@entropic-bond/firebase 1.7.5 → 1.7.7
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/lib/cloud-functions/firebase-cloud-functions.d.ts +2 -1
- package/lib/cloud-functions/firebase-cloud-functions.js +16 -1
- package/lib/cloud-functions/firebase-cloud-functions.js.map +1 -1
- package/lib/cloud-functions/firebase-cloud-functions.spec.d.ts +6 -1
- package/lib/cloud-functions/firebase-cloud-functions.spec.js +36 -3
- package/lib/cloud-functions/firebase-cloud-functions.spec.js.map +1 -1
- package/package.json +4 -4
|
@@ -2,5 +2,6 @@ import { CloudFunction, CloudFunctionsService } from 'entropic-bond';
|
|
|
2
2
|
import { EmulatorConfig } from '../firebase-helper';
|
|
3
3
|
export declare class FirebaseCloudFunctions implements CloudFunctionsService {
|
|
4
4
|
constructor(region?: string, emulator?: EmulatorConfig);
|
|
5
|
-
|
|
5
|
+
retrieveFunction<P, R>(cloudFunction: string): CloudFunction<P, R>;
|
|
6
|
+
callFunction<P, R>(func: CloudFunction<P, R>, params: P): Promise<R>;
|
|
6
7
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.FirebaseCloudFunctions = void 0;
|
|
4
13
|
const functions_1 = require("firebase/functions");
|
|
@@ -15,9 +24,15 @@ class FirebaseCloudFunctions {
|
|
|
15
24
|
(0, functions_1.connectFunctionsEmulator)(firebase_helper_1.FirebaseHelper.instance.functions(), host, functionsPort);
|
|
16
25
|
}
|
|
17
26
|
}
|
|
18
|
-
|
|
27
|
+
retrieveFunction(cloudFunction) {
|
|
19
28
|
return (0, functions_1.httpsCallable)(firebase_helper_1.FirebaseHelper.instance.functions(), cloudFunction);
|
|
20
29
|
}
|
|
30
|
+
callFunction(func, params) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const res = yield func(params);
|
|
33
|
+
return res.data;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
21
36
|
}
|
|
22
37
|
exports.FirebaseCloudFunctions = FirebaseCloudFunctions;
|
|
23
38
|
//# sourceMappingURL=firebase-cloud-functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase-cloud-functions.js","sourceRoot":"","sources":["../../src/cloud-functions/firebase-cloud-functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firebase-cloud-functions.js","sourceRoot":"","sources":["../../src/cloud-functions/firebase-cloud-functions.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kDAA4E;AAC5E,wDAAmE;AAEnE,MAAa,sBAAsB;IAClC,YAAa,MAAe,EAAE,QAAyB;;QACtD,IAAK,MAAM;YAAG,gCAAc,CAAC,SAAS,CAAE,MAAM,CAAE,CAAA;QAChD,IAAK,QAAQ;YAAG,gCAAc,CAAC,WAAW,CAAE,QAAQ,CAAE,CAAA;QAEtD,IAAK,MAAA,gCAAc,CAAC,QAAQ,0CAAE,OAAO,EAAG;YACvC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,gCAAc,CAAC,QAAQ,CAAA;YACvD,IAAA,oCAAwB,EAAE,gCAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,aAAa,CAAE,CAAA;SACpF;IAEF,CAAC;IAED,gBAAgB,CAAQ,aAAqB;QAC5C,OAAO,IAAA,yBAAa,EAAO,gCAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,aAAa,CAAoC,CAAA;IAClH,CAAC;IAEK,YAAY,CAAQ,IAAyB,EAAE,MAAS;;YAC7D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAE,MAAM,CAAS,CAAA;YACvC,OAAO,GAAG,CAAC,IAAI,CAAA;QAChB,CAAC;KAAA;CACD;AApBD,wDAoBC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
9
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
10
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -9,9 +15,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
15
|
});
|
|
10
16
|
};
|
|
11
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ParamWrapper = void 0;
|
|
12
19
|
const entropic_bond_1 = require("entropic-bond");
|
|
13
20
|
const firebase_helper_1 = require("../firebase-helper");
|
|
14
21
|
const firebase_cloud_functions_1 = require("./firebase-cloud-functions");
|
|
22
|
+
let ParamWrapper = class ParamWrapper extends entropic_bond_1.Persistent {
|
|
23
|
+
constructor(a, b) {
|
|
24
|
+
super();
|
|
25
|
+
this._a = a;
|
|
26
|
+
this._b = b;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
__decorate([
|
|
30
|
+
entropic_bond_1.persistent
|
|
31
|
+
], ParamWrapper.prototype, "_a", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
entropic_bond_1.persistent
|
|
34
|
+
], ParamWrapper.prototype, "_b", void 0);
|
|
35
|
+
ParamWrapper = __decorate([
|
|
36
|
+
(0, entropic_bond_1.registerPersistentClass)('ParamWrapper')
|
|
37
|
+
], ParamWrapper);
|
|
38
|
+
exports.ParamWrapper = ParamWrapper;
|
|
15
39
|
describe('Cloud functions', () => {
|
|
16
40
|
beforeEach(() => {
|
|
17
41
|
firebase_helper_1.FirebaseHelper.setFirebaseConfig({
|
|
@@ -21,9 +45,18 @@ describe('Cloud functions', () => {
|
|
|
21
45
|
firebase_helper_1.FirebaseHelper.useEmulator();
|
|
22
46
|
entropic_bond_1.CloudFunctions.useCloudFunctionsService(new firebase_cloud_functions_1.FirebaseCloudFunctions('europe-west1', { emulate: true }));
|
|
23
47
|
});
|
|
24
|
-
it('should call cloud
|
|
25
|
-
const
|
|
26
|
-
|
|
48
|
+
it('should call cloud functions with plain types', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
const testCallablePlain = entropic_bond_1.CloudFunctions.instance.getFunction('testCallablePlain');
|
|
50
|
+
const result = yield testCallablePlain('Hello');
|
|
51
|
+
expect(result).toBe(5);
|
|
52
|
+
}));
|
|
53
|
+
it('should call cloud function for Persistent', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
const testCallablePersistent = entropic_bond_1.CloudFunctions.instance.getFunction('testCallablePersistent');
|
|
55
|
+
const paramWrapper = new ParamWrapper('test', 30);
|
|
56
|
+
const a = paramWrapper.toObject();
|
|
57
|
+
const result = yield testCallablePersistent(paramWrapper);
|
|
58
|
+
expect(result._a).toEqual('test');
|
|
59
|
+
expect(result._b).toEqual(30);
|
|
27
60
|
}));
|
|
28
61
|
});
|
|
29
62
|
//# sourceMappingURL=firebase-cloud-functions.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase-cloud-functions.spec.js","sourceRoot":"","sources":["../../src/cloud-functions/firebase-cloud-functions.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firebase-cloud-functions.spec.js","sourceRoot":"","sources":["../../src/cloud-functions/firebase-cloud-functions.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iDAA+F;AAC/F,wDAAmD;AACnD,yEAAmE;AAG5D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,0BAAU;IAC3C,YAAa,CAAU,EAAE,CAAU;QAClC,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;QACX,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;IACZ,CAAC;CAGD,CAAA;AAFY;IAAX,0BAAU;wCAAW;AACV;IAAX,0BAAU;wCAAW;AAPV,YAAY;IADxB,IAAA,uCAAuB,EAAE,cAAc,CAAE;GAC7B,YAAY,CAQxB;AARY,oCAAY;AAUzB,QAAQ,CAAE,iBAAiB,EAAE,GAAE,EAAE;IAEhC,UAAU,CAAC,GAAE,EAAE;QACd,gCAAc,CAAC,iBAAiB,CAAC;YAChC,SAAS,EAAE,WAAW;YACtB,aAAa,EAAE,gBAAgB;SAC/B,CAAC,CAAA;QAEF,gCAAc,CAAC,WAAW,EAAE,CAAA;QAC5B,8BAAc,CAAC,wBAAwB,CACtC,IAAI,iDAAsB,CAAE,cAAc,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAC9D,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAE,8CAA8C,EAAE,GAAQ,EAAE;QAC7D,MAAM,iBAAiB,GAAG,8BAAc,CAAC,QAAQ,CAAC,WAAW,CAAkB,mBAAmB,CAAE,CAAA;QACpG,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAE,OAAO,CAAE,CAAA;QAEjD,MAAM,CAAE,MAAM,CAAE,CAAC,IAAI,CAAE,CAAC,CAAE,CAAA;IAC3B,CAAC,CAAA,CAAC,CAAA;IAEF,EAAE,CAAE,2CAA2C,EAAE,GAAQ,EAAE;QAC1D,MAAM,sBAAsB,GAAG,8BAAc,CAAC,QAAQ,CAAC,WAAW,CAA8B,wBAAwB,CAAE,CAAA;QAC1H,MAAM,YAAY,GAAG,IAAI,YAAY,CAAE,MAAM,EAAE,EAAE,CAAE,CAAA;QAEnD,MAAM,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAA;QAEjC,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAE,YAAY,CAAE,CAAA;QAC3D,MAAM,CAAE,MAAM,CAAC,EAAE,CAAE,CAAC,OAAO,CAAE,MAAM,CAAE,CAAA;QACrC,MAAM,CAAE,MAAM,CAAC,EAAE,CAAE,CAAC,OAAO,CAAE,EAAE,CAAE,CAAA;IAClC,CAAC,CAAA,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entropic-bond/firebase",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"branches": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/node-fetch": "^3.0.3",
|
|
53
53
|
"git-branch-is": "^4.0.0",
|
|
54
54
|
"husky": "^8.0.1",
|
|
55
|
-
"jest": "^29.
|
|
55
|
+
"jest": "^29.2.0",
|
|
56
56
|
"node-fetch": "^2.6.1",
|
|
57
57
|
"semantic-release": "^19.0.5",
|
|
58
58
|
"ts-jest": "^29.0.3",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"xhr2": "^0.2.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"entropic-bond": "^1.
|
|
64
|
-
"firebase": "^9.12.
|
|
63
|
+
"entropic-bond": "^1.34.9",
|
|
64
|
+
"firebase": "^9.12.1"
|
|
65
65
|
},
|
|
66
66
|
"husky": {
|
|
67
67
|
"hooks": {
|