@_henriquewilson/gabirubi-domain 1.1.16 → 1.2.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.
@@ -1,6 +1,49 @@
1
- interface Timestamp {
2
- seconds: number;
3
- nanoseconds: number;
1
+ import * as _firebase_firestore from '@firebase/firestore';
2
+ import { Model } from '../model.mjs';
3
+ import { Firestore, QueryConstraint } from 'firebase/firestore';
4
+ import { FieldPath, WhereFilterOp } from '@google-cloud/firestore';
5
+ import 'zod';
6
+
7
+ interface Operator {
8
+ fieldPath: string | FieldPath;
9
+ opStr: WhereFilterOp;
10
+ value: string | object | number | boolean;
11
+ }
12
+ declare class FirestoreService {
13
+ private static _instance;
14
+ private static _firestore;
15
+ private _path;
16
+ private _id;
17
+ private _limit;
18
+ private _where;
19
+ private _orderBy;
20
+ private constructor();
21
+ /**
22
+ * Initialize singleton with Firestore instance
23
+ */
24
+ static init(firestore: Firestore): void;
25
+ /**
26
+ * Get singleton instance
27
+ */
28
+ static getInstance(): FirestoreService;
29
+ path(path: string): this;
30
+ id(id: string | number): this;
31
+ where(...where: QueryConstraint[]): this;
32
+ limit(limit: number): this;
33
+ orderBy(field: string, direction?: 'asc' | 'desc'): this;
34
+ get<T>(): Promise<T | null>;
35
+ getAll<T>(): Promise<T[]>;
36
+ onSnapshotById<T>(callback: (doc: T | null) => void, onNotFound?: () => void): _firebase_firestore.Unsubscribe;
37
+ onSnapshot<T>(callback: (docs: T[]) => void, onNotFound?: () => void): _firebase_firestore.Unsubscribe;
38
+ add<T>(data: T): Promise<T>;
39
+ set<T extends Model>(data: T, merge?: boolean): Promise<T>;
40
+ update<T>(data: T): Promise<void>;
41
+ delete(): Promise<void>;
42
+ save<T extends Model>(data: T, merge?: boolean): Promise<T>;
43
+ private static dataToModel;
44
+ private static replaceUndefined;
45
+ private reset;
46
+ private ensureFirestore;
4
47
  }
5
48
 
6
- export { Timestamp };
49
+ export { FirestoreService, Operator };
@@ -1,6 +1,49 @@
1
- interface Timestamp {
2
- seconds: number;
3
- nanoseconds: number;
1
+ import * as _firebase_firestore from '@firebase/firestore';
2
+ import { Model } from '../model.js';
3
+ import { Firestore, QueryConstraint } from 'firebase/firestore';
4
+ import { FieldPath, WhereFilterOp } from '@google-cloud/firestore';
5
+ import 'zod';
6
+
7
+ interface Operator {
8
+ fieldPath: string | FieldPath;
9
+ opStr: WhereFilterOp;
10
+ value: string | object | number | boolean;
11
+ }
12
+ declare class FirestoreService {
13
+ private static _instance;
14
+ private static _firestore;
15
+ private _path;
16
+ private _id;
17
+ private _limit;
18
+ private _where;
19
+ private _orderBy;
20
+ private constructor();
21
+ /**
22
+ * Initialize singleton with Firestore instance
23
+ */
24
+ static init(firestore: Firestore): void;
25
+ /**
26
+ * Get singleton instance
27
+ */
28
+ static getInstance(): FirestoreService;
29
+ path(path: string): this;
30
+ id(id: string | number): this;
31
+ where(...where: QueryConstraint[]): this;
32
+ limit(limit: number): this;
33
+ orderBy(field: string, direction?: 'asc' | 'desc'): this;
34
+ get<T>(): Promise<T | null>;
35
+ getAll<T>(): Promise<T[]>;
36
+ onSnapshotById<T>(callback: (doc: T | null) => void, onNotFound?: () => void): _firebase_firestore.Unsubscribe;
37
+ onSnapshot<T>(callback: (docs: T[]) => void, onNotFound?: () => void): _firebase_firestore.Unsubscribe;
38
+ add<T>(data: T): Promise<T>;
39
+ set<T extends Model>(data: T, merge?: boolean): Promise<T>;
40
+ update<T>(data: T): Promise<void>;
41
+ delete(): Promise<void>;
42
+ save<T extends Model>(data: T, merge?: boolean): Promise<T>;
43
+ private static dataToModel;
44
+ private static replaceUndefined;
45
+ private reset;
46
+ private ensureFirestore;
4
47
  }
5
48
 
6
- export { Timestamp };
49
+ export { FirestoreService, Operator };