fable 3.0.97 → 3.0.98

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.
Files changed (44) hide show
  1. package/dist/fable.compatible.js +12 -12
  2. package/dist/fable.compatible.min.js +2 -2
  3. package/dist/fable.compatible.min.js.map +1 -1
  4. package/dist/fable.js +11 -11
  5. package/dist/fable.min.js +2 -2
  6. package/dist/fable.min.js.map +1 -1
  7. package/package.json +3 -3
  8. package/source/services/Fable-Service-Anticipate.js +2 -0
  9. package/source/services/Fable-Service-MetaTemplate/MetaTemplate-StringParser.js +19 -12
  10. package/source/services/Fable-Service-MetaTemplate.js +1 -1
  11. package/retold-harness/bookstore-serve-api.js +0 -41
  12. package/retold-harness/configuration-bookstore-serve-api.js +0 -30
  13. package/retold-harness/docker_scripts/MySQL-Laden-Entry.sh +0 -17
  14. package/retold-harness/model/Model-Extended.json +0 -915
  15. package/retold-harness/model/Model-PICT.json +0 -1
  16. package/retold-harness/model/Model.json +0 -280
  17. package/retold-harness/model/bookstore-api-endpoint-exercises.paw +0 -0
  18. package/retold-harness/model/ddl/BookStore.ddl +0 -66
  19. package/retold-harness/model/generated_diagram/README.md +0 -1
  20. package/retold-harness/model/generated_diagram/Stricture_Output.dot +0 -13
  21. package/retold-harness/model/generated_diagram/Stricture_Output.png +0 -0
  22. package/retold-harness/model/generated_documentation/Dictionary.md +0 -18
  23. package/retold-harness/model/generated_documentation/Model-Author.md +0 -20
  24. package/retold-harness/model/generated_documentation/Model-Book.md +0 -26
  25. package/retold-harness/model/generated_documentation/Model-BookAuthorJoin.md +0 -14
  26. package/retold-harness/model/generated_documentation/Model-BookPrice.md +0 -25
  27. package/retold-harness/model/generated_documentation/Model-Review.md +0 -22
  28. package/retold-harness/model/generated_documentation/ModelChangeTracking.md +0 -17
  29. package/retold-harness/model/generated_documentation/README.md +0 -1
  30. package/retold-harness/model/manual_scripts/DropTables.sql +0 -5
  31. package/retold-harness/model/manual_scripts/MySQL-Laden-Entry.sh +0 -17
  32. package/retold-harness/model/manual_scripts/MySQL-Security.sql +0 -5
  33. package/retold-harness/model/manual_scripts/README.md +0 -2
  34. package/retold-harness/model/manual_scripts/my.cnf +0 -4
  35. package/retold-harness/model/meadow/Model-MeadowSchema-Author.json +0 -220
  36. package/retold-harness/model/meadow/Model-MeadowSchema-Book.json +0 -268
  37. package/retold-harness/model/meadow/Model-MeadowSchema-BookAuthorJoin.json +0 -172
  38. package/retold-harness/model/meadow/Model-MeadowSchema-BookPrice.json +0 -260
  39. package/retold-harness/model/meadow/Model-MeadowSchema-Review.json +0 -236
  40. package/retold-harness/model/meadow/README.md +0 -1
  41. package/retold-harness/model/sql_create/BookStore-CreateDatabase.mysql.sql +0 -116
  42. package/retold-harness/model/sql_create/BookStore-DeleteAndRepopulateTables.sql +0 -194
  43. package/retold-harness/model/sql_create/MySQL-Security.sql +0 -5
  44. package/retold-harness/model/sql_create/README.md +0 -1
package/dist/fable.js CHANGED
@@ -539,7 +539,7 @@ if(val.charCodeAt(0)===0x22){val=val.slice(1,-1);}obj[key]=tryDecode(val,dec);}i
539
539
  * @param {object} [options]
540
540
  * @return {string}
541
541
  * @public
