fable 3.0.116 → 3.0.118
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/debug/Example-ProgressTime.js +89 -0
- package/debug/Harness.js +14 -60
- package/dist/fable.compatible.js +185 -178
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +131 -124
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
- package/source/services/Fable-Service-Operation-DefaultSettings.js +16 -21
- package/source/services/Fable-Service-Operation.js +82 -61
- package/source/services/Fable-Service-ProgressTime.js +5 -0
- package/source/services/Fable-Service-ProgressTracker.js +129 -15
- package/test/FableOperation_tests.js +61 -11
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//let libBookstore = require('../retold-harness/bookstore-serve-meadow-endpoint-apis-run.js');
|
|
2
|
+
const libFable = require('../source/Fable.js');
|
|
3
|
+
|
|
4
|
+
let testFable = new libFable({"Product": "ProgressTrackerExample"});
|
|
5
|
+
|
|
6
|
+
let tmpProgressTracker = testFable.instantiateServiceProvider('ProgressTracker');
|
|
7
|
+
|
|
8
|
+
// 10000 takes about a minute on the beefy box
|
|
9
|
+
tmpProgressTracker.createProgressTracker('TestTracker', 50051);
|
|
10
|
+
tmpProgressTracker.logProgressTrackerStatus('TestTracker');
|
|
11
|
+
|
|
12
|
+
let tmpAnticipate = testFable.newAnticipate();
|
|
13
|
+
|
|
14
|
+
tmpAnticipate.anticipate(
|
|
15
|
+
function (fDone)
|
|
16
|
+
{
|
|
17
|
+
let tmpWaitTime = Math.floor(Math.random() * 150) + 150;
|
|
18
|
+
//this.log.trace(`Starting tracker in ${tmpWaitTime}ms...`);
|
|
19
|
+
setTimeout(
|
|
20
|
+
() =>
|
|
21
|
+
{
|
|
22
|
+
this.ProgressTracker.startProgressTracker('TestTracker');
|
|
23
|
+
this.ProgressTracker.logProgressTrackerStatus('TestTracker');
|
|
24
|
+
return fDone();
|
|
25
|
+
}, tmpWaitTime);
|
|
26
|
+
}.bind(testFable));
|
|
27
|
+
|
|
28
|
+
tmpAnticipate.anticipate(
|
|
29
|
+
function (fDone)
|
|
30
|
+
{
|
|
31
|
+
let tmpWaitTime = Math.floor(Math.random() * 150) + 150;
|
|
32
|
+
//this.log.trace(`Showing info for tracker in ${tmpWaitTime}ms...`);
|
|
33
|
+
|
|
34
|
+
setTimeout(
|
|
35
|
+
() =>
|
|
36
|
+
{
|
|
37
|
+
this.ProgressTracker.logProgressTrackerStatus('TestTracker');
|
|
38
|
+
return fDone();
|
|
39
|
+
}, tmpWaitTime);
|
|
40
|
+
}.bind(testFable));
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
for (let i = 0; i < 11000; i++)
|
|
44
|
+
{
|
|
45
|
+
tmpAnticipate.anticipate(
|
|
46
|
+
function (fDone)
|
|
47
|
+
{
|
|
48
|
+
let tmpTracker = this.ProgressTracker.getProgressTracker('TestTracker');
|
|
49
|
+
|
|
50
|
+
if (tmpTracker.PercentComplete >= 100)
|
|
51
|
+
{
|
|
52
|
+
return fDone();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let tmpWaitTime = Math.floor(Math.random() * 150) + 150;
|
|
56
|
+
let tmpIncrementAmount = Math.floor(Math.random() * 50) + 50;
|
|
57
|
+
//this.log.trace(`Incrementing tracker by ${tmpIncrementAmount} in ${tmpWaitTime}ms...`);
|
|
58
|
+
|
|
59
|
+
setTimeout(
|
|
60
|
+
() =>
|
|
61
|
+
{
|
|
62
|
+
if (tmpTracker.PercentComplete < 100)
|
|
63
|
+
{
|
|
64
|
+
this.ProgressTracker.incrementProgressTracker('TestTracker', tmpIncrementAmount);
|
|
65
|
+
this.ProgressTracker.logProgressTrackerStatus('TestTracker');
|
|
66
|
+
}
|
|
67
|
+
return fDone();
|
|
68
|
+
}, tmpWaitTime);
|
|
69
|
+
}.bind(testFable));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
tmpAnticipate.wait(
|
|
73
|
+
function (pError)
|
|
74
|
+
{
|
|
75
|
+
if (pError)
|
|
76
|
+
{
|
|
77
|
+
testFable.log.error(`Error: ${pError}`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let tmpWaitTime = Math.floor(Math.random() * 150) + 150;
|
|
81
|
+
//this.log.trace(`Ending tracker in ${tmpWaitTime}ms...`);
|
|
82
|
+
|
|
83
|
+
setTimeout(
|
|
84
|
+
() =>
|
|
85
|
+
{
|
|
86
|
+
this.ProgressTracker.endProgressTracker('TestTracker');
|
|
87
|
+
this.ProgressTracker.logProgressTrackerStatus('TestTracker');
|
|
88
|
+
}, tmpWaitTime);
|
|
89
|
+
}.bind(testFable));
|
package/debug/Harness.js
CHANGED
|
@@ -1,70 +1,24 @@
|
|
|
1
|
-
//let libBookstore = require('../retold-harness/bookstore-serve-meadow-endpoint-apis-run.js');
|
|
2
|
-
const libFable = require('../source/Fable.js');
|
|
3
1
|
|
|
4
|
-
class SimpleService extends libFable.ServiceProviderBase
|
|
5
|
-
{
|
|
6
|
-
constructor(pFable, pOptions, pServiceHash)
|
|
7
|
-
{
|
|
8
|
-
super(pFable, pOptions, pServiceHash);
|
|
9
|
-
|
|
10
|
-
this.serviceType = 'SimpleService';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
doSomething()
|
|
14
|
-
{
|
|
15
|
-
this.fable.log.info(`SimpleService ${this.UUID}::${this.Hash} is doing something.`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let testFable = new libFable({"Product": "FableDebugHarness"});
|
|
20
|
-
|
|
21
|
-
let tmpProgressTracker = testFable.instantiateServiceProvider('ProgressTracker');
|
|
22
2
|
|
|
23
|
-
|
|
3
|
+
testFable.addServiceType('SimpleService', SimpleService);
|
|
24
4
|
|
|
25
|
-
|
|
5
|
+
testFable.instantiateServiceProvider('SimpleService', {SomeOption: true}, 'SimpleService-123');
|
|
26
6
|
|
|
27
|
-
let tmpAnticipate = testFable.newAnticipate();
|
|
28
7
|
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
tmpAnticipate.anticipate(
|
|
32
|
-
function (fDone)
|
|
33
|
-
{
|
|
34
|
-
let tmpTracker = this.ProgressTracker.getProgressTracker('TestTracker');
|
|
8
|
+
testFable.servicesMap['SimpleService']['SimpleService-123'].doSomething();
|
|
35
9
|
|
|
36
|
-
|
|
37
|
-
() =>
|
|
38
|
-
{
|
|
39
|
-
if (tmpTracker.PercentComplete < 100)
|
|
40
|
-
{
|
|
41
|
-
this.ProgressTracker.incrementProgressTracker('TestTracker', Math.floor(Math.random() * 10) + 10);
|
|
42
|
-
this.ProgressTracker.logProgressTrackerStatus('TestTracker');
|
|
43
|
-
}
|
|
44
|
-
return fDone();
|
|
45
|
-
}, Math.floor(Math.random() * 100) + 110);
|
|
46
|
-
}.bind(testFable));
|
|
47
|
-
}
|
|
10
|
+
testFable.SimpleService.doSomething();
|
|
48
11
|
|
|
49
|
-
|
|
12
|
+
console.log(`Initialized Service ${testFable.servicesMap['SimpleService']['SimpleService-123'].serviceType} as UUID ${testFable.servicesMap['SimpleService']['SimpleService-123'].UUID} with hash ${testFable.servicesMap['SimpleService']['SimpleService-123'].Hash}`);
|
|
50
13
|
|
|
51
|
-
|
|
14
|
+
testFable.servicesMap['SimpleService']['SimpleService-123'].doSomething();
|
|
52
15
|
|
|
16
|
+
// Instantiate the RestClient Service Provider
|
|
17
|
+
let tmpRestClient = testFable.instantiateServiceProvider('RestClient', {TraceLog: true}, 'RestClient-99');
|
|
53
18
|
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// testFable.servicesMap['SimpleService']['SimpleService-123'].doSomething();
|
|
61
|
-
|
|
62
|
-
// // Instantiate the RestClient Service Provider
|
|
63
|
-
// let tmpRestClient = testFable.instantiateServiceProvider('RestClient', {TraceLog: true}, 'RestClient-99');
|
|
64
|
-
|
|
65
|
-
// // Download the wiktionary entry for dog!
|
|
66
|
-
// tmpRestClient.getJSON('https://en.wiktionary.org/w/api.php?action=parse&prop=wikitext&format=json&page=dog',
|
|
67
|
-
// (pError, pResponse, pBody)=>
|
|
68
|
-
// {
|
|
69
|
-
// testFable.log.info('Response received~', pBody);
|
|
70
|
-
// });
|
|
19
|
+
// Download the wiktionary entry for dog!
|
|
20
|
+
tmpRestClient.getJSON('https://en.wiktionary.org/w/api.php?action=parse&prop=wikitext&format=json&page=dog',
|
|
21
|
+
(pError, pResponse, pBody)=>
|
|
22
|
+
{
|
|
23
|
+
testFable.log.info('Response received~', pBody);
|
|
24
|
+
});
|