fable-serviceproviderbase 3.0.2 → 3.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fable-serviceproviderbase",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "Simple base classes for fable services.",
5
5
  "main": "source/Fable-ServiceProviderBase.js",
6
6
  "scripts": {
@@ -42,7 +42,7 @@
42
42
  "homepage": "https://github.com/stevenvelozo/fable-serviceproviderbase",
43
43
  "devDependencies": {
44
44
  "chai": "4.3.7",
45
- "fable": "^3.0.28",
45
+ "fable": "^3.0.29",
46
46
  "mocha": "10.2.0",
47
47
  "nyc": "^15.1.0"
48
48
  }
@@ -4,7 +4,6 @@
4
4
  * For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.
5
5
  * This is a base class for those services.
6
6
  *
7
- * @license MIT
8
7
  * @author <steven@velozo.com>
9
8
  */
10
9
 
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Fable Service Base
3
- * @license MIT
4
3
  * @author <steven@velozo.com>
5
4
  */
6
5
 
@@ -10,16 +9,25 @@ class FableServiceProviderBase
10
9
  {
11
10
  this.fable = pFable;
12
11
 
13
- this.options = (typeof(pOptions) === 'object') ? pOptions : {};
12
+ this.options = (typeof(pOptions) === 'object') ? pOptions
13
+ : ((typeof(pFable) === 'object') && !pFable.isFable) ? pFable
14
+ : {};
14
15
 
15
- this.serviceType = 'Unknown';
16
+ this.serviceType = 'Unknown';
16
17
 
17
- this.UUID = pFable.getUUID();
18
+ if (typeof(pFable.getUUID) == 'function')
19
+ {
20
+ this.UUID = pFable.getUUID();
21
+ }
22
+ else
23
+ {
24
+ this.UUID = `NoFABLESVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`
25
+ }
18
26
 
19
- this.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;
27
+ this.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;
20
28
  }
21
29
 
22
- static isFableService = true;
30
+ static isFableService = true;
23
31
  }
24
32
 
25
33
  module.exports = FableServiceProviderBase;
@@ -88,7 +88,7 @@ suite
88
88
  function()
89
89
  {
90
90
  testFable = new libFable();
91
-
91
+
92
92
  let tmpSimpleService = new SimpleService(testFable, {SomeOption: true});
93
93
 
94
94
  tmpSimpleService.doSomething();
@@ -241,6 +241,18 @@ suite
241
241
  }
242
242
  )
243
243
 
244
+ test
245
+ (
246
+ 'Construct a service without a fable at all',
247
+ function()
248
+ {
249
+ let tmpService = new SimpleService({Setting:'Something'});
250
+
251
+ Expect(tmpService.options.Setting).to.equal('Something');
252
+ Expect(tmpService.UUID).to.be.a('string');
253
+ }
254
+ )
255
+
244
256
  test
245
257
  (
246
258
  'Attempt to change the default service provider to a nonexistant provider',