fable 3.0.28 → 3.0.30
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/README.md +0 -3
- package/dist/fable.compatible.js +1941 -3274
- package/dist/fable.compatible.min.js +32 -33
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +112 -111
- package/dist/fable.min.js +27 -46
- package/dist/fable.min.js.map +1 -1
- package/gulpfile-config.json +2 -2
- package/package.json +6 -6
- package/source/Fable-ServiceManager.js +7 -4
- package/source/Fable.js +48 -68
- package/source/services/Fable-Service-Operation-DefaultSettings.js +27 -0
- package/source/{Fable-Operation.js → services/Fable-Service-Operation.js} +10 -40
- package/test/FableDataArithmatic_tests.js +8 -8
- package/test/FableOperations_tests.js +9 -9
- package/test/FableUtility_tests.js +25 -25
- package/test/Fable_tests.js +7 -9
- package/source/services/Fable-Service-DataArithmatic.js +0 -17
package/gulpfile-config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fable",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.30",
|
|
4
4
|
"description": "An entity behavior management and API bundling library.",
|
|
5
5
|
"main": "source/Fable.js",
|
|
6
6
|
"scripts": {
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"async.eachlimit": "^0.5.2",
|
|
65
65
|
"async.waterfall": "^0.5.2",
|
|
66
|
-
"data-arithmatic": "^1.0.
|
|
67
|
-
"fable-log": "^3.0.
|
|
68
|
-
"fable-serviceproviderbase": "^3.0.
|
|
69
|
-
"fable-settings": "^3.0.
|
|
70
|
-
"fable-uuid": "^3.0.
|
|
66
|
+
"data-arithmatic": "^1.0.7",
|
|
67
|
+
"fable-log": "^3.0.8",
|
|
68
|
+
"fable-serviceproviderbase": "^3.0.2",
|
|
69
|
+
"fable-settings": "^3.0.4",
|
|
70
|
+
"fable-uuid": "^3.0.4",
|
|
71
71
|
"precedent": "^1.0.10",
|
|
72
72
|
"simple-get": "^4.0.1"
|
|
73
73
|
}
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
const libFableServiceBase = require('fable-serviceproviderbase');
|
|
8
8
|
|
|
9
|
-
class FableService
|
|
9
|
+
class FableService extends libFableServiceBase.CoreServiceProviderBase
|
|
10
10
|
{
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(pSettings, pServiceHash)
|
|
12
12
|
{
|
|
13
|
-
|
|
13
|
+
super(pSettings, pServiceHash);
|
|
14
|
+
|
|
15
|
+
this.serviceType = 'ServiceManager';
|
|
14
16
|
|
|
15
17
|
this.serviceTypes = [];
|
|
16
18
|
|
|
@@ -32,7 +34,8 @@ class FableService
|
|
|
32
34
|
// Add the container for instantiated services to go in
|
|
33
35
|
this.services[pServiceType] = {};
|
|
34
36
|
|
|
35
|
-
if
|
|
37
|
+
// Using the static member of the class is a much more reliable way to check if it is a service class than instanceof
|
|
38
|
+
if ((typeof(pServiceClass) == 'function') && (pServiceClass.isFableService))
|
|
36
39
|
{
|
|
37
40
|
// Add the class to the list of classes
|
|
38
41
|
this.serviceClasses[pServiceType] = pServiceClass;
|
package/source/Fable.js
CHANGED
|
@@ -10,106 +10,86 @@ const libFableLog = require('fable-log');
|
|
|
10
10
|
|
|
11
11
|
const libFableServiceManager = require('./Fable-ServiceManager.js');
|
|
12
12
|
|
|
13
|
-
// Services
|
|
14
|
-
const libFableServiceDataArithmatic = require('
|
|
13
|
+
// Default Services
|
|
14
|
+
const libFableServiceDataArithmatic = require('data-arithmatic');
|
|
15
15
|
const libFableServiceMetaTemplate = require('./services/Fable-Service-MetaTemplate.js');
|
|
16
|
+
const libFableServiceOperation = require('./services/Fable-Service-Operation.js');
|
|
16
17
|
const libFableServiceRestClient = require('./services/Fable-Service-RestClient.js');
|
|
17
18
|
const libFableServiceTemplate = require('./services/Fable-Service-Template.js');
|
|
18
19
|
const libFableServiceUtility = require('./services/Fable-Service-Utility.js');
|
|
19
20
|
|
|
20
|
-
const libFableOperation = require('./Fable-Operation.js');
|
|
21
|
-
|
|
22
21
|
class Fable
|
|
23
22
|
{
|
|
24
23
|
constructor(pSettings)
|
|
25
24
|
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
// Initialization Phase 0: Set up the lowest level state (core services)
|
|
26
|
+
// Container for the core services prototypes.
|
|
27
|
+
// This is here so if an API consumer changes the default for a core service,
|
|
28
|
+
// fable still runs with what was initialized.
|
|
29
|
+
this._coreServices = {};
|
|
30
|
+
|
|
31
|
+
// Instantiate the default Settings Manager
|
|
32
|
+
this._coreServices.SettingsManager = new libFableSettings(pSettings);
|
|
30
33
|
// Instantiate the UUID generator
|
|
31
|
-
this.
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.serviceManager
|
|
34
|
+
this._coreServices.UUID = new libFableUUID(this._coreServices.SettingsManager.settings);
|
|
35
|
+
// Instantiate the logging system
|
|
36
|
+
this._coreServices.Logging = new libFableLog(this._coreServices.SettingsManager.settings);
|
|
37
|
+
this._coreServices.Logging.initialize();
|
|
38
|
+
|
|
39
|
+
// Initialization Phase 1: Instantiate the service manager
|
|
40
|
+
// This is the start actual bootstrapping point for fable
|
|
41
|
+
this._coreServices.ServiceManager = new libFableServiceManager(this);
|
|
42
|
+
this.serviceManager = this._coreServices.ServiceManager;
|
|
43
|
+
this.serviceManager.connectFable(this);
|
|
44
|
+
// Bootstrapping of fable into the Service Manager is complete
|
|
45
|
+
|
|
46
|
+
// Initialization Phase 2: Map in the default services.
|
|
47
|
+
// They will then be available in the Default service provider set as well.
|
|
48
|
+
this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.ServiceManager);
|
|
49
|
+
this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.UUID);
|
|
50
|
+
this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.Logging);
|
|
51
|
+
this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.SettingsManager);
|
|
46
52
|
|
|
47
53
|
// Initialize and instantiate the default baked-in Data Arithmatic service
|
|
48
|
-
this.serviceManager.addServiceType('DataArithmatic', libFableServiceDataArithmatic);
|
|
49
|
-
this.fable.serviceManager.instantiateServiceProvider('DataArithmatic', {}, 'Default-Service-DataArithmatic');
|
|
50
|
-
// This service is passing through the data arithmatic library
|
|
51
|
-
this.DataArithmatic = this.serviceManager.defaultServices.DataArithmatic._DataArithmaticLibrary;
|
|
52
|
-
|
|
53
|
-
// Initialize the template service
|
|
54
54
|
this.serviceManager.addServiceType('Template', libFableServiceTemplate);
|
|
55
|
-
|
|
56
|
-
// Initialize the metatemplate service
|
|
57
55
|
this.serviceManager.addServiceType('MetaTemplate', libFableServiceMetaTemplate);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.serviceManager.addServiceType('Utility', libFableServiceUtility)
|
|
61
|
-
this.fable.serviceManager.instantiateServiceProvider('Utility'
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
-
// Add the REST Client service type
|
|
56
|
+
this.serviceManager.addServiceType('DataArithmatic', libFableServiceDataArithmatic);
|
|
57
|
+
this.fable.serviceManager.instantiateServiceProvider('DataArithmatic');
|
|
58
|
+
this.serviceManager.addServiceType('Utility', libFableServiceUtility);
|
|
59
|
+
this.fable.serviceManager.instantiateServiceProvider('Utility');
|
|
60
|
+
this.serviceManager.addServiceType('Operation', libFableServiceOperation);
|
|
65
61
|
this.serviceManager.addServiceType('RestClient', libFableServiceRestClient);
|
|
66
62
|
|
|
67
|
-
this.services = this.serviceManager.services;
|
|
68
|
-
this.defaultServices = this.serviceManager.defaultServices;
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
get settings()
|
|
72
66
|
{
|
|
73
|
-
return this.
|
|
67
|
+
return this._coreServices.SettingsManager.settings;
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
get
|
|
70
|
+
get log()
|
|
77
71
|
{
|
|
78
|
-
return this;
|
|
72
|
+
return this._coreServices.Logging;
|
|
79
73
|
}
|
|
80
74
|
|
|
81
|
-
|
|
75
|
+
get services()
|
|
82
76
|
{
|
|
83
|
-
return this.
|
|
77
|
+
return this._coreServices.ServiceManager.services;
|
|
84
78
|
}
|
|
85
79
|
|
|
86
|
-
|
|
80
|
+
get defaultServices()
|
|
87
81
|
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (this.Operations.hasOwnProperty(tmpOperation.Hash))
|
|
91
|
-
{
|
|
92
|
-
// Uh Oh ...... Operation Hash Collision!
|
|
93
|
-
// TODO: What to do?!
|
|
94
|
-
}
|
|
95
|
-
else
|
|
96
|
-
{
|
|
97
|
-
this.Operations[tmpOperation.Hash] = tmpOperation;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return tmpOperation;
|
|
82
|
+
return this._coreServices.ServiceManager.defaultServices;
|
|
101
83
|
}
|
|
102
84
|
|
|
103
|
-
|
|
85
|
+
getUUID()
|
|
104
86
|
{
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return this.Operations[pOperationHash];
|
|
112
|
-
}
|
|
87
|
+
return this._coreServices.UUID.getUUID();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get fable()
|
|
91
|
+
{
|
|
92
|
+
return this;
|
|
113
93
|
}
|
|
114
94
|
}
|
|
115
95
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module.exports = (
|
|
2
|
+
{
|
|
3
|
+
"Metadata": {
|
|
4
|
+
"GUID": false,
|
|
5
|
+
"Hash": false,
|
|
6
|
+
|
|
7
|
+
"Title": "",
|
|
8
|
+
"Summary": "",
|
|
9
|
+
|
|
10
|
+
"Version": 0
|
|
11
|
+
},
|
|
12
|
+
"Status": {
|
|
13
|
+
"Completed": false,
|
|
14
|
+
|
|
15
|
+
"CompletionProgress": 0,
|
|
16
|
+
"CompletionTimeElapsed": 0,
|
|
17
|
+
|
|
18
|
+
"Steps": 1,
|
|
19
|
+
"StepsCompleted": 0,
|
|
20
|
+
|
|
21
|
+
"StartTime": 0,
|
|
22
|
+
"EndTime": 0
|
|
23
|
+
},
|
|
24
|
+
"Errors": [],
|
|
25
|
+
"Log": []
|
|
26
|
+
}
|
|
27
|
+
);
|
|
@@ -1,47 +1,22 @@
|
|
|
1
|
-
const
|
|
2
|
-
{
|
|
3
|
-
"Metadata": {
|
|
4
|
-
"GUID": false,
|
|
5
|
-
"Hash": false,
|
|
6
|
-
|
|
7
|
-
"Title": "",
|
|
8
|
-
"Summary": "",
|
|
9
|
-
|
|
10
|
-
"Version": 0
|
|
11
|
-
},
|
|
12
|
-
"Status": {
|
|
13
|
-
"Completed": false,
|
|
1
|
+
const libFableServiceBase = require('../Fable-ServiceManager.js').ServiceProviderBase;
|
|
14
2
|
|
|
15
|
-
|
|
16
|
-
"CompletionTimeElapsed": 0,
|
|
3
|
+
const _OperationStatePrototypeString = JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));
|
|
17
4
|
|
|
18
|
-
|
|
19
|
-
"StepsCompleted": 0,
|
|
20
|
-
|
|
21
|
-
"StartTime": 0,
|
|
22
|
-
"EndTime": 0
|
|
23
|
-
},
|
|
24
|
-
"Errors": [],
|
|
25
|
-
"Log": []
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
class FableOperation
|
|
5
|
+
class FableOperation extends libFableServiceBase
|
|
29
6
|
{
|
|
30
|
-
|
|
7
|
+
|
|
8
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
31
9
|
{
|
|
32
|
-
|
|
10
|
+
super(pFable, pOptions, pServiceHash);
|
|
33
11
|
|
|
34
|
-
|
|
12
|
+
this.serviceType = 'PhasedOperation';
|
|
35
13
|
|
|
36
|
-
this.state = JSON.parse(
|
|
14
|
+
this.state = JSON.parse(_OperationStatePrototypeString);
|
|
37
15
|
|
|
38
16
|
this.state.Metadata.GUID = this.fable.getUUID();
|
|
39
|
-
this.state.Metadata.Hash = this.
|
|
17
|
+
this.state.Metadata.Hash = this.Hash;
|
|
40
18
|
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
this.state.Metadata.Hash = pOperationHash;
|
|
44
|
-
}
|
|
19
|
+
this.name = (typeof(this.options.Name) == 'string') ? this.options.Name : `Unnamed Operation ${this.state.Metadata.GUID}`;
|
|
45
20
|
}
|
|
46
21
|
|
|
47
22
|
get GUID()
|
|
@@ -49,11 +24,6 @@ class FableOperation
|
|
|
49
24
|
return this.state.Metadata.GUID;
|
|
50
25
|
}
|
|
51
26
|
|
|
52
|
-
get Hash()
|
|
53
|
-
{
|
|
54
|
-
return this.state.Metadata.Hash;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
27
|
get log()
|
|
58
28
|
{
|
|
59
29
|
return this;
|
|
@@ -29,7 +29,7 @@ suite
|
|
|
29
29
|
(fTestComplete)=>
|
|
30
30
|
{
|
|
31
31
|
let testFable = new libFable({LogStreams: false});
|
|
32
|
-
let _DataArithmatic = testFable.DataArithmatic;
|
|
32
|
+
let _DataArithmatic = testFable.defaultServices.DataArithmatic;
|
|
33
33
|
Expect(_DataArithmatic
|
|
34
34
|
.stringReverse('Dogs'))
|
|
35
35
|
.to.equal('sgoD');
|
|
@@ -45,7 +45,7 @@ suite
|
|
|
45
45
|
(fTestComplete)=>
|
|
46
46
|
{
|
|
47
47
|
let testFable = new libFable({LogStreams: false});
|
|
48
|
-
let _DataArithmatic = testFable.DataArithmatic;
|
|
48
|
+
let _DataArithmatic = testFable.defaultServices.DataArithmatic;
|
|
49
49
|
Expect(_DataArithmatic
|
|
50
50
|
.insecureStringHash('Dogs'))
|
|
51
51
|
.to.equal('HSH2135767');
|
|
@@ -68,7 +68,7 @@ suite
|
|
|
68
68
|
(fTestComplete)=>
|
|
69
69
|
{
|
|
70
70
|
let testFable = new libFable({LogStreams: false});
|
|
71
|
-
let _DataArithmatic = testFable.DataArithmatic;
|
|
71
|
+
let _DataArithmatic = testFable.defaultServices.DataArithmatic;
|
|
72
72
|
// Test the enclosure cleaning function
|
|
73
73
|
Expect(_DataArithmatic
|
|
74
74
|
.cleanEnclosureWrapCharacters('`', '`Dogs`'))
|
|
@@ -102,7 +102,7 @@ suite
|
|
|
102
102
|
(fTestComplete)=>
|
|
103
103
|
{
|
|
104
104
|
let testFable = new libFable({LogStreams: false});
|
|
105
|
-
let _DataArithmatic = testFable.DataArithmatic;
|
|
105
|
+
let _DataArithmatic = testFable.defaultServices.DataArithmatic;
|
|
106
106
|
Expect(_DataArithmatic
|
|
107
107
|
.stringStartsWith('Dogs', 'Do'))
|
|
108
108
|
.to.equal(true);
|
|
@@ -124,7 +124,7 @@ suite
|
|
|
124
124
|
(fTestComplete)=>
|
|
125
125
|
{
|
|
126
126
|
let testFable = new libFable({LogStreams: false});
|
|
127
|
-
let _DataArithmatic = testFable.DataArithmatic;
|
|
127
|
+
let _DataArithmatic = testFable.defaultServices.DataArithmatic;
|
|
128
128
|
_DataArithmatic._UseEngineStringStartsWith = false;
|
|
129
129
|
Expect(_DataArithmatic
|
|
130
130
|
.stringStartsWith('Dogs', 'Do'))
|
|
@@ -147,7 +147,7 @@ suite
|
|
|
147
147
|
(fTestComplete)=>
|
|
148
148
|
{
|
|
149
149
|
let testFable = new libFable({LogStreams: false});
|
|
150
|
-
let _DataArithmatic = testFable.DataArithmatic;
|
|
150
|
+
let _DataArithmatic = testFable.defaultServices.DataArithmatic;
|
|
151
151
|
Expect(_DataArithmatic
|
|
152
152
|
.stringEndsWith('Dogs', 'gs'))
|
|
153
153
|
.to.equal(true);
|
|
@@ -169,7 +169,7 @@ suite
|
|
|
169
169
|
(fTestComplete)=>
|
|
170
170
|
{
|
|
171
171
|
let testFable = new libFable({LogStreams: false});
|
|
172
|
-
let _DataArithmatic = testFable.DataArithmatic;
|
|
172
|
+
let _DataArithmatic = testFable.defaultServices.DataArithmatic;
|
|
173
173
|
_DataArithmatic._UseEngineStringEndsWith = false;
|
|
174
174
|
Expect(_DataArithmatic
|
|
175
175
|
.stringEndsWith('Dogs', 'gs'))
|
|
@@ -199,7 +199,7 @@ suite
|
|
|
199
199
|
(fTestComplete)=>
|
|
200
200
|
{
|
|
201
201
|
let testFable = new libFable({LogStreams: false});
|
|
202
|
-
let _DataArithmatic = testFable.DataArithmatic;
|
|
202
|
+
let _DataArithmatic = testFable.defaultServices.DataArithmatic;
|
|
203
203
|
Expect(_DataArithmatic
|
|
204
204
|
.cleanNonAlphaCharacters('Dogs'))
|
|
205
205
|
.to.equal('Dogs');
|
|
@@ -27,11 +27,11 @@ suite
|
|
|
27
27
|
function()
|
|
28
28
|
{
|
|
29
29
|
let testFable = new libFable();
|
|
30
|
-
let tmpOperation = testFable.
|
|
30
|
+
let tmpOperation = testFable.serviceManager.instantiateServiceProvider('Operation', {Name: 'Big Complex Integration Operation'}, 'INTEGRATION-123');
|
|
31
31
|
Expect(tmpOperation).to.be.an('object');
|
|
32
|
-
Expect(testFable.
|
|
33
|
-
Expect(testFable.
|
|
34
|
-
Expect(testFable.
|
|
32
|
+
Expect(testFable.services.Operation['INTEGRATION-123']).to.equal(tmpOperation);
|
|
33
|
+
Expect(testFable.services.Operation['BADHASH']).to.be.undefined;
|
|
34
|
+
Expect(testFable.services.Operation.hasOwnProperty('INTEGRATION-123')).to.equal(true);
|
|
35
35
|
tmpOperation.log.info(`Operation GUID ${tmpOperation.GUID} ---- Test 123`);
|
|
36
36
|
Expect(tmpOperation.state.Log.length).to.equal(1);
|
|
37
37
|
Expect(tmpOperation.state.Log[0]).to.contain('Test 123');
|
|
@@ -43,15 +43,15 @@ suite
|
|
|
43
43
|
function()
|
|
44
44
|
{
|
|
45
45
|
let testFable = new libFable();
|
|
46
|
-
let tmpOperation = testFable.
|
|
46
|
+
let tmpOperation = testFable.serviceManager.instantiateServiceProvider('Operation', {Name: 'Big Complex Integration Operation'}, 'INTEGRATION-123');;
|
|
47
47
|
Expect(tmpOperation).to.be.an('object');
|
|
48
48
|
Expect(tmpOperation.name).to.equal('Big Complex Integration Operation');
|
|
49
49
|
|
|
50
|
-
let tmpCollisionOperation = testFable.
|
|
50
|
+
let tmpCollisionOperation = testFable.serviceManager.instantiateServiceProvider('Operation', {Name: 'Another Big Complex Integration Operation with Colliding Name'}, 'INTEGRATION-123');;
|
|
51
51
|
Expect(tmpCollisionOperation).to.be.an('object');
|
|
52
52
|
Expect(tmpCollisionOperation.name).to.equal('Another Big Complex Integration Operation with Colliding Name');
|
|
53
53
|
|
|
54
|
-
Expect(testFable.
|
|
54
|
+
Expect(testFable.services.Operation['INTEGRATION-123']).to.equal(tmpCollisionOperation);
|
|
55
55
|
|
|
56
56
|
}
|
|
57
57
|
);
|
|
@@ -61,9 +61,9 @@ suite
|
|
|
61
61
|
function()
|
|
62
62
|
{
|
|
63
63
|
let testFable = new libFable();
|
|
64
|
-
let tmpOperation = testFable.
|
|
64
|
+
let tmpOperation = testFable.serviceManager.instantiateServiceProvider('Operation', {Name:'Another Big Complex Integration Operation'});
|
|
65
65
|
Expect(tmpOperation).to.be.an('object');
|
|
66
|
-
Expect(testFable.
|
|
66
|
+
Expect(testFable.services.Operation.hasOwnProperty(tmpOperation.Hash)).to.equal(true);
|
|
67
67
|
Expect(tmpOperation.state.Log.length).to.equal(0);
|
|
68
68
|
let tmpText = `Operation ${tmpOperation.Hash} starting up...`;
|
|
69
69
|
tmpOperation.log.info(tmpText);
|
|
@@ -36,7 +36,7 @@ suite
|
|
|
36
36
|
function()
|
|
37
37
|
{
|
|
38
38
|
testFable = new libFable();
|
|
39
|
-
let tmpTemplate = testFable.Utility.template('Something');
|
|
39
|
+
let tmpTemplate = testFable.defaultServices.Utility.template('Something');
|
|
40
40
|
Expect(tmpTemplate).to.be.a('function');
|
|
41
41
|
}
|
|
42
42
|
);
|
|
@@ -46,7 +46,7 @@ suite
|
|
|
46
46
|
function()
|
|
47
47
|
{
|
|
48
48
|
testFable = new libFable();
|
|
49
|
-
let tmpTemplate = testFable.Utility.template('Something');
|
|
49
|
+
let tmpTemplate = testFable.defaultServices.Utility.template('Something');
|
|
50
50
|
Expect(tmpTemplate).to.be.a('function');
|
|
51
51
|
Expect(tmpTemplate()).to.equal('Something');
|
|
52
52
|
}
|
|
@@ -57,7 +57,7 @@ suite
|
|
|
57
57
|
function()
|
|
58
58
|
{
|
|
59
59
|
testFable = new libFable();
|
|
60
|
-
let tmpTemplate = testFable.Utility.template('There // %> are \\ */ /* <%= Count %> things....');
|
|
60
|
+
let tmpTemplate = testFable.defaultServices.Utility.template('There // %> are \\ */ /* <%= Count %> things....');
|
|
61
61
|
Expect(tmpTemplate).to.be.a('function');
|
|
62
62
|
Expect(tmpTemplate({Count:1000})).to.equal('There // %> are \\ */ /* 1000 things....');
|
|
63
63
|
}
|
|
@@ -68,10 +68,10 @@ suite
|
|
|
68
68
|
function()
|
|
69
69
|
{
|
|
70
70
|
testFable = new libFable();
|
|
71
|
-
let tmpTemplate = testFable.Utility.template('There are so many of these things (<%= Count %> to be exact)....');
|
|
71
|
+
let tmpTemplate = testFable.defaultServices.Utility.template('There are so many of these things (<%= Count %> to be exact)....');
|
|
72
72
|
Expect(tmpTemplate).to.be.a('function');
|
|
73
73
|
Expect(tmpTemplate({Count:1000})).to.equal('There are so many of these things (1000 to be exact)....');
|
|
74
|
-
let tmpOtherTemplate = testFable.Utility.template('Things count: <%= Count %>');
|
|
74
|
+
let tmpOtherTemplate = testFable.defaultServices.Utility.template('Things count: <%= Count %>');
|
|
75
75
|
Expect(tmpOtherTemplate).to.be.a('function');
|
|
76
76
|
Expect(tmpOtherTemplate({Count:600})).to.equal('Things count: 600');
|
|
77
77
|
Expect(tmpTemplate({Count:256})).to.equal('There are so many of these things (256 to be exact)....');
|
|
@@ -83,16 +83,16 @@ suite
|
|
|
83
83
|
function()
|
|
84
84
|
{
|
|
85
85
|
testFable = new libFable();
|
|
86
|
-
testFable.Utility.buildHashedTemplate('HeadLine', '<h1><%= TitleText %> Page</h1>');
|
|
87
|
-
testFable.Utility.buildHashedTemplate('Slogan', '<p>Some people, like <%= Name %>, have all the fun.</p>');
|
|
86
|
+
testFable.defaultServices.Utility.buildHashedTemplate('HeadLine', '<h1><%= TitleText %> Page</h1>');
|
|
87
|
+
testFable.defaultServices.Utility.buildHashedTemplate('Slogan', '<p>Some people, like <%= Name %>, have all the fun.</p>');
|
|
88
88
|
|
|
89
89
|
// Access the low level service render function
|
|
90
90
|
Expect(testFable.services.Template.HeadLine.renderFunction({TitleText:'Test'})).to.equal('<h1>Test Page</h1>');
|
|
91
91
|
Expect(testFable.services.Template.Slogan.renderFunction({Name:'Jim'})).to.equal('<p>Some people, like Jim, have all the fun.</p>');
|
|
92
92
|
|
|
93
93
|
// Use the high level simpler one
|
|
94
|
-
Expect(testFable.Utility.templates.HeadLine({TitleText:'A New'})).to.equal('<h1>A New Page</h1>');
|
|
95
|
-
Expect(testFable.Utility.templates.Slogan({Name:'Bob'})).to.equal('<p>Some people, like Bob, have all the fun.</p>');
|
|
94
|
+
Expect(testFable.defaultServices.Utility.templates.HeadLine({TitleText:'A New'})).to.equal('<h1>A New Page</h1>');
|
|
95
|
+
Expect(testFable.defaultServices.Utility.templates.Slogan({Name:'Bob'})).to.equal('<p>Some people, like Bob, have all the fun.</p>');
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
98
|
test
|
|
@@ -101,7 +101,7 @@ suite
|
|
|
101
101
|
function()
|
|
102
102
|
{
|
|
103
103
|
testFable = new libFable();
|
|
104
|
-
let tmpTemplate = testFable.Utility.template('There are <%= Count %> things....', {Count:1000});
|
|
104
|
+
let tmpTemplate = testFable.defaultServices.Utility.template('There are <%= Count %> things....', {Count:1000});
|
|
105
105
|
Expect(tmpTemplate).to.equal('There are 1000 things....');
|
|
106
106
|
}
|
|
107
107
|
);
|
|
@@ -111,7 +111,7 @@ suite
|
|
|
111
111
|
function()
|
|
112
112
|
{
|
|
113
113
|
testFable = new libFable();
|
|
114
|
-
let tmpResult = testFable.Utility.extend({SomeValue:'here'});
|
|
114
|
+
let tmpResult = testFable.defaultServices.Utility.extend({SomeValue:'here'});
|
|
115
115
|
Expect(tmpResult).to.have.a.property('SomeValue')
|
|
116
116
|
.that.is.a('string');
|
|
117
117
|
Expect(tmpResult.SomeValue).to.equal('here')
|
|
@@ -123,7 +123,7 @@ suite
|
|
|
123
123
|
function()
|
|
124
124
|
{
|
|
125
125
|
testFable = new libFable();
|
|
126
|
-
let tmpResult = testFable.Utility.extend({SomeValue:'here',Size:10},{Color:'Red',Size:20});
|
|
126
|
+
let tmpResult = testFable.defaultServices.Utility.extend({SomeValue:'here',Size:10},{Color:'Red',Size:20});
|
|
127
127
|
Expect(tmpResult).to.have.a.property('SomeValue')
|
|
128
128
|
.that.is.a('string');
|
|
129
129
|
Expect(tmpResult.SomeValue).to.equal('here');
|
|
@@ -137,7 +137,7 @@ suite
|
|
|
137
137
|
function()
|
|
138
138
|
{
|
|
139
139
|
testFable = new libFable();
|
|
140
|
-
let tmpResult = testFable.Utility.extend(
|
|
140
|
+
let tmpResult = testFable.defaultServices.Utility.extend(
|
|
141
141
|
{SomeValue:'here',Size:10, Race:'Human'},
|
|
142
142
|
{Color:'Red',Size:20, Band:'Metalocalypse'},
|
|
143
143
|
{Name:'Bilbo', Size:15, Race:'Hobbit', Band:'The dead hobbitz'});
|
|
@@ -165,20 +165,20 @@ suite
|
|
|
165
165
|
*/
|
|
166
166
|
// Regular Expressions for easy conversion of underscore tests:
|
|
167
167
|
// S: assert.deepEqual\(_.chunk\((.*)\), (.*), '
|
|
168
|
-
// R: Expect(testFable.Utility.chunk($1)).to.deep.equal($2); // $3
|
|
169
|
-
Expect(testFable.Utility.chunk([], 2)).to.deep.equal([]); // chunk for empty array returns an empty array');
|
|
168
|
+
// R: Expect(testFable.defaultServices.Utility.chunk($1)).to.deep.equal($2); // $3
|
|
169
|
+
Expect(testFable.defaultServices.Utility.chunk([], 2)).to.deep.equal([]); // chunk for empty array returns an empty array');
|
|
170
170
|
|
|
171
|
-
Expect(testFable.Utility.chunk([1, 2, 3], 0)).to.deep.equal([]); // chunk into parts of 0 elements returns empty array');
|
|
172
|
-
Expect(testFable.Utility.chunk([1, 2, 3], -1)).to.deep.equal([]); // chunk into parts of negative amount of elements returns an empty array');
|
|
173
|
-
Expect(testFable.Utility.chunk([1, 2, 3])).to.deep.equal([]); // defaults to empty array (chunk size 0)');
|
|
171
|
+
Expect(testFable.defaultServices.Utility.chunk([1, 2, 3], 0)).to.deep.equal([]); // chunk into parts of 0 elements returns empty array');
|
|
172
|
+
Expect(testFable.defaultServices.Utility.chunk([1, 2, 3], -1)).to.deep.equal([]); // chunk into parts of negative amount of elements returns an empty array');
|
|
173
|
+
Expect(testFable.defaultServices.Utility.chunk([1, 2, 3])).to.deep.equal([]); // defaults to empty array (chunk size 0)');
|
|
174
174
|
|
|
175
|
-
Expect(testFable.Utility.chunk([1, 2, 3], 1)).to.deep.equal([[1], [2], [3]]); // chunk into parts of 1 elements returns original array');
|
|
175
|
+
Expect(testFable.defaultServices.Utility.chunk([1, 2, 3], 1)).to.deep.equal([[1], [2], [3]]); // chunk into parts of 1 elements returns original array');
|
|
176
176
|
|
|
177
|
-
Expect(testFable.Utility.chunk([1, 2, 3], 3)).to.deep.equal([[1, 2, 3]]); // chunk into parts of current array length elements returns the original array');
|
|
178
|
-
Expect(testFable.Utility.chunk([1, 2, 3], 5)).to.deep.equal([[1, 2, 3]]); // chunk into parts of more then current array length elements returns the original array');
|
|
177
|
+
Expect(testFable.defaultServices.Utility.chunk([1, 2, 3], 3)).to.deep.equal([[1, 2, 3]]); // chunk into parts of current array length elements returns the original array');
|
|
178
|
+
Expect(testFable.defaultServices.Utility.chunk([1, 2, 3], 5)).to.deep.equal([[1, 2, 3]]); // chunk into parts of more then current array length elements returns the original array');
|
|
179
179
|
|
|
180
|
-
Expect(testFable.Utility.chunk([10, 20, 30, 40, 50, 60, 70], 2)).to.deep.equal([[10, 20], [30, 40], [50, 60], [70]]); // chunk into parts of less then current array length elements');
|
|
181
|
-
Expect(testFable.Utility.chunk([10, 20, 30, 40, 50, 60, 70], 3)).to.deep.equal([[10, 20, 30], [40, 50, 60], [70]]); // chunk into parts of less then current array length elements');
|
|
180
|
+
Expect(testFable.defaultServices.Utility.chunk([10, 20, 30, 40, 50, 60, 70], 2)).to.deep.equal([[10, 20], [30, 40], [50, 60], [70]]); // chunk into parts of less then current array length elements');
|
|
181
|
+
Expect(testFable.defaultServices.Utility.chunk([10, 20, 30, 40, 50, 60, 70], 3)).to.deep.equal([[10, 20, 30], [40, 50, 60], [70]]); // chunk into parts of less then current array length elements');
|
|
182
182
|
}
|
|
183
183
|
);
|
|
184
184
|
test
|
|
@@ -190,7 +190,7 @@ suite
|
|
|
190
190
|
|
|
191
191
|
let tmpState = {};
|
|
192
192
|
|
|
193
|
-
testFable.Utility.waterfall([
|
|
193
|
+
testFable.defaultServices.Utility.waterfall([
|
|
194
194
|
(fStageComplete)=>
|
|
195
195
|
{
|
|
196
196
|
tmpState.Name = 'The Pixies';
|
|
@@ -220,7 +220,7 @@ suite
|
|
|
220
220
|
|
|
221
221
|
let tmpData = ['a','b','c','d','e'];
|
|
222
222
|
|
|
223
|
-
testFable.Utility.eachLimit(tmpData, 2,
|
|
223
|
+
testFable.defaultServices.Utility.eachLimit(tmpData, 2,
|
|
224
224
|
(pItem, fCallback)=>
|
|
225
225
|
{
|
|
226
226
|
tmpState[pItem] = pItem;
|
package/test/Fable_tests.js
CHANGED
|
@@ -16,8 +16,6 @@ suite
|
|
|
16
16
|
'Fable',
|
|
17
17
|
function()
|
|
18
18
|
{
|
|
19
|
-
var testFable = false;
|
|
20
|
-
|
|
21
19
|
setup
|
|
22
20
|
(
|
|
23
21
|
function()
|
|
@@ -35,7 +33,7 @@ suite
|
|
|
35
33
|
'The class should initialize itself into a happy little object.',
|
|
36
34
|
function()
|
|
37
35
|
{
|
|
38
|
-
testFable = new libFable({LogStreams: false});
|
|
36
|
+
let testFable = new libFable({LogStreams: false});
|
|
39
37
|
// Instantiate the logger
|
|
40
38
|
Expect(testFable).to.be.an('object', 'Fable should initialize as an object directly from the require statement.');
|
|
41
39
|
Expect(testFable).to.have.a.property('log')
|
|
@@ -50,10 +48,10 @@ suite
|
|
|
50
48
|
);
|
|
51
49
|
test
|
|
52
50
|
(
|
|
53
|
-
'The class should initialize itself into a happy little object.',
|
|
51
|
+
'The class should initialize itself into a happy little object with more config.',
|
|
54
52
|
function()
|
|
55
53
|
{
|
|
56
|
-
testFable = libFable.new({Product:'LegacyApplicationNameHere', LogStreams: false});
|
|
54
|
+
let testFable = libFable.new({Product:'LegacyApplicationNameHere', LogStreams: false});
|
|
57
55
|
// Instantiate the logger
|
|
58
56
|
Expect(testFable).to.be.an('object', 'Fable should initialize as an object directly from the require statement.');
|
|
59
57
|
Expect(testFable).to.have.a.property('log')
|
|
@@ -71,7 +69,7 @@ suite
|
|
|
71
69
|
'Logging should happen...',
|
|
72
70
|
function(fDone)
|
|
73
71
|
{
|
|
74
|
-
testFable = new libFable({Product:'LogTest', LogStreams:[{streamtype:'process.stdout'}]});
|
|
72
|
+
let testFable = new libFable({Product:'LogTest', LogStreams:[{streamtype:'process.stdout'}]});
|
|
75
73
|
Expect(testFable).to.have.a.property('log')
|
|
76
74
|
.that.is.a('object');
|
|
77
75
|
testFable.log.info('There should be a visible log entry here...');
|
|
@@ -83,7 +81,7 @@ suite
|
|
|
83
81
|
'Generate a uuid...',
|
|
84
82
|
function(fDone)
|
|
85
83
|
{
|
|
86
|
-
testFable = new libFable({Product:'LogTest', LogStreams:[{streamtype:'process.stdout'}]});
|
|
84
|
+
let testFable = new libFable({Product:'LogTest', LogStreams:[{streamtype:'process.stdout'}]});
|
|
87
85
|
Expect(testFable).to.have.a.property('log')
|
|
88
86
|
.that.is.a('object');
|
|
89
87
|
var tmpUUID = testFable.getUUID();
|
|
@@ -99,14 +97,14 @@ suite
|
|
|
99
97
|
'Change some settings later...',
|
|
100
98
|
function(fDone)
|
|
101
99
|
{
|
|
102
|
-
testFable = new libFable();
|
|
100
|
+
let testFable = new libFable();
|
|
103
101
|
Expect(testFable).to.have.a.property('settings')
|
|
104
102
|
.that.is.a('object');
|
|
105
103
|
Expect(testFable.settings.Product)
|
|
106
104
|
.to.equal('ApplicationNameHere');
|
|
107
105
|
Expect(testFable.settings.ProductVersion)
|
|
108
106
|
.to.equal('0.0.0');
|
|
109
|
-
testFable.
|
|
107
|
+
testFable.defaultServices.SettingsManager.merge({Product:'TestProduct'});
|
|
110
108
|
Expect(testFable.settings.Product)
|
|
111
109
|
.to.equal('TestProduct');
|
|
112
110
|
Expect(testFable.settings.ProductVersion)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const libFableServiceBase = require('../Fable-ServiceManager.js').ServiceProviderBase;
|
|
2
|
-
|
|
3
|
-
const libDataArithmatic = require('data-arithmatic');
|
|
4
|
-
|
|
5
|
-
class FableServiceDataArithmatic extends libFableServiceBase
|
|
6
|
-
{
|
|
7
|
-
constructor(pFable, pOptions, pServiceHash)
|
|
8
|
-
{
|
|
9
|
-
super(pFable, pOptions, pServiceHash);
|
|
10
|
-
|
|
11
|
-
this.serviceType = 'DataArithmatic';
|
|
12
|
-
|
|
13
|
-
this._DataArithmaticLibrary = new libDataArithmatic();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = FableServiceDataArithmatic;
|