@ddd-ts/store-firestore 0.0.37 → 0.0.38
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/LICENSE +21 -0
- package/dist/asyncTools.d.ts +3 -0
- package/dist/asyncTools.d.ts.map +1 -0
- package/dist/asyncTools.js +16 -0
- package/dist/asyncTools.mjs +15 -0
- package/dist/asyncTools.spec.d.ts +2 -0
- package/dist/asyncTools.spec.d.ts.map +1 -0
- package/dist/converter.d.ts +13 -0
- package/dist/converter.d.ts.map +1 -0
- package/dist/converter.js +62 -0
- package/dist/converter.mjs +62 -0
- package/dist/firestore.store.d.ts +26 -0
- package/dist/firestore.store.d.ts.map +1 -0
- package/dist/firestore.store.js +100 -0
- package/dist/firestore.store.mjs +100 -0
- package/dist/firestore.store.spec.d.ts +2 -0
- package/dist/firestore.store.spec.d.ts.map +1 -0
- package/dist/firestore.transaction.d.ts +15 -0
- package/dist/firestore.transaction.d.ts.map +1 -0
- package/dist/firestore.transaction.js +29 -0
- package/dist/firestore.transaction.mjs +28 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.mjs +5 -0
- package/dist/shape/src/addons/microsecond-timestamp.js +62 -0
- package/dist/shape/src/addons/microsecond-timestamp.mjs +61 -0
- package/dist/shape/src/index.js +1 -0
- package/dist/shape/src/index.mjs +3 -0
- package/package.json +33 -31
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Aetherall
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncTools.d.ts","sourceRoot":"","sources":["../src/asyncTools.ts"],"names":[],"mappings":"AAAA,wBAAuB,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,6CA0B9D;AAED,wBAAuB,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,+CAavE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/asyncTools.ts
|
|
3
|
+
async function* batch(iterator, size) {
|
|
4
|
+
let batch = [];
|
|
5
|
+
for await (const item of iterator) {
|
|
6
|
+
batch.push(item);
|
|
7
|
+
if (batch.length === size) {
|
|
8
|
+
yield batch;
|
|
9
|
+
batch = [];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (batch.length > 0) yield batch;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.batch = batch;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/asyncTools.ts
|
|
2
|
+
async function* batch(iterator, size) {
|
|
3
|
+
let batch = [];
|
|
4
|
+
for await (const item of iterator) {
|
|
5
|
+
batch.push(item);
|
|
6
|
+
if (batch.length === size) {
|
|
7
|
+
yield batch;
|
|
8
|
+
batch = [];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
if (batch.length > 0) yield batch;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { batch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncTools.spec.d.ts","sourceRoot":"","sources":["../src/asyncTools.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type FirestoreDataConverter } from "firebase-admin/firestore";
|
|
2
|
+
export declare class DefaultConverter<T extends FirebaseFirestore.DocumentData> implements FirestoreDataConverter<T> {
|
|
3
|
+
toFirestore(modelObject: T): FirebaseFirestore.DocumentData;
|
|
4
|
+
fromFirestore(snapshot: FirebaseFirestore.QueryDocumentSnapshot): T;
|
|
5
|
+
fromFirestoreSnapshot(snapshot: FirebaseFirestore.DocumentSnapshot): T | undefined;
|
|
6
|
+
toFirestorePartial(modelObject: Partial<T> | FirebaseFirestore.UpdateData<T>): FirebaseFirestore.UpdateData<T>;
|
|
7
|
+
}
|
|
8
|
+
export declare function toFirestore<T>(obj: T): T;
|
|
9
|
+
/**
|
|
10
|
+
* decode Firebase timestamps into Dates
|
|
11
|
+
*/
|
|
12
|
+
export declare function decodeFirebaseTimestamps(obj: FirebaseFirestore.DocumentData): FirebaseFirestore.DocumentData;
|
|
13
|
+
//# sourceMappingURL=converter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,sBAAsB,EAE5B,MAAM,0BAA0B,CAAC;AAElC,qBAAa,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,CAAC,YAAY,CACpE,YAAW,sBAAsB,CAAC,CAAC,CAAC;IAE7B,WAAW,CAAC,WAAW,EAAE,CAAC,GAAG,iBAAiB,CAAC,YAAY;IAI3D,aAAa,CAAC,QAAQ,EAAE,iBAAiB,CAAC,qBAAqB,GAAG,CAAC;IAInE,qBAAqB,CAC1B,QAAQ,EAAE,iBAAiB,CAAC,gBAAgB,GAC3C,CAAC,GAAG,SAAS;IAQT,kBAAkB,CACvB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,GACxD,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;CAGnC;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAmCxC;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,iBAAiB,CAAC,YAAY,GAClC,iBAAiB,CAAC,YAAY,CAgChC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require('./shape/src/index.js');
|
|
2
|
+
let firebase_admin_firestore = require("firebase-admin/firestore");
|
|
3
|
+
|
|
4
|
+
//#region src/converter.ts
|
|
5
|
+
var DefaultConverter = class {
|
|
6
|
+
toFirestore(modelObject) {
|
|
7
|
+
return toFirestore(modelObject);
|
|
8
|
+
}
|
|
9
|
+
fromFirestore(snapshot) {
|
|
10
|
+
return decodeFirebaseTimestamps(snapshot.data());
|
|
11
|
+
}
|
|
12
|
+
fromFirestoreSnapshot(snapshot) {
|
|
13
|
+
const data = snapshot.data();
|
|
14
|
+
if (!data) return;
|
|
15
|
+
return decodeFirebaseTimestamps(data);
|
|
16
|
+
}
|
|
17
|
+
toFirestorePartial(modelObject) {
|
|
18
|
+
return toFirestore(modelObject);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function toFirestore(obj) {
|
|
22
|
+
if (obj instanceof Date) {
|
|
23
|
+
if ("microseconds" in obj && typeof obj.microseconds === "bigint") {
|
|
24
|
+
const microseconds = obj.microseconds;
|
|
25
|
+
const seconds = microseconds / 1000000n;
|
|
26
|
+
const nanoseconds = microseconds % 1000000n * 1000n;
|
|
27
|
+
return new firebase_admin_firestore.Timestamp(Number(seconds), Number(nanoseconds));
|
|
28
|
+
}
|
|
29
|
+
return obj;
|
|
30
|
+
}
|
|
31
|
+
if (obj instanceof firebase_admin_firestore.FieldValue || obj?.constructor?.name === "VectorValue") return obj;
|
|
32
|
+
if (Array.isArray(obj)) return obj.map(toFirestore);
|
|
33
|
+
if (obj instanceof Object) return Object.entries(obj).reduce((map, [key, value]) => {
|
|
34
|
+
if (value !== void 0) map[key] = toFirestore(value);
|
|
35
|
+
return map;
|
|
36
|
+
}, {});
|
|
37
|
+
return obj;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* decode Firebase timestamps into Dates
|
|
41
|
+
*/
|
|
42
|
+
function decodeFirebaseTimestamps(obj) {
|
|
43
|
+
if (obj instanceof Date) return obj;
|
|
44
|
+
if (obj?.toDate) {
|
|
45
|
+
const result = obj.toDate();
|
|
46
|
+
if (obj?.seconds !== void 0 && obj?.nanoseconds !== void 0) {
|
|
47
|
+
result.microseconds = BigInt(obj.seconds) * BigInt(1e6) + BigInt(obj.nanoseconds) / BigInt(1e3);
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
if (obj?.constructor?.name === "VectorValue") return obj;
|
|
53
|
+
if (Array.isArray(obj)) return obj.map(decodeFirebaseTimestamps);
|
|
54
|
+
if (obj instanceof Object) return Object.entries(obj).reduce((map, [key, value]) => {
|
|
55
|
+
map[key] = decodeFirebaseTimestamps(value);
|
|
56
|
+
return map;
|
|
57
|
+
}, {});
|
|
58
|
+
return obj;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.DefaultConverter = DefaultConverter;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import "./shape/src/index.mjs";
|
|
2
|
+
import { FieldValue, Timestamp } from "firebase-admin/firestore";
|
|
3
|
+
|
|
4
|
+
//#region src/converter.ts
|
|
5
|
+
var DefaultConverter = class {
|
|
6
|
+
toFirestore(modelObject) {
|
|
7
|
+
return toFirestore(modelObject);
|
|
8
|
+
}
|
|
9
|
+
fromFirestore(snapshot) {
|
|
10
|
+
return decodeFirebaseTimestamps(snapshot.data());
|
|
11
|
+
}
|
|
12
|
+
fromFirestoreSnapshot(snapshot) {
|
|
13
|
+
const data = snapshot.data();
|
|
14
|
+
if (!data) return;
|
|
15
|
+
return decodeFirebaseTimestamps(data);
|
|
16
|
+
}
|
|
17
|
+
toFirestorePartial(modelObject) {
|
|
18
|
+
return toFirestore(modelObject);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function toFirestore(obj) {
|
|
22
|
+
if (obj instanceof Date) {
|
|
23
|
+
if ("microseconds" in obj && typeof obj.microseconds === "bigint") {
|
|
24
|
+
const microseconds = obj.microseconds;
|
|
25
|
+
const seconds = microseconds / 1000000n;
|
|
26
|
+
const nanoseconds = microseconds % 1000000n * 1000n;
|
|
27
|
+
return new Timestamp(Number(seconds), Number(nanoseconds));
|
|
28
|
+
}
|
|
29
|
+
return obj;
|
|
30
|
+
}
|
|
31
|
+
if (obj instanceof FieldValue || obj?.constructor?.name === "VectorValue") return obj;
|
|
32
|
+
if (Array.isArray(obj)) return obj.map(toFirestore);
|
|
33
|
+
if (obj instanceof Object) return Object.entries(obj).reduce((map, [key, value]) => {
|
|
34
|
+
if (value !== void 0) map[key] = toFirestore(value);
|
|
35
|
+
return map;
|
|
36
|
+
}, {});
|
|
37
|
+
return obj;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* decode Firebase timestamps into Dates
|
|
41
|
+
*/
|
|
42
|
+
function decodeFirebaseTimestamps(obj) {
|
|
43
|
+
if (obj instanceof Date) return obj;
|
|
44
|
+
if (obj?.toDate) {
|
|
45
|
+
const result = obj.toDate();
|
|
46
|
+
if (obj?.seconds !== void 0 && obj?.nanoseconds !== void 0) {
|
|
47
|
+
result.microseconds = BigInt(obj.seconds) * BigInt(1e6) + BigInt(obj.nanoseconds) / BigInt(1e3);
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
if (obj?.constructor?.name === "VectorValue") return obj;
|
|
53
|
+
if (Array.isArray(obj)) return obj.map(decodeFirebaseTimestamps);
|
|
54
|
+
if (obj instanceof Object) return Object.entries(obj).reduce((map, [key, value]) => {
|
|
55
|
+
map[key] = decodeFirebaseTimestamps(value);
|
|
56
|
+
return map;
|
|
57
|
+
}, {});
|
|
58
|
+
return obj;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { DefaultConverter };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CollectionReference, type DocumentData, QueryDocumentSnapshot } from "firebase-admin/firestore";
|
|
2
|
+
import type { Store, ISerializer, IIdentifiable, Serialized } from "@ddd-ts/core";
|
|
3
|
+
import { FirestoreTransaction } from "./firestore.transaction";
|
|
4
|
+
import { DefaultConverter } from "./converter";
|
|
5
|
+
export declare class FirestoreStore<M extends IIdentifiable, S extends ISerializer<M> = ISerializer<M>> implements Store<M> {
|
|
6
|
+
readonly _collection: CollectionReference;
|
|
7
|
+
readonly serializer: S;
|
|
8
|
+
readonly $name?: string | undefined;
|
|
9
|
+
defaultConverter: DefaultConverter<DocumentData>;
|
|
10
|
+
constructor(_collection: CollectionReference, serializer: S, $name?: string | undefined);
|
|
11
|
+
get firestore(): FirebaseFirestore.Firestore;
|
|
12
|
+
get collection(): CollectionReference<Serialized<S>, Serialized<S>>;
|
|
13
|
+
executeQuery(query: FirebaseFirestore.Query<any>, trx?: FirestoreTransaction): Promise<M[]>;
|
|
14
|
+
streamPages(query: FirebaseFirestore.Query<any>, pageSize: number): AsyncGenerator<QueryDocumentSnapshot<any, DocumentData>, void, unknown>;
|
|
15
|
+
streamQuery(query: FirebaseFirestore.Query<any>, pageSize?: number): AsyncIterable<M>;
|
|
16
|
+
save(model: M, trx?: FirestoreTransaction): Promise<void>;
|
|
17
|
+
saveAll(models: M[], trx?: FirestoreTransaction): Promise<void>;
|
|
18
|
+
load(id: M["id"], trx?: FirestoreTransaction): Promise<M | undefined>;
|
|
19
|
+
loadAll(transaction?: FirestoreTransaction): Promise<M[]>;
|
|
20
|
+
delete(id: M["id"], trx?: FirestoreTransaction): Promise<void>;
|
|
21
|
+
loadMany(ids: M["id"][], trx?: FirestoreTransaction): Promise<M[]>;
|
|
22
|
+
streamAll(pageSize?: number): AsyncIterable<M>;
|
|
23
|
+
countAll(): Promise<number>;
|
|
24
|
+
count(query: FirebaseFirestore.Query<DocumentData>): Promise<number>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=firestore.store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestore.store.d.ts","sourceRoot":"","sources":["../src/firestore.store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,YAAY,EACjB,qBAAqB,EAEtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,aAAa,EACb,UAAU,EACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,qBAAa,cAAc,CACzB,CAAC,SAAS,aAAa,EACvB,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CACzC,YAAW,KAAK,CAAC,CAAC,CAAC;aAID,WAAW,EAAE,mBAAmB;aAChC,UAAU,EAAE,CAAC;aACb,KAAK,CAAC,EAAE,MAAM;IAJzB,gBAAgB,iCAA0B;gBAE/B,WAAW,EAAE,mBAAmB,EAChC,UAAU,EAAE,CAAC,EACb,KAAK,CAAC,EAAE,MAAM,YAAA;IAGhC,IAAI,SAAS,gCAEZ;IAED,IAAI,UAAU,IAGP,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CACvD;IAEK,YAAY,CAChB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,EACnC,GAAG,CAAC,EAAE,oBAAoB,GACzB,OAAO,CAAC,CAAC,EAAE,CAAC;IAcR,WAAW,CAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM;IAyBjE,WAAW,CAChB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,EACnC,QAAQ,CAAC,EAAE,MAAM,GAChB,aAAa,CAAC,CAAC,CAAC;IAsBb,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAUzD,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/D,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAgBrE,OAAO,CAAC,WAAW,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAmBzD,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ9D,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAKxE,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC;IAIxC,QAAQ;IAIR,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,YAAY,CAAC;CAGzD"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
require('./firestore.transaction.js');
|
|
2
|
+
const require_asyncTools = require('./asyncTools.js');
|
|
3
|
+
const require_converter = require('./converter.js');
|
|
4
|
+
let firebase_admin_firestore = require("firebase-admin/firestore");
|
|
5
|
+
|
|
6
|
+
//#region src/firestore.store.ts
|
|
7
|
+
var FirestoreStore = class {
|
|
8
|
+
defaultConverter = new require_converter.DefaultConverter();
|
|
9
|
+
constructor(_collection, serializer, $name) {
|
|
10
|
+
this._collection = _collection;
|
|
11
|
+
this.serializer = serializer;
|
|
12
|
+
this.$name = $name;
|
|
13
|
+
}
|
|
14
|
+
get firestore() {
|
|
15
|
+
return this._collection.firestore;
|
|
16
|
+
}
|
|
17
|
+
get collection() {
|
|
18
|
+
return this._collection.withConverter(this.defaultConverter);
|
|
19
|
+
}
|
|
20
|
+
async executeQuery(query, trx) {
|
|
21
|
+
const result = trx ? await trx.transaction.get(query) : await query.get();
|
|
22
|
+
return Promise.all(result.docs.map((doc) => this.serializer.deserialize({
|
|
23
|
+
...this.$name ? { $name: this.$name } : {},
|
|
24
|
+
id: doc.id,
|
|
25
|
+
...doc.data()
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
async *streamPages(query, pageSize) {
|
|
29
|
+
let last;
|
|
30
|
+
let nextPagePromise;
|
|
31
|
+
function getNextPagePromise(cursor) {
|
|
32
|
+
return cursor ? query.limit(pageSize).startAfter(cursor).get() : query.limit(pageSize).get();
|
|
33
|
+
}
|
|
34
|
+
do {
|
|
35
|
+
const { docs } = await (nextPagePromise ?? getNextPagePromise(last));
|
|
36
|
+
last = docs[pageSize - 1];
|
|
37
|
+
if (last) nextPagePromise = getNextPagePromise(last);
|
|
38
|
+
for (const doc of docs) yield doc;
|
|
39
|
+
} while (last);
|
|
40
|
+
}
|
|
41
|
+
async *streamQuery(query, pageSize) {
|
|
42
|
+
const finalPageSize = pageSize ?? 50;
|
|
43
|
+
const stream = finalPageSize === 1 ? query.stream() : this.streamPages(query, finalPageSize);
|
|
44
|
+
for await (const docs of require_asyncTools.batch(stream, finalPageSize)) {
|
|
45
|
+
const deserializedDocs = await Promise.all(docs.map((doc) => this.serializer.deserialize({
|
|
46
|
+
...this.$name ? { $name: this.$name } : {},
|
|
47
|
+
id: doc.id,
|
|
48
|
+
...doc.data()
|
|
49
|
+
})));
|
|
50
|
+
for (const deserializedDoc of deserializedDocs) yield deserializedDoc;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async save(model, trx) {
|
|
54
|
+
const serialized = await this.serializer.serialize(model);
|
|
55
|
+
const ref = this.collection.doc(model.id.serialize());
|
|
56
|
+
trx ? trx.transaction.set(ref, serialized) : await ref.set(serialized);
|
|
57
|
+
}
|
|
58
|
+
async saveAll(models, trx) {
|
|
59
|
+
await Promise.all(models.map((m) => this.save(m, trx)));
|
|
60
|
+
}
|
|
61
|
+
async load(id, trx) {
|
|
62
|
+
const ref = this.collection.doc(id.serialize());
|
|
63
|
+
const snapshot = trx ? await trx.transaction.get(ref) : await ref.get();
|
|
64
|
+
if (!snapshot.exists) return;
|
|
65
|
+
return this.serializer.deserialize({
|
|
66
|
+
...this.$name ? { $name: this.$name } : {},
|
|
67
|
+
id: id.serialize(),
|
|
68
|
+
...snapshot.data()
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async loadAll(transaction) {
|
|
72
|
+
let docs;
|
|
73
|
+
if (transaction) docs = await transaction.transaction.getAll();
|
|
74
|
+
else ({docs} = await this.collection.get());
|
|
75
|
+
return Promise.all(docs.map((doc) => this.serializer.deserialize({
|
|
76
|
+
...this.$name ? { $name: this.$name } : {},
|
|
77
|
+
id: doc.id,
|
|
78
|
+
...doc.data()
|
|
79
|
+
})));
|
|
80
|
+
}
|
|
81
|
+
async delete(id, trx) {
|
|
82
|
+
if (trx) trx.transaction.delete(this.collection.doc(id.serialize()));
|
|
83
|
+
else await this.collection.doc(id.serialize()).delete();
|
|
84
|
+
}
|
|
85
|
+
async loadMany(ids, trx) {
|
|
86
|
+
return (await Promise.all(ids.map((id) => this.load(id, trx)))).filter((m) => m !== void 0);
|
|
87
|
+
}
|
|
88
|
+
streamAll(pageSize) {
|
|
89
|
+
return this.streamQuery(this.collection, pageSize);
|
|
90
|
+
}
|
|
91
|
+
async countAll() {
|
|
92
|
+
return (await this.collection.count().get()).data().count;
|
|
93
|
+
}
|
|
94
|
+
async count(query) {
|
|
95
|
+
return (await query.count().get()).data().count;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
exports.FirestoreStore = FirestoreStore;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import "./firestore.transaction.mjs";
|
|
2
|
+
import { batch } from "./asyncTools.mjs";
|
|
3
|
+
import { DefaultConverter } from "./converter.mjs";
|
|
4
|
+
import "firebase-admin/firestore";
|
|
5
|
+
|
|
6
|
+
//#region src/firestore.store.ts
|
|
7
|
+
var FirestoreStore = class {
|
|
8
|
+
defaultConverter = new DefaultConverter();
|
|
9
|
+
constructor(_collection, serializer, $name) {
|
|
10
|
+
this._collection = _collection;
|
|
11
|
+
this.serializer = serializer;
|
|
12
|
+
this.$name = $name;
|
|
13
|
+
}
|
|
14
|
+
get firestore() {
|
|
15
|
+
return this._collection.firestore;
|
|
16
|
+
}
|
|
17
|
+
get collection() {
|
|
18
|
+
return this._collection.withConverter(this.defaultConverter);
|
|
19
|
+
}
|
|
20
|
+
async executeQuery(query, trx) {
|
|
21
|
+
const result = trx ? await trx.transaction.get(query) : await query.get();
|
|
22
|
+
return Promise.all(result.docs.map((doc) => this.serializer.deserialize({
|
|
23
|
+
...this.$name ? { $name: this.$name } : {},
|
|
24
|
+
id: doc.id,
|
|
25
|
+
...doc.data()
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
async *streamPages(query, pageSize) {
|
|
29
|
+
let last;
|
|
30
|
+
let nextPagePromise;
|
|
31
|
+
function getNextPagePromise(cursor) {
|
|
32
|
+
return cursor ? query.limit(pageSize).startAfter(cursor).get() : query.limit(pageSize).get();
|
|
33
|
+
}
|
|
34
|
+
do {
|
|
35
|
+
const { docs } = await (nextPagePromise ?? getNextPagePromise(last));
|
|
36
|
+
last = docs[pageSize - 1];
|
|
37
|
+
if (last) nextPagePromise = getNextPagePromise(last);
|
|
38
|
+
for (const doc of docs) yield doc;
|
|
39
|
+
} while (last);
|
|
40
|
+
}
|
|
41
|
+
async *streamQuery(query, pageSize) {
|
|
42
|
+
const finalPageSize = pageSize ?? 50;
|
|
43
|
+
const stream = finalPageSize === 1 ? query.stream() : this.streamPages(query, finalPageSize);
|
|
44
|
+
for await (const docs of batch(stream, finalPageSize)) {
|
|
45
|
+
const deserializedDocs = await Promise.all(docs.map((doc) => this.serializer.deserialize({
|
|
46
|
+
...this.$name ? { $name: this.$name } : {},
|
|
47
|
+
id: doc.id,
|
|
48
|
+
...doc.data()
|
|
49
|
+
})));
|
|
50
|
+
for (const deserializedDoc of deserializedDocs) yield deserializedDoc;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async save(model, trx) {
|
|
54
|
+
const serialized = await this.serializer.serialize(model);
|
|
55
|
+
const ref = this.collection.doc(model.id.serialize());
|
|
56
|
+
trx ? trx.transaction.set(ref, serialized) : await ref.set(serialized);
|
|
57
|
+
}
|
|
58
|
+
async saveAll(models, trx) {
|
|
59
|
+
await Promise.all(models.map((m) => this.save(m, trx)));
|
|
60
|
+
}
|
|
61
|
+
async load(id, trx) {
|
|
62
|
+
const ref = this.collection.doc(id.serialize());
|
|
63
|
+
const snapshot = trx ? await trx.transaction.get(ref) : await ref.get();
|
|
64
|
+
if (!snapshot.exists) return;
|
|
65
|
+
return this.serializer.deserialize({
|
|
66
|
+
...this.$name ? { $name: this.$name } : {},
|
|
67
|
+
id: id.serialize(),
|
|
68
|
+
...snapshot.data()
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async loadAll(transaction) {
|
|
72
|
+
let docs;
|
|
73
|
+
if (transaction) docs = await transaction.transaction.getAll();
|
|
74
|
+
else ({docs} = await this.collection.get());
|
|
75
|
+
return Promise.all(docs.map((doc) => this.serializer.deserialize({
|
|
76
|
+
...this.$name ? { $name: this.$name } : {},
|
|
77
|
+
id: doc.id,
|
|
78
|
+
...doc.data()
|
|
79
|
+
})));
|
|
80
|
+
}
|
|
81
|
+
async delete(id, trx) {
|
|
82
|
+
if (trx) trx.transaction.delete(this.collection.doc(id.serialize()));
|
|
83
|
+
else await this.collection.doc(id.serialize()).delete();
|
|
84
|
+
}
|
|
85
|
+
async loadMany(ids, trx) {
|
|
86
|
+
return (await Promise.all(ids.map((id) => this.load(id, trx)))).filter((m) => m !== void 0);
|
|
87
|
+
}
|
|
88
|
+
streamAll(pageSize) {
|
|
89
|
+
return this.streamQuery(this.collection, pageSize);
|
|
90
|
+
}
|
|
91
|
+
async countAll() {
|
|
92
|
+
return (await this.collection.count().get()).data().count;
|
|
93
|
+
}
|
|
94
|
+
async count(query) {
|
|
95
|
+
return (await query.count().get()).data().count;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { FirestoreStore };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestore.store.spec.d.ts","sourceRoot":"","sources":["../src/firestore.store.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Firestore, Transaction as FirebaseTransaction } from "firebase-admin/firestore";
|
|
2
|
+
import { TransactionPerformer, type Transaction, type CommitListener } from "@ddd-ts/core";
|
|
3
|
+
export declare class FirestoreTransaction implements Transaction {
|
|
4
|
+
readonly transaction: FirebaseTransaction;
|
|
5
|
+
commitListeners: CommitListener[];
|
|
6
|
+
constructor(transaction: FirebaseTransaction);
|
|
7
|
+
counter: number;
|
|
8
|
+
increment(): number;
|
|
9
|
+
onCommit(callback: CommitListener): void;
|
|
10
|
+
executeCommitListeners(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare class FirestoreTransactionPerformer extends TransactionPerformer<FirestoreTransaction> {
|
|
13
|
+
constructor(db: Firestore);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=firestore.transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestore.transaction.d.ts","sourceRoot":"","sources":["../src/firestore.transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,IAAI,mBAAmB,EACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB,qBAAa,oBAAqB,YAAW,WAAW;aAE1B,WAAW,EAAE,mBAAmB;IAD5D,eAAe,EAAE,cAAc,EAAE,CAAM;gBACX,WAAW,EAAE,mBAAmB;IAE5D,OAAO,SAAM;IAEb,SAAS;IAKT,QAAQ,CAAC,QAAQ,EAAE,cAAc;IAI3B,sBAAsB;CAG7B;AAED,qBAAa,6BAA8B,SAAQ,oBAAoB,CAAC,oBAAoB,CAAC;gBAC/E,EAAE,EAAE,SAAS;CAK1B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
let _ddd_ts_core = require("@ddd-ts/core");
|
|
2
|
+
|
|
3
|
+
//#region src/firestore.transaction.ts
|
|
4
|
+
var FirestoreTransaction = class {
|
|
5
|
+
commitListeners = [];
|
|
6
|
+
constructor(transaction) {
|
|
7
|
+
this.transaction = transaction;
|
|
8
|
+
}
|
|
9
|
+
counter = -1;
|
|
10
|
+
increment() {
|
|
11
|
+
this.counter++;
|
|
12
|
+
return this.counter;
|
|
13
|
+
}
|
|
14
|
+
onCommit(callback) {
|
|
15
|
+
this.commitListeners.push(callback);
|
|
16
|
+
}
|
|
17
|
+
async executeCommitListeners() {
|
|
18
|
+
await Promise.all(this.commitListeners.map((cb) => cb()));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var FirestoreTransactionPerformer = class extends _ddd_ts_core.TransactionPerformer {
|
|
22
|
+
constructor(db) {
|
|
23
|
+
super((effect) => db.runTransaction((trx) => effect(new FirestoreTransaction(trx))));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.FirestoreTransaction = FirestoreTransaction;
|
|
29
|
+
exports.FirestoreTransactionPerformer = FirestoreTransactionPerformer;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TransactionPerformer } from "@ddd-ts/core";
|
|
2
|
+
|
|
3
|
+
//#region src/firestore.transaction.ts
|
|
4
|
+
var FirestoreTransaction = class {
|
|
5
|
+
commitListeners = [];
|
|
6
|
+
constructor(transaction) {
|
|
7
|
+
this.transaction = transaction;
|
|
8
|
+
}
|
|
9
|
+
counter = -1;
|
|
10
|
+
increment() {
|
|
11
|
+
this.counter++;
|
|
12
|
+
return this.counter;
|
|
13
|
+
}
|
|
14
|
+
onCommit(callback) {
|
|
15
|
+
this.commitListeners.push(callback);
|
|
16
|
+
}
|
|
17
|
+
async executeCommitListeners() {
|
|
18
|
+
await Promise.all(this.commitListeners.map((cb) => cb()));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var FirestoreTransactionPerformer = class extends TransactionPerformer {
|
|
22
|
+
constructor(db) {
|
|
23
|
+
super((effect) => db.runTransaction((trx) => effect(new FirestoreTransaction(trx))));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { FirestoreTransaction, FirestoreTransactionPerformer };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_firestore_transaction = require('./firestore.transaction.js');
|
|
3
|
+
const require_converter = require('./converter.js');
|
|
4
|
+
const require_firestore_store = require('./firestore.store.js');
|
|
5
|
+
|
|
6
|
+
exports.DefaultConverter = require_converter.DefaultConverter;
|
|
7
|
+
exports.FirestoreStore = require_firestore_store.FirestoreStore;
|
|
8
|
+
exports.FirestoreTransaction = require_firestore_transaction.FirestoreTransaction;
|
|
9
|
+
exports.FirestoreTransactionPerformer = require_firestore_transaction.FirestoreTransactionPerformer;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FirestoreTransaction, FirestoreTransactionPerformer } from "./firestore.transaction.mjs";
|
|
2
|
+
import { DefaultConverter } from "./converter.mjs";
|
|
3
|
+
import { FirestoreStore } from "./firestore.store.mjs";
|
|
4
|
+
|
|
5
|
+
export { DefaultConverter, FirestoreStore, FirestoreTransaction, FirestoreTransactionPerformer };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../shape/src/addons/microsecond-timestamp.ts
|
|
3
|
+
var MicrosecondTimestamp = class MicrosecondTimestamp {
|
|
4
|
+
static MILLISECOND = new MicrosecondTimestamp(BigInt(1e3));
|
|
5
|
+
static SECOND = this.MILLISECOND.mult(1e3);
|
|
6
|
+
static MINUTE = this.SECOND.mult(60);
|
|
7
|
+
static HOUR = this.MINUTE.mult(60);
|
|
8
|
+
static DAY = this.HOUR.mult(24);
|
|
9
|
+
static WEEK = this.DAY.mult(7);
|
|
10
|
+
static MONTH = this.DAY.mult(30);
|
|
11
|
+
constructor(micros) {
|
|
12
|
+
this.micros = micros;
|
|
13
|
+
}
|
|
14
|
+
isAfter(other) {
|
|
15
|
+
return this.micros > other.micros;
|
|
16
|
+
}
|
|
17
|
+
equals(other) {
|
|
18
|
+
return this.micros === other.micros;
|
|
19
|
+
}
|
|
20
|
+
isBefore(other) {
|
|
21
|
+
return this.micros < other.micros;
|
|
22
|
+
}
|
|
23
|
+
add(micros) {
|
|
24
|
+
const value = micros instanceof MicrosecondTimestamp ? micros.micros : micros;
|
|
25
|
+
return new MicrosecondTimestamp(this.micros + value);
|
|
26
|
+
}
|
|
27
|
+
sub(micros) {
|
|
28
|
+
const value = micros instanceof MicrosecondTimestamp ? micros.micros : micros;
|
|
29
|
+
return new MicrosecondTimestamp(this.micros - value);
|
|
30
|
+
}
|
|
31
|
+
mult(factor) {
|
|
32
|
+
return new MicrosecondTimestamp(this.micros * BigInt(factor));
|
|
33
|
+
}
|
|
34
|
+
static now() {
|
|
35
|
+
return new MicrosecondTimestamp(BigInt(Date.now()) * BigInt(1e3));
|
|
36
|
+
}
|
|
37
|
+
static fromNanoseconds(nanoseconds) {
|
|
38
|
+
return new MicrosecondTimestamp(nanoseconds / BigInt(1e3));
|
|
39
|
+
}
|
|
40
|
+
static fromMicroseconds(microseconds) {
|
|
41
|
+
return new MicrosecondTimestamp(microseconds);
|
|
42
|
+
}
|
|
43
|
+
static deserialize(serialized) {
|
|
44
|
+
if (serialized instanceof MicrosecondTimestamp) return serialized;
|
|
45
|
+
if (typeof serialized === "bigint") return new MicrosecondTimestamp(serialized);
|
|
46
|
+
if ("microseconds" in serialized && typeof serialized.microseconds === "bigint") return new MicrosecondTimestamp(serialized.microseconds);
|
|
47
|
+
return new MicrosecondTimestamp(BigInt(serialized.getTime()) * BigInt(1e3));
|
|
48
|
+
}
|
|
49
|
+
serialize() {
|
|
50
|
+
const date = new Date(Number(this.micros / BigInt(1e3)));
|
|
51
|
+
date.microseconds = this.micros;
|
|
52
|
+
return date;
|
|
53
|
+
}
|
|
54
|
+
static sort(left, right) {
|
|
55
|
+
if (left.isAfter(right)) return 1;
|
|
56
|
+
if (left.isBefore(right)) return -1;
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.MicrosecondTimestamp = MicrosecondTimestamp;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//#region ../shape/src/addons/microsecond-timestamp.ts
|
|
2
|
+
var MicrosecondTimestamp = class MicrosecondTimestamp {
|
|
3
|
+
static MILLISECOND = new MicrosecondTimestamp(BigInt(1e3));
|
|
4
|
+
static SECOND = this.MILLISECOND.mult(1e3);
|
|
5
|
+
static MINUTE = this.SECOND.mult(60);
|
|
6
|
+
static HOUR = this.MINUTE.mult(60);
|
|
7
|
+
static DAY = this.HOUR.mult(24);
|
|
8
|
+
static WEEK = this.DAY.mult(7);
|
|
9
|
+
static MONTH = this.DAY.mult(30);
|
|
10
|
+
constructor(micros) {
|
|
11
|
+
this.micros = micros;
|
|
12
|
+
}
|
|
13
|
+
isAfter(other) {
|
|
14
|
+
return this.micros > other.micros;
|
|
15
|
+
}
|
|
16
|
+
equals(other) {
|
|
17
|
+
return this.micros === other.micros;
|
|
18
|
+
}
|
|
19
|
+
isBefore(other) {
|
|
20
|
+
return this.micros < other.micros;
|
|
21
|
+
}
|
|
22
|
+
add(micros) {
|
|
23
|
+
const value = micros instanceof MicrosecondTimestamp ? micros.micros : micros;
|
|
24
|
+
return new MicrosecondTimestamp(this.micros + value);
|
|
25
|
+
}
|
|
26
|
+
sub(micros) {
|
|
27
|
+
const value = micros instanceof MicrosecondTimestamp ? micros.micros : micros;
|
|
28
|
+
return new MicrosecondTimestamp(this.micros - value);
|
|
29
|
+
}
|
|
30
|
+
mult(factor) {
|
|
31
|
+
return new MicrosecondTimestamp(this.micros * BigInt(factor));
|
|
32
|
+
}
|
|
33
|
+
static now() {
|
|
34
|
+
return new MicrosecondTimestamp(BigInt(Date.now()) * BigInt(1e3));
|
|
35
|
+
}
|
|
36
|
+
static fromNanoseconds(nanoseconds) {
|
|
37
|
+
return new MicrosecondTimestamp(nanoseconds / BigInt(1e3));
|
|
38
|
+
}
|
|
39
|
+
static fromMicroseconds(microseconds) {
|
|
40
|
+
return new MicrosecondTimestamp(microseconds);
|
|
41
|
+
}
|
|
42
|
+
static deserialize(serialized) {
|
|
43
|
+
if (serialized instanceof MicrosecondTimestamp) return serialized;
|
|
44
|
+
if (typeof serialized === "bigint") return new MicrosecondTimestamp(serialized);
|
|
45
|
+
if ("microseconds" in serialized && typeof serialized.microseconds === "bigint") return new MicrosecondTimestamp(serialized.microseconds);
|
|
46
|
+
return new MicrosecondTimestamp(BigInt(serialized.getTime()) * BigInt(1e3));
|
|
47
|
+
}
|
|
48
|
+
serialize() {
|
|
49
|
+
const date = new Date(Number(this.micros / BigInt(1e3)));
|
|
50
|
+
date.microseconds = this.micros;
|
|
51
|
+
return date;
|
|
52
|
+
}
|
|
53
|
+
static sort(left, right) {
|
|
54
|
+
if (left.isAfter(right)) return 1;
|
|
55
|
+
if (left.isBefore(right)) return -1;
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { MicrosecondTimestamp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const require_microsecond_timestamp = require('./addons/microsecond-timestamp.js');
|
package/package.json
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
"name": "@ddd-ts/store-firestore",
|
|
3
|
+
"version": "0.0.38",
|
|
4
|
+
"types": "dist/index.d.ts",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "git+https://github.com/ddd-ts/monorepo"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@ddd-ts/core": "0.0.38",
|
|
14
|
+
"firebase-admin": "^13.2.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@ddd-ts/shape": "0.0.38",
|
|
18
|
+
"@ddd-ts/tools": "0.0.38",
|
|
19
|
+
"@ddd-ts/types": "0.0.38",
|
|
20
|
+
"@types/jest": "^29.5.1"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./dist/index.mjs",
|
|
25
|
+
"require": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"module": "./dist/index.mjs",
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsdown --config node_modules/@ddd-ts/tools/tsdown.config.js"
|
|
33
|
+
}
|
|
34
|
+
}
|