542
- */function serialize(name,val,options){var opt=options||{};var enc=opt.encode||encode;if(typeof enc!=='function'){throw new TypeError('option encode is invalid');}if(!fieldContentRegExp.test(name)){throw new TypeError('argument name is invalid');}var value=enc(val);if(value&&!fieldContentRegExp.test(value)){throw new TypeError('argument val is invalid');}var str=name+'='+value;if(null!=opt.maxAge){var maxAge=opt.maxAge-0;if(isNaN(maxAge)||!isFinite(maxAge)){throw new TypeError('option maxAge is invalid');}str+='; Max-Age='+Math.floor(maxAge);}if(opt.domain){if(!fieldContentRegExp.test(opt.domain)){throw new TypeError('option domain is invalid');}str+='; Domain='+opt.domain;}if(opt.path){if(!fieldContentRegExp.test(opt.path)){throw new TypeError('option path is invalid');}str+='; Path='+opt.path;}if(opt.expires){var expires=opt.expires;if(!isDate(expires)||isNaN(expires.valueOf())){throw new TypeError('option expires is invalid');}str+='; Expires='+expires.toUTCString();}if(opt.httpOnly){str+='; HttpOnly';}if(opt.secure){str+='; Secure';}if(opt.priority){var priority=typeof opt.priority==='string'?opt.priority.toLowerCase():opt.priority;switch(priority){case'low':str+='; Priority=Low';break;case'medium':str+='; Priority=Medium';break;case'high':str+='; Priority=High';break;default:throw new TypeError('option priority is invalid');}}if(opt.sameSite){var sameSite=typeof opt.sameSite==='string'?opt.sameSite.toLowerCase():opt.sameSite;switch(sameSite){case true:str+='; SameSite=Strict';break;case'lax':str+='; SameSite=Lax';break;case'strict':str+='; SameSite=Strict';break;case'none':str+='; SameSite=None';break;default:throw new TypeError('option sameSite is invalid');}}return str;}/**
542
+ */function serialize(name,val,options){var opt=options||{};var enc=opt.encode||encode;if(typeof enc!=='function'){throw new TypeError('option encode is invalid');}if(!fieldContentRegExp.test(name)){throw new TypeError('argument name is invalid');}var value=enc(val);if(value&&!fieldContentRegExp.test(value)){throw new TypeError('argument val is invalid');}var str=name+'='+value;if(null!=opt.maxAge){var maxAge=opt.maxAge-0;if(isNaN(maxAge)||!isFinite(maxAge)){throw new TypeError('option maxAge is invalid');}str+='; Max-Age='+Math.floor(maxAge);}if(opt.domain){if(!fieldContentRegExp.test(opt.domain)){throw new TypeError('option domain is invalid');}str+='; Domain='+opt.domain;}if(opt.path){if(!fieldContentRegExp.test(opt.path)){throw new TypeError('option path is invalid');}str+='; Path='+opt.path;}if(opt.expires){var expires=opt.expires;if(!isDate(expires)||isNaN(expires.valueOf())){throw new TypeError('option expires is invalid');}str+='; Expires='+expires.toUTCString();}if(opt.httpOnly){str+='; HttpOnly';}if(opt.secure){str+='; Secure';}if(opt.partitioned){str+='; Partitioned';}if(opt.priority){var priority=typeof opt.priority==='string'?opt.priority.toLowerCase():opt.priority;switch(priority){case'low':str+='; Priority=Low';break;case'medium':str+='; Priority=Medium';break;case'high':str+='; Priority=High';break;default:throw new TypeError('option priority is invalid');}}if(opt.sameSite){var sameSite=typeof opt.sameSite==='string'?opt.sameSite.toLowerCase():opt.sameSite;switch(sameSite){case true:str+='; SameSite=Strict';break;case'lax':str+='; SameSite=Lax';break;case'strict':str+='; SameSite=Strict';break;case'none':str+='; SameSite=None';break;default:throw new TypeError('option sameSite is invalid');}}return str;}/**
543
543
  * URL-decode string value. Optimized to skip native call when no %.
544
544
  *
545
545
  * @param {string} str
@@ -547,7 +547,7 @@ if(val.charCodeAt(0)===0x22){val=val.slice(1,-1);}obj[key]=tryDecode(val,dec);}i
547
547
  */function decode(str){return str.indexOf('%')!==-1?decodeURIComponent(str):str;}/**
548
548
  * URL-encode value.
549
549
  *
550
- * @param {string} str
550
+ * @param {string} val
551
551
  * @returns {string}
552
552
  */function encode(val){return encodeURIComponent(val);}/**
553
553
  * Determine if value is a Date.
@@ -2875,9 +2875,9 @@ if(this.servicesMap[pServiceType].hasOwnProperty(pServiceHash)){if(!this.hasOwnP
2875
2875
  function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports.new=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceBase;module.exports.CoreServiceProviderBase=libFableServiceBase.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"./services/Fable-Service-Anticipate.js":120,"./services/Fable-Service-CSVParser.js":121,"./services/Fable-Service-DataFormat.js":122,"./services/Fable-Service-DataGeneration.js":124,"./services/Fable-Service-DateManipulation.js":125,"./services/Fable-Service-EnvironmentData.js":126,"./services/Fable-Service-FilePersistence.js":127,"./services/Fable-Service-MetaTemplate.js":128,"./services/Fable-Service-Operation.js":132,"./services/Fable-Service-RestClient.js":133,"./services/Fable-Service-Template.js":134,"./services/Fable-Service-Utility.js":135,"cachetrax":22,"fable-log":43,"fable-serviceproviderbase":44,"fable-settings":47,"fable-uuid":49,"manyfest":72}],120:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceAnticipate extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='AsyncAnticipate';// The queue of operations waiting to run.
2876
2876
  this.operationQueue=[];this.erroredOperations=[];this.executingOperationCount=0;this.completedOperationCount=0;this.maxOperations=1;this.lastError=undefined;this.waitingFunctions=[];}checkQueue(){// This checks to see if we need to start any operations.
2877
2877
  if(this.operationQueue.length>0&&this.executingOperationCount<this.maxOperations){let tmpOperation=this.operationQueue.shift();this.executingOperationCount+=1;tmpOperation(this.buildAnticipatorCallback());}else if(this.waitingFunctions.length>0&&this.executingOperationCount<1){// If there are no operations left, and we have waiting functions, call them.
2878
- for(let i=0;i<this.waitingFunctions.length;i++){this.waitingFunctions[i](this.lastError);}// Reset our state
2878
+ for(let i=0;i<this.waitingFunctions.length;i++){this.log.trace('Calling waiting function.');this.waitingFunctions[i](this.lastError);}// Reset our state
2879
2879
  this.lastError=undefined;this.waitingFunctions=[];}}// Expects a function fAsynchronousFunction(fCallback)
2880
- anticipate(fAsynchronousFunction){this.operationQueue.push(fAsynchronousFunction);this.checkQueue();}buildAnticipatorCallback(){// This uses closure-scoped state to track the callback state
2880
+ anticipate(fAsynchronousFunction){this.log.trace('Adding a function...');this.operationQueue.push(fAsynchronousFunction);this.checkQueue();}buildAnticipatorCallback(){// This uses closure-scoped state to track the callback state
2881
2881
  let tmpCallbackState={Called:false,Error:undefined,OperationSet:this};return hoistedCallback;function hoistedCallback(pError){if(tmpCallbackState.Called){// If they call the callback twice, throw an error
2882
2882
  throw new Error("Anticipation async callback called twice...");}tmpCallbackState.Called=true;tmpCallbackState.error=pError;tmpCallbackState.OperationSet.executingOperationCount-=1;tmpCallbackState.OperationSet.completedOperationCount+=1;tmpCallbackState.OperationSet.checkQueue();}}wait(fCallback){this.waitingFunctions.push(fCallback);this.checkQueue();}}module.exports=FableServiceAnticipate;},{"fable-serviceproviderbase":44}],121:[function(require,module,exports){const libFableServiceProviderBase=require('fable-serviceproviderbase');/**
2883
2883
  * Parsing CSVs. Why? Because it's a thing that needs to be done.
@@ -3131,7 +3131,7 @@ return this.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCrea
3131
3131
  * @author Steven Velozo <steven@velozo.com>
3132
3132
  * @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
3133
3133
  */const libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");const libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");class FableServiceMetaTemplate extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='MetaTemplate';this.WordTree=new libWordTree();// In order to allow asynchronous template processing we need to use the async.eachLimit function
