@nx-ddd/firestore 18.13.0-preview-v19f.1 → 19.0.0-preview-merge-graphql-enhanced-to-graphql.1
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/admin/index.d.ts +40 -1
- package/adapters/firebase/index.d.ts +35 -1
- package/{adapters/admin/admin.adapter.js → fesm2022/nx-ddd-firestore-adapters-admin.mjs} +23 -22
- package/fesm2022/nx-ddd-firestore-adapters-admin.mjs.map +1 -0
- package/{adapters/firebase/firebase.adapter.js → fesm2022/nx-ddd-firestore-adapters-firebase.mjs} +20 -23
- package/fesm2022/nx-ddd-firestore-adapters-firebase.mjs.map +1 -0
- package/fesm2022/nx-ddd-firestore.mjs +796 -0
- package/fesm2022/nx-ddd-firestore.mjs.map +1 -0
- package/index.d.ts +424 -7
- package/package.json +26 -19
- package/README.md +0 -96
- package/adapters/admin/admin.adapter.d.ts +0 -39
- package/adapters/admin/admin.adapter.js.map +0 -1
- package/adapters/admin/index.js +0 -2
- package/adapters/admin/index.js.map +0 -1
- package/adapters/base/base.adapter.d.ts +0 -34
- package/adapters/base/base.adapter.js +0 -173
- package/adapters/base/base.adapter.js.map +0 -1
- package/adapters/base/index.d.ts +0 -1
- package/adapters/base/index.js +0 -2
- package/adapters/base/index.js.map +0 -1
- package/adapters/firebase/firebase.adapter.d.ts +0 -36
- package/adapters/firebase/firebase.adapter.js.map +0 -1
- package/adapters/firebase/index.js +0 -2
- package/adapters/firebase/index.js.map +0 -1
- package/adapters/index.d.ts +0 -1
- package/adapters/index.js +0 -2
- package/adapters/index.js.map +0 -1
- package/converter/converter.d.ts +0 -12
- package/converter/converter.js +0 -28
- package/converter/converter.js.map +0 -1
- package/converter/index.d.ts +0 -1
- package/converter/index.js +0 -2
- package/converter/index.js.map +0 -1
- package/dao/firestore.dao.d.ts +0 -17
- package/dao/firestore.dao.js +0 -22
- package/dao/firestore.dao.js.map +0 -1
- package/dao/index.d.ts +0 -1
- package/dao/index.js +0 -2
- package/dao/index.js.map +0 -1
- package/decorators/decorators.d.ts +0 -77
- package/decorators/decorators.js +0 -30
- package/decorators/decorators.js.map +0 -1
- package/decorators/index.d.ts +0 -1
- package/decorators/index.js +0 -2
- package/decorators/index.js.map +0 -1
- package/index.js +0 -8
- package/index.js.map +0 -1
- package/interfaces/index.d.ts +0 -1
- package/interfaces/index.js +0 -2
- package/interfaces/index.js.map +0 -1
- package/interfaces/interfaces.d.ts +0 -63
- package/interfaces/interfaces.js +0 -2
- package/interfaces/interfaces.js.map +0 -1
- package/path-builder/index.d.ts +0 -1
- package/path-builder/index.js +0 -2
- package/path-builder/index.js.map +0 -1
- package/path-builder/path-builder.d.ts +0 -34
- package/path-builder/path-builder.js +0 -33
- package/path-builder/path-builder.js.map +0 -1
- package/query/firestore.query.d.ts +0 -33
- package/query/firestore.query.js +0 -75
- package/query/firestore.query.js.map +0 -1
- package/query/index.d.ts +0 -1
- package/query/index.js +0 -2
- package/query/index.js.map +0 -1
- package/query/v2/cached-query.d.ts +0 -58
- package/query/v2/cached-query.js +0 -102
- package/query/v2/cached-query.js.map +0 -1
- package/query/v2/index.d.ts +0 -2
- package/query/v2/index.js +0 -3
- package/query/v2/index.js.map +0 -1
- package/query/v2/query.d.ts +0 -27
- package/query/v2/query.js +0 -60
- package/query/v2/query.js.map +0 -1
- package/repository/index.d.ts +0 -1
- package/repository/index.js +0 -2
- package/repository/index.js.map +0 -1
- package/repository/repository.d.ts +0 -45
- package/repository/repository.js +0 -163
- package/repository/repository.js.map +0 -1
- package/testing/common.d.ts +0 -7
- package/testing/common.js +0 -19
- package/testing/common.js.map +0 -1
- package/testing/index.d.ts +0 -1
- package/testing/index.js +0 -2
- package/testing/index.js.map +0 -1
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { CollectionReference, CollectionGroup, DocumentReference, ToFirestoreData, Timestamp, Query, FieldValue, DocumentData } from '../../interfaces';
|
|
2
|
-
export type QueryFn<AppModelType, DbModelType, R> = (collection?: any) => R;
|
|
3
|
-
export type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in';
|
|
4
|
-
export declare abstract class FirestoreAdapter<Date = any> {
|
|
5
|
-
protected abstract isTimestamp(v: any): v is Timestamp;
|
|
6
|
-
protected abstract isFieldValue(v: any): v is FieldValue;
|
|
7
|
-
protected abstract isDate(v: any): v is Date;
|
|
8
|
-
abstract convertTimestampToDate(timestamp: Timestamp): Date;
|
|
9
|
-
abstract convertDateToTimestamp(date: Date): Timestamp;
|
|
10
|
-
abstract get Timestamp(): any;
|
|
11
|
-
abstract get FieldValue(): any;
|
|
12
|
-
abstract get FieldPath(): any;
|
|
13
|
-
abstract doc<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(path: string): DocumentReference<AppModelType>;
|
|
14
|
-
abstract collection<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(path: string): CollectionReference<AppModelType, DbModelType>;
|
|
15
|
-
abstract collectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(collectionId: string): CollectionGroup<AppModelType, DbModelType>;
|
|
16
|
-
abstract query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(collection: CollectionReference<AppModelType, DbModelType>, ...queryFnArray: QueryFn<AppModelType, DbModelType, any>[]): Query<AppModelType, DbModelType>;
|
|
17
|
-
abstract where<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(key: string, evaluation: WhereFilterOp, value: unknown): QueryFn<AppModelType, DbModelType, any>;
|
|
18
|
-
abstract orderBy<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(key: string, order: 'asc' | 'desc'): QueryFn<AppModelType, DbModelType, any>;
|
|
19
|
-
abstract limit<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(n: number): QueryFn<AppModelType, DbModelType, any>;
|
|
20
|
-
abstract runTransaction(fn: any): any;
|
|
21
|
-
abstract batch(): any;
|
|
22
|
-
toFirestoreData<Entity>(entity: Entity): ToFirestoreData<Entity, Date>;
|
|
23
|
-
fromFirestoreData<Entity>(data: ToFirestoreData<Entity, Date>): Entity;
|
|
24
|
-
toFirestore<T>(obj: object, Entity: new () => T): object;
|
|
25
|
-
fromFirestore<T = any>(data: any, Entity: new () => T): T;
|
|
26
|
-
/**
|
|
27
|
-
* @description FirestoreのUpdateは通常のオブジェクトでは孫以下のプロパティが既存データとマージされないので、パスに変換する必要がある。
|
|
28
|
-
*/
|
|
29
|
-
flattenForUpdate(obj: any): any;
|
|
30
|
-
}
|
|
31
|
-
export declare function provideFirestoreAdapter(useClass: new () => FirestoreAdapter): {
|
|
32
|
-
provide: typeof FirestoreAdapter;
|
|
33
|
-
useClass: new () => FirestoreAdapter;
|
|
34
|
-
};
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { Injectable } from '@angular/core';
|
|
3
|
-
import { getFirestoreAnnotations } from '../../decorators/decorators';
|
|
4
|
-
import { walkObj } from '@nx-ddd/core/util/walk-obj';
|
|
5
|
-
import { get } from 'lodash-es';
|
|
6
|
-
let FirestoreAdapter = class FirestoreAdapter {
|
|
7
|
-
//** @deprecated */
|
|
8
|
-
toFirestoreData(entity) {
|
|
9
|
-
return Object.entries(entity).reduce((pre, [k, v]) => (Object.assign(Object.assign({}, pre), { [k]: this.isDate(v) ? this.convertDateToTimestamp(v) : v })), {});
|
|
10
|
-
}
|
|
11
|
-
//** @deprecated */
|
|
12
|
-
fromFirestoreData(data) {
|
|
13
|
-
return Object.entries(data).reduce((pre, [k, v]) => (Object.assign(Object.assign({}, pre), { [k]: this.isTimestamp(v) ? this.convertTimestampToDate(v) : v })), {});
|
|
14
|
-
}
|
|
15
|
-
toFirestore(obj, Entity) {
|
|
16
|
-
const newObj = {};
|
|
17
|
-
for (const annotation of getFirestoreAnnotations(Entity)) {
|
|
18
|
-
const _value = get(obj, annotation.propName);
|
|
19
|
-
if (_value === null) {
|
|
20
|
-
newObj[annotation.fieldName] = null;
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
switch (annotation.type) {
|
|
24
|
-
case 'id':
|
|
25
|
-
case 'string':
|
|
26
|
-
case 'number':
|
|
27
|
-
case 'boolean': {
|
|
28
|
-
if (typeof _value === 'undefined')
|
|
29
|
-
break;
|
|
30
|
-
newObj[annotation.fieldName] = _value;
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
case 'timestamp': {
|
|
34
|
-
if (typeof _value === 'undefined')
|
|
35
|
-
break;
|
|
36
|
-
if (!this.isDate(_value))
|
|
37
|
-
throw new Error(`Invalid Date Type: ${_value}`);
|
|
38
|
-
newObj[annotation.fieldName] = this.convertDateToTimestamp(_value);
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
case 'array': {
|
|
42
|
-
if (typeof (annotation === null || annotation === void 0 ? void 0 : annotation.childType) === 'undefined') {
|
|
43
|
-
if (_value)
|
|
44
|
-
newObj[annotation.fieldName] = _value;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
const Type = annotation.childType();
|
|
48
|
-
if (typeof _value === 'undefined')
|
|
49
|
-
break;
|
|
50
|
-
const value = _value.map(v => {
|
|
51
|
-
switch (Type) {
|
|
52
|
-
case String:
|
|
53
|
-
case Number:
|
|
54
|
-
return v;
|
|
55
|
-
default:
|
|
56
|
-
return this.toFirestore(v, Type);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
if (value)
|
|
60
|
-
newObj[annotation.fieldName] = value;
|
|
61
|
-
}
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
case 'map': {
|
|
65
|
-
if (typeof _value === 'undefined')
|
|
66
|
-
break;
|
|
67
|
-
if (typeof (annotation === null || annotation === void 0 ? void 0 : annotation.childType) === 'undefined') {
|
|
68
|
-
if (_value)
|
|
69
|
-
newObj[annotation.fieldName] = _value;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
const Type = annotation.childType();
|
|
73
|
-
const value = this.toFirestore(_value, Type);
|
|
74
|
-
if (value)
|
|
75
|
-
newObj[annotation.fieldName] = value;
|
|
76
|
-
}
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return newObj;
|
|
82
|
-
}
|
|
83
|
-
fromFirestore(data, Entity) {
|
|
84
|
-
const newObj = {};
|
|
85
|
-
for (const annotation of getFirestoreAnnotations(Entity)) {
|
|
86
|
-
const _value = data[annotation.fieldName];
|
|
87
|
-
if (typeof _value === 'undefined')
|
|
88
|
-
continue;
|
|
89
|
-
if (_value === null) {
|
|
90
|
-
newObj[annotation.propName] = null;
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
switch (annotation.type) {
|
|
94
|
-
case 'id':
|
|
95
|
-
case 'string':
|
|
96
|
-
case 'number':
|
|
97
|
-
case 'boolean': {
|
|
98
|
-
newObj[annotation.propName] = _value;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
case 'timestamp': {
|
|
102
|
-
try {
|
|
103
|
-
newObj[annotation.propName] = this.convertTimestampToDate(_value);
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
newObj[annotation.propName] = _value;
|
|
107
|
-
}
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
case 'array': {
|
|
111
|
-
if (typeof (annotation === null || annotation === void 0 ? void 0 : annotation.childType) === 'undefined') {
|
|
112
|
-
newObj[annotation.propName] = _value;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
const Type = annotation.childType();
|
|
116
|
-
const value = _value.map(v => {
|
|
117
|
-
switch (Type) {
|
|
118
|
-
case String:
|
|
119
|
-
case Number:
|
|
120
|
-
return v;
|
|
121
|
-
default:
|
|
122
|
-
return this.fromFirestore(v, Type);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
if (value)
|
|
126
|
-
newObj[annotation.propName] = value;
|
|
127
|
-
}
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
case 'map': {
|
|
131
|
-
if (typeof (annotation === null || annotation === void 0 ? void 0 : annotation.childType) === 'undefined') {
|
|
132
|
-
newObj[annotation.propName] = _value;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
const Type = annotation.childType();
|
|
136
|
-
const value = this.fromFirestore(_value, Type);
|
|
137
|
-
if (value)
|
|
138
|
-
newObj[annotation.propName] = value;
|
|
139
|
-
}
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return newObj;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* @description FirestoreのUpdateは通常のオブジェクトでは孫以下のプロパティが既存データとマージされないので、パスに変換する必要がある。
|
|
148
|
-
*/
|
|
149
|
-
flattenForUpdate(obj) {
|
|
150
|
-
const newObj = {};
|
|
151
|
-
walkObj(obj, {
|
|
152
|
-
callback: (paths, value) => newObj[paths.join('.')] = value,
|
|
153
|
-
overwrite: (_, value) => {
|
|
154
|
-
if (Array.isArray(value))
|
|
155
|
-
return [true, value];
|
|
156
|
-
if (this.isTimestamp(value))
|
|
157
|
-
return [true, value];
|
|
158
|
-
if (this.isFieldValue(value))
|
|
159
|
-
return [true, value];
|
|
160
|
-
return [false];
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
return newObj;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
FirestoreAdapter = __decorate([
|
|
167
|
-
Injectable()
|
|
168
|
-
], FirestoreAdapter);
|
|
169
|
-
export { FirestoreAdapter };
|
|
170
|
-
export function provideFirestoreAdapter(useClass) {
|
|
171
|
-
return { provide: FirestoreAdapter, useClass };
|
|
172
|
-
}
|
|
173
|
-
//# sourceMappingURL=base.adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.adapter.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/firestore/src/lib/adapters/base/base.adapter.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AAzMqB,gBAAgB;IADrC,UAAU,EAAE;GACS,gBAAgB,CAyMrC;;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAoC;IAC1E,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC;AACjD,CAAC"}
|
package/adapters/base/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './base.adapter';
|
package/adapters/base/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/firestore/src/lib/adapters/base/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { FieldValue, Timestamp, FieldPath } from 'firebase/firestore';
|
|
2
|
-
import dayjs from 'dayjs';
|
|
3
|
-
import { FirestoreAdapter, QueryFn as _QueryFn, WhereFilterOp } from '../base';
|
|
4
|
-
import type firestore from 'firebase/firestore';
|
|
5
|
-
import { CollectionReference as _CollectionReference, CollectionGroup as _CollectionGroup, Query as _Query, DocumentReference, DocumentData } from '../../interfaces';
|
|
6
|
-
type CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = _CollectionReference<AppModelType, DbModelType, firestore.CollectionReference<AppModelType, DbModelType>>;
|
|
7
|
-
type CollectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = _CollectionGroup<AppModelType, DbModelType, firestore.Query<AppModelType, DbModelType>>;
|
|
8
|
-
type Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = _Query<AppModelType, DbModelType, firestore.Query<AppModelType, DbModelType>>;
|
|
9
|
-
type QueryFn<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = _QueryFn<AppModelType, DbModelType, firestore.QueryConstraint>;
|
|
10
|
-
type Origin<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = firestore.CollectionReference<AppModelType, DbModelType> | firestore.Query<AppModelType, DbModelType> | firestore.Query<AppModelType, DbModelType>;
|
|
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 firestore.CollectionReference<infer A, infer B> ? CollectionReference<A, B> : O extends firestore.Query<infer A, infer B> ? CollectionGroup<A, B> : O extends firestore.Query<infer A, infer B> ? Query<A, B> : never;
|
|
13
|
-
export declare function wrapCollectionLike<O extends Origin>(origin: O): InferCollectionLike<O>;
|
|
14
|
-
export declare function unwrapCollectionLike<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(collection: CollectionLike<AppModelType, DbModelType>): Origin<AppModelType, DbModelType>;
|
|
15
|
-
export declare class FirebaseFirestoreAdapter extends FirestoreAdapter<dayjs.Dayjs> {
|
|
16
|
-
firestore: firestore.Firestore;
|
|
17
|
-
constructor(firestore?: firestore.Firestore);
|
|
18
|
-
get FieldValue(): typeof FieldValue;
|
|
19
|
-
get Timestamp(): typeof Timestamp;
|
|
20
|
-
get FieldPath(): FieldPath;
|
|
21
|
-
protected isTimestamp(v: any): v is Timestamp;
|
|
22
|
-
protected isFieldValue(v: any): v is FieldValue;
|
|
23
|
-
protected isDate(v: any): v is dayjs.Dayjs;
|
|
24
|
-
convertDateToTimestamp(date: dayjs.Dayjs): Timestamp;
|
|
25
|
-
convertTimestampToDate(timestamp: Timestamp): dayjs.Dayjs;
|
|
26
|
-
doc(path: string): DocumentReference<any>;
|
|
27
|
-
collection<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(path: string): CollectionReference<AppModelType, DbModelType>;
|
|
28
|
-
collectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(collectionId: string): CollectionGroup<AppModelType, DbModelType>;
|
|
29
|
-
query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(collection: CollectionReference<AppModelType, DbModelType>, ...queryFnArray: QueryFn[]): Query<AppModelType, DbModelType>;
|
|
30
|
-
where<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(fieldPath: string, opStr: WhereFilterOp, value: unknown): QueryFn;
|
|
31
|
-
orderBy<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(key: string, order?: 'asc' | 'desc'): QueryFn;
|
|
32
|
-
limit<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(n: number): QueryFn;
|
|
33
|
-
runTransaction(): void;
|
|
34
|
-
batch(): firestore.WriteBatch;
|
|
35
|
-
}
|
|
36
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAsB,MAAM,oBAAoB,CAAC;AAC/O,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAsC,MAAM,SAAS,CAAC;AAW/E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA2C3C,MAAM,UAAU,kBAAkB,CAAmB,MAAS;IAC5D,OAAO;QACL,KAAK,EAAE,MAAM;QACb,YAAY,EAAE,GAAG,EAAE;YACjB,MAAM,OAAO,GAAG,IAAI,OAAO,EAA+B,CAAC;YAC3D,UAAU,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC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AAE,IAAI,CAAC,CAAC;QAC7C,OAAO,kBAAkB,CAAC,GAAG,CAAmD,CAAC;IACnF,CAAC;IAED,eAAe,CAGb,YAAoB;QACpB,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAC1D,OAAO,kBAAkB,CAAC,GAAG,CAAmD,CAAC;IACnF,CAAC;IAED,KAAK,CAIH,UAA0D,EAC1D,GAAG,YAAuB;QAE1B,MAAM,GAAG,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO,kBAAkB,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,KAAK,CAGH,SAAiB,EAAE,KAAoB,EAAE,KAAc;QACvD,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,CAGL,GAAW,EAAE,QAAwB,KAAK;QAC1C,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAGH,CAAS;QACT,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,cAAc;QACZ,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IAED,KAAK;QACH,OAAO,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAjHY,wBAAwB;IADpC,UAAU,EAAE;;GACA,wBAAwB,CAiHpC"}
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './base';
|
package/adapters/index.js
DELETED
package/adapters/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DocumentSnapshot } from '../interfaces';
|
|
2
|
-
export interface IFirestoreConverter<E extends {
|
|
3
|
-
id: string;
|
|
4
|
-
}> {
|
|
5
|
-
fromFirestore(doc: DocumentSnapshot<object>): E;
|
|
6
|
-
toFirestore(entity: Partial<E>): object;
|
|
7
|
-
fromObject?(obj: object): E;
|
|
8
|
-
toObject?(entity: E): object;
|
|
9
|
-
}
|
|
10
|
-
export declare function injectConverter<Entity extends {
|
|
11
|
-
id: string;
|
|
12
|
-
}>(Entity: new () => Entity): IFirestoreConverter<Entity>;
|
package/converter/converter.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { inject } from '@angular/core';
|
|
2
|
-
import { plainToInstanceWithValid } from '@nx-ddd/core/util';
|
|
3
|
-
import { FirestoreAdapter } from '../adapters/base';
|
|
4
|
-
import { instanceToPlain } from 'class-transformer';
|
|
5
|
-
class BasicConverter {
|
|
6
|
-
constructor(Entity, adapter) {
|
|
7
|
-
this.Entity = Entity;
|
|
8
|
-
this.adapter = adapter;
|
|
9
|
-
}
|
|
10
|
-
fromFirestore(doc) {
|
|
11
|
-
const data = this.adapter.fromFirestore(Object.assign(Object.assign({}, doc.data()), { id: doc.id }), this.Entity);
|
|
12
|
-
return plainToInstanceWithValid(this.Entity, data);
|
|
13
|
-
}
|
|
14
|
-
toFirestore(entity) {
|
|
15
|
-
return this.adapter.toFirestore(entity, this.Entity);
|
|
16
|
-
}
|
|
17
|
-
fromObject(obj) {
|
|
18
|
-
return plainToInstanceWithValid(this.Entity, obj);
|
|
19
|
-
}
|
|
20
|
-
toObject(entity) {
|
|
21
|
-
return instanceToPlain(entity);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export function injectConverter(Entity) {
|
|
25
|
-
const adapter = inject(FirestoreAdapter);
|
|
26
|
-
return new BasicConverter(Entity, adapter);
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=converter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AASpD,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,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,UAAU,CAAC,GAAW;QACpB,OAAO,wBAAwB,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpD,CAAC;IAED,QAAQ,CAAC,MAAS;QAChB,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,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.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './converter';
|
package/converter/index.js
DELETED
package/converter/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import { FirestoreAdapter } from '../adapters/base';
|
|
3
|
-
import { CollectionReference, CollectionGroup, DocumentReference, ToFirestoreData, CollectionLike } from '../interfaces';
|
|
4
|
-
import { FirestorePathBuilder } from '../path-builder';
|
|
5
|
-
export declare class FirestoreDAO<Entity extends {
|
|
6
|
-
id: string;
|
|
7
|
-
}, FirestoreData = ToFirestoreData<Entity, dayjs.Dayjs>> {
|
|
8
|
-
protected adapter: FirestoreAdapter;
|
|
9
|
-
protected pathBuilder: FirestorePathBuilder<Entity>;
|
|
10
|
-
constructor(adapter: FirestoreAdapter, pathBuilder: FirestorePathBuilder<Entity>);
|
|
11
|
-
collection(paramMap?: Partial<Entity>): CollectionReference<FirestoreData>;
|
|
12
|
-
collectionGroup(): CollectionGroup<FirestoreData>;
|
|
13
|
-
doc(paramMap: Partial<Entity> & {
|
|
14
|
-
id: string;
|
|
15
|
-
}): DocumentReference<FirestoreData>;
|
|
16
|
-
getCollection(paramMap?: Partial<Entity>): CollectionLike;
|
|
17
|
-
}
|
package/dao/firestore.dao.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export class FirestoreDAO {
|
|
2
|
-
constructor(adapter, pathBuilder) {
|
|
3
|
-
this.adapter = adapter;
|
|
4
|
-
this.pathBuilder = pathBuilder;
|
|
5
|
-
}
|
|
6
|
-
collection(paramMap) {
|
|
7
|
-
const path = this.pathBuilder.collection(paramMap);
|
|
8
|
-
return this.adapter.collection(path);
|
|
9
|
-
}
|
|
10
|
-
collectionGroup() {
|
|
11
|
-
const path = this.pathBuilder.collectionGroup();
|
|
12
|
-
return this.adapter.collectionGroup(path);
|
|
13
|
-
}
|
|
14
|
-
doc(paramMap) {
|
|
15
|
-
const path = this.pathBuilder.doc(paramMap);
|
|
16
|
-
return this.adapter.doc(path);
|
|
17
|
-
}
|
|
18
|
-
getCollection(paramMap) {
|
|
19
|
-
return paramMap ? this.collection(paramMap) : this.collectionGroup();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=firestore.dao.js.map
|
package/dao/firestore.dao.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firestore.dao.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/dao/firestore.dao.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,YAAY;IAKvB,YACY,OAAyB,EACzB,WAAyC;QADzC,YAAO,GAAP,OAAO,CAAkB;QACzB,gBAAW,GAAX,WAAW,CAA8B;IACjD,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.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './firestore.dao';
|
package/dao/index.js
DELETED
package/dao/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/dao/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
export declare const FIRESTORE_ANNOTATIONS = "firestore_annotations";
|
|
2
|
-
export type FirestoreFieldType = 'id' | 'boolean' | 'number' | 'timestamp' | 'string' | 'geopoint' | 'null' | 'map' | 'array' | 'reference';
|
|
3
|
-
export interface FirestoreAnnotation {
|
|
4
|
-
type: FirestoreFieldType;
|
|
5
|
-
fieldName: string;
|
|
6
|
-
propName: string;
|
|
7
|
-
childType: any;
|
|
8
|
-
}
|
|
9
|
-
export declare const createDecorator: (type: FirestoreFieldType, options?: {
|
|
10
|
-
childType?: any;
|
|
11
|
-
}) => (nameOrProps?: {
|
|
12
|
-
name?: string;
|
|
13
|
-
} | string) => (target: any, propName: string) => void, getAnnotations: (target: any) => FirestoreAnnotation[];
|
|
14
|
-
/** @deprecated use getAnnotations */
|
|
15
|
-
export declare function getFirestoreAnnotations(target: any): FirestoreAnnotation[];
|
|
16
|
-
export declare const ID: (nameOrProps?: {
|
|
17
|
-
name?: string;
|
|
18
|
-
} | string) => (target: any, propName: string) => void;
|
|
19
|
-
export declare const String: (nameOrProps?: {
|
|
20
|
-
name?: string;
|
|
21
|
-
} | string) => (target: any, propName: string) => void;
|
|
22
|
-
export declare const Null: (nameOrProps?: {
|
|
23
|
-
name?: string;
|
|
24
|
-
} | string) => (target: any, propName: string) => void;
|
|
25
|
-
export declare const Geopoint: (nameOrProps?: {
|
|
26
|
-
name?: string;
|
|
27
|
-
} | string) => (target: any, propName: string) => void;
|
|
28
|
-
export declare const Boolean: (nameOrProps?: {
|
|
29
|
-
name?: string;
|
|
30
|
-
} | string) => (target: any, propName: string) => void;
|
|
31
|
-
export declare const Timestamp: (nameOrProps?: {
|
|
32
|
-
name?: string;
|
|
33
|
-
} | string) => (target: any, propName: string) => void;
|
|
34
|
-
export declare const Number: (nameOrProps?: {
|
|
35
|
-
name?: string;
|
|
36
|
-
} | string) => (target: any, propName: string) => void;
|
|
37
|
-
export declare const Map: (childType?: () => any, props?: {
|
|
38
|
-
name?: string;
|
|
39
|
-
}) => (target: any, propName: string) => void;
|
|
40
|
-
export declare const Array: (childType?: () => any, props?: {
|
|
41
|
-
name?: string;
|
|
42
|
-
}) => (target: any, propName: string) => void;
|
|
43
|
-
export declare const Reference: (nameOrProps?: {
|
|
44
|
-
name?: string;
|
|
45
|
-
} | string) => (target: any, propName: string) => void;
|
|
46
|
-
export declare class Firestore {
|
|
47
|
-
static ID: (nameOrProps?: {
|
|
48
|
-
name?: string;
|
|
49
|
-
} | string) => (target: any, propName: string) => void;
|
|
50
|
-
static String: (nameOrProps?: {
|
|
51
|
-
name?: string;
|
|
52
|
-
} | string) => (target: any, propName: string) => void;
|
|
53
|
-
static Null: (nameOrProps?: {
|
|
54
|
-
name?: string;
|
|
55
|
-
} | string) => (target: any, propName: string) => void;
|
|
56
|
-
static Geopoint: (nameOrProps?: {
|
|
57
|
-
name?: string;
|
|
58
|
-
} | string) => (target: any, propName: string) => void;
|
|
59
|
-
static Boolean: (nameOrProps?: {
|
|
60
|
-
name?: string;
|
|
61
|
-
} | string) => (target: any, propName: string) => void;
|
|
62
|
-
static Timestamp: (nameOrProps?: {
|
|
63
|
-
name?: string;
|
|
64
|
-
} | string) => (target: any, propName: string) => void;
|
|
65
|
-
static Number: (nameOrProps?: {
|
|
66
|
-
name?: string;
|
|
67
|
-
} | string) => (target: any, propName: string) => void;
|
|
68
|
-
static Map: (childType?: () => any, props?: {
|
|
69
|
-
name?: string;
|
|
70
|
-
}) => (target: any, propName: string) => void;
|
|
71
|
-
static Array: (childType?: () => any, props?: {
|
|
72
|
-
name?: string;
|
|
73
|
-
}) => (target: any, propName: string) => void;
|
|
74
|
-
static Reference: (nameOrProps?: {
|
|
75
|
-
name?: string;
|
|
76
|
-
} | string) => (target: any, propName: string) => void;
|
|
77
|
-
}
|
package/decorators/decorators.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { makeDecoratorFactories } from '@nx-ddd/core/create-decorator';
|
|
2
|
-
export const FIRESTORE_ANNOTATIONS = 'firestore_annotations';
|
|
3
|
-
export const { createDecorator, getAnnotations, } = makeDecoratorFactories((type, fieldName, propName, options) => ({ type, fieldName, propName, childType: options.childType }), FIRESTORE_ANNOTATIONS);
|
|
4
|
-
/** @deprecated use getAnnotations */
|
|
5
|
-
export function getFirestoreAnnotations(target) {
|
|
6
|
-
return getAnnotations(target);
|
|
7
|
-
}
|
|
8
|
-
export const ID = createDecorator('id');
|
|
9
|
-
export const String = createDecorator('string');
|
|
10
|
-
export const Null = createDecorator('null');
|
|
11
|
-
export const Geopoint = createDecorator('geopoint');
|
|
12
|
-
export const Boolean = createDecorator('boolean');
|
|
13
|
-
export const Timestamp = createDecorator('timestamp');
|
|
14
|
-
export const Number = createDecorator('number');
|
|
15
|
-
export const Map = (childType, props) => createDecorator('map', { childType })(props);
|
|
16
|
-
export const Array = (childType, props) => createDecorator('array', { childType })(props);
|
|
17
|
-
export const Reference = createDecorator('reference');
|
|
18
|
-
export class Firestore {
|
|
19
|
-
}
|
|
20
|
-
Firestore.ID = ID;
|
|
21
|
-
Firestore.String = String;
|
|
22
|
-
Firestore.Null = Null;
|
|
23
|
-
Firestore.Geopoint = Geopoint;
|
|
24
|
-
Firestore.Boolean = Boolean;
|
|
25
|
-
Firestore.Timestamp = Timestamp;
|
|
26
|
-
Firestore.Number = Number;
|
|
27
|
-
Firestore.Map = Map;
|
|
28
|
-
Firestore.Array = Array;
|
|
29
|
-
Firestore.Reference = Reference;
|
|
30
|
-
//# sourceMappingURL=decorators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/decorators/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAW7D,MAAM,CAAC,MAAM,EACX,eAAe,EACf,cAAc,GACf,GAAG,sBAAsB,CAKxB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAC,CAAC,EACnG,qBAAqB,CACtB,CAAC;AAEF,qCAAqC;AACrC,MAAM,UAAU,uBAAuB,CAAC,MAAW;IACjD,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,SAAqB,EAAE,KAAuB,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,EAAC,SAAS,EAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAClH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,SAAqB,EAAE,KAAuB,EAAE,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,EAAC,SAAS,EAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACtH,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;AAEtD,MAAM,OAAO,SAAS;;AACb,YAAE,GAAG,EAAE,CAAC;AACR,gBAAM,GAAG,MAAM,CAAC;AAChB,cAAI,GAAG,IAAI,CAAC;AACZ,kBAAQ,GAAG,QAAQ,CAAC;AACpB,iBAAO,GAAG,OAAO,CAAC;AAClB,mBAAS,GAAG,SAAS,CAAC;AACtB,gBAAM,GAAG,MAAM,CAAC;AAChB,aAAG,GAAG,GAAG,CAAC;AACV,eAAK,GAAG,KAAK,CAAC;AACd,mBAAS,GAAG,SAAS,CAAC"}
|
package/decorators/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Firestore } from './decorators';
|
package/decorators/index.js
DELETED
package/decorators/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
package/index.js
DELETED
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './interfaces';
|
package/interfaces/index.js
DELETED
package/interfaces/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/firestore/src/lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { QueryDocumentSnapshot } from 'firebase-admin/firestore';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
export type DocumentData = {
|
|
4
|
-
[field: string]: any;
|
|
5
|
-
};
|
|
6
|
-
export interface GetOptions {
|
|
7
|
-
readonly source?: 'default' | 'server' | 'cache';
|
|
8
|
-
}
|
|
9
|
-
export interface DocumentChangeAction<T> {
|
|
10
|
-
type: any;
|
|
11
|
-
payload: {
|
|
12
|
-
doc: DocumentSnapshot<T>;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface DocumentSnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
|
|
16
|
-
id: string;
|
|
17
|
-
ref: {
|
|
18
|
-
path: string;
|
|
19
|
-
};
|
|
20
|
-
data: () => AppModelType | undefined;
|
|
21
|
-
get: (fieldPath: string) => any;
|
|
22
|
-
exists?: (() => boolean) | boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface QuerySnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
|
|
25
|
-
docs: Array<QueryDocumentSnapshot<AppModelType, DbModelType>>;
|
|
26
|
-
}
|
|
27
|
-
export interface Timestamp {
|
|
28
|
-
readonly seconds: number;
|
|
29
|
-
readonly nanoseconds: number;
|
|
30
|
-
toDate(): Date;
|
|
31
|
-
toMillis(): number;
|
|
32
|
-
isEqual(other: Timestamp): boolean;
|
|
33
|
-
valueOf(): string;
|
|
34
|
-
}
|
|
35
|
-
export interface TimestampConstructor {
|
|
36
|
-
new (seconds: number, nanoseconds: number): Timestamp;
|
|
37
|
-
now(): Timestamp;
|
|
38
|
-
fromDate(date: Date): Timestamp;
|
|
39
|
-
fromMillis(milliseconds: number): Timestamp;
|
|
40
|
-
}
|
|
41
|
-
export type FieldValue = any;
|
|
42
|
-
export type ToFirestoreData<Entity, Date> = {
|
|
43
|
-
[K in keyof Entity]: Entity[K] extends Date ? Timestamp | FieldValue : Entity[K];
|
|
44
|
-
};
|
|
45
|
-
export interface DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData, Origin = any> {
|
|
46
|
-
__ref?: Origin;
|
|
47
|
-
exists(): Promise<boolean>;
|
|
48
|
-
set(data: AppModelType, options?: any): Promise<void | any>;
|
|
49
|
-
get(): Promise<DocumentSnapshot<AppModelType, DbModelType>>;
|
|
50
|
-
update(data: AppModelType): Promise<void | any>;
|
|
51
|
-
delete(): Promise<void | any>;
|
|
52
|
-
stateChanges?: () => Observable<DocumentSnapshot<AppModelType, DbModelType>>;
|
|
53
|
-
}
|
|
54
|
-
export type CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData, Origin = any> = Query<AppModelType, DbModelType, Origin>;
|
|
55
|
-
export type CollectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData, Origin = any> = Query<AppModelType, DbModelType, Origin>;
|
|
56
|
-
export interface Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData, Origin = any> {
|
|
57
|
-
__ref?: Origin;
|
|
58
|
-
stateChanges?: () => Observable<DocumentChangeAction<DocumentData>[]>;
|
|
59
|
-
get(options?: GetOptions): Promise<QuerySnapshot<AppModelType, DbModelType>>;
|
|
60
|
-
onSnapshot?(onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: Error) => void): () => void;
|
|
61
|
-
count(): Promise<number>;
|
|
62
|
-
}
|
|
63
|
-
export type CollectionLike<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData, Origin = any> = CollectionReference<AppModelType, DbModelType, Origin> | CollectionGroup<AppModelType, DbModelType, Origin> | Query<AppModelType, DbModelType, Origin>;
|