fable-serviceproviderbase 3.0.5 → 3.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fable-serviceproviderbase",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
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.46",
45
+ "fable": "^3.0.64",
46
46
  "mocha": "10.2.0",
47
47
  "nyc": "^15.1.0"
48
48
  }
@@ -15,16 +15,16 @@ class FableCoreServiceProviderBase
15
15
 
16
16
  this.options = (typeof(pOptions) === 'object') ? pOptions : {};
17
17
 
18
- this.serviceType = 'Unknown';
18
+ this.serviceType = 'Unknown';
19
19
 
20
20
  // The hash will be a non-standard UUID ... the UUID service uses this base class!
21
- this.UUID = `CORESVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`;
21
+ this.UUID = `CORESVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`;
22
22
 
23
- this.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;
23
+ this.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;
24
24
  }
25
25
 
26
26
 
27
- static isFableService = true;
27
+ static isFableService = true;
28
28
 
29
29
  // After fable is initialized, it would be expected to be wired in as a normal service.
30
30
  connectFable(pFable)
@@ -28,8 +28,8 @@ class FableServiceProviderBase
28
28
 
29
29
  // Pull back a few things
30
30
  this.log = this.fable.log;
31
+ this.servicesMap = this.fable.serviceMap;
31
32
  this.services = this.fable.services;
32
- this.defaultServices = this.fable.defaultServices;
33
33
  }
34
34
 
35
35
  static isFableService = true;
@@ -105,7 +105,7 @@ suite
105
105
  testFable.serviceManager.addServiceType('SimpleService');
106
106
  testFable.serviceManager.instantiateServiceProvider('SimpleService', {SomeOption: true}, 'SimpleService-123');
107
107
 
108
- Expect(testFable.serviceManager.services['SimpleService']['SimpleService-123']).to.be.an('object');
108
+ Expect(testFable.serviceManager.serviceMap['SimpleService']['SimpleService-123']).to.be.an('object');
109
109
  }
110
110
  );
111
111
  test
@@ -117,16 +117,16 @@ suite
117
117
  testFable.serviceManager.addServiceType('SimpleService', SimpleService);
118
118
  let tmpSimpleService = testFable.serviceManager.instantiateServiceProvider('SimpleService', {SomeOption: true}, 'SimpleService-123');
119
119
 
120
- Expect(testFable.serviceManager.services['SimpleService']['SimpleService-123']).to.be.an('object');
120
+ Expect(testFable.serviceManager.serviceMap['SimpleService']['SimpleService-123']).to.be.an('object');
121
121
 
122
122
  // The passed-in magic stuff should work too.
123
- tmpSimpleService.log.info(`There were almost ${tmpSimpleService.defaultServices.DataFormat.formatterDollars(9821229.37)} dollars just lying here!`);
123
+ tmpSimpleService.log.info(`There were almost ${tmpSimpleService.services.DataFormat.formatterDollars(9821229.37)} dollars just lying here!`);
124
124
 
125
- Expect(testFable.serviceManager.defaultServices['SimpleService']).to.be.an('object');
125
+ Expect(testFable.serviceManager.serviceMap['SimpleService']).to.be.an('object');
126
126
 
127
- testFable.serviceManager.defaultServices.SimpleService.doSomething();
127
+ testFable.serviceManager.services.SimpleService.doSomething();
128
128
 
129
- Expect(testFable.serviceManager.defaultServices['SimpleService'].Hash).to.equal('SimpleService-123');
129
+ Expect(testFable.serviceManager.services['SimpleService'].Hash).to.equal('SimpleService-123');
130
130
  }
131
131
  );
132
132
  test
@@ -140,9 +140,9 @@ suite
140
140
 
141
141
  testFable.serviceManager.instantiateServiceProvider('SimpleService', {SomeOption: true}, 'SimpleService-13');
142
142
 
143
- testFable.serviceManager.services['SimpleService']['SimpleService-13'].doSomething();
143
+ testFable.serviceManager.serviceMap['SimpleService']['SimpleService-13'].doSomething();
144
144
 
145
- Expect(testFable.serviceManager.services['SimpleService']['SimpleService-13']).to.be.an('object');
145
+ Expect(testFable.serviceManager.serviceMap['SimpleService']['SimpleService-13']).to.be.an('object');
146
146
  }
147
147
  );
148
148
 
@@ -157,7 +157,7 @@ suite
157
157
 
158
158
  let tmpService = testFable.serviceManager.instantiateServiceProviderWithoutRegistration('SimpleService', {SomeOption: true}, 'SimpleService-99');
159
159
 
160
- Expect(testFable.services.SimpleService['SimpleService-99']).to.be.an('undefined');
160
+ Expect(testFable.serviceMap.SimpleService['SimpleService-99']).to.be.an('undefined');
161
161
 
162
162
  Expect(tmpService).to.be.an('object');
163
163
  }
@@ -174,25 +174,25 @@ suite
174
174
  testFable.serviceManager.addServiceType('DatabaseService', MockDatabaseService);
