fable-serviceproviderbase 3.0.14 → 3.0.16
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/.browserslistrc +1 -1
- package/package.json +10 -5
- package/source/Fable-ServiceProviderBase.js +28 -5
- package/test/FableServiceProvider_tests.js +17 -2
- package/tsconfig.build.json +15 -0
- package/tsconfig.json +15 -0
- package/types/source/Fable-ServiceProviderBase.d.ts +37 -0
- package/types/source/Fable-ServiceProviderBase.d.ts.map +1 -0
package/.browserslistrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
since 2020
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fable-serviceproviderbase",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.16",
|
|
4
4
|
"description": "Simple base classes for fable services.",
|
|
5
5
|
"main": "source/Fable-ServiceProviderBase.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
"test": "npx mocha -u tdd -R spec",
|
|
9
9
|
"tests": "npx mocha -u tdd --exit -R spec --grep",
|
|
10
10
|
"coverage": "npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",
|
|
11
|
-
"build": "npx quack build"
|
|
11
|
+
"build": "npx quack build",
|
|
12
|
+
"types": "tsc -p ./tsconfig.build.json",
|
|
13
|
+
"check": "tsc -p . --noEmit"
|
|
12
14
|
},
|
|
15
|
+
"types": "types/source/Fable-ServiceProviderBase.d.ts",
|
|
13
16
|
"mocha": {
|
|
14
17
|
"diff": true,
|
|
15
18
|
"extension": [
|
|
@@ -43,7 +46,9 @@
|
|
|
43
46
|
},
|
|
44
47
|
"homepage": "https://github.com/stevenvelozo/fable-serviceproviderbase",
|
|
45
48
|
"devDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
49
|
+
"@types/mocha": "^10.0.10",
|
|
50
|
+
"fable": "^3.1.51",
|
|
51
|
+
"quackage": "^1.0.45",
|
|
52
|
+
"typescript": "^5.9.3"
|
|
48
53
|
}
|
|
49
|
-
}
|
|
54
|
+
}
|
|
@@ -3,13 +3,32 @@
|
|
|
3
3
|
* @author <steven@velozo.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
const libPackage = require('../package.json');
|
|
7
|
+
|
|
6
8
|
class FableServiceProviderBase
|
|
7
9
|
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The constructor can be used in two ways:
|
|
12
|
+
* 1) With a fable, options object and service hash (the options object and service hash are optional)a
|
|
13
|
+
* 2) With an object or nothing as the first parameter, where it will be treated as the options object
|
|
14
|
+
*
|
|
15
|
+
* @param {import('fable')|Record<string, any>} [pFable] - (optional) The fable instance, or the options object if there is no fable
|
|
16
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
17
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
18
|
+
*/
|
|
11
19
|
constructor(pFable, pOptions, pServiceHash)
|
|
12
20
|
{
|
|
21
|
+
/** @type {import('fable')} */
|
|
22
|
+
this.fable;
|
|
23
|
+
/** @type {string} */
|
|
24
|
+
this.UUID;
|
|
25
|
+
/** @type {Record<string, any>} */
|
|
26
|
+
this.options;
|
|
27
|
+
/** @type {Record<string, any>} */
|
|
28
|
+
this.services;
|
|
29
|
+
/** @type {Record<string, any>} */
|
|
30
|
+
this.servicesMap;
|
|
31
|
+
|
|
13
32
|
// Check if a fable was passed in; connect it if so
|
|
14
33
|
if ((typeof(pFable) === 'object') && pFable.isFable)
|
|
15
34
|
{
|
|
@@ -21,7 +40,8 @@ class FableServiceProviderBase
|
|
|
21
40
|
}
|
|
22
41
|
|
|
23
42
|
// Initialize the services map if it wasn't passed in
|
|
24
|
-
|
|
43
|
+
/** @type {Record<string, any>} */
|
|
44
|
+
this._PackageFableServiceProvider = libPackage;
|
|
25
45
|
|
|
26
46
|
// initialize options and UUID based on whether the fable was passed in or not.
|
|
27
47
|
if (this.fable)
|
|
@@ -49,6 +69,9 @@ class FableServiceProviderBase
|
|
|
49
69
|
: `${this.UUID}`;
|
|
50
70
|
}
|
|
51
71
|
|
|
72
|
+
/**
|
|
73
|
+
* @param {import('fable')} pFable
|
|
74
|
+
*/
|
|
52
75
|
connectFable(pFable)
|
|
53
76
|
{
|
|
54
77
|
if ((typeof(pFable) !== 'object') || (!pFable.isFable))
|
|
@@ -86,4 +109,4 @@ class FableServiceProviderBase
|
|
|
86
109
|
module.exports = FableServiceProviderBase;
|
|
87
110
|
|
|
88
111
|
// This is left here in case we want to go back to having different code/base class for "core" services
|
|
89
|
-
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
112
|
+
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
@@ -9,11 +9,16 @@
|
|
|
9
9
|
const libFable = require('fable');
|
|
10
10
|
const libFableServiceProviderBase = require('../source/Fable-ServiceProviderBase.js');
|
|
11
11
|
|
|
12
|
-
const Chai = require(
|
|
12
|
+
const Chai = require('chai');
|
|
13
13
|
const Expect = Chai.expect;
|
|
14
14
|
|
|
15
15
|
class SimpleService extends libFableServiceProviderBase
|
|
16
16
|
{
|
|
17
|
+
/**
|
|
18
|
+
* @param {import('fable')|Record<string, any>} pFable - The fable instance, or the options object if there is no fable
|
|
19
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
20
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
21
|
+
*/
|
|
17
22
|
constructor(pFable, pOptions, pServiceHash)
|
|
18
23
|
{
|
|
19
24
|
super(pFable, pOptions, pServiceHash);
|
|
@@ -29,6 +34,11 @@ class SimpleService extends libFableServiceProviderBase
|
|
|
29
34
|
|
|
30
35
|
class MockDatabaseService extends libFableServiceProviderBase
|
|
31
36
|
{
|
|
37
|
+
/**
|
|
38
|
+
* @param {import('fable')|Record<string, any>} pFable - The fable instance, or the options object if there is no fable
|
|
39
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
40
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
41
|
+
*/
|
|
32
42
|
constructor(pFable, pOptions, pServiceHash)
|
|
33
43
|
{
|
|
34
44
|
super(pFable, pOptions, pServiceHash);
|
|
@@ -49,6 +59,10 @@ class MockDatabaseService extends libFableServiceProviderBase
|
|
|
49
59
|
|
|
50
60
|
class MockCoreService extends libFableServiceProviderBase.CoreServiceProviderBase
|
|
51
61
|
{
|
|
62
|
+
/**
|
|
63
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
64
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
65
|
+
*/
|
|
52
66
|
constructor(pOptions, pServiceHash)
|
|
53
67
|
{
|
|
54
68
|
super(pOptions, pServiceHash);
|
|
@@ -68,6 +82,7 @@ suite
|
|
|
68
82
|
'Fable Service Manager',
|
|
69
83
|
function()
|
|
70
84
|
{
|
|
85
|
+
/** @type {import('fable')} */
|
|
71
86
|
var testFable = false;
|
|
72
87
|
|
|
73
88
|
setup
|
|
@@ -295,4 +310,4 @@ suite
|
|
|
295
310
|
}
|
|
296
311
|
);
|
|
297
312
|
}
|
|
298
|
-
);
|
|
313
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["source"],
|
|
3
|
+
"compilerOptions":
|
|
4
|
+
{
|
|
5
|
+
"lib": ["es5", "es6", "dom"],
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"checkJs": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"emitDeclarationOnly": true,
|
|
11
|
+
"outDir": "types",
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"resolveJsonModule": true
|
|
14
|
+
}
|
|
15
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["source", "test"],
|
|
3
|
+
"compilerOptions":
|
|
4
|
+
{
|
|
5
|
+
"lib": ["es5", "es6", "dom"],
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"checkJs": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"emitDeclarationOnly": true,
|
|
11
|
+
"outDir": "types",
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"resolveJsonModule": true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export = FableServiceProviderBase;
|
|
2
|
+
declare class FableServiceProviderBase {
|
|
3
|
+
static isFableService: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* The constructor can be used in two ways:
|
|
6
|
+
* 1) With a fable, options object and service hash (the options object and service hash are optional)a
|
|
7
|
+
* 2) With an object or nothing as the first parameter, where it will be treated as the options object
|
|
8
|
+
*
|
|
9
|
+
* @param {import('fable')|Record<string, any>} [pFable] - (optional) The fable instance, or the options object if there is no fable
|
|
10
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
11
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
12
|
+
*/
|
|
13
|
+
constructor(pFable?: any | Record<string, any>, pOptions?: Record<string, any> | string, pServiceHash?: string);
|
|
14
|
+
/** @type {import('fable')} */
|
|
15
|
+
fable: any;
|
|
16
|
+
/** @type {string} */
|
|
17
|
+
UUID: string;
|
|
18
|
+
/** @type {Record<string, any>} */
|
|
19
|
+
options: Record<string, any>;
|
|
20
|
+
/** @type {Record<string, any>} */
|
|
21
|
+
services: Record<string, any>;
|
|
22
|
+
/** @type {Record<string, any>} */
|
|
23
|
+
servicesMap: Record<string, any>;
|
|
24
|
+
/** @type {Record<string, any>} */
|
|
25
|
+
_PackageFableServiceProvider: Record<string, any>;
|
|
26
|
+
serviceType: string;
|
|
27
|
+
Hash: string;
|
|
28
|
+
/**
|
|
29
|
+
* @param {import('fable')} pFable
|
|
30
|
+
*/
|
|
31
|
+
connectFable(pFable: any): true | Error;
|
|
32
|
+
log: any;
|
|
33
|
+
}
|
|
34
|
+
declare namespace FableServiceProviderBase {
|
|
35
|
+
export { FableServiceProviderBase as CoreServiceProviderBase };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=Fable-ServiceProviderBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fable-ServiceProviderBase.d.ts","sourceRoot":"","sources":["../../source/Fable-ServiceProviderBase.js"],"names":[],"mappings":";AAOA;IAkGC,+BAA6B;IAhG7B;;;;;;;;OAQG;IACH,qBAJW,GAAe,GAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,aACnC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAC,MAAM,iBAC1B,MAAM,EAqDhB;IAjDA,8BAA8B;IAC9B,WAAU;IACV,qBAAqB;IACrB,MADW,MAAM,CACR;IACT,kCAAkC;IAClC,SADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAClB;IACZ,kCAAkC;IAClC,UADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACjB;IACb,kCAAkC;IAClC,aADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACd;IAahB,kCAAkC;IAClC,8BADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACgB;IAoB9C,oBAAyC;IAGzC,aAEmB;IAGpB;;OAEG;IACH,wCA6BC;IAbC,SAA6B;CAgB/B"}
|