fable 3.0.7 → 3.0.10
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.js +31 -21
- package/dist/fable.min.js +10 -10
- package/dist/fable.min.js.map +1 -1
- package/package.json +4 -4
- package/source/Fable.js +21 -4
- package/test/Fable_tests.js +18 -0
package/dist/fable.js
CHANGED
|
@@ -754,7 +754,7 @@
|
|
|
754
754
|
class BaseLogger {
|
|
755
755
|
constructor(pLogStreamSettings, pFableLog) {
|
|
756
756
|
// This should not possibly be able to be instantiated without a settings object
|
|
757
|
-
this._Settings = pLogStreamSettings;
|
|
757
|
+
this._Settings = typeof pLogStreamSettings == 'object' ? pLogStreamSettings : {};
|
|
758
758
|
|
|
759
759
|
// The base logger does nothing but associate a UUID with itself
|
|
760
760
|
// We added this as the mechanism for tracking loggers to allow multiple simultaneous streams
|
|
@@ -838,13 +838,13 @@
|
|
|
838
838
|
class ConsoleLogger extends libBaseLogger {
|
|
839
839
|
constructor(pLogStreamSettings, pFableLog) {
|
|
840
840
|
super(pLogStreamSettings);
|
|
841
|
-
this._ShowTimeStamps =
|
|
842
|
-
this._FormattedTimeStamps =
|
|
843
|
-
this._ContextMessage =
|
|
841
|
+
this._ShowTimeStamps = this._Settings.hasOwnProperty('showtimestamps') ? this._Settings.showtimestamps == true : false;
|
|
842
|
+
this._FormattedTimeStamps = this._Settings.hasOwnProperty('formattedtimestamps') ? this._Settings.formattedtimestamps == true : false;
|
|
843
|
+
this._ContextMessage = this._Settings.hasOwnProperty('Context') ? `(${this._Settings.Context})` : pFableLog._Settings.hasOwnProperty('Product') ? `(${pFableLog._Settings.Product})` : 'Unnamed_Log_Context';
|
|
844
844
|
|
|
845
845
|
// Allow the user to decide what gets output to the console
|
|
846
|
-
this._OutputLogLinesToConsole =
|
|
847
|
-
this._OutputObjectsToConsole =
|
|
846
|
+
this._OutputLogLinesToConsole = this._Settings.hasOwnProperty('outputloglinestoconsole') ? this._Settings.outputloglinestoconsole : true;
|
|
847
|
+
this._OutputObjectsToConsole = this._Settings.hasOwnProperty('outputobjectstoconsole') ? this._Settings.outputobjectstoconsole : true;
|
|
848
848
|
|
|
849
849
|
// Precompute the prefix for each level
|
|
850
850
|
this.prefixCache = {};
|
|
@@ -1058,11 +1058,11 @@
|
|
|
1058
1058
|
function autoConstruct(pSettings) {
|
|
1059
1059
|
return new FableLog(pSettings);
|
|
1060
1060
|
}
|
|
1061
|
-
module.exports =
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
};
|
|
1061
|
+
module.exports = FableLog;
|
|
1062
|
+
module.exports.new = autoConstruct;
|
|
1063
|
+
module.exports.LogProviderBase = require('./Fable-Log-BaseLogger.js');
|
|
1065
1064
|
}, {
|
|
1065
|
+
"./Fable-Log-BaseLogger.js": 17,
|
|
1066
1066
|
"./Fable-Log-DefaultProviders-Node.js": 18,
|
|
1067
1067
|
"./Fable-Log-DefaultStreams.json": 19
|
|
1068
1068
|
}],
|
|
@@ -1262,10 +1262,9 @@
|
|
|
1262
1262
|
function autoConstruct(pSettings) {
|
|
1263
1263
|
return new FableSettings(pSettings);
|
|
1264
1264
|
}
|
|
1265
|
-
module.exports =
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
};
|
|
1265
|
+
module.exports = FableSettings;
|
|
1266
|
+
module.exports.new = autoConstruct;
|
|
1267
|
+
module.exports.precedent = libPrecedent;
|
|
1269
1268
|
}, {
|
|
1270
1269
|
"./Fable-Settings-Default": 22,
|
|
1271
1270
|
"./Fable-Settings-TemplateProcessor.js": 23,
|
|
@@ -1402,10 +1401,8 @@
|
|
|
1402
1401
|
function autoConstruct(pSettings) {
|
|
1403
1402
|
return new FableUUID(pSettings);
|
|
1404
1403
|
}
|
|
1405
|
-
module.exports =
|
|
1406
|
-
|
|
1407
|
-
FableUUID: FableUUID
|
|
1408
|
-
};
|
|
1404
|
+
module.exports = FableUUID;
|
|
1405
|
+
module.exports.new = autoConstruct;
|
|
1409
1406
|
}, {
|
|
1410
1407
|
"./Fable-UUID-Random.js": 25
|
|
1411
1408
|
}],
|
|
@@ -2070,9 +2067,9 @@
|
|
|
2070
2067
|
* @license MIT
|
|
2071
2068
|
* @author <steven@velozo.com>
|
|
2072
2069
|
*/
|
|
2073
|
-
const libFableSettings = require('fable-settings')
|
|
2074
|
-
const libFableUUID = require('fable-uuid')
|
|
2075
|
-
const libFableLog = require('fable-log')
|
|
2070
|
+
const libFableSettings = require('fable-settings');
|
|
2071
|
+
const libFableUUID = require('fable-uuid');
|
|
2072
|
+
const libFableLog = require('fable-log');
|
|
2076
2073
|
const libFableUtility = require('./Fable-Utility.js');
|
|
2077
2074
|
class Fable {
|
|
2078
2075
|
constructor(pSettings) {
|
|
@@ -2084,6 +2081,11 @@
|
|
|
2084
2081
|
this.log = new libFableLog(this.settingsManager.settings);
|
|
2085
2082
|
this.log.initialize();
|
|
2086
2083
|
this.Utility = new libFableUtility(this);
|
|
2084
|
+
|
|
2085
|
+
// Built-in dependencies ... more can be added here.
|
|
2086
|
+
this.Dependencies = {
|
|
2087
|
+
precedent: libFableSettings.precedent
|
|
2088
|
+
};
|
|
2087
2089
|
}
|
|
2088
2090
|
get settings() {
|
|
2089
2091
|
return this.settingsManager.settings;
|
|
@@ -2095,7 +2097,15 @@
|
|
|
2095
2097
|
return this.libUUID.getUUID();
|
|
2096
2098
|
}
|
|
2097
2099
|
}
|
|
2100
|
+
|
|
2101
|
+
// This is for backwards compatibility
|
|
2102
|
+
function autoConstruct(pSettings) {
|
|
2103
|
+
return new Fable(pSettings);
|
|
2104
|
+
}
|
|
2098
2105
|
module.exports = Fable;
|
|
2106
|
+
module.exports.new = autoConstruct;
|
|
2107
|
+
module.exports.LogProviderBase = libFableLog.LogProviderBase;
|
|
2108
|
+
module.exports.precedent = libFableSettings.precedent;
|
|
2099
2109
|
}, {
|
|
2100
2110
|
"./Fable-Utility.js": 34,
|
|
2101
2111
|
"fable-log": 21,
|
package/dist/fable.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Fable=t()}}((function(){return function t(e,r,n){function
|
|
1
|
+
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Fable=t()}}((function(){return function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[s]={exports:{}};e[s][0].call(c.exports,(function(t){return i(e[s][1][t]||t)}),c,c.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,o.isAsync)(t))return function(...e){const r=e.pop();return a(t.apply(this,e),r)};return(0,n.default)((function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}if(n&&"function"==typeof n.then)return a(n,r);r(null,n)}))};var n=s(t("./internal/initialParams.js")),i=s(t("./internal/setImmediate.js")),o=t("./internal/wrapAsync.js");function s(t){return t&&t.__esModule?t:{default:t}}function a(t,e){return t.then((t=>{u(e,null,t)}),(t=>{u(e,t&&t.message?t:new Error(t))}))}function u(t,e,r){try{t(e,r)}catch(t){(0,i.default)((t=>{throw t}),t)}}e.exports=r.default},{"./internal/initialParams.js":8,"./internal/setImmediate.js":13,"./internal/wrapAsync.js":15}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(t("./internal/eachOfLimit.js")),i=a(t("./internal/withoutIndex.js")),o=a(t("./internal/wrapAsync.js")),s=a(t("./internal/awaitify.js"));function a(t){return t&&t.__esModule?t:{default:t}}r.default=(0,s.default)((function(t,e,r,s){return(0,n.default)(e)(t,(0,i.default)((0,o.default)(r)),s)}),4),e.exports=r.default},{"./internal/awaitify.js":4,"./internal/eachOfLimit.js":6,"./internal/withoutIndex.js":14,"./internal/wrapAsync.js":15}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e,r,n){let i=!1,s=!1,a=!1,u=0,l=0;function c(){u>=e||a||i||(a=!0,t.next().then((({value:t,done:e})=>{if(!s&&!i){if(a=!1,e)return i=!0,void(u<=0&&n(null));u++,r(t,l,f),l++,c()}})).catch(h))}function f(t,e){if(u-=1,!s)return t?h(t):!1===t?(i=!0,void(s=!0)):e===o.default||i&&u<=0?(i=!0,n(null)):void c()}function h(t){s||(a=!1,i=!0,n(t))}c()};var n,i=t("./breakLoop.js"),o=(n=i)&&n.__esModule?n:{default:n};e.exports=r.default},{"./breakLoop.js":5}],4:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e=t.length){if(!e)throw new Error("arity is undefined");return function(...r){return"function"==typeof r[e-1]?t.apply(this,r):new Promise(((n,i)=>{r[e-1]=(t,...e)=>{if(t)return i(t);n(e.length>1?e:e[0])},t.apply(this,r)}))}},e.exports=r.default},{}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.default={},e.exports=r.default},{}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=l(t("./once.js")),i=l(t("./iterator.js")),o=l(t("./onlyOnce.js")),s=t("./wrapAsync.js"),a=l(t("./asyncEachOfLimit.js")),u=l(t("./breakLoop.js"));function l(t){return t&&t.__esModule?t:{default:t}}r.default=t=>(e,r,l)=>{if(l=(0,n.default)(l),t<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!e)return l(null);if((0,s.isAsyncGenerator)(e))return(0,a.default)(e,t,r,l);if((0,s.isAsyncIterable)(e))return(0,a.default)(e[Symbol.asyncIterator](),t,r,l);var c=(0,i.default)(e),f=!1,h=!1,p=0,d=!1;function g(t,e){if(!h)if(p-=1,t)f=!0,l(t);else if(!1===t)f=!0,h=!0;else{if(e===u.default||f&&p<=0)return f=!0,l(null);d||m()}}function m(){for(d=!0;p<t&&!f;){var e=c();if(null===e)return f=!0,void(p<=0&&l(null));p+=1,r(e.value,e.key,(0,o.default)(g))}d=!1}m()},e.exports=r.default},{"./asyncEachOfLimit.js":3,"./breakLoop.js":5,"./iterator.js":10,"./once.js":11,"./onlyOnce.js":12,"./wrapAsync.js":15}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t[Symbol.iterator]&&t[Symbol.iterator]()},e.exports=r.default},{}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){var r=e.pop();return t.call(this,e,r)}},e.exports=r.default},{}],9:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0},e.exports=r.default},{}],10:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,n.default)(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e=(0,i.default)(t);return e?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(e):(r=t,o=r?Object.keys(r):[],s=-1,a=o.length,function t(){var e=o[++s];return"__proto__"===e?t():s<a?{value:r[e],key:e}:null});var r,o,s,a};var n=o(t("./isArrayLike.js")),i=o(t("./getIterator.js"));function o(t){return t&&t.__esModule?t:{default:t}}e.exports=r.default},{"./getIterator.js":7,"./isArrayLike.js":9}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){function e(...e){if(null!==t){var r=t;t=null,r.apply(this,e)}}return Object.assign(e,t),e},e.exports=r.default},{}],12:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){if(null===t)throw new Error("Callback was already called.");var r=t;t=null,r.apply(this,e)}},e.exports=r.default},{}],13:[function(t,e,r){(function(t,e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fallback=a,r.wrap=u;var n,i=r.hasQueueMicrotask="function"==typeof queueMicrotask&&queueMicrotask,o=r.hasSetImmediate="function"==typeof e&&e,s=r.hasNextTick="object"==typeof t&&"function"==typeof t.nextTick;function a(t){setTimeout(t,0)}function u(t){return(e,...r)=>t((()=>e(...r)))}n=i?queueMicrotask:o?e:s?t.nextTick:a,r.default=u(n)}).call(this)}).call(this,t("_process"),t("timers").setImmediate)},{_process:30,timers:31}],14:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return(e,r,n)=>t(e,n)},e.exports=r.default},{}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isAsyncIterable=r.isAsyncGenerator=r.isAsync=void 0;var n,i=t("../asyncify.js"),o=(n=i)&&n.__esModule?n:{default:n};function s(t){return"AsyncFunction"===t[Symbol.toStringTag]}r.default=function(t){if("function"!=typeof t)throw new Error("expected a function");return s(t)?(0,o.default)(t):t},r.isAsync=s,r.isAsyncGenerator=function(t){return"AsyncGenerator"===t[Symbol.toStringTag]},r.isAsyncIterable=function(t){return"function"==typeof t[Symbol.asyncIterator]}},{"../asyncify.js":1}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(t("./internal/once.js")),i=a(t("./internal/onlyOnce.js")),o=a(t("./internal/wrapAsync.js")),s=a(t("./internal/awaitify.js"));function a(t){return t&&t.__esModule?t:{default:t}}r.default=(0,s.default)((function(t,e){if(e=(0,n.default)(e),!Array.isArray(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function s(e){(0,o.default)(t[r++])(...e,(0,i.default)(a))}function a(n,...i){if(!1!==n)return n||r===t.length?e(n,...i):void s(i)}s([])})),e.exports=r.default},{"./internal/awaitify.js":4,"./internal/once.js":11,"./internal/onlyOnce.js":12,"./internal/wrapAsync.js":15}],17:[function(t,e,r){e.exports=
|
|
2
2
|
/**
|
|
3
3
|
* Base Logger Class
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @author Steven Velozo <steven@velozo.com>
|
|
8
8
|
*/
|
|
9
|
-
class{constructor(t,e){this._Settings=t,this.loggerUUID=this.generateInsecureUUID(),this.levels=["trace","debug","info","warn","error","fatal"]}generateInsecureUUID(){let t=(new Date).getTime();return"LOGSTREAM-xxxxxx-yxxxxx".replace(/[xy]/g,(e=>{let r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?r:3&r|8).toString(16)}))}initialize(){}trace(t,e){this.write("trace",t,e)}debug(t,e){this.write("debug",t,e)}info(t,e){this.write("info",t,e)}warn(t,e){this.write("warn",t,e)}error(t,e){this.write("error",t,e)}fatal(t,e){this.write("fatal",t,e)}write(t,e,r){return!0}}},{}],18:[function(t,e,r){
|
|
9
|
+
class{constructor(t,e){this._Settings="object"==typeof t?t:{},this.loggerUUID=this.generateInsecureUUID(),this.levels=["trace","debug","info","warn","error","fatal"]}generateInsecureUUID(){let t=(new Date).getTime();return"LOGSTREAM-xxxxxx-yxxxxx".replace(/[xy]/g,(e=>{let r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?r:3&r|8).toString(16)}))}initialize(){}trace(t,e){this.write("trace",t,e)}debug(t,e){this.write("debug",t,e)}info(t,e){this.write("info",t,e)}warn(t,e){this.write("warn",t,e)}error(t,e){this.write("error",t,e)}fatal(t,e){this.write("fatal",t,e)}write(t,e,r){return!0}}},{}],18:[function(t,e,r){
|
|
10
10
|
/**
|
|
11
11
|
* Default Logger Provider Function
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ class{constructor(t,e){this._Settings=t,this.loggerUUID=this.generateInsecureUUI
|
|
|
14
14
|
*
|
|
15
15
|
* @author Steven Velozo <steven@velozo.com>
|
|
16
16
|
*/
|
|
17
|
-
getDefaultProviders=()=>{let e={};return e.console=t("./Fable-Log-Logger-Console.js"),e.default=e.console,e},e.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":20}],19:[function(t,e,r){e.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],20:[function(t,e,r){let n=t("./Fable-Log-BaseLogger.js");e.exports=class extends n{constructor(t,e){super(t),this._ShowTimeStamps=!!
|
|
17
|
+
getDefaultProviders=()=>{let e={};return e.console=t("./Fable-Log-Logger-Console.js"),e.default=e.console,e},e.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":20}],19:[function(t,e,r){e.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],20:[function(t,e,r){let n=t("./Fable-Log-BaseLogger.js");e.exports=class extends n{constructor(t,e){super(t),this._ShowTimeStamps=!!this._Settings.hasOwnProperty("showtimestamps")&&1==this._Settings.showtimestamps,this._FormattedTimeStamps=!!this._Settings.hasOwnProperty("formattedtimestamps")&&1==this._Settings.formattedtimestamps,this._ContextMessage=this._Settings.hasOwnProperty("Context")?`(${this._Settings.Context})`:e._Settings.hasOwnProperty("Product")?`(${e._Settings.Product})`:"Unnamed_Log_Context",this._OutputLogLinesToConsole=!this._Settings.hasOwnProperty("outputloglinestoconsole")||this._Settings.outputloglinestoconsole,this._OutputObjectsToConsole=!this._Settings.hasOwnProperty("outputobjectstoconsole")||this._Settings.outputobjectstoconsole,this.prefixCache={};for(let t=0;t<=this.levels.length;t++)this.prefixCache[this.levels[t]]=`[${this.levels[t]}] ${this._ContextMessage}: `,this._ShowTimeStamps&&(this.prefixCache[this.levels[t]]=" "+this.prefixCache[this.levels[t]])}write(t,e,r){let n="";this._ShowTimeStamps&&this._FormattedTimeStamps?n=(new Date).toISOString():this._ShowTimeStamps&&(n=+new Date);let i=`${n}${this.prefixCache[t]}${e}`;return this._OutputLogLinesToConsole&&console.log(i),this._OutputObjectsToConsole&&void 0!==r&&console.log(JSON.stringify(r,null,2)),i}}},{"./Fable-Log-BaseLogger.js":17}],21:[function(t,e,r){
|
|
18
18
|
/**
|
|
19
19
|
* Fable Logging Add-on
|
|
20
20
|
*
|
|
@@ -23,7 +23,7 @@ getDefaultProviders=()=>{let e={};return e.console=t("./Fable-Log-Logger-Console
|
|
|
23
23
|
* @author Steven Velozo <steven@velozo.com>
|
|
24
24
|
* @module Fable Logger
|
|
25
25
|
*/
|
|
26
|
-
class n{constructor(e,r){let n="object"==typeof e?e:{};this._Settings=n,this._Providers=t("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=n.hasOwnProperty("LogStreams")?n.LogStreams:t("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=t=>t,this.uuid="string"==typeof n.Product?n.Product:"Default"}addLogger(t,e){if(this.activeLogStreams.hasOwnProperty(t.loggerUUID))return!1;switch(this.logStreams.push(t),this.activeLogStreams[t.loggerUUID]=!0,e){case"trace":this.logStreamsTrace.push(t);case"debug":this.logStreamsDebug.push(t);case"info":this.logStreamsInfo.push(t);case"warn":this.logStreamsWarn.push(t);case"error":this.logStreamsError.push(t);case"fatal":this.logStreamsFatal.push(t)}return!0}setDatumDecorator(t){this.datumDecorator="function"==typeof t?t:t=>t}trace(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsTrace.length;e++)this.logStreamsTrace[e].trace(t,r)}debug(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsDebug.length;e++)this.logStreamsDebug[e].debug(t,r)}info(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsInfo.length;e++)this.logStreamsInfo[e].info(t,r)}warn(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsWarn.length;e++)this.logStreamsWarn[e].warn(t,r)}error(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsError.length;e++)this.logStreamsError[e].error(t,r)}fatal(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsFatal.length;e++)this.logStreamsFatal[e].fatal(t,r)}initialize(){for(let t=0;t<this._StreamDefinitions.length;t++){let e=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[t]);this._Providers.hasOwnProperty(e.loggertype)?this.addLogger(new this._Providers[e.loggertype](e,this),e.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(e)}`)}for(let t=0;t<this.logStreams.length;t++)this.logStreams[t].initialize()}logTime(t,e){let r=void 0!==t?t:"Time",n=new Date;this.info(`${r} ${n} (epoch ${+n})`,e)}getTimeStamp(){return+new Date}getTimeDelta(t){return+new Date-t}logTimeDelta(t,e,r){let n=void 0!==e?e:"Time Measurement",
|
|
26
|
+
class n{constructor(e,r){let n="object"==typeof e?e:{};this._Settings=n,this._Providers=t("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=n.hasOwnProperty("LogStreams")?n.LogStreams:t("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=t=>t,this.uuid="string"==typeof n.Product?n.Product:"Default"}addLogger(t,e){if(this.activeLogStreams.hasOwnProperty(t.loggerUUID))return!1;switch(this.logStreams.push(t),this.activeLogStreams[t.loggerUUID]=!0,e){case"trace":this.logStreamsTrace.push(t);case"debug":this.logStreamsDebug.push(t);case"info":this.logStreamsInfo.push(t);case"warn":this.logStreamsWarn.push(t);case"error":this.logStreamsError.push(t);case"fatal":this.logStreamsFatal.push(t)}return!0}setDatumDecorator(t){this.datumDecorator="function"==typeof t?t:t=>t}trace(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsTrace.length;e++)this.logStreamsTrace[e].trace(t,r)}debug(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsDebug.length;e++)this.logStreamsDebug[e].debug(t,r)}info(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsInfo.length;e++)this.logStreamsInfo[e].info(t,r)}warn(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsWarn.length;e++)this.logStreamsWarn[e].warn(t,r)}error(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsError.length;e++)this.logStreamsError[e].error(t,r)}fatal(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsFatal.length;e++)this.logStreamsFatal[e].fatal(t,r)}initialize(){for(let t=0;t<this._StreamDefinitions.length;t++){let e=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[t]);this._Providers.hasOwnProperty(e.loggertype)?this.addLogger(new this._Providers[e.loggertype](e,this),e.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(e)}`)}for(let t=0;t<this.logStreams.length;t++)this.logStreams[t].initialize()}logTime(t,e){let r=void 0!==t?t:"Time",n=new Date;this.info(`${r} ${n} (epoch ${+n})`,e)}getTimeStamp(){return+new Date}getTimeDelta(t){return+new Date-t}logTimeDelta(t,e,r){let n=void 0!==e?e:"Time Measurement",i=+new Date;this.info(`${n} logged at (epoch ${+i}) took (${t}ms)`,r)}logTimeDeltaHuman(t,e,r){let n=void 0!==e?e:"Time Measurement",i=+new Date,o=parseInt(t%1e3),s=parseInt(t/1e3%60),a=parseInt(t/6e4%60),u=parseInt(t/36e5);o=o<10?"00"+o:o<100?"0"+o:o,s=s<10?"0"+s:s,a=a<10?"0"+a:a,u=u<10?"0"+u:u,this.info(`${n} logged at (epoch ${+i}) took (${t}ms) or (${u}:${a}:${s}.${o})`,r)}logTimeDeltaRelative(t,e,r){this.logTimeDelta(this.getTimeDelta(t),e,r)}logTimeDeltaRelativeHuman(t,e,r){this.logTimeDeltaHuman(this.getTimeDelta(t),e,r)}}e.exports=n,e.exports.new=function(t){return new n(t)},e.exports.LogProviderBase=t("./Fable-Log-BaseLogger.js")},{"./Fable-Log-BaseLogger.js":17,"./Fable-Log-DefaultProviders-Node.js":18,"./Fable-Log-DefaultStreams.json":19}],22:[function(t,e,r){e.exports={Product:"ApplicationNameHere",ProductVersion:"0.0.0",ConfigFile:!1,LogStreams:[{level:"trace"}]}},{}],23:[function(t,e,r){(function(t){(function(){e.exports=
|
|
27
27
|
/**
|
|
28
28
|
* Fable Settings Template Processor
|
|
29
29
|
*
|
|
@@ -34,7 +34,7 @@ class n{constructor(e,r){let n="object"==typeof e?e:{};this._Settings=n,this._Pr
|
|
|
34
34
|
* @author Steven Velozo <steven@velozo.com>
|
|
35
35
|
* @module Fable Settings
|
|
36
36
|
*/
|
|
37
|
-
class{constructor(e){this.templateProcessor=new e.precedent,this.templateProcessor.addPattern("${","}",(e=>{let r=e.trim(),n=r.indexOf("|"),
|
|
37
|
+
class{constructor(e){this.templateProcessor=new e.precedent,this.templateProcessor.addPattern("${","}",(e=>{let r=e.trim(),n=r.indexOf("|"),i=r.substring(n+1),o=n>-1?r.substring(0,n):r;return t.env.hasOwnProperty(o)?t.env[o]:i}))}parseSetting(t){return this.templateProcessor.parseString(t)}}}).call(this)}).call(this,t("_process"))},{_process:30}],24:[function(t,e,r){
|
|
38
38
|
/**
|
|
39
39
|
* Fable Settings Add-on
|
|
40
40
|
*
|
|
@@ -43,7 +43,7 @@ class{constructor(e){this.templateProcessor=new e.precedent,this.templateProcess
|
|
|
43
43
|
* @author Steven Velozo <steven@velozo.com>
|
|
44
44
|
* @module Fable Settings
|
|
45
45
|
*/
|
|
46
|
-
const n=t("precedent"),
|
|
46
|
+
const n=t("precedent"),i=t("./Fable-Settings-TemplateProcessor.js");class o{constructor(e){this.dependencies={precedent:n},this.settingsTemplateProcessor=new i(this.dependencies),this._configureEnvTemplating(e),this.default=this.buildDefaultSettings();let r=this.merge(e,this.buildDefaultSettings());if(this.base=JSON.parse(JSON.stringify(r)),r.DefaultConfigFile)try{r=this.merge(t(r.DefaultConfigFile),r)}catch(t){console.log("Fable-Settings Warning: Default configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+t)}if(r.ConfigFile)try{r=this.merge(t(r.ConfigFile),r)}catch(t){console.log("Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+t)}this.settings=r}buildDefaultSettings(){return JSON.parse(JSON.stringify(t("./Fable-Settings-Default")))}_configureEnvTemplating(t){this._PerformEnvTemplating=!t||!0!==t.NoEnvReplacement}_resolveEnv(t){for(const e in t)"object"==typeof t[e]?this._resolveEnv(t[e]):"string"==typeof t[e]&&(t[e]=this.settingsTemplateProcessor.parseSetting(t[e]))}_isObject(t){return"object"==typeof t&&!Array.isArray(t)}_deepMergeObjects(t,e){if(e&&this._isObject(e))return Object.keys(e).forEach((r=>{const n=e[r];if(this._isObject(n)){const e=t[r];if(e&&this._isObject(e))return void this._deepMergeObjects(e,n)}t[r]=n})),t}merge(t,e){let r="object"==typeof t?t:{},n="object"==typeof e?e:this.settings,i=JSON.parse(JSON.stringify(r));return n=this._deepMergeObjects(n,i),this._PerformEnvTemplating&&this._resolveEnv(n),this._configureEnvTemplating(n),n}fill(t){let e="object"==typeof t?t:{},r=JSON.parse(JSON.stringify(e));return this.settings=this._deepMergeObjects(r,this.settings),this.settings}}e.exports=o,e.exports.new=function(t){return new o(t)},e.exports.precedent=n},{"./Fable-Settings-Default":22,"./Fable-Settings-TemplateProcessor.js":23,precedent:27}],25:[function(t,e,r){e.exports=
|
|
47
47
|
/**
|
|
48
48
|
* Random Byte Generator - Browser version
|
|
49
49
|
*
|
|
@@ -60,7 +60,7 @@ class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getR
|
|
|
60
60
|
* @author Steven Velozo <steven@velozo.com>
|
|
61
61
|
* @module Fable UUID
|
|
62
62
|
*/
|
|
63
|
-
var n=t("./Fable-UUID-Random.js");class
|
|
63
|
+
var n=t("./Fable-UUID-Random.js");class i{constructor(t){this._UUIDModeRandom=!("object"!=typeof t||!t.hasOwnProperty("UUIDModeRandom"))&&1==t.UUIDModeRandom,this._UUIDLength="object"==typeof t&&t.hasOwnProperty("UUIDLength")?t.UUIDLength+0:8,this._UUIDRandomDictionary="object"==typeof t&&t.hasOwnProperty("UUIDDictionary")?t.UUIDDictionary+0:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.randomByteGenerator=new n,this._HexLookup=[];for(let t=0;t<256;++t)this._HexLookup[t]=(t+256).toString(16).substr(1)}bytesToUUID(t){let e=0;return[this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]]].join("")}generateUUIDv4(){new Array(16);var t=this.randomByteGenerator.generate();return t[6]=15&t[6]|64,t[8]=63&t[8]|128,this.bytesToUUID(t)}generateRandom(){let t="";for(let e=0;e<this._UUIDLength;e++)t+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));return t}getUUID(){return this._UUIDModeRandom?this.generateRandom():this.generateUUIDv4()}}e.exports=i,e.exports.new=function(t){return new i(t)}},{"./Fable-UUID-Random.js":25}],27:[function(t,e,r){
|
|
64
64
|
/**
|
|
65
65
|
* Precedent Meta-Templating
|
|
66
66
|
*
|
|
@@ -70,7 +70,7 @@ var n=t("./Fable-UUID-Random.js");class o{constructor(t){this._UUIDModeRandom=!(
|
|
|
70
70
|
*
|
|
71
71
|
* @description Process text streams, parsing out meta-template expressions.
|
|
72
72
|
*/
|
|
73
|
-
var n=t("./WordTree.js"),
|
|
73
|
+
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":28,"./WordTree.js":29}],28:[function(t,e,r){e.exports=
|
|
74
74
|
/**
|
|
75
75
|
* String Parser
|
|
76
76
|
*
|
|
@@ -90,11 +90,11 @@ class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer
|
|
|
90
90
|
*
|
|
91
91
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
92
92
|
*/
|
|
93
|
-
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
|
|
93
|
+
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}}},{}],30:[function(t,e,r){var n,i,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!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:s}catch(t){n=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var l,c=[],f=!1,h=-1;function p(){f&&l&&(f=!1,l.length?c=l.concat(c):h=-1,c.length&&d())}function d(){if(!f){var t=u(p);f=!0;for(var e=c.length;e;){for(l=c,c=[];++h<e;)l&&l[h].run();h=-1,e=c.length}l=null,f=!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 g(t,e){this.fun=t,this.array=e}function m(){}o.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];c.push(new g(t,e)),1!==c.length||f||u(d)},g.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],31:[function(t,e,r){(function(e,n){(function(){var i=t("process/browser.js").nextTick,o=Function.prototype.apply,s=Array.prototype.slice,a={},u=0;function l(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new l(o.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new l(o.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.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=u++,n=!(arguments.length<2)&&s.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":30,timers:31}],32:[function(t,e,r){var n=t("./Fable.js");"object"!=typeof window||window.hasOwnProperty("Fable")||(window.Fable=n),e.exports=n},{"./Fable.js":35}],33:[function(t,e,r){e.exports=class{constructor(t,e){this.fable=t,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=()=>""}extend(t,...e){return Object.assign(t,...e)}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=>`\\${this.templateEscapes[t]}`)).replace(this.Matchers.Interpolate||this.Matchers.GuaranteedNonMatch,((t,e)=>`'+\n(${decodeURIComponent(e)})+\n'`)).replace(this.Matchers.Evaluate||this.Matchers.GuaranteedNonMatch,((t,e)=>`';\n${decodeURIComponent(e)}\n;__p+='`))+"';\n",this.TemplateSource=`with(pTemplateDataObject||{}){\n${this.TemplateSource}}\n`,this.TemplateSource=`var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n${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())}}},{}],34:[function(t,e,r){const n=t("./Fable-Utility-Template.js"),i=t("async/waterfall"),o=t("async/eachLimit");e.exports=class{constructor(t){this.fable=t,this.waterfall=i,this.eachLimit=o}extend(t,...e){return Object.assign(t,...e)}template(t,e){return new n(this.fable,t).buildTemplateFunction(t,e)}chunk(t,e,r){let n=[...t],i="number"==typeof e?e:0,o=void 0!==r?r:[];if(i<=0)return o;for(;n.length;)o.push(n.splice(0,i));return o}}},{"./Fable-Utility-Template.js":33,"async/eachLimit":2,"async/waterfall":16}],35:[function(t,e,r){
|
|
94
94
|
/**
|
|
95
95
|
* Fable Application Services Support Library
|
|
96
96
|
* @license MIT
|
|
97
97
|
* @author <steven@velozo.com>
|
|
98
98
|
*/
|
|
99
|
-
const n=t("fable-settings")
|
|
99
|
+
const n=t("fable-settings"),i=t("fable-uuid"),o=t("fable-log"),s=t("./Fable-Utility.js");class a{constructor(t){let e=new n(t);this.settingsManager=e,this.libUUID=new i(this.settingsManager.settings),this.log=new o(this.settingsManager.settings),this.log.initialize(),this.Utility=new s(this),this.Dependencies={precedent:n.precedent}}get settings(){return this.settingsManager.settings}get fable(){return this}getUUID(){return this.libUUID.getUUID()}}e.exports=a,e.exports.new=function(t){return new a(t)},e.exports.LogProviderBase=o.LogProviderBase,e.exports.precedent=n.precedent},{"./Fable-Utility.js":34,"fable-log":21,"fable-settings":24,"fable-uuid":26}]},{},[32])(32)}));
|
|
100
100
|
//# sourceMappingURL=fable.min.js.map
|