@data-weave/backend-firestore 0.4.24 → 0.4.25

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.
@@ -15,6 +15,7 @@ export interface FirebaseDataManagerOptions {
15
15
  readonly List?: typeof FirestoreList;
16
16
  readonly listCache?: Cache;
17
17
  readonly refCache?: Cache;
18
+ readonly disableCache?: boolean;
18
19
  }
19
20
  export interface QueryParams<T> {
20
21
  readonly filters?: Array<FilterBy<T & FirestoreSerializedMetadata>>;
@@ -165,7 +165,7 @@ let FirestoreDataManager = (() => {
165
165
  var _a;
166
166
  if (!((_a = this.managerOptions) === null || _a === void 0 ? void 0 : _a.Reference))
167
167
  throw new Error('ReferenceClass not defined');
168
- if (this.refCache.has(id)) {
168
+ if (this.refCache.has(id) && !this.managerOptions.disableCache) {
169
169
  return this.refCache.get(id);
170
170
  }
171
171
  const newRef = new this.managerOptions.Reference(this.firestore, this.firestore.doc(this.collection, id), {
@@ -173,7 +173,9 @@ let FirestoreDataManager = (() => {
173
173
  errorInterceptor: this.managerOptions.errorInterceptor,
174
174
  snapshotOptions: this.managerOptions.snapshotOptions,
175
175
  });
176
- this.refCache.set(id, newRef);
176
+ if (!this.managerOptions.disableCache) {
177
+ this.refCache.set(id, newRef);
178
+ }
177
179
  return newRef;
178
180
  }
179
181
  _getFilteredQuery(params) {
@@ -192,11 +194,13 @@ let FirestoreDataManager = (() => {
192
194
  throw new Error('ListClass not defined');
193
195
  const compoundQuery = this._getFilteredQuery(params);
194
196
  const key = JSON.stringify(params || {});
195
- if (this.listCache.has(key)) {
197
+ if (this.listCache.has(key) && !this.managerOptions.disableCache) {
196
198
  return this.listCache.get(key);
197
199
  }
198
200
  const newList = new this.managerOptions.List(this.firestore, compoundQuery, Object.assign({ readMode: this.managerOptions.readMode, errorInterceptor: this.managerOptions.errorInterceptor }, params));
199
- this.listCache.set(key, newList);
201
+ if (!this.managerOptions.disableCache) {
202
+ this.listCache.set(key, newList);
203
+ }
200
204
  return newList;
201
205
  }
202
206
  preventOverwriteOnCreate(docRef, createOptions) {
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  // Generated by genversion.
3
- module.exports = '0.4.24';
3
+ module.exports = '0.4.25';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-weave/backend-firestore",
3
- "version": "0.4.24",
3
+ "version": "0.4.25",
4
4
  "author": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -23,8 +23,8 @@
23
23
  "registry": "https://registry.npmjs.org/"
24
24
  },
25
25
  "peerDependencies": {
26
- "@data-weave/datamanager": "~0.4.23",
26
+ "@data-weave/datamanager": "~0.4.24",
27
27
  "firebase": ">=11.0.0"
28
28
  },
29
- "gitHead": "6fed915392b808c1e4f737237d5a06b99a0b4ab6"
29
+ "gitHead": "e799ceb5e6670be8df92ffd3d5bd8f1e78de06f2"
30
30
  }