175
175
 
176
176
  testFable.serviceManager.instantiateServiceProvider('SimpleService', {SomeOption: true});
177
- testFable.serviceManager.defaultServices.SimpleService.doSomething();
177
+ testFable.serviceManager.services.SimpleService.doSomething();
178
178
 
179
179
  testFable.serviceManager.instantiateServiceProvider('DatabaseService', {ConnectionString: 'mongodb://localhost:27017/test'}, 'PrimaryConnection');
180
180
 
181
- Expect(testFable.serviceManager.defaultServices.DatabaseService.Hash).to.equal('PrimaryConnection');
181
+ Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
182
182
 
183
183
  testFable.serviceManager.instantiateServiceProvider('DatabaseService', {ConnectionString: 'mongodb://localhost:27017/test'}, 'SecondaryConnection');
184
184
 
185
- Expect(testFable.serviceManager.defaultServices.DatabaseService.Hash).to.equal('PrimaryConnection');
185
+ Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
186
186
 
187
- testFable.serviceManager.defaultServices.DatabaseService.connect();
188
- testFable.serviceManager.defaultServices.DatabaseService.commit('Test Record');
187
+ testFable.serviceManager.services.DatabaseService.connect();
188
+ testFable.serviceManager.services.DatabaseService.commit('Test Record');
189
189
 
190
190
  testFable.serviceManager.setDefaultServiceInstantiation('DatabaseService', 'SecondaryConnection');
191
191
 
192
- testFable.serviceManager.defaultServices.DatabaseService.connect();
193
- testFable.serviceManager.defaultServices.DatabaseService.commit('Another Test Record');
192
+ testFable.serviceManager.services.DatabaseService.connect();
193
+ testFable.serviceManager.services.DatabaseService.commit('Another Test Record');
194
194
 
195
- Expect(testFable.serviceManager.defaultServices.DatabaseService.Hash).to.equal('SecondaryConnection');
195
+ Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('SecondaryConnection');
196
196
  }
197
197
  );
198
198
 
@@ -237,10 +237,10 @@ suite
237
237
 
238
238
  testFable.serviceManager.connectPreinitServiceProviderInstance(tmpCoreService);
239
239
 
240
- Expect(testFable.services.MockCoreService['MockCoreService-2']).to.be.an('object');
241
- Expect(testFable.defaultServices.MockCoreService).to.be.an('object');
240
+ Expect(testFable.serviceMap.MockCoreService['MockCoreService-2']).to.be.an('object');
241
+ Expect(testFable.services.MockCoreService).to.be.an('object');
242
242
 
243
- Expect(testFable.defaultServices.MockCoreService.fable.log).to.be.an('object');
243
+ Expect(testFable.services.MockCoreService.fable.log).to.be.an('object');
244
244
  }
245
245
  )
246
246
 
@@ -267,25 +267,25 @@ suite
267
267
  testFable.serviceManager.addServiceType('DatabaseService', MockDatabaseService);
268
268
 
269
269
  testFable.serviceManager.instantiateServiceProvider('SimpleService', {SomeOption: true});
270
- testFable.serviceManager.defaultServices.SimpleService.doSomething();
270
+ testFable.serviceManager.services.SimpleService.doSomething();
271
271
 
272
272
  testFable.serviceManager.instantiateServiceProvider('DatabaseService', {ConnectionString: 'mongodb://localhost:27017/test'}, 'PrimaryConnection');
273
273
 
274
- Expect(testFable.serviceManager.defaultServices.DatabaseService.Hash).to.equal('PrimaryConnection');
274
+ Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
275
275
 
276
276
  testFable.serviceManager.instantiateServiceProvider('DatabaseService', {ConnectionString: 'mongodb://localhost:27017/test'}, 'SecondaryConnection');
277
277
 
278
- Expect(testFable.serviceManager.defaultServices.DatabaseService.Hash).to.equal('PrimaryConnection');
278
+ Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
279
279
 
280
- testFable.serviceManager.defaultServices.DatabaseService.connect();
281
- testFable.serviceManager.defaultServices.DatabaseService.commit('Test Record');
280
+ testFable.serviceManager.services.DatabaseService.connect();
281
+ testFable.serviceManager.services.DatabaseService.commit('Test Record');
282
282
 
283
283
  Expect(testFable.serviceManager.setDefaultServiceInstantiation('DatabaseService', 'TertiaryConnection')).to.be.false;
284
284
 
285
- testFable.serviceManager.defaultServices.DatabaseService.connect();
286
- testFable.serviceManager.defaultServices.DatabaseService.commit('Another Test Record');
285
+ testFable.serviceManager.services.DatabaseService.connect();
286
+ testFable.serviceManager.services.DatabaseService.commit('Another Test Record');
287
287
 
288
- Expect(testFable.serviceManager.defaultServices.DatabaseService.Hash).to.equal('PrimaryConnection');
288
+ Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
289
289
  }
290
290
  );
291
291
  }