@data-weave/backend-firestore 0.4.6 → 0.4.8

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.
@@ -1,12 +1,12 @@
1
- import { Cache } from '@data-weave/datamanager/src/Cache';
2
- import { DataManager, WithMetadata } from '@data-weave/datamanager/src/DataManager';
3
- import { List, ListPaginationParams } from '@data-weave/datamanager/src/List';
4
- import { IdentifiableReference, WithoutId } from '@data-weave/datamanager/src/Reference';
5
- import { FirestoreList, FirestoreListContext } from './FirestoreList';
1
+ import { Cache, DataManager, IdentifiableReference, List, ListPaginationParams, WithMetadata, WithoutId } from '@data-weave/datamanager';
2
+ import { FirestoreListContext } from './FirestoreList';
6
3
  import { FirestoreSerializedMetadata } from './FirestoreMetadata';
7
- import { FirestoreReference, FirestoreReferenceContext } from './FirestoreReference';
4
+ import { FirestoreReferenceContext } from './FirestoreReference';
8
5
  import { FilterBy, FirebaseCreateOptions, Firestore, FirestoreDataConverter, FirestoreReadMode, FirestoreReadOptions, FirestoreTypes, FirestoreWriteOptions, OrderBy, WithFieldValue } from './firestoreTypes';
9
6
  export type FirebaseDataManagerDeleteMode = 'soft' | 'hard';
7
+ type Constructor<T = {}> = new (...args: any[]) => T;
8
+ export type FirestoreReferenceClass = Constructor<IdentifiableReference<any>>;
9
+ export type FirestoreListClass = Constructor<List<any>>;
10
10
  export interface FirebaseDataManagerOptions {
11
11
  readonly idResolver?: () => string;
12
12
  readonly deleteMode?: FirebaseDataManagerDeleteMode;
@@ -14,8 +14,8 @@ export interface FirebaseDataManagerOptions {
14
14
  readonly preventOverwriteOnCreate?: boolean;
15
15
  readonly errorInterceptor?: (error: unknown, ctx: FirestoreReferenceContext | FirestoreListContext) => void;
16
16
  readonly snapshotOptions?: FirestoreTypes.SnapshotOptions;
17
- readonly Reference?: typeof FirestoreReference;
18
- readonly List?: typeof FirestoreList;
17
+ readonly Reference?: FirestoreReferenceClass;
18
+ readonly List?: FirestoreListClass;
19
19
  readonly listCache?: Cache;
20
20
  readonly refCache?: Cache;
21
21
  }
@@ -36,13 +36,14 @@ export declare class FirestoreDataManager<T extends FirestoreTypes.DocumentData,
36
36
  private listCache;
37
37
  constructor(firestore: Firestore, collectionPath: string, converter: FirestoreDataConverter<T, SerializedT>, opts?: FirebaseDataManagerOptions | undefined);
38
38
  read(id: string, options?: FirestoreReadOptions): Promise<WithMetadata<T> | undefined>;
39
- create(data: WithFieldValue<WithoutId<T>>, options?: FirebaseCreateOptions): Promise<IdentifiableReference<WithMetadata<T>>>;
39
+ create(data: WithFieldValue<WithoutId<T>>, options?: FirebaseCreateOptions): Promise<IdentifiableReference<any>>;
40
40
  private _update;
41
41
  update(id: string, data: WithoutId<Partial<WithFieldValue<T>>>, options?: FirestoreWriteOptions): Promise<void>;
42
42
  upsert(id: string, data: WithFieldValue<WithoutId<T>>, options?: FirestoreWriteOptions): Promise<void>;
43
43
  delete(id: string, options?: FirestoreWriteOptions): Promise<void>;
44
- getRef(id: string): IdentifiableReference<WithMetadata<T>>;
44
+ getRef(id: string): IdentifiableReference<any>;
45
45
  private _getFilteredQuery;
46
- getList(params?: QueryParams<SerializedT> & ListPaginationParams): List<WithMetadata<T>>;
46
+ getList(params?: QueryParams<SerializedT> & ListPaginationParams): List<any>;
47
47
  private preventOverwriteOnCreate;
48
48
  }
49
+ export {};
@@ -49,7 +49,7 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.FirestoreDataManager = void 0;
51
51
  const inversify_1 = require("inversify");
52
- const Cache_1 = require("@data-weave/datamanager/src/Cache");
52
+ const datamanager_1 = require("@data-weave/datamanager");
53
53
  const FirestoreList_1 = require("./FirestoreList");
54
54
  const FirestoreMetadata_1 = require("./FirestoreMetadata");
55
55
  const FirestoreReference_1 = require("./FirestoreReference");
@@ -75,8 +75,8 @@ let FirestoreDataManager = (() => {
75
75
  // @ts-expect-error - Force merge FirestoreDataConverter and InternalFirestoreDataConverter
76
76
  this.mergedConverter = new utils_1.MergeConverters(this.converter, new FirestoreMetadata_1.FirestoreMetadataConverter());
77
77
  this.managerOptions = Object.assign(defaultFirebaseDataManagerOptions, this.opts);
78
- this.refCache = this.managerOptions.refCache || new Cache_1.MapCache(100);
79
- this.listCache = this.managerOptions.listCache || new Cache_1.MapCache(100);
78
+ this.refCache = this.managerOptions.refCache || new datamanager_1.MapCache(100);
79
+ this.listCache = this.managerOptions.listCache || new datamanager_1.MapCache(100);
80
80
  this.collection = this.firestore
81
81
  .collection(this.firestore.app, this.collectionPath)
82
82
  .withConverter(this.mergedConverter);
@@ -1,4 +1,4 @@
1
- import { ListPaginationParams, LiveList, LiveListOptions } from '@data-weave/datamanager/src';
1
+ import { ListPaginationParams, LiveList, LiveListOptions } from '@data-weave/datamanager';
2
2
  import { DocumentData, Firestore, FirestoreReadMode, FirestoreTypes } from './firestoreTypes';
3
3
  export interface FirestoreListContext {
4
4
  query: FirestoreTypes.Query<unknown>;
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.FirestoreList = void 0;
13
- const src_1 = require("@data-weave/datamanager/src");
14
- class FirestoreList extends src_1.LiveList {
13
+ const datamanager_1 = require("@data-weave/datamanager");
14
+ class FirestoreList extends datamanager_1.LiveList {
15
15
  constructor(firestore, query, options) {
16
16
  super(options);
17
17
  this.firestore = firestore;
@@ -1,4 +1,4 @@
1
- import { Metadata, WithoutId } from '@data-weave/datamanager/src';
1
+ import { Metadata, WithoutId } from '@data-weave/datamanager';
2
2
  import { DocumentData, FirestoreQuery, FirestoreTypes, FirestoreWhere, InternalFirestoreDataConverter, WithFieldValue } from './firestoreTypes';
3
3
  declare enum FIRESTORE_INTERAL_KEYS {
4
4
  DELETED = "__deleted",
@@ -1,4 +1,4 @@
1
- import { LiveReference, LiveReferenceOptions } from '@data-weave/datamanager/src';
1
+ import { LiveReference, LiveReferenceOptions } from '@data-weave/datamanager';
2
2
  import { DocumentData, Firestore, FirestoreReadMode, FirestoreTypes } from './firestoreTypes';
3
3
  export interface FirestoreReferenceContext {
4
4
  path: string;
@@ -10,9 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.FirestoreReference = void 0;
13
- const src_1 = require("@data-weave/datamanager/src");
13
+ const datamanager_1 = require("@data-weave/datamanager");
14
14
  const utils_1 = require("./utils");
15
- class FirestoreReference extends src_1.LiveReference {
15
+ class FirestoreReference extends datamanager_1.LiveReference {
16
16
  constructor(firestore, docRef, options) {
17
17
  super(options);
18
18
  this.firestore = firestore;
@@ -1,4 +1,4 @@
1
- import { WithoutId } from '@data-weave/datamanager/src';
1
+ import { WithoutId } from '@data-weave/datamanager';
2
2
  import type * as FirestoreTypes from '@firebase/firestore';
3
3
  import type { FieldPath, WithFieldValue as FirestoreWithFieldValue, QueryConstraint } from '@firebase/firestore';
4
4
  import type { HttpsCallable, HttpsCallableOptions } from '@firebase/functions-types';
package/lib/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { WithoutId } from '@data-weave/datamanager/src';
1
+ import { WithoutId } from '@data-weave/datamanager';
2
2
  import { DocumentData, Firestore, FirestoreTypes, InternalFirestoreDataConverter, Transaction, WithFieldValue } from './firestoreTypes';
3
3
  import { Firestore as FirebaseFirestore } from 'firebase/firestore';
4
4
  export declare class MergeConverters<T extends DocumentData, SerializedT extends DocumentData, G extends DocumentData, SerializedG extends DocumentData> implements InternalFirestoreDataConverter<T & G, SerializedT & SerializedG> {
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  // Generated by genversion.
3
- module.exports = '0.4.6';
3
+ module.exports = '0.4.8';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-weave/backend-firestore",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
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.5",
26
+ "@data-weave/datamanager": "0.4.7",
27
27
  "firebase": ">=11.0.0"
28
28
  },
29
- "gitHead": "2c6e04cf115b898b39b24782c3c2f15a92cc1604"
29
+ "gitHead": "b578fc01b811a4db83891959df0a218123edc136"
30
30
  }