fable 3.0.128 → 3.0.129
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 +93 -92
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +93 -92
- 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 +16 -16
- package/source/services/Fable-Service-MetaTemplate/MetaTemplate-WordTree.js +3 -3
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fable",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.129",
|
|
4
4
|
"description": "A service dependency injection, configuration and logging library.",
|
|
5
5
|
"main": "source/Fable.js",
|
|
6
6
|
"scripts": {
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"cookie": "^0.6.0",
|
|
61
61
|
"data-arithmatic": "^1.0.7",
|
|
62
62
|
"dayjs": "^1.11.11",
|
|
63
|
-
"fable-log": "^3.0.
|
|
63
|
+
"fable-log": "^3.0.14",
|
|
64
64
|
"fable-serviceproviderbase": "^3.0.13",
|
|
65
|
-
"fable-settings": "^3.0.
|
|
66
|
-
"fable-uuid": "^3.0.
|
|
67
|
-
"manyfest": "^1.0.
|
|
65
|
+
"fable-settings": "^3.0.10",
|
|
66
|
+
"fable-uuid": "^3.0.7",
|
|
67
|
+
"manyfest": "^1.0.33",
|
|
68
68
|
"simple-get": "^4.0.1"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/source/Fable.js
CHANGED
|
@@ -118,7 +118,7 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
118
118
|
/* Service Manager Methods */
|
|
119
119
|
addServiceType(pServiceType, pServiceClass)
|
|
120
120
|
{
|
|
121
|
-
if (this.servicesMap
|
|
121
|
+
if (pServiceType in this.servicesMap)
|
|
122
122
|
{
|
|
123
123
|
// TODO: Check if any services are running?
|
|
124
124
|
this.log.warn(`Adding a service type [${pServiceType}] that already exists. This will change the default class prototype for this service.`);
|
|
@@ -150,7 +150,7 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
150
150
|
|
|
151
151
|
addServiceTypeIfNotExists(pServiceType, pServiceClass)
|
|
152
152
|
{
|
|
153
|
-
if (!this.servicesMap
|
|
153
|
+
if (!(pServiceType in this.servicesMap))
|
|
154
154
|
{
|
|
155
155
|
return this.addServiceType(pServiceType, pServiceClass);
|
|
156
156
|
}
|
|
@@ -169,7 +169,7 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
169
169
|
|
|
170
170
|
addAndInstantiateServiceTypeIfNotExists(pServiceType, pServiceClass)
|
|
171
171
|
{
|
|
172
|
-
if (!this.servicesMap
|
|
172
|
+
if (!(pServiceType in this.servicesMap))
|
|
173
173
|
{
|
|
174
174
|
return this.instantiateServiceProvider(pServiceType, {}, `${pServiceType}-Default`);
|
|
175
175
|
}
|
|
@@ -194,7 +194,7 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
194
194
|
this.servicesMap[pServiceType][tmpService.Hash] = tmpService;
|
|
195
195
|
|
|
196
196
|
// If this is the first service of this type, make it the default
|
|
197
|
-
if (!this.services
|
|
197
|
+
if (!(pServiceType in this.services))
|
|
198
198
|
{
|
|
199
199
|
this.setDefaultServiceInstantiation(pServiceType, tmpService.Hash)
|
|
200
200
|
}
|
|
@@ -211,7 +211,7 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
211
211
|
this.servicesMap[pServiceType][tmpService.Hash] = tmpService;
|
|
212
212
|
|
|
213
213
|
// If this is the first service of this type, make it the default
|
|
214
|
-
if (!this.services
|
|
214
|
+
if (!(pServiceType in this.services))
|
|
215
215
|
{
|
|
216
216
|
this.setDefaultServiceInstantiation(pServiceType, tmpService.Hash)
|
|
217
217
|
}
|
|
@@ -221,7 +221,7 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
221
221
|
|
|
222
222
|
instantiateServiceProviderIfNotExists(pServiceType, pOptions, pCustomServiceHash)
|
|
223
223
|
{
|
|
224
|
-
if (this.services
|
|
224
|
+
if (pServiceType in this.services)
|
|
225
225
|
{
|
|
226
226
|
return this.services[pServiceType];
|
|
227
227
|
}
|
|
@@ -253,7 +253,7 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
253
253
|
pServiceInstance.connectFable(this);
|
|
254
254
|
|
|
255
255
|
// Add the service type to the map if it isn't there yet
|
|
256
|
-
if (!this.servicesMap
|
|
256
|
+
if (!(tmpServiceType in this.servicesMap))
|
|
257
257
|
{
|
|
258
258
|
// If the core service hasn't registered itself yet, create the service container for it.
|
|
259
259
|
// This means you couldn't register another with this type unless it was later registered with a constructor class.
|
|
@@ -263,7 +263,7 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
263
263
|
this.servicesMap[tmpServiceType][tmpServiceHash] = pServiceInstance;
|
|
264
264
|
|
|
265
265
|
// If this is the first service of this type, make it the default
|
|
266
|
-
if (!this.services
|
|
266
|
+
if (!(tmpServiceType in this.services))
|
|
267
267
|
{
|
|
268
268
|
this.setDefaultServiceInstantiation(tmpServiceType, tmpServiceHash, false);
|
|
269
269
|
}
|
|
@@ -276,13 +276,13 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
276
276
|
// Overwrite services by default, unless told not to
|
|
277
277
|
let tmpOverwriteService = (typeof(pOverwriteService) === 'undefined') ? true : pOverwriteService;
|
|
278
278
|
// Make sure the service exists
|
|
279
|
-
if (this.servicesMap[pServiceType]
|
|
279
|
+
if (pServiceHash in this.servicesMap[pServiceType])
|
|
280
280
|
{
|
|
281
|
-
if (!
|
|
281
|
+
if (!(pServiceType in this) || tmpOverwriteService)
|
|
282
282
|
{
|
|
283
283
|
this[pServiceType] = this.servicesMap[pServiceType][pServiceHash];
|
|
284
284
|
}
|
|
285
|
-
if (!this.services
|
|
285
|
+
if (!(pServiceType in this.services) || tmpOverwriteService)
|
|
286
286
|
{
|
|
287
287
|
this.services[pServiceType] = this.servicesMap[pServiceType][pServiceHash];
|
|
288
288
|
}
|
|
@@ -518,13 +518,13 @@ class DataFormat extends libFableServiceProviderBase
|
|
|
518
518
|
tmpSegmentCount++;
|
|
519
519
|
}
|
|
520
520
|
// IF This is the start of an enclosure
|
|
521
|
-
else if (
|
|
521
|
+
else if (tmpString[i] in tmpEnclosureStartSymbolMap)
|
|
522
522
|
{
|
|
523
523
|
// Add it to the stack!
|
|
524
524
|
tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
|
|
525
525
|
}
|
|
526
526
|
// IF This is the end of an enclosure
|
|
527
|
-
else if (
|
|
527
|
+
else if ((tmpString[i] in tmpEnclosureEndSymbolMap)
|
|
528
528
|
// AND it matches the current nest level symbol
|
|
529
529
|
&& tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1])
|
|
530
530
|
{
|
|
@@ -576,13 +576,13 @@ class DataFormat extends libFableServiceProviderBase
|
|
|
576
576
|
tmpCurrentSegmentStart = i+1;
|
|
577
577
|
}
|
|
578
578
|
// IF This is the start of an enclosure
|
|
579
|
-
else if (
|
|
579
|
+
else if (tmpString[i] in tmpEnclosureStartSymbolMap)
|
|
580
580
|
{
|
|
581
581
|
// Add it to the stack!
|
|
582
582
|
tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
|
|
583
583
|
}
|
|
584
584
|
// IF This is the end of an enclosure
|
|
585
|
-
else if (
|
|
585
|
+
else if ((tmpString[i] in tmpEnclosureEndSymbolMap)
|
|
586
586
|
// AND it matches the current nest level symbol
|
|
587
587
|
&& tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1])
|
|
588
588
|
{
|
|
@@ -635,13 +635,13 @@ class DataFormat extends libFableServiceProviderBase
|
|
|
635
635
|
return tmpString.substring(0, i);
|
|
636
636
|
}
|
|
637
637
|
// IF This is the start of an enclosure
|
|
638
|
-
else if (
|
|
638
|
+
else if (tmpString[i] in tmpEnclosureStartSymbolMap)
|
|
639
639
|
{
|
|
640
640
|
// Add it to the stack!
|
|
641
641
|
tmpEnclosureStack.push(tmpEnclosureStartSymbolMap[tmpString[i]]);
|
|
642
642
|
}
|
|
643
643
|
// IF This is the end of an enclosure
|
|
644
|
-
else if (
|
|
644
|
+
else if ((tmpString[i] in tmpEnclosureEndSymbolMap)
|
|
645
645
|
// AND it matches the current nest level symbol
|
|
646
646
|
&& tmpEnclosureEndSymbolMap[tmpString[i]] == tmpEnclosureStack[tmpEnclosureStack.length - 1])
|
|
647
647
|
{
|
package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Base.js
CHANGED
|
@@ -20,7 +20,7 @@ class ExpressionParserOperationBase extends libFableServiceProviderBase
|
|
|
20
20
|
|
|
21
21
|
getTokenType(pToken)
|
|
22
22
|
{
|
|
23
|
-
if (this.ExpressionParser.tokenMap
|
|
23
|
+
if (pToken in this.ExpressionParser.tokenMap)
|
|
24
24
|
{
|
|
25
25
|
return `Token.${this.ExpressionParser.tokenMap[pToken].Type}`;
|
|
26
26
|
}
|
|
@@ -47,7 +47,7 @@ class ExpressionParserOperationBase extends libFableServiceProviderBase
|
|
|
47
47
|
{
|
|
48
48
|
Token: pToken,
|
|
49
49
|
Type: (typeof(pTokenType) === 'undefined') ? this.getTokenType(pToken) : pTokenType,
|
|
50
|
-
Descriptor: this.ExpressionParser.tokenMap
|
|
50
|
+
Descriptor: (pToken in this.ExpressionParser.tokenMap) ? this.ExpressionParser.tokenMap[pToken] : false
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -100,7 +100,7 @@ class ExpressionTokenizer extends libExpressionParserOperationBase
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// [ TOKENS ]
|
|
103
|
-
if (this.ExpressionParser.tokenMap
|
|
103
|
+
if (tmpCharacter in this.ExpressionParser.tokenMap)
|
|
104
104
|
{
|
|
105
105
|
if (tmpCurrentToken.length > 0)
|
|
106
106
|
{
|
package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Linter.js
CHANGED
|
@@ -153,11 +153,11 @@ class ExpressionParserLinter extends libExpressionParserOperationBase
|
|
|
153
153
|
let tmpTokenPrevious = false;
|
|
154
154
|
for (let i = 0; i < pTokenizedExpression.length - 1; i++)
|
|
155
155
|
{
|
|
156
|
-
if ((this.ExpressionParser.tokenMap
|
|
156
|
+
if ((pTokenizedExpression[i] in this.ExpressionParser.tokenMap) && (this.ExpressionParser.tokenMap[pTokenizedExpression[i]].Type != 'Parenthesis') && !tmpTokenPrevious)
|
|
157
157
|
{
|
|
158
158
|
tmpTokenPrevious = true;
|
|
159
159
|
}
|
|
160
|
-
else if (this.ExpressionParser.tokenMap
|
|
160
|
+
else if ((pTokenizedExpression[i] in this.ExpressionParser.tokenMap) && (this.ExpressionParser.tokenMap[pTokenizedExpression[i]].Type != 'Parenthesis'))
|
|
161
161
|
{
|
|
162
162
|
// If this isn't a + or - positivity/negativity multiplier, it's an error.
|
|
163
163
|
if ((pTokenizedExpression[i] !== '+') && (pTokenizedExpression[i] !== '-'))
|
package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-Postfix.js
CHANGED
|
@@ -64,7 +64,7 @@ class ExpressionParserPostfix extends libExpressionParserOperationBase
|
|
|
64
64
|
{
|
|
65
65
|
if ((tmpDepthSolveList[i].Type === 'Token.Operator') && (!tmpDepthSolveList[i].Parsed) &&
|
|
66
66
|
// When walking backward, we only want to mutate if the .
|
|
67
|
-
tmpDepthSolveList[i]
|
|
67
|
+
('Descriptor' in tmpDepthSolveList[i]) && ('Descriptor' in tmpOperation.Operation) &&
|
|
68
68
|
// Anything >3 does not have commutative properties
|
|
69
69
|
(tmpDepthSolveList[i].Descriptor.Precedence > 3))
|
|
70
70
|
{
|
|
@@ -94,7 +94,7 @@ class ExpressionParserPostfix extends libExpressionParserOperationBase
|
|
|
94
94
|
{
|
|
95
95
|
if ((tmpDepthSolveList[i].Type === 'Token.Operator') && (!tmpDepthSolveList[i].Parsed) &&
|
|
96
96
|
// When walking forward, we only want to mutate if the precedence hasn't been solved.
|
|
97
|
-
tmpDepthSolveList[i]
|
|
97
|
+
('Descriptor' in tmpDepthSolveList[i]) && ('Descriptor' in tmpOperation.Operation) &&
|
|
98
98
|
// Anything >3 does not have commutative properties
|
|
99
99
|
(tmpDepthSolveList[i].Descriptor.Precedence > 3))
|
|
100
100
|
{
|
|
@@ -273,7 +273,7 @@ class ExpressionParserPostfix extends libExpressionParserOperationBase
|
|
|
273
273
|
let tmpSolveLayerMaxDepth = 0;
|
|
274
274
|
for (let i = 0; i < tmpResults.PostfixTokenObjects.length; i++)
|
|
275
275
|
{
|
|
276
|
-
if (!
|
|
276
|
+
if (!(tmpResults.PostfixTokenObjects[i].SolveLayerStack in tmpSolveLayerMap))
|
|
277
277
|
{
|
|
278
278
|
tmpSolveLayerMap[tmpResults.PostfixTokenObjects[i].SolveLayerStack] = [];
|
|
279
279
|
}
|
|
@@ -504,7 +504,7 @@ class ExpressionParserPostfix extends libExpressionParserOperationBase
|
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
// The next token is an operator and it isn't a function
|
|
507
|
-
else if (tmpPeekedNextToken.Type == 'Token.Operator' &&
|
|
507
|
+
else if (tmpPeekedNextToken.Type == 'Token.Operator' && ('PreviousPrecedence' in tmpOpenParenthesis))
|
|
508
508
|
{
|
|
509
509
|
// This is the second most complex case -- the next token is an operator.
|
|
510
510
|
// If the operater is at the same precedence or higher than the open parenthesis previous operator, use the previous operator's identifier
|
|
@@ -18,7 +18,7 @@ class ExpressionParserSolver extends libExpressionParserOperationBase
|
|
|
18
18
|
let tmpDataDestinationObject = (typeof(pDataDestinationObject) === 'object') ? pDataDestinationObject : {};
|
|
19
19
|
|
|
20
20
|
// If there was a fable passed in (e.g. the results object was a service or such), we won't decorate
|
|
21
|
-
let tmpPassedInFable =
|
|
21
|
+
let tmpPassedInFable = ('fable' in tmpResults);
|
|
22
22
|
if (!tmpPassedInFable)
|
|
23
23
|
{
|
|
24
24
|
tmpResults.fable = this.fable;
|
|
@@ -73,11 +73,11 @@ class ExpressionParserSolver extends libExpressionParserOperationBase
|
|
|
73
73
|
// TODO: This can be optimized. A lot. If necessary. Seems pretty fast honestly for even thousands of operations. Slowest part is arbitrary precision.
|
|
74
74
|
// An operator always has a left and right value.
|
|
75
75
|
let tmpFunctionAddress = false;
|
|
76
|
-
if (
|
|
76
|
+
if (tmpStepResultObject.ExpressionStep.Operation.Token in this.ExpressionParser.tokenMap)
|
|
77
77
|
{
|
|
78
78
|
tmpFunctionAddress = `ResultsObject.${tmpStepResultObject.ExpressionStep.Operation.Descriptor.Function}`;
|
|
79
79
|
}
|
|
80
|
-
else if (
|
|
80
|
+
else if (tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase() in this.ExpressionParser.functionMap)
|
|
81
81
|
{
|
|
82
82
|
tmpFunctionAddress = `ResultsObject.${this.ExpressionParser.functionMap[tmpStepResultObject.ExpressionStep.Operation.Token.toLowerCase()].Address}`;
|
|
83
83
|
}
|
|
@@ -13,7 +13,7 @@ class FableServiceFilePersistence extends libFableServiceBase
|
|
|
13
13
|
|
|
14
14
|
this.serviceType = 'FilePersistence';
|
|
15
15
|
|
|
16
|
-
if (!
|
|
16
|
+
if (!('Mode' in this.options))
|
|
17
17
|
{
|
|
18
18
|
this.options.Mode = parseInt('0777', 8) & ~process.umask();
|
|
19
19
|
}
|
|
@@ -152,7 +152,7 @@ class FableServiceFilePersistence extends libFableServiceBase
|
|
|
152
152
|
return false;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
if (!
|
|
155
|
+
if (!('Mode' in tmpParameters))
|
|
156
156
|
{
|
|
157
157
|
tmpParameters.Mode = this.options.Mode;
|
|
158
158
|
}
|
|
@@ -91,21 +91,21 @@ class StringParser
|
|
|
91
91
|
if (pParserState.PatternMatch)
|
|
92
92
|
{
|
|
93
93
|
// If the pattern is still matching the start and we haven't passed the buffer
|
|
94
|
-
if (!pParserState.StartPatternMatchComplete && pParserState.Pattern
|
|
94
|
+
if (!pParserState.StartPatternMatchComplete && (pCharacter in pParserState.Pattern))
|
|
95
95
|
{
|
|
96
96
|
pParserState.Pattern = pParserState.Pattern[pCharacter];
|
|
97
97
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
98
98
|
}
|
|
99
99
|
else if (pParserState.EndPatternMatchBegan)
|
|
100
100
|
{
|
|
101
|
-
if (pParserState.Pattern.PatternEnd
|
|
101
|
+
if (pCharacter in pParserState.Pattern.PatternEnd)
|
|
102
102
|
{
|
|
103
103
|
// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
104
104
|
pParserState.Pattern = pParserState.Pattern.PatternEnd[pCharacter];
|
|
105
105
|
// Flush the output buffer.
|
|
106
106
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
107
107
|
// If this last character is the end of the pattern, parse it.
|
|
108
|
-
if (
|
|
108
|
+
if (('Parse' in pParserState.Pattern) && (!pParserState.Pattern.isAsync || pParserState.Pattern.isBoth))
|
|
109
109
|
{
|
|
110
110
|
// Run the function
|
|
111
111
|
pParserState.OutputBuffer = pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length, pParserState.OutputBuffer.length - (pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)), pData, pDataContext);
|
|
@@ -117,7 +117,7 @@ class StringParser
|
|
|
117
117
|
return this.resetOutputBuffer(pParserState);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
else if (pParserState.PatternStartNode.PatternEnd
|
|
120
|
+
else if (pCharacter in pParserState.PatternStartNode.PatternEnd)
|
|
121
121
|
{
|
|
122
122
|
// We broke out of the end -- see if this is a new start of the end.
|
|
123
123
|
pParserState.Pattern = pParserState.PatternStartNode.PatternEnd[pCharacter];
|
|
@@ -129,7 +129,7 @@ class StringParser
|
|
|
129
129
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
else if (pParserState.Pattern
|
|
132
|
+
else if ('PatternEnd' in pParserState.Pattern)
|
|
133
133
|
{
|
|
134
134
|
if (!pParserState.StartPatternMatchComplete)
|
|
135
135
|
{
|
|
@@ -139,14 +139,14 @@ class StringParser
|
|
|
139
139
|
|
|
140
140
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
141
141
|
|
|
142
|
-
if (pParserState.Pattern.PatternEnd
|
|
142
|
+
if (pCharacter in pParserState.Pattern.PatternEnd)
|
|
143
143
|
{
|
|
144
144
|
// This is the first character of the end pattern.
|
|
145
145
|
pParserState.EndPatternMatchBegan = true;
|
|
146
146
|
// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
147
147
|
pParserState.Pattern = pParserState.Pattern.PatternEnd[pCharacter];
|
|
148
148
|
// If this last character is the end of the pattern, parse it.
|
|
149
|
-
if (pParserState.Pattern
|
|
149
|
+
if ('Parse' in pParserState.Pattern)
|
|
150
150
|
{
|
|
151
151
|
if (pParserState.Pattern.isAsync && !pParserState.Pattern.isBoth)
|
|
152
152
|
{
|
|
@@ -172,7 +172,7 @@ class StringParser
|
|
|
172
172
|
if (!pParserState.PatternMatch)
|
|
173
173
|
{
|
|
174
174
|
// This may be the start of a new pattern....
|
|
175
|
-
if (pParserState.ParseTree
|
|
175
|
+
if (pCharacter in pParserState.ParseTree)
|
|
176
176
|
{
|
|
177
177
|
// ... assign the root node as the matched node.
|
|
178
178
|
this.resetOutputBuffer(pParserState);
|
|
@@ -251,26 +251,26 @@ class StringParser
|
|
|
251
251
|
if (pParserState.PatternMatch)
|
|
252
252
|
{
|
|
253
253
|
// If the pattern is still matching the start and we haven't passed the buffer
|
|
254
|
-
if (!pParserState.StartPatternMatchComplete && pParserState.Pattern
|
|
254
|
+
if (!pParserState.StartPatternMatchComplete && (pCharacter in pParserState.Pattern))
|
|
255
255
|
{
|
|
256
256
|
pParserState.Pattern = pParserState.Pattern[pCharacter];
|
|
257
257
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
258
258
|
}
|
|
259
259
|
else if (pParserState.EndPatternMatchBegan)
|
|
260
260
|
{
|
|
261
|
-
if (pParserState.Pattern.PatternEnd
|
|
261
|
+
if (pCharacter in pParserState.Pattern.PatternEnd)
|
|
262
262
|
{
|
|
263
263
|
// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
264
264
|
pParserState.Pattern = pParserState.Pattern.PatternEnd[pCharacter];
|
|
265
265
|
// Flush the output buffer.
|
|
266
266
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
267
267
|
// If this last character is the end of the pattern, parse it.
|
|
268
|
-
if (pParserState.Pattern
|
|
268
|
+
if ('Parse' in pParserState.Pattern)
|
|
269
269
|
{
|
|
270
270
|
return this.executePatternAsync(pParserState, pData, fCallback, pDataContext);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
else if (pParserState.PatternStartNode.PatternEnd
|
|
273
|
+
else if (pCharacter in pParserState.PatternStartNode.PatternEnd)
|
|
274
274
|
{
|
|
275
275
|
// We broke out of the end -- see if this is a new start of the end.
|
|
276
276
|
pParserState.Pattern = pParserState.PatternStartNode.PatternEnd[pCharacter];
|
|
@@ -282,7 +282,7 @@ class StringParser
|
|
|
282
282
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
else if (pParserState.Pattern
|
|
285
|
+
else if ('PatternEnd' in pParserState.Pattern)
|
|
286
286
|
{
|
|
287
287
|
if (!pParserState.StartPatternMatchComplete)
|
|
288
288
|
{
|
|
@@ -292,14 +292,14 @@ class StringParser
|
|
|
292
292
|
|
|
293
293
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
294
294
|
|
|
295
|
-
if (pParserState.Pattern.PatternEnd
|
|
295
|
+
if (pCharacter in pParserState.Pattern.PatternEnd)
|
|
296
296
|
{
|
|
297
297
|
// This is the first character of the end pattern.
|
|
298
298
|
pParserState.EndPatternMatchBegan = true;
|
|
299
299
|
// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
300
300
|
pParserState.Pattern = pParserState.Pattern.PatternEnd[pCharacter];
|
|
301
301
|
// If this last character is the end of the pattern, parse it.
|
|
302
|
-
if (pParserState.Pattern
|
|
302
|
+
if ('Parse' in pParserState.Pattern)
|
|
303
303
|
{
|
|
304
304
|
return this.executePatternAsync(pParserState, pData, fCallback, pDataContext);
|
|
305
305
|
}
|
|
@@ -315,7 +315,7 @@ class StringParser
|
|
|
315
315
|
else
|
|
316
316
|
{
|
|
317
317
|
// This may be the start of a new pattern....
|
|
318
|
-
if (pParserState.ParseTree
|
|
318
|
+
if (pCharacter in pParserState.ParseTree)
|
|
319
319
|
{
|
|
320
320
|
// ... assign the root node as the matched node.
|
|
321
321
|
this.resetOutputBuffer(pParserState);
|
|
@@ -24,7 +24,7 @@ class WordTree
|
|
|
24
24
|
*/
|
|
25
25
|
addChild (pTree, pPattern)
|
|
26
26
|
{
|
|
27
|
-
if (!
|
|
27
|
+
if (!(pPattern in pTree))
|
|
28
28
|
{
|
|
29
29
|
pTree[pPattern] = {};
|
|
30
30
|
}
|
|
@@ -42,7 +42,7 @@ class WordTree
|
|
|
42
42
|
*/
|
|
43
43
|
addEndChild (pTree, pPattern)
|
|
44
44
|
{
|
|
45
|
-
if (!
|
|
45
|
+
if (!('PatternEnd' in pTree))
|
|
46
46
|
{
|
|
47
47
|
pTree.PatternEnd = {};
|
|
48
48
|
}
|
|
@@ -79,7 +79,7 @@ class WordTree
|
|
|
79
79
|
tmpLeaf = this.addChild(tmpLeaf, pPatternStart[i], i);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
if (!
|
|
82
|
+
if (!('PatternEnd' in tmpLeaf))
|
|
83
83
|
{
|
|
84
84
|
tmpLeaf.PatternEnd = {};
|
|
85
85
|
}
|
|
@@ -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
|
}
|