@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
|
@@ -11,16 +11,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Firebase_PubSubFunction = exports.Firebase_StorageFunction = exports.FirebaseScheduledFunction = exports.FirestoreFunctionModule = exports.FirebaseFunctionModule = exports.Firebase_HttpsFunction = exports.Firebase_ExpressFunction = exports.FirebaseFunction = void 0;
|
|
13
13
|
const functions = require("firebase-functions");
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
15
|
+
class FirebaseFunction extends ts_common_1.Module {
|
|
16
|
+
constructor(name, onDestroy) {
|
|
17
|
+
super(name);
|
|
18
|
+
this.onDestroy = [];
|
|
19
|
+
onDestroy && this.onDestroy.push(onDestroy);
|
|
20
|
+
}
|
|
21
|
+
addOnDestroy(onDestroy) {
|
|
22
|
+
this.onDestroy.push(onDestroy);
|
|
23
|
+
}
|
|
24
|
+
;
|
|
20
25
|
}
|
|
21
26
|
exports.FirebaseFunction = FirebaseFunction;
|
|
22
27
|
class Firebase_ExpressFunction {
|
|
23
|
-
constructor(_express, name = "api") {
|
|
28
|
+
constructor(_express, name = "api", onDestroy) {
|
|
29
|
+
this.onDestroy = [];
|
|
24
30
|
this.getFunction = () => {
|
|
25
31
|
if (this.function)
|
|
26
32
|
return this.function;
|
|
@@ -30,14 +36,25 @@ class Firebase_ExpressFunction {
|
|
|
30
36
|
type: "https",
|
|
31
37
|
version: "v1"
|
|
32
38
|
} }, Firebase_ExpressFunction.config);
|
|
33
|
-
return this.function = functions.runWith(runtimeOptions).https.onRequest(this
|
|
39
|
+
return this.function = functions.runWith(runtimeOptions).https.onRequest((req, resp) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const result = yield this.express(req, resp);
|
|
41
|
+
for (const _onDestroy of this.onDestroy) {
|
|
42
|
+
yield _onDestroy();
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}));
|
|
34
46
|
};
|
|
35
47
|
this.express = _express;
|
|
36
48
|
this.name = name;
|
|
49
|
+
onDestroy && this.onDestroy.push(onDestroy);
|
|
37
50
|
}
|
|
38
51
|
static setConfig(config) {
|
|
39
52
|
this.config = config;
|
|
40
53
|
}
|
|
54
|
+
addOnDestroy(onDestroy) {
|
|
55
|
+
this.onDestroy.push(onDestroy);
|
|
56
|
+
}
|
|
57
|
+
;
|
|
41
58
|
getName() {
|
|
42
59
|
return this.name;
|
|
43
60
|
}
|
|
@@ -58,7 +75,13 @@ class Firebase_HttpsFunction extends FirebaseFunction {
|
|
|
58
75
|
version: "v1"
|
|
59
76
|
}
|
|
60
77
|
};
|
|
61
|
-
return this.function = functions.runWith(runtimeOptions).https.onRequest((req, res) => this
|
|
78
|
+
return this.function = functions.runWith(runtimeOptions).https.onRequest((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const result = yield this.process(req, res);
|
|
80
|
+
for (const _onDestroy of this.onDestroy) {
|
|
81
|
+
yield _onDestroy();
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}));
|
|
62
85
|
};
|
|
63
86
|
this.onFunctionReady = () => __awaiter(this, void 0, void 0, function* () {
|
|
64
87
|
return;
|
|
@@ -68,7 +91,7 @@ class Firebase_HttpsFunction extends FirebaseFunction {
|
|
|
68
91
|
exports.Firebase_HttpsFunction = Firebase_HttpsFunction;
|
|
69
92
|
//TODO: I would like to add a type for the params..
|
|
70
93
|
class FirebaseFunctionModule extends FirebaseFunction {
|
|
71
|
-
constructor(listeningPath, name) {
|
|
94
|
+
constructor(listeningPath, name, onDestroy) {
|
|
72
95
|
super(name);
|
|
73
96
|
this.getFunction = () => {
|
|
74
97
|
var _a;
|
|
@@ -80,21 +103,26 @@ class FirebaseFunctionModule extends FirebaseFunction {
|
|
|
80
103
|
type: "realtime-db-listener",
|
|
81
104
|
version: "v1"
|
|
82
105
|
} }, (_a = this.config) === null || _a === void 0 ? void 0 : _a.runtimeOpts);
|
|
83
|
-
return this.function = functions.runWith(runtimeOptions).database.ref(this.listeningPath).onWrite((change, context) => {
|
|
106
|
+
return this.function = functions.runWith(runtimeOptions).database.ref(this.listeningPath).onWrite((change, context) => __awaiter(this, void 0, void 0, function* () {
|
|
84
107
|
const before = change.before && change.before.val();
|
|
85
108
|
const after = change.after && change.after.val();
|
|
86
|
-
const params =
|
|
87
|
-
|
|
88
|
-
|
|
109
|
+
const params = (0, ts_common_1.deepClone)(context.params);
|
|
110
|
+
const result = yield this.processChanges(before, after, params);
|
|
111
|
+
for (const _onDestroy of this.onDestroy) {
|
|
112
|
+
yield _onDestroy();
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
}));
|
|
89
116
|
};
|
|
90
117
|
this.listeningPath = listeningPath;
|
|
118
|
+
onDestroy && this.addOnDestroy(onDestroy);
|
|
91
119
|
}
|
|
92
120
|
}
|
|
93
121
|
exports.FirebaseFunctionModule = FirebaseFunctionModule;
|
|
94
122
|
//TODO: I would like to add a type for the params..
|
|
95
123
|
class FirestoreFunctionModule extends FirebaseFunction {
|
|
96
|
-
constructor(collectionName, name) {
|
|
97
|
-
super(name);
|
|
124
|
+
constructor(collectionName, name, onDestroy) {
|
|
125
|
+
super(name, onDestroy);
|
|
98
126
|
this.getFunction = () => {
|
|
99
127
|
var _a;
|
|
100
128
|
if (this.function)
|
|
@@ -105,12 +133,16 @@ class FirestoreFunctionModule extends FirebaseFunction {
|
|
|
105
133
|
type: "firestore-listener",
|
|
106
134
|
version: "v1"
|
|
107
135
|
} }, (_a = this.config) === null || _a === void 0 ? void 0 : _a.runTimeOptions);
|
|
108
|
-
return this.function = functions.runWith(runtimeOptions).firestore.document(`${this.collectionName}/{docId}`).onWrite((change, context) => {
|
|
136
|
+
return this.function = functions.runWith(runtimeOptions).firestore.document(`${this.collectionName}/{docId}`).onWrite((change, context) => __awaiter(this, void 0, void 0, function* () {
|
|
109
137
|
const before = change.before && change.before.data();
|
|
110
138
|
const after = change.after && change.after.data();
|
|
111
|
-
const params =
|
|
112
|
-
|
|
113
|
-
|
|
139
|
+
const params = (0, ts_common_1.deepClone)(context.params);
|
|
140
|
+
const result = yield this.processChanges(params, before, after);
|
|
141
|
+
for (const _onDestroy of this.onDestroy) {
|
|
142
|
+
yield _onDestroy();
|
|
143
|
+
}
|
|
144
|
+
return result;
|
|
145
|
+
}));
|
|
114
146
|
};
|
|
115
147
|
this.collectionName = collectionName;
|
|
116
148
|
}
|
|
@@ -123,7 +155,7 @@ class FirebaseScheduledFunction extends FirebaseFunction {
|
|
|
123
155
|
this.getFunction = () => {
|
|
124
156
|
var _a, _b;
|
|
125
157
|
if (!this.schedule)
|
|
126
|
-
throw new
|
|
158
|
+
throw new ts_common_1.ImplementationMissingException("MUST set schedule !!");
|
|
127
159
|
if (this.function)
|
|
128
160
|
return this.function;
|
|
129
161
|
const runtimeOptions = Object.assign({ labels: {
|
|
@@ -143,12 +175,16 @@ class FirebaseScheduledFunction extends FirebaseFunction {
|
|
|
143
175
|
this.logDebug("will not execute backup.. running conditions didn't pass: ", results);
|
|
144
176
|
return;
|
|
145
177
|
}
|
|
146
|
-
|
|
178
|
+
const result = yield this.onScheduledEvent();
|
|
179
|
+
for (const _onDestroy of this.onDestroy) {
|
|
180
|
+
yield _onDestroy();
|
|
181
|
+
}
|
|
182
|
+
return result;
|
|
147
183
|
}));
|
|
148
184
|
};
|
|
149
185
|
}
|
|
150
186
|
addRunningCondition(runningCondition) {
|
|
151
|
-
this.runningCondition
|
|
187
|
+
(0, ts_common_1.addItemToArray)(this.runningCondition, runningCondition);
|
|
152
188
|
return this;
|
|
153
189
|
}
|
|
154
190
|
setSchedule(schedule) {
|
|
@@ -177,41 +213,51 @@ class Firebase_StorageFunction extends FirebaseFunction {
|
|
|
177
213
|
}
|
|
178
214
|
catch (e) {
|
|
179
215
|
const _message = `Error handling callback to onFinalize bucket listener method` +
|
|
180
|
-
"\n" + `File changed ${object.name}` + "\n with attributes: " +
|
|
216
|
+
"\n" + `File changed ${object.name}` + "\n with attributes: " + (0, ts_common_1.__stringify)(context) + "\n" + (0, ts_common_1.__stringify)(e);
|
|
181
217
|
this.logError(_message);
|
|
182
218
|
try {
|
|
183
|
-
yield
|
|
219
|
+
yield ts_common_1.dispatch_onServerError.dispatchModuleAsync(ts_common_1.ServerErrorSeverity.Critical, this, _message);
|
|
184
220
|
}
|
|
185
221
|
catch (_e) {
|
|
186
222
|
this.logError("Error while handing bucket listener error", _e);
|
|
187
223
|
}
|
|
188
224
|
}
|
|
225
|
+
finally {
|
|
226
|
+
for (const _onDestroy of this.onDestroy) {
|
|
227
|
+
yield _onDestroy();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
189
230
|
}));
|
|
190
231
|
};
|
|
191
232
|
}
|
|
192
233
|
}
|
|
193
234
|
exports.Firebase_StorageFunction = Firebase_StorageFunction;
|
|
194
235
|
function getFormattedFunctionName(name) {
|
|
195
|
-
return name.toLowerCase().replace(/\s/g, "_");
|
|
236
|
+
return name.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/\s/g, "_");
|
|
196
237
|
}
|
|
197
238
|
class Firebase_PubSubFunction extends FirebaseFunction {
|
|
198
|
-
constructor(topic, name) {
|
|
199
|
-
super(name);
|
|
239
|
+
constructor(topic, name, onDestroy) {
|
|
240
|
+
super(name, onDestroy);
|
|
200
241
|
this._onPublish = (object, originalMessage, context) => __awaiter(this, void 0, void 0, function* () {
|
|
201
242
|
try {
|
|
202
243
|
return yield this.onPublish(object, originalMessage, context);
|
|
203
244
|
}
|
|
204
245
|
catch (e) {
|
|
205
|
-
const _message = `Error publishing pub/sub message` +
|
|
206
|
-
"\n" + ` to topic ${this.topic}` + "\n with attributes: " +
|
|
246
|
+
const _message = `Error publishing pub/sub message` + (0, ts_common_1.__stringify)(object) +
|
|
247
|
+
"\n" + ` to topic ${this.topic}` + "\n with attributes: " + (0, ts_common_1.__stringify)(originalMessage.attributes) + "\n" + (0, ts_common_1.__stringify)(e);
|
|
207
248
|
this.logError(_message);
|
|
208
249
|
try {
|
|
209
|
-
yield
|
|
250
|
+
yield ts_common_1.dispatch_onServerError.dispatchModuleAsync(ts_common_1.ServerErrorSeverity.Critical, this, _message);
|
|
210
251
|
}
|
|
211
252
|
catch (_e) {
|
|
212
253
|
this.logError("Error while handing pubsub error", _e);
|
|
213
254
|
}
|
|
214
255
|
}
|
|
256
|
+
finally {
|
|
257
|
+
for (const _onDestroy of this.onDestroy) {
|
|
258
|
+
yield _onDestroy();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
215
261
|
});
|
|
216
262
|
this.getFunction = () => {
|
|
217
263
|
var _a;
|
|
@@ -232,7 +278,7 @@ class Firebase_PubSubFunction extends FirebaseFunction {
|
|
|
232
278
|
}
|
|
233
279
|
catch (e) {
|
|
234
280
|
this.logError(`Error parsing the data attribute from pub/sub message to topic ${this.topic}` +
|
|
235
|
-
"\n" +
|
|
281
|
+
"\n" + (0, ts_common_1.__stringify)(originalMessage.data) + "\n" + (0, ts_common_1.__stringify)(e));
|
|
236
282
|
}
|
|
237
283
|
return this._onPublish(data, originalMessage, context);
|
|
238
284
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase-function.js","sourceRoot":"","sources":["../../../src/main/app-backend/functions/firebase-function.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAgD;
|
|
1
|
+
{"version":3,"file":"firebase-function.js","sourceRoot":"","sources":["../../../src/main/app-backend/functions/firebase-function.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAgD;AAWhD,4DASsC;AAatC,MAAsB,gBAClB,SAAQ,kBAAc;IAItB,YAAY,IAAY,EAAE,SAA+B;QACrD,KAAK,CAAC,IAAI,CAAC,CAAC;QAHhB,cAAS,GAA4B,EAAE,CAAC;QAIpC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAGM,YAAY,CAAC,SAA8B;QAC9C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAAA,CAAC;CAEL;AAfD,4CAeC;AAED,MAAa,wBAAwB;IAQjC,YAAY,QAAiB,EAAE,IAAI,GAAG,KAAK,EAAE,SAA+B;QAF5E,cAAS,GAA4B,EAAE,CAAC;QAoBxC,gBAAW,GAAG,GAAG,EAAE;YACf,IAAI,IAAI,CAAC,QAAQ;gBACb,OAAO,IAAI,CAAC,QAAQ,CAAC;YAEzB,MAAM,cAAc,mBAChB,MAAM,EAAE;oBACJ,KAAK,EAAE,cAAc;oBACrB,aAAa,EAAE,wBAAwB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;oBACvD,IAAI,EAAE,OAAO;oBACb,OAAO,EAAE,IAAI;iBAChB,IACE,wBAAwB,C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AC;gBAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;YAC3D,CAAC,CAAA,CAAC,CAAC;QACP,CAAC,CAAC;QAnDE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CAmDJ;AA5DD,0DA4DC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FirebaseType_BatchResponse, FirebaseType_Message, FirebaseType_SubscriptionResponse, FirebaseType_TopicResponse } from "./types";
|
|
2
2
|
import { FirebaseBaseWrapper } from "../auth/FirebaseBaseWrapper";
|
|
3
3
|
import { FirebaseSession } from "../auth/firebase-session";
|
|
4
|
-
import { StringMap } from "@intuitionrobotics/ts-common
|
|
4
|
+
import { StringMap } from "@intuitionrobotics/ts-common";
|
|
5
5
|
export declare class PushMessagesWrapper extends FirebaseBaseWrapper {
|
|
6
6
|
private readonly messaging;
|
|
7
7
|
constructor(firebaseSession: FirebaseSession<any, any>);
|
|
@@ -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) {
|
|
@@ -15,7 +32,7 @@ const messaging_1 = require("firebase-admin/messaging");
|
|
|
15
32
|
class PushMessagesWrapper extends FirebaseBaseWrapper_1.FirebaseBaseWrapper {
|
|
16
33
|
constructor(firebaseSession) {
|
|
17
34
|
super(firebaseSession);
|
|
18
|
-
this.messaging = messaging_1.getMessaging(firebaseSession.app);
|
|
35
|
+
this.messaging = (0, messaging_1.getMessaging)(firebaseSession.app);
|
|
19
36
|
}
|
|
20
37
|
send(message, dryRun) {
|
|
21
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushMessagesWrapper.js","sourceRoot":"","sources":["../../../src/main/app-backend/push/PushMessagesWrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PushMessagesWrapper.js","sourceRoot":"","sources":["../../../src/main/app-backend/push/PushMessagesWrapper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;AASH,qEAAgE;AAGhE,wDAAsD;AAEtD,MAAa,mBACZ,SAAQ,yCAAmB;IAI3B,YAAY,eAA0C;QACrD,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAA,wBAAY,EAAC,eAAe,CAAC,GAAG,CAAC,CAAA;IACnD,CAAC;IAEK,IAAI,CAAC,OAA6B,EAAE,MAAgB;;YACzD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;KAAA;IAEK,OAAO,CAAC,QAAgC;;YAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;KAAA;IAEK,aAAa,CAAC,MAAgB,EAAE,IAAe;;YACpD,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAC;QAC5D,CAAC;KAAA;IAEK,WAAW,CAAC,KAAa,EAAE,IAAe,EAAE,MAAgB;;YACjE,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,MAAM,EAAC,CAAC,CAAA;QAC3D,CAAC;KAAA;IAEK,gBAAgB,CAAC,MAAgB,EAAE,KAAa;;YACrD,OAAO,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACtD,CAAC;KAAA;IAEK,oBAAoB,CAAC,MAAgB,EAAE,KAAa;;YACzD,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QAC1D,CAAC;KAAA;CACD;AAjCD,kDAiCC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as admin from "firebase-admin";
|
|
2
|
-
|
|
2
|
+
type BaseMessage = {
|
|
3
3
|
data?: {
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
};
|
|
@@ -9,13 +9,13 @@ declare type BaseMessage = {
|
|
|
9
9
|
apns?: admin.messaging.ApnsConfig;
|
|
10
10
|
fcmOptions?: admin.messaging.FcmOptions;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
type TokenMessage = BaseMessage & {
|
|
13
13
|
token: string;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
15
|
+
export type FirebaseType_PushMessages = admin.messaging.Messaging;
|
|
16
|
+
export type FirebaseType_Message = TokenMessage;
|
|
17
|
+
export type FirebaseType_BatchResponse = admin.messaging.BatchResponse;
|
|
18
|
+
export type FirebaseType_TopicResponse = admin.messaging.MessagingTopicResponse;
|
|
19
|
+
export type FirebaseType_MulticastMessage = admin.messaging.MulticastMessage;
|
|
20
|
+
export type FirebaseType_SubscriptionResponse = admin.messaging.MessagingTopicManagementResponse;
|
|
21
21
|
export {};
|
|
@@ -1,3 +1,20 @@
|
|
|
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
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/main/app-backend/push/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/main/app-backend/push/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -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,14 +27,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
27
|
};
|
|
11
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
29
|
exports.FileWrapper = exports.BucketWrapper = exports.StorageWrapper = void 0;
|
|
30
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
13
31
|
const FirebaseBaseWrapper_1 = require("../auth/FirebaseBaseWrapper");
|
|
14
32
|
const storage_1 = require("firebase-admin/storage");
|
|
15
|
-
const exceptions_1 = require("@intuitionrobotics/ts-common/core/exceptions");
|
|
16
|
-
const date_time_tools_1 = require("@intuitionrobotics/ts-common/utils/date-time-tools");
|
|
17
33
|
class StorageWrapper extends FirebaseBaseWrapper_1.FirebaseBaseWrapper {
|
|
18
34
|
constructor(firebaseSession) {
|
|
19
35
|
super(firebaseSession);
|
|
20
|
-
this.storage = storage_1.getStorage(firebaseSession.app);
|
|
36
|
+
this.storage = (0, storage_1.getStorage)(firebaseSession.app);
|
|
21
37
|
}
|
|
22
38
|
getOrCreateBucket(bucketName) {
|
|
23
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -25,7 +41,7 @@ class StorageWrapper extends FirebaseBaseWrapper_1.FirebaseBaseWrapper {
|
|
|
25
41
|
if (!_bucketName)
|
|
26
42
|
_bucketName = `gs://${this.firebaseSession.getProjectId()}.appspot.com`;
|
|
27
43
|
if (!_bucketName.startsWith("gs://"))
|
|
28
|
-
throw new
|
|
44
|
+
throw new ts_common_1.BadImplementationException("Bucket name MUST start with 'gs://'");
|
|
29
45
|
const bucket = (yield this.storage.bucket(_bucketName).get({ autoCreate: true }))[0];
|
|
30
46
|
// @ts-ignore
|
|
31
47
|
return new BucketWrapper(_bucketName, bucket, this);
|
|
@@ -90,7 +106,7 @@ class FileWrapper {
|
|
|
90
106
|
const options = {
|
|
91
107
|
action: 'write',
|
|
92
108
|
contentType: contentType,
|
|
93
|
-
expires:
|
|
109
|
+
expires: (0, ts_common_1.currentTimeMillies)() + expiresInMs,
|
|
94
110
|
};
|
|
95
111
|
return this.getSignedUrl(options);
|
|
96
112
|
});
|
|
@@ -99,7 +115,7 @@ class FileWrapper {
|
|
|
99
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
116
|
const options = {
|
|
101
117
|
action: 'read',
|
|
102
|
-
expires:
|
|
118
|
+
expires: (0, ts_common_1.currentTimeMillies)() + expiresInMs,
|
|
103
119
|
};
|
|
104
120
|
return this.getSignedUrl(options);
|
|
105
121
|
});
|
|
@@ -118,7 +134,7 @@ class FileWrapper {
|
|
|
118
134
|
case "symbol":
|
|
119
135
|
case "bigint":
|
|
120
136
|
case "undefined":
|
|
121
|
-
throw new
|
|
137
|
+
throw new ts_common_1.BadImplementationException(`Cannot save file: ${this.file.name}, data is ${typeof data}`);
|
|
122
138
|
case "object":
|
|
123
139
|
return this.file.save(JSON.stringify(data));
|
|
124
140
|
case "boolean":
|
|
@@ -176,9 +192,9 @@ class FileWrapper {
|
|
|
176
192
|
yield file.delete();
|
|
177
193
|
}
|
|
178
194
|
catch (err) {
|
|
179
|
-
throw new
|
|
195
|
+
throw new ts_common_1.ThisShouldNotHappenException('Error during the deletion of the recently copied file, check the attached error', err);
|
|
180
196
|
}
|
|
181
|
-
throw new
|
|
197
|
+
throw new ts_common_1.BadImplementationException('Error during the deletion of the file after a successful copy, attached error stack', e);
|
|
182
198
|
}
|
|
183
199
|
});
|
|
184
200
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageWrapper.js","sourceRoot":"","sources":["../../../src/main/app-backend/storage/StorageWrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"StorageWrapper.js","sourceRoot":"","sources":["../../../src/main/app-backend/storage/StorageWrapper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;AAEH,4DAIsC;AActC,qEAAgE;AAChE,oDAAkD;AAElD,MAAa,cACZ,SAAQ,yCAAmB;IAK3B,YAAY,eAA0C;QACrD,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAA,oBAAU,EAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IAEK,iBAAiB,CAAC,UAAmB;;YAC1C,IAAI,WAAW,GAAG,UAAU,CAAC;YAC7B,IAAI,CAAC,WAAW;gBACf,WAAW,GAAG,QAAQ,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,cAAc,CAAC;YAEzE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC;gBACnC,MAAM,IAAI,sCAA0B,CAAC,qCAAqC,CAAC,CAAC;YAE7E,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,EAAC,UAAU,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnF,aAAa;YACb,OAAO,IAAI,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;KAAA;CACD;AAvBD,wCAuBC;AAED,MAAa,aAAa;IAKzB,YAAoB,UAAkB,EAAE,M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,kCAwIC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CopyResponse } from "@google-cloud/storage";
|
|
2
2
|
import { Storage } from "firebase-admin/storage";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type FirebaseType_Storage = Storage;
|
|
4
|
+
export type FirebaseType_Metadata = any;
|
|
5
|
+
export type ReturnType_Metadata = {
|
|
6
6
|
metadata?: FirebaseType_Metadata;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type Firebase_CopyResponse = [CopyResponse[0], CopyResponse[1] | undefined];
|
|
@@ -1,3 +1,20 @@
|
|
|
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
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/main/app-backend/storage/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/main/app-backend/storage/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Module } from "@intuitionrobotics/ts-common";
|
|
2
|
+
import { FirebaseConfig } from "..";
|
|
1
3
|
import { FirebaseSession } from "./auth/FirebaseSession";
|
|
2
4
|
import { SwFirebaseSession } from "./auth/SwFirebaseSession";
|
|
3
|
-
|
|
4
|
-
import { Module } from "@intuitionrobotics/ts-common/core/module";
|
|
5
|
-
declare type ConfigType = {
|
|
5
|
+
type ConfigType = {
|
|
6
6
|
[s: string]: FirebaseConfig;
|
|
7
7
|
};
|
|
8
8
|
export declare class FirebaseModule_Class extends Module<ConfigType> {
|
|
@@ -10,12 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.FirebaseModule = exports.FirebaseModule_Class = void 0;
|
|
13
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
13
14
|
const FirebaseSession_1 = require("./auth/FirebaseSession");
|
|
14
15
|
const SwFirebaseSession_1 = require("./auth/SwFirebaseSession");
|
|
15
|
-
const module_1 = require("@intuitionrobotics/ts-common/core/module");
|
|
16
|
-
const exceptions_1 = require("@intuitionrobotics/ts-common/core/exceptions");
|
|
17
16
|
const localSessionId = 'local';
|
|
18
|
-
class FirebaseModule_Class extends
|
|
17
|
+
class FirebaseModule_Class extends ts_common_1.Module {
|
|
19
18
|
constructor() {
|
|
20
19
|
super("FirebaseModule");
|
|
21
20
|
this.sessions = {};
|
|
@@ -28,7 +27,7 @@ class FirebaseModule_Class extends module_1.Module {
|
|
|
28
27
|
return config;
|
|
29
28
|
}
|
|
30
29
|
catch (e) {
|
|
31
|
-
throw new
|
|
30
|
+
throw new ts_common_1.ImplementationMissingException(`Either specify configs for the 'FirebaseModule' or use SDK auto-configuration with firebase hosting`);
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
33
|
}
|
|
@@ -98,9 +97,9 @@ class FirebaseModule_Class extends module_1.Module {
|
|
|
98
97
|
}
|
|
99
98
|
checkConfig(config, projectId) {
|
|
100
99
|
if (!config)
|
|
101
|
-
throw new
|
|
100
|
+
throw new ts_common_1.BadImplementationException('Did you forget to add FirebaseModule to the main.ts in the modules array?');
|
|
102
101
|
if (!config || !config.projectId || !config.apiKey || !config.authDomain)
|
|
103
|
-
throw new
|
|
102
|
+
throw new ts_common_1.BadImplementationException(`Config for key ${projectId} is not an Admin credentials pattern`);
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
exports.FirebaseModule_Class = FirebaseModule_Class;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirebaseModule.js","sourceRoot":"","sources":["../../src/main/app-frontend/FirebaseModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4DAAuD;AACvD,gEAA2D;AAE3D,
|
|
1
|
+
{"version":3,"file":"FirebaseModule.js","sourceRoot":"","sources":["../../src/main/app-frontend/FirebaseModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4DAIsC;AAEtC,4DAAuD;AACvD,gEAA2D;AAE3D,MAAM,cAAc,GAAG,OAAO,CAAC;AAM/B,MAAa,oBACZ,SAAQ,kBAAkB;IAK1B;QACC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAJjB,aAAQ,GAA6C,EAAE,CAAC;QAqCxD,qBAAgB,GAAG,GAAS,EAAE;YACrC,IAAI,CAAC;gBACJ,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,wBAAwB,CAAC,CAAC;gBACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAA6B,CAAC;gBAC5D,aAAa;gBACb,IAAI,CAAC,SAAS,CAAC,EAAC,CAAC,cAAc,CAAC,EAAE,MAAM,EAAC,CAAC,CAAC;gBAC3C,OAAO,MAAM,CAAC;YACf,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACZ,MAAM,IAAI,0CAA8B,CAAC,qGAAqG,CAAC,CAAC;Y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