manyfest 1.0.42 → 1.0.44
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/README.md +91 -260
- package/dist/manyfest.compatible.js +279 -112
- package/dist/manyfest.compatible.js.map +1 -1
- package/dist/manyfest.compatible.min.js +1 -1
- package/dist/manyfest.compatible.min.js.map +1 -1
- package/dist/manyfest.js +280 -112
- package/dist/manyfest.js.map +1 -1
- package/dist/manyfest.min.js +1 -1
- package/dist/manyfest.min.js.map +1 -1
- package/docs/.nojekyll +0 -0
- package/docs/README.md +108 -0
- package/docs/_sidebar.md +17 -0
- package/docs/address-notation.md +244 -0
- package/docs/cover.md +11 -0
- package/docs/hash-translation.md +202 -0
- package/docs/index.html +51 -0
- package/docs/quickstart.md +203 -0
- package/docs/reading.md +339 -0
- package/docs/schema-manipulation.md +186 -0
- package/docs/schema.md +319 -0
- package/docs/validating.md +344 -0
- package/docs/writing.md +300 -0
- package/package.json +3 -3
- package/source/Manyfest-CleanWrapCharacters.js +7 -1
- package/source/Manyfest-HashTranslation.js +29 -8
- package/source/Manyfest-ObjectAddress-CheckAddressExists.js +31 -17
- package/source/Manyfest-ObjectAddress-DeleteValue.js +27 -7
- package/source/Manyfest-ObjectAddress-GetValue.js +25 -10
- package/source/Manyfest-ObjectAddress-Parser.js +42 -35
- package/source/Manyfest-ObjectAddress-SetValue.js +21 -6
- package/source/Manyfest-ObjectAddressGeneration.js +23 -12
- package/source/Manyfest-ParseConditionals.js +3 -16
- package/source/Manyfest-SchemaManipulation.js +44 -21
- package/source/Manyfest.js +72 -17
- package/test/Manyfest_Performance_tests.js +48 -0
- package/types/Manyfest-CleanWrapCharacters.d.ts +7 -1
- package/types/Manyfest-CleanWrapCharacters.d.ts.map +1 -1
- package/types/Manyfest-HashTranslation.d.ts +34 -7
- package/types/Manyfest-HashTranslation.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts +23 -4
- package/types/Manyfest-ObjectAddress-CheckAddressExists.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-DeleteValue.d.ts +25 -6
- package/types/Manyfest-ObjectAddress-DeleteValue.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-GetValue.d.ts +26 -6
- package/types/Manyfest-ObjectAddress-GetValue.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-Parser.d.ts +5 -5
- package/types/Manyfest-ObjectAddress-Parser.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddress-SetValue.d.ts +18 -5
- package/types/Manyfest-ObjectAddress-SetValue.d.ts.map +1 -1
- package/types/Manyfest-ObjectAddressGeneration.d.ts +25 -4
- package/types/Manyfest-ObjectAddressGeneration.d.ts.map +1 -1
- package/types/Manyfest-SchemaManipulation.d.ts +47 -6
- package/types/Manyfest-SchemaManipulation.d.ts.map +1 -1
- package/types/Manyfest.d.ts +35 -12
- package/types/Manyfest.d.ts.map +1 -1
package/dist/manyfest.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function _defineProperty(e,t,s){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:t+""}function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var r=s.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}!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).Manyfest=e()}}((function(){return function e(t,s,r){function n(o,i){if(!s[o]){if(!t[o]){var c="function"==typeof require&&require;if(!i&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var h=s[o]={exports:{}};t[o][0].call(h.exports,(function(e){return n(t[o][1][e]||e)}),h,h.exports,e,t,s,r)}return s[o].exports}for(var a="function"==typeof require&&require,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,s){t.exports={name:"fable-serviceproviderbase",version:"3.0.15",description:"Simple base classes for fable services.",main:"source/Fable-ServiceProviderBase.js",scripts:{start:"node source/Fable-ServiceProviderBase.js",test:"npx mocha -u tdd -R spec",tests:"npx mocha -u tdd --exit -R spec --grep",coverage:"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",build:"npx quack build"},mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},repository:{type:"git",url:"https://github.com/stevenvelozo/fable-serviceproviderbase.git"},keywords:["entity","behavior"],author:"Steven Velozo <steven@velozo.com> (http://velozo.com/)",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/fable-serviceproviderbase/issues"},homepage:"https://github.com/stevenvelozo/fable-serviceproviderbase",devDependencies:{fable:"^3.0.143",quackage:"^1.0.33"}}},{}],2:[function(e,t,s){const r=e("../package.json");class n{constructor(e,t,s){"object"==typeof e&&e.isFable?this.connectFable(e):this.fable=!1,this._PackageFableServiceProvider=r,this.fable?(this.UUID=e.getUUID(),this.options="object"==typeof t?t:{}):(this.options="object"!=typeof e||e.isFable?"object"==typeof t?t:{}:e,this.UUID="CORE-SVC-".concat(Math.floor(89999*Math.random()+1e4))),this.serviceType="Unknown-".concat(this.UUID),this.Hash="string"==typeof s?s:this.fable||"string"!=typeof t?"".concat(this.UUID):t}connectFable(e){if("object"!=typeof e||!e.isFable){let t="Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [".concat(typeof e,"].}");return console.log(t),new Error(t)}return this.fable||(this.fable=e),this.log||(this.log=this.fable.Logging),this.services||(this.services=this.fable.services),this.servicesMap||(this.servicesMap=this.fable.servicesMap),!0}}_defineProperty(n,"isFableService",!0),t.exports=n,t.exports.CoreServiceProviderBase=n},{"../package.json":1}],3:[function(e,t,s){t.exports=(e,t)=>t.startsWith(e)&&t.endsWith(e)?t.substring(1,t.length-1):t},{}],4:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.translationTable={}}translationCount(){return Object.keys(this.translationTable).length}addTranslation(e){if("object"!=typeof e)return this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(typeof e)),!1;Object.keys(e).forEach((t=>{"string"!=typeof e[t]?this.logError("Hash translation addTranslation expected a translation destination hash for [".concat(t,"] to be a string but the referrant was a ").concat(typeof e[t])):this.translationTable[t]=e[t]}))}removeTranslationHash(e){e in this.translationTable&&delete this.translationTable[e]}removeTranslation(e){if("string"==typeof e)return this.removeTranslationHash(e),!0;if("object"==typeof e){return Object.keys(e).forEach((e=>{this.removeTranslation(e)})),!0}return this.logError("Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ".concat(typeof e)),!1}clearTranslations(){this.translationTable={}}translate(e){return e in this.translationTable?this.translationTable[e]:e}}},{"./Manyfest-LogToConsole.js":5}],5:[function(e,t,s){t.exports=(e,t)=>{let s="string"==typeof e?e:"";console.log("[Manyfest] ".concat(s)),t&&console.log(JSON.stringify(t))}},{}],6:[function(e,t,s){const r=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-ObjectAddress-GetValue.js");let a={DataFormat:e("./Manyfest-ObjectAddress-Parser.js")};t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.getObjectValueClass=new n(this.logInfo,this.logError)}checkAddressExists(e,t,s){if("object"!=typeof e)return!1;if("string"!=typeof t)return!1;let n=void 0===s?e:s,o=a.DataFormat.stringGetFirstSegment(t);if(o.length==t.length){let s=t.indexOf("["),r=t.indexOf("]"),n=t.indexOf("(");if(n>0&&a.DataFormat.stringCountEnclosures(t)>0){let s=t.substring(0,n).trim();return s in e&&"function"==typeof e[s]}if(s>0&&r>s&&r-s>1){let n=t.substring(0,s).trim();if("object"!=typeof e[n])return!1;let a=t.substring(s+1,r).trim(),o=parseInt(a,10);return Array.isArray(e[n])!=isNaN(o)&&(isNaN(o)?(a=this.cleanWrapCharacters('"',a),a=this.cleanWrapCharacters("`",a),a=this.cleanWrapCharacters("'",a),a in e[n]):o in e[n])}return t in e}{let i=o,c=t.substring(o.length+1),l=i.indexOf("["),h=i.indexOf("]"),d=i.indexOf("(");if(d>0&&a.DataFormat.stringCountEnclosures(i)>0){let o=i.substring(0,d).trim();if("function"==(e[o],!1))return!1;let l=a.DataFormat.stringGetSegments(a.DataFormat.stringGetEnclosureValueByIndex(i.substring(o.length),0),",");if(0==l.length||""==l[0]){if(!(o in e))return r.log("Function ".concat(o," does not exist (address [").concat(t,"])")),!1;try{return this.checkAddressExists(e[o].apply(e),c,n)}catch(e){return r.log("Error calling function ".concat(o," (address [").concat(t,"]): ").concat(e.message)),!1}}else{let n=[],a=void 0===s?e:s;for(let e=0;e<l.length;e++)n.push(this.getObjectValueClass.getValueAtAddress(a,l[e]));if(!(o in e))return r.log("Function ".concat(o," does not exist (address [").concat(t,"])")),!1;try{return this.checkAddressExists(e[o].apply(e,n),c,a)}catch(e){return r.log("Error calling function ".concat(o," (address [").concat(t,"]): ").concat(e.message)),!1}}}else if(l>0&&h>l&&h-l>1){let t=i.substring(0,l).trim(),s=i.substring(l+1,h).trim(),r=parseInt(s,10);return Array.isArray(e[t])!=isNaN(r)&&(isNaN(r)?(s=this.cleanWrapCharacters('"',s),s=this.cleanWrapCharacters("`",s),s=this.cleanWrapCharacters("'",s),this.checkAddressExists(e[t][s],c,n)):this.checkAddressExists(e[t][r],c,n))}return(!(i in e)||"object"==typeof e[i])&&(i in e||(e[i]={}),this.checkAddressExists(e[i],c,n))}}}},{"./Manyfest-LogToConsole.js":5,"./Manyfest-ObjectAddress-GetValue.js":8,"./Manyfest-ObjectAddress-Parser.js":9}],7:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=e("../source/Manyfest-ParseConditionals.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.cleanWrapCharacters=n}checkRecordFilters(e,t){return a(this,e,t)}deleteValueAtAddress(e,t,s){if("object"!=typeof e)return;if("string"!=typeof t)return;let r="";"string"==typeof s&&(r=s);let n=t.indexOf(".");if(-1==n){let s=t.indexOf("["),r=t.indexOf("]"),n=t.indexOf("{}");if(s>0&&r>s&&r-s>1){let n=t.substring(0,s).trim();if("object"!=typeof e[n])return!1;let a=t.substring(s+1,r).trim(),o=parseInt(a,10);return Array.isArray(e[n])!=isNaN(o)&&(isNaN(o)?(a=this.cleanWrapCharacters('"',a),a=this.cleanWrapCharacters("`",a),a=this.cleanWrapCharacters("'",a),delete e[n][a],!0):(delete e[n][o],!0))}if(s>0&&r>s&&r-s==1){let r=t.substring(0,s).trim();if(!Array.isArray(e[r]))return!1;let n=e[r];for(let e=n.length-1;e>=0;e--){this.checkRecordFilters(t,n[e])&&n.splice(e,1)}return!0}if(n>0){let s=t.substring(0,n).trim();return"object"==typeof e[s]&&(delete e[s],!0)}return delete e[t],!0}{let s=t.substring(0,n),a=t.substring(n+1),o=s.indexOf("["),i=s.indexOf("]");if(o>0&&i>o&&i-o>1){let t=s.substring(0,o).trim(),n=s.substring(o+1,i).trim(),c=parseInt(n,10);return Array.isArray(e[t])!=isNaN(c)&&("object"==typeof e[t]&&(isNaN(c)?(n=this.cleanWrapCharacters('"',n),n=this.cleanWrapCharacters("`",n),n=this.cleanWrapCharacters("'",n),r="".concat(r).concat(r.length>0?".":"").concat(s),this.deleteValueAtAddress(e[t][n],a,r)):(r="".concat(r).concat(r.length>0?".":"").concat(s),this.deleteValueAtAddress(e[t][c],a,r))))}if(o>0&&i>o&&i-o==1){let s=t.substring(0,o).trim();if(!Array.isArray(e[s]))return!1;let n=e[s];r="".concat(r).concat(r.length>0?".":"").concat(s);let i={};for(let t=0;t<n.length;t++){let n="".concat(r,"[").concat(t,"]"),o=this.deleteValueAtAddress(e[s][t],a,n);i["".concat(n,".").concat(a)]=o}return i}let c=t.indexOf("{}");if(c>0){let s=t.substring(0,c).trim();if("object"!=typeof e[s])return!1;let n=e[s],o=Object.keys(n);r="".concat(r).concat(r.length>0?".":"").concat(s);let i={};for(let n=0;n<o.length;n++){let c="".concat(r,".").concat(o[n]),l=this.deleteValueAtAddress(e[s][o[n]],a,c);this.checkRecordFilters(t,l)&&(i["".concat(c,".").concat(a)]=l)}return i}return s in e&&"object"!=typeof e[s]?void 0:s in e?(r="".concat(r).concat(r.length>0?".":"").concat(s),this.deleteValueAtAddress(e[s],a,r)):(r="".concat(r).concat(r.length>0?".":"").concat(s),e[s]={},this.deleteValueAtAddress(e[s],a,r))}}}},{"../source/Manyfest-ParseConditionals.js":12,"./Manyfest-CleanWrapCharacters.js":3,"./Manyfest-LogToConsole.js":5}],8:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=e("../source/Manyfest-ParseConditionals.js"),o={DataFormat:e("./Manyfest-ObjectAddress-Parser.js")};t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.cleanWrapCharacters=n}checkRecordFilters(e,t){return a(this,e,t)}getValueAtAddress(e,t,s,r){if("object"!=typeof e)return;if(null===e)return;if("string"!=typeof t)return;let n="";"string"==typeof s&&(n=s);let a=void 0===r?e:r,i=o.DataFormat.stringGetFirstSegment(t);if(""==i){let e=o.DataFormat.stringGetSegments(n),s=0;for(let e=0;e<t.length&&"."==t.charAt(e);e++)s++;let r=e.length-s;if(r<0)return;{let n=t.slice(s);return r>0&&(n="".concat(e.slice(0,r).join("."),".").concat(n)),this.logInfo("Back-navigation detected. Recursing back to address [".concat(n,"]")),this.getValueAtAddress(a,n)}}if(i.length!=t.length){let s=i,c=t.substring(i.length+1),l=s.indexOf("["),h=s.indexOf("]"),d=s.indexOf("(");if(d>0&&o.DataFormat.stringCountEnclosures(s)>0){let i=s.substring(0,d).trim();if(n="".concat(n).concat(n.length>0?".":"").concat(s),"function"==(e[i],!1))return!1;let l=o.DataFormat.stringGetSegments(o.DataFormat.stringGetEnclosureValueByIndex(s.substring(i.length),0),",");if(0==l.length||""==l[0]){if(!(i in e))return console.log("Function ".concat(i," does not exist (address [").concat(t,"])")),!1;try{return this.getValueAtAddress(e[i].apply(e),c,n,a)}catch(e){return console.log("Error in getValueAtAddress calling function ".concat(i," (address [").concat(t,"]): ").concat(e.message)),!1}}else{let s=[],a=void 0===r?e:r;for(let e=0;e<l.length;e++)!(l[e].length>=2)||'"'!=l[e].charAt(0)&&"'"!=l[e].charAt(0)&&"`"!=l[e].charAt(0)||'"'!=l[e].charAt(l[e].length-1)&&"'"!=l[e].charAt(l[e].length-1)&&"`"!=l[e].charAt(l[e].length-1)?s.push(this.getValueAtAddress(a,l[e])):s.push(l[e].substring(1,l[e].length-1));if(!(i in e))return console.log("Function ".concat(i," does not exist (address [").concat(t,"])")),!1;try{return this.getValueAtAddress(e[i].apply(e,s),c,n,a)}catch(e){return console.log("Error in getValueAtAddress calling function ".concat(i," (address [").concat(t,"]): ").concat(e.message)),!1}}}else{if(l>0&&h>l&&h-l>1){let t=s.substring(0,l).trim(),r=s.substring(l+1,h).trim(),o=parseInt(r,10);if(Array.isArray(e[t])==isNaN(o))return;if("object"!=typeof e[t])return;return isNaN(o)?(r=this.cleanWrapCharacters('"',r),r=this.cleanWrapCharacters("`",r),r=this.cleanWrapCharacters("'",r),n="".concat(n).concat(n.length>0?".":"").concat(s),this.getValueAtAddress(e[t][r],c,n,a)):(n="".concat(n).concat(n.length>0?".":"").concat(s),this.getValueAtAddress(e[t][o],c,n,a))}if(l>0&&h>l&&h-l==1){let s=t.substring(0,l).trim();if(!Array.isArray(e[s]))return!1;let r=e[s];n="".concat(n).concat(n.length>0?".":"").concat(s);let o={};for(let t=0;t<r.length;t++){let r="".concat(n,"[").concat(t,"]"),i=this.getValueAtAddress(e[s][t],c,r,a);o["".concat(r,".").concat(c)]=i}return o}}let u=t.indexOf("{}");if(u>0){let s=t.substring(0,u).trim();if("object"!=typeof e[s])return!1;let r=e[s],o=Object.keys(r);n="".concat(n).concat(n.length>0?".":"").concat(s);let i={};for(let r=0;r<o.length;r++){let l="".concat(n,".").concat(o[r]),h=this.getValueAtAddress(e[s][o[r]],c,l,a);this.checkRecordFilters(t,h)&&(i["".concat(l,".").concat(c)]=h)}return i}return s in e&&"object"!=typeof e[s]?void 0:s in e?(n="".concat(n).concat(n.length>0?".":"").concat(s),this.getValueAtAddress(e[s],c,n,a)):(n="".concat(n).concat(n.length>0?".":"").concat(s),e[s]={},this.getValueAtAddress(e[s],c,n,a))}{let s=t.indexOf("["),n=t.indexOf("]"),a=t.indexOf("{}"),i=t.indexOf("(");if(!(i>0&&o.DataFormat.stringCountEnclosures(t)>0)){if(s>0&&n>s&&n-s>1){let r=t.substring(0,s).trim();if("object"!=typeof e[r])return;let a=t.substring(s+1,n).trim(),o=parseInt(a,10);if(Array.isArray(e[r])==isNaN(o))return;return isNaN(o)?(a=this.cleanWrapCharacters('"',a),a=this.cleanWrapCharacters("`",a),a=this.cleanWrapCharacters("'",a),e[r][a]):e[r][o]}if(s>0&&n>s&&n-s==1){let r=t.substring(0,s).trim();if(!Array.isArray(e[r]))return!1;let n=e[r],a=[];for(let e=0;e<n.length;e++){this.checkRecordFilters(t,n[e])&&a.push(n[e])}return a}if(a>0){let s=t.substring(0,a).trim();return"object"==typeof e[s]&&e[s]}return null!=typeof e[t]?e[t]:null}{let s=t.substring(0,i).trim();if("function"==(e[s],!1))return!1;let n=o.DataFormat.stringGetSegments(o.DataFormat.stringGetEnclosureValueByIndex(t.substring(s.length),0),",");if(0==n.length||""==n[0]){if(!(s in e))return console.log("Function ".concat(s," does not exist (address [").concat(t,"])")),!1;try{return e[s].apply(e)}catch(e){return console.log("Error in getValueAtAddress calling function ".concat(s," (address [").concat(t,"]): ").concat(e.message)),!1}}else{let a=[],o=void 0===r?e:r;for(let e=0;e<n.length;e++)!(n[e].length>=2)||'"'!=n[e].charAt(0)&&"'"!=n[e].charAt(0)&&"`"!=n[e].charAt(0)||'"'!=n[e].charAt(n[e].length-1)&&"'"!=n[e].charAt(n[e].length-1)&&"`"!=n[e].charAt(n[e].length-1)?a.push(this.getValueAtAddress(o,n[e])):a.push(n[e].substring(1,n[e].length-1));if(!(s in e))return console.log("Function ".concat(s," does not exist (address [").concat(t,"])")),!1;try{return e[s].apply(e,a)}catch(e){return console.log("Error in getValueAtAddress calling function ".concat(s," (address [").concat(t,"]): ").concat(e.message)),!1}}}}}}},{"../source/Manyfest-ParseConditionals.js":12,"./Manyfest-CleanWrapCharacters.js":3,"./Manyfest-LogToConsole.js":5,"./Manyfest-ObjectAddress-Parser.js":9}],9:[function(e,t,s){t.exports={stringCountSegments:(e,t,s,r)=>{let n="string"==typeof e?e:"",a="string"==typeof t?t:".",o="object"==typeof s?pEnclosureStart:{"{":0,"[":1,"(":2},i="object"==typeof r?pEnclosureEnd:{"}":0,"]":1,")":2};if(e.length<1)return 0;let c=1,l=[];for(let e=0;e<n.length;e++)n[e]==a&&0==l.length?c++:n[e]in o?l.push(o[n[e]]):n[e]in i&&i[n[e]]==l[l.length-1]&&l.pop();return c},stringGetFirstSegment:(e,t,s,r)=>{let n="string"==typeof e?e:"",a="string"==typeof t?t:".",o="object"==typeof s?pEnclosureStart:{"{":0,"[":1,"(":2},i="object"==typeof r?pEnclosureEnd:{"}":0,"]":1,")":2};if(e.length<1)return 0;let c=[];for(let e=0;e<n.length;e++){if(n[e]==a&&0==c.length)return n.substring(0,e);n[e]in o?c.push(o[n[e]]):n[e]in i&&i[n[e]]==c[c.length-1]&&c.pop()}return n},stringGetSegments:(e,t,s,r)=>{let n="string"==typeof e?e:"",a="string"==typeof t?t:".",o="object"==typeof s?pEnclosureStart:{"{":0,"[":1,"(":2},i="object"==typeof r?pEnclosureEnd:{"}":0,"]":1,")":2},c=0,l=[];if(e.length<1)return l;let h=[];for(let e=0;e<n.length;e++)n[e]==a&&0==h.length?(l.push(n.substring(c,e)),c=e+1):n[e]in o?h.push(o[n[e]]):n[e]in i&&i[n[e]]==h[h.length-1]&&h.pop();return c<n.length&&l.push(n.substring(c)),l},stringCountEnclosures:(e,t,s)=>{let r="string"==typeof e?e:"",n="string"==typeof t?t:"(",a="string"==typeof s?s:")",o=0,i=0;for(let e=0;e<r.length;e++)r[e]==n?(0==i&&o++,i++):r[e]==a&&i--;return o},stringGetEnclosureValueByIndex:(e,t,s,r)=>{let n="string"==typeof e?e:"",a="number"==typeof t?t:0,o="string"==typeof s?s:"(",i="string"==typeof r?r:")",c=0,l=0,h=!1,d=0,u=0;for(let e=0;e<n.length;e++)n[e]==o?(l++,1==l&&(c++,a==c-1&&(h=!0,d=e))):n[e]==i&&(l--,0==l&&h&&u<=d&&(u=e,h=!1));return c<=a?"":u>0&&u>d?n.substring(d+1,u):n.substring(d+1)}}},{}],10:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.cleanWrapCharacters=n}setValueAtAddress(e,t,s){if("object"!=typeof e)return!1;if("string"!=typeof t)return!1;let r=t.indexOf(".");if(-1==r){let r=t.indexOf("["),n=t.indexOf("]");if(r>0&&n>r&&n-r>1){let a=t.substring(0,r).trim(),o=t.substring(r+1,n).trim(),i=parseInt(o,10),c=!isNaN(i);if(null==e[a]&&(e[a]=c?[]:{}),"object"!=typeof e[a])return!1;if(Array.isArray(e[a])==isNaN(i))return!1;if(isNaN(i))return o=this.cleanWrapCharacters('"',o),o=this.cleanWrapCharacters("`",o),o=this.cleanWrapCharacters("'",o),o in e[a]||(e[a][o]={}),e[a][o]=s,!0;for(;e[a].length<i+1;)e[a].push({});return e[a][i]=s,!0}return e[t]=s,!0}{let n=t.substring(0,r),a=t.substring(r+1),o=n.indexOf("["),i=n.indexOf("]");if(o>0&&i>o&&i-o>1){let t=n.substring(0,o).trim(),r=n.substring(o+1,i).trim(),c=parseInt(r,10),l=!isNaN(c);if(null==e[t]&&(e[t]=l?[]:{}),Array.isArray(e[t])!=l)return!1;if(isNaN(c))return r=this.cleanWrapCharacters('"',r),r=this.cleanWrapCharacters("`",r),r=this.cleanWrapCharacters("'",r),r in e[t]||(e[t][r]={}),this.setValueAtAddress(e[t][r],a,s);for(;e[t].length<c+1;)e[t].push({});return this.setValueAtAddress(e[t][c],a,s)}return n in e&&"object"!=typeof e[n]?("__ERROR"in e||(e.__ERROR={}),e.__ERROR[t]=s,!1):(n in e||(e[n]={}),this.setValueAtAddress(e[n],a,s))}}}},{"./Manyfest-CleanWrapCharacters.js":3,"./Manyfest-LogToConsole.js":5}],11:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r}generateAddressses(e,t,s){let r="string"==typeof t?t:"",n="object"==typeof s?s:{},a=typeof e,o={Address:r,Hash:r,Name:r,InSchema:!1};switch("object"==a&&null==e&&(a="null"),a){case"string":o.DataType="String",o.Default=e,n[r]=o;break;case"number":case"bigint":o.DataType="Number",o.Default=e,n[r]=o;break;case"undefined":case"null":o.DataType="Any",o.Default=e,n[r]=o;break;case"object":if(Array.isArray(e)){o.DataType="Array",""!=r&&(n[r]=o);for(let t=0;t<e.length;t++)this.generateAddressses(e[t],"".concat(r,"[").concat(t,"]"),n)}else{o.DataType="Object",""!=r&&(n[r]=o,r+=".");let t=Object.keys(e);for(let s=0;s<t.length;s++)this.generateAddressses(e[t[s]],"".concat(r).concat(t[s]),n)}}return n}}},{"./Manyfest-LogToConsole.js":5}],12:[function(e,t,s){const r="<<~?",n="?~>>",a=(e,t,s,r,n)=>{switch(r){case"TRUE":return!0===e.getValueAtAddress(t,s);case"FALSE":return!1===e.getValueAtAddress(t,s);case"LNGT":case"LENGTH_GREATER_THAN":switch(typeof e.getValueAtAddress(t,s)){case"string":case"object":return e.getValueAtAddress(t,s).length>n;default:return!1}break;case"LNLT":case"LENGTH_LESS_THAN":switch(typeof e.getValueAtAddress(t,s)){case"string":case"object":return e.getValueAtAddress(t,s).length<n;default:return!1}break;case"!=":return e.getValueAtAddress(t,s)!=n;case"<":return e.getValueAtAddress(t,s)<n;case">":return e.getValueAtAddress(t,s)>n;case"<=":return e.getValueAtAddress(t,s)<=n;case">=":return e.getValueAtAddress(t,s)>=n;case"===":return e.getValueAtAddress(t,s)===n;default:return e.getValueAtAddress(t,s)==n}};t.exports=(e,t,s)=>{let o=!0,i=t.indexOf(r);for(;-1!=i;){let c=t.indexOf(n,i+4);if(-1!=c){let n=t.substring(i+4,c).split(","),l=n[0],h="EXISTS";n.length>1&&(h=n[1]);let d=!1;n.length>2&&(d=n[2]),o=o&&a(e,s,l,h,d),i=t.indexOf(r,c+4)}else i=-1}return o}},{}],13:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r}resolveAddressMappings(e,t){if("object"!=typeof e)return this.logError("Attempted to resolve address mapping but the descriptor was not an object."),!1;if("object"!=typeof t)return!0;let s=Object.keys(e),r={};return s.forEach((t=>{"Hash"in e[t]&&(r[e[t].Hash]=t)})),Object.keys(t).forEach((s=>{let n=t[s],a=!1,o=!1;s in e?a=s:s in r&&(a=r[s]),a?(o=e[a],delete e[a]):o={Hash:s},e[n]=o})),!0}safeResolveAddressMappings(e,t){let s=JSON.parse(JSON.stringify(e));return this.resolveAddressMappings(s,t),s}mergeAddressMappings(e,t){if("object"!=typeof t||"object"!=typeof e)return this.logError("Attempted to merge two schema descriptors but both were not objects."),!1;let s=JSON.parse(JSON.stringify(t)),r=JSON.parse(JSON.stringify(e));return Object.keys(s).forEach((e=>{e in r||(r[e]=s[e])})),r}}},{"./Manyfest-LogToConsole.js":5}],14:[function(e,t,s){const r=e("fable-serviceproviderbase");let n=e("./Manyfest-LogToConsole.js"),a=e("./Manyfest-HashTranslation.js"),o=e("./Manyfest-ObjectAddress-CheckAddressExists.js"),i=e("./Manyfest-ObjectAddress-GetValue.js"),c=e("./Manyfest-ObjectAddress-SetValue.js"),l=e("./Manyfest-ObjectAddress-DeleteValue.js"),h=e("./Manyfest-ObjectAddressGeneration.js"),d=e("./Manyfest-SchemaManipulation.js");const u={Scope:"DEFAULT",Descriptors:{}};class f extends r{constructor(e,t,s){void 0===e?super({}):super(e,t,s),this.options,this.serviceType="Manifest",this.logInfo=n,this.logError=n,this.objectAddressCheckAddressExists=new o(this.logInfo,this.logError),this.objectAddressGetValue=new i(this.logInfo,this.logError),this.objectAddressSetValue=new c(this.logInfo,this.logError),this.objectAddressDeleteValue=new l(this.logInfo,this.logError),"defaultValues"in this.options||(this.options.defaultValues={String:"",Number:0,Float:0,Integer:0,PreciseNumber:"0.0",Boolean:!1,Binary:0,DateTime:0,Array:[],Object:{},Null:null}),"strict"in this.options||(this.options.strict=!1),this.scope=void 0,this.elementAddresses=void 0,this.elementHashes=void 0,this.elementDescriptors=void 0,this.reset(),"object"==typeof this.options&&this.loadManifest(this.options),this.schemaManipulations=new d(this.logInfo,this.logError),this.objectAddressGeneration=new h(this.logInfo,this.logError),this.hashTranslations=new a(this.logInfo,this.logError),this.numberRegex=/^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/}reset(){this.scope="DEFAULT",this.elementAddresses=[],this.elementHashes={},this.elementDescriptors={}}clone(){let e=JSON.parse(JSON.stringify(this.options)),t=new f(this.getManifest(),this.logInfo,this.logError,e);return t.hashTranslations.addTranslation(this.hashTranslations.translationTable),t}deserialize(e){return this.loadManifest(JSON.parse(e))}loadManifest(e){"object"!=typeof e&&this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(typeof e,"."));let t="object"==typeof e?e:{},s=Object.keys(u);for(let e=0;e<s.length;e++)s[e]in t||(t[s[e]]=JSON.parse(JSON.stringify(u[s[e]])));if("Scope"in t?"string"==typeof t.Scope?this.scope=t.Scope:this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(typeof t.Scope,"."),t):this.logError("(".concat(this.scope,') Error loading scope from manifest object. Property "Scope" does not exist in the root of the object.'),t),"Descriptors"in t)if("object"==typeof t.Descriptors){let e=Object.keys(t.Descriptors);for(let s=0;s<e.length;s++)this.addDescriptor(e[s],t.Descriptors[e[s]])}else this.logError("(".concat(this.scope,") Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ").concat(typeof t.Descriptors,"."),t);else this.logError("(".concat(this.scope,') Error loading object description from manifest object. Property "Descriptors" does not exist in the root of the Manifest object.'),t);if("HashTranslations"in t&&"object"==typeof t.HashTranslations)for(let e=0;e<t.HashTranslations.length;e++);}serialize(){return JSON.stringify(this.getManifest())}getManifest(){return{Scope:this.scope,Descriptors:JSON.parse(JSON.stringify(this.elementDescriptors)),HashTranslations:JSON.parse(JSON.stringify(this.hashTranslations.translationTable))}}addDescriptor(e,t){return"object"==typeof t?("Address"in t||(t.Address=e),e in this.elementDescriptors||this.elementAddresses.push(e),this.elementDescriptors[e]=t,this.elementHashes[e]=e,"Hash"in t?this.elementHashes[t.Hash]=e:t.Hash=e,!0):(this.logError("(".concat(this.scope,") Error loading object descriptor for address '").concat(e,"' from manifest object. Expecting an object but property was type ").concat(typeof t,".")),!1)}getDescriptorByHash(e){return this.getDescriptor(this.resolveHashAddress(e))}getDescriptor(e){return this.elementDescriptors[e]}eachDescriptor(e){let t=Object.keys(this.elementDescriptors);for(let s=0;s<t.length;s++)e(this.elementDescriptors[t[s]])}checkAddressExistsByHash(e,t){return this.checkAddressExists(e,this.resolveHashAddress(t))}checkAddressExists(e,t){return this.objectAddressCheckAddressExists.checkAddressExists(e,t)}resolveHashAddress(e){let t,s=e in this.elementHashes,r=e in this.hashTranslations.translationTable;return t=s&&!r?this.elementHashes[e]:r&&this.hashTranslations.translate(e)in this.elementHashes?this.elementHashes[this.hashTranslations.translate(e)]:r?this.hashTranslations.translate(e):e,t}getValueByHash(e,t){let s=this.getValueAtAddress(e,this.resolveHashAddress(t));return void 0===s&&(s=this.getDefaultValue(this.getDescriptorByHash(t))),s}lintAddress(e){let t=e.trim();return(t.endsWith("..")||t.endsWith("."))&&(t=t.slice(0,-1)),t}getValueAtAddress(e,t){let s=this.lintAddress(t);if(""==s)return void this.logError("(".concat(this.scope,") Error getting value at address; address is an empty string."),e);let r=this.objectAddressGetValue.getValueAtAddress(e,s);return void 0===r&&(r=this.getDefaultValue(this.getDescriptor(s))),r}setValueByHash(e,t,s){return this.setValueAtAddress(e,this.resolveHashAddress(t),s)}setValueAtAddress(e,t,s){let r=this.lintAddress(t);return this.objectAddressSetValue.setValueAtAddress(e,r,s)}deleteValueByHash(e,t,s){return this.deleteValueAtAddress(e,this.resolveHashAddress(t),s)}deleteValueAtAddress(e,t,s){let r=this.lintAddress(t);return this.objectAddressDeleteValue.deleteValueAtAddress(e,r,s)}validate(e){let t={Error:null,Errors:[],MissingElements:[]};"object"!=typeof e&&(t.Error=!0,t.Errors.push("Expected passed in object to be type object but was passed in ".concat(typeof e)));let s=(e,s)=>{t.Error=!0,t.Errors.push('Element at address "'.concat(e,'" ').concat(s,"."))};for(let r=0;r<this.elementAddresses.length;r++){let n=this.getDescriptor(this.elementAddresses[r]),a=this.checkAddressExists(e,n.Address),o=this.getValueAtAddress(e,n.Address);if(void 0!==o&&a||(t.MissingElements.push(n.Address),(n.Required||this.options.strict)&&s(n.Address,"is flagged REQUIRED but is not set in the object")),n.DataType){let e=typeof o;switch(n.DataType.toString().trim().toLowerCase()){case"string":"string"!=e&&s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e));break;case"precisenumber":"string"!=e?s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e)):this.numberRegex.test(o)||s(n.Address,"has a DataType ".concat(n.DataType," but is not a valid number"));break;case"number":"number"!=e&&s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e));break;case"integer":if("number"!=e)s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e));else{o.toString().indexOf(".")>-1&&s(n.Address,"has a DataType ".concat(n.DataType," but has a decimal point in the number."))}break;case"float":"number"!=e&&s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e));break;case"datetime":"Invalid Date"==new Date(o).toString()&&s(n.Address,"has a DataType ".concat(n.DataType," but is not parsable as a Date by Javascript"));default:"string"!=e&&s(n.Address,"has a DataType ".concat(n.DataType," (which auto-converted to String because it was unrecognized) but is of the type ").concat(e))}}}return t}getDefaultValue(e){if("object"==typeof e){if("Default"in e)return e.Default;{let t="DataType"in e?e.DataType:"String";return t in this.options.defaultValues?this.options.defaultValues[t]:null}}}populateDefaults(e,t){return this.populateObject(e,t,(e=>"Default"in e))}populateObject(e,t,s){let r="object"==typeof e?e:{},n=void 0!==t&&t,a="function"==typeof s?s:e=>!0;return this.elementAddresses.forEach((e=>{let t=this.getDescriptor(e);a(t)&&(!n&&this.checkAddressExists(r,e)||this.setValueAtAddress(r,e,this.getDefaultValue(t)))})),r}}t.exports=f},{"./Manyfest-HashTranslation.js":4,"./Manyfest-LogToConsole.js":5,"./Manyfest-ObjectAddress-CheckAddressExists.js":6,"./Manyfest-ObjectAddress-DeleteValue.js":7,"./Manyfest-ObjectAddress-GetValue.js":8,"./Manyfest-ObjectAddress-SetValue.js":10,"./Manyfest-ObjectAddressGeneration.js":11,"./Manyfest-SchemaManipulation.js":13,"fable-serviceproviderbase":2}]},{},[14])(14)}));
|
|
1
|
+
"use strict";function _defineProperty(e,t,s){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:t+""}function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var r=s.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}!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).Manyfest=e()}}((function(){return function e(t,s,r){function n(o,i){if(!s[o]){if(!t[o]){var c="function"==typeof require&&require;if(!i&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var h=s[o]={exports:{}};t[o][0].call(h.exports,(function(e){return n(t[o][1][e]||e)}),h,h.exports,e,t,s,r)}return s[o].exports}for(var a="function"==typeof require&&require,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,s){t.exports={name:"fable-serviceproviderbase",version:"3.0.15",description:"Simple base classes for fable services.",main:"source/Fable-ServiceProviderBase.js",scripts:{start:"node source/Fable-ServiceProviderBase.js",test:"npx mocha -u tdd -R spec",tests:"npx mocha -u tdd --exit -R spec --grep",coverage:"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",build:"npx quack build"},mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},repository:{type:"git",url:"https://github.com/stevenvelozo/fable-serviceproviderbase.git"},keywords:["entity","behavior"],author:"Steven Velozo <steven@velozo.com> (http://velozo.com/)",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/fable-serviceproviderbase/issues"},homepage:"https://github.com/stevenvelozo/fable-serviceproviderbase",devDependencies:{fable:"^3.0.143",quackage:"^1.0.33"}}},{}],2:[function(e,t,s){const r=e("../package.json");class n{constructor(e,t,s){"object"==typeof e&&e.isFable?this.connectFable(e):this.fable=!1,this._PackageFableServiceProvider=r,this.fable?(this.UUID=e.getUUID(),this.options="object"==typeof t?t:{}):(this.options="object"!=typeof e||e.isFable?"object"==typeof t?t:{}:e,this.UUID="CORE-SVC-".concat(Math.floor(89999*Math.random()+1e4))),this.serviceType="Unknown-".concat(this.UUID),this.Hash="string"==typeof s?s:this.fable||"string"!=typeof t?"".concat(this.UUID):t}connectFable(e){if("object"!=typeof e||!e.isFable){let t="Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [".concat(typeof e,"].}");return console.log(t),new Error(t)}return this.fable||(this.fable=e),this.log||(this.log=this.fable.Logging),this.services||(this.services=this.fable.services),this.servicesMap||(this.servicesMap=this.fable.servicesMap),!0}}_defineProperty(n,"isFableService",!0),t.exports=n,t.exports.CoreServiceProviderBase=n},{"../package.json":1}],3:[function(e,t,s){t.exports=(e,t)=>t.startsWith(e)&&t.endsWith(e)?t.substring(1,t.length-1):t},{}],4:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.translationTable={}}translationCount(){return Object.keys(this.translationTable).length}addTranslation(e){if("object"!=typeof e)return this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(typeof e)),!1;Object.keys(e).forEach((t=>{"string"!=typeof e[t]?this.logError("Hash translation addTranslation expected a translation destination hash for [".concat(t,"] to be a string but the referrant was a ").concat(typeof e[t])):this.translationTable[t]=e[t]}))}removeTranslationHash(e){delete this.translationTable[e]}removeTranslation(e){if("string"==typeof e)return this.removeTranslationHash(e),!0;if("object"==typeof e){return Object.keys(e).forEach((e=>{this.removeTranslation(e)})),!0}return this.logError("Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ".concat(typeof e)),!1}clearTranslations(){this.translationTable={}}translate(e){return e in this.translationTable?this.translationTable[e]:e}}},{"./Manyfest-LogToConsole.js":5}],5:[function(e,t,s){t.exports=(e,t)=>{let s="string"==typeof e?e:"";console.log("[Manyfest] ".concat(s)),t&&console.log(JSON.stringify(t))}},{}],6:[function(e,t,s){const r=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-ObjectAddress-GetValue.js"),a=e("./Manyfest-CleanWrapCharacters.js");let o={DataFormat:e("./Manyfest-ObjectAddress-Parser.js")};t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.getObjectValueClass=new n(this.logInfo,this.logError),this.cleanWrapCharacters=a}checkAddressExists(e,t,s){if("object"!=typeof e)return!1;if("string"!=typeof t)return!1;let n=void 0===s?e:s,a=o.DataFormat.stringGetFirstSegment(t);if(a.length==t.length){let s=t.indexOf("["),r=t.indexOf("]"),n=t.indexOf("(");if(n>0&&o.DataFormat.stringCountEnclosures(t)>0){let s=t.substring(0,n).trim();return s in e&&"function"==typeof e[s]}if(s>0&&r>s&&r-s>1){let n=t.substring(0,s).trim();if("object"!=typeof e[n])return!1;let a=t.substring(s+1,r).trim(),o=parseInt(a,10);return Array.isArray(e[n])!=isNaN(o)&&(isNaN(o)?(a=this.cleanWrapCharacters('"',a),a=this.cleanWrapCharacters("`",a),a=this.cleanWrapCharacters("'",a),a in e[n]):o in e[n])}return t in e}{let i=a,c=t.substring(a.length+1),l=i.indexOf("["),h=i.indexOf("]"),d=i.indexOf("(");if(d>0&&o.DataFormat.stringCountEnclosures(i)>0){let a=i.substring(0,d).trim();if("function"!=typeof e[a])return!1;let l=o.DataFormat.stringGetSegments(o.DataFormat.stringGetEnclosureValueByIndex(i.substring(a.length),0),",");if(0==l.length||""==l[0]){if(!(a in e))return r("Function ".concat(a," does not exist (address [").concat(t,"])")),!1;try{return this.checkAddressExists(e[a].apply(e),c,n)}catch(e){return r("Error calling function ".concat(a," (address [").concat(t,"]): ").concat(e.message)),!1}}else{let n=[],o=void 0===s?e:s;for(let e=0;e<l.length;e++)n.push(this.getObjectValueClass.getValueAtAddress(o,l[e]));if(!(a in e))return r("Function ".concat(a," does not exist (address [").concat(t,"])")),!1;try{return this.checkAddressExists(e[a].apply(e,n),c,o)}catch(e){return r("Error calling function ".concat(a," (address [").concat(t,"]): ").concat(e.message)),!1}}}else if(l>0&&h>l&&h-l>1){let t=i.substring(0,l).trim(),s=i.substring(l+1,h).trim(),r=parseInt(s,10);return Array.isArray(e[t])!=isNaN(r)&&(isNaN(r)?(s=this.cleanWrapCharacters('"',s),s=this.cleanWrapCharacters("`",s),s=this.cleanWrapCharacters("'",s),this.checkAddressExists(e[t][s],c,n)):this.checkAddressExists(e[t][r],c,n))}return(!(i in e)||"object"==typeof e[i])&&(i in e||(e[i]={}),this.checkAddressExists(e[i],c,n))}}}},{"./Manyfest-CleanWrapCharacters.js":3,"./Manyfest-LogToConsole.js":5,"./Manyfest-ObjectAddress-GetValue.js":8,"./Manyfest-ObjectAddress-Parser.js":9}],7:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=e("../source/Manyfest-ParseConditionals.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.cleanWrapCharacters=n}checkRecordFilters(e,t){return a(this,e,t)}deleteValueAtAddress(e,t,s){if("object"!=typeof e)return;if("string"!=typeof t)return;let r="";"string"==typeof s&&(r=s);let n=t.indexOf(".");if(-1==n){let s=t.indexOf("["),r=t.indexOf("]"),n=t.indexOf("{}");if(s>0&&r>s&&r-s>1){let n=t.substring(0,s).trim();if("object"!=typeof e[n])return!1;let a=t.substring(s+1,r).trim(),o=parseInt(a,10);return Array.isArray(e[n])!=isNaN(o)&&(isNaN(o)?(a=this.cleanWrapCharacters('"',a),a=this.cleanWrapCharacters("`",a),a=this.cleanWrapCharacters("'",a),delete e[n][a],!0):(delete e[n][o],!0))}if(s>0&&r>s&&r-s==1){let r=t.substring(0,s).trim();if(!Array.isArray(e[r]))return!1;let n=e[r];for(let e=n.length-1;e>=0;e--){this.checkRecordFilters(t,n[e])&&n.splice(e,1)}return!0}if(n>0){let s=t.substring(0,n).trim();return"object"==typeof e[s]&&(delete e[s],!0)}return delete e[t],!0}{let s=t.substring(0,n),a=t.substring(n+1),o=s.indexOf("["),i=s.indexOf("]");if(o>0&&i>o&&i-o>1){let t=s.substring(0,o).trim(),n=s.substring(o+1,i).trim(),c=parseInt(n,10);return Array.isArray(e[t])!=isNaN(c)&&("object"==typeof e[t]&&(isNaN(c)?(n=this.cleanWrapCharacters('"',n),n=this.cleanWrapCharacters("`",n),n=this.cleanWrapCharacters("'",n),r="".concat(r).concat(r.length>0?".":"").concat(s),this.deleteValueAtAddress(e[t][n],a,r)):(r="".concat(r).concat(r.length>0?".":"").concat(s),this.deleteValueAtAddress(e[t][c],a,r))))}if(o>0&&i>o&&i-o==1){let s=t.substring(0,o).trim();if(!Array.isArray(e[s]))return!1;let n=e[s];r="".concat(r).concat(r.length>0?".":"").concat(s);let i={};for(let t=0;t<n.length;t++){let n="".concat(r,"[").concat(t,"]"),o=this.deleteValueAtAddress(e[s][t],a,n);i["".concat(n,".").concat(a)]=o}return i}let c=t.indexOf("{}");if(c>0){let s=t.substring(0,c).trim();if("object"!=typeof e[s])return!1;let n=e[s],o=Object.keys(n);r="".concat(r).concat(r.length>0?".":"").concat(s);let i={};for(let n=0;n<o.length;n++){let c="".concat(r,".").concat(o[n]),l=this.deleteValueAtAddress(e[s][o[n]],a,c);this.checkRecordFilters(t,l)&&(i["".concat(c,".").concat(a)]=l)}return i}return s in e&&"object"!=typeof e[s]?void 0:s in e?(r="".concat(r).concat(r.length>0?".":"").concat(s),this.deleteValueAtAddress(e[s],a,r)):(r="".concat(r).concat(r.length>0?".":"").concat(s),e[s]={},this.deleteValueAtAddress(e[s],a,r))}}}},{"../source/Manyfest-ParseConditionals.js":12,"./Manyfest-CleanWrapCharacters.js":3,"./Manyfest-LogToConsole.js":5}],8:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js"),a=e("../source/Manyfest-ParseConditionals.js"),o={DataFormat:e("./Manyfest-ObjectAddress-Parser.js")};t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.cleanWrapCharacters=n}checkRecordFilters(e,t){return a(this,e,t)}getValueAtAddress(e,t,s,r){if("object"!=typeof e)return;if(null===e)return;if("string"!=typeof t)return;let n="";"string"==typeof s&&(n=s);let a=void 0===r?e:r,i=o.DataFormat.stringGetFirstSegment(t);if(""==i){let e=o.DataFormat.stringGetSegments(n),s=0;for(let e=0;e<t.length&&"."==t.charAt(e);e++)s++;let r=e.length-s;if(r<0)return;{let n=t.slice(s);return r>0&&(n="".concat(e.slice(0,r).join("."),".").concat(n)),this.logInfo("Back-navigation detected. Recursing back to address [".concat(n,"]")),this.getValueAtAddress(a,n)}}if(i.length!=t.length){let s=i,c=t.substring(i.length+1),l=s.indexOf("["),h=s.indexOf("]"),d=s.indexOf("(");if(d>0&&o.DataFormat.stringCountEnclosures(s)>0){let i=s.substring(0,d).trim();if(n="".concat(n).concat(n.length>0?".":"").concat(s),"function"!=typeof e[i])return!1;let l=o.DataFormat.stringGetSegments(o.DataFormat.stringGetEnclosureValueByIndex(s.substring(i.length),0),",");if(0==l.length||""==l[0]){if(!(i in e))return console.log("Function ".concat(i," does not exist (address [").concat(t,"])")),!1;try{return this.getValueAtAddress(e[i].apply(e),c,n,a)}catch(e){return console.log("Error in getValueAtAddress calling function ".concat(i," (address [").concat(t,"]): ").concat(e.message)),!1}}else{let s=[],a=void 0===r?e:r;for(let e=0;e<l.length;e++)!(l[e].length>=2)||'"'!=l[e].charAt(0)&&"'"!=l[e].charAt(0)&&"`"!=l[e].charAt(0)||'"'!=l[e].charAt(l[e].length-1)&&"'"!=l[e].charAt(l[e].length-1)&&"`"!=l[e].charAt(l[e].length-1)?s.push(this.getValueAtAddress(a,l[e])):s.push(l[e].substring(1,l[e].length-1));if(!(i in e))return console.log("Function ".concat(i," does not exist (address [").concat(t,"])")),!1;try{return this.getValueAtAddress(e[i].apply(e,s),c,n,a)}catch(e){return console.log("Error in getValueAtAddress calling function ".concat(i," (address [").concat(t,"]): ").concat(e.message)),!1}}}else{if(l>0&&h>l&&h-l>1){let t=s.substring(0,l).trim(),r=s.substring(l+1,h).trim(),o=parseInt(r,10);if(Array.isArray(e[t])==isNaN(o))return;if("object"!=typeof e[t])return;return isNaN(o)?(r=this.cleanWrapCharacters('"',r),r=this.cleanWrapCharacters("`",r),r=this.cleanWrapCharacters("'",r),n="".concat(n).concat(n.length>0?".":"").concat(s),this.getValueAtAddress(e[t][r],c,n,a)):(n="".concat(n).concat(n.length>0?".":"").concat(s),this.getValueAtAddress(e[t][o],c,n,a))}if(l>0&&h>l&&h-l==1){let s=t.substring(0,l).trim();if(!Array.isArray(e[s]))return!1;let r=e[s];n="".concat(n).concat(n.length>0?".":"").concat(s);let o={};for(let t=0;t<r.length;t++){let r="".concat(n,"[").concat(t,"]"),i=this.getValueAtAddress(e[s][t],c,r,a);o["".concat(r,".").concat(c)]=i}return o}}let u=t.indexOf("{}");if(u>0){let s=t.substring(0,u).trim();if("object"!=typeof e[s])return!1;let r=e[s],o=Object.keys(r);n="".concat(n).concat(n.length>0?".":"").concat(s);let i={};for(let r=0;r<o.length;r++){let l="".concat(n,".").concat(o[r]),h=this.getValueAtAddress(e[s][o[r]],c,l,a);this.checkRecordFilters(t,h)&&(i["".concat(l,".").concat(c)]=h)}return i}return s in e&&"object"!=typeof e[s]?void 0:s in e?(n="".concat(n).concat(n.length>0?".":"").concat(s),this.getValueAtAddress(e[s],c,n,a)):(n="".concat(n).concat(n.length>0?".":"").concat(s),e[s]={},this.getValueAtAddress(e[s],c,n,a))}{let s=t.indexOf("["),n=t.indexOf("]"),a=t.indexOf("{}"),i=t.indexOf("(");if(!(i>0&&o.DataFormat.stringCountEnclosures(t)>0)){if(s>0&&n>s&&n-s>1){let r=t.substring(0,s).trim();if("object"!=typeof e[r])return;let a=t.substring(s+1,n).trim(),o=parseInt(a,10);if(Array.isArray(e[r])==isNaN(o))return;return isNaN(o)?(a=this.cleanWrapCharacters('"',a),a=this.cleanWrapCharacters("`",a),a=this.cleanWrapCharacters("'",a),e[r][a]):e[r][o]}if(s>0&&n>s&&n-s==1){let r=t.substring(0,s).trim();if(!Array.isArray(e[r]))return!1;let n=e[r],a=[];for(let e=0;e<n.length;e++){this.checkRecordFilters(t,n[e])&&a.push(n[e])}return a}if(a>0){let s=t.substring(0,a).trim();return"object"==typeof e[s]&&e[s]}return null!=typeof e[t]?e[t]:null}{let s=t.substring(0,i).trim();if("function"!=typeof e[s])return!1;let n=o.DataFormat.stringGetSegments(o.DataFormat.stringGetEnclosureValueByIndex(t.substring(s.length),0),",");if(0==n.length||""==n[0]){if(!(s in e))return console.log("Function ".concat(s," does not exist (address [").concat(t,"])")),!1;try{return e[s].apply(e)}catch(e){return console.log("Error in getValueAtAddress calling function ".concat(s," (address [").concat(t,"]): ").concat(e.message)),!1}}else{let a=[],o=void 0===r?e:r;for(let e=0;e<n.length;e++)!(n[e].length>=2)||'"'!=n[e].charAt(0)&&"'"!=n[e].charAt(0)&&"`"!=n[e].charAt(0)||'"'!=n[e].charAt(n[e].length-1)&&"'"!=n[e].charAt(n[e].length-1)&&"`"!=n[e].charAt(n[e].length-1)?a.push(this.getValueAtAddress(o,n[e])):a.push(n[e].substring(1,n[e].length-1));if(!(s in e))return console.log("Function ".concat(s," does not exist (address [").concat(t,"])")),!1;try{return e[s].apply(e,a)}catch(e){return console.log("Error in getValueAtAddress calling function ".concat(s," (address [").concat(t,"]): ").concat(e.message)),!1}}}}}}},{"../source/Manyfest-ParseConditionals.js":12,"./Manyfest-CleanWrapCharacters.js":3,"./Manyfest-LogToConsole.js":5,"./Manyfest-ObjectAddress-Parser.js":9}],9:[function(e,t,s){const r={"{":0,"[":1,"(":2},n={"}":0,"]":1,")":2};t.exports={stringCountSegments:(e,t,s,a)=>{let o="string"==typeof e?e:"",i="string"==typeof t?t:".",c="object"==typeof s?s:r,l="object"==typeof a?a:n;if(e.length<1)return 0;let h=1,d=[];for(let e=0;e<o.length;e++)o[e]==i&&0==d.length?h++:o[e]in c?d.push(c[o[e]]):o[e]in l&&l[o[e]]==d[d.length-1]&&d.pop();return h},stringGetFirstSegment:(e,t,s,a)=>{let o="string"==typeof e?e:"",i="string"==typeof t?t:".",c="object"==typeof s?s:r,l="object"==typeof a?a:n;if(e.length<1)return"";let h=[];for(let e=0;e<o.length;e++){if(o[e]==i&&0==h.length)return o.substring(0,e);o[e]in c?h.push(c[o[e]]):o[e]in l&&l[o[e]]==h[h.length-1]&&h.pop()}return o},stringGetSegments:(e,t,s,a)=>{let o="string"==typeof e?e:"",i="string"==typeof t?t:".",c="object"==typeof s?s:r,l="object"==typeof a?a:n,h=0,d=[];if(e.length<1)return d;let u=[];for(let e=0;e<o.length;e++)o[e]==i&&0==u.length?(d.push(o.substring(h,e)),h=e+1):o[e]in c?u.push(c[o[e]]):o[e]in l&&l[o[e]]==u[u.length-1]&&u.pop();return h<o.length&&d.push(o.substring(h)),d},stringCountEnclosures:(e,t,s)=>{let r="string"==typeof e?e:"",n="string"==typeof t?t:"(",a="string"==typeof s?s:")",o=0,i=0;for(let e=0;e<r.length;e++)r[e]==n?(0==i&&o++,i++):r[e]==a&&i--;return o},stringGetEnclosureValueByIndex:(e,t,s,r)=>{let n="string"==typeof e?e:"",a="number"==typeof t?t:0,o="string"==typeof s?s:"(",i="string"==typeof r?r:")",c=0,l=0,h=!1,d=0,u=0;for(let e=0;e<n.length;e++)n[e]==o?(l++,1==l&&(c++,a==c-1&&(h=!0,d=e))):n[e]==i&&(l--,0==l&&h&&u<=d&&(u=e,h=!1));return c<=a?"":u>0&&u>d?n.substring(d+1,u):n.substring(d+1)}}},{}],10:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js"),n=e("./Manyfest-CleanWrapCharacters.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r,this.cleanWrapCharacters=n}setValueAtAddress(e,t,s){if("object"!=typeof e)return!1;if("string"!=typeof t)return!1;let r=t.indexOf(".");if(-1==r){let r=t.indexOf("["),n=t.indexOf("]");if(r>0&&n>r&&n-r>1){let a=t.substring(0,r).trim(),o=t.substring(r+1,n).trim(),i=parseInt(o,10),c=!isNaN(i);if(null==e[a]&&(e[a]=c?[]:{}),"object"!=typeof e[a])return!1;if(Array.isArray(e[a])==isNaN(i))return!1;if(isNaN(i))return o=this.cleanWrapCharacters('"',o),o=this.cleanWrapCharacters("`",o),o=this.cleanWrapCharacters("'",o),o in e[a]||(e[a][o]={}),e[a][o]=s,!0;for(;e[a].length<i+1;)e[a].push({});return e[a][i]=s,!0}return e[t]=s,!0}{let n=t.substring(0,r),a=t.substring(r+1),o=n.indexOf("["),i=n.indexOf("]");if(o>0&&i>o&&i-o>1){let t=n.substring(0,o).trim(),r=n.substring(o+1,i).trim(),c=parseInt(r,10),l=!isNaN(c);if(null==e[t]&&(e[t]=l?[]:{}),Array.isArray(e[t])!=l)return!1;if(isNaN(c))return r=this.cleanWrapCharacters('"',r),r=this.cleanWrapCharacters("`",r),r=this.cleanWrapCharacters("'",r),r in e[t]||(e[t][r]={}),this.setValueAtAddress(e[t][r],a,s);for(;e[t].length<c+1;)e[t].push({});return this.setValueAtAddress(e[t][c],a,s)}return n in e&&"object"!=typeof e[n]?("__ERROR"in e||(e.__ERROR={}),e.__ERROR[t]=s,!1):(n in e||(e[n]={}),this.setValueAtAddress(e[n],a,s))}}}},{"./Manyfest-CleanWrapCharacters.js":3,"./Manyfest-LogToConsole.js":5}],11:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r}generateAddressses(e,t,s){let r="string"==typeof t?t:"",n="object"==typeof s?s:{},a=typeof e,o={Address:r,Hash:r,Name:r,InSchema:!1};switch("object"==a&&null==e&&(a="undefined"),a){case"string":o.DataType="String",o.Default=e,n[r]=o;break;case"number":case"bigint":o.DataType="Number",o.Default=e,n[r]=o;break;case"undefined":o.DataType="Any",o.Default=e,n[r]=o;break;case"object":if(Array.isArray(e)){o.DataType="Array",""!=r&&(n[r]=o);for(let t=0;t<e.length;t++)this.generateAddressses(e[t],"".concat(r,"[").concat(t,"]"),n)}else{o.DataType="Object",""!=r&&(n[r]=o,r+=".");let t=Object.keys(e);for(let s=0;s<t.length;s++)this.generateAddressses(e[t[s]],"".concat(r).concat(t[s]),n)}}return n}}},{"./Manyfest-LogToConsole.js":5}],12:[function(e,t,s){const r="<<~?",n="?~>>",a=(e,t,s,r,n)=>{switch(r){case"TRUE":return!0===e.getValueAtAddress(t,s);case"FALSE":return!1===e.getValueAtAddress(t,s);case"LNGT":case"LENGTH_GREATER_THAN":switch(typeof e.getValueAtAddress(t,s)){case"string":case"object":return e.getValueAtAddress(t,s).length>n;default:return!1}break;case"LNLT":case"LENGTH_LESS_THAN":switch(typeof e.getValueAtAddress(t,s)){case"string":case"object":return e.getValueAtAddress(t,s).length<n;default:return!1}break;case"!=":return e.getValueAtAddress(t,s)!=n;case"<":return e.getValueAtAddress(t,s)<n;case">":return e.getValueAtAddress(t,s)>n;case"<=":return e.getValueAtAddress(t,s)<=n;case">=":return e.getValueAtAddress(t,s)>=n;case"===":return e.getValueAtAddress(t,s)===n;default:return e.getValueAtAddress(t,s)==n}};t.exports=(e,t,s)=>{let o=!0,i=t.indexOf(r);for(;-1!=i;){let c=t.indexOf(n,i+4);if(-1!=c){let n=t.substring(i+4,c).split(","),l=n[0],h="EXISTS";n.length>1&&(h=n[1]);let d=!1;n.length>2&&(d=n[2]),o=o&&a(e,s,l,h,d),i=t.indexOf(r,c+4)}else i=-1}return o}},{}],13:[function(e,t,s){let r=e("./Manyfest-LogToConsole.js");t.exports=class{constructor(e,t){this.logInfo="function"==typeof e?e:r,this.logError="function"==typeof t?t:r}resolveAddressMappings(e,t){if("object"!=typeof e)return this.logError("Attempted to resolve address mapping but the descriptor was not an object."),!1;if("object"!=typeof t)return!0;let s=Object.keys(e),r={};return s.forEach((t=>{"Hash"in e[t]&&(r[e[t].Hash]=t)})),Object.keys(t).forEach((s=>{let n,a=t[s],o=null;s in e?o=s:s in r&&(o=r[s]),o?(n=e[o],delete e[o]):n={Hash:s},e[a]=n})),!0}safeResolveAddressMappings(e,t){let s=JSON.parse(JSON.stringify(e));return this.resolveAddressMappings(s,t),s}mergeAddressMappings(e,t){if("object"!=typeof t||"object"!=typeof e)return this.logError("Attempted to merge two schema descriptors but both were not objects."),!1;let s=JSON.parse(JSON.stringify(t)),r=JSON.parse(JSON.stringify(e));return Object.keys(s).forEach((e=>{e in r||(r[e]=s[e])})),r}}},{"./Manyfest-LogToConsole.js":5}],14:[function(e,t,s){const r=e("fable-serviceproviderbase");let n=e("./Manyfest-LogToConsole.js"),a=e("./Manyfest-HashTranslation.js"),o=e("./Manyfest-ObjectAddress-CheckAddressExists.js"),i=e("./Manyfest-ObjectAddress-GetValue.js"),c=e("./Manyfest-ObjectAddress-SetValue.js"),l=e("./Manyfest-ObjectAddress-DeleteValue.js"),h=e("./Manyfest-ObjectAddressGeneration.js"),d=e("./Manyfest-SchemaManipulation.js");const u={Scope:"DEFAULT",Descriptors:{}};class f extends r{constructor(e,t,s){void 0===e?super({}):super(e,t,s),this.fable,this.options,this.Hash,this.UUID,this.serviceType="Manifest",this.logInfo=n,this.logError=n,this.objectAddressCheckAddressExists=new o(this.logInfo,this.logError),this.objectAddressGetValue=new i(this.logInfo,this.logError),this.objectAddressSetValue=new c(this.logInfo,this.logError),this.objectAddressDeleteValue=new l(this.logInfo,this.logError),"defaultValues"in this.options||(this.options.defaultValues={String:"",Number:0,Float:0,Integer:0,PreciseNumber:"0.0",Boolean:!1,Binary:0,DateTime:0,Array:[],Object:{},Null:null}),"strict"in this.options||(this.options.strict=!1),this.scope=void 0,this.elementAddresses=void 0,this.elementHashes=void 0,this.elementDescriptors=void 0,this.reset(),"object"==typeof this.options&&this.loadManifest(this.options),this.schemaManipulations=new d(this.logInfo,this.logError),this.objectAddressGeneration=new h(this.logInfo,this.logError),this.hashTranslations=new a(this.logInfo,this.logError),this.numberRegex=/^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/}reset(){this.scope="DEFAULT",this.elementAddresses=[],this.elementHashes={},this.elementDescriptors={}}clone(){let e=JSON.parse(JSON.stringify(this.options)),t=new f(this.fable,e,this.Hash);t.logInfo=this.logInfo,t.logError=this.logError;const{Scope:s,Descriptors:r,HashTranslations:n}=this.getManifest();t.scope=s,t.elementDescriptors=r,t.elementAddresses=Object.keys(r);for(let e=0;e<t.elementAddresses.length;e++){let s=t.elementAddresses[e],r=t.elementDescriptors[s];t.elementHashes[s]=s,"Hash"in r&&(t.elementHashes[r.Hash]=s)}return t.hashTranslations.addTranslation(this.hashTranslations.translationTable),t}deserialize(e){return this.loadManifest(JSON.parse(e)),this}loadManifest(e){"object"!=typeof e&&this.logError("(".concat(this.scope,") Error loading manifest; expecting an object but parameter was type ").concat(typeof e,"."));let t="object"==typeof e?e:{},s=Object.keys(u);for(let e=0;e<s.length;e++)s[e]in t||(t[s[e]]=JSON.parse(JSON.stringify(u[s[e]])));if("Scope"in t?"string"==typeof t.Scope?this.scope=t.Scope:this.logError("(".concat(this.scope,") Error loading scope from manifest; expecting a string but property was type ").concat(typeof t.Scope,"."),t):this.logError("(".concat(this.scope,') Error loading scope from manifest object. Property "Scope" does not exist in the root of the object.'),t),"Descriptors"in t)if("object"==typeof t.Descriptors){let e=Object.keys(t.Descriptors);for(let s=0;s<e.length;s++)this.addDescriptor(e[s],t.Descriptors[e[s]])}else this.logError("(".concat(this.scope,") Error loading description object from manifest object. Expecting an object in 'Manifest.Descriptors' but the property was type ").concat(typeof t.Descriptors,"."),t);else this.logError("(".concat(this.scope,') Error loading object description from manifest object. Property "Descriptors" does not exist in the root of the Manifest object.'),t);if("HashTranslations"in t&&"object"==typeof t.HashTranslations)for(let e=0;e<t.HashTranslations.length;e++);}serialize(){return JSON.stringify(this.getManifest())}getManifest(){return{Scope:this.scope,Descriptors:JSON.parse(JSON.stringify(this.elementDescriptors)),HashTranslations:JSON.parse(JSON.stringify(this.hashTranslations.translationTable))}}addDescriptor(e,t){return"object"==typeof t?("Address"in t||(t.Address=e),e in this.elementDescriptors||this.elementAddresses.push(e),this.elementDescriptors[e]=t,this.elementHashes[e]=e,"Hash"in t?this.elementHashes[t.Hash]=e:t.Hash=e,!0):(this.logError("(".concat(this.scope,") Error loading object descriptor for address '").concat(e,"' from manifest object. Expecting an object but property was type ").concat(typeof t,".")),!1)}getDescriptorByHash(e){return this.getDescriptor(this.resolveHashAddress(e))}getDescriptor(e){return this.elementDescriptors[e]}eachDescriptor(e){let t=Object.keys(this.elementDescriptors);for(let s=0;s<t.length;s++)e(this.elementDescriptors[t[s]])}checkAddressExistsByHash(e,t){return this.checkAddressExists(e,this.resolveHashAddress(t))}checkAddressExists(e,t){return this.objectAddressCheckAddressExists.checkAddressExists(e,t)}resolveHashAddress(e){let t,s=e in this.elementHashes,r=e in this.hashTranslations.translationTable;return t=s&&!r?this.elementHashes[e]:r&&this.hashTranslations.translate(e)in this.elementHashes?this.elementHashes[this.hashTranslations.translate(e)]:r?this.hashTranslations.translate(e):e,t}getValueByHash(e,t){let s=this.getValueAtAddress(e,this.resolveHashAddress(t));return void 0===s&&(s=this.getDefaultValue(this.getDescriptorByHash(t))),s}lintAddress(e){let t=e.trim();return(t.endsWith("..")||t.endsWith("."))&&(t=t.slice(0,-1)),t}getValueAtAddress(e,t){let s=this.lintAddress(t);if(""==s)return void this.logError("(".concat(this.scope,") Error getting value at address; address is an empty string."),e);let r=this.objectAddressGetValue.getValueAtAddress(e,s);return void 0===r&&(r=this.getDefaultValue(this.getDescriptor(s))),r}setValueByHash(e,t,s){return this.setValueAtAddress(e,this.resolveHashAddress(t),s)}setValueAtAddress(e,t,s){let r=this.lintAddress(t);return this.objectAddressSetValue.setValueAtAddress(e,r,s)}deleteValueByHash(e,t,s){return this.deleteValueAtAddress(e,this.resolveHashAddress(t),s)}deleteValueAtAddress(e,t,s){let r=this.lintAddress(t);return this.objectAddressDeleteValue.deleteValueAtAddress(e,r,s)}validate(e){let t={Error:null,Errors:[],MissingElements:[]};"object"!=typeof e&&(t.Error=!0,t.Errors.push("Expected passed in object to be type object but was passed in ".concat(typeof e)));let s=(e,s)=>{t.Error=!0,t.Errors.push('Element at address "'.concat(e,'" ').concat(s,"."))};for(let r=0;r<this.elementAddresses.length;r++){let n=this.getDescriptor(this.elementAddresses[r]),a=this.checkAddressExists(e,n.Address),o=this.getValueAtAddress(e,n.Address);if(void 0!==o&&a||(t.MissingElements.push(n.Address),(n.Required||this.options.strict)&&s(n.Address,"is flagged REQUIRED but is not set in the object")),n.DataType){let e=typeof o;switch(n.DataType.toString().trim().toLowerCase()){case"string":"string"!=e&&s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e));break;case"precisenumber":"string"!=e?s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e)):this.numberRegex.test(o)||s(n.Address,"has a DataType ".concat(n.DataType," but is not a valid number"));break;case"number":"number"!=e&&s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e));break;case"integer":if("number"!=e)s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e));else{o.toString().indexOf(".")>-1&&s(n.Address,"has a DataType ".concat(n.DataType," but has a decimal point in the number."))}break;case"float":"number"!=e&&s(n.Address,"has a DataType ".concat(n.DataType," but is of the type ").concat(e));break;case"datetime":"Invalid Date"==new Date(o).toString()&&s(n.Address,"has a DataType ".concat(n.DataType," but is not parsable as a Date by Javascript"));default:"string"!=e&&s(n.Address,"has a DataType ".concat(n.DataType," (which auto-converted to String because it was unrecognized) but is of the type ").concat(e))}}}return t}getDefaultValue(e){if("object"==typeof e){if("Default"in e)return e.Default;{let t="DataType"in e?e.DataType:"String";return t in this.options.defaultValues?this.options.defaultValues[t]:null}}}populateDefaults(e,t){return this.populateObject(e,t,(e=>"Default"in e))}populateObject(e,t,s){let r="object"==typeof e?e:{},n=void 0!==t&&t,a="function"==typeof s?s:e=>!0;return this.elementAddresses.forEach((e=>{let t=this.getDescriptor(e);a(t)&&(!n&&this.checkAddressExists(r,e)||this.setValueAtAddress(r,e,this.getDefaultValue(t)))})),r}}t.exports=f},{"./Manyfest-HashTranslation.js":4,"./Manyfest-LogToConsole.js":5,"./Manyfest-ObjectAddress-CheckAddressExists.js":6,"./Manyfest-ObjectAddress-DeleteValue.js":7,"./Manyfest-ObjectAddress-GetValue.js":8,"./Manyfest-ObjectAddress-SetValue.js":10,"./Manyfest-ObjectAddressGeneration.js":11,"./Manyfest-SchemaManipulation.js":13,"fable-serviceproviderbase":2}]},{},[14])(14)}));
|
|
2
2
|
//# sourceMappingURL=manyfest.min.js.map
|