@sofiakb/fireblaze-ts 1.0.0-dev.8 → 2.0.0-dev.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/lib/commons/index.d.ts +1 -0
- package/lib/commons/index.js +14 -0
- package/lib/commons/index.js.map +1 -0
- package/lib/core/firebase-config.d.ts +7 -0
- package/lib/core/firebase-config.js +1 -1
- package/lib/core/firebase.d.ts +4 -4
- package/lib/core/firebase.js +9 -3
- package/lib/core/firebase.js.map +1 -1
- package/lib/core/firestore-repository.d.ts +324 -0
- package/lib/core/firestore-repository.js +660 -0
- package/lib/core/firestore-repository.js.map +1 -0
- package/lib/core/prepared-data.d.ts +27 -0
- package/lib/core/prepared-data.js +30 -0
- package/lib/core/prepared-data.js.map +1 -0
- package/lib/exceptions/empty-snapshot-exception.d.ts +3 -0
- package/lib/exceptions/empty-snapshot-exception.js +17 -0
- package/lib/exceptions/empty-snapshot-exception.js.map +1 -0
- package/lib/exceptions/no-document-found-exception.d.ts +11 -0
- package/lib/exceptions/no-document-found-exception.js +25 -0
- package/lib/exceptions/no-document-found-exception.js.map +1 -0
- package/lib/exceptions/no-firebase-instance-exception.js +3 -3
- package/lib/exceptions/no-firestore-instance-exception.d.ts +3 -0
- package/lib/exceptions/no-firestore-instance-exception.js +17 -0
- package/lib/exceptions/no-firestore-instance-exception.js.map +1 -0
- package/lib/exceptions/unique-constraint-exception.d.ts +11 -0
- package/lib/exceptions/unique-constraint-exception.js +25 -0
- package/lib/exceptions/unique-constraint-exception.js.map +1 -0
- package/lib/index.d.ts +4 -4
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/types/class-constructor.js +1 -1
- package/lib/types/nullable.d.ts +1 -1
- package/lib/types/nullable.js +1 -1
- package/lib/utils/date.d.ts +12 -1
- package/lib/utils/date.js +27 -14
- package/lib/utils/date.js.map +1 -1
- package/lib/utils/ignored-keys.d.ts +2 -0
- package/lib/utils/ignored-keys.js +12 -0
- package/lib/utils/ignored-keys.js.map +1 -0
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +4 -6
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/paginated-data.d.ts +35 -0
- package/lib/utils/paginated-data.js +49 -0
- package/lib/utils/paginated-data.js.map +1 -0
- package/lib/utils/to-json.d.ts +1 -0
- package/lib/utils/to-json.js +35 -0
- package/lib/utils/to-json.js.map +1 -0
- package/package.json +26 -24
- package/lib/core/firebase-repository.d.ts +0 -60
- package/lib/core/firebase-repository.js +0 -316
- package/lib/core/firebase-repository.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defined: (value: any, strict?: boolean) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defined = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* cloud-functions
|
|
6
|
+
*
|
|
7
|
+
* (c) Sofiakb <contact.sofiakb@gmail.com>
|
|
8
|
+
*
|
|
9
|
+
* Created by WebStorm on 31/12/2022 at 18:17
|
|
10
|
+
* File functions/src/commons/index
|
|
11
|
+
*/
|
|
12
|
+
const defined = (value, strict = true) => typeof value !== "undefined" && (strict ? value !== null : true);
|
|
13
|
+
exports.defined = defined;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commons/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb;;;;;;;GAOG;AAEI,MAAM,OAAO,GAAG,CAAC,KAAU,EAAE,MAAM,GAAG,IAAI,EAAW,EAAE,CAC7D,OAAO,KAAK,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AADrD,QAAA,OAAO,WAC8C"}
|
package/lib/core/firebase.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FirebaseApp } from
|
|
2
|
-
import { Auth } from
|
|
3
|
-
import { FirebaseStorage } from
|
|
4
|
-
import FirebaseConfig from
|
|
1
|
+
import { FirebaseApp } from "firebase/app";
|
|
2
|
+
import { Auth } from "firebase/auth";
|
|
3
|
+
import { FirebaseStorage } from "firebase/storage";
|
|
4
|
+
import FirebaseConfig from "./firebase-config";
|
|
5
5
|
export default class Firebase {
|
|
6
6
|
config: FirebaseConfig;
|
|
7
7
|
app: FirebaseApp;
|
package/lib/core/firebase.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
4
|
* @sofiakb/fireblaze-ts
|
|
5
5
|
*
|
|
6
|
-
* (c)
|
|
6
|
+
* (c) Sofiakb <contact.sofiakb@gmail.com>
|
|
7
7
|
*
|
|
8
8
|
* Created by WebStorm on 21/09/2022 at 10:04
|
|
9
9
|
* File src/core/firebase
|
|
@@ -21,7 +21,7 @@ class Firebase {
|
|
|
21
21
|
this.config = config;
|
|
22
22
|
this.app = (0, app_1.initializeApp)(this.config);
|
|
23
23
|
if (config.withEmulator === true)
|
|
24
|
-
(0, firestore_1.connectFirestoreEmulator)((0, firestore_1.getFirestore)(),
|
|
24
|
+
(0, firestore_1.connectFirestoreEmulator)((0, firestore_1.getFirestore)(), "localhost", config.emulators?.ports?.firestore ?? 9100);
|
|
25
25
|
this.saveGlobally();
|
|
26
26
|
}
|
|
27
27
|
saveGlobally() {
|
|
@@ -32,10 +32,16 @@ class Firebase {
|
|
|
32
32
|
}
|
|
33
33
|
withAuth() {
|
|
34
34
|
this.auth = (0, auth_1.getAuth)(this.app);
|
|
35
|
+
if (this.config.withEmulator === true && !!this.config.emulators?.auth?.url)
|
|
36
|
+
(0, auth_1.connectAuthEmulator)(this.auth, this.config.emulators.auth.url);
|
|
35
37
|
this.saveGlobally();
|
|
36
38
|
}
|
|
37
39
|
withStorage() {
|
|
38
40
|
this.storage = (0, storage_1.getStorage)(this.app);
|
|
41
|
+
if (this.config.withEmulator === true &&
|
|
42
|
+
!!this.config.emulators?.storage?.host &&
|
|
43
|
+
!!this.config.emulators?.storage?.port)
|
|
44
|
+
(0, storage_1.connectStorageEmulator)(this.storage, this.config.emulators.storage.host, this.config.emulators.storage.port);
|
|
39
45
|
this.saveGlobally();
|
|
40
46
|
}
|
|
41
47
|
static get() {
|
package/lib/core/firebase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../../src/core/firebase.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;GAOG;AAEH,sCAA0D;AAC1D,kDAA4E;AAE5E,
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../../src/core/firebase.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;GAOG;AAEH,sCAA0D;AAC1D,kDAA4E;AAE5E,wCAAmE;AACnE,8CAAuF;AAIvF,MAAqB,QAAQ;IAC5B,MAAM,CAAiB;IACvB,GAAG,CAAc;IAEjB,IAAI,CAAQ;IACZ,OAAO,CAAmB;IAE1B,YAAY,MAAsB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,GAAG,GAAG,IAAA,mBAAa,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEtC,IAAI,MAAM,CAAC,YAAY,KAAK,IAAI;YAC/B,IAAA,oCAAwB,EAAC,IAAA,wBAAY,GAAE,EAAE,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,IAAI,IAAI,CAAC,CAAC;QAEnG,IAAI,CAAC,YAAY,EAAE,CAAC;IACrB,CAAC;IAED,YAAY;QACV,UAAkB,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC7C,UAAkB,CAAC,sBAAsB,GAAG,IAAI,CAAC,GAAG,CAAC;QACrD,UAAkB,CAAC,uBAAuB,GAAG,IAAI,CAAC,IAAI,CAAC;QACvD,UAAkB,CAAC,0BAA0B,GAAG,IAAI,CAAC,OAAO,CAAC;IAC/D,CAAC;IAED,QAAQ;QACP,IAAI,CAAC,IAAI,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,GAAG;YAC1E,IAAA,0BAAmB,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChE,IAAI,CAAC,YAAY,EAAE,CAAC;IACrB,CAAC;IAED,WAAW;QACV,IAAI,CAAC,OAAO,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpC,IACC,IAAI,CAAC,MAAM,CAAC,YAAY,KAAK,IAAI;YACjC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI;YACtC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI;YAEtC,IAAA,gCAAsB,EACrB,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAClC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAClC,CAAC;QACH,IAAI,CAAC,YAAY,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,GAAG;QACT,OAAQ,UAAkB,CAAC,kBAAkB,CAAC;IAC/C,CAAC;IAED,MAAM,CAAC,MAAM;QACZ,OAAQ,UAAkB,CAAC,sBAAsB,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,OAAO;QACb,OAAQ,UAAkB,CAAC,uBAAuB,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,UAAU;QAChB,OAAQ,UAAkB,CAAC,0BAA0B,CAAC;IACvD,CAAC;CACD;AA9DD,2BA8DC"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { CollectionReference, DocumentReference, FieldPath, Firestore, FirestoreError, OrderByDirection, Query, QueryCompositeFilterConstraint, QueryFieldFilterConstraint, QuerySnapshot } from "firebase/firestore";
|
|
2
|
+
import { ClassConstructor } from "../types/class-constructor";
|
|
3
|
+
import Nullable from "../types/nullable";
|
|
4
|
+
import PreparedData from "./prepared-data";
|
|
5
|
+
export interface FirestoreRepositoryAttributes<T> {
|
|
6
|
+
collectionName?: string;
|
|
7
|
+
collection?: CollectionReference;
|
|
8
|
+
firestore?: Firestore;
|
|
9
|
+
options?: FirestoreRepositoryOptions;
|
|
10
|
+
model?: Nullable<ClassConstructor<T>>;
|
|
11
|
+
without?: string[];
|
|
12
|
+
appends?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface QueryOptions {
|
|
15
|
+
withSoftDelete?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface FirestoreRepositoryOptions {
|
|
18
|
+
cache: {
|
|
19
|
+
use: boolean;
|
|
20
|
+
until: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export default class FirestoreRepository<T> {
|
|
24
|
+
#private;
|
|
25
|
+
model: Nullable<ClassConstructor<T>>;
|
|
26
|
+
without: string[];
|
|
27
|
+
appends: string[];
|
|
28
|
+
softDeletes: boolean;
|
|
29
|
+
_firestoreLocalStoragePrefix: string;
|
|
30
|
+
options?: FirestoreRepositoryOptions;
|
|
31
|
+
constructor(attributes: FirestoreRepositoryAttributes<T>);
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @return {CollectionReference}
|
|
35
|
+
*/
|
|
36
|
+
get collection(): CollectionReference;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param {CollectionReference} collection
|
|
40
|
+
*/
|
|
41
|
+
set collection(collection: CollectionReference);
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @return {Nullable<string>}
|
|
45
|
+
*/
|
|
46
|
+
get collectionName(): Nullable<string>;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param {Nullable<string>} collectionName
|
|
50
|
+
*/
|
|
51
|
+
set collectionName(collectionName: Nullable<string>);
|
|
52
|
+
/**
|
|
53
|
+
* @return {Nullable<Query>}
|
|
54
|
+
*/
|
|
55
|
+
get snapshot(): Nullable<Query>;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @param {Nullable<Query>} snapshot
|
|
59
|
+
*/
|
|
60
|
+
set snapshot(snapshot: Nullable<Query>);
|
|
61
|
+
/**
|
|
62
|
+
* @return {Firestore}
|
|
63
|
+
*/
|
|
64
|
+
get firestore(): Firestore;
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param {Firestore} firestore
|
|
68
|
+
*/
|
|
69
|
+
set firestore(firestore: Firestore);
|
|
70
|
+
/**
|
|
71
|
+
* @return {Firestore}
|
|
72
|
+
*/
|
|
73
|
+
get instance(): Firestore;
|
|
74
|
+
static verifyLogin(error: FirestoreError): null | Promise<any> | FirestoreError;
|
|
75
|
+
static _now(): Date;
|
|
76
|
+
clearLocalStorage(): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* @method casting
|
|
79
|
+
* @description Cette méthode permet de transformer l'objet retourné par firebase.
|
|
80
|
+
*
|
|
81
|
+
* @param {any} data
|
|
82
|
+
*
|
|
83
|
+
* @return {Promise}
|
|
84
|
+
*/
|
|
85
|
+
casting(data: any): Promise<T | null>;
|
|
86
|
+
/**
|
|
87
|
+
* @method castingAll
|
|
88
|
+
* @description Cette méthode permet de transformer l'objet retourné par firebase.
|
|
89
|
+
*
|
|
90
|
+
* @param {any} values
|
|
91
|
+
*
|
|
92
|
+
* @return {Promise}
|
|
93
|
+
*/
|
|
94
|
+
castingAll(values: any): Promise<Awaited<T | null>[] | T | null>;
|
|
95
|
+
/**
|
|
96
|
+
* @method _castData
|
|
97
|
+
* @description Cette méthode permet de transformer l'objet retourné par firebase.
|
|
98
|
+
*
|
|
99
|
+
* @param {QuerySnapshot} querySnapshot
|
|
100
|
+
*
|
|
101
|
+
* @return {Promise}
|
|
102
|
+
*/
|
|
103
|
+
_castData(querySnapshot: QuerySnapshot): Promise<(Awaited<T> | null)[]>;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @return {Query}
|
|
107
|
+
*/
|
|
108
|
+
_query(): Query;
|
|
109
|
+
/**
|
|
110
|
+
* @method all
|
|
111
|
+
* @description Cette méthode prépare la requête afin lister tous les éléments de la collection.
|
|
112
|
+
*
|
|
113
|
+
* @param {object} options
|
|
114
|
+
*
|
|
115
|
+
* @return {this}
|
|
116
|
+
*/
|
|
117
|
+
all(options?: QueryOptions): this;
|
|
118
|
+
/**
|
|
119
|
+
* @method where
|
|
120
|
+
* @description Cette méthode prépare la requête afin rechercher des éléments.
|
|
121
|
+
*
|
|
122
|
+
* @return {this}
|
|
123
|
+
* @param {QueryCompositeFilterConstraint|QueryFieldFilterConstraint} filter
|
|
124
|
+
*/
|
|
125
|
+
where(filter: QueryCompositeFilterConstraint | QueryFieldFilterConstraint): this;
|
|
126
|
+
/**
|
|
127
|
+
* @method whereSnapshot
|
|
128
|
+
* @description Cette méthode prépare la requête afin rechercher des éléments.
|
|
129
|
+
*
|
|
130
|
+
* @return {this}
|
|
131
|
+
* @param {QueryCompositeFilterConstraint|QueryFieldFilterConstraint} filter
|
|
132
|
+
*/
|
|
133
|
+
whereSnapshot(filter: QueryCompositeFilterConstraint | QueryFieldFilterConstraint): this;
|
|
134
|
+
/**
|
|
135
|
+
* @method findOneById
|
|
136
|
+
* @description Cette méthode prépare la requête afin rechercher un élément par son ID.
|
|
137
|
+
*
|
|
138
|
+
* @return {Promise<Nullable<T | any>>}
|
|
139
|
+
* @param {string} id
|
|
140
|
+
*/
|
|
141
|
+
findOneById(id: string): Promise<Nullable<T | any>>;
|
|
142
|
+
/**
|
|
143
|
+
* @method documentReference
|
|
144
|
+
* @description Cette méthode retourne la référence d'un document.
|
|
145
|
+
*
|
|
146
|
+
* @return {Nullable<DocumentReference>}
|
|
147
|
+
* @param {string} docID
|
|
148
|
+
*/
|
|
149
|
+
documentReference(docID: string): Nullable<DocumentReference>;
|
|
150
|
+
/**
|
|
151
|
+
* @method doc
|
|
152
|
+
* @description Cette méthode retourne la référence d'un document.
|
|
153
|
+
*
|
|
154
|
+
* @return {Promise}
|
|
155
|
+
* @param {Nullable<string>} docID
|
|
156
|
+
* @param {boolean} cast
|
|
157
|
+
* @param {QueryOptions} options
|
|
158
|
+
*/
|
|
159
|
+
doc(docID: Nullable<string>, cast?: boolean, options?: QueryOptions): Promise<Nullable<T | any>>;
|
|
160
|
+
/**
|
|
161
|
+
* @method find
|
|
162
|
+
* @description Cette méthode retourne un objet en fonction de son ID.
|
|
163
|
+
*
|
|
164
|
+
* @return {Promise}
|
|
165
|
+
* @param {Nullable<string>} docID
|
|
166
|
+
* @param {QueryOptions} options
|
|
167
|
+
*
|
|
168
|
+
*/
|
|
169
|
+
find(docID: Nullable<string>, options?: QueryOptions): Promise<Nullable<T | any>>;
|
|
170
|
+
/**
|
|
171
|
+
* @method id
|
|
172
|
+
* @description Cette méthode permet de créer un identifiant de document.
|
|
173
|
+
*
|
|
174
|
+
* @return {string}
|
|
175
|
+
*/
|
|
176
|
+
id(): string;
|
|
177
|
+
/**
|
|
178
|
+
* @method orderBy
|
|
179
|
+
* @description Cette méthode ajoute un tri à la requête.
|
|
180
|
+
*
|
|
181
|
+
* @return {this}
|
|
182
|
+
* @param {string | FieldPath} fieldPath
|
|
183
|
+
* @param {OrderByDirection} directionStr
|
|
184
|
+
*/
|
|
185
|
+
orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): this;
|
|
186
|
+
/**
|
|
187
|
+
* @method limit
|
|
188
|
+
* @description Cette méthode ajoute une limite.
|
|
189
|
+
*
|
|
190
|
+
* @return {this}
|
|
191
|
+
* @param {number} _limit
|
|
192
|
+
*/
|
|
193
|
+
limit(_limit?: number): this;
|
|
194
|
+
/**
|
|
195
|
+
* @method limitToLast
|
|
196
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
197
|
+
*
|
|
198
|
+
* @return {this}
|
|
199
|
+
* @param {number} limit
|
|
200
|
+
*/
|
|
201
|
+
limitToLast(limit?: number): this;
|
|
202
|
+
/**
|
|
203
|
+
* @method startAfter
|
|
204
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
205
|
+
*
|
|
206
|
+
* @return {this}
|
|
207
|
+
* @param {any} value
|
|
208
|
+
*/
|
|
209
|
+
startAfter(value: any): this;
|
|
210
|
+
/**
|
|
211
|
+
* @method endBefore
|
|
212
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
213
|
+
*
|
|
214
|
+
* @return {this}
|
|
215
|
+
* @param {any} value
|
|
216
|
+
*/
|
|
217
|
+
endBefore(value: any): this;
|
|
218
|
+
/**
|
|
219
|
+
* @method startAt
|
|
220
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
221
|
+
*
|
|
222
|
+
* @return {this}
|
|
223
|
+
* @param {any} value
|
|
224
|
+
*/
|
|
225
|
+
startAt(value: any): this;
|
|
226
|
+
/**
|
|
227
|
+
* @method endAt
|
|
228
|
+
* @description Cette méthode ajoute une limite à la fin.
|
|
229
|
+
*
|
|
230
|
+
* @return {this}
|
|
231
|
+
* @param {any} value
|
|
232
|
+
*/
|
|
233
|
+
endAt(value: any): this;
|
|
234
|
+
/**
|
|
235
|
+
* @method first
|
|
236
|
+
* @description Cette méthode retourne le premier élément.
|
|
237
|
+
*
|
|
238
|
+
* @return {Promise}
|
|
239
|
+
*/
|
|
240
|
+
first(): Promise<Nullable<T>>;
|
|
241
|
+
offset(_offset?: number): this;
|
|
242
|
+
/**
|
|
243
|
+
* @method prepareData
|
|
244
|
+
* @description Cette méthode permet de mettre à jour un élément en fonction de son ID.
|
|
245
|
+
*
|
|
246
|
+
* @param {any} data
|
|
247
|
+
*
|
|
248
|
+
* @return {PreparedData}
|
|
249
|
+
*/
|
|
250
|
+
prepareData(data: any): PreparedData;
|
|
251
|
+
/**
|
|
252
|
+
* @method store
|
|
253
|
+
* @description Cette méthode permet d'ajouter un élément.
|
|
254
|
+
*
|
|
255
|
+
* @param {any} data
|
|
256
|
+
*
|
|
257
|
+
* @return {Promise}
|
|
258
|
+
*/
|
|
259
|
+
store(data: any): Promise<T | null>;
|
|
260
|
+
/**
|
|
261
|
+
* @method storeUnique
|
|
262
|
+
*
|
|
263
|
+
* @param {any} data
|
|
264
|
+
* @param {string[]} uniqueKeys
|
|
265
|
+
*
|
|
266
|
+
* @return {Promise<Nullable<T>>}
|
|
267
|
+
*/
|
|
268
|
+
storeUnique(data: any, uniqueKeys: string[]): Promise<Nullable<T>>;
|
|
269
|
+
/**
|
|
270
|
+
* @method storeMultiple
|
|
271
|
+
* @description Cette méthode permet d'ajouter plusieurs éléments.
|
|
272
|
+
*
|
|
273
|
+
* @param {any[]} values
|
|
274
|
+
*
|
|
275
|
+
* @return {Promise}
|
|
276
|
+
*/
|
|
277
|
+
storeMultiple(values: any[]): Promise<void>;
|
|
278
|
+
update(docID: string, data: any, force?: boolean): Promise<any>;
|
|
279
|
+
delete(docID?: string): Promise<any>;
|
|
280
|
+
/**
|
|
281
|
+
* @method softDelete
|
|
282
|
+
* @description Cette méthode permet de "soft supprimer" un élément en fonction de son ID.
|
|
283
|
+
*
|
|
284
|
+
* @param {string} docID
|
|
285
|
+
*
|
|
286
|
+
* @return {Promise<boolean>}
|
|
287
|
+
*/
|
|
288
|
+
softDelete(docID: string): Promise<boolean>;
|
|
289
|
+
/**
|
|
290
|
+
* @method whereIn
|
|
291
|
+
* @description Cette méthode permet de rechercher parmi les valeurs du tableau en paramètre.
|
|
292
|
+
*
|
|
293
|
+
* @param {string} column
|
|
294
|
+
* @param {string[]} values
|
|
295
|
+
*
|
|
296
|
+
* @return {Promise}
|
|
297
|
+
*/
|
|
298
|
+
whereIn(column: string, values: string[]): Promise<T[]>;
|
|
299
|
+
/**
|
|
300
|
+
* @method whereNotIn
|
|
301
|
+
* @description Cette méthode permet de rechercher parmi les valeurs du tableau en paramètre.
|
|
302
|
+
*
|
|
303
|
+
* @param {string} column
|
|
304
|
+
* @param {string[]} values
|
|
305
|
+
*
|
|
306
|
+
* @return {Promise}
|
|
307
|
+
*/
|
|
308
|
+
whereNotIn(column: string, values: string[]): Promise<T[]>;
|
|
309
|
+
/**
|
|
310
|
+
* @method count
|
|
311
|
+
* @description Cette méthode permet de compter le nombre d'éléments dans la requête.
|
|
312
|
+
*
|
|
313
|
+
* @param {boolean} all
|
|
314
|
+
*
|
|
315
|
+
* @return {Promise<number>}
|
|
316
|
+
*/
|
|
317
|
+
count(all?: boolean): Promise<number>;
|
|
318
|
+
get(cast?: boolean): Promise<any | null>;
|
|
319
|
+
snapshots(callback?: (value: any) => any, options?: {
|
|
320
|
+
cast?: boolean;
|
|
321
|
+
metaData?: boolean;
|
|
322
|
+
}): import("firebase/firestore").Unsubscribe | null;
|
|
323
|
+
private deleteWhere;
|
|
324
|
+
}
|