@intuitionrobotics/firebase 0.42.60 → 0.42.61
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/app-backend/firestore/FirestoreV2Collection.d.ts +7 -0
- package/app-backend/firestore/FirestoreV2Collection.js +30 -0
- package/app-backend/firestore/FirestoreV2Collection.js.map +1 -0
- package/app-backend/firestore/FirestoreWrapper.d.ts +3 -0
- package/app-backend/firestore/FirestoreWrapper.js +9 -17
- package/app-backend/firestore/FirestoreWrapper.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FirestoreQuery } from "../../shared/types";
|
|
2
|
+
import { CollectionReference } from "firebase-admin/firestore";
|
|
3
|
+
import { Query } from "firebase-admin/lib/firestore";
|
|
4
|
+
export declare type FirestoreV2Collection<Type extends object> = CollectionReference<Type> & {
|
|
5
|
+
buildQuery: (query?: FirestoreQuery<Type>) => Query<Type>;
|
|
6
|
+
};
|
|
7
|
+
export declare const enchanceCollection: <Type extends object>(collection: CollectionReference<Type>) => FirestoreV2Collection<Type>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Firebase is a simpler Typescript wrapper to all of firebase services.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.enchanceCollection = void 0;
|
|
21
|
+
const FirestoreInterface_1 = require("./FirestoreInterface");
|
|
22
|
+
const enchanceCollection = (collection) => {
|
|
23
|
+
let collectionRef = collection;
|
|
24
|
+
collectionRef.buildQuery = (ourQuery) => {
|
|
25
|
+
return FirestoreInterface_1.FirestoreInterface.buildQuery(collection, ourQuery);
|
|
26
|
+
};
|
|
27
|
+
return collectionRef;
|
|
28
|
+
};
|
|
29
|
+
exports.enchanceCollection = enchanceCollection;
|
|
30
|
+
//# sourceMappingURL=FirestoreV2Collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirestoreV2Collection.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreV2Collection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAGH,6DAAwD;AAQjD,MAAM,kBAAkB,GAAG,CAAsB,UAAqC,EAA+B,EAAE;IAC1H,IAAI,aAAa,GAAG,UAAyC,CAAC;IAC9D,aAAa,CAAC,UAAU,GAAG,CAAC,QAA+B,EAAe,EAAE;QACxE,OAAO,uCAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC/D,CAAC,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B"}
|
|
@@ -3,11 +3,14 @@ import { FirestoreType, FirestoreType_Collection } from "./types";
|
|
|
3
3
|
import { FilterKeys } from "../../shared/types";
|
|
4
4
|
import { FirebaseSession } from "../auth/firebase-session";
|
|
5
5
|
import { FirebaseBaseWrapper } from "../auth/FirebaseBaseWrapper";
|
|
6
|
+
import { FirestoreV2Collection } from "./FirestoreV2Collection";
|
|
6
7
|
export declare class FirestoreWrapper extends FirebaseBaseWrapper {
|
|
7
8
|
readonly firestore: FirestoreType;
|
|
8
9
|
private readonly collections;
|
|
10
|
+
private readonly collectionsV2;
|
|
9
11
|
constructor(firebaseSession: FirebaseSession<any, any>);
|
|
10
12
|
getCollection<Type extends object>(name: string, externalFilterKeys?: FilterKeys<Type>): FirestoreCollection<Type>;
|
|
13
|
+
getCollectionV2<Type extends object>(name: string): FirestoreV2Collection<Type>;
|
|
11
14
|
getSdkInstance(): FirebaseFirestore.Firestore;
|
|
12
15
|
deleteCollection(name: string): Promise<object[]>;
|
|
13
16
|
listCollections(): Promise<FirestoreType_Collection[]>;
|
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Firebase is a simpler Typescript wrapper to all of firebase services.
|
|
4
|
-
*
|
|
5
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
20
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
21
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -30,10 +13,12 @@ exports.FirestoreWrapper = void 0;
|
|
|
30
13
|
const FirestoreCollection_1 = require("./FirestoreCollection");
|
|
31
14
|
const FirebaseBaseWrapper_1 = require("../auth/FirebaseBaseWrapper");
|
|
32
15
|
const firestore_1 = require("firebase-admin/firestore");
|
|
16
|
+
const FirestoreV2Collection_1 = require("./FirestoreV2Collection");
|
|
33
17
|
class FirestoreWrapper extends FirebaseBaseWrapper_1.FirebaseBaseWrapper {
|
|
34
18
|
constructor(firebaseSession) {
|
|
35
19
|
super(firebaseSession);
|
|
36
20
|
this.collections = {};
|
|
21
|
+
this.collectionsV2 = {};
|
|
37
22
|
this.firestore = firestore_1.getFirestore(firebaseSession.app);
|
|
38
23
|
}
|
|
39
24
|
getCollection(name, externalFilterKeys) {
|
|
@@ -42,6 +27,13 @@ class FirestoreWrapper extends FirebaseBaseWrapper_1.FirebaseBaseWrapper {
|
|
|
42
27
|
return collection;
|
|
43
28
|
return this.collections[name] = new FirestoreCollection_1.FirestoreCollection(name, this, externalFilterKeys);
|
|
44
29
|
}
|
|
30
|
+
getCollectionV2(name) {
|
|
31
|
+
const collection = this.collectionsV2[name];
|
|
32
|
+
if (collection)
|
|
33
|
+
return collection;
|
|
34
|
+
const enchanceCollection1 = FirestoreV2Collection_1.enchanceCollection(this.firestore.collection(name));
|
|
35
|
+
return this.collectionsV2[name] = enchanceCollection1;
|
|
36
|
+
}
|
|
45
37
|
getSdkInstance() {
|
|
46
38
|
return this.firestore;
|
|
47
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirestoreWrapper.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreWrapper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FirestoreWrapper.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreWrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA0D;AAI1D,qEAAgE;AAChE,wDAA2E;AAC3E,mEAAkF;AAGlF,MAAa,gBACT,SAAQ,yCAAmB;IAM3B,YAAY,eAA0C;QAClD,KAAK,CAAC,eAAe,CAAC,CAAC;QAJV,gBAAW,GAA2D,EAAE,CAAC;QACzE,kBAAa,GAA6D,EAAE,CAAC;QAI1F,IAAI,CAAC,SAAS,GAAG,wBAAY,CA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