3134
- this.StringParser=new libStringParser(this.fable.services.Utility.eachLimit);this.ParseTree=this.WordTree.ParseTree;}/**
3134
+ this.StringParser=new libStringParser(this.fable);this.ParseTree=this.WordTree.ParseTree;}/**
3135
3135
  * Add a Pattern to the Parse Tree
3136
3136
  * @method addPattern
3137
3137
  * @param {Object} pTree - A node on the parse tree to push the characters into
@@ -3150,7 +3150,7 @@ this.StringParser=new libStringParser(this.fable.services.Utility.eachLimit);thi
3150
3150
  * @description Parse a string, properly processing each matched token in the word tree.
3151
3151
  */class StringParser{/**
3152
3152
  * StringParser Constructor
3153
- */constructor(fEachLimit){this.eachLimit=fEachLimit;}/**
3153
+ */constructor(pFable){this.fable=pFable;}/**
3154
3154
  * Create a fresh parsing state object to work with.
3155
3155
  * @method newParserState
3156
3156
  * @param {Object} pParseTree - A node on the parse tree to begin parsing from (usually root)
@@ -3194,9 +3194,9 @@ if(pParserState.ParseTree.hasOwnProperty(pCharacter)){// ... assign the root nod
3194
3194
  this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserState);pParserState.Pattern=pParserState.ParseTree[pCharacter];pParserState.PatternMatch=true;return true;}else{this.appendOutputBuffer(pCharacter,pParserState);}}return false;}executePatternAsync(pParserState,pData,fCallback){// ... this is the end of a pattern, cut off the end tag and parse it.
3195
3195
  // Trim the start and end tags off the output buffer now
3196
3196
  if(pParserState.Pattern.isAsync&&!pParserState.Pattern.isBoth){// Run the function
3197
- return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,(pError,pAsyncOutput)=>{if(pError){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;this.resetOutputBuffer(pParserState);return setTimeout(fCallback,0);});}else if(pParserState.Pattern.isAsync&&pParserState.Pattern.isBoth){// Run the function when both async and non async were provided with the pattern
3198
- return pParserState.Pattern.ParseAsync(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,(pError,pAsyncOutput)=>{if(pError){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;this.resetOutputBuffer(pParserState);return setTimeout(fCallback,0);});}else{// Run the t*mplate function
3199
- pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);this.resetOutputBuffer(pParserState);return setTimeout(fCallback,0);}}/**
3197
+ return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,(pError,pAsyncOutput)=>{if(pError){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;this.resetOutputBuffer(pParserState);return fCallback();});}else if(pParserState.Pattern.isAsync&&pParserState.Pattern.isBoth){// Run the function when both async and non async were provided with the pattern
3198
+ return pParserState.Pattern.ParseAsync(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,(pError,pAsyncOutput)=>{if(pError){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;this.resetOutputBuffer(pParserState);return fCallback();});}else{// Run the t*mplate function
3199
+ pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);this.resetOutputBuffer(pParserState);return fCallback();}}/**
3200
3200
  * Parse a character in the buffer.
3201
3201
  * @method parseCharacter
3202
3202
  * @param {string} pCharacter - The character to append
@@ -3226,8 +3226,8 @@ return fCallback();}/**
3226
3226
  * @param {function} fCallback - The callback function to call when the parse is complete
3227
3227
  */parseString(pString,pParseTree,pData,fCallback){if(typeof fCallback!=='function'){let tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){// TODO: This is not fast.
3228
3228
  this.parseCharacter(pString[i],tmpParserState,pData,fCallback);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}else{// This is the async mode
3229
- let tmpParserState=this.newParserState(pParseTree);tmpParserState.Asynchronous=true;this.eachLimit(pString,1,(pCharacter,fCharacterCallback)=>{this.parseCharacterAsync(pCharacter,tmpParserState,pData,fCharacterCallback);},pError=>{// Flush the remaining data
3230
- this.flushOutputBuffer(tmpParserState);fCallback(pError,tmpParserState.Output);});}}}module.exports=StringParser;},{}],130:[function(require,module,exports){/**
3229
+ let tmpParserState=this.newParserState(pParseTree);tmpParserState.Asynchronous=true;let tmpAnticipate=this.fable.instantiateServiceProviderWithoutRegistration('Anticipate');for(let i=0;i<pString.length;i++){tmpAnticipate.anticipate(fCallback=>{console.log("Running template for character [".concat(pString[i],"] index ").concat(i));this.parseCharacterAsync(pString[i],tmpParserState,pData,fCallback);});}tmpAnticipate.wait(pError=>{// Flush the remaining data
3230
+ this.flushOutputBuffer(tmpParserState);return fCallback(pError,tmpParserState.Output);});}}}module.exports=StringParser;},{}],130:[function(require,module,exports){/**
3231
3231
  * Word Tree
3232
3232
  * @author Steven Velozo <steven@velozo.com>
3233
3233
  * @description Create a tree (directed graph) of Javascript objects, one character per object.