@data-weave/backend-firestore 0.6.0 → 0.6.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-weave/backend-firestore",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "author": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,25 +8,6 @@
8
8
  "dist/**/*.js",
9
9
  "dist/**/*.d.ts"
10
10
  ],
11
- "sideEffects": false,
12
- "exports": {
13
- ".": {
14
- "types": "./dist/index.d.ts",
15
- "import": "./dist/index.js",
16
- "require": "./dist/index.js",
17
- "default": "./dist/index.js"
18
- },
19
- "./admin": {
20
- "types": "./dist/FirestoreAdminAdapter.d.ts",
21
- "import": "./dist/FirestoreAdminAdapter.js",
22
- "require": "./dist/FirestoreAdminAdapter.js",
23
- "default": "./dist/FirestoreAdminAdapter.js"
24
- },
25
- "./package.json": "./package.json"
26
- },
27
- "browser": {
28
- "./dist/FirestoreAdminAdapter.js": false
29
- },
30
11
  "scripts": {
31
12
  "clean": "rm -rf dist",
32
13
  "build": "tsc",
@@ -41,35 +22,13 @@
41
22
  "access": "public",
42
23
  "registry": "https://registry.npmjs.org/"
43
24
  },
44
- "peerDependencies": {
45
- "@data-weave/datamanager": "~0.6.0",
46
- "@firebase/firestore": "^4.7.8",
47
- "@google-cloud/firestore": "^7.11.1",
48
- "firebase": "^11.9.0 || ^12.0.0",
49
- "firebase-admin": "^12.0.0 || ^13.0.0"
50
- },
51
- "peerDependenciesMeta": {
52
- "@firebase/firestore": {
53
- "optional": true
54
- },
55
- "@google-cloud/firestore": {
56
- "optional": true
57
- },
58
- "firebase": {
59
- "optional": true
60
- },
61
- "firebase-admin": {
62
- "optional": true
63
- }
64
- },
65
25
  "devDependencies": {
66
- "@data-weave/datamanager": "~0.6.0",
26
+ "@data-weave/datamanager": "~0.6.2",
67
27
  "@firebase/firestore": "^4.7.8",
68
28
  "@firebase/functions-types": "^0.6.3",
69
29
  "@google-cloud/firestore": "^7.11.1",
70
30
  "@types/node": "^22.10.2",
71
31
  "firebase": "^11.9.0",
72
- "firebase-admin": "^13.0.0",
73
32
  "typescript": "5.9.3"
74
33
  },
75
34
  "gitHead": "df44d823b93b392d9e3b685fafb0d17399001291"
@@ -1,31 +0,0 @@
1
- import { type AggregateResult, type AggregateSpec, FieldValues, Firestore, FirestoreApp, FirestoreTypes } from './firestoreTypes';
2
- export declare class FirestoreAdminAdapter extends Firestore {
3
- readonly firestore: FirestoreApp;
4
- readonly fieldValues: FieldValues;
5
- app: FirestoreApp;
6
- constructor(firestore: FirestoreApp, fieldValues: FieldValues);
7
- collection(reference: any, path: string): any;
8
- getDocs(reference: any): any;
9
- getAggregateFromServer<Spec extends AggregateSpec>(query: any, spec: Spec): Promise<AggregateResult<Spec>>;
10
- getDoc(reference: any, path?: string): any;
11
- serverTimestamp(): FirestoreTypes.FieldValue;
12
- increment(n: number): FirestoreTypes.FieldValue;
13
- query(reference: any, filter: any): any;
14
- where(field: string | FirestoreTypes.FieldPath, op: string, value: unknown): any;
15
- limit(limit: number): {
16
- type: string;
17
- limit: number;
18
- };
19
- orderBy(orderBy: string, direction: FirestoreTypes.OrderByDirection): {
20
- type: string;
21
- field: string;
22
- direction: FirestoreTypes.OrderByDirection;
23
- };
24
- setDoc(reference: any, data: any, options?: FirestoreTypes.SetOptions): any;
25
- updateDoc(reference: any, data: any): any;
26
- deleteDoc(reference: any): any;
27
- doc(reference: any, path?: string): any;
28
- onSnapshot(reference: any, onNext: (snapshot: any) => void, onError?: (error: Error) => void): any;
29
- runTransaction<T>(firestore: FirestoreApp, transaction: (transaction: FirestoreTypes.Transaction) => Promise<T>, options?: FirestoreTypes.TransactionOptions): Promise<T>;
30
- }
31
- //# sourceMappingURL=FirestoreAdminAdapter.d.ts.map
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FirestoreAdminAdapter = void 0;
4
- const firestore_1 = require("firebase-admin/firestore");
5
- const firestoreTypes_1 = require("./firestoreTypes");
6
- /*
7
- * FirestoreAdminAdapter creates an interface between modular and namespaced
8
- * firestore libraries.
9
- * - admin sdk doesn't support modular imports
10
- */
11
- // TODO: add types
12
- /* eslint-disable @typescript-eslint/no-explicit-any */
13
- class FirestoreAdminAdapter extends firestoreTypes_1.Firestore {
14
- firestore;
15
- fieldValues;
16
- app;
17
- constructor(firestore, fieldValues) {
18
- super();
19
- this.firestore = firestore;
20
- this.fieldValues = fieldValues;
21
- this.app = firestore;
22
- this.fieldValues = fieldValues;
23
- }
24
- collection(reference, path) {
25
- return reference.collection(path);
26
- }
27
- getDocs(reference) {
28
- return reference.get();
29
- }
30
- async getAggregateFromServer(query, spec) {
31
- const adminSpec = Object.fromEntries(Object.keys(spec).map(alias => {
32
- const fieldSpec = spec[alias];
33
- if (fieldSpec.type === 'count') {
34
- return [alias, firestore_1.AggregateField.count()];
35
- }
36
- return [alias, firestore_1.AggregateField[fieldSpec.type](fieldSpec.field)];
37
- }));
38
- const snapshot = await query.aggregate(adminSpec).get();
39
- return snapshot.data();
40
- }
41
- getDoc(reference, path) {
42
- return reference.get(path);
43
- }
44
- serverTimestamp() {
45
- return this.fieldValues.serverTimestamp();
46
- }
47
- increment(n) {
48
- return this.fieldValues.increment(n);
49
- }
50
- query(reference, filter) {
51
- if (filter.type === 'where') {
52
- return reference.where(filter.field, filter.op, filter.value);
53
- }
54
- if (filter.type === 'orderBy') {
55
- return reference.orderBy(filter.field, filter.direction);
56
- }
57
- if (filter.type === 'limit') {
58
- return reference.limit(filter.limit);
59
- }
60
- }
61
- where(field, op, value) {
62
- return {
63
- type: 'where',
64
- field,
65
- op,
66
- value,
67
- };
68
- }
69
- limit(limit) {
70
- return {
71
- type: 'limit',
72
- limit,
73
- };
74
- }
75
- orderBy(orderBy, direction) {
76
- return {
77
- type: 'orderBy',
78
- field: orderBy,
79
- direction,
80
- };
81
- }
82
- setDoc(reference, data, options) {
83
- return reference.set(data, options);
84
- }
85
- updateDoc(reference, data) {
86
- return reference.update(data);
87
- }
88
- deleteDoc(reference) {
89
- return reference.delete();
90
- }
91
- doc(reference, path) {
92
- if (!path)
93
- return reference.doc();
94
- return reference.doc(path);
95
- }
96
- onSnapshot(reference, onNext, onError) {
97
- return reference.onSnapshot(onNext, onError);
98
- }
99
- runTransaction(firestore, transaction, options) {
100
- // firestore.runTransaction is Admin SDK specific
101
- return firestore.runTransaction(transaction, options);
102
- }
103
- }
104
- exports.FirestoreAdminAdapter = FirestoreAdminAdapter;
105
- /* eslint-enable @typescript-eslint/no-explicit-any */
106
- //# sourceMappingURL=FirestoreAdminAdapter.js.map