fable 3.0.21 → 3.0.23
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/dist/fable.compatible.js +97 -42
- package/dist/fable.compatible.min.js +13 -13
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +64 -20
- package/dist/fable.min.js +6 -6
- package/dist/fable.min.js.map +1 -1
- package/package.json +3 -2
- package/source/Fable-Service-MetaTemplate.js +41 -0
- package/source/Fable.js +4 -0
- package/test/FableMetaTemplating_tests.js +96 -0
- package/test/FableOperations_tests.js +0 -1
- package/test/FableUtility_tests.js +0 -1
package/dist/fable.js
CHANGED
|
@@ -2011,10 +2011,11 @@
|
|
|
2011
2011
|
* Parse a string with the existing parse tree
|
|
2012
2012
|
* @method parseString
|
|
2013
2013
|
* @param {string} pString - The string to parse
|
|
2014
|
+
* @param {object} pData - Data to pass in as the second argument
|
|
2014
2015
|
* @return {string} The result from the parser
|
|
2015
2016
|
*/
|
|
2016
|
-
parseString(pString) {
|
|
2017
|
-
return this.StringParser.parseString(pString, this.ParseTree);
|
|
2017
|
+
parseString(pString, pData) {
|
|
2018
|
+
return this.StringParser.parseString(pString, this.ParseTree, pData);
|
|
2018
2019
|
}
|
|
2019
2020
|
}
|
|
2020
2021
|
module.exports = Precedent;
|
|
@@ -2104,11 +2105,11 @@
|
|
|
2104
2105
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
2105
2106
|
* @private
|
|
2106
2107
|
*/
|
|
2107
|
-
checkPatternEnd(pParserState) {
|
|
2108
|
+
checkPatternEnd(pParserState, pData) {
|
|
2108
2109
|
if (pParserState.OutputBuffer.length >= pParserState.Pattern.PatternEnd.length + pParserState.Pattern.PatternStart.length && pParserState.OutputBuffer.substr(-pParserState.Pattern.PatternEnd.length) === pParserState.Pattern.PatternEnd) {
|
|
2109
2110
|
// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
2110
2111
|
// Trim the start and end tags off the output buffer now
|
|
2111
|
-
pParserState.OutputBuffer = pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStart.length, pParserState.OutputBuffer.length - (pParserState.Pattern.PatternStart.length + pParserState.Pattern.PatternEnd.length)));
|
|
2112
|
+
pParserState.OutputBuffer = pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStart.length, pParserState.OutputBuffer.length - (pParserState.Pattern.PatternStart.length + pParserState.Pattern.PatternEnd.length)), pData);
|
|
2112
2113
|
// Flush the output buffer.
|
|
2113
2114
|
this.flushOutputBuffer(pParserState);
|
|
2114
2115
|
// End pattern mode
|
|
@@ -2124,7 +2125,7 @@
|
|
|
2124
2125
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
2125
2126
|
* @private
|
|
2126
2127
|
*/
|
|
2127
|
-
parseCharacter(pCharacter, pParserState) {
|
|
2128
|
+
parseCharacter(pCharacter, pParserState, pData) {
|
|
2128
2129
|
// (1) If we aren't in a pattern match, and we aren't potentially matching, and this may be the start of a new pattern....
|
|
2129
2130
|
if (!pParserState.PatternMatch && pParserState.ParseTree.hasOwnProperty(pCharacter)) {
|
|
2130
2131
|
// ... assign the node as the matched node.
|
|
@@ -2141,7 +2142,7 @@
|
|
|
2141
2142
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
2142
2143
|
if (pParserState.Pattern) {
|
|
2143
2144
|
// ... Check if this is the end of the pattern (if we are matching a valid pattern)...
|
|
2144
|
-
this.checkPatternEnd(pParserState);
|
|
2145
|
+
this.checkPatternEnd(pParserState, pData);
|
|
2145
2146
|
}
|
|
2146
2147
|
}
|
|
2147
2148
|
// (3) If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
|
|
@@ -2155,12 +2156,13 @@
|
|
|
2155
2156
|
* @method parseString
|
|
2156
2157
|
* @param {string} pString - The string to parse.
|
|
2157
2158
|
* @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
|
|
2159
|
+
* @param {Object} pData - The data to pass to the function as a second paramter
|
|
2158
2160
|
*/
|
|
2159
|
-
parseString(pString, pParseTree) {
|
|
2161
|
+
parseString(pString, pParseTree, pData) {
|
|
2160
2162
|
let tmpParserState = this.newParserState(pParseTree);
|
|
2161
2163
|
for (var i = 0; i < pString.length; i++) {
|
|
2162
2164
|
// TODO: This is not fast.
|
|
2163
|
-
this.parseCharacter(pString[i], tmpParserState);
|
|
2165
|
+
this.parseCharacter(pString[i], tmpParserState, pData);
|
|
2164
2166
|
}
|
|
2165
2167
|
this.flushOutputBuffer(tmpParserState);
|
|
2166
2168
|
return tmpParserState.Output;
|
|
@@ -2488,7 +2490,7 @@
|
|
|
2488
2490
|
}
|
|
2489
2491
|
module.exports = libNPMModuleWrapper;
|
|
2490
2492
|
}, {
|
|
2491
|
-
"./Fable.js":
|
|
2493
|
+
"./Fable.js": 43
|
|
2492
2494
|
}],
|
|
2493
2495
|
36: [function (require, module, exports) {
|
|
2494
2496
|
const _OperationStatePrototype = JSON.stringify({
|
|
@@ -2584,10 +2586,47 @@
|
|
|
2584
2586
|
}
|
|
2585
2587
|
module.exports = FableServiceDataArithmatic;
|
|
2586
2588
|
}, {
|
|
2587
|
-
"./Fable-ServiceProviderBase.js":
|
|
2589
|
+
"./Fable-ServiceProviderBase.js": 42,
|
|
2588
2590
|
"data-arithmatic": 17
|
|
2589
2591
|
}],
|
|
2590
2592
|
38: [function (require, module, exports) {
|
|
2593
|
+
const libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2594
|
+
const libPrecedent = require('precedent');
|
|
2595
|
+
class FableServiceMetaTemplate extends libFableServiceBase {
|
|
2596
|
+
constructor(pFable, pOptions, pServiceHash) {
|
|
2597
|
+
super(pFable, pOptions, pServiceHash);
|
|
2598
|
+
this.serviceType = 'MetaTemplate';
|
|
2599
|
+
this._MetaTemplateLibrary = new libPrecedent(this.options);
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
/**
|
|
2603
|
+
* Add a Pattern to the Parse Tree
|
|
2604
|
+
* @method addPattern
|
|
2605
|
+
* @param {Object} pTree - A node on the parse tree to push the characters into
|
|
2606
|
+
* @param {string} pPattern - The string to add to the tree
|
|
2607
|
+
* @param {number} pIndex - callback function
|
|
2608
|
+
* @return {bool} True if adding the pattern was successful
|
|
2609
|
+
*/
|
|
2610
|
+
addPattern(pPatternStart, pPatternEnd, pParser) {
|
|
2611
|
+
return this._MetaTemplateLibrary.addPattern(pPatternStart, pPatternEnd, pParser);
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
/**
|
|
2615
|
+
* Parse a string with the existing parse tree
|
|
2616
|
+
* @method parseString
|
|
2617
|
+
* @param {string} pString - The string to parse
|
|
2618
|
+
* @return {string} The result from the parser
|
|
2619
|
+
*/
|
|
2620
|
+
parseString(pString) {
|
|
2621
|
+
return this._MetaTemplateLibrary.parseString(pString, this.ParseTree);
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
module.exports = FableServiceMetaTemplate;
|
|
2625
|
+
}, {
|
|
2626
|
+
"./Fable-ServiceProviderBase.js": 42,
|
|
2627
|
+
"precedent": 30
|
|
2628
|
+
}],
|
|
2629
|
+
39: [function (require, module, exports) {
|
|
2591
2630
|
const libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2592
2631
|
class FableServiceTemplate extends libFableServiceBase {
|
|
2593
2632
|
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
@@ -2668,9 +2707,9 @@
|
|
|
2668
2707
|
}
|
|
2669
2708
|
module.exports = FableServiceTemplate;
|
|
2670
2709
|
}, {
|
|
2671
|
-
"./Fable-ServiceProviderBase.js":
|
|
2710
|
+
"./Fable-ServiceProviderBase.js": 42
|
|
2672
2711
|
}],
|
|
2673
|
-
|
|
2712
|
+
40: [function (require, module, exports) {
|
|
2674
2713
|
const libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2675
2714
|
|
|
2676
2715
|
// TODO: These are still pretty big -- consider the smaller polyfills
|
|
@@ -2740,11 +2779,11 @@
|
|
|
2740
2779
|
}
|
|
2741
2780
|
module.exports = FableServiceUtility;
|
|
2742
2781
|
}, {
|
|
2743
|
-
"./Fable-ServiceProviderBase.js":
|
|
2782
|
+
"./Fable-ServiceProviderBase.js": 42,
|
|
2744
2783
|
"async.eachlimit": 1,
|
|
2745
2784
|
"async.waterfall": 15
|
|
2746
2785
|
}],
|
|
2747
|
-
|
|
2786
|
+
41: [function (require, module, exports) {
|
|
2748
2787
|
/**
|
|
2749
2788
|
* Fable Application Services Management
|
|
2750
2789
|
* @license MIT
|
|
@@ -2811,9 +2850,9 @@
|
|
|
2811
2850
|
module.exports = FableService;
|
|
2812
2851
|
module.exports.ServiceProviderBase = libFableServiceBase;
|
|
2813
2852
|
}, {
|
|
2814
|
-
"./Fable-ServiceProviderBase.js":
|
|
2853
|
+
"./Fable-ServiceProviderBase.js": 42
|
|
2815
2854
|
}],
|
|
2816
|
-
|
|
2855
|
+
42: [function (require, module, exports) {
|
|
2817
2856
|
/**
|
|
2818
2857
|
* Fable Service Base
|
|
2819
2858
|
* @license MIT
|
|
@@ -2831,7 +2870,7 @@
|
|
|
2831
2870
|
}
|
|
2832
2871
|
module.exports = FableServiceProviderBase;
|
|
2833
2872
|
}, {}],
|
|
2834
|
-
|
|
2873
|
+
43: [function (require, module, exports) {
|
|
2835
2874
|
/**
|
|
2836
2875
|
* Fable Application Services Support Library
|
|
2837
2876
|
* @license MIT
|
|
@@ -2843,6 +2882,7 @@
|
|
|
2843
2882
|
const libFableServiceManager = require('./Fable-ServiceManager.js');
|
|
2844
2883
|
const libFableServiceDataArithmatic = require('./Fable-Service-DataArithmatic.js');
|
|
2845
2884
|
const libFableServiceTemplate = require('./Fable-Service-Template.js');
|
|
2885
|
+
const libFableServiceMetaTemplate = require('./Fable-Service-MetaTemplate.js');
|
|
2846
2886
|
const libFableServiceUtility = require('./Fable-Service-Utility.js');
|
|
2847
2887
|
const libFableOperation = require('./Fable-Operation.js');
|
|
2848
2888
|
class Fable {
|
|
@@ -2873,6 +2913,9 @@
|
|
|
2873
2913
|
// Initialize the template service
|
|
2874
2914
|
this.serviceManager.addServiceType('Template', libFableServiceTemplate);
|
|
2875
2915
|
|
|
2916
|
+
// Initialize the metatemplate service
|
|
2917
|
+
this.serviceManager.addServiceType('MetaTemplate', libFableServiceMetaTemplate);
|
|
2918
|
+
|
|
2876
2919
|
// Initialize and instantiate the default baked-in Utility service
|
|
2877
2920
|
this.serviceManager.addServiceType('Utility', libFableServiceUtility);
|
|
2878
2921
|
this.fable.serviceManager.instantiateServiceProvider('Utility', {}, 'Default-Service-Utility');
|
|
@@ -2920,9 +2963,10 @@
|
|
|
2920
2963
|
}, {
|
|
2921
2964
|
"./Fable-Operation.js": 36,
|
|
2922
2965
|
"./Fable-Service-DataArithmatic.js": 37,
|
|
2923
|
-
"./Fable-Service-
|
|
2924
|
-
"./Fable-Service-
|
|
2925
|
-
"./Fable-
|
|
2966
|
+
"./Fable-Service-MetaTemplate.js": 38,
|
|
2967
|
+
"./Fable-Service-Template.js": 39,
|
|
2968
|
+
"./Fable-Service-Utility.js": 40,
|
|
2969
|
+
"./Fable-ServiceManager.js": 41,
|
|
2926
2970
|
"fable-log": 23,
|
|
2927
2971
|
"fable-settings": 26,
|
|
2928
2972
|
"fable-uuid": 28
|
package/dist/fable.min.js
CHANGED
|
@@ -75,7 +75,7 @@ var n=t("./Fable-UUID-Random.js");class i{constructor(t){this._UUIDModeRandom=!(
|
|
|
75
75
|
*
|
|
76
76
|
* @description Process text streams, parsing out meta-template expressions.
|
|
77
77
|
*/
|
|
78
|
-
var n=t("./WordTree.js"),i=t("./StringParser.js");e.exports=class{constructor(){this.WordTree=new n,this.StringParser=new i,this.ParseTree=this.WordTree.ParseTree}addPattern(t,e,r){return this.WordTree.addPattern(t,e,r)}parseString(t){return this.StringParser.parseString(t,this.ParseTree)}}},{"./StringParser.js":31,"./WordTree.js":32}],31:[function(t,e,r){e.exports=
|
|
78
|
+
var n=t("./WordTree.js"),i=t("./StringParser.js");e.exports=class{constructor(){this.WordTree=new n,this.StringParser=new i,this.ParseTree=this.WordTree.ParseTree}addPattern(t,e,r){return this.WordTree.addPattern(t,e,r)}parseString(t,e){return this.StringParser.parseString(t,this.ParseTree,e)}}},{"./StringParser.js":31,"./WordTree.js":32}],31:[function(t,e,r){e.exports=
|
|
79
79
|
/**
|
|
80
80
|
* String Parser
|
|
81
81
|
*
|
|
@@ -85,7 +85,7 @@ var n=t("./WordTree.js"),i=t("./StringParser.js");e.exports=class{constructor(){
|
|
|
85
85
|
*
|
|
86
86
|
* @description Parse a string, properly processing each matched token in the word tree.
|
|
87
87
|
*/
|
|
88
|
-
class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer:"",Pattern:!1,PatternMatch:!1,PatternMatchOutputBuffer:""}}assignNode(t,e){e.PatternMatch=t,e.PatternMatch.hasOwnProperty("PatternEnd")&&(e.Pattern=e.PatternMatch)}appendOutputBuffer(t,e){e.OutputBuffer+=t}flushOutputBuffer(t){t.Output+=t.OutputBuffer,t.OutputBuffer=""}checkPatternEnd(t){t.OutputBuffer.length>=t.Pattern.PatternEnd.length+t.Pattern.PatternStart.length&&t.OutputBuffer.substr(-t.Pattern.PatternEnd.length)===t.Pattern.PatternEnd&&(t.OutputBuffer=t.Pattern.Parse(t.OutputBuffer.substr(t.Pattern.PatternStart.length,t.OutputBuffer.length-(t.Pattern.PatternStart.length+t.Pattern.PatternEnd.length))),this.flushOutputBuffer(t),t.Pattern=!1,t.PatternMatch=!1)}parseCharacter(t,e){!e.PatternMatch&&e.ParseTree.hasOwnProperty(t)?(this.assignNode(e.ParseTree[t],e),this.appendOutputBuffer(t,e)):e.PatternMatch?(e.PatternMatch.hasOwnProperty(t)&&this.assignNode(e.PatternMatch[t],e),this.appendOutputBuffer(t,e),e.Pattern&&this.checkPatternEnd(e)):e.Output+=t}parseString(t,e){let
|
|
88
|
+
class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer:"",Pattern:!1,PatternMatch:!1,PatternMatchOutputBuffer:""}}assignNode(t,e){e.PatternMatch=t,e.PatternMatch.hasOwnProperty("PatternEnd")&&(e.Pattern=e.PatternMatch)}appendOutputBuffer(t,e){e.OutputBuffer+=t}flushOutputBuffer(t){t.Output+=t.OutputBuffer,t.OutputBuffer=""}checkPatternEnd(t,e){t.OutputBuffer.length>=t.Pattern.PatternEnd.length+t.Pattern.PatternStart.length&&t.OutputBuffer.substr(-t.Pattern.PatternEnd.length)===t.Pattern.PatternEnd&&(t.OutputBuffer=t.Pattern.Parse(t.OutputBuffer.substr(t.Pattern.PatternStart.length,t.OutputBuffer.length-(t.Pattern.PatternStart.length+t.Pattern.PatternEnd.length)),e),this.flushOutputBuffer(t),t.Pattern=!1,t.PatternMatch=!1)}parseCharacter(t,e,r){!e.PatternMatch&&e.ParseTree.hasOwnProperty(t)?(this.assignNode(e.ParseTree[t],e),this.appendOutputBuffer(t,e)):e.PatternMatch?(e.PatternMatch.hasOwnProperty(t)&&this.assignNode(e.PatternMatch[t],e),this.appendOutputBuffer(t,e),e.Pattern&&this.checkPatternEnd(e,r)):e.Output+=t}parseString(t,e,r){let n=this.newParserState(e);for(var i=0;i<t.length;i++)this.parseCharacter(t[i],n,r);return this.flushOutputBuffer(n),n.Output}}},{}],32:[function(t,e,r){e.exports=
|
|
89
89
|
/**
|
|
90
90
|
* Word Tree
|
|
91
91
|
*
|
|
@@ -95,23 +95,23 @@ class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer
|
|
|
95
95
|
*
|
|
96
96
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
97
97
|
*/
|
|
98
|
-
class{constructor(){this.ParseTree={}}addChild(t,e,r){return t.hasOwnProperty(e[r])||(t[e[r]]={}),t[e[r]]}addPattern(t,e,r){if(t.length<1)return!1;if("string"==typeof e&&e.length<1)return!1;let n=this.ParseTree;for(var i=0;i<t.length;i++)n=this.addChild(n,t,i);return n.PatternStart=t,n.PatternEnd="string"==typeof e&&e.length>0?e:t,n.Parse="function"==typeof r?r:"string"==typeof r?()=>r:t=>t,!0}}},{}],33:[function(t,e,r){var n,i,s=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var c,u=[],h=!1,f=-1;function g(){h&&c&&(h=!1,c.length?u=c.concat(u):f=-1,u.length&&p())}function p(){if(!h){var t=l(g);h=!0;for(var e=u.length;e;){for(c=u,u=[];++f<e;)c&&c[f].run();f=-1,e=u.length}c=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{return i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new d(t,e)),1!==u.length||h||l(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=m,s.addListener=m,s.once=m,s.off=m,s.removeListener=m,s.removeAllListeners=m,s.emit=m,s.prependListener=m,s.prependOnceListener=m,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],34:[function(t,e,r){(function(e,n){(function(){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},l=0;function c(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new c(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new c(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},c.prototype.unref=c.prototype.ref=function(){},c.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=l++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i((function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":33,timers:34}],35:[function(t,e,r){var n=t("./Fable.js");"object"!=typeof window||window.hasOwnProperty("Fable")||(window.Fable=n),e.exports=n},{"./Fable.js":
|
|
98
|
+
class{constructor(){this.ParseTree={}}addChild(t,e,r){return t.hasOwnProperty(e[r])||(t[e[r]]={}),t[e[r]]}addPattern(t,e,r){if(t.length<1)return!1;if("string"==typeof e&&e.length<1)return!1;let n=this.ParseTree;for(var i=0;i<t.length;i++)n=this.addChild(n,t,i);return n.PatternStart=t,n.PatternEnd="string"==typeof e&&e.length>0?e:t,n.Parse="function"==typeof r?r:"string"==typeof r?()=>r:t=>t,!0}}},{}],33:[function(t,e,r){var n,i,s=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var c,u=[],h=!1,f=-1;function g(){h&&c&&(h=!1,c.length?u=c.concat(u):f=-1,u.length&&p())}function p(){if(!h){var t=l(g);h=!0;for(var e=u.length;e;){for(c=u,u=[];++f<e;)c&&c[f].run();f=-1,e=u.length}c=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{return i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new d(t,e)),1!==u.length||h||l(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=m,s.addListener=m,s.once=m,s.off=m,s.removeListener=m,s.removeAllListeners=m,s.emit=m,s.prependListener=m,s.prependOnceListener=m,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],34:[function(t,e,r){(function(e,n){(function(){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},l=0;function c(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new c(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new c(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},c.prototype.unref=c.prototype.ref=function(){},c.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=l++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i((function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":33,timers:34}],35:[function(t,e,r){var n=t("./Fable.js");"object"!=typeof window||window.hasOwnProperty("Fable")||(window.Fable=n),e.exports=n},{"./Fable.js":43}],36:[function(t,e,r){const n=JSON.stringify({Metadata:{GUID:!1,Hash:!1,Title:"",Summary:"",Version:0},Status:{Completed:!1,CompletionProgress:0,CompletionTimeElapsed:0,Steps:1,StepsCompleted:0,StartTime:0,EndTime:0},Errors:[],Log:[]});e.exports=class{constructor(t,e,r){this.fable=t,this.name=e,this.state=JSON.parse(n),this.state.Metadata.GUID=this.fable.getUUID(),this.state.Metadata.Hash=this.state.GUID,"string"==typeof r&&(this.state.Metadata.Hash=r)}get GUID(){return this.state.Metadata.GUID}get Hash(){return this.state.Metadata.Hash}get log(){return this}writeOperationLog(t,e,r){this.state.Log.push("".concat((new Date).toUTCString()," [").concat(t,"]: ").concat(e)),"object"==typeof r&&this.state.Log.push(JSON.stringify(r))}writeOperationErrors(t,e){this.state.Errors.push("".concat(t)),"object"==typeof e&&this.state.Errors.push(JSON.stringify(e))}trace(t,e){this.writeOperationLog("TRACE",t,e),this.fable.log.trace(t,e)}debug(t,e){this.writeOperationLog("DEBUG",t,e),this.fable.log.debug(t,e)}info(t,e){this.writeOperationLog("INFO",t,e),this.fable.log.info(t,e)}warn(t,e){this.writeOperationLog("WARN",t,e),this.fable.log.warn(t,e)}error(t,e){this.writeOperationLog("ERROR",t,e),this.writeOperationErrors(t,e),this.fable.log.error(t,e)}fatal(t,e){this.writeOperationLog("FATAL",t,e),this.writeOperationErrors(t,e),this.fable.log.fatal(t,e)}}},{}],37:[function(t,e,r){const n=t("./Fable-ServiceProviderBase.js"),i=t("data-arithmatic");e.exports=class extends n{constructor(t,e,r){super(t,e,r),this.serviceType="DataArithmatic",this._DataArithmaticLibrary=new i}}},{"./Fable-ServiceProviderBase.js":42,"data-arithmatic":17}],38:[function(t,e,r){const n=t("./Fable-ServiceProviderBase.js"),i=t("precedent");e.exports=class extends n{constructor(t,e,r){super(t,e,r),this.serviceType="MetaTemplate",this._MetaTemplateLibrary=new i(this.options)}addPattern(t,e,r){return this._MetaTemplateLibrary.addPattern(t,e,r)}parseString(t){return this._MetaTemplateLibrary.parseString(t,this.ParseTree)}}},{"./Fable-ServiceProviderBase.js":42,precedent:30}],39:[function(t,e,r){const n=t("./Fable-ServiceProviderBase.js");e.exports=class extends n{constructor(t,e,r){super(t,e,r),this.serviceType="Template",this.Matchers={Evaluate:/<%([\s\S]+?)%>/g,Interpolate:/<%=([\s\S]+?)%>/g,Escaper:/\\|'|\r|\n|\t|\u2028|\u2029/g,Unescaper:/\\(\\|'|r|n|t|u2028|u2029)/g,GuaranteedNonMatch:/.^/},this.templateEscapes={"\\":"\\","'":"'",r:"\r","\r":"r",n:"\n","\n":"n",t:"\t","\t":"t",u2028:"\u2028","\u2028":"u2028",u2029:"\u2029","\u2029":"u2029"},this.renderFunction=!1,this.templateString=!1}renderTemplate(t){return this.renderFunction(t)}templateFunction(t){return this.renderTemplate.bind(this)}buildTemplateFunction(t,e){return this.TemplateSource="__p+='"+t.replace(this.Matchers.Escaper,(t=>"\\".concat(this.templateEscapes[t]))).replace(this.Matchers.Interpolate||this.Matchers.GuaranteedNonMatch,((t,e)=>"'+\n(".concat(decodeURIComponent(e),")+\n'"))).replace(this.Matchers.Evaluate||this.Matchers.GuaranteedNonMatch,((t,e)=>"';\n".concat(decodeURIComponent(e),"\n;__p+='")))+"';\n",this.TemplateSource="with(pTemplateDataObject||{}){\n".concat(this.TemplateSource,"}\n"),this.TemplateSource="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n".concat(this.TemplateSource,"return __p;\n"),this.renderFunction=new Function("pTemplateDataObject",this.TemplateSource),void 0!==e?this.renderFunction(e):(this.TemplateSourceCompiled="function(obj){\n"+this.TemplateSource+"}",this.templateFunction())}}},{"./Fable-ServiceProviderBase.js":42}],40:[function(t,e,r){const n=t("./Fable-ServiceProviderBase.js"),i=t("async.waterfall"),s=t("async.eachlimit");e.exports=class extends n{constructor(t,e,r){super(t,e,r),this.templates={},this.waterfall=i,this.eachLimit=s}extend(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Object.assign(t,...r)}template(t,e){return this.fable.serviceManager.instantiateServiceProviderWithoutRegistration("Template").buildTemplateFunction(t,e)}buildHashedTemplate(t,e,r){let n=this.fable.serviceManager.instantiateServiceProvider("Template",{},t);return this.templates[t]=n.buildTemplateFunction(e,r),this.templates[t]}chunk(t,e,r){let n=[...t],i="number"==typeof e?e:0,s=void 0!==r?r:[];if(i<=0)return s;for(;n.length;)s.push(n.splice(0,i));return s}}},{"./Fable-ServiceProviderBase.js":42,"async.eachlimit":1,"async.waterfall":15}],41:[function(t,e,r){
|
|
99
99
|
/**
|
|
100
100
|
* Fable Application Services Management
|
|
101
101
|
* @license MIT
|
|
102
102
|
* @author <steven@velozo.com>
|
|
103
103
|
*/
|
|
104
|
-
const n=t("./Fable-ServiceProviderBase.js");e.exports=class{constructor(t){this.fable=t,this.serviceTypes=[],this.services={},this.defaultServices={},this.serviceClasses={}}addServiceType(t,e){this.serviceTypes.push(t),this.services[t]={},"function"==typeof e&&e.prototype instanceof n?this.serviceClasses[t]=e:this.serviceClasses[t]=n}instantiateServiceProvider(t,e,r){let n=this.instantiateServiceProviderWithoutRegistration(t,e,r);return this.services[t][n.Hash]=n,this.defaultServices.hasOwnProperty(t)||(this.defaultServices[t]=n),n}instantiateServiceProviderWithoutRegistration(t,e,r){return new this.serviceClasses[t](this.fable,e,r)}setDefaultServiceInstantiation(t,e){return!!this.services[t].hasOwnProperty(e)&&(this.defaultServices[t]=this.services[t][e],!0)}},e.exports.ServiceProviderBase=n},{"./Fable-ServiceProviderBase.js":
|
|
104
|
+
const n=t("./Fable-ServiceProviderBase.js");e.exports=class{constructor(t){this.fable=t,this.serviceTypes=[],this.services={},this.defaultServices={},this.serviceClasses={}}addServiceType(t,e){this.serviceTypes.push(t),this.services[t]={},"function"==typeof e&&e.prototype instanceof n?this.serviceClasses[t]=e:this.serviceClasses[t]=n}instantiateServiceProvider(t,e,r){let n=this.instantiateServiceProviderWithoutRegistration(t,e,r);return this.services[t][n.Hash]=n,this.defaultServices.hasOwnProperty(t)||(this.defaultServices[t]=n),n}instantiateServiceProviderWithoutRegistration(t,e,r){return new this.serviceClasses[t](this.fable,e,r)}setDefaultServiceInstantiation(t,e){return!!this.services[t].hasOwnProperty(e)&&(this.defaultServices[t]=this.services[t][e],!0)}},e.exports.ServiceProviderBase=n},{"./Fable-ServiceProviderBase.js":42}],42:[function(t,e,r){e.exports=
|
|
105
105
|
/**
|
|
106
106
|
* Fable Service Base
|
|
107
107
|
* @license MIT
|
|
108
108
|
* @author <steven@velozo.com>
|
|
109
109
|
*/
|
|
110
|
-
class{constructor(t,e,r){this.fable=t,this.options="object"==typeof e?e:{},this.serviceType="Unknown",this.UUID=t.getUUID(),this.Hash="string"==typeof r?r:"".concat(this.UUID)}}},{}],
|
|
110
|
+
class{constructor(t,e,r){this.fable=t,this.options="object"==typeof e?e:{},this.serviceType="Unknown",this.UUID=t.getUUID(),this.Hash="string"==typeof r?r:"".concat(this.UUID)}}},{}],43:[function(t,e,r){
|
|
111
111
|
/**
|
|
112
112
|
* Fable Application Services Support Library
|
|
113
113
|
* @license MIT
|
|
114
114
|
* @author <steven@velozo.com>
|
|
115
115
|
*/
|
|
116
|
-
const n=t("fable-settings"),i=t("fable-uuid"),s=t("fable-log"),o=t("./Fable-ServiceManager.js"),a=t("./Fable-Service-DataArithmatic.js"),l=t("./Fable-Service-Template.js"),c=t("./Fable-Service-
|
|
116
|
+
const n=t("fable-settings"),i=t("fable-uuid"),s=t("fable-log"),o=t("./Fable-ServiceManager.js"),a=t("./Fable-Service-DataArithmatic.js"),l=t("./Fable-Service-Template.js"),c=t("./Fable-Service-MetaTemplate.js"),u=t("./Fable-Service-Utility.js"),h=t("./Fable-Operation.js");class f{constructor(t){let e=new n(t);this.settingsManager=e,this.libUUID=new i(this.settingsManager.settings),this.log=new s(this.settingsManager.settings),this.log.initialize(),this.Dependencies={precedent:n.precedent},this.Operations={},this.serviceManager=new o(this),this.serviceManager.addServiceType("DataArithmatic",a),this.fable.serviceManager.instantiateServiceProvider("DataArithmatic",{},"Default-Service-DataArithmatic"),this.DataArithmatic=this.serviceManager.defaultServices.DataArithmatic._DataArithmaticLibrary,this.serviceManager.addServiceType("Template",l),this.serviceManager.addServiceType("MetaTemplate",c),this.serviceManager.addServiceType("Utility",u),this.fable.serviceManager.instantiateServiceProvider("Utility",{},"Default-Service-Utility"),this.Utility=this.serviceManager.defaultServices.Utility,this.services=this.serviceManager.services,this.defaultServices=this.serviceManager.defaultServices}get settings(){return this.settingsManager.settings}get fable(){return this}getUUID(){return this.libUUID.getUUID()}createOperation(t,e){let r=new h(this,t,e);return this.Operations.hasOwnProperty(r.Hash)||(this.Operations[r.Hash]=r),r}getOperation(t){return!!this.Operations.hasOwnProperty(t)&&this.Operations[t]}}e.exports=f,e.exports.new=function(t){return new f(t)},e.exports.LogProviderBase=s.LogProviderBase,e.exports.ServiceProviderBase=o.ServiceProviderBase,e.exports.precedent=n.precedent},{"./Fable-Operation.js":36,"./Fable-Service-DataArithmatic.js":37,"./Fable-Service-MetaTemplate.js":38,"./Fable-Service-Template.js":39,"./Fable-Service-Utility.js":40,"./Fable-ServiceManager.js":41,"fable-log":23,"fable-settings":26,"fable-uuid":28}]},{},[35])(35)}));
|
|
117
117
|
//# sourceMappingURL=fable.min.js.map
|