fable 3.0.128 → 3.0.130
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/Harness.js +13 -18
- package/dist/fable.compatible.js +102 -107
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +102 -107
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +5 -5
- package/source/Fable-Browser-Shim.js +1 -1
- package/source/Fable.js +11 -11
- package/source/services/Fable-Service-DataFormat.js +6 -6
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Base.js +2 -2
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ExpressionTokenizer.js +1 -1
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js +2 -2
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js +4 -4
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-SolvePostfixedExpression.js +3 -3
- package/source/services/Fable-Service-FilePersistence.js +2 -2
- package/source/services/Fable-Service-MetaTemplate/MetaTemplate-StringParser.js +101 -39
- package/source/services/Fable-Service-MetaTemplate/MetaTemplate-WordTree.js +14 -8
- package/source/services/Fable-Service-MetaTemplate.js +6 -14
- package/source/services/Fable-Service-Operation.js +1 -1
- package/source/services/Fable-Service-ProgressTime.js +7 -7
- package/source/services/Fable-Service-ProgressTrackerSet.js +11 -11
- package/source/services/Fable-Service-RestClient.js +4 -4
- package/source/services/Fable-Service-Utility.js +1 -1
- package/test/MetaTemplating_tests.js +21 -1
|
@@ -25,27 +25,19 @@ class FableServiceMetaTemplate extends libFableServiceBase
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
* Add a Pattern to the Parse Tree
|
|
30
|
-
* @method addPattern
|
|
31
|
-
* @param {Object} pTree - A node on the parse tree to push the characters into
|
|
32
|
-
* @param {string} pPattern - The string to add to the tree
|
|
33
|
-
* @param {number} pIndex - callback function
|
|
34
|
-
* @return {bool} True if adding the pattern was successful
|
|
35
|
-
*/
|
|
36
|
-
addPattern(pPatternStart, pPatternEnd, pParser)
|
|
28
|
+
addPattern(pPatternStart, pPatternEnd, pParser, pParserContext)
|
|
37
29
|
{
|
|
38
|
-
return this.WordTree.addPattern(pPatternStart, pPatternEnd, pParser);
|
|
30
|
+
return this.WordTree.addPattern(pPatternStart, pPatternEnd, pParser, pParserContext);
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
addPatternAsync(pPatternStart, pPatternEnd, pParserPromise)
|
|
33
|
+
addPatternAsync(pPatternStart, pPatternEnd, pParserPromise, pParserContext)
|
|
42
34
|
{
|
|
43
|
-
return this.WordTree.addPatternAsync(pPatternStart, pPatternEnd, pParserPromise);
|
|
35
|
+
return this.WordTree.addPatternAsync(pPatternStart, pPatternEnd, pParserPromise, pParserContext);
|
|
44
36
|
}
|
|
45
37
|
|
|
46
|
-
addPatternBoth(pPatternStart, pPatternEnd, pParser, pParserPromise)
|
|
38
|
+
addPatternBoth(pPatternStart, pPatternEnd, pParser, pParserPromise, pParserContext)
|
|
47
39
|
{
|
|
48
|
-
return this.WordTree.addPatternBoth(pPatternStart, pPatternEnd, pParser, pParserPromise);
|
|
40
|
+
return this.WordTree.addPatternBoth(pPatternStart, pPatternEnd, pParser, pParserPromise, pParserContext);
|
|
49
41
|
}
|
|
50
42
|
|
|
51
43
|
/**
|
|
@@ -142,7 +142,7 @@ class FableOperation extends libFableServiceBase
|
|
|
142
142
|
|
|
143
143
|
setStepTotalOperations(pGUIDStep, pTotalOperationCount)
|
|
144
144
|
{
|
|
145
|
-
if (!this.stepMap
|
|
145
|
+
if (!(pGUIDStep in this.stepMap))
|
|
146
146
|
{
|
|
147
147
|
return new Error(`Step [${pGUIDStep}] does not exist in operation [${this.state.Metadata.UUID}] ${this.state.Metadata.Name} when attempting to set total operations to ${pTotalOperationCount}.`);
|
|
148
148
|
}
|
|
@@ -51,7 +51,7 @@ class FableServiceProgressTime extends libFableServiceBase
|
|
|
51
51
|
getTimeStampValue(pTimeStampHash)
|
|
52
52
|
{
|
|
53
53
|
let tmpTimeStampHash = (typeof(pTimeStampHash) == 'string') ? pTimeStampHash : 'Default';
|
|
54
|
-
return this.timeStamps
|
|
54
|
+
return (tmpTimeStampHash in this.timeStamps) ? this.timeStamps[tmpTimeStampHash] : -1;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
updateTimeStampValue(pTimeStampHash, pReferenceTime)
|
|
@@ -62,7 +62,7 @@ class FableServiceProgressTime extends libFableServiceBase
|
|
|
62
62
|
// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
|
|
63
63
|
if (typeof(pReferenceTime) == 'string')
|
|
64
64
|
{
|
|
65
|
-
tmpReferenceTime = this.timeStamps
|
|
65
|
+
tmpReferenceTime = (tmpReference in this.timeStamps) ? this.timeStamps[tmpReference] : false;
|
|
66
66
|
}
|
|
67
67
|
else if (typeof(pReferenceTime) == 'number')
|
|
68
68
|
{
|
|
@@ -73,7 +73,7 @@ class FableServiceProgressTime extends libFableServiceBase
|
|
|
73
73
|
tmpReferenceTime = +new Date();
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
if (this.timeStamps
|
|
76
|
+
if ((tmpTimeStampHash in this.timeStamps) && tmpReferenceTime)
|
|
77
77
|
{
|
|
78
78
|
this.timeStamps[tmpTimeStampHash] = tmpReferenceTime;
|
|
79
79
|
return this.timeStamps[tmpTimeStampHash];
|
|
@@ -87,7 +87,7 @@ class FableServiceProgressTime extends libFableServiceBase
|
|
|
87
87
|
removeTimeStamp(pTimeStampHash)
|
|
88
88
|
{
|
|
89
89
|
let tmpTimeStampHash = (typeof(pTimeStampHash) == 'string') ? pTimeStampHash : 'Default';
|
|
90
|
-
if (this.timeStamps
|
|
90
|
+
if (tmpTimeStampHash in this.timeStamps)
|
|
91
91
|
{
|
|
92
92
|
delete this.timeStamps[tmpTimeStampHash];
|
|
93
93
|
return true;
|
|
@@ -106,7 +106,7 @@ class FableServiceProgressTime extends libFableServiceBase
|
|
|
106
106
|
// This function allows the user to pass in either a reference time in ms, or, a hash of a timestamp.
|
|
107
107
|
if (typeof(pReferenceTime) == 'string')
|
|
108
108
|
{
|
|
109
|
-
tmpReferenceTime = this.timeStamps
|
|
109
|
+
tmpReferenceTime = (tmpReference in this.timeStamps) ? this.timeStamps[tmpReference] : false;
|
|
110
110
|
}
|
|
111
111
|
else if (typeof(pReferenceTime) == 'number')
|
|
112
112
|
{
|
|
@@ -117,7 +117,7 @@ class FableServiceProgressTime extends libFableServiceBase
|
|
|
117
117
|
tmpReferenceTime = +new Date();
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
if (this.timeStamps
|
|
120
|
+
if ((tmpTimeStampHash in this.timeStamps) && tmpReferenceTime)
|
|
121
121
|
{
|
|
122
122
|
return tmpReferenceTime-this.timeStamps[tmpTimeStampHash];
|
|
123
123
|
}
|
|
@@ -131,7 +131,7 @@ class FableServiceProgressTime extends libFableServiceBase
|
|
|
131
131
|
{
|
|
132
132
|
let tmpTimeStampHashStart = (typeof(pTimeStampHashStart) == 'string') ? pTimeStampHashStart : 'Default';
|
|
133
133
|
let tmpTimeStampHashEnd = (typeof(pTimeStampHashEnd) == 'string') ? pTimeStampHashEnd : 'Default';
|
|
134
|
-
if (this.timeStamps
|
|
134
|
+
if ((tmpTimeStampHashStart in this.timeStamps) && (tmpTimeStampHashEnd in this.timeStamps))
|
|
135
135
|
{
|
|
136
136
|
return this.timeStamps[tmpTimeStampHashEnd]-this.timeStamps[tmpTimeStampHashStart];
|
|
137
137
|
}
|
|
@@ -23,7 +23,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
23
23
|
{
|
|
24
24
|
let tmpProgressTrackerHash = (typeof(pProgressTrackerHash) == 'string') ? pProgressTrackerHash : 'Default';
|
|
25
25
|
|
|
26
|
-
if (!this.progressTrackers
|
|
26
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
27
27
|
{
|
|
28
28
|
this.fable.log.warn(`ProgressTracker ${tmpProgressTrackerHash} does not exist! Creating a new tracker...`);
|
|
29
29
|
this.createProgressTracker(tmpProgressTrackerHash, 100);
|
|
@@ -36,7 +36,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
36
36
|
{
|
|
37
37
|
let tmpProgressTrackerHash = (typeof(pProgressTrackerHash) == 'string') ? pProgressTrackerHash : 'Default';
|
|
38
38
|
|
|
39
|
-
if (!this.progressTrackers
|
|
39
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
40
40
|
{
|
|
41
41
|
this.fable.log.warn(`ProgressTracker ${tmpProgressTrackerHash} does not exist! Creating a new tracker...`);
|
|
42
42
|
this.createProgressTracker(tmpProgressTrackerHash, 100);
|
|
@@ -73,7 +73,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
73
73
|
CurrentCount:-1
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
if (this.progressTrackers
|
|
76
|
+
if (tmpProgressTrackerHash in this.progressTrackers)
|
|
77
77
|
{
|
|
78
78
|
this.fable.log.warn(`ProgressTracker ${tmpProgressTrackerHash} already exists! Overwriting with a new tracker...`);
|
|
79
79
|
this.progressTimes.removeTimeStamp(tmpProgressTracker.StartTimeHash);
|
|
@@ -90,7 +90,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
90
90
|
let tmpProgressTrackerHash = (typeof(pProgressTrackerHash) == 'string') ? pProgressTrackerHash : 'Default';
|
|
91
91
|
let tmpTotalOperations = (typeof(pTotalOperations) == 'number') ? pTotalOperations : 100;
|
|
92
92
|
|
|
93
|
-
if (!this.progressTrackers
|
|
93
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
94
94
|
{
|
|
95
95
|
this.fable.log.warn(`Attempted to set the total operations of ProgressTracker ${tmpProgressTrackerHash} but it does not exist! Creating a new tracker...`);
|
|
96
96
|
this.createProgressTracker(tmpProgressTrackerHash, tmpTotalOperations);
|
|
@@ -106,7 +106,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
106
106
|
let tmpProgressTrackerHash = (typeof(pProgressTrackerHash) == 'string') ? pProgressTrackerHash : 'Default';
|
|
107
107
|
|
|
108
108
|
// This is the only method to lazily create ProgressTrackers now
|
|
109
|
-
if (!this.progressTrackers
|
|
109
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
110
110
|
{
|
|
111
111
|
this.createProgressTracker(tmpProgressTrackerHash, 100);
|
|
112
112
|
}
|
|
@@ -127,7 +127,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
127
127
|
{
|
|
128
128
|
let tmpProgressTrackerHash = (typeof(pProgressTrackerHash) == 'string') ? pProgressTrackerHash : 'Default';
|
|
129
129
|
|
|
130
|
-
if (!this.progressTrackers
|
|
130
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
131
131
|
{
|
|
132
132
|
this.fable.log.error(`Attempted to end ProgressTracker ${tmpProgressTrackerHash} that does not exist!`);
|
|
133
133
|
return false;
|
|
@@ -145,7 +145,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
145
145
|
{
|
|
146
146
|
let tmpProgressTrackerHash = (typeof(pProgressTrackerHash) == 'string') ? pProgressTrackerHash : 'Default';
|
|
147
147
|
|
|
148
|
-
if (!this.progressTrackers
|
|
148
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
149
149
|
{
|
|
150
150
|
this.fable.log.error(`Attempted to solve ProgressTracker ${tmpProgressTrackerHash} that does not exist!`);
|
|
151
151
|
return false;
|
|
@@ -217,7 +217,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
217
217
|
return false;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
if (!this.progressTrackers
|
|
220
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
221
221
|
{
|
|
222
222
|
this.createProgressTracker(100, tmpProgressTrackerHash);
|
|
223
223
|
}
|
|
@@ -237,7 +237,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
237
237
|
tmpOperationIncrementAmount = 1;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
if (!this.progressTrackers
|
|
240
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
241
241
|
{
|
|
242
242
|
this.fable.log.warn(`Attempted to increment ProgressTracker ${tmpProgressTrackerHash} but it did not exist.`);
|
|
243
243
|
return false;
|
|
@@ -284,7 +284,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
284
284
|
// TODO: Is there a pattern to avoid this double call that's worth putting in?
|
|
285
285
|
this.solveProgressTrackerStatus(tmpProgressTrackerHash);
|
|
286
286
|
|
|
287
|
-
if (!this.progressTrackers
|
|
287
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
288
288
|
{
|
|
289
289
|
return `ProgressTracker ${tmpProgressTrackerHash} does not exist! No stats to display.`;
|
|
290
290
|
}
|
|
@@ -325,7 +325,7 @@ class FableServiceProgressTrackerSet extends libFableServiceBase
|
|
|
325
325
|
// TODO: Is there a pattern to avoid this double call that's worth putting in?
|
|
326
326
|
this.solveProgressTrackerStatus(tmpProgressTrackerHash);
|
|
327
327
|
|
|
328
|
-
if (!this.progressTrackers
|
|
328
|
+
if (!(tmpProgressTrackerHash in this.progressTrackers))
|
|
329
329
|
{
|
|
330
330
|
return `ProgressTracker ${tmpProgressTrackerHash} does not exist! No stats to display.`;
|
|
331
331
|
}
|
|
@@ -36,7 +36,7 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
36
36
|
if (this.cookie)
|
|
37
37
|
{
|
|
38
38
|
let tmpCookieObject = this.cookie;
|
|
39
|
-
if (!
|
|
39
|
+
if (!('headers' in pRequestOptions))
|
|
40
40
|
{
|
|
41
41
|
pRequestOptions.headers = {};
|
|
42
42
|
}
|
|
@@ -56,7 +56,7 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
56
56
|
let tmpOptions = this.prepareCookies(pOptions);
|
|
57
57
|
|
|
58
58
|
// Prepend a string to the URL if it exists in the Fable Config
|
|
59
|
-
if (this.fable.settings
|
|
59
|
+
if ('RestClientURLPrefix' in this.fable.settings)
|
|
60
60
|
{
|
|
61
61
|
tmpOptions.url = this.fable.settings.RestClientURLPrefix + tmpOptions.url;
|
|
62
62
|
}
|
|
@@ -181,12 +181,12 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
181
181
|
|
|
182
182
|
let tmpOptions = this.preRequest(pOptions);
|
|
183
183
|
|
|
184
|
-
if (!
|
|
184
|
+
if (!('headers' in tmpOptions))
|
|
185
185
|
{
|
|
186
186
|
tmpOptions.headers = {};
|
|
187
187
|
}
|
|
188
188
|
/* Automated headers break some APIs
|
|
189
|
-
if (!
|
|
189
|
+
if (!('Content-Type' in tmpOptions.headers))
|
|
190
190
|
{
|
|
191
191
|
tmpOptions.headers['Content-Type'] = 'application/json';
|
|
192
192
|
}
|
|
@@ -105,7 +105,7 @@ class FableServiceUtility extends libFableServiceBase
|
|
|
105
105
|
// with ultra limited JS capabilities where those don't work.
|
|
106
106
|
isoStringToDate (pISOString)
|
|
107
107
|
{
|
|
108
|
-
if (!
|
|
108
|
+
if (!('Dates' in this.fable))
|
|
109
109
|
{
|
|
110
110
|
this.fable.instantiateServiceProvider('Dates');
|
|
111
111
|
}
|
|
@@ -21,7 +21,6 @@ const loadMetaTemplateModule = () =>
|
|
|
21
21
|
const configMetaTemplate = (pModule) =>
|
|
22
22
|
{
|
|
23
23
|
|
|
24
|
-
|
|
25
24
|
pModule.addPattern('<%', '%>', 'JUNKED_THIS_DATA');
|
|
26
25
|
// This one gets the count of the inner string...
|
|
27
26
|
pModule.addPattern('<%#', '%>', (pData)=>{return pData.length});
|
|
@@ -150,6 +149,27 @@ suite
|
|
|
150
149
|
}
|
|
151
150
|
);
|
|
152
151
|
test
|
|
152
|
+
(
|
|
153
|
+
'Custom this',
|
|
154
|
+
(fDone) =>
|
|
155
|
+
{
|
|
156
|
+
let tmpTestString = 'The [^objective^] pData up in here and a $comment$ as well.';
|
|
157
|
+
let tmpExpectedResult = 'The This objective is like {\"BigData\":\"is here\"} pData up in here and a comment as well.';
|
|
158
|
+
let testMetaTemplate = loadMetaTemplateModule();
|
|
159
|
+
configMetaTemplate(testMetaTemplate);
|
|
160
|
+
|
|
161
|
+
testMetaTemplate.addPattern('[^', '^]',
|
|
162
|
+
function (pData)
|
|
163
|
+
{
|
|
164
|
+
return `This ${pData} is like ${JSON.stringify(this)}`;
|
|
165
|
+
}, {BigData:'is here'});
|
|
166
|
+
|
|
167
|
+
let tmpResult = testMetaTemplate.parseString(tmpTestString, 'where my big data at');
|
|
168
|
+
Expect(tmpResult).to.equal(tmpExpectedResult);
|
|
169
|
+
fDone();
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
test
|
|
153
173
|
(
|
|
154
174
|
'Leveraging pData a using subobjects...',
|
|
155
175
|
(fDone) =>
|