Comparing version 2.0.5 to 3.0.1
@@ -1,58 +0,106 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Fable=e()}}((function(){return function e(t,o,r){function n(s,a){if(!o[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var g=o[s]={exports:{}};t[s][0].call(g.exports,(function(e){return n(t[s][1][e]||e)}),g,g.exports,e,t,o,r)}return o[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,o){ | ||
!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 s(i,a){if(!r[i]){if(!e[i]){var l="function"==typeof require&&require;if(!a&&l)return l(i,!0);if(o)return o(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[i]={exports:{}};e[i][0].call(h.exports,(function(t){return s(e[i][1][t]||t)}),h,h.exports,t,e,r,n)}return r[i].exports}for(var o="function"==typeof require&&require,i=0;i<n.length;i++)s(n[i]);return s}({1:[function(t,e,r){e.exports= | ||
/** | ||
* Base Logger Class | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
const r=new(e("fable-uuid").FableUUID);t.exports=class{constructor(e,t){this._Settings=e,this.loggerUUID=r.getUUID()}initialize(){}trace(e,t){this.write("trace",e,t)}debug(e,t){this.write("debug",e,t)}info(e,t){this.write("info",e,t)}warn(e,t){this.write("warn",e,t)}error(e,t){this.write("error",e,t)}fatal(e,t){this.write("fatal",e,t)}write(e,t,o){return!0}}},{"fable-uuid":9}],2:[function(e,t,o){ | ||
* Base Logger Class | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
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}}},{}],2:[function(t,e,r){ | ||
/** | ||
* Default Logger Provider Function --- Browser | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
getDefaultProviders=()=>{let t={};return t.console=e("./Fable-Log-Logger-Console.js"),t.default=t.console,t},t.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":4}],3:[function(e,t,o){t.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],4:[function(e,t,o){let r=e("./Fable-Log-BaseLogger.js");t.exports=class extends r{constructor(e,t){super(e),this._ShowTimeStamps=!!e.hasOwnProperty("ShowTimeStamps")&&1==e.ShowTimeStamps,this._FormattedTimeStamps=!!e.hasOwnProperty("FormattedTimeStamps")&&1==e.FormattedTimeStamps,this._ContextMessage=e.hasOwnProperty("Context")?` (${e.Context})`:t._Settings.hasOwnProperty("Product")?` (${t._Settings.Product})`:""}write(e,t,o){if(this._ShowTimeStamps&&this._FormattedTimeStamps){let o=(new Date).toISOString();console.log(`${o} [${e}]${this._ContextMessage} ${t}`)}else if(this._ShowTimeStamps){let o=+new Date;console.log(`${o} [${e}]${this._ContextMessage} ${t}`)}else console.log(`[${e}]${this._ContextMessage} ${t}`);void 0!==o&&console.log(JSON.stringify(o,null,4))}}},{"./Fable-Log-BaseLogger.js":1}],5:[function(e,t,o){ | ||
* Default Logger Provider Function | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
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":4}],3:[function(t,e,r){e.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],4:[function(t,e,r){let n=t("./Fable-Log-BaseLogger.js");e.exports=class extends n{constructor(t,e){super(t),this._ShowTimeStamps=!!t.hasOwnProperty("showtimestamps")&&1==t.showtimestamps,this._FormattedTimeStamps=!!t.hasOwnProperty("formattedtimestamps")&&1==t.formattedtimestamps,this._ContextMessage=t.hasOwnProperty("Context")?`(${t.Context})`:e._Settings.hasOwnProperty("Product")?`(${e._Settings.Product})`:"Unnamed_Log_Context",this._OutputLogLinesToConsole=!t.hasOwnProperty("outputloglinestoconsole")||t.outputloglinestoconsole,this._OutputObjectsToConsole=!t.hasOwnProperty("outputobjectstoconsole")||t.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 s=`${n}${this.prefixCache[t]}${e}`;return this._OutputLogLinesToConsole&&console.log(s),this._OutputObjectsToConsole&&void 0!==r&&console.log(JSON.stringify(r,null,2)),s}}},{"./Fable-Log-BaseLogger.js":1}],5:[function(t,e,r){ | ||
/** | ||
* Fable Logging Add-on | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable Logger | ||
*/ | ||
class r{constructor(t,o){let r="object"==typeof t?t:{};this._Settings=r,this._Providers=e("./Fable-Log-DefaultProviders.js"),this._StreamDefinitions=r.hasOwnProperty("LogStreams")?r.LogStreams:e("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=e=>e,this.uuid="string"==typeof r.Product?r.Product:"Default"}addLogger(e,t){if(this.activeLogStreams.hasOwnProperty(e.loggerUUID))return!1;switch(this.logStreams.push(e),this.activeLogStreams[e.loggerUUID]=!0,t){case"trace":this.logStreamsTrace.push(e);case"debug":this.logStreamsDebug.push(e);case"info":this.logStreamsInfo.push(e);case"warn":this.logStreamsWarn.push(e);case"error":this.logStreamsError.push(e);case"fatal":this.logStreamsFatal.push(e)}return!0}setDatumDecorator(e){this.datumDecorator="function"==typeof e?e:e=>e}trace(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsTrace.length;t++)this.logStreamsTrace[t].trace(e,o)}debug(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsDebug.length;t++)this.logStreamsDebug[t].debug(e,o)}info(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsInfo.length;t++)this.logStreamsInfo[t].info(e,o)}warn(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsWarn.length;t++)this.logStreamsWarn[t].warn(e,o)}error(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsError.length;t++)this.logStreamsError[t].error(e,o)}fatal(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsFatal.length;t++)this.logStreamsFatal[t].fatal(e,o)}initialize(){for(let e=0;e<this._StreamDefinitions.length;e++){let t=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[e]);this._Providers.hasOwnProperty(t.loggertype)?this.addLogger(new this._Providers[t.loggertype](t,this),t.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(t)}`)}for(let e=0;e<this.logStreams.length;e++)this.logStreams[e].initialize()}logTime(e,t){let o=void 0!==e?e:"Time",r=new Date;this.info(`${o} ${r} (epoch ${+r})`,t)}getTimeStamp(){return+new Date}getTimeDelta(e){return+new Date-e}logTimeDelta(e,t,o){let r=void 0!==t?t:"Time Measurement",n=+new Date;this.info(`${r} logged at (epoch ${+n}) took (${e}ms)`,o)}logTimeDeltaHuman(e,t,o){let r=void 0!==t?t:"Time Measurement",n=+new Date,i=parseInt(e%1e3),s=parseInt(e/1e3%60),a=parseInt(e/6e4%60),l=parseInt(e/36e5);i=i<10?"00"+i:i<100?"0"+i:i,s=s<10?"0"+s:s,a=a<10?"0"+a:a,l=l<10?"0"+l:l,this.info(`${r} logged at (epoch ${+n}) took (${e}ms) or (${l}:${a}:${s}.${i})`,o)}logTimeDeltaRelative(e,t,o){this.logTimeDelta(this.getTimeDelta(e),t,o)}logTimeDeltaRelativeHuman(e,t,o){this.logTimeDeltaHuman(this.getTimeDelta(e),t,o)}}t.exports={new:function(e){return new r(e)},FableLog:r}},{"./Fable-Log-DefaultProviders.js":2,"./Fable-Log-DefaultStreams.json":3}],6:[function(e,t,o){t.exports={Product:"ApplicationNameHere",ProductVersion:"0.0.0",ConfigFile:!1,LogStreams:[{level:"trace"}]}},{}],7:[function(e,t,o){(function(o){(function(){ | ||
* Fable Logging Add-on | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable Logger | ||
*/ | ||
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",s=+new Date;this.info(`${n} logged at (epoch ${+s}) took (${t}ms)`,r)}logTimeDeltaHuman(t,e,r){let n=void 0!==e?e:"Time Measurement",s=+new Date,o=parseInt(t%1e3),i=parseInt(t/1e3%60),a=parseInt(t/6e4%60),l=parseInt(t/36e5);o=o<10?"00"+o:o<100?"0"+o:o,i=i<10?"0"+i:i,a=a<10?"0"+a:a,l=l<10?"0"+l:l,this.info(`${n} logged at (epoch ${+s}) took (${t}ms) or (${l}:${a}:${i}.${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={new:function(t){return new n(t)},FableLog:n}},{"./Fable-Log-DefaultProviders-Node.js":2,"./Fable-Log-DefaultStreams.json":3}],6:[function(t,e,r){e.exports={Product:"ApplicationNameHere",ProductVersion:"0.0.0",ConfigFile:!1,LogStreams:[{level:"trace"}]}},{}],7:[function(t,e,r){(function(t){(function(){e.exports= | ||
/** | ||
* Fable Settings Add-on | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable Settings | ||
*/ | ||
const r=e("match-all");class n{constructor(t){this.default=this.buildDefaultSettings();let o=this.merge(t,this.buildDefaultSettings());if(this._PerformEnvTemplating=!o||!0!==o.NoEnvReplacement,this.base=JSON.parse(JSON.stringify(o)),o.DefaultConfigFile)try{o=this.merge(e(o.DefaultConfigFile),o)}catch(e){console.log("Fable-Settings Warning: Default configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+e)}if(o.ConfigFile)try{o=this.merge(e(o.ConfigFile),o)}catch(e){console.log("Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+e)}this.settings=o}buildDefaultSettings(){return JSON.parse(JSON.stringify(e("./Fable-Settings-Default")))}_resolveEnv(e){for(const t in e){const n=e[t];if("object"==typeof n)this._resolveEnv(n);else if("string"==typeof n&&n.indexOf("${")>=0){r(n,/\$\{(.*?)\}/g).toArray().forEach((r=>{const n=r.split("|");let i=o.env[n[0]]||"";!i&&n.length>1&&(i=n[1]),e[t]=e[t].replace("${"+r+"}",i)}))}}}_isObject(e){return"object"==typeof e&&!Array.isArray(e)}_deepMergeObjects(e,t){if(t&&this._isObject(t))return Object.keys(t).forEach((o=>{const r=t[o];if(this._isObject(r)){const t=e[o];if(t&&this._isObject(t))return void this._deepMergeObjects(t,r)}e[o]=r})),e}merge(e,t){let o="object"==typeof e?e:{},r="object"==typeof t?t:this.settings,n=JSON.parse(JSON.stringify(o));return r=this._deepMergeObjects(r,n),this._PerformEnvTemplating&&this._resolveEnv(r),r}fill(e){let t="object"==typeof e?e:{},o=JSON.parse(JSON.stringify(t));return this.settings=this._deepMergeObjects(o,this.settings),this.settings}}t.exports={new:function(e){return new n(e)},FableSettings:n}}).call(this)}).call(this,e("_process"))},{"./Fable-Settings-Default":6,_process:11,"match-all":10}],8:[function(e,t,o){t.exports= | ||
* Fable Settings Template Processor | ||
* | ||
* This class allows environment variables to come in via templated expressions, and defaults to be set. | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable Settings | ||
*/ | ||
class{constructor(e){this.templateProcessor=new e.precedent,this.templateProcessor.addPattern("${","}",(e=>{let r=e.trim(),n=r.indexOf("|"),s=r.substring(n+1),o=n>-1?r.substring(0,n):r;return t.env.hasOwnProperty(o)?t.env[o]:s}))}parseSetting(t){return this.templateProcessor.parseString(t)}}}).call(this)}).call(this,t("_process"))},{_process:14}],8:[function(t,e,r){ | ||
/** | ||
* Random Byte Generator - Browser version | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)}generateWhatWGBytes(){let e=new Uint8Array(16);return this.getRandomValues(e),e}generateRandomBytes(){let e=new Uint8Array(16);for(let t,o=0;o<16;o++)0==(3&o)&&(t=4294967296*Math.random()),e[o]=t>>>((3&o)<<3)&255;return e}generate(){return this.getRandomValues?this.generateWhatWGBytes():this.generateRandomBytes()}}},{}],9:[function(e,t,o){ | ||
* Fable Settings Add-on | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable Settings | ||
*/ | ||
const n=t("precedent"),s=t("./Fable-Settings-TemplateProcessor.js");class o{constructor(e){this.dependencies={precedent:n},this.settingsTemplateProcessor=new s(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,s=JSON.parse(JSON.stringify(r));return n=this._deepMergeObjects(n,s),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={new:function(t){return new o(t)},FableSettings:o}},{"./Fable-Settings-Default":6,"./Fable-Settings-TemplateProcessor.js":7,precedent:11}],9:[function(t,e,r){e.exports= | ||
/** | ||
* Fable UUID Generator | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable UUID | ||
*/ | ||
var r=e("./Fable-UUID-Random.js");class n{constructor(e){this._UUIDModeRandom=!("object"!=typeof e||!e.hasOwnProperty("UUIDModeRandom"))&&1==e.UUIDModeRandom,this._UUIDLength="object"==typeof e&&e.hasOwnProperty("UUIDLength")?e.UUIDLength+0:8,this._UUIDRandomDictionary="object"==typeof e&&e.hasOwnProperty("UUIDDictionary")?e.UUIDDictionary+0:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.randomByteGenerator=new r,this._HexLookup=[];for(let e=0;e<256;++e)this._HexLookup[e]=(e+256).toString(16).substr(1)}bytesToUUID(e){let t=0;return[this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]]].join("")}generateUUIDv4(){new Array(16);var e=this.randomByteGenerator.generate();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,this.bytesToUUID(e)}generateRandom(){let e="";for(let t=0;t<this._UUIDLength;t++)e+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));return e}getUUID(){return this._UUIDModeRandom?this.generateRandom():this.generateUUIDv4()}}t.exports={new:function(e){return new n(e)},FableUUID:n}},{"./Fable-UUID-Random.js":8}],10:[function(e,t,o){"use strict";t.exports=function(e,t){return{input:e,regex:t,next:function(){var e=this.nextRaw();if(e)for(var t=1;t<e.length;t++)if(e[t])return e[t];return null},nextRaw:function(){return this.regex.exec(this.input)},toArray:function(){for(var e=[],t=null;t=this.next();)e.push(t);return e},reset:function(e){return this.regex.lastIndex=e||0}}}},{}],11:[function(e,t,o){var r,n,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,g=[],h=!1,c=-1;function f(){h&&u&&(h=!1,u.length?g=u.concat(g):c=-1,g.length&&m())}function m(){if(!h){var e=l(f);h=!0;for(var t=g.length;t;){for(u=g,g=[];++c<t;)u&&u[c].run();c=-1,t=g.length}u=null,h=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function d(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)t[o-1]=arguments[o];g.push(new p(e,t)),1!==g.length||h||l(m)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=d,i.addListener=d,i.once=d,i.off=d,i.removeListener=d,i.removeAllListeners=d,i.emit=d,i.prependListener=d,i.prependOnceListener=d,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],12:[function(e,t,o){ | ||
* Random Byte Generator - Browser version | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
*/ | ||
class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)}generateWhatWGBytes(){let t=new Uint8Array(16);return this.getRandomValues(t),t}generateRandomBytes(){let t=new Uint8Array(16);for(let e,r=0;r<16;r++)0==(3&r)&&(e=4294967296*Math.random()),t[r]=e>>>((3&r)<<3)&255;return t}generate(){return this.getRandomValues?this.generateWhatWGBytes():this.generateRandomBytes()}}},{}],10:[function(t,e,r){ | ||
/** | ||
* @license MIT | ||
* @author <steven@velozo.com> | ||
*/ | ||
const r=e("fable-settings").FableSettings,n=e("fable-uuid").FableUUID,i=e("fable-log").FableLog;class s{constructor(e){let t=new r(e);this.settingsManager=t,this.libUUID=new n(this.settingsManager.settings),this.log=new i(this.settingsManager.settings),this.log.initialize()}get settings(){return this.settingsManager.settings}get fable(){return this}getUUID(){return this.libUUID.getUUID()}}t.exports={new:function(e){return new s(e)},Fable:s}},{"fable-log":5,"fable-settings":7,"fable-uuid":9}]},{},[12])(12)})); | ||
* Fable UUID Generator | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* @module Fable UUID | ||
*/ | ||
var n=t("./Fable-UUID-Random.js");class s{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={new:function(t){return new s(t)},FableUUID:s}},{"./Fable-UUID-Random.js":9}],11:[function(t,e,r){ | ||
/** | ||
* Precedent Meta-Templating | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* | ||
* @description Process text streams, parsing out meta-template expressions. | ||
*/ | ||
var n=t("./WordTree.js"),s=t("./StringParser.js");e.exports=class{constructor(){this.WordTree=new n,this.StringParser=new s,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":12,"./WordTree.js":13}],12:[function(t,e,r){e.exports= | ||
/** | ||
* String Parser | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* | ||
* @description Parse a string, properly processing each matched token in the word tree. | ||
*/ | ||
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 r=this.newParserState(e);for(var n=0;n<t.length;n++)this.parseCharacter(t[n],r);return this.flushOutputBuffer(r),r.Output}}},{}],13:[function(t,e,r){e.exports= | ||
/** | ||
* Word Tree | ||
* | ||
* @license MIT | ||
* | ||
* @author Steven Velozo <steven@velozo.com> | ||
* | ||
* @description Create a tree (directed graph) of Javascript objects, one character per object. | ||
*/ | ||
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 s=0;s<t.length;s++)n=this.addChild(n,t,s);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}}},{}],14:[function(t,e,r){var n,s,o=e.exports={};function i(){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===i||!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:i}catch(t){n=i}try{s="function"==typeof clearTimeout?clearTimeout:a}catch(t){s=a}}();var u,h=[],g=!1,c=-1;function f(){g&&u&&(g=!1,u.length?h=u.concat(h):c=-1,h.length&&p())}function p(){if(!g){var t=l(f);g=!0;for(var e=h.length;e;){for(u=h,h=[];++c<e;)u&&u[c].run();c=-1,e=h.length}u=null,g=!1,function(t){if(s===clearTimeout)return clearTimeout(t);if((s===a||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(t);try{return s(t)}catch(e){try{return s.call(null,t)}catch(e){return s.call(this,t)}}}(t)}}function d(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];h.push(new d(t,e)),1!==h.length||g||l(p)},d.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}},{}],15:[function(t,e,r){ | ||
/** | ||
* Simple browser shim loader - assign the npm module to a window global automatically | ||
* | ||
* @license MIT | ||
* @author <steven@velozo.com> | ||
*/ | ||
var n=t("./Fable.js");"object"!=typeof window||window.hasOwnProperty("Fable")||(window.Fable=n),e.exports=n},{"./Fable.js":16}],16:[function(t,e,r){ | ||
/** | ||
* @license MIT | ||
* @author <steven@velozo.com> | ||
*/ | ||
const n=t("fable-settings").FableSettings,s=t("fable-uuid").FableUUID,o=t("fable-log").FableLog;class i{constructor(t){let e=new n(t);this.settingsManager=e,this.libUUID=new s(this.settingsManager.settings),this.log=new o(this.settingsManager.settings),this.log.initialize()}get settings(){return this.settingsManager.settings}get fable(){return this}getUUID(){return this.libUUID.getUUID()}}e.exports={new:function(t){return new i(t)},Fable:i}},{"fable-log":5,"fable-settings":8,"fable-uuid":10}]},{},[15])(15)})); | ||
//# sourceMappingURL=fable.min.js.map |
'use strict'; | ||
// We aren't abstracting this yet but here's the ... "Config" | ||
const _CONFIG = ( | ||
{ | ||
// The input source file that should be passed to browserify: | ||
// (if you need to auto-instantiate an object, for instance) | ||
EntrypointInputSourceFile: `${__dirname}/source/Fable-Browser-Shim.js`, | ||
// The name of the packaged object to be passed to browserify: | ||
// (browserify sets this to global scope and window.SOMEOBJECTNAMEHERE where SOMEOBJECTNAMEHERE is the string below) | ||
LibraryObjectName: `Fable`, | ||
// The folder to write the library files and maps out to: | ||
LibraryOutputFolder: `${__dirname}/dist/`, | ||
// The name of the unminified version of the packaged library, for easy debugging: | ||
LibraryUniminifiedFileName: `fable.js`, | ||
// The name of the minified version of the packaged library, for production release: | ||
LibraryMinifiedFileName: `fable.min.js` | ||
}); | ||
// ---> Boilerplate Browser Uglification and Packaging <--- \\ | ||
const libBrowserify = require('browserify'); | ||
@@ -9,34 +32,31 @@ const libGulp = require('gulp'); | ||
const libTerser = require('gulp-terser'); | ||
const libSourcemaps = require('gulp-sourcemaps'); | ||
const libGulpUtil = require('gulp-util'); | ||
const libGulpBabel = require('gulp-babel'); | ||
const libBabel = require('gulp-babel'); | ||
const libTerser = require('gulp-terser'); | ||
// Build the module for the browser | ||
// This gulp task is taken from the gulp recipe repository: | ||
// https://github.com/gulpjs/gulp/blob/master/docs/recipes/browserify-uglify-sourcemap.md | ||
libGulp.task('minified', | ||
() => { | ||
// set up the custom browserify instance for this task | ||
var tmpBrowserify = libBrowserify( | ||
{ | ||
entries: './source/Fable.js', | ||
standalone: 'Fable', | ||
debug: true | ||
}); | ||
return tmpBrowserify.bundle() | ||
.pipe(libVinylSourceStream('fable.min.js')) | ||
.pipe(libVinylBuffer()) | ||
.pipe(libSourcemaps.init({loadMaps: true})) | ||
// Add transformation tasks to the pipeline here. | ||
.pipe(libTerser()) | ||
.on('error', libGulpUtil.log) | ||
.pipe(libSourcemaps.write('./')) | ||
.pipe(libGulp.dest('./dist/')); | ||
() => { | ||
// set up the custom browserify instance for this task | ||
var tmpBrowserify = libBrowserify( | ||
{ | ||
entries: _CONFIG.EntrypointInputSourceFile, | ||
standalone: _CONFIG.LibraryObjectName, | ||
debug: true | ||
}); | ||
return tmpBrowserify.bundle() | ||
.pipe(libVinylSourceStream(_CONFIG.LibraryMinifiedFileName)) | ||
.pipe(libVinylBuffer()) | ||
.pipe(libSourcemaps.init({loadMaps: true})) | ||
// Add transformation tasks to the pipeline here. | ||
.pipe(libBabel()) | ||
.pipe(libTerser()) | ||
.on('error', libGulpUtil.log) | ||
.pipe(libSourcemaps.write('./')) | ||
.pipe(libGulp.dest(_CONFIG.LibraryOutputFolder)); | ||
}); | ||
// Build the module for the browser | ||
// This gulp task is taken from the gulp recipe repository: | ||
// https://github.com/gulpjs/gulp/blob/master/docs/recipes/browserify-uglify-sourcemap.md | ||
libGulp.task('debug', | ||
@@ -47,4 +67,4 @@ () => { | ||
{ | ||
entries: './source/Fable.js', | ||
standalone: 'Fable', | ||
entries: _CONFIG.EntrypointInputSourceFile, | ||
standalone: _CONFIG.LibraryObjectName, | ||
debug: true | ||
@@ -54,6 +74,7 @@ }); | ||
return tmpBrowserify.bundle() | ||
.pipe(libVinylSourceStream('fable.js')) | ||
.pipe(libVinylSourceStream(_CONFIG.LibraryUniminifiedFileName)) | ||
.pipe(libVinylBuffer()) | ||
.pipe(libBabel()) | ||
.on('error', libGulpUtil.log) | ||
.pipe(libGulp.dest('./dist/')); | ||
.pipe(libGulp.dest(_CONFIG.LibraryOutputFolder)); | ||
}); | ||
@@ -65,2 +86,2 @@ | ||
libGulp.series('debug', 'minified') | ||
); | ||
); |
{ | ||
"name": "fable", | ||
"version": "2.0.5", | ||
"version": "3.0.1", | ||
"description": "An entity behavior management and API bundling library.", | ||
@@ -8,6 +8,26 @@ "main": "source/Fable.js", | ||
"start": "node source/Fable.js", | ||
"coverage": "./node_modules/nyc/bin/nyc.js --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec", | ||
"test": "./node_modules/mocha/bin/_mocha -u tdd -R spec", | ||
"harness": "node debug/Harness.js" | ||
"coverage": "./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec", | ||
"test": "./node_modules/.bin/mocha -u tdd -R spec", | ||
"build": "./node_modules/.bin/gulp build", | ||
"docker-dev-build-image": "docker build ./ -f Dockerfile_LUXURYCode -t retold/fable:local", | ||
"docker-dev-run": "docker run -it -d --name retold-fable-dev -p 30001:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/fable:local" | ||
}, | ||
"mocha": { | ||
"diff": true, | ||
"extension": [ | ||
"js" | ||
], | ||
"package": "./package.json", | ||
"reporter": "spec", | ||
"slow": "75", | ||
"timeout": "5000", | ||
"ui": "tdd", | ||
"watch-files": [ | ||
"source/**/*.js", | ||
"test/**/*.js" | ||
], | ||
"watch-ignore": [ | ||
"lib/vendor" | ||
] | ||
}, | ||
"repository": { | ||
@@ -28,14 +48,11 @@ "type": "git", | ||
"devDependencies": { | ||
"@babel/core": "^7.4.4", | ||
"@babel/preset-env": "^7.4.4", | ||
"async": "^2.6.2", | ||
"browserify": "^16.2.3", | ||
"chai": "4.2.0", | ||
"browserify": "^17.0.0", | ||
"chai": "4.3.7", | ||
"gulp": "^4.0.2", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-sourcemaps": "^2.6.5", | ||
"gulp-terser": "^1.1.7", | ||
"gulp-sourcemaps": "^3.0.0", | ||
"gulp-terser": "^2.1.0", | ||
"gulp-util": "^3.0.8", | ||
"mocha": "6.1.4", | ||
"nyc": "^14.1.0", | ||
"mocha": "10.2.0", | ||
"nyc": "^15.1.0", | ||
"vinyl-buffer": "^1.0.1", | ||
@@ -45,6 +62,6 @@ "vinyl-source-stream": "^2.0.0" | ||
"dependencies": { | ||
"fable-log": "^2.0.0", | ||
"fable-settings": "^2.0.0", | ||
"fable-uuid": "^2.0.0" | ||
"fable-log": "^3.0.1", | ||
"fable-settings": "^3.0.0", | ||
"fable-uuid": "^3.0.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
195727
11
18
1588
11
+ Addedfable-log@3.0.16(transitive)
+ Addedfable-serviceproviderbase@3.0.15(transitive)
+ Addedfable-settings@3.0.12(transitive)
+ Addedfable-uuid@3.0.11(transitive)
+ Addedprecedent@1.0.15(transitive)
- RemovedCBuffer@2.0.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbunyan@1.8.15(transitive)
- Removedbunyan-logstash-tcp@1.0.0(transitive)
- Removedbunyan-prettystream@0.1.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddtrace-provider@0.8.8(transitive)
- Removedfable-log@2.0.7(transitive)
- Removedfable-settings@2.0.5(transitive)
- Removedfable-uuid@2.0.2(transitive)
- Removedglob@6.0.4(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedmatch-all@1.2.6(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedmoment@2.30.1(transitive)
- Removedmv@2.1.1(transitive)
- Removednan@2.22.0(transitive)
- Removedncp@2.0.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrimraf@2.4.5(transitive)
- Removedsafe-json-stringify@1.2.0(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedfable-log@^3.0.1
Updatedfable-settings@^3.0.0
Updatedfable-uuid@^3.0.1