entropic-bond 1.34.5 → 1.34.6
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/cloud-functions-mock.d.ts +1 -1
- package/lib/cloud-functions/cloud-functions-mock.js +1 -1
- package/lib/cloud-functions/cloud-functions-mock.js.map +1 -1
- package/lib/cloud-functions/cloud-functions-mock.spec.js +46 -8
- package/lib/cloud-functions/cloud-functions-mock.spec.js.map +1 -1
- package/lib/cloud-functions/cloud-functions.d.ts +5 -3
- package/lib/cloud-functions/cloud-functions.js +18 -1
- package/lib/cloud-functions/cloud-functions.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ interface FunctionCollection {
|
|
|
4
4
|
}
|
|
5
5
|
export declare class CloudFunctionsMock implements CloudFunctionsService {
|
|
6
6
|
constructor(registeredFunctions: FunctionCollection);
|
|
7
|
-
|
|
7
|
+
retrieveFunction<P, R>(cloudFunction: string): CloudFunction<P, R>;
|
|
8
8
|
private _registeredFunctions;
|
|
9
9
|
}
|
|
10
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-functions-mock.js","sourceRoot":"","sources":["../../src/cloud-functions/cloud-functions-mock.ts"],"names":[],"mappings":";;;AAMA,MAAa,kBAAkB;IAC9B,YAAa,mBAAuC;QACnD,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAA;IAChD,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"cloud-functions-mock.js","sourceRoot":"","sources":["../../src/cloud-functions/cloud-functions-mock.ts"],"names":[],"mappings":";;;AAMA,MAAa,kBAAkB;IAC9B,YAAa,mBAAuC;QACnD,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAA;IAChD,CAAC;IAED,gBAAgB,CAAQ,aAAqB;QAC5C,OAAO,IAAI,CAAC,oBAAoB,CAAE,aAAa,CAAE,CAAA;IAClD,CAAC;CAGD;AAVD,gDAUC"}
|
|
@@ -1,21 +1,59 @@
|
|
|
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
|
+
};
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const persistent_1 = require("../persistent/persistent");
|
|
3
19
|
const cloud_functions_1 = require("./cloud-functions");
|
|
4
20
|
const cloud_functions_mock_1 = require("./cloud-functions-mock");
|
|
21
|
+
let ParamWrapper = class ParamWrapper extends persistent_1.Persistent {
|
|
22
|
+
constructor(a, b) {
|
|
23
|
+
super();
|
|
24
|
+
this._a = a;
|
|
25
|
+
this._b = b;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
__decorate([
|
|
29
|
+
persistent_1.persistent
|
|
30
|
+
], ParamWrapper.prototype, "_a", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
persistent_1.persistent
|
|
33
|
+
], ParamWrapper.prototype, "_b", void 0);
|
|
34
|
+
ParamWrapper = __decorate([
|
|
35
|
+
(0, persistent_1.registerPersistentClass)('Wrapper')
|
|
36
|
+
], ParamWrapper);
|
|
5
37
|
describe('Cloud functions', () => {
|
|
6
38
|
beforeEach(() => {
|
|
7
39
|
cloud_functions_1.CloudFunctions.useCloudFunctionsService(new cloud_functions_mock_1.CloudFunctionsMock({
|
|
8
40
|
testNoParam: () => Promise.resolve('test'),
|
|
9
|
-
testAutoResolve: (data) =>
|
|
41
|
+
testAutoResolve: (data) => {
|
|
42
|
+
return Promise.resolve(JSON.parse(JSON.stringify(data)));
|
|
43
|
+
}
|
|
10
44
|
}));
|
|
11
45
|
});
|
|
12
|
-
it('should execute test cloud function without params', () => {
|
|
13
|
-
const testNoParam = cloud_functions_1.CloudFunctions.instance.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
46
|
+
it('should execute test cloud function without params', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
const testNoParam = cloud_functions_1.CloudFunctions.instance.getRawFunction('testNoParam');
|
|
48
|
+
const result = yield testNoParam();
|
|
49
|
+
expect(result).toEqual('test');
|
|
50
|
+
}));
|
|
51
|
+
it('should execute test cloud function with params', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
52
|
const testAutoResolve = cloud_functions_1.CloudFunctions.instance.getFunction('testAutoResolve');
|
|
18
|
-
|
|
19
|
-
|
|
53
|
+
const paramWrapper = new ParamWrapper('test', 30);
|
|
54
|
+
const result = yield testAutoResolve(paramWrapper);
|
|
55
|
+
expect(result._a).toEqual('test');
|
|
56
|
+
expect(result._b).toBe(30);
|
|
57
|
+
}));
|
|
20
58
|
});
|
|
21
59
|
//# sourceMappingURL=cloud-functions-mock.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-functions-mock.spec.js","sourceRoot":"","sources":["../../src/cloud-functions/cloud-functions-mock.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloud-functions-mock.spec.js","sourceRoot":"","sources":["../../src/cloud-functions/cloud-functions-mock.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAA4G;AAC5G,uDAAkD;AAClD,iEAA2D;AAG3D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,uBAAU;IACpC,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,uBAAU;wCAAW;AACV;IAAX,uBAAU;wCAAW;AAPjB,YAAY;IADjB,IAAA,oCAAuB,EAAE,SAAS,CAAE;GAC/B,YAAY,CAQjB;AAED,QAAQ,CAAE,iBAAiB,EAAE,GAAE,EAAE;IAEhC,UAAU,CAAC,GAAE,EAAE;QACd,gCAAc,CAAC,wBAAwB,CAAE,IAAI,yCAAkB,CAAC;YAC/D,WAAW,EAAE,GAAmB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAE,MAAM,CAAE;YAC5D,eAAe,EAAE,CAAE,IAAoC,EAA4C,EAAE;gBACpG,OAAO,OAAO,CAAC,OAAO,CAAE,IAAI,CAAC,KAAK,CAAE,IAAI,CAAC,SAAS,CAAE,IAAI,CAAE,CAAE,CAAE,CAAA;YAC/D,CAAC;SACD,CAAC,CAAC,CAAA;IAEJ,CAAC,CAAC,CAAA;IAEF,EAAE,CAAE,mDAAmD,EAAE,GAAQ,EAAE;QAClE,MAAM,WAAW,GAAG,gCAAc,CAAC,QAAQ,CAAC,cAAc,CAAiB,aAAa,CAAE,CAAA;QAC1F,MAAM,MAAM,GAAG,MAAM,WAAW,EAAE,CAAA;QAClC,MAAM,CAAE,MAAM,CAAE,CAAC,OAAO,CAAE,MAAM,CAAE,CAAA;IACnC,CAAC,CAAA,CAAC,CAAA;IAEF,EAAE,CAAE,gDAAgD,EAAE,GAAQ,EAAE;QAC/D,MAAM,eAAe,GAAG,gCAAc,CAAC,QAAQ,CAAC,WAAW,CAA8B,iBAAiB,CAAE,CAAA;QAE5G,MAAM,YAAY,GAAG,IAAI,YAAY,CAAE,MAAM,EAAE,EAAE,CAAE,CAAA;QACnD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAE,YAAY,CAAE,CAAA;QACpD,MAAM,CAAE,MAAM,CAAC,EAAE,CAAE,CAAC,OAAO,CAAE,MAAM,CAAE,CAAA;QACrC,MAAM,CAAE,MAAM,CAAC,EAAE,CAAE,CAAC,IAAI,CAAE,EAAE,CAAE,CAAA;IAC/B,CAAC,CAAA,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { Persistent } from '../persistent/persistent';
|
|
1
2
|
export declare type CloudFunction<P, R> = (param?: P) => Promise<R>;
|
|
2
3
|
export interface CloudFunctionsService {
|
|
3
|
-
|
|
4
|
+
retrieveFunction<P, R>(cloudFunction: string): CloudFunction<P, R>;
|
|
4
5
|
}
|
|
5
|
-
export declare class CloudFunctions
|
|
6
|
+
export declare class CloudFunctions {
|
|
6
7
|
private constructor();
|
|
7
8
|
static error: {
|
|
8
9
|
shouldBeRegistered: string;
|
|
9
10
|
};
|
|
10
11
|
static useCloudFunctionsService(cloudFunctionsService: CloudFunctionsService): void;
|
|
11
12
|
static get instance(): CloudFunctions;
|
|
12
|
-
|
|
13
|
+
getRawFunction<P, R>(cloudFunction: string): CloudFunction<P, R>;
|
|
14
|
+
getFunction<P extends Persistent | undefined, R extends Persistent>(cloudFunction: string): CloudFunction<P, R>;
|
|
13
15
|
private static _cloudFunctionsService;
|
|
14
16
|
private static _instance;
|
|
15
17
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
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.CloudFunctions = void 0;
|
|
13
|
+
const persistent_1 = require("../persistent/persistent");
|
|
4
14
|
class CloudFunctions {
|
|
5
15
|
constructor() { }
|
|
6
16
|
static useCloudFunctionsService(cloudFunctionsService) {
|
|
@@ -13,8 +23,15 @@ class CloudFunctions {
|
|
|
13
23
|
throw new Error(CloudFunctions.error.shouldBeRegistered);
|
|
14
24
|
return CloudFunctions._instance || (CloudFunctions._instance = new CloudFunctions());
|
|
15
25
|
}
|
|
26
|
+
getRawFunction(cloudFunction) {
|
|
27
|
+
return CloudFunctions._cloudFunctionsService.retrieveFunction(cloudFunction);
|
|
28
|
+
}
|
|
16
29
|
getFunction(cloudFunction) {
|
|
17
|
-
|
|
30
|
+
const func = CloudFunctions._cloudFunctionsService.retrieveFunction(cloudFunction);
|
|
31
|
+
return (param) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const result = yield func(param === null || param === void 0 ? void 0 : param.toObject());
|
|
33
|
+
return persistent_1.Persistent.createInstance(result);
|
|
34
|
+
});
|
|
18
35
|
}
|
|
19
36
|
}
|
|
20
37
|
exports.CloudFunctions = CloudFunctions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-functions.js","sourceRoot":"","sources":["../../src/cloud-functions/cloud-functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloud-functions.js","sourceRoot":"","sources":["../../src/cloud-functions/cloud-functions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuE;AAUvE,MAAa,cAAc;IAC1B,gBAAuB,CAAC;IAIxB,MAAM,CAAC,wBAAwB,CAAE,qBAA4C;QAC5E,IAAK,IAAI,CAAC,sBAAsB,IAAI,qBAAqB,EAAG;YAC3D,IAAI,CAAC,sBAAsB,GAAG,qBAAqB,CAAA;SACnD;IACF,CAAC;IAED,MAAM,KAAK,QAAQ;QAClB,IAAK,CAAC,IAAI,CAAC,sBAAsB;YAAG,MAAM,IAAI,KAAK,CAAE,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAE,CAAA;QAC9F,OAAO,cAAc,CAAC,SAAS,IAAI,CAAE,cAAc,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAE,CAAA;IACvF,CAAC;IAED,cAAc,CAAQ,aAAqB;QAC1C,OAAO,cAAc,CAAC,sBAAsB,CAAC,gBAAgB,CAAE,aAAa,CAAE,CAAA;IAC/E,CAAC;IAED,WAAW,CAA0D,aAAqB;QACzF,MAAM,IAAI,GAAG,cAAc,CAAC,sBAAsB,CAAC,gBAAgB,CAAE,aAAa,CAAE,CAAA;QACpF,OAAO,CAAQ,KAAS,EAAG,EAAE;YAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE,CAAO,CAAA;YACnD,OAAO,uBAAU,CAAC,cAAc,CAAK,MAAM,CAAE,CAAA;QAC9C,CAAC,CAAA,CAAA;IACF,CAAC;;AA1BF,wCA8BC;AA3BO,oBAAK,GAAG,EAAE,kBAAkB,EAAE,wHAAwH,EAAE,CAAA"}
|