@infrab4a/connect 4.4.0-beta.8 → 4.4.0-beta4
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/index.cjs.js +4 -11
- package/index.esm.js +4 -11
- package/package.json +1 -1
- package/src/infra/firebase/firestore/services/connect-collection-reference.d.ts +4 -4
- package/src/infra/firebase/firestore/services/connect-collection.service.d.ts +5 -5
- package/src/infra/firebase/firestore/services/connect-document-reference.d.ts +3 -3
- package/src/infra/firebase/firestore/services/connect-document.service.d.ts +3 -3
- package/src/infra/firebase/firestore/types/connect-firestore/{connect-document-snapshot.type.d.ts → connect-document-snapshop.type.d.ts} +1 -4
- package/src/infra/firebase/firestore/types/connect-firestore/connect-query-snapshot.type.d.ts +2 -2
- package/src/infra/firebase/firestore/types/connect-firestore/index.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -3650,10 +3650,7 @@ class ConnectDocumentService {
|
|
|
3650
3650
|
await firestore.deleteDoc(this.reference);
|
|
3651
3651
|
}
|
|
3652
3652
|
withConverter(params) {
|
|
3653
|
-
this.reference
|
|
3654
|
-
toFirestore: (data) => params.toFirestore(data),
|
|
3655
|
-
fromFirestore: (snapshot, options) => params.fromFirestore(snapshot, options),
|
|
3656
|
-
});
|
|
3653
|
+
this.reference.withConverter(params);
|
|
3657
3654
|
return this;
|
|
3658
3655
|
}
|
|
3659
3656
|
}
|
|
@@ -3672,7 +3669,7 @@ class ConnectCollectionService {
|
|
|
3672
3669
|
}
|
|
3673
3670
|
async add(data, id) {
|
|
3674
3671
|
const newDoc = await this.save(data, id);
|
|
3675
|
-
return new ConnectDocumentService(newDoc.path, this.firestore)
|
|
3672
|
+
return new ConnectDocumentService(newDoc.path, this.firestore);
|
|
3676
3673
|
}
|
|
3677
3674
|
async getDocs() {
|
|
3678
3675
|
const constraints = [
|
|
@@ -3686,7 +3683,7 @@ class ConnectCollectionService {
|
|
|
3686
3683
|
return firestore.getDocs(firestore.query(this.reference, ...constraints));
|
|
3687
3684
|
}
|
|
3688
3685
|
getDoc(id) {
|
|
3689
|
-
return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore)
|
|
3686
|
+
return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore);
|
|
3690
3687
|
}
|
|
3691
3688
|
where(attribute, operator, value) {
|
|
3692
3689
|
this.wheres.push(firestore.where(attribute, operator, value));
|
|
@@ -3713,11 +3710,7 @@ class ConnectCollectionService {
|
|
|
3713
3710
|
return this;
|
|
3714
3711
|
}
|
|
3715
3712
|
withConverter(params) {
|
|
3716
|
-
this.
|
|
3717
|
-
toFirestore: (data) => params.toFirestore(data),
|
|
3718
|
-
fromFirestore: (snapshot, options) => params.fromFirestore(snapshot, options),
|
|
3719
|
-
};
|
|
3720
|
-
this.reference = this.reference.withConverter(this.converter);
|
|
3713
|
+
this.reference.withConverter(params);
|
|
3721
3714
|
return this;
|
|
3722
3715
|
}
|
|
3723
3716
|
async save(data, id) {
|
package/index.esm.js
CHANGED
|
@@ -3626,10 +3626,7 @@ class ConnectDocumentService {
|
|
|
3626
3626
|
await deleteDoc(this.reference);
|
|
3627
3627
|
}
|
|
3628
3628
|
withConverter(params) {
|
|
3629
|
-
this.reference
|
|
3630
|
-
toFirestore: (data) => params.toFirestore(data),
|
|
3631
|
-
fromFirestore: (snapshot, options) => params.fromFirestore(snapshot, options),
|
|
3632
|
-
});
|
|
3629
|
+
this.reference.withConverter(params);
|
|
3633
3630
|
return this;
|
|
3634
3631
|
}
|
|
3635
3632
|
}
|
|
@@ -3648,7 +3645,7 @@ class ConnectCollectionService {
|
|
|
3648
3645
|
}
|
|
3649
3646
|
async add(data, id) {
|
|
3650
3647
|
const newDoc = await this.save(data, id);
|
|
3651
|
-
return new ConnectDocumentService(newDoc.path, this.firestore)
|
|
3648
|
+
return new ConnectDocumentService(newDoc.path, this.firestore);
|
|
3652
3649
|
}
|
|
3653
3650
|
async getDocs() {
|
|
3654
3651
|
const constraints = [
|
|
@@ -3662,7 +3659,7 @@ class ConnectCollectionService {
|
|
|
3662
3659
|
return getDocs(query(this.reference, ...constraints));
|
|
3663
3660
|
}
|
|
3664
3661
|
getDoc(id) {
|
|
3665
|
-
return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore)
|
|
3662
|
+
return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore);
|
|
3666
3663
|
}
|
|
3667
3664
|
where(attribute, operator, value) {
|
|
3668
3665
|
this.wheres.push(where(attribute, operator, value));
|
|
@@ -3689,11 +3686,7 @@ class ConnectCollectionService {
|
|
|
3689
3686
|
return this;
|
|
3690
3687
|
}
|
|
3691
3688
|
withConverter(params) {
|
|
3692
|
-
this.
|
|
3693
|
-
toFirestore: (data) => params.toFirestore(data),
|
|
3694
|
-
fromFirestore: (snapshot, options) => params.fromFirestore(snapshot, options),
|
|
3695
|
-
};
|
|
3696
|
-
this.reference = this.reference.withConverter(this.converter);
|
|
3689
|
+
this.reference.withConverter(params);
|
|
3697
3690
|
return this;
|
|
3698
3691
|
}
|
|
3699
3692
|
async save(data, id) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConnectQuerySnapshop, ConnectWhereOption } from '../types';
|
|
2
2
|
import { ConnectDocumentData } from '../types/connect-firestore/connect-document-data.type';
|
|
3
|
-
import { ConnectDocumentSnapshot
|
|
3
|
+
import { ConnectDocumentSnapshot } from '../types/connect-firestore/connect-document-snapshop.type';
|
|
4
4
|
import { ConnectDocumentReference } from './connect-document-reference';
|
|
5
5
|
export interface ConnectCollectionReference<T extends ConnectDocumentData> {
|
|
6
6
|
add(data: Partial<T>, id?: string): Promise<ConnectDocumentReference<T>>;
|
|
@@ -14,8 +14,8 @@ export interface ConnectCollectionReference<T extends ConnectDocumentData> {
|
|
|
14
14
|
fromStartAfter(startAt: ConnectDocumentReference<T>): ConnectCollectionReference<T>;
|
|
15
15
|
withConverter(converter: {
|
|
16
16
|
toFirestore: (data: T) => ConnectDocumentData<T>;
|
|
17
|
-
fromFirestore: (
|
|
17
|
+
fromFirestore: (snap: ConnectDocumentSnapshot<T>) => T;
|
|
18
18
|
}): ConnectCollectionReference<T>;
|
|
19
19
|
getDoc(id?: string): ConnectDocumentReference<T>;
|
|
20
|
-
getDocs(): Promise<
|
|
20
|
+
getDocs(): Promise<ConnectQuerySnapshop<T>>;
|
|
21
21
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Firestore } from 'firebase/firestore';
|
|
2
|
-
import { ConnectDocumentData,
|
|
2
|
+
import { ConnectDocumentData, ConnectQuerySnapshop, ConnectWhereOption } from '../types';
|
|
3
|
+
import { ConnectDocumentSnapshot } from '../types/connect-firestore/connect-document-snapshop.type';
|
|
3
4
|
import { ConnectCollectionReference } from './connect-collection-reference';
|
|
4
5
|
import { ConnectDocumentReference } from './connect-document-reference';
|
|
5
6
|
export declare class ConnectCollectionService<T extends ConnectDocumentData> implements ConnectCollectionReference<T> {
|
|
@@ -11,10 +12,9 @@ export declare class ConnectCollectionService<T extends ConnectDocumentData> imp
|
|
|
11
12
|
private offsetBy;
|
|
12
13
|
private statingAt;
|
|
13
14
|
private startingAfter;
|
|
14
|
-
private converter;
|
|
15
15
|
constructor(path: string, firestore: Firestore);
|
|
16
16
|
add(data: T, id?: string): Promise<ConnectDocumentReference<T>>;
|
|
17
|
-
getDocs(): Promise<
|
|
17
|
+
getDocs(): Promise<ConnectQuerySnapshop<T>>;
|
|
18
18
|
getDoc(id?: string): ConnectDocumentReference<T>;
|
|
19
19
|
where(attribute: string, operator: ConnectWhereOption, value: any): ConnectCollectionReference<T>;
|
|
20
20
|
order(attribute: string, order: 'asc' | 'desc'): ConnectCollectionReference<T>;
|
|
@@ -25,8 +25,8 @@ export declare class ConnectCollectionService<T extends ConnectDocumentData> imp
|
|
|
25
25
|
fromStartAfter(startingAt: number): ConnectCollectionReference<T>;
|
|
26
26
|
fromStartAfter(startingAt: ConnectDocumentReference<T>): ConnectCollectionReference<T>;
|
|
27
27
|
withConverter(params: {
|
|
28
|
-
toFirestore: (data: T) =>
|
|
29
|
-
fromFirestore: (snapshot: ConnectDocumentSnapshot
|
|
28
|
+
toFirestore: (data: T) => T;
|
|
29
|
+
fromFirestore: (snapshot: ConnectDocumentSnapshot<T>) => T;
|
|
30
30
|
}): ConnectCollectionReference<T>;
|
|
31
31
|
private save;
|
|
32
32
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ConnectDocumentData } from '../types/connect-firestore/connect-document-data.type';
|
|
2
|
-
import { ConnectDocumentSnapshot
|
|
2
|
+
import { ConnectDocumentSnapshot } from '../types/connect-firestore/connect-document-snapshop.type';
|
|
3
3
|
export interface ConnectDocumentReference<T extends ConnectDocumentData> {
|
|
4
4
|
get(): Promise<ConnectDocumentSnapshot<T>>;
|
|
5
5
|
getId(): string;
|
|
6
6
|
save(data: T): Promise<ConnectDocumentReference<T>>;
|
|
7
7
|
delete(): Promise<void>;
|
|
8
8
|
withConverter(converter: {
|
|
9
|
-
toFirestore: (data: T) =>
|
|
10
|
-
fromFirestore: (
|
|
9
|
+
toFirestore: (data: T) => T;
|
|
10
|
+
fromFirestore: (snap: ConnectDocumentSnapshot<T>) => T;
|
|
11
11
|
}): ConnectDocumentReference<T>;
|
|
12
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Firestore } from 'firebase/firestore';
|
|
2
|
-
import { ConnectDocumentData, ConnectDocumentSnapshot
|
|
2
|
+
import { ConnectDocumentData, ConnectDocumentSnapshot } from '../types';
|
|
3
3
|
import { ConnectDocumentReference } from './connect-document-reference';
|
|
4
4
|
export declare class ConnectDocumentService<T extends ConnectDocumentData> implements ConnectDocumentReference<T> {
|
|
5
5
|
private path;
|
|
@@ -11,7 +11,7 @@ export declare class ConnectDocumentService<T extends ConnectDocumentData> imple
|
|
|
11
11
|
save(data: T): Promise<ConnectDocumentReference<T>>;
|
|
12
12
|
delete(): Promise<void>;
|
|
13
13
|
withConverter(params: {
|
|
14
|
-
toFirestore: (data: T) =>
|
|
15
|
-
fromFirestore: (snapshot: ConnectDocumentSnapshot<T
|
|
14
|
+
toFirestore: (data: T) => T;
|
|
15
|
+
fromFirestore: (snapshot: ConnectDocumentSnapshot<T>) => T;
|
|
16
16
|
}): ConnectDocumentReference<T>;
|
|
17
17
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { ConnectDocumentData } from './connect-document-data.type';
|
|
2
|
-
export type ConnectSnapshotOptions = {
|
|
3
|
-
serverTimestamps?: 'estimate' | 'previous' | 'none';
|
|
4
|
-
};
|
|
5
2
|
export type ConnectDocumentSnapshot<T extends ConnectDocumentData = ConnectDocumentData> = {
|
|
6
3
|
exists(): boolean;
|
|
7
|
-
data(
|
|
4
|
+
data(): T | undefined;
|
|
8
5
|
get(fieldPath: string): any;
|
|
9
6
|
id: string;
|
|
10
7
|
};
|
package/src/infra/firebase/firestore/types/connect-firestore/connect-query-snapshot.type.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConnectDocumentData } from './connect-document-data.type';
|
|
2
|
-
import { ConnectDocumentSnapshot } from './connect-document-
|
|
3
|
-
export type
|
|
2
|
+
import { ConnectDocumentSnapshot } from './connect-document-snapshop.type';
|
|
3
|
+
export type ConnectQuerySnapshop<T extends ConnectDocumentData> = {
|
|
4
4
|
docs: ConnectDocumentSnapshot<T>[];
|
|
5
5
|
size: number;
|
|
6
6
|
empty: boolean;
|