fable-serviceproviderbase 3.0.4 → 3.0.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fable-serviceproviderbase",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
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.
|
|
45
|
+
"fable": "^3.0.46",
|
|
46
46
|
"mocha": "10.2.0",
|
|
47
47
|
"nyc": "^15.1.0"
|
|
48
48
|
}
|
|
@@ -25,6 +25,11 @@ class FableServiceProviderBase
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
this.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;
|
|
28
|
+
|
|
29
|
+
// Pull back a few things
|
|
30
|
+
this.log = this.fable.log;
|
|
31
|
+
this.servicesMap = this.fable.serviceMap;
|
|
32
|
+
this.services = this.fable.services;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
static isFableService = true;
|
|
@@ -115,15 +115,18 @@ suite
|
|
|
115
115
|
{
|
|
116
116
|
testFable = new libFable();
|
|
117
117
|
testFable.serviceManager.addServiceType('SimpleService', SimpleService);
|
|
118
|
-
testFable.serviceManager.instantiateServiceProvider('SimpleService', {SomeOption: true}, 'SimpleService-123');
|
|
118
|
+
let tmpSimpleService = testFable.serviceManager.instantiateServiceProvider('SimpleService', {SomeOption: true}, 'SimpleService-123');
|
|
119
119
|
|
|
120
120
|
Expect(testFable.serviceManager.services['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.services.DataFormat.formatterDollars(9821229.37)} dollars just lying here!`);
|
|
124
|
+
|
|
125
|
+
Expect(testFable.serviceManager.services['SimpleService']).to.be.an('object');
|
|
123
126
|
|
|
124
|
-
testFable.serviceManager.
|
|
127
|
+
testFable.serviceManager.services.SimpleService.doSomething();
|
|
125
128
|
|
|
126
|
-
Expect(testFable.serviceManager.
|
|
129
|
+
Expect(testFable.serviceManager.services['SimpleService'].Hash).to.equal('SimpleService-123');
|
|
127
130
|
}
|
|
128
131
|
);
|
|
129
132
|
test
|
|
@@ -154,7 +157,7 @@ suite
|
|
|
154
157
|
|
|
155
158
|
let tmpService = testFable.serviceManager.instantiateServiceProviderWithoutRegistration('SimpleService', {SomeOption: true}, 'SimpleService-99');
|
|
156
159
|
|
|
157
|
-
Expect(testFable.
|
|
160
|
+
Expect(testFable.serviceMap.SimpleService['SimpleService-99']).to.be.an('undefined');
|
|
158
161
|
|
|
159
162
|
Expect(tmpService).to.be.an('object');
|
|
160
163
|
}
|
|
@@ -171,25 +174,25 @@ suite
|
|
|
171
174
|
testFable.serviceManager.addServiceType('DatabaseService', MockDatabaseService);
|
|
172
175
|
|
|
173
176
|
testFable.serviceManager.instantiateServiceProvider('SimpleService', {SomeOption: true});
|
|
174
|
-
testFable.serviceManager.
|
|
177
|
+
testFable.serviceManager.services.SimpleService.doSomething();
|
|
175
178
|
|
|
176
179
|
testFable.serviceManager.instantiateServiceProvider('DatabaseService', {ConnectionString: 'mongodb://localhost:27017/test'}, 'PrimaryConnection');
|
|
177
180
|
|
|
178
|
-
Expect(testFable.serviceManager.
|
|
181
|
+
Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
|
|
179
182
|
|
|
180
183
|
testFable.serviceManager.instantiateServiceProvider('DatabaseService', {ConnectionString: 'mongodb://localhost:27017/test'}, 'SecondaryConnection');
|
|
181
184
|
|
|
182
|
-
Expect(testFable.serviceManager.
|
|
185
|
+
Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
|
|
183
186
|
|
|
184
|
-
testFable.serviceManager.
|
|
185
|
-
testFable.serviceManager.
|
|
187
|
+
testFable.serviceManager.services.DatabaseService.connect();
|
|
188
|
+
testFable.serviceManager.services.DatabaseService.commit('Test Record');
|
|
186
189
|
|
|
187
190
|
testFable.serviceManager.setDefaultServiceInstantiation('DatabaseService', 'SecondaryConnection');
|
|
188
191
|
|
|
189
|
-
testFable.serviceManager.
|
|
190
|
-
testFable.serviceManager.
|
|
192
|
+
testFable.serviceManager.services.DatabaseService.connect();
|
|
193
|
+
testFable.serviceManager.services.DatabaseService.commit('Another Test Record');
|
|
191
194
|
|
|
192
|
-
Expect(testFable.serviceManager.
|
|
195
|
+
Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('SecondaryConnection');
|
|
193
196
|
}
|
|
194
197
|
);
|
|
195
198
|
|
|
@@ -234,10 +237,10 @@ suite
|
|
|
234
237
|
|
|
235
238
|
testFable.serviceManager.connectPreinitServiceProviderInstance(tmpCoreService);
|
|
236
239
|
|
|
237
|
-
Expect(testFable.
|
|
238
|
-
Expect(testFable.
|
|
240
|
+
Expect(testFable.serviceMap.MockCoreService['MockCoreService-2']).to.be.an('object');
|
|
241
|
+
Expect(testFable.services.MockCoreService).to.be.an('object');
|
|
239
242
|
|
|
240
|
-
Expect(testFable.
|
|
243
|
+
Expect(testFable.services.MockCoreService.fable.log).to.be.an('object');
|
|
241
244
|
}
|
|
242
245
|
)
|
|
243
246
|
|
|
@@ -264,25 +267,25 @@ suite
|
|
|
264
267
|
testFable.serviceManager.addServiceType('DatabaseService', MockDatabaseService);
|
|
265
268
|
|
|
266
269
|
testFable.serviceManager.instantiateServiceProvider('SimpleService', {SomeOption: true});
|
|
267
|
-
testFable.serviceManager.
|
|
270
|
+
testFable.serviceManager.services.SimpleService.doSomething();
|
|
268
271
|
|
|
269
272
|
testFable.serviceManager.instantiateServiceProvider('DatabaseService', {ConnectionString: 'mongodb://localhost:27017/test'}, 'PrimaryConnection');
|
|
270
273
|
|
|
271
|
-
Expect(testFable.serviceManager.
|
|
274
|
+
Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
|
|
272
275
|
|
|
273
276
|
testFable.serviceManager.instantiateServiceProvider('DatabaseService', {ConnectionString: 'mongodb://localhost:27017/test'}, 'SecondaryConnection');
|
|
274
277
|
|
|
275
|
-
Expect(testFable.serviceManager.
|
|
278
|
+
Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
|
|
276
279
|
|
|
277
|
-
testFable.serviceManager.
|
|
278
|
-
testFable.serviceManager.
|
|
280
|
+
testFable.serviceManager.services.DatabaseService.connect();
|
|
281
|
+
testFable.serviceManager.services.DatabaseService.commit('Test Record');
|
|
279
282
|
|
|
280
283
|
Expect(testFable.serviceManager.setDefaultServiceInstantiation('DatabaseService', 'TertiaryConnection')).to.be.false;
|
|
281
284
|
|
|
282
|
-
testFable.serviceManager.
|
|
283
|
-
testFable.serviceManager.
|
|
285
|
+
testFable.serviceManager.services.DatabaseService.connect();
|
|
286
|
+
testFable.serviceManager.services.DatabaseService.commit('Another Test Record');
|
|
284
287
|
|
|
285
|
-
Expect(testFable.serviceManager.
|
|
288
|
+
Expect(testFable.serviceManager.services.DatabaseService.Hash).to.equal('PrimaryConnection');
|
|
286
289
|
}
|
|
287
290
|
);
|
|
288
291
|
}
|