@intuitionrobotics/firebase 0.46.0 → 0.47.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.
- package/app-backend/FirebaseModule.d.ts +3 -3
- package/app-backend/FirebaseModule.js +9 -12
- package/app-backend/FirebaseModule.js.map +1 -1
- package/app-backend/auth/FirebaseBaseWrapper.d.ts +1 -1
- package/app-backend/auth/FirebaseBaseWrapper.js +19 -2
- package/app-backend/auth/FirebaseBaseWrapper.js.map +1 -1
- package/app-backend/auth/FirebaseSession_Admin.js +23 -6
- package/app-backend/auth/FirebaseSession_Admin.js.map +1 -1
- package/app-backend/auth/FirebaseSession_UserPassword.js.map +1 -1
- package/app-backend/auth/firebase-session.d.ts +3 -3
- package/app-backend/auth/firebase-session.js +19 -2
- package/app-backend/auth/firebase-session.js.map +1 -1
- package/app-backend/database/DatabaseWrapper.d.ts +3 -3
- package/app-backend/database/DatabaseWrapper.js +10 -11
- package/app-backend/database/DatabaseWrapper.js.map +1 -1
- package/app-backend/database/types.d.ts +3 -3
- package/app-backend/database/types.js +17 -0
- package/app-backend/database/types.js.map +1 -1
- package/app-backend/firestore/FirestoreCollection.d.ts +7 -5
- package/app-backend/firestore/FirestoreCollection.js +22 -7
- package/app-backend/firestore/FirestoreCollection.js.map +1 -1
- package/app-backend/firestore/FirestoreInterface.d.ts +1 -1
- package/app-backend/firestore/FirestoreInterface.js +25 -10
- package/app-backend/firestore/FirestoreInterface.js.map +1 -1
- package/app-backend/firestore/FirestoreTransaction.d.ts +1 -1
- package/app-backend/firestore/FirestoreTransaction.js +22 -6
- package/app-backend/firestore/FirestoreTransaction.js.map +1 -1
- package/app-backend/firestore/FirestoreV2Collection.d.ts +1 -1
- package/app-backend/firestore/FirestoreV2Collection.js +17 -0
- package/app-backend/firestore/FirestoreV2Collection.js.map +1 -1
- package/app-backend/firestore/FirestoreWrapper.js +2 -2
- package/app-backend/firestore/FirestoreWrapper.js.map +1 -1
- package/app-backend/firestore/types.d.ts +9 -9
- package/app-backend/firestore/types.js +17 -0
- package/app-backend/firestore/types.js.map +1 -1
- package/app-backend/functions/firebase-function.d.ts +18 -12
- package/app-backend/functions/firebase-function.js +78 -32
- package/app-backend/functions/firebase-function.js.map +1 -1
- package/app-backend/push/PushMessagesWrapper.d.ts +1 -1
- package/app-backend/push/PushMessagesWrapper.js +18 -1
- package/app-backend/push/PushMessagesWrapper.js.map +1 -1
- package/app-backend/push/types.d.ts +8 -8
- package/app-backend/push/types.js +17 -0
- package/app-backend/push/types.js.map +1 -1
- package/app-backend/storage/StorageWrapper.js +25 -9
- package/app-backend/storage/StorageWrapper.js.map +1 -1
- package/app-backend/storage/types.d.ts +4 -4
- package/app-backend/storage/types.js +17 -0
- package/app-backend/storage/types.js.map +1 -1
- package/app-frontend/FirebaseModule.d.ts +3 -3
- package/app-frontend/FirebaseModule.js +5 -6
- package/app-frontend/FirebaseModule.js.map +1 -1
- package/app-frontend/analytics/AnalyticsModule.d.ts +1 -1
- package/app-frontend/analytics/AnalyticsModule.js +21 -5
- package/app-frontend/analytics/AnalyticsModule.js.map +1 -1
- package/app-frontend/analytics/AnalyticsWrapper.d.ts +1 -1
- package/app-frontend/analytics/AnalyticsWrapper.js +24 -6
- package/app-frontend/analytics/AnalyticsWrapper.js.map +1 -1
- package/app-frontend/analytics/types.d.ts +3 -3
- package/app-frontend/analytics/types.js +18 -0
- package/app-frontend/analytics/types.js.map +1 -1
- package/app-frontend/auth/FirebaseSession.d.ts +2 -2
- package/app-frontend/auth/FirebaseSession.js +11 -12
- package/app-frontend/auth/FirebaseSession.js.map +1 -1
- package/app-frontend/auth/SwFirebaseSession.d.ts +1 -1
- package/app-frontend/auth/SwFirebaseSession.js +4 -3
- package/app-frontend/auth/SwFirebaseSession.js.map +1 -1
- package/app-frontend/database/DatabaseWrapper.d.ts +1 -1
- package/app-frontend/database/DatabaseWrapper.js +33 -16
- package/app-frontend/database/DatabaseWrapper.js.map +1 -1
- package/app-frontend/database/types.d.ts +1 -1
- package/app-frontend/database/types.js +17 -0
- package/app-frontend/database/types.js.map +1 -1
- package/app-frontend/messaging/MessagingWrapper.d.ts +1 -1
- package/app-frontend/messaging/MessagingWrapper.js +21 -4
- package/app-frontend/messaging/MessagingWrapper.js.map +1 -1
- package/app-frontend/messaging/SwMessagingWrapper.d.ts +1 -1
- package/app-frontend/messaging/SwMessagingWrapper.js +21 -3
- package/app-frontend/messaging/SwMessagingWrapper.js.map +1 -1
- package/app-frontend/messaging/types.d.ts +2 -2
- package/app-frontend/messaging/types.js +17 -0
- package/app-frontend/messaging/types.js.map +1 -1
- package/backend-functions.d.ts +1 -0
- package/backend-functions.js +35 -0
- package/backend-functions.js.map +1 -0
- package/backend.d.ts +13 -0
- package/backend.js +48 -0
- package/backend.js.map +1 -0
- package/frontend.d.ts +4 -0
- package/frontend.js +39 -0
- package/frontend.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +33 -0
- package/index.js.map +1 -1
- package/package.json +6 -6
- package/shared/types.d.ts +18 -15
- package/shared/types.js +17 -0
- package/shared/types.js.map +1 -1
|
@@ -1,10 +1,25 @@
|
|
|
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
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.FirestoreInterface = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const tools_1 = require("@intuitionrobotics/ts-common/utils/tools");
|
|
7
|
-
const object_tools_1 = require("@intuitionrobotics/ts-common/utils/object-tools");
|
|
21
|
+
const __1 = require("../..");
|
|
22
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
8
23
|
class FirestoreInterface {
|
|
9
24
|
static buildQuery(collection, query) {
|
|
10
25
|
let myQuery = collection;
|
|
@@ -21,7 +36,7 @@ class FirestoreInterface {
|
|
|
21
36
|
const valueType = typeof _whereValue;
|
|
22
37
|
if (Array.isArray(_whereValue)) {
|
|
23
38
|
if (_whereValue.length === 0 || _whereValue.length > 10)
|
|
24
|
-
throw new
|
|
39
|
+
throw new ts_common_1.BadImplementationException("While querying in an array you can only provide one or more values to query by and not more than 10... this " +
|
|
25
40
|
"is due to Firestore limitation... ");
|
|
26
41
|
if (_whereValue.length === 1)
|
|
27
42
|
return _query.where(whereKey, 'array-contains', _whereValue[0]);
|
|
@@ -29,7 +44,7 @@ class FirestoreInterface {
|
|
|
29
44
|
}
|
|
30
45
|
if (this.isQueryObject(_whereValue)) {
|
|
31
46
|
// @ts-ignore
|
|
32
|
-
return _query.where(whereKey,
|
|
47
|
+
return _query.where(whereKey, __1.ComparatorMap[Object.keys(_whereValue)[0]], Object.values(_whereValue)[0]);
|
|
33
48
|
}
|
|
34
49
|
if (valueType === "string" || valueType === "number" || valueType === "boolean")
|
|
35
50
|
return ___query.where(whereKey, "==", _whereValue);
|
|
@@ -38,7 +53,7 @@ class FirestoreInterface {
|
|
|
38
53
|
return processObject(__query, `${whereKey}.${key}`, _whereValue[key]);
|
|
39
54
|
}, ___query);
|
|
40
55
|
}
|
|
41
|
-
throw new
|
|
56
|
+
throw new ts_common_1.ImplementationMissingException(`Could not compose where clause for '${whereKey}' with value type '${valueType}'in query: ${(0, ts_common_1.__stringify)(___query)}`);
|
|
42
57
|
};
|
|
43
58
|
return processObject(_query, whereField, whereValue);
|
|
44
59
|
}, myQuery);
|
|
@@ -65,16 +80,16 @@ class FirestoreInterface {
|
|
|
65
80
|
}
|
|
66
81
|
static assertUniqueDocument(results, query, collectionName) {
|
|
67
82
|
if (results.length > 1)
|
|
68
|
-
throw new
|
|
83
|
+
throw new ts_common_1.BadImplementationException(`too many results for query: ${(0, ts_common_1.__stringify)(query)} in collection: ${collectionName}`);
|
|
69
84
|
if (results.length === 0)
|
|
70
85
|
return;
|
|
71
86
|
return results[0];
|
|
72
87
|
}
|
|
73
88
|
;
|
|
74
89
|
static buildUniqueQuery(collection, instance) {
|
|
75
|
-
|
|
90
|
+
(0, ts_common_1._keys)(instance).forEach((key) => {
|
|
76
91
|
if (instance[key] === undefined || instance[key] === null) {
|
|
77
|
-
throw new
|
|
92
|
+
throw new ts_common_1.BadImplementationException(`No where properties are allowed to be null or undefined.\nWhile querying collection '${collection.name}' we found property '${String(key)}' to be '${instance[key]}'`);
|
|
78
93
|
}
|
|
79
94
|
});
|
|
80
95
|
const where = collection.externalUniqueFilter(instance);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirestoreInterface.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreInterface.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"FirestoreInterface.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreInterface.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,6BAGe;AAMf,4DAKsC;AAGtC,MAAa,kBAAkB;IAE9B,MAAM,CAAC,UAAU,CAAsB,UAAqC,EAAE,KAA4B;QACzG,IAAI,OAAO,GAAe,UAAU,CAAC;QACrC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM;YACxB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAkB,CAAC,CAAC;QAEvD,IA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U,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QACxD,OAAO,EAAC,KAAK,EAAC,CAAC;IAChB,CAAC;CACD;AAlGD,gDAkGC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as admin from "firebase-admin";
|
|
2
2
|
import { firestore } from "firebase-admin";
|
|
3
3
|
import { FirestoreCollection } from "./FirestoreCollection";
|
|
4
|
+
import { Subset } from "@intuitionrobotics/ts-common";
|
|
4
5
|
import { FirestoreQuery } from "../../shared/types";
|
|
5
6
|
import { SetOptions } from "firebase-admin/firestore";
|
|
6
|
-
import { Subset } from "@intuitionrobotics/ts-common/utils/types";
|
|
7
7
|
import Transaction = firestore.Transaction;
|
|
8
8
|
export declare class FirestoreTransaction {
|
|
9
9
|
private transaction;
|
|
@@ -1,4 +1,21 @@
|
|
|
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
|
+
*/
|
|
2
19
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
20
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
21
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,9 +27,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
27
|
};
|
|
11
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
29
|
exports.FirestoreTransaction = void 0;
|
|
30
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
13
31
|
const FirestoreInterface_1 = require("./FirestoreInterface");
|
|
14
|
-
const exceptions_1 = require("@intuitionrobotics/ts-common/core/exceptions");
|
|
15
|
-
const merge_tools_1 = require("@intuitionrobotics/ts-common/utils/merge-tools");
|
|
16
32
|
class FirestoreTransaction {
|
|
17
33
|
constructor(transaction) {
|
|
18
34
|
this.transaction = transaction;
|
|
@@ -90,7 +106,7 @@ class FirestoreTransaction {
|
|
|
90
106
|
upsertAll(collection, instances) {
|
|
91
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
92
108
|
if (instances.length > 500)
|
|
93
|
-
throw new
|
|
109
|
+
throw new ts_common_1.BadImplementationException('Firestore transaction supports maximum 500 at a time');
|
|
94
110
|
return (yield this.upsertAll_Read(collection, instances))();
|
|
95
111
|
});
|
|
96
112
|
}
|
|
@@ -109,9 +125,9 @@ class FirestoreTransaction {
|
|
|
109
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
126
|
const doc = yield this._queryItem(collection, instance);
|
|
111
127
|
if (!doc)
|
|
112
|
-
throw new
|
|
128
|
+
throw new ts_common_1.BadImplementationException(`Patching a non existent doc for query ${FirestoreInterface_1.FirestoreInterface.buildUniqueQuery(collection, instance)}`);
|
|
113
129
|
return () => {
|
|
114
|
-
const patchedInstance =
|
|
130
|
+
const patchedInstance = (0, ts_common_1.merge)(doc.data(), instance);
|
|
115
131
|
this.transaction.set(doc.ref, patchedInstance);
|
|
116
132
|
return patchedInstance;
|
|
117
133
|
};
|
|
@@ -126,7 +142,7 @@ class FirestoreTransaction {
|
|
|
126
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
143
|
const docs = yield this._query(collection, ourQuery);
|
|
128
144
|
if (docs.length > 500)
|
|
129
|
-
throw new
|
|
145
|
+
throw new ts_common_1.BadImplementationException(`Trying to delete ${docs.length} documents. Not allowed more then 5oo in a single transaction`);
|
|
130
146
|
return () => {
|
|
131
147
|
const toReturn = docs.map(doc => doc.data());
|
|
132
148
|
docs.forEach((doc) => this.transaction.delete(doc.ref));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirestoreTransaction.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FirestoreTransaction.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreTransaction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;AAMH,4DAAuF;AAEvF,6DAAwD;AAIxD,MAAa,oBAAoB;IAG7B,YAAY,WAAwC;QAChD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAEa,MAAM,CAAsB,UAAqC,EAAE,QAA8B;;YAC3G,MAAM,KAAK,GAAgB,uCAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAC1F,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QACpD,CAAC;KAAA;IAEa,YAAY,CAAsB,UAAqC,EAAE,QAA8B;;YACjH,MAAM,OAAO,GAAgD,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACrG,OAAO,uCAAkB,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QACvF,CAAC;KAAA;IAEa,UAAU,CAAsB,UAAqC,EAAE,QAAsB;;YACvG,MAAM,QAAQ,GAAG,uCAAkB,CAAC,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YA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,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACjC,OAAO,MAAM,CAAC;YAClB,CAAC,CAAA;QACL,CAAC;KAAA;IAID,GAAG,CAAsB,UAAqC,EAAE,QAAa,EAAE,EAAU,EAAE,OAAa;QACpG,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAsB,UAAqC,EAAE,QAAc,EAAE,EAAU;QACzF,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC5E,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;CACJ;AArKD,oDAqKC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FirestoreQuery } from "../../shared/types";
|
|
2
2
|
import { CollectionReference } from "firebase-admin/firestore";
|
|
3
3
|
import { Query } from "firebase-admin/lib/firestore";
|
|
4
|
-
export
|
|
4
|
+
export type FirestoreV2Collection<Type extends object> = CollectionReference<Type> & {
|
|
5
5
|
buildQuery: (query?: FirestoreQuery<Type>) => Query<Type>;
|
|
6
6
|
};
|
|
7
7
|
export declare const enhanceCollection: <Type extends object>(collection: CollectionReference<Type>) => FirestoreV2Collection<Type>;
|
|
@@ -1,4 +1,21 @@
|
|
|
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
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
exports.enhanceCollection = void 0;
|
|
4
21
|
const FirestoreInterface_1 = require("./FirestoreInterface");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirestoreV2Collection.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreV2Collection.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"FirestoreV2Collection.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreV2Collection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAGH,6DAAwD;AAQjD,MAAM,iBAAiB,GAAG,CAAsB,UAAqC,EAA+B,EAAE;IACzH,MAAM,aAAa,GAAG,UAAyC,CAAC;IAChE,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,iBAAiB,qBAO5B"}
|
|
@@ -19,7 +19,7 @@ class FirestoreWrapper extends FirebaseBaseWrapper_1.FirebaseBaseWrapper {
|
|
|
19
19
|
super(firebaseSession);
|
|
20
20
|
this.collections = {};
|
|
21
21
|
this.collectionsV2 = {};
|
|
22
|
-
this.firestore = firestore_1.getFirestore(firebaseSession.app);
|
|
22
|
+
this.firestore = (0, firestore_1.getFirestore)(firebaseSession.app);
|
|
23
23
|
}
|
|
24
24
|
getCollection(name, externalFilterKeys) {
|
|
25
25
|
const collection = this.collections[name];
|
|
@@ -31,7 +31,7 @@ class FirestoreWrapper extends FirebaseBaseWrapper_1.FirebaseBaseWrapper {
|
|
|
31
31
|
const collection = this.collectionsV2[name];
|
|
32
32
|
if (collection)
|
|
33
33
|
return collection;
|
|
34
|
-
const enchanceCollection1 = FirestoreV2Collection_1.enhanceCollection(this.firestore.collection(name));
|
|
34
|
+
const enchanceCollection1 = (0, FirestoreV2Collection_1.enhanceCollection)(this.firestore.collection(name));
|
|
35
35
|
return this.collectionsV2[name] = enchanceCollection1;
|
|
36
36
|
}
|
|
37
37
|
getSdkInstance() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirestoreWrapper.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreWrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA0D;AAI1D,qEAAgE;AAChE,wDAA2E;AAC3E,mEAAiF;
|
|
1
|
+
{"version":3,"file":"FirestoreWrapper.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/FirestoreWrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA0D;AAI1D,qEAAgE;AAChE,wDAA2E;AAC3E,mEAAiF;AAGjF,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,IAAA,wBAAY,EAAC,eAAe,CAAC,GAAG,CAAC,CAAA;IACtD,CAAC;IAEM,aAAa,CAAsB,IAAY,EAAE,kBAAqC;QACzF,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,UAAU;YACV,OAAO,UAAU,CAAC;QAEtB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,yCAAmB,CAAO,IAAI,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAClG,CAAC;IAEM,eAAe,CAAsB,IAAY;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,UAAU;YACV,OAAO,UAAU,CAAC;QAEtB,MAAM,mBAAmB,GAAG,IAAA,yCAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAA8B,CAA+B,CAAC;QAC1I,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC;IAC1D,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAEY,gBAAgB,CAAC,IAAY;;YACtC,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;QAChD,CAAC;KAAA;IAEY,eAAe;;YACxB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe;gBAC/B,OAAO,EAAE,CAAC;YAEd,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;QAC5C,CAAC;KAAA;CACJ;AA3CD,4CA2CC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
1
|
+
import * as admin from "firebase-admin";
|
|
2
|
+
export type FirestoreType_Collection<T = any> = admin.firestore.CollectionReference<T>;
|
|
3
|
+
export type FirestoreType_QueryDocumentSnapshot<T = any> = admin.firestore.QueryDocumentSnapshot<T>;
|
|
4
|
+
export type FirestoreType_DocumentSnapshot<T = any> = admin.firestore.DocumentSnapshot<T>;
|
|
5
|
+
export type FirestoreType_QuerySnapshot<T> = admin.firestore.QuerySnapshot<T>;
|
|
6
|
+
export type FirestoreType_Query = admin.firestore.Query;
|
|
7
|
+
export type FirestoreType_DocumentReference = admin.firestore.DocumentReference;
|
|
8
|
+
export type FirestoreType = admin.firestore.Firestore;
|
|
9
|
+
export type FirestoreType_Transaction = admin.firestore.Transaction;
|
|
@@ -1,4 +1,21 @@
|
|
|
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
|
+
*/
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
20
|
// export type FirestoreType_Collection = admin.firestore.CollectionReference | firebase.firestore.CollectionReference;
|
|
4
21
|
// export type FirestoreType_DocumentSnapshot = admin.firestore.QueryDocumentSnapshot | firebase.firestore.QueryDocumentSnapshot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/types.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/main/app-backend/firestore/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;AAaH,uHAAuH;AACvH,iIAAiI;AACjI,mJAAmJ;AACnJ,0HAA0H;AAC1H,8JAA8J;AAC9J,wGAAwG;AACxG,EAAE"}
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import * as functions from "firebase-functions";
|
|
2
2
|
import { EventContext, HttpsFunction, RuntimeOptions } from "firebase-functions";
|
|
3
|
-
import { Module } from "@intuitionrobotics/ts-common/core/module";
|
|
4
3
|
import { Express, Request, Response } from "express";
|
|
4
|
+
import { Module, StringMap } from "@intuitionrobotics/ts-common";
|
|
5
5
|
import { ObjectMetadata } from "firebase-functions/lib/v1/providers/storage";
|
|
6
|
-
import { StringMap } from "@intuitionrobotics/ts-common/utils/types";
|
|
7
6
|
export interface FirebaseFunctionInterface {
|
|
7
|
+
onDestroy: (() => Promise<void>)[];
|
|
8
8
|
getFunction(): HttpsFunction;
|
|
9
|
+
addOnDestroy(onDestroy: () => Promise<void>): void;
|
|
9
10
|
}
|
|
10
11
|
export declare abstract class FirebaseFunction<Config = any> extends Module<Config> implements FirebaseFunctionInterface {
|
|
12
|
+
onDestroy: (() => Promise<void>)[];
|
|
13
|
+
constructor(name: string, onDestroy?: () => Promise<void>);
|
|
11
14
|
abstract getFunction(): HttpsFunction;
|
|
15
|
+
addOnDestroy(onDestroy: () => Promise<void>): void;
|
|
12
16
|
}
|
|
13
17
|
export declare class Firebase_ExpressFunction implements FirebaseFunctionInterface {
|
|
14
18
|
private readonly express;
|
|
15
19
|
private function;
|
|
16
20
|
private readonly name;
|
|
17
21
|
static config: RuntimeOptions;
|
|
18
|
-
|
|
22
|
+
onDestroy: (() => Promise<void>)[];
|
|
23
|
+
constructor(_express: Express, name?: string, onDestroy?: () => Promise<void>);
|
|
19
24
|
static setConfig(config: RuntimeOptions): void;
|
|
25
|
+
addOnDestroy(onDestroy: () => Promise<void>): void;
|
|
20
26
|
getName(): string;
|
|
21
27
|
getFunction: () => functions.HttpsFunction;
|
|
22
28
|
}
|
|
@@ -29,26 +35,26 @@ export declare abstract class Firebase_HttpsFunction<Config = any> extends Fireb
|
|
|
29
35
|
export declare abstract class FirebaseFunctionModule<DataType = any, Config extends RuntimeOptsConfigs = any> extends FirebaseFunction<Config> {
|
|
30
36
|
private readonly listeningPath;
|
|
31
37
|
private function;
|
|
32
|
-
protected constructor(listeningPath: string, name: string);
|
|
38
|
+
protected constructor(listeningPath: string, name: string, onDestroy?: () => Promise<void>);
|
|
33
39
|
abstract processChanges(before: DataType, after: DataType, params: {
|
|
34
40
|
[param: string]: any;
|
|
35
41
|
}): Promise<any>;
|
|
36
42
|
getFunction: () => functions.CloudFunction<functions.Change<functions.database.DataSnapshot>>;
|
|
37
43
|
}
|
|
38
|
-
export
|
|
44
|
+
export type FirestoreConfigs = {
|
|
39
45
|
runTimeOptions?: RuntimeOptions;
|
|
40
46
|
configs: any;
|
|
41
47
|
};
|
|
42
48
|
export declare abstract class FirestoreFunctionModule<DataType extends object, Config extends FirestoreConfigs = FirestoreConfigs> extends FirebaseFunction<Config> {
|
|
43
49
|
private readonly collectionName;
|
|
44
50
|
private function;
|
|
45
|
-
protected constructor(collectionName: string, name: string);
|
|
51
|
+
protected constructor(collectionName: string, name: string, onDestroy?: () => Promise<void>);
|
|
46
52
|
abstract processChanges(params: {
|
|
47
53
|
[param: string]: any;
|
|
48
54
|
}, before?: DataType, after?: DataType): Promise<any>;
|
|
49
55
|
getFunction: () => functions.CloudFunction<functions.Change<functions.firestore.DocumentSnapshot>>;
|
|
50
56
|
}
|
|
51
|
-
export
|
|
57
|
+
export type ScheduledConfig = RuntimeOptsConfigs & {
|
|
52
58
|
timeZone?: string;
|
|
53
59
|
};
|
|
54
60
|
export declare abstract class FirebaseScheduledFunction<Config extends ScheduledConfig = any> extends FirebaseFunction<Config> {
|
|
@@ -60,10 +66,10 @@ export declare abstract class FirebaseScheduledFunction<Config extends Scheduled
|
|
|
60
66
|
abstract onScheduledEvent(): Promise<any>;
|
|
61
67
|
getFunction: () => functions.CloudFunction<functions.Change<functions.database.DataSnapshot>>;
|
|
62
68
|
}
|
|
63
|
-
export
|
|
69
|
+
export type RuntimeOptsConfigs = {
|
|
64
70
|
runtimeOpts?: RuntimeOptions;
|
|
65
71
|
};
|
|
66
|
-
export
|
|
72
|
+
export type BucketConfigs = RuntimeOptsConfigs & {
|
|
67
73
|
bucketName?: string;
|
|
68
74
|
};
|
|
69
75
|
export declare abstract class Firebase_StorageFunction<Config extends BucketConfigs = BucketConfigs> extends FirebaseFunction<Config> {
|
|
@@ -71,15 +77,15 @@ export declare abstract class Firebase_StorageFunction<Config extends BucketConf
|
|
|
71
77
|
abstract onFinalize(object: ObjectMetadata, context: EventContext): Promise<any>;
|
|
72
78
|
getFunction: () => functions.CloudFunction<functions.storage.ObjectMetadata>;
|
|
73
79
|
}
|
|
74
|
-
export
|
|
75
|
-
export
|
|
80
|
+
export type FirebaseEventContext = EventContext;
|
|
81
|
+
export type TopicMessage = {
|
|
76
82
|
data: string;
|
|
77
83
|
attributes: StringMap;
|
|
78
84
|
};
|
|
79
85
|
export declare abstract class Firebase_PubSubFunction<T, Config extends RuntimeOptsConfigs = any> extends FirebaseFunction<Config> {
|
|
80
86
|
private function;
|
|
81
87
|
private readonly topic;
|
|
82
|
-
protected constructor(topic: string, name: string);
|
|
88
|
+
protected constructor(topic: string, name: string, onDestroy?: () => Promise<void>);
|
|
83
89
|
abstract onPublish(object: T | undefined, originalMessage: TopicMessage, context: FirebaseEventContext): Promise<any>;
|
|
84
90
|
private _onPublish;
|
|
85
91
|
getFunction: () => functions.CloudFunction<functions.pubsub.Message>;
|