@nx-ddd/firestore 20.69.4 → 20.73.0

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,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable } from '@angular/core';
3
- import admin from 'firebase-admin';
3
+ import * as adminFirestore from 'firebase-admin/firestore';
4
4
  import { Subject } from 'rxjs';
5
5
  import { FirestoreAdapter, provideFirestoreAdapter as provideFirestoreAdapter$1 } from '@nx-ddd/firestore';
6
6
 
@@ -25,15 +25,15 @@ function unwrapCollectionLike(collection) {
25
25
  return collection.__ref;
26
26
  }
27
27
  class AdminFirestoreAdapter extends FirestoreAdapter {
28
- firestore = admin.firestore();
28
+ firestore = adminFirestore.getFirestore();
29
29
  get FieldValue() {
30
- return admin.firestore.FieldValue;
30
+ return adminFirestore.FieldValue;
31
31
  }
32
32
  get Timestamp() {
33
- return admin.firestore.Timestamp;
33
+ return adminFirestore.Timestamp;
34
34
  }
35
35
  get FieldPath() {
36
- return admin.firestore.FieldPath;
36
+ return adminFirestore.FieldPath;
37
37
  }
38
38
  isTimestamp(v) {
39
39
  return v instanceof this.Timestamp;
@@ -43,7 +43,7 @@ class AdminFirestoreAdapter extends FirestoreAdapter {
43
43
  }
44
44
  convertDateToTimestamp(date) {
45
45
  if (this.dateAdapter.isDate(date) && this.dateAdapter.isValid(date)) {
46
- return admin.firestore.Timestamp.fromDate(this.dateAdapter.getJsDate(date));
46
+ return adminFirestore.Timestamp.fromDate(this.dateAdapter.getJsDate(date));
47
47
  }
48
48
  throw new Error(`Invalid date: ${date}`);
49
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx-ddd/firestore",
3
- "version": "20.69.4",
3
+ "version": "20.73.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "homepage": "https://github.com/xx-machina/plaform/tree/main/packages/@nx-ddd/firestore",
@@ -9,8 +9,8 @@
9
9
  "url": "https://github.com/xx-machina/plaform.git"
10
10
  },
11
11
  "peerDependencies": {
12
- "@nx-ddd/common": "20.69.4",
13
- "@nx-ddd/core": "20.69.4"
12
+ "@nx-ddd/common": "20.73.0",
13
+ "@nx-ddd/core": "20.73.0"
14
14
  },
15
15
  "dependencies": {
16
16
  "tslib": "^2.3.0"
@@ -1,26 +1,26 @@
1
- import admin from 'firebase-admin';
1
+ import * as adminFirestore from 'firebase-admin/firestore';
2
2
  import { DocumentData, Transaction } from 'firebase-admin/firestore';
3
3
  import { CollectionReference as CollectionReference$1, CollectionGroup as CollectionGroup$1, Query as Query$1, FirestoreAdapter, DocumentReference, QueryFn as QueryFn$1, WhereFilterOp } from '@nx-ddd/firestore';
4
4
  import * as i0 from '@angular/core';
5
5
 
6
- type CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = CollectionReference$1<AppModelType, DbModelType, admin.firestore.CollectionReference<AppModelType, DbModelType>>;
7
- type CollectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = CollectionGroup$1<AppModelType, DbModelType, admin.firestore.CollectionGroup<AppModelType, DbModelType>>;
8
- type Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = Query$1<AppModelType, DbModelType, admin.firestore.Query<AppModelType, DbModelType>>;
9
- type QueryFn<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = QueryFn$1<AppModelType, DbModelType, admin.firestore.Query>;
10
- type Origin<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = admin.firestore.CollectionReference<AppModelType, DbModelType> | admin.firestore.CollectionGroup<AppModelType, DbModelType> | admin.firestore.Query<AppModelType, DbModelType>;
6
+ type CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = CollectionReference$1<AppModelType, DbModelType, adminFirestore.CollectionReference<AppModelType, DbModelType>>;
7
+ type CollectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = CollectionGroup$1<AppModelType, DbModelType, adminFirestore.CollectionGroup<AppModelType, DbModelType>>;
8
+ type Query<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = Query$1<AppModelType, DbModelType, adminFirestore.Query<AppModelType, DbModelType>>;
9
+ type QueryFn<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = QueryFn$1<AppModelType, DbModelType, adminFirestore.Query>;
10
+ type Origin<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> = adminFirestore.CollectionReference<AppModelType, DbModelType> | adminFirestore.CollectionGroup<AppModelType, DbModelType> | adminFirestore.Query<AppModelType, DbModelType>;
11
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 admin.firestore.CollectionReference<infer A, infer B> ? CollectionReference<A, B> : O extends admin.firestore.CollectionGroup<infer A, infer B> ? CollectionGroup<A, B> : O extends admin.firestore.Query<infer A, infer B> ? Query<A, B> : never;
12
+ type InferCollectionLike<O extends Origin> = O extends adminFirestore.CollectionReference<infer A, infer B> ? CollectionReference<A, B> : O extends adminFirestore.CollectionGroup<infer A, infer B> ? CollectionGroup<A, B> : O extends adminFirestore.Query<infer A, infer B> ? Query<A, B> : never;
13
13
  declare function wrapCollectionLike<O extends Origin>(origin: O): InferCollectionLike<O>;
14
14
  declare function unwrapCollectionLike<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(collection: CollectionLike<AppModelType, DbModelType>): Origin<AppModelType, DbModelType>;
15
15
  declare class AdminFirestoreAdapter<Date> extends FirestoreAdapter<Date> {
16
- protected firestore: admin.firestore.Firestore;
17
- get FieldValue(): typeof admin.firestore.FieldValue;
18
- get Timestamp(): typeof admin.firestore.Timestamp;
19
- get FieldPath(): typeof admin.firestore.FieldPath;
20
- protected isTimestamp(v: any): v is admin.firestore.Timestamp;
21
- protected isFieldValue(v: any): v is admin.firestore.FieldValue;
22
- convertDateToTimestamp(date: Date): admin.firestore.Timestamp;
23
- doc(path: string): DocumentReference<any, admin.firestore.DocumentReference>;
16
+ protected firestore: adminFirestore.Firestore;
17
+ get FieldValue(): typeof adminFirestore.FieldValue;
18
+ get Timestamp(): typeof adminFirestore.Timestamp;
19
+ get FieldPath(): typeof adminFirestore.FieldPath;
20
+ protected isTimestamp(v: any): v is adminFirestore.Timestamp;
21
+ protected isFieldValue(v: any): v is adminFirestore.FieldValue;
22
+ convertDateToTimestamp(date: Date): adminFirestore.Timestamp;
23
+ doc(path: string): DocumentReference<any, adminFirestore.DocumentReference>;
24
24
  collection<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(path: string): CollectionReference<AppModelType, DbModelType>;
25
25
  collectionGroup<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(collectionId: string): CollectionGroup<AppModelType, DbModelType>;
26
26
  runTransaction<T>(updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
@@ -28,7 +28,7 @@ declare class AdminFirestoreAdapter<Date> extends FirestoreAdapter<Date> {
28
28
  where<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(key: string, evaluation: WhereFilterOp, value: unknown): QueryFn<AppModelType, DbModelType>;
29
29
  orderBy<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(key: string, order?: 'asc' | 'desc'): QueryFn<AppModelType, DbModelType>;
30
30
  limit<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>(n: number): QueryFn<AppModelType, DbModelType>;
31
- batch(): admin.firestore.WriteBatch;
31
+ batch(): adminFirestore.WriteBatch;
32
32
  static ɵfac: i0.ɵɵFactoryDeclaration<AdminFirestoreAdapter<any>, never>;
33
33
  static ɵprov: i0.ɵɵInjectableDeclaration<AdminFirestoreAdapter<any>>;
34
34
  }