fable 3.1.55 → 3.1.58
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/CONTRIBUTING.md +50 -0
- package/README.md +15 -0
- package/dist/fable.js +91 -36
- package/dist/fable.js.map +1 -1
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/dist/indoctrinate_content_staging/Indoctrinate-Catalog-AppData.json +10514 -0
- package/docs/_sidebar.md +1 -1
- package/docs/_topbar.md +6 -0
- package/docs/cover.md +1 -1
- package/docs/css/docuserve.css +73 -0
- package/docs/index.html +1 -1
- package/docs/retold-catalog.json +287 -0
- package/docs/retold-keyword-index.json +43244 -0
- package/example_applications/mathematical_playground/AppData.json +4 -1
- package/example_applications/mathematical_playground/Equations.json +2 -1
- package/package.json +9 -9
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json +9 -0
- package/source/services/Fable-Service-Math.js +179 -0
- package/test/ExpressionParser_tests.js +44 -0
- package/test/Math_test.js +93 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Contributing to Retold
|
|
2
|
+
|
|
3
|
+
We welcome contributions to Retold and its modules. This guide covers the expectations and process for contributing.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
The Retold community values **empathy**, **equity**, **kindness**, and **thoughtfulness**. We expect all participants to treat each other with respect, assume good intent, and engage constructively. These values apply to all interactions: pull requests, issues, discussions, and code review.
|
|
8
|
+
|
|
9
|
+
## How to Contribute
|
|
10
|
+
|
|
11
|
+
### Pull Requests
|
|
12
|
+
|
|
13
|
+
Pull requests are the preferred method for contributing changes. To submit one:
|
|
14
|
+
|
|
15
|
+
1. Fork the module repository you want to change
|
|
16
|
+
2. Create a branch for your work
|
|
17
|
+
3. Make your changes, following the code style of the module you are editing
|
|
18
|
+
4. Ensure your changes have test coverage (see below)
|
|
19
|
+
5. Open a pull request against the module's main branch
|
|
20
|
+
|
|
21
|
+
**Submitting a pull request does not guarantee it will be accepted.** Maintainers review contributions for fit, quality, and alignment with the project's direction. A PR may be declined, or you may be asked to revise it. This is normal and not a reflection on the quality of your effort.
|
|
22
|
+
|
|
23
|
+
### Reporting Issues
|
|
24
|
+
|
|
25
|
+
If you find a bug or have a feature suggestion, open an issue on the relevant module's repository. Include enough detail to reproduce the problem or understand the proposal.
|
|
26
|
+
|
|
27
|
+
## Test Coverage
|
|
28
|
+
|
|
29
|
+
Every commit must include test coverage for the changes it introduces. Retold modules use Mocha in TDD style. Before submitting:
|
|
30
|
+
|
|
31
|
+
- **Write tests** for any new functionality or bug fixes
|
|
32
|
+
- **Run the existing test suite** with `npm test` and confirm all tests pass
|
|
33
|
+
- **Check coverage** with `npm run coverage` if the module supports it
|
|
34
|
+
|
|
35
|
+
Pull requests that break existing tests or lack coverage for new code will not be merged.
|
|
36
|
+
|
|
37
|
+
## Code Style
|
|
38
|
+
|
|
39
|
+
Follow the conventions of the module you are working in. The general Retold style is:
|
|
40
|
+
|
|
41
|
+
- **Tabs** for indentation, never spaces
|
|
42
|
+
- **Plain JavaScript** only (no TypeScript)
|
|
43
|
+
- **Allman-style braces** (opening brace on its own line)
|
|
44
|
+
- **Variable naming:** `pVariable` for parameters, `tmpVariable` for temporaries, `libSomething` for imports
|
|
45
|
+
|
|
46
|
+
When in doubt, match what the surrounding code does.
|
|
47
|
+
|
|
48
|
+
## Repository Structure
|
|
49
|
+
|
|
50
|
+
Each module is its own git repository. The [retold](https://github.com/stevenvelozo/retold) repository tracks module organization but does not contain module source code. Direct your pull request to the specific module repository where your change belongs.
|
package/README.md
CHANGED
|
@@ -378,3 +378,18 @@ const value = parser.solve('SUM(1, 2, 3, 4, 5)', {});
|
|
|
378
378
|
```
|
|
379
379
|
|
|
380
380
|
See the [Services Documentation](./docs/services/README.md) for detailed information on each service.
|
|
381
|
+
|
|
382
|
+
## Related Packages
|
|
383
|
+
|
|
384
|
+
- [fable-log](https://github.com/stevenvelozo/fable-log) - Logging services
|
|
385
|
+
- [fable-settings](https://github.com/stevenvelozo/fable-settings) - Settings management
|
|
386
|
+
- [fable-serviceproviderbase](https://github.com/stevenvelozo/fable-serviceproviderbase) - Service provider base class
|
|
387
|
+
- [fable-uuid](https://github.com/stevenvelozo/fable-uuid) - UUID generation service
|
|
388
|
+
|
|
389
|
+
## License
|
|
390
|
+
|
|
391
|
+
MIT
|
|
392
|
+
|
|
393
|
+
## Contributing
|
|
394
|
+
|
|
395
|
+
Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the [Retold Contributing Guide](https://github.com/stevenvelozo/retold/blob/main/docs/contributing.md).
|
package/dist/fable.js
CHANGED
|
@@ -407,7 +407,6 @@ return obj!==obj;// eslint-disable-line no-self-compare
|
|
|
407
407
|
*
|
|
408
408
|
* Also:
|
|
409
409
|
* - built to work well with browserify
|
|
410
|
-
* - no dependencies at all
|
|
411
410
|
* - pet friendly
|
|
412
411
|
*
|
|
413
412
|
* @author Steven Velozo <steven@velozo.com>
|
|
@@ -493,7 +492,7 @@ else tmpNode=tmpNode.RightNode;// Call the actual action
|
|
|
493
492
|
// I hate this pattern because long tails eventually cause stack overflows.
|
|
494
493
|
fAction(tmpNode.Datum,tmpNode.Hash,fIterator);};// Now kick off the iterator
|
|
495
494
|
return fIterator();}// Seek a specific node, 0 is the index of the first node.
|
|
496
|
-
seek(pNodeIndex){if(!pNodeIndex)return false;if(this.length<1)return false;if(pNodeIndex>=this.length)return false;let tmpNode=this.head;for(let i=0;i<pNodeIndex;i++){tmpNode=tmpNode.RightNode;}return tmpNode;}}module.exports=LinkedList;},{"./LinkedList-Node.js":23}],25:[function(require,module,exports){'use strict';var bind=require('function-bind');var $apply=require('./functionApply');var $call=require('./functionCall');var $reflectApply=require('./reflectApply');/** @type {import('./actualApply')} */module.exports=$reflectApply||bind.call($call,$apply);},{"./functionApply":26,"./functionCall":27,"./reflectApply":29,"function-bind":68}],26:[function(require,module,exports){'use strict';/** @type {import('./functionApply')} */module.exports=Function.prototype.apply;},{}],27:[function(require,module,exports){'use strict';/** @type {import('./functionCall')} */module.exports=Function.prototype.call;},{}],28:[function(require,module,exports){'use strict';var bind=require('function-bind');var $TypeError=require('es-errors/type');var $call=require('./functionCall');var $actualApply=require('./actualApply');/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */module.exports=function callBindBasic(args){if(args.length<1||typeof args[0]!=='function'){throw new $TypeError('a function is required');}return $actualApply(bind,$call,args);};},{"./actualApply":25,"./functionCall":27,"es-errors/type":47,"function-bind":68}],29:[function(require,module,exports){'use strict';/** @type {import('./reflectApply')} */module.exports=typeof Reflect!=='undefined'&&Reflect&&Reflect.apply;},{}],30:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBindBasic=require('call-bind-apply-helpers');/** @type {(thisArg: string, searchString: string, position?: number) => number} */var $indexOf=callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);/** @type {import('.')} */module.exports=function callBoundIntrinsic(name,allowMissing){/* eslint no-extra-parens: 0 */var intrinsic=/** @type {(this: unknown, ...args: unknown[]) => unknown} */GetIntrinsic(name,!!allowMissing);if(typeof intrinsic==='function'&&$indexOf(name,'.prototype.')>-1){return callBindBasic(/** @type {const} */[intrinsic]);}return intrinsic;};},{"call-bind-apply-helpers":28,"get-intrinsic":69}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.parse=
|
|
495
|
+
seek(pNodeIndex){if(!pNodeIndex)return false;if(this.length<1)return false;if(pNodeIndex>=this.length)return false;let tmpNode=this.head;for(let i=0;i<pNodeIndex;i++){tmpNode=tmpNode.RightNode;}return tmpNode;}}module.exports=LinkedList;},{"./LinkedList-Node.js":23}],25:[function(require,module,exports){'use strict';var bind=require('function-bind');var $apply=require('./functionApply');var $call=require('./functionCall');var $reflectApply=require('./reflectApply');/** @type {import('./actualApply')} */module.exports=$reflectApply||bind.call($call,$apply);},{"./functionApply":26,"./functionCall":27,"./reflectApply":29,"function-bind":68}],26:[function(require,module,exports){'use strict';/** @type {import('./functionApply')} */module.exports=Function.prototype.apply;},{}],27:[function(require,module,exports){'use strict';/** @type {import('./functionCall')} */module.exports=Function.prototype.call;},{}],28:[function(require,module,exports){'use strict';var bind=require('function-bind');var $TypeError=require('es-errors/type');var $call=require('./functionCall');var $actualApply=require('./actualApply');/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */module.exports=function callBindBasic(args){if(args.length<1||typeof args[0]!=='function'){throw new $TypeError('a function is required');}return $actualApply(bind,$call,args);};},{"./actualApply":25,"./functionCall":27,"es-errors/type":47,"function-bind":68}],29:[function(require,module,exports){'use strict';/** @type {import('./reflectApply')} */module.exports=typeof Reflect!=='undefined'&&Reflect&&Reflect.apply;},{}],30:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBindBasic=require('call-bind-apply-helpers');/** @type {(thisArg: string, searchString: string, position?: number) => number} */var $indexOf=callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);/** @type {import('.')} */module.exports=function callBoundIntrinsic(name,allowMissing){/* eslint no-extra-parens: 0 */var intrinsic=/** @type {(this: unknown, ...args: unknown[]) => unknown} */GetIntrinsic(name,!!allowMissing);if(typeof intrinsic==='function'&&$indexOf(name,'.prototype.')>-1){return callBindBasic(/** @type {const} */[intrinsic]);}return intrinsic;};},{"call-bind-apply-helpers":28,"get-intrinsic":69}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.parseCookie=parseCookie;exports.parse=parseCookie;exports.stringifyCookie=stringifyCookie;exports.stringifySetCookie=stringifySetCookie;exports.serialize=stringifySetCookie;exports.parseSetCookie=parseSetCookie;exports.stringifySetCookie=stringifySetCookie;exports.serialize=stringifySetCookie;/**
|
|
497
496
|
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
|
|
498
497
|
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
|
|
499
498
|
* which has been replaced by the token definition in RFC 7230 appendix B.
|
|
@@ -545,24 +544,31 @@ seek(pNodeIndex){if(!pNodeIndex)return false;if(this.length<1)return false;if(pN
|
|
|
545
544
|
* path-value = <any CHAR except CTLs or ";">
|
|
546
545
|
* CHAR = %x01-7F
|
|
547
546
|
* ; defined in RFC 5234 appendix B.1
|
|
548
|
-
*/const pathValueRegExp=/^[\u0020-\u003A\u003D-\u007E]
|
|
549
|
-
*
|
|
547
|
+
*/const pathValueRegExp=/^[\u0020-\u003A\u003D-\u007E]*$/;/**
|
|
548
|
+
* RegExp to match max-age-value in RFC 6265 sec 5.6.2
|
|
549
|
+
*/const maxAgeRegExp=/^-?\d+$/;const __toString=Object.prototype.toString;const NullObject=/* @__PURE__ */(()=>{const C=function(){};C.prototype=Object.create(null);return C;})();/**
|
|
550
|
+
* Parse a `Cookie` header.
|
|
550
551
|
*
|
|
551
552
|
* Parse the given cookie header string into an object
|
|
552
553
|
* The object has the various cookies as keys(names) => values
|
|
553
|
-
*/function
|
|
554
|
-
if(len<2)return obj;const dec=(options===null||options===void 0?void 0:options.decode)||decode;let index=0;do{const eqIdx=str
|
|
555
|
-
const
|
|
556
|
-
index=str.lastIndexOf(";",eqIdx-1)+1;continue;}const
|
|
557
|
-
if(obj[key]===undefined){
|
|
558
|
-
*
|
|
554
|
+
*/function parseCookie(str,options){const obj=new NullObject();const len=str.length;// RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
|
|
555
|
+
if(len<2)return obj;const dec=(options===null||options===void 0?void 0:options.decode)||decode;let index=0;do{const eqIdx=eqIndex(str,index,len);if(eqIdx===-1)break;// No more cookie pairs.
|
|
556
|
+
const endIdx=endIndex(str,index,len);if(eqIdx>endIdx){// backtrack on prior semicolon
|
|
557
|
+
index=str.lastIndexOf(";",eqIdx-1)+1;continue;}const key=valueSlice(str,index,eqIdx);// only assign once
|
|
558
|
+
if(obj[key]===undefined){obj[key]=dec(valueSlice(str,eqIdx+1,endIdx));}index=endIdx+1;}while(index<len);return obj;}/**
|
|
559
|
+
* Stringifies an object into an HTTP `Cookie` header.
|
|
560
|
+
*/function stringifyCookie(cookie,options){const enc=(options===null||options===void 0?void 0:options.encode)||encodeURIComponent;const cookieStrings=[];for(const name of Object.keys(cookie)){const val=cookie[name];if(val===undefined)continue;if(!cookieNameRegExp.test(name)){throw new TypeError(`cookie name is invalid: ${name}`);}const value=enc(val);if(!cookieValueRegExp.test(value)){throw new TypeError(`cookie val is invalid: ${val}`);}cookieStrings.push(`${name}=${value}`);}return cookieStrings.join("; ");}function stringifySetCookie(_name,_val,_opts){const cookie=typeof _name==="object"?_name:{..._opts,name:_name,value:String(_val)};const options=typeof _val==="object"?_val:_opts;const enc=(options===null||options===void 0?void 0:options.encode)||encodeURIComponent;if(!cookieNameRegExp.test(cookie.name)){throw new TypeError(`argument name is invalid: ${cookie.name}`);}const value=cookie.value?enc(cookie.value):"";if(!cookieValueRegExp.test(value)){throw new TypeError(`argument val is invalid: ${cookie.value}`);}let str=cookie.name+"="+value;if(cookie.maxAge!==undefined){if(!Number.isInteger(cookie.maxAge)){throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);}str+="; Max-Age="+cookie.maxAge;}if(cookie.domain){if(!domainValueRegExp.test(cookie.domain)){throw new TypeError(`option domain is invalid: ${cookie.domain}`);}str+="; Domain="+cookie.domain;}if(cookie.path){if(!pathValueRegExp.test(cookie.path)){throw new TypeError(`option path is invalid: ${cookie.path}`);}str+="; Path="+cookie.path;}if(cookie.expires){if(!isDate(cookie.expires)||!Number.isFinite(cookie.expires.valueOf())){throw new TypeError(`option expires is invalid: ${cookie.expires}`);}str+="; Expires="+cookie.expires.toUTCString();}if(cookie.httpOnly){str+="; HttpOnly";}if(cookie.secure){str+="; Secure";}if(cookie.partitioned){str+="; Partitioned";}if(cookie.priority){const priority=typeof cookie.priority==="string"?cookie.priority.toLowerCase():undefined;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: ${cookie.priority}`);}}if(cookie.sameSite){const sameSite=typeof cookie.sameSite==="string"?cookie.sameSite.toLowerCase():cookie.sameSite;switch(sameSite){case true:case"strict":str+="; SameSite=Strict";break;case"lax":str+="; SameSite=Lax";break;case"none":str+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);}}return str;}/**
|
|
561
|
+
* Deserialize a `Set-Cookie` header into an object.
|
|
559
562
|
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
|
|
563
|
-
*
|
|
564
|
-
|
|
565
|
-
|
|
563
|
+
* deserialize('foo=bar; httpOnly')
|
|
564
|
+
* => { name: 'foo', value: 'bar', httpOnly: true }
|
|
565
|
+
*/function parseSetCookie(str,options){const dec=(options===null||options===void 0?void 0:options.decode)||decode;const len=str.length;const endIdx=endIndex(str,0,len);const eqIdx=eqIndex(str,0,endIdx);const setCookie=eqIdx===-1?{name:"",value:dec(valueSlice(str,0,endIdx))}:{name:valueSlice(str,0,eqIdx),value:dec(valueSlice(str,eqIdx+1,endIdx))};let index=endIdx+1;while(index<len){const endIdx=endIndex(str,index,len);const eqIdx=eqIndex(str,index,endIdx);const attr=eqIdx===-1?valueSlice(str,index,endIdx):valueSlice(str,index,eqIdx);const val=eqIdx===-1?undefined:valueSlice(str,eqIdx+1,endIdx);switch(attr.toLowerCase()){case"httponly":setCookie.httpOnly=true;break;case"secure":setCookie.secure=true;break;case"partitioned":setCookie.partitioned=true;break;case"domain":setCookie.domain=val;break;case"path":setCookie.path=val;break;case"max-age":if(val&&maxAgeRegExp.test(val))setCookie.maxAge=Number(val);break;case"expires":if(!val)break;const date=new Date(val);if(Number.isFinite(date.valueOf()))setCookie.expires=date;break;case"priority":if(!val)break;const priority=val.toLowerCase();if(priority==="low"||priority==="medium"||priority==="high"){setCookie.priority=priority;}break;case"samesite":if(!val)break;const sameSite=val.toLowerCase();if(sameSite==="lax"||sameSite==="strict"||sameSite==="none"){setCookie.sameSite=sameSite;}break;}index=endIdx+1;}return setCookie;}/**
|
|
566
|
+
* Find the `;` character between `min` and `len` in str.
|
|
567
|
+
*/function endIndex(str,min,len){const index=str.indexOf(";",min);return index===-1?len:index;}/**
|
|
568
|
+
* Find the `=` character between `min` and `max` in str.
|
|
569
|
+
*/function eqIndex(str,min,max){const index=str.indexOf("=",min);return index<max?index:-1;}/**
|
|
570
|
+
* Slice out a value between startPod to max.
|
|
571
|
+
*/function valueSlice(str,min,max){let start=min;let end=max;do{const code=str.charCodeAt(start);if(code!==0x20/* */&&code!==0x09/* \t */)break;}while(++start<end);while(end>start){const code=str.charCodeAt(end-1);if(code!==0x20/* */&&code!==0x09/* \t */)break;end--;}return str.slice(start,end);}/**
|
|
566
572
|
* URL-decode string value. Optimized to skip native call when no %.
|
|
567
573
|
*/function decode(str){if(str.indexOf("%")===-1)return str;try{return decodeURIComponent(str);}catch(e){return str;}}/**
|
|
568
574
|
* Determine if value is a Date.
|
|
@@ -619,7 +625,7 @@ for(i=listeners.length-1;i>=0;i--){this.removeListener(type,listeners[i]);}}retu
|
|
|
619
625
|
// EventEmitters, we do not listen for `error` events here.
|
|
620
626
|
emitter.addEventListener(name,function wrapListener(arg){// IE does not have builtin `{ once: true }` support so we
|
|
621
627
|
// have to do it manually.
|
|
622
|
-
if(flags.once){emitter.removeEventListener(name,wrapListener);}listener(arg);});}else{throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof emitter);}}},{}],51:[function(require,module,exports){module.exports={"name":"fable-log","version":"3.0.
|
|
628
|
+
if(flags.once){emitter.removeEventListener(name,wrapListener);}listener(arg);});}else{throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof emitter);}}},{}],51:[function(require,module,exports){module.exports={"name":"fable-log","version":"3.0.17","description":"A simple logging wrapper.","main":"source/Fable-Log.js","scripts":{"start":"node source/Fable-Log.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","tests":"npx mocha -u tdd --exit -R spec --grep"},"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"]},"browser":{"./source/Fable-Log-DefaultProviders-Node.js":"./source/Fable-Log-DefaultProviders-Web.js"},"repository":{"type":"git","url":"https://github.com/stevenvelozo/fable-log.git"},"keywords":["logging"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable-log/issues"},"homepage":"https://github.com/stevenvelozo/fable-log","devDependencies":{"quackage":"^1.0.51"},"dependencies":{"fable-serviceproviderbase":"^3.0.17"}};},{}],52:[function(require,module,exports){/**
|
|
623
629
|
* Base Logger Class
|
|
624
630
|
*
|
|
625
631
|
*
|
|
@@ -667,7 +673,7 @@ switch(pLevel){case'trace':this.logStreamsTrace.push(pLogger);case'debug':this.l
|
|
|
667
673
|
for(let i=0;i<this._StreamDefinitions.length;i++){let tmpStreamDefinition=Object.assign({loggertype:'default',streamtype:'console',level:'info'},this._StreamDefinitions[i]);if(!(tmpStreamDefinition.loggertype in this._Providers)){console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(tmpStreamDefinition)}`);}else{this.addLogger(new this._Providers[tmpStreamDefinition.loggertype](tmpStreamDefinition,this),tmpStreamDefinition.level);}}// Now initialize each one.
|
|
668
674
|
for(let i=0;i<this.logStreams.length;i++){this.logStreams[i].initialize();}}logTime(pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time';let tmpTime=new Date();this.info(`${tmpMessage} ${tmpTime} (epoch ${+tmpTime})`,pDatum);}// Get a timestamp
|
|
669
675
|
getTimeStamp(){return+new Date();}getTimeDelta(pTimeStamp){let tmpEndTime=+new Date();return tmpEndTime-pTimeStamp;}// Log the delta between a timestamp, and now with a message
|
|
670
|
-
logTimeDelta(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpDatum=typeof pDatum==='object'?pDatum:{};let tmpEndTime=+new Date();this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms)`,pDatum);}logTimeDeltaHuman(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpEndTime=+new Date();let tmpMs=parseInt(pTimeDelta%1000);let tmpSeconds=parseInt(pTimeDelta/1000%60);let tmpMinutes=parseInt(pTimeDelta/(1000*60)%60);let tmpHours=parseInt(pTimeDelta/(1000*60*60));tmpMs=tmpMs<10?"00"+tmpMs:tmpMs<100?"0"+tmpMs:tmpMs;tmpSeconds=tmpSeconds<10?"0"+tmpSeconds:tmpSeconds;tmpMinutes=tmpMinutes<10?"0"+tmpMinutes:tmpMinutes;tmpHours=tmpHours<10?"0"+tmpHours:tmpHours;this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms) or (${tmpHours}:${tmpMinutes}:${tmpSeconds}.${tmpMs})`,pDatum);}logTimeDeltaRelative(pStartTime,pMessage,pDatum){this.logTimeDelta(this.getTimeDelta(pStartTime),pMessage,pDatum);}logTimeDeltaRelativeHuman(pStartTime,pMessage,pDatum){this.logTimeDeltaHuman(this.getTimeDelta(pStartTime),pMessage,pDatum);}}module.exports=FableLog;module.exports.LogProviderBase=require('./Fable-Log-BaseLogger.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-Console.js');module.exports.LogProviderFlatfile=require('./Fable-Log-Logger-SimpleFlatFile.js');},{"../package.json":51,"./Fable-Log-BaseLogger.js":52,"./Fable-Log-DefaultProviders-Node.js":53,"./Fable-Log-DefaultStreams.json":54,"./Fable-Log-Logger-Console.js":55,"./Fable-Log-Logger-SimpleFlatFile.js":56,"fable-serviceproviderbase":59}],58:[function(require,module,exports){module.exports={"name":"fable-serviceproviderbase","version":"3.0.
|
|
676
|
+
logTimeDelta(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpDatum=typeof pDatum==='object'?pDatum:{};let tmpEndTime=+new Date();this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms)`,pDatum);}logTimeDeltaHuman(pTimeDelta,pMessage,pDatum){let tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';let tmpEndTime=+new Date();let tmpMs=parseInt(pTimeDelta%1000);let tmpSeconds=parseInt(pTimeDelta/1000%60);let tmpMinutes=parseInt(pTimeDelta/(1000*60)%60);let tmpHours=parseInt(pTimeDelta/(1000*60*60));tmpMs=tmpMs<10?"00"+tmpMs:tmpMs<100?"0"+tmpMs:tmpMs;tmpSeconds=tmpSeconds<10?"0"+tmpSeconds:tmpSeconds;tmpMinutes=tmpMinutes<10?"0"+tmpMinutes:tmpMinutes;tmpHours=tmpHours<10?"0"+tmpHours:tmpHours;this.info(`${tmpMessage} logged at (epoch ${+tmpEndTime}) took (${pTimeDelta}ms) or (${tmpHours}:${tmpMinutes}:${tmpSeconds}.${tmpMs})`,pDatum);}logTimeDeltaRelative(pStartTime,pMessage,pDatum){this.logTimeDelta(this.getTimeDelta(pStartTime),pMessage,pDatum);}logTimeDeltaRelativeHuman(pStartTime,pMessage,pDatum){this.logTimeDeltaHuman(this.getTimeDelta(pStartTime),pMessage,pDatum);}}module.exports=FableLog;module.exports.LogProviderBase=require('./Fable-Log-BaseLogger.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-Console.js');module.exports.LogProviderFlatfile=require('./Fable-Log-Logger-SimpleFlatFile.js');},{"../package.json":51,"./Fable-Log-BaseLogger.js":52,"./Fable-Log-DefaultProviders-Node.js":53,"./Fable-Log-DefaultStreams.json":54,"./Fable-Log-Logger-Console.js":55,"./Fable-Log-Logger-SimpleFlatFile.js":56,"fable-serviceproviderbase":59}],58:[function(require,module,exports){module.exports={"name":"fable-serviceproviderbase","version":"3.0.18","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","types":"tsc -p ./tsconfig.build.json","check":"tsc -p . --noEmit"},"types":"types/source/Fable-ServiceProviderBase.d.ts","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":{"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":{"@types/mocha":"^10.0.10","fable":"^3.1.55","quackage":"^1.0.51","typescript":"^5.9.3"}};},{}],59:[function(require,module,exports){/**
|
|
671
677
|
* Fable Service Base
|
|
672
678
|
* @author <steven@velozo.com>
|
|
673
679
|
*/const libPackage=require('../package.json');class FableServiceProviderBase{/**
|
|
@@ -688,7 +694,7 @@ this.serviceType=`Unknown-${this.UUID}`;// The service hash is used to identify
|
|
|
688
694
|
this.Hash=typeof pServiceHash==='string'?pServiceHash:!this.fable&&typeof pOptions==='string'?pOptions:`${this.UUID}`;}/**
|
|
689
695
|
* @param {import('fable')} pFable
|
|
690
696
|
*/connectFable(pFable){if(typeof pFable!=='object'||!pFable.isFable){let tmpErrorMessage=`Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof pFable}].}`;console.log(tmpErrorMessage);return new Error(tmpErrorMessage);}if(!this.fable){this.fable=pFable;}if(!this.log){this.log=this.fable.Logging;}if(!this.services){this.services=this.fable.services;}if(!this.servicesMap){this.servicesMap=this.fable.servicesMap;}return true;}}_defineProperty2(FableServiceProviderBase,"isFableService",true);module.exports=FableServiceProviderBase;// This is left here in case we want to go back to having different code/base class for "core" services
|
|
691
|
-
module.exports.CoreServiceProviderBase=FableServiceProviderBase;},{"../package.json":58}],60:[function(require,module,exports){module.exports={"name":"fable-settings","version":"3.0.
|
|
697
|
+
module.exports.CoreServiceProviderBase=FableServiceProviderBase;},{"../package.json":58}],60:[function(require,module,exports){module.exports={"name":"fable-settings","version":"3.0.15","description":"A simple, tolerant configuration chain.","main":"source/Fable-Settings.js","scripts":{"start":"node source/Fable-Settings.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-settings:local","docker-dev-run":"docker run -it -d --name retold-fable-settings-dev -p 30003:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable-settings\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/fable-settings: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":{"type":"git","url":"https://github.com/stevenvelozo/fable-settings.git"},"keywords":["configuration"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable-settings/issues"},"homepage":"https://github.com/stevenvelozo/fable-settings","devDependencies":{"quackage":"^1.0.51"},"dependencies":{"fable-serviceproviderbase":"^3.0.17","precedent":"^1.0.15"}};},{}],61:[function(require,module,exports){module.exports={"Product":"ApplicationNameHere","ProductVersion":"0.0.0","ConfigFile":false,"LogStreams":[{"level":"trace"}]};},{}],62:[function(require,module,exports){(function(process){(function(){/**
|
|
692
698
|
* Fable Settings Template Processor
|
|
693
699
|
*
|
|
694
700
|
* This class allows environment variables to come in via templated expressions, and defaults to be set.
|
|
@@ -732,7 +738,7 @@ this._configureEnvTemplating(tmpSettingsTo);return tmpSettingsTo;}// Fill in set
|
|
|
732
738
|
fill(pSettingsFrom){// If an invalid settings from object is passed in (e.g. object constructor without passing in anything) this should still work
|
|
733
739
|
let tmpSettingsFrom=typeof pSettingsFrom==='object'?pSettingsFrom:{};// do not mutate the From object property values
|
|
734
740
|
let tmpSettingsFromCopy=JSON.parse(JSON.stringify(tmpSettingsFrom));this.settings=this._deepMergeObjects(tmpSettingsFromCopy,this.settings);return this.settings;}};// This is for backwards compatibility
|
|
735
|
-
function autoConstruct(pSettings){return new FableSettings(pSettings);}module.exports=FableSettings;module.exports.new=autoConstruct;},{"../package.json":60,"./Fable-Settings-Default":61,"./Fable-Settings-TemplateProcessor.js":62,"fable-serviceproviderbase":59}],64:[function(require,module,exports){module.exports={"name":"fable-uuid","version":"3.0.
|
|
741
|
+
function autoConstruct(pSettings){return new FableSettings(pSettings);}module.exports=FableSettings;module.exports.new=autoConstruct;},{"../package.json":60,"./Fable-Settings-Default":61,"./Fable-Settings-TemplateProcessor.js":62,"fable-serviceproviderbase":59}],64:[function(require,module,exports){module.exports={"name":"fable-uuid","version":"3.0.12","description":"A simple UUID Generator.","main":"source/Fable-UUID.js","scripts":{"start":"node source/Fable-UUID.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-uuid:local","docker-dev-run":"docker run -it -d --name retold-fable-uuid-dev -p 30002:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable-uuid\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/fable-uuid: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":{"type":"git","url":"https://github.com/stevenvelozo/fable-uuid.git"},"keywords":["logging"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable-uuid/issues"},"browser":{"./source/Fable-UUID-Random.js":"./source/Fable-UUID-Random-Browser.js"},"homepage":"https://github.com/stevenvelozo/fable-uuid","devDependencies":{"quackage":"^1.0.51"},"dependencies":{"fable-serviceproviderbase":"^3.0.17"}};},{}],65:[function(require,module,exports){/**
|
|
736
742
|
* Random Byte Generator - Browser version
|
|
737
743
|
*
|
|
738
744
|
*
|
|
@@ -2165,7 +2171,7 @@ for/* no condition */(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:
|
|
|
2165
2171
|
if(typeof define=='function'&&typeof define.amd=='object'&&define.amd){define('punycode',function(){return punycode;});}else if(freeExports&&freeModule){if(module.exports==freeExports){// in Node.js, io.js, or RingoJS v0.8.0+
|
|
2166
2172
|
freeModule.exports=punycode;}else{// in Narwhal or RingoJS v0.7.0-
|
|
2167
2173
|
for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);}}}else{// in Rhino or a web browser
|
|
2168
|
-
root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],109:[function(require,module,exports){'use strict';var replace=String.prototype.replace;var percentTwenties=/%20/g;var Format={RFC1738:'RFC1738',RFC3986:'RFC3986'};module.exports={'default':Format.RFC3986,formatters:{RFC1738:function(value){return replace.call(value,percentTwenties,'+');},RFC3986:function(value){return String(value);}},RFC1738:Format.RFC1738,RFC3986:Format.RFC3986};},{}],110:[function(require,module,exports){'use strict';var stringify=require('./stringify');var parse=require('./parse');var formats=require('./formats');module.exports={formats:formats,parse:parse,stringify:stringify};},{"./formats":109,"./parse":111,"./stringify":112}],111:[function(require,module,exports){'use strict';var utils=require('./utils');var has=Object.prototype.hasOwnProperty;var isArray=Array.isArray;var defaults={allowDots:false,allowEmptyArrays:false,allowPrototypes:false,allowSparse:false,arrayLimit:20,charset:'utf-8',charsetSentinel:false,comma:false,decodeDotInKeys:false,decoder:utils.decode,delimiter:'&',depth:5,duplicates:'combine',ignoreQueryPrefix:false,interpretNumericEntities:false,parameterLimit:1000,parseArrays:true,plainObjects:false,strictDepth:false,strictNullHandling:false,throwOnLimitExceeded:false};var interpretNumericEntities=function(str){return str.replace(/&#(\d+);/g,function($0,numberStr){return String.fromCharCode(parseInt(numberStr,10));});};var parseArrayValue=function(val,options,currentArrayLength){if(val&&typeof val==='string'&&options.comma&&val.indexOf(',')>-1){return val.split(',');}if(options.throwOnLimitExceeded&¤tArrayLength>=options.arrayLimit){throw new RangeError('Array limit exceeded. Only '+options.arrayLimit+' element'+(options.arrayLimit===1?'':'s')+' allowed in an array.');}return val;};// This is what browsers will submit when the ✓ character occurs in an
|
|
2174
|
+
root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],109:[function(require,module,exports){'use strict';var replace=String.prototype.replace;var percentTwenties=/%20/g;var Format={RFC1738:'RFC1738',RFC3986:'RFC3986'};module.exports={'default':Format.RFC3986,formatters:{RFC1738:function(value){return replace.call(value,percentTwenties,'+');},RFC3986:function(value){return String(value);}},RFC1738:Format.RFC1738,RFC3986:Format.RFC3986};},{}],110:[function(require,module,exports){'use strict';var stringify=require('./stringify');var parse=require('./parse');var formats=require('./formats');module.exports={formats:formats,parse:parse,stringify:stringify};},{"./formats":109,"./parse":111,"./stringify":112}],111:[function(require,module,exports){'use strict';var utils=require('./utils');var has=Object.prototype.hasOwnProperty;var isArray=Array.isArray;var defaults={allowDots:false,allowEmptyArrays:false,allowPrototypes:false,allowSparse:false,arrayLimit:20,charset:'utf-8',charsetSentinel:false,comma:false,decodeDotInKeys:false,decoder:utils.decode,delimiter:'&',depth:5,duplicates:'combine',ignoreQueryPrefix:false,interpretNumericEntities:false,parameterLimit:1000,parseArrays:true,plainObjects:false,strictDepth:false,strictMerge:true,strictNullHandling:false,throwOnLimitExceeded:false};var interpretNumericEntities=function(str){return str.replace(/&#(\d+);/g,function($0,numberStr){return String.fromCharCode(parseInt(numberStr,10));});};var parseArrayValue=function(val,options,currentArrayLength){if(val&&typeof val==='string'&&options.comma&&val.indexOf(',')>-1){return val.split(',');}if(options.throwOnLimitExceeded&¤tArrayLength>=options.arrayLimit){throw new RangeError('Array limit exceeded. Only '+options.arrayLimit+' element'+(options.arrayLimit===1?'':'s')+' allowed in an array.');}return val;};// This is what browsers will submit when the ✓ character occurs in an
|
|
2169
2175
|
// application/x-www-form-urlencoded body and the encoding of the page containing
|
|
2170
2176
|
// the form is iso-8859-1, or when the submitted form has an accept-charset
|
|
2171
2177
|
// attribute of iso-8859-1. Presumably also with other charsets that do not contain
|
|
@@ -2173,24 +2179,22 @@ root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="und
|
|
|
2173
2179
|
var isoSentinel='utf8=%26%2310003%3B';// encodeURIComponent('✓')
|
|
2174
2180
|
// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
|
|
2175
2181
|
var charsetSentinel='utf8=%E2%9C%93';// encodeURIComponent('✓')
|
|
2176
|
-
var parseValues=function parseQueryStringValues(str,options){var obj={__proto__:null};var cleanStr=options.ignoreQueryPrefix?str.replace(/^\?/,''):str;cleanStr=cleanStr.replace(/%5B/gi,'[').replace(/%5D/gi,']');var limit=options.parameterLimit===Infinity?undefined:options.parameterLimit;var parts=cleanStr.split(options.delimiter,options.throwOnLimitExceeded?limit+1:limit);if(options.throwOnLimitExceeded&&parts.length>limit){throw new RangeError('Parameter limit exceeded. Only '+limit+' parameter'+(limit===1?'':'s')+' allowed.');}var skipIndex=-1;// Keep track of where the utf8 sentinel was found
|
|
2182
|
+
var parseValues=function parseQueryStringValues(str,options){var obj={__proto__:null};var cleanStr=options.ignoreQueryPrefix?str.replace(/^\?/,''):str;cleanStr=cleanStr.replace(/%5B/gi,'[').replace(/%5D/gi,']');var limit=options.parameterLimit===Infinity?void undefined:options.parameterLimit;var parts=cleanStr.split(options.delimiter,options.throwOnLimitExceeded?limit+1:limit);if(options.throwOnLimitExceeded&&parts.length>limit){throw new RangeError('Parameter limit exceeded. Only '+limit+' parameter'+(limit===1?'':'s')+' allowed.');}var skipIndex=-1;// Keep track of where the utf8 sentinel was found
|
|
2177
2183
|
var i;var charset=options.charset;if(options.charsetSentinel){for(i=0;i<parts.length;++i){if(parts[i].indexOf('utf8=')===0){if(parts[i]===charsetSentinel){charset='utf-8';}else if(parts[i]===isoSentinel){charset='iso-8859-1';}skipIndex=i;i=parts.length;// The eslint settings do not allow break;
|
|
2178
|
-
}}}for(i=0;i<parts.length;++i){if(i===skipIndex){continue;}var part=parts[i];var bracketEqualsPos=part.indexOf(']=');var pos=bracketEqualsPos===-1?part.indexOf('='):bracketEqualsPos+1;var key;var val;if(pos===-1){key=options.decoder(part,defaults.decoder,charset,'key');val=options.strictNullHandling?null:'';}else{key=options.decoder(part.slice(0,pos),defaults.decoder,charset,'key');val=utils.maybeMap(parseArrayValue(part.slice(pos+1),options,isArray(obj[key])?obj[key].length:0),function(encodedVal){return options.decoder(encodedVal,defaults.decoder,charset,'value');});}if(val&&options.interpretNumericEntities&&charset==='iso-8859-1'){val=interpretNumericEntities(String(val));}if(part.indexOf('[]=')>-1){val=isArray(val)?[val]:val;}var existing=has.call(obj,key);if(existing&&options.duplicates==='combine'){obj[key]=utils.combine(obj[key],val);}else if(!existing||options.duplicates==='last'){obj[key]=val;}}return obj;};var parseObject=function(chain,val,options,valuesParsed){var currentArrayLength=0;if(chain.length>0&&chain[chain.length-1]==='[]'){var parentKey=chain.slice(0,-1).join('');currentArrayLength=Array.isArray(val)&&val[parentKey]?val[parentKey].length:0;}var leaf=valuesParsed?val:parseArrayValue(val,options,currentArrayLength);for(var i=chain.length-1;i>=0;--i){var obj;var root=chain[i];if(root==='[]'&&options.parseArrays){
|
|
2179
|
-
var key=options.allowDots?givenKey.replace(/\.([^.[]+)/g,'[$1]'):givenKey
|
|
2180
|
-
var
|
|
2181
|
-
var segment=options.depth>0&&brackets.exec(key);var parent=segment?key.slice(0,segment.index):key;// Stash the parent if it exists
|
|
2182
|
-
var keys=[];if(parent){// If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
|
|
2183
|
-
if(!options.plainObjects&&has.call(Object.prototype,parent)){if(!options.allowPrototypes){return;}}keys.push(parent);}// Loop through children appending to the array until we hit depth
|
|
2184
|
-
var i=0;while(options.depth>0&&(segment=child.exec(key))!==null&&i<options.depth){i+=1;if(!options.plainObjects&&has.call(Object.prototype,segment[1].slice(1,-1))){if(!options.allowPrototypes){return;}}keys.push(segment[1]);}// If there's a remainder, check strictDepth option for throw, else just add whatever is left
|
|
2185
|
-
if(segment){if(options.strictDepth===true){throw new RangeError('Input depth exceeded depth option of '+options.depth+' and strictDepth is true');}keys.push('['+key.slice(segment.index)+']');}return parseObject(keys,val,options,valuesParsed);};var normalizeParseOptions=function normalizeParseOptions(opts){if(!opts){return defaults;}if(typeof opts.allowEmptyArrays!=='undefined'&&typeof opts.allowEmptyArrays!=='boolean'){throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');}if(typeof opts.decodeDotInKeys!=='undefined'&&typeof opts.decodeDotInKeys!=='boolean'){throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');}if(opts.decoder!==null&&typeof opts.decoder!=='undefined'&&typeof opts.decoder!=='function'){throw new TypeError('Decoder has to be a function.');}if(typeof opts.charset!=='undefined'&&opts.charset!=='utf-8'&&opts.charset!=='iso-8859-1'){throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');}if(typeof opts.throwOnLimitExceeded!=='undefined'&&typeof opts.throwOnLimitExceeded!=='boolean'){throw new TypeError('`throwOnLimitExceeded` option must be a boolean');}var charset=typeof opts.charset==='undefined'?defaults.charset:opts.charset;var duplicates=typeof opts.duplicates==='undefined'?defaults.duplicates:opts.duplicates;if(duplicates!=='combine'&&duplicates!=='first'&&duplicates!=='last'){throw new TypeError('The duplicates option must be either combine, first, or last');}var allowDots=typeof opts.allowDots==='undefined'?opts.decodeDotInKeys===true?true:defaults.allowDots:!!opts.allowDots;return{allowDots:allowDots,allowEmptyArrays:typeof opts.allowEmptyArrays==='boolean'?!!opts.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:typeof opts.allowPrototypes==='boolean'?opts.allowPrototypes:defaults.allowPrototypes,allowSparse:typeof opts.allowSparse==='boolean'?opts.allowSparse:defaults.allowSparse,arrayLimit:typeof opts.arrayLimit==='number'?opts.arrayLimit:defaults.arrayLimit,charset:charset,charsetSentinel:typeof opts.charsetSentinel==='boolean'?opts.charsetSentinel:defaults.charsetSentinel,comma:typeof opts.comma==='boolean'?opts.comma:defaults.comma,decodeDotInKeys:typeof opts.decodeDotInKeys==='boolean'?opts.decodeDotInKeys:defaults.decodeDotInKeys,decoder:typeof opts.decoder==='function'?opts.decoder:defaults.decoder,delimiter:typeof opts.delimiter==='string'||utils.isRegExp(opts.delimiter)?opts.delimiter:defaults.delimiter,// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
2186
|
-
depth:typeof opts.depth==='number'||opts.depth===false?+opts.depth:defaults.depth,duplicates:duplicates,ignoreQueryPrefix:opts.ignoreQueryPrefix===true,interpretNumericEntities:typeof opts.interpretNumericEntities==='boolean'?opts.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:typeof opts.parameterLimit==='number'?opts.parameterLimit:defaults.parameterLimit,parseArrays:opts.parseArrays!==false,plainObjects:typeof opts.plainObjects==='boolean'?opts.plainObjects:defaults.plainObjects,strictDepth:typeof opts.strictDepth==='boolean'?!!opts.strictDepth:defaults.strictDepth,strictNullHandling:typeof opts.strictNullHandling==='boolean'?opts.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:typeof opts.throwOnLimitExceeded==='boolean'?opts.throwOnLimitExceeded:false};};module.exports=function(str,opts){var options=normalizeParseOptions(opts);if(str===''||str===null||typeof str==='undefined'){return options.plainObjects?{__proto__:null}:{};}var tempObj=typeof str==='string'?parseValues(str,options):str;var obj=options.plainObjects?{__proto__:null}:{};// Iterate over the keys and setup the new object
|
|
2184
|
+
}}}for(i=0;i<parts.length;++i){if(i===skipIndex){continue;}var part=parts[i];var bracketEqualsPos=part.indexOf(']=');var pos=bracketEqualsPos===-1?part.indexOf('='):bracketEqualsPos+1;var key;var val;if(pos===-1){key=options.decoder(part,defaults.decoder,charset,'key');val=options.strictNullHandling?null:'';}else{key=options.decoder(part.slice(0,pos),defaults.decoder,charset,'key');if(key!==null){val=utils.maybeMap(parseArrayValue(part.slice(pos+1),options,isArray(obj[key])?obj[key].length:0),function(encodedVal){return options.decoder(encodedVal,defaults.decoder,charset,'value');});}}if(val&&options.interpretNumericEntities&&charset==='iso-8859-1'){val=interpretNumericEntities(String(val));}if(part.indexOf('[]=')>-1){val=isArray(val)?[val]:val;}if(options.comma&&isArray(val)&&val.length>options.arrayLimit){if(options.throwOnLimitExceeded){throw new RangeError('Array limit exceeded. Only '+options.arrayLimit+' element'+(options.arrayLimit===1?'':'s')+' allowed in an array.');}val=utils.combine([],val,options.arrayLimit,options.plainObjects);}if(key!==null){var existing=has.call(obj,key);if(existing&&(options.duplicates==='combine'||part.indexOf('[]=')>-1)){obj[key]=utils.combine(obj[key],val,options.arrayLimit,options.plainObjects);}else if(!existing||options.duplicates==='last'){obj[key]=val;}}}return obj;};var parseObject=function(chain,val,options,valuesParsed){var currentArrayLength=0;if(chain.length>0&&chain[chain.length-1]==='[]'){var parentKey=chain.slice(0,-1).join('');currentArrayLength=Array.isArray(val)&&val[parentKey]?val[parentKey].length:0;}var leaf=valuesParsed?val:parseArrayValue(val,options,currentArrayLength);for(var i=chain.length-1;i>=0;--i){var obj;var root=chain[i];if(root==='[]'&&options.parseArrays){if(utils.isOverflow(leaf)){// leaf is already an overflow object, preserve it
|
|
2185
|
+
obj=leaf;}else{obj=options.allowEmptyArrays&&(leaf===''||options.strictNullHandling&&leaf===null)?[]:utils.combine([],leaf,options.arrayLimit,options.plainObjects);}}else{obj=options.plainObjects?{__proto__:null}:{};var cleanRoot=root.charAt(0)==='['&&root.charAt(root.length-1)===']'?root.slice(1,-1):root;var decodedRoot=options.decodeDotInKeys?cleanRoot.replace(/%2E/g,'.'):cleanRoot;var index=parseInt(decodedRoot,10);var isValidArrayIndex=!isNaN(index)&&root!==decodedRoot&&String(index)===decodedRoot&&index>=0&&options.parseArrays;if(!options.parseArrays&&decodedRoot===''){obj={0:leaf};}else if(isValidArrayIndex&&index<options.arrayLimit){obj=[];obj[index]=leaf;}else if(isValidArrayIndex&&options.throwOnLimitExceeded){throw new RangeError('Array limit exceeded. Only '+options.arrayLimit+' element'+(options.arrayLimit===1?'':'s')+' allowed in an array.');}else if(isValidArrayIndex){obj[index]=leaf;utils.markOverflow(obj,index);}else if(decodedRoot!=='__proto__'){obj[decodedRoot]=leaf;}}leaf=obj;}return leaf;};var splitKeyIntoSegments=function splitKeyIntoSegments(givenKey,options){var key=options.allowDots?givenKey.replace(/\.([^.[]+)/g,'[$1]'):givenKey;if(options.depth<=0){if(!options.plainObjects&&has.call(Object.prototype,key)){if(!options.allowPrototypes){return;}}return[key];}var brackets=/(\[[^[\]]*])/;var child=/(\[[^[\]]*])/g;var segment=brackets.exec(key);var parent=segment?key.slice(0,segment.index):key;var keys=[];if(parent){if(!options.plainObjects&&has.call(Object.prototype,parent)){if(!options.allowPrototypes){return;}}keys[keys.length]=parent;}var i=0;while((segment=child.exec(key))!==null&&i<options.depth){i+=1;var segmentContent=segment[1].slice(1,-1);if(!options.plainObjects&&has.call(Object.prototype,segmentContent)){if(!options.allowPrototypes){return;}}keys[keys.length]=segment[1];}if(segment){if(options.strictDepth===true){throw new RangeError('Input depth exceeded depth option of '+options.depth+' and strictDepth is true');}keys[keys.length]='['+key.slice(segment.index)+']';}return keys;};var parseKeys=function parseQueryStringKeys(givenKey,val,options,valuesParsed){if(!givenKey){return;}var keys=splitKeyIntoSegments(givenKey,options);if(!keys){return;}return parseObject(keys,val,options,valuesParsed);};var normalizeParseOptions=function normalizeParseOptions(opts){if(!opts){return defaults;}if(typeof opts.allowEmptyArrays!=='undefined'&&typeof opts.allowEmptyArrays!=='boolean'){throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');}if(typeof opts.decodeDotInKeys!=='undefined'&&typeof opts.decodeDotInKeys!=='boolean'){throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');}if(opts.decoder!==null&&typeof opts.decoder!=='undefined'&&typeof opts.decoder!=='function'){throw new TypeError('Decoder has to be a function.');}if(typeof opts.charset!=='undefined'&&opts.charset!=='utf-8'&&opts.charset!=='iso-8859-1'){throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');}if(typeof opts.throwOnLimitExceeded!=='undefined'&&typeof opts.throwOnLimitExceeded!=='boolean'){throw new TypeError('`throwOnLimitExceeded` option must be a boolean');}var charset=typeof opts.charset==='undefined'?defaults.charset:opts.charset;var duplicates=typeof opts.duplicates==='undefined'?defaults.duplicates:opts.duplicates;if(duplicates!=='combine'&&duplicates!=='first'&&duplicates!=='last'){throw new TypeError('The duplicates option must be either combine, first, or last');}var allowDots=typeof opts.allowDots==='undefined'?opts.decodeDotInKeys===true?true:defaults.allowDots:!!opts.allowDots;return{allowDots:allowDots,allowEmptyArrays:typeof opts.allowEmptyArrays==='boolean'?!!opts.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:typeof opts.allowPrototypes==='boolean'?opts.allowPrototypes:defaults.allowPrototypes,allowSparse:typeof opts.allowSparse==='boolean'?opts.allowSparse:defaults.allowSparse,arrayLimit:typeof opts.arrayLimit==='number'?opts.arrayLimit:defaults.arrayLimit,charset:charset,charsetSentinel:typeof opts.charsetSentinel==='boolean'?opts.charsetSentinel:defaults.charsetSentinel,comma:typeof opts.comma==='boolean'?opts.comma:defaults.comma,decodeDotInKeys:typeof opts.decodeDotInKeys==='boolean'?opts.decodeDotInKeys:defaults.decodeDotInKeys,decoder:typeof opts.decoder==='function'?opts.decoder:defaults.decoder,delimiter:typeof opts.delimiter==='string'||utils.isRegExp(opts.delimiter)?opts.delimiter:defaults.delimiter,// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
2186
|
+
depth:typeof opts.depth==='number'||opts.depth===false?+opts.depth:defaults.depth,duplicates:duplicates,ignoreQueryPrefix:opts.ignoreQueryPrefix===true,interpretNumericEntities:typeof opts.interpretNumericEntities==='boolean'?opts.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:typeof opts.parameterLimit==='number'?opts.parameterLimit:defaults.parameterLimit,parseArrays:opts.parseArrays!==false,plainObjects:typeof opts.plainObjects==='boolean'?opts.plainObjects:defaults.plainObjects,strictDepth:typeof opts.strictDepth==='boolean'?!!opts.strictDepth:defaults.strictDepth,strictMerge:typeof opts.strictMerge==='boolean'?!!opts.strictMerge:defaults.strictMerge,strictNullHandling:typeof opts.strictNullHandling==='boolean'?opts.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:typeof opts.throwOnLimitExceeded==='boolean'?opts.throwOnLimitExceeded:false};};module.exports=function(str,opts){var options=normalizeParseOptions(opts);if(str===''||str===null||typeof str==='undefined'){return options.plainObjects?{__proto__:null}:{};}var tempObj=typeof str==='string'?parseValues(str,options):str;var obj=options.plainObjects?{__proto__:null}:{};// Iterate over the keys and setup the new object
|
|
2187
2187
|
var keys=Object.keys(tempObj);for(var i=0;i<keys.length;++i){var key=keys[i];var newObj=parseKeys(key,tempObj[key],options,typeof str==='string');obj=utils.merge(obj,newObj,options);}if(options.allowSparse===true){return obj;}return utils.compact(obj);};},{"./utils":113}],112:[function(require,module,exports){'use strict';var getSideChannel=require('side-channel');var utils=require('./utils');var formats=require('./formats');var has=Object.prototype.hasOwnProperty;var arrayPrefixGenerators={brackets:function brackets(prefix){return prefix+'[]';},comma:'comma',indices:function indices(prefix,key){return prefix+'['+key+']';},repeat:function repeat(prefix){return prefix;}};var isArray=Array.isArray;var push=Array.prototype.push;var pushToArray=function(arr,valueOrArray){push.apply(arr,isArray(valueOrArray)?valueOrArray:[valueOrArray]);};var toISO=Date.prototype.toISOString;var defaultFormat=formats['default'];var defaults={addQueryPrefix:false,allowDots:false,allowEmptyArrays:false,arrayFormat:'indices',charset:'utf-8',charsetSentinel:false,commaRoundTrip:false,delimiter:'&',encode:true,encodeDotInKeys:false,encoder:utils.encode,encodeValuesOnly:false,filter:void undefined,format:defaultFormat,formatter:formats.formatters[defaultFormat],// deprecated
|
|
2188
2188
|
indices:false,serializeDate:function serializeDate(date){return toISO.call(date);},skipNulls:false,strictNullHandling:false};var isNonNullishPrimitive=function isNonNullishPrimitive(v){return typeof v==='string'||typeof v==='number'||typeof v==='boolean'||typeof v==='symbol'||typeof v==='bigint';};var sentinel={};var stringify=function stringify(object,prefix,generateArrayPrefix,commaRoundTrip,allowEmptyArrays,strictNullHandling,skipNulls,encodeDotInKeys,encoder,filter,sort,allowDots,serializeDate,format,formatter,encodeValuesOnly,charset,sideChannel){var obj=object;var tmpSc=sideChannel;var step=0;var findFlag=false;while((tmpSc=tmpSc.get(sentinel))!==void undefined&&!findFlag){// Where object last appeared in the ref tree
|
|
2189
2189
|
var pos=tmpSc.get(object);step+=1;if(typeof pos!=='undefined'){if(pos===step){throw new RangeError('Cyclic object value');}else{findFlag=true;// Break while
|
|
2190
2190
|
}}if(typeof tmpSc.get(sentinel)==='undefined'){step=0;}}if(typeof filter==='function'){obj=filter(prefix,obj);}else if(obj instanceof Date){obj=serializeDate(obj);}else if(generateArrayPrefix==='comma'&&isArray(obj)){obj=utils.maybeMap(obj,function(value){if(value instanceof Date){return serializeDate(value);}return value;});}if(obj===null){if(strictNullHandling){return encoder&&!encodeValuesOnly?encoder(prefix,defaults.encoder,charset,'key',format):prefix;}obj='';}if(isNonNullishPrimitive(obj)||utils.isBuffer(obj)){if(encoder){var keyValue=encodeValuesOnly?prefix:encoder(prefix,defaults.encoder,charset,'key',format);return[formatter(keyValue)+'='+formatter(encoder(obj,defaults.encoder,charset,'value',format))];}return[formatter(prefix)+'='+formatter(String(obj))];}var values=[];if(typeof obj==='undefined'){return values;}var objKeys;if(generateArrayPrefix==='comma'&&isArray(obj)){// we need to join elements in
|
|
2191
2191
|
if(encodeValuesOnly&&encoder){obj=utils.maybeMap(obj,encoder);}objKeys=[{value:obj.length>0?obj.join(',')||null:void undefined}];}else if(isArray(filter)){objKeys=filter;}else{var keys=Object.keys(obj);objKeys=sort?keys.sort(sort):keys;}var encodedPrefix=encodeDotInKeys?String(prefix).replace(/\./g,'%2E'):String(prefix);var adjustedPrefix=commaRoundTrip&&isArray(obj)&&obj.length===1?encodedPrefix+'[]':encodedPrefix;if(allowEmptyArrays&&isArray(obj)&&obj.length===0){return adjustedPrefix+'[]';}for(var j=0;j<objKeys.length;++j){var key=objKeys[j];var value=typeof key==='object'&&key&&typeof key.value!=='undefined'?key.value:obj[key];if(skipNulls&&value===null){continue;}var encodedKey=allowDots&&encodeDotInKeys?String(key).replace(/\./g,'%2E'):String(key);var keyPrefix=isArray(obj)?typeof generateArrayPrefix==='function'?generateArrayPrefix(adjustedPrefix,encodedKey):adjustedPrefix:adjustedPrefix+(allowDots?'.'+encodedKey:'['+encodedKey+']');sideChannel.set(object,step);var valueSideChannel=getSideChannel();valueSideChannel.set(sentinel,sideChannel);pushToArray(values,stringify(value,keyPrefix,generateArrayPrefix,commaRoundTrip,allowEmptyArrays,strictNullHandling,skipNulls,encodeDotInKeys,generateArrayPrefix==='comma'&&encodeValuesOnly&&isArray(obj)?null:encoder,filter,sort,allowDots,serializeDate,format,formatter,encodeValuesOnly,charset,valueSideChannel));}return values;};var normalizeStringifyOptions=function normalizeStringifyOptions(opts){if(!opts){return defaults;}if(typeof opts.allowEmptyArrays!=='undefined'&&typeof opts.allowEmptyArrays!=='boolean'){throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');}if(typeof opts.encodeDotInKeys!=='undefined'&&typeof opts.encodeDotInKeys!=='boolean'){throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');}if(opts.encoder!==null&&typeof opts.encoder!=='undefined'&&typeof opts.encoder!=='function'){throw new TypeError('Encoder has to be a function.');}var charset=opts.charset||defaults.charset;if(typeof opts.charset!=='undefined'&&opts.charset!=='utf-8'&&opts.charset!=='iso-8859-1'){throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');}var format=formats['default'];if(typeof opts.format!=='undefined'){if(!has.call(formats.formatters,opts.format)){throw new TypeError('Unknown format option provided.');}format=opts.format;}var formatter=formats.formatters[format];var filter=defaults.filter;if(typeof opts.filter==='function'||isArray(opts.filter)){filter=opts.filter;}var arrayFormat;if(opts.arrayFormat in arrayPrefixGenerators){arrayFormat=opts.arrayFormat;}else if('indices'in opts){arrayFormat=opts.indices?'indices':'repeat';}else{arrayFormat=defaults.arrayFormat;}if('commaRoundTrip'in opts&&typeof opts.commaRoundTrip!=='boolean'){throw new TypeError('`commaRoundTrip` must be a boolean, or absent');}var allowDots=typeof opts.allowDots==='undefined'?opts.encodeDotInKeys===true?true:defaults.allowDots:!!opts.allowDots;return{addQueryPrefix:typeof opts.addQueryPrefix==='boolean'?opts.addQueryPrefix:defaults.addQueryPrefix,allowDots:allowDots,allowEmptyArrays:typeof opts.allowEmptyArrays==='boolean'?!!opts.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:arrayFormat,charset:charset,charsetSentinel:typeof opts.charsetSentinel==='boolean'?opts.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!opts.commaRoundTrip,delimiter:typeof opts.delimiter==='undefined'?defaults.delimiter:opts.delimiter,encode:typeof opts.encode==='boolean'?opts.encode:defaults.encode,encodeDotInKeys:typeof opts.encodeDotInKeys==='boolean'?opts.encodeDotInKeys:defaults.encodeDotInKeys,encoder:typeof opts.encoder==='function'?opts.encoder:defaults.encoder,encodeValuesOnly:typeof opts.encodeValuesOnly==='boolean'?opts.encodeValuesOnly:defaults.encodeValuesOnly,filter:filter,format:format,formatter:formatter,serializeDate:typeof opts.serializeDate==='function'?opts.serializeDate:defaults.serializeDate,skipNulls:typeof opts.skipNulls==='boolean'?opts.skipNulls:defaults.skipNulls,sort:typeof opts.sort==='function'?opts.sort:null,strictNullHandling:typeof opts.strictNullHandling==='boolean'?opts.strictNullHandling:defaults.strictNullHandling};};module.exports=function(object,opts){var obj=object;var options=normalizeStringifyOptions(opts);var objKeys;var filter;if(typeof options.filter==='function'){filter=options.filter;obj=filter('',obj);}else if(isArray(options.filter)){filter=options.filter;objKeys=filter;}var keys=[];if(typeof obj!=='object'||obj===null){return'';}var generateArrayPrefix=arrayPrefixGenerators[options.arrayFormat];var commaRoundTrip=generateArrayPrefix==='comma'&&options.commaRoundTrip;if(!objKeys){objKeys=Object.keys(obj);}if(options.sort){objKeys.sort(options.sort);}var sideChannel=getSideChannel();for(var i=0;i<objKeys.length;++i){var key=objKeys[i];var value=obj[key];if(options.skipNulls&&value===null){continue;}pushToArray(keys,stringify(value,key,generateArrayPrefix,commaRoundTrip,options.allowEmptyArrays,options.strictNullHandling,options.skipNulls,options.encodeDotInKeys,options.encode?options.encoder:null,options.filter,options.sort,options.allowDots,options.serializeDate,options.format,options.formatter,options.encodeValuesOnly,options.charset,sideChannel));}var joined=keys.join(options.delimiter);var prefix=options.addQueryPrefix===true?'?':'';if(options.charsetSentinel){if(options.charset==='iso-8859-1'){// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
|
2192
2192
|
prefix+='utf8=%26%2310003%3B&';}else{// encodeURIComponent('✓')
|
|
2193
|
-
prefix+='utf8=%E2%9C%93&';}}return joined.length>0?prefix+joined:'';};},{"./formats":109,"./utils":113,"side-channel":121}],113:[function(require,module,exports){'use strict';var formats=require('./formats');var
|
|
2193
|
+
prefix+='utf8=%E2%9C%93&';}}return joined.length>0?prefix+joined:'';};},{"./formats":109,"./utils":113,"side-channel":121}],113:[function(require,module,exports){'use strict';var formats=require('./formats');var getSideChannel=require('side-channel');var has=Object.prototype.hasOwnProperty;var isArray=Array.isArray;// Track objects created from arrayLimit overflow using side-channel
|
|
2194
|
+
// Stores the current max numeric index for O(1) lookup
|
|
2195
|
+
var overflowChannel=getSideChannel();var markOverflow=function markOverflow(obj,maxIndex){overflowChannel.set(obj,maxIndex);return obj;};var isOverflow=function isOverflow(obj){return overflowChannel.has(obj);};var getMaxIndex=function getMaxIndex(obj){return overflowChannel.get(obj);};var setMaxIndex=function setMaxIndex(obj,maxIndex){overflowChannel.set(obj,maxIndex);};var hexTable=function(){var array=[];for(var i=0;i<256;++i){array[array.length]='%'+((i<16?'0':'')+i.toString(16)).toUpperCase();}return array;}();var compactQueue=function compactQueue(queue){while(queue.length>1){var item=queue.pop();var obj=item.obj[item.prop];if(isArray(obj)){var compacted=[];for(var j=0;j<obj.length;++j){if(typeof obj[j]!=='undefined'){compacted[compacted.length]=obj[j];}}item.obj[item.prop]=compacted;}}};var arrayToObject=function arrayToObject(source,options){var obj=options&&options.plainObjects?{__proto__:null}:{};for(var i=0;i<source.length;++i){if(typeof source[i]!=='undefined'){obj[i]=source[i];}}return obj;};var merge=function merge(target,source,options){/* eslint no-param-reassign: 0 */if(!source){return target;}if(typeof source!=='object'&&typeof source!=='function'){if(isArray(target)){var nextIndex=target.length;if(options&&typeof options.arrayLimit==='number'&&nextIndex>options.arrayLimit){return markOverflow(arrayToObject(target.concat(source),options),nextIndex);}target[nextIndex]=source;}else if(target&&typeof target==='object'){if(isOverflow(target)){// Add at next numeric index for overflow objects
|
|
2196
|
+
var newIndex=getMaxIndex(target)+1;target[newIndex]=source;setMaxIndex(target,newIndex);}else if(options&&options.strictMerge){return[target,source];}else if(options&&(options.plainObjects||options.allowPrototypes)||!has.call(Object.prototype,source)){target[source]=true;}}else{return[target,source];}return target;}if(!target||typeof target!=='object'){if(isOverflow(source)){// Create new object with target at 0, source values shifted by 1
|
|
2197
|
+
var sourceKeys=Object.keys(source);var result=options&&options.plainObjects?{__proto__:null,0:target}:{0:target};for(var m=0;m<sourceKeys.length;m++){var oldKey=parseInt(sourceKeys[m],10);result[oldKey+1]=source[sourceKeys[m]];}return markOverflow(result,getMaxIndex(source)+1);}var combined=[target].concat(source);if(options&&typeof options.arrayLimit==='number'&&combined.length>options.arrayLimit){return markOverflow(arrayToObject(combined,options),combined.length-1);}return combined;}var mergeTarget=target;if(isArray(target)&&!isArray(source)){mergeTarget=arrayToObject(target,options);}if(isArray(target)&&isArray(source)){source.forEach(function(item,i){if(has.call(target,i)){var targetItem=target[i];if(targetItem&&typeof targetItem==='object'&&item&&typeof item==='object'){target[i]=merge(targetItem,item,options);}else{target[target.length]=item;}}else{target[i]=item;}});return target;}return Object.keys(source).reduce(function(acc,key){var value=source[key];if(has.call(acc,key)){acc[key]=merge(acc[key],value,options);}else{acc[key]=value;}if(isOverflow(source)&&!isOverflow(acc)){markOverflow(acc,getMaxIndex(source));}if(isOverflow(acc)){var keyNum=parseInt(key,10);if(String(keyNum)===key&&keyNum>=0&&keyNum>getMaxIndex(acc)){setMaxIndex(acc,keyNum);}}return acc;},mergeTarget);};var assign=function assignSingleSource(target,source){return Object.keys(source).reduce(function(acc,key){acc[key]=source[key];return acc;},target);};var decode=function(str,defaultDecoder,charset){var strWithoutPlus=str.replace(/\+/g,' ');if(charset==='iso-8859-1'){// unescape never throws, no try...catch needed:
|
|
2194
2198
|
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi,unescape);}// utf-8
|
|
2195
2199
|
try{return decodeURIComponent(strWithoutPlus);}catch(e){return strWithoutPlus;}};var limit=1024;/* eslint operator-linebreak: [2, "before"] */var encode=function encode(str,defaultEncoder,charset,kind,format){// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
|
2196
2200
|
// It has been adapted here for stricter adherence to RFC 3986
|
|
@@ -2202,7 +2206,8 @@ if(str.length===0){return str;}var string=str;if(typeof str==='symbol'){string=S
|
|
|
2202
2206
|
||c>=0x41&&c<=0x5A// a-z
|
|
2203
2207
|
||c>=0x61&&c<=0x7A// A-Z
|
|
2204
2208
|
||format===formats.RFC1738&&(c===0x28||c===0x29)// ( )
|
|
2205
|
-
){arr[arr.length]=segment.charAt(i);continue;}if(c<0x80){arr[arr.length]=hexTable[c];continue;}if(c<0x800){arr[arr.length]=hexTable[0xC0|c>>6]+hexTable[0x80|c&0x3F];continue;}if(c<0xD800||c>=0xE000){arr[arr.length]=hexTable[0xE0|c>>12]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];continue;}i+=1;c=0x10000+((c&0x3FF)<<10|segment.charCodeAt(i)&0x3FF);arr[arr.length]=hexTable[0xF0|c>>18]+hexTable[0x80|c>>12&0x3F]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];}out+=arr.join('');}return out;};var compact=function compact(value){var queue=[{obj:{o:value},prop:'o'}];var refs=[];for(var i=0;i<queue.length;++i){var item=queue[i];var obj=item.obj[item.prop];var keys=Object.keys(obj);for(var j=0;j<keys.length;++j){var key=keys[j];var val=obj[key];if(typeof val==='object'&&val!==null&&refs.indexOf(val)===-1){queue.
|
|
2209
|
+
){arr[arr.length]=segment.charAt(i);continue;}if(c<0x80){arr[arr.length]=hexTable[c];continue;}if(c<0x800){arr[arr.length]=hexTable[0xC0|c>>6]+hexTable[0x80|c&0x3F];continue;}if(c<0xD800||c>=0xE000){arr[arr.length]=hexTable[0xE0|c>>12]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];continue;}i+=1;c=0x10000+((c&0x3FF)<<10|segment.charCodeAt(i)&0x3FF);arr[arr.length]=hexTable[0xF0|c>>18]+hexTable[0x80|c>>12&0x3F]+hexTable[0x80|c>>6&0x3F]+hexTable[0x80|c&0x3F];}out+=arr.join('');}return out;};var compact=function compact(value){var queue=[{obj:{o:value},prop:'o'}];var refs=[];for(var i=0;i<queue.length;++i){var item=queue[i];var obj=item.obj[item.prop];var keys=Object.keys(obj);for(var j=0;j<keys.length;++j){var key=keys[j];var val=obj[key];if(typeof val==='object'&&val!==null&&refs.indexOf(val)===-1){queue[queue.length]={obj:obj,prop:key};refs[refs.length]=val;}}}compactQueue(queue);return value;};var isRegExp=function isRegExp(obj){return Object.prototype.toString.call(obj)==='[object RegExp]';};var isBuffer=function isBuffer(obj){if(!obj||typeof obj!=='object'){return false;}return!!(obj.constructor&&obj.constructor.isBuffer&&obj.constructor.isBuffer(obj));};var combine=function combine(a,b,arrayLimit,plainObjects){// If 'a' is already an overflow object, add to it
|
|
2210
|
+
if(isOverflow(a)){var newIndex=getMaxIndex(a)+1;a[newIndex]=b;setMaxIndex(a,newIndex);return a;}var result=[].concat(a,b);if(result.length>arrayLimit){return markOverflow(arrayToObject(result,{plainObjects:plainObjects}),result.length-1);}return result;};var maybeMap=function maybeMap(val,fn){if(isArray(val)){var mapped=[];for(var i=0;i<val.length;i+=1){mapped[mapped.length]=fn(val[i]);}return mapped;}return fn(val);};module.exports={arrayToObject:arrayToObject,assign:assign,combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge};},{"./formats":109,"side-channel":121}],114:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2206
2211
|
//
|
|
2207
2212
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2208
2213
|
// copy of this software and associated documentation files (the
|
|
@@ -3191,7 +3196,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
3191
3196
|
// presumably different callback function.
|
|
3192
3197
|
// This makes sure that own properties are retained, so that
|
|
3193
3198
|
// decorations and such are not lost along the way.
|
|
3194
|
-
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],148:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],149:[function(require,module,exports){module.exports={"name":"fable","version":"3.1.
|
|
3199
|
+
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],148:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],149:[function(require,module,exports){module.exports={"name":"fable","version":"3.1.58","description":"A service dependency injection, configuration and logging library.","main":"source/Fable.js","scripts":{"start":"node source/Fable.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":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t fable-image:local","docker-dev-run":"docker run -it -d --name fable-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" fable-image:local","docker-dev-shell":"docker exec -it fable-dev /bin/bash","tests":"./node_modules/mocha/bin/_mocha -u tdd --exit -R spec --grep"},"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"]},"browser":{"./source/service/Fable-Service-EnvironmentData.js":"./source/service/Fable-Service-EnvironmentData-Web.js","./source/service/Fable-Service-FilePersistence.js":"./source/service/Fable-Service-FilePersistence-Web.js"},"repository":{"type":"git","url":"https://github.com/stevenvelozo/fable.git"},"keywords":["entity","behavior"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/fable/issues"},"homepage":"https://github.com/stevenvelozo/fable","devDependencies":{"quackage":"^1.0.51"},"dependencies":{"async.eachlimit":"^0.5.2","async.waterfall":"^0.5.2","big.js":"^7.0.1","cachetrax":"^1.0.5","cookie":"^1.1.1","data-arithmatic":"^1.0.7","dayjs":"^1.11.19","fable-log":"^3.0.17","fable-serviceproviderbase":"^3.0.18","fable-settings":"^3.0.15","fable-uuid":"^3.0.12","manyfest":"^1.0.46","simple-get":"^4.0.1"}};},{}],150:[function(require,module,exports){/**
|
|
3195
3200
|
* Fable Application Services Support Library
|
|
3196
3201
|
* @author <steven@velozo.com>
|
|
3197
3202
|
*/// Pre-init services
|
|
@@ -3967,7 +3972,7 @@ tmpCurrentTokenType='Value';tmpCurrentToken+=tmpCharacter;// continue;
|
|
|
3967
3972
|
// tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenize found an unknown character code ${tmpCharCode} character ${tmpCharacter} in the expression: ${pExpression} at index ${i}`);
|
|
3968
3973
|
// this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
3969
3974
|
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}tmpResults.OriginalRawTokens=Array.from(tmpResults.RawTokens);// Potentially mutate the tokens based on directives in the tokenized expression
|
|
3970
|
-
this.TokenizerDirectiveMutation.parseDirectives(tmpResults);return tmpResults.RawTokens;}}module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":159}],162:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"percent":{"Name":"Compute Percent (in IS over OF format)","Address":"fable.Math.percentagePrecise"},"compare":{"Name":"Compare","Address":"fable.Math.comparePrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"floor":{"Name":"Floor Value","Address":"fable.Math.floorPrecise"},"ceil":{"Name":"Ceiling Value","Address":"fable.Math.ceilPrecise"},"rad":{"Name":"Degrees to Radians","Address":"fable.Math.radPrecise"},"pi":{"Name":"Pi","Address":"fable.Math.piPrecise"},"euler":{"Name":"Euler","Address":"fable.Math.eulerPrecise"},"log":{"Name":"Logarithm","Address":"fable.Math.logPrecise"},"exp":{"Name":"Eulers Number to the Power Of N","Address":"fable.Math.expPrecise"},"sin":{"Name":"Sine","Address":"fable.Math.sin"},"cos":{"Name":"Cosine","Address":"fable.Math.cos"},"tan":{"Name":"Tangent","Address":"fable.Math.tan"},"count":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"countset":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"sortset":{"Name":"Sort Set","Address":"fable.Math.sortSetPrecise"},"bucketset":{"Name":"Bucket Set","Address":"fable.Math.bucketSetPrecise"},"sorthistogram":{"Name":"Sort Histogram","Address":"fable.Math.sortHistogramPrecise"},"sorthistogrambykeys":{"Name":"Sort Histogram by Keys","Address":"fable.Math.sortHistogramByKeys"},"max":{"Name":"Maximum","Address":"fable.Math.maxPrecise"},"min":{"Name":"Minimum","Address":"fable.Math.minPrecise"},"sum":{"Name":"Sum","Address":"fable.Math.sumPrecise"},"avg":{"Name":"Average","Address":"fable.Math.averagePrecise"},"mean":{"Name":"Mean","Address":"fable.Math.meanPrecise"},"median":{"Name":"Median","Address":"fable.Math.medianPrecise"},"mode":{"Name":"Mode","Address":"fable.Math.modePrecise"},"var":{"Name":"Variance (Sample)","Address":"fable.Math.variancePrecise"},"vara":{"Name":"Variance (Sample)","Address":"fable.Math.variancePrecise"},"varp":{"Name":"Variance (Population)","Address":"fable.Math.populationVariancePrecise"},"stdev":{"Name":"Standard Deviation (Sample)","Address":"fable.Math.standardDeviationPrecise"},"stdeva":{"Name":"Standard Deviation (Sample)","Address":"fable.Math.standardDeviationPrecise"},"stdevp":{"Name":"Standard Deviation (Population)","Address":"fable.Math.populationStandardDeviationPrecise"},"round":{"Name":"Round","Address":"fable.Math.roundPrecise"},"tofixed":{"Name":"To Fixed","Address":"fable.Math.toFixedPrecise"},"cumulativesummation":{"Name":"Sum each value in a Histogram or Value Map cumulatively, creating or setting a property with the result on each row","Address":"fable.Math.cumulativeSummation"},"subtractingsummation":{"Name":"Subtract each subsequent value in a Histogram or Value Map cumulatively (by default from the first row), creating or setting a property with the result on each row.","Address":"fable.Math.subtractingSummation"},"iterativeseries":{"Name":"Perform an Iterative Series of Mathematical Operations on Set Elements","Address":"fable.Math.iterativeSeries"},"countsetelements":{"Name":"Count Set Elements in a Histogram or Value Map","Address":"fable.Math.countSetElements"},"getvalue":{"Name":"Get Value from Application State or Services (AppData, etc.)","Address":"fable.Utility.getInternalValueByHash"},"setvalue":{"Name":"Set Value to Application State or Services (AppData, etc.)","Address":"fable.Utility.setInternalValueByHash"},"objectkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"objectvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"generatearrayofobjectsfromsets":{"Name":"Generate Array of Objects from Sets","Address":"fable.Utility.generateArrayOfObjectsFromSets"},"objectvaluessortbyexternalobjectarray":{"Name":"Get Array of an Object's values sorted by an external array","Address":"fable.Utility.objectValuesSortByExternalArray"},"setkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"setvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"histogramkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"histogramvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"createarrayfromabsolutevalues":{"Name":"Create Array from Absolute Values","Address":"fable.Utility.createArrayFromAbsoluteValues"},"flatten":{"Name":"flatten an array of values","Address":"fable.Utility.flattenArrayOfSolverInputs"},"findfirstvaluebyexactmatch":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByExactMatchInternal"},"findfirstvaluebystringincludes":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByStringIncludesInternal"},"match":{"Name":"Implementation of sheets MATCH() function","Address":"fable.Utility.findIndexInternal"},"resolvehtmlentities":{"Name":"resolve HTML entities","Address":"fable.DataFormat.resolveHtmlEntities"},"concat":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsInternal"},"concatraw":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsRawInternal"},"arrayconcat":{"Name":"concatenate two or more arrays generating a single output array","Address":"fable.Utility.concatenateArrays"},"join":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsInternal"},"joinraw":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsRawInternal"},"if":{"Name":"perform a conditional operator on two values, and choose one of two outcomes based on the result","Address":"fable.Logic.checkIf"},"when":{"Name":"perform a 'truthy' check on one value, and return one of two outcomes based on the result","Address":"fable.Logic.when"},"entryinset":{"Name":"Entry in Set","Address":"fable.Math.entryInSet"},"smallestinset":{"Name":"Smallest in Set","Address":"fable.Math.smallestInSet"},"largestinset":{"Name":"Largest in Set","Address":"fable.Math.largestInSet"},"aggregationhistogram":{"Name":"Generate a Histogram by Exact Value Aggregation","Address":"fable.Math.histogramAggregationByExactValueFromInternalState"},"aggregationhistogrambyobject":{"Name":"Generate a Histogram by Exact Value Aggregation from Object Property","Address":"fable.Math.histogramAggregationByExactValue"},"distributionhistogram":{"Name":"Generate a Histogram Based on Value Distribution","Address":"fable.Math.histogramDistributionByExactValueFromInternalState"},"distributionhistogrambyobject":{"Name":"Generate a Histogram Based on Value Distribution from Object Property","Address":"fable.Math.histogramDistributionByExactValue"},"setconcatenate":{"Name":"Set Concatenate","Address":"fable.Math.setConcatenate"},"getvaluearray":{"Name":"Get Value Array from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueArrayByHashParametersFromInternal"},"getvalueobject":{"Name":"Get Value Object from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueObjectByHashParametersFromInternal"},"cleanvaluearray":{"Name":"Clean Value Array","Address":"fable.Math.cleanValueArray"},"cleanvalueobject":{"Name":"Clean Value Object","Address":"fable.Math.cleanValueObject"},"polynomialregression":{"Name":"Perform an nth degree Polynomial Regression on a Set of X and Y Values","Address":"fable.Math.polynomialRegression"},"randominteger":{"Name":"Random Integer","Address":"fable.DataGeneration.randomInteger"},"randomintegerbetween":{"Name":"Random Integer Between Two Numbers","Address":"fable.DataGeneration.randomIntegerBetween"},"randomintegerupto":{"Name":"Random Integer","Address":"fable.DataGeneration.randomIntegerUpTo"},"randomfloat":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloat"},"randomfloatbetween":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatBetween"},"randomfloatupto":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatUpTo"},"datemilliseconddifference":{"Name":"Date Difference in Milliseconds","Address":"fable.Dates.dateMillisecondDifference"},"dateseconddifference":{"Name":"Date Difference in Seconds","Address":"fable.Dates.dateSecondDifference"},"dateminutedifference":{"Name":"Date Difference in Minutes","Address":"fable.Dates.dateMinuteDifference"},"datehourdifference":{"Name":"Date Difference in Hours","Address":"fable.Dates.dateHourDifference"},"datedaydifference":{"Name":"Date Difference in Days","Address":"fable.Dates.dateDayDifference"},"dateweekdifference":{"Name":"Date Difference in Weeks","Address":"fable.Dates.dateWeekDifference"},"datemonthdifference":{"Name":"Date Difference in Months","Address":"fable.Dates.dateMonthDifference"},"dateyeardifference":{"Name":"Date Difference in Years","Address":"fable.Dates.dateYearDifference"},"datemathadd":{"Name":"Date Math Add","Address":"fable.Dates.dateMath"},"dateaddmilliseconds":{"Name":"Date Add Milliseconds","Address":"fable.Dates.dateAddMilliseconds"},"dateaddseconds":{"Name":"Date Add Seconds","Address":"fable.Dates.dateAddSeconds"},"dateaddminutes":{"Name":"Date Add Minutes","Address":"fable.Dates.dateAddMinutes"},"dateaddhours":{"Name":"Date Add Hours","Address":"fable.Dates.dateAddHours"},"dateadddays":{"Name":"Date Add Days","Address":"fable.Dates.dateAddDays"},"dateaddweeks":{"Name":"Date Add Weeks","Address":"fable.Dates.dateAddWeeks"},"dateaddmonths":{"Name":"Date Add Months","Address":"fable.Dates.dateAddMonths"},"dateaddyears":{"Name":"Date Add Years","Address":"fable.Dates.dateAddYears"},"datefromparts":{"Name":"Date From Parts","Address":"fable.Dates.dateFromParts"},"slice":{"Name":"Slice Array","Address":"fable.Utility.slice"},"createvalueobjectbyhashes":{"Name":"Create Value Object by Hashes","Address":"fable.Utility.createValueObjectByHashes"},"polynomialregression":{"Name":"Perform an nth degree Polynomial Regression on a Set of X and Y Values","Address":"fable.Math.polynomialRegression"},"leastsquares":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"linest":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"matrixtranspose":{"Name":"Transpose a Matrix","Address":"fable.Math.matrixTranspose"},"matrixmultiply":{"Name":"Multiply Two Matrices","Address":"fable.Math.matrixMultiply"},"matrixvectormultiply":{"Name":"Multiply a Matrix by a Vector","Address":"fable.Math.matrixVectorMultiply"},"matrixinverse":{"Name":"Inverse a Matrix","Address":"fable.Math.matrixInverse"},"gaussianelimination":{"Name":"Solve a System of Linear Equations using Gaussian Elimination","Address":"fable.Math.gaussianElimination"},"predict":{"Name":"Predict Y Values from X Values using a Regression Model","Address":"fable.Math.predictFromRegressionModel"},"stringcountsegments":{"Name":"Count Segments in a String","Address":"fable.DataFormat.stringCountSegments"},"stringgetsegments":{"Name":"Get Segments from a String","Address":"fable.DataFormat.stringGetSegments"}};},{}],163:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');class ExpressionParserLinter extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-Linter';}lintTokenizedExpression(pTokenizedExpression,pResultObject){let tmpResults=typeof pResultObject==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.LinterResults=[];// Guard against bad data being passed in
|
|
3975
|
+
this.TokenizerDirectiveMutation.parseDirectives(tmpResults);return tmpResults.RawTokens;}}module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":159}],162:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"percent":{"Name":"Compute Percent (in IS over OF format)","Address":"fable.Math.percentagePrecise"},"compare":{"Name":"Compare","Address":"fable.Math.comparePrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"floor":{"Name":"Floor Value","Address":"fable.Math.floorPrecise"},"ceil":{"Name":"Ceiling Value","Address":"fable.Math.ceilPrecise"},"rad":{"Name":"Degrees to Radians","Address":"fable.Math.radPrecise"},"pi":{"Name":"Pi","Address":"fable.Math.piPrecise"},"euler":{"Name":"Euler","Address":"fable.Math.eulerPrecise"},"log":{"Name":"Logarithm","Address":"fable.Math.logPrecise"},"exp":{"Name":"Eulers Number to the Power Of N","Address":"fable.Math.expPrecise"},"sin":{"Name":"Sine","Address":"fable.Math.sin"},"cos":{"Name":"Cosine","Address":"fable.Math.cos"},"tan":{"Name":"Tangent","Address":"fable.Math.tan"},"count":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"countset":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"sortset":{"Name":"Sort Set","Address":"fable.Math.sortSetPrecise"},"bucketset":{"Name":"Bucket Set","Address":"fable.Math.bucketSetPrecise"},"sorthistogram":{"Name":"Sort Histogram","Address":"fable.Math.sortHistogramPrecise"},"sorthistogrambykeys":{"Name":"Sort Histogram by Keys","Address":"fable.Math.sortHistogramByKeys"},"max":{"Name":"Maximum","Address":"fable.Math.maxPrecise"},"min":{"Name":"Minimum","Address":"fable.Math.minPrecise"},"sum":{"Name":"Sum","Address":"fable.Math.sumPrecise"},"avg":{"Name":"Average","Address":"fable.Math.averagePrecise"},"mean":{"Name":"Mean","Address":"fable.Math.meanPrecise"},"median":{"Name":"Median","Address":"fable.Math.medianPrecise"},"mode":{"Name":"Mode","Address":"fable.Math.modePrecise"},"var":{"Name":"Variance (Sample)","Address":"fable.Math.variancePrecise"},"vara":{"Name":"Variance (Sample)","Address":"fable.Math.variancePrecise"},"varp":{"Name":"Variance (Population)","Address":"fable.Math.populationVariancePrecise"},"stdev":{"Name":"Standard Deviation (Sample)","Address":"fable.Math.standardDeviationPrecise"},"stdeva":{"Name":"Standard Deviation (Sample)","Address":"fable.Math.standardDeviationPrecise"},"stdevp":{"Name":"Standard Deviation (Population)","Address":"fable.Math.populationStandardDeviationPrecise"},"round":{"Name":"Round","Address":"fable.Math.roundPrecise"},"tofixed":{"Name":"To Fixed","Address":"fable.Math.toFixedPrecise"},"cumulativesummation":{"Name":"Sum each value in a Histogram or Value Map cumulatively, creating or setting a property with the result on each row","Address":"fable.Math.cumulativeSummation"},"subtractingsummation":{"Name":"Subtract each subsequent value in a Histogram or Value Map cumulatively (by default from the first row), creating or setting a property with the result on each row.","Address":"fable.Math.subtractingSummation"},"iterativeseries":{"Name":"Perform an Iterative Series of Mathematical Operations on Set Elements","Address":"fable.Math.iterativeSeries"},"countsetelements":{"Name":"Count Set Elements in a Histogram or Value Map","Address":"fable.Math.countSetElements"},"getvalue":{"Name":"Get Value from Application State or Services (AppData, etc.)","Address":"fable.Utility.getInternalValueByHash"},"setvalue":{"Name":"Set Value to Application State or Services (AppData, etc.)","Address":"fable.Utility.setInternalValueByHash"},"objectkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"objectvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"generatearrayofobjectsfromsets":{"Name":"Generate Array of Objects from Sets","Address":"fable.Utility.generateArrayOfObjectsFromSets"},"objectvaluessortbyexternalobjectarray":{"Name":"Get Array of an Object's values sorted by an external array","Address":"fable.Utility.objectValuesSortByExternalArray"},"setkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"setvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"histogramkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"histogramvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"createarrayfromabsolutevalues":{"Name":"Create Array from Absolute Values","Address":"fable.Utility.createArrayFromAbsoluteValues"},"flatten":{"Name":"flatten an array of values","Address":"fable.Utility.flattenArrayOfSolverInputs"},"findfirstvaluebyexactmatch":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByExactMatchInternal"},"findfirstvaluebystringincludes":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByStringIncludesInternal"},"match":{"Name":"Implementation of sheets MATCH() function","Address":"fable.Utility.findIndexInternal"},"resolvehtmlentities":{"Name":"resolve HTML entities","Address":"fable.DataFormat.resolveHtmlEntities"},"concat":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsInternal"},"concatraw":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsRawInternal"},"arrayconcat":{"Name":"concatenate two or more arrays generating a single output array","Address":"fable.Utility.concatenateArrays"},"join":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsInternal"},"joinraw":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsRawInternal"},"if":{"Name":"perform a conditional operator on two values, and choose one of two outcomes based on the result","Address":"fable.Logic.checkIf"},"when":{"Name":"perform a 'truthy' check on one value, and return one of two outcomes based on the result","Address":"fable.Logic.when"},"entryinset":{"Name":"Entry in Set","Address":"fable.Math.entryInSet"},"smallestinset":{"Name":"Smallest in Set","Address":"fable.Math.smallestInSet"},"largestinset":{"Name":"Largest in Set","Address":"fable.Math.largestInSet"},"aggregationhistogram":{"Name":"Generate a Histogram by Exact Value Aggregation","Address":"fable.Math.histogramAggregationByExactValueFromInternalState"},"aggregationhistogrambyobject":{"Name":"Generate a Histogram by Exact Value Aggregation from Object Property","Address":"fable.Math.histogramAggregationByExactValue"},"distributionhistogram":{"Name":"Generate a Histogram Based on Value Distribution","Address":"fable.Math.histogramDistributionByExactValueFromInternalState"},"distributionhistogrambyobject":{"Name":"Generate a Histogram Based on Value Distribution from Object Property","Address":"fable.Math.histogramDistributionByExactValue"},"setconcatenate":{"Name":"Set Concatenate","Address":"fable.Math.setConcatenate"},"getvaluearray":{"Name":"Get Value Array from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueArrayByHashParametersFromInternal"},"getvalueobject":{"Name":"Get Value Object from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueObjectByHashParametersFromInternal"},"cleanvaluearray":{"Name":"Clean Value Array","Address":"fable.Math.cleanValueArray"},"cleanvalueobject":{"Name":"Clean Value Object","Address":"fable.Math.cleanValueObject"},"polynomialregression":{"Name":"Perform an nth degree Polynomial Regression on a Set of X and Y Values","Address":"fable.Math.polynomialRegression"},"randominteger":{"Name":"Random Integer","Address":"fable.DataGeneration.randomInteger"},"randomintegerbetween":{"Name":"Random Integer Between Two Numbers","Address":"fable.DataGeneration.randomIntegerBetween"},"randomintegerupto":{"Name":"Random Integer","Address":"fable.DataGeneration.randomIntegerUpTo"},"randomfloat":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloat"},"randomfloatbetween":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatBetween"},"randomfloatupto":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatUpTo"},"datemilliseconddifference":{"Name":"Date Difference in Milliseconds","Address":"fable.Dates.dateMillisecondDifference"},"dateseconddifference":{"Name":"Date Difference in Seconds","Address":"fable.Dates.dateSecondDifference"},"dateminutedifference":{"Name":"Date Difference in Minutes","Address":"fable.Dates.dateMinuteDifference"},"datehourdifference":{"Name":"Date Difference in Hours","Address":"fable.Dates.dateHourDifference"},"datedaydifference":{"Name":"Date Difference in Days","Address":"fable.Dates.dateDayDifference"},"dateweekdifference":{"Name":"Date Difference in Weeks","Address":"fable.Dates.dateWeekDifference"},"datemonthdifference":{"Name":"Date Difference in Months","Address":"fable.Dates.dateMonthDifference"},"dateyeardifference":{"Name":"Date Difference in Years","Address":"fable.Dates.dateYearDifference"},"datemathadd":{"Name":"Date Math Add","Address":"fable.Dates.dateMath"},"dateaddmilliseconds":{"Name":"Date Add Milliseconds","Address":"fable.Dates.dateAddMilliseconds"},"dateaddseconds":{"Name":"Date Add Seconds","Address":"fable.Dates.dateAddSeconds"},"dateaddminutes":{"Name":"Date Add Minutes","Address":"fable.Dates.dateAddMinutes"},"dateaddhours":{"Name":"Date Add Hours","Address":"fable.Dates.dateAddHours"},"dateadddays":{"Name":"Date Add Days","Address":"fable.Dates.dateAddDays"},"dateaddweeks":{"Name":"Date Add Weeks","Address":"fable.Dates.dateAddWeeks"},"dateaddmonths":{"Name":"Date Add Months","Address":"fable.Dates.dateAddMonths"},"dateaddyears":{"Name":"Date Add Years","Address":"fable.Dates.dateAddYears"},"datefromparts":{"Name":"Date From Parts","Address":"fable.Dates.dateFromParts"},"slice":{"Name":"Slice Array","Address":"fable.Utility.slice"},"createvalueobjectbyhashes":{"Name":"Create Value Object by Hashes","Address":"fable.Utility.createValueObjectByHashes"},"polynomialregression":{"Name":"Perform an nth degree Polynomial Regression on a Set of X and Y Values","Address":"fable.Math.polynomialRegression"},"leastsquares":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"linest":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"matrixtranspose":{"Name":"Transpose a Matrix","Address":"fable.Math.matrixTranspose"},"matrixmultiply":{"Name":"Multiply Two Matrices","Address":"fable.Math.matrixMultiply"},"matrixvectormultiply":{"Name":"Multiply a Matrix by a Vector","Address":"fable.Math.matrixVectorMultiply"},"matrixinverse":{"Name":"Inverse a Matrix","Address":"fable.Math.matrixInverse"},"gaussianelimination":{"Name":"Solve a System of Linear Equations using Gaussian Elimination","Address":"fable.Math.gaussianElimination"},"predict":{"Name":"Predict Y Values from X Values using a Regression Model","Address":"fable.Math.predictFromRegressionModel"},"stringcountsegments":{"Name":"Count Segments in a String","Address":"fable.DataFormat.stringCountSegments"},"stringgetsegments":{"Name":"Get Segments from a String","Address":"fable.DataFormat.stringGetSegments"},"bezierpoint":{"Name":"Evaluate a Point on a Cubic Bezier Curve at Parameter t","Address":"fable.Math.bezierPoint"},"beziercurvefit":{"Name":"Fit a Cubic Bezier Curve to a Set of Data Points","Address":"fable.Math.bezierCurveFit"}};},{}],163:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');class ExpressionParserLinter extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-Linter';}lintTokenizedExpression(pTokenizedExpression,pResultObject){let tmpResults=typeof pResultObject==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.LinterResults=[];// Guard against bad data being passed in
|
|
3971
3976
|
if(!Array.isArray(pTokenizedExpression)){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.lintTokenizedExpression was passed a non-array tokenized expression.`);tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}if(pTokenizedExpression.length<1){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.lintTokenizedExpression was passed an empty tokenized expression.`);tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}// 1. Check for balanced parenthesis
|
|
3972
3977
|
let tmpParenthesisDepth=0;// If it is in a state address, we don't care about the parenthesis
|
|
3973
3978
|
// State addresses are between squiggly brackets
|
|
@@ -4688,7 +4693,57 @@ return this.addPrecise(pEasingConfiguration.DomainRangeStart,tmpScaledValue);}}/
|
|
|
4688
4693
|
* @param {Array<number|string>|number|string} pIndependentVariableVector - The independent variable values [x1, x2, ..., xn] or single value for single variable.
|
|
4689
4694
|
*
|
|
4690
4695
|
* @return {number|string} - The predicted dependent variable value.
|
|
4691
|
-
*/predictFromRegressionModel(pRegressionCoefficients,pIndependentVariableVector){let tmpIndependentVariableVector=pIndependentVariableVector;if(!Array.isArray(pIndependentVariableVector)){tmpIndependentVariableVector=[pIndependentVariableVector];}return pRegressionCoefficients.slice(1).reduce((sum,b,i)=>{return this.addPrecise(sum,this.multiplyPrecise(b,tmpIndependentVariableVector[i]));},pRegressionCoefficients[0]);}
|
|
4696
|
+
*/predictFromRegressionModel(pRegressionCoefficients,pIndependentVariableVector){let tmpIndependentVariableVector=pIndependentVariableVector;if(!Array.isArray(pIndependentVariableVector)){tmpIndependentVariableVector=[pIndependentVariableVector];}return pRegressionCoefficients.slice(1).reduce((sum,b,i)=>{return this.addPrecise(sum,this.multiplyPrecise(b,tmpIndependentVariableVector[i]));},pRegressionCoefficients[0]);}/**
|
|
4697
|
+
* Evaluate a point on a cubic bezier curve at parameter t.
|
|
4698
|
+
*
|
|
4699
|
+
* B(t) = (1-t)^3*P0 + 3*(1-t)^2*t*P1 + 3*(1-t)*t^2*P2 + t^3*P3
|
|
4700
|
+
*
|
|
4701
|
+
* @param {number|string} pP0 - First control point value
|
|
4702
|
+
* @param {number|string} pP1 - Second control point value
|
|
4703
|
+
* @param {number|string} pP2 - Third control point value
|
|
4704
|
+
* @param {number|string} pP3 - Fourth control point value
|
|
4705
|
+
* @param {number|string} pT - Parameter t in [0,1]
|
|
4706
|
+
*
|
|
4707
|
+
* @return {string} - The bezier curve value at parameter t
|
|
4708
|
+
*/bezierPoint(pP0,pP1,pP2,pP3,pT){let tmpT=this.parsePrecise(pT,0);let tmpOneMinusT=this.subtractPrecise(1,tmpT);// (1-t)^3 * P0
|
|
4709
|
+
let tmpTerm0=this.multiplyPrecise(this.powerPrecise(tmpOneMinusT,3),pP0);// 3 * (1-t)^2 * t * P1
|
|
4710
|
+
let tmpTerm1=this.multiplyPrecise(this.multiplyPrecise(this.multiplyPrecise(3,this.powerPrecise(tmpOneMinusT,2)),tmpT),pP1);// 3 * (1-t) * t^2 * P2
|
|
4711
|
+
let tmpTerm2=this.multiplyPrecise(this.multiplyPrecise(this.multiplyPrecise(3,tmpOneMinusT),this.powerPrecise(tmpT,2)),pP2);// t^3 * P3
|
|
4712
|
+
let tmpTerm3=this.multiplyPrecise(this.powerPrecise(tmpT,3),pP3);return this.addPrecise(this.addPrecise(tmpTerm0,tmpTerm1),this.addPrecise(tmpTerm2,tmpTerm3));}/**
|
|
4713
|
+
* Fit a cubic bezier curve to a set of data points using least-squares optimization.
|
|
4714
|
+
*
|
|
4715
|
+
* Given arrays of X and Y values representing data points, this function finds the four
|
|
4716
|
+
* control points (P0, P1, P2, P3) of a cubic bezier curve that best fits the data.
|
|
4717
|
+
*
|
|
4718
|
+
* The first and last control points are pinned to the first and last data points.
|
|
4719
|
+
* The interior control points (P1, P2) are found by least-squares minimization of
|
|
4720
|
+
* the squared distances between the data points and the curve.
|
|
4721
|
+
*
|
|
4722
|
+
* Parameter t values are assigned by chord-length parameterization: each data point
|
|
4723
|
+
* gets a t value proportional to its cumulative distance along the polyline.
|
|
4724
|
+
*
|
|
4725
|
+
* @param {Array<number|string>} pXValues - Array of x coordinates
|
|
4726
|
+
* @param {Array<number|string>} pYValues - Array of y coordinates
|
|
4727
|
+
*
|
|
4728
|
+
* @return {Array<Array<string>>} - Four control points as [[x0,y0], [x1,y1], [x2,y2], [x3,y3]]
|
|
4729
|
+
*/bezierCurveFit(pXValues,pYValues){if(!Array.isArray(pXValues)||!Array.isArray(pYValues)){this.log.warn('bezierCurveFit: pXValues and pYValues must be arrays');return[[0,0],[0,0],[0,0],[0,0]];}let tmpN=Math.min(pXValues.length,pYValues.length);if(tmpN<2){this.log.warn('bezierCurveFit: need at least 2 data points');return[[0,0],[0,0],[0,0],[0,0]];}// Pin P0 and P3 to the first and last data points
|
|
4730
|
+
let tmpP0x=this.parsePrecise(pXValues[0],0);let tmpP0y=this.parsePrecise(pYValues[0],0);let tmpP3x=this.parsePrecise(pXValues[tmpN-1],0);let tmpP3y=this.parsePrecise(pYValues[tmpN-1],0);if(tmpN===2){// With only two points, place control points at 1/3 and 2/3 along the line
|
|
4731
|
+
let tmpP1x=this.addPrecise(tmpP0x,this.dividePrecise(this.subtractPrecise(tmpP3x,tmpP0x),3));let tmpP1y=this.addPrecise(tmpP0y,this.dividePrecise(this.subtractPrecise(tmpP3y,tmpP0y),3));let tmpP2x=this.addPrecise(tmpP0x,this.multiplyPrecise(this.dividePrecise(this.subtractPrecise(tmpP3x,tmpP0x),3),2));let tmpP2y=this.addPrecise(tmpP0y,this.multiplyPrecise(this.dividePrecise(this.subtractPrecise(tmpP3y,tmpP0y),3),2));return[[tmpP0x.toString(),tmpP0y.toString()],[tmpP1x.toString(),tmpP1y.toString()],[tmpP2x.toString(),tmpP2y.toString()],[tmpP3x.toString(),tmpP3y.toString()]];}// Compute chord-length parameterization for t values
|
|
4732
|
+
let tmpDistances=[0];for(let i=1;i<tmpN;i++){let tmpDx=this.subtractPrecise(pXValues[i],pXValues[i-1]);let tmpDy=this.subtractPrecise(pYValues[i],pYValues[i-1]);let tmpDist=this.sqrtPrecise(this.addPrecise(this.multiplyPrecise(tmpDx,tmpDx),this.multiplyPrecise(tmpDy,tmpDy)));tmpDistances.push(this.addPrecise(tmpDistances[i-1],tmpDist));}let tmpTotalLength=tmpDistances[tmpN-1];let tmpTValues=[];for(let i=0;i<tmpN;i++){if(this.comparePrecise(tmpTotalLength,0)==0){tmpTValues.push(this.dividePrecise(i,tmpN-1));}else{tmpTValues.push(this.dividePrecise(tmpDistances[i],tmpTotalLength));}}// Build the least-squares system for interior control points P1 and P2.
|
|
4733
|
+
// For each data point i with parameter t_i:
|
|
4734
|
+
// B(t_i) = (1-t)^3*P0 + 3*(1-t)^2*t*P1 + 3*(1-t)*t^2*P2 + t^3*P3
|
|
4735
|
+
//
|
|
4736
|
+
// We want to minimize sum of |DataPoint_i - B(t_i)|^2 over P1 and P2.
|
|
4737
|
+
// Let A1(t) = 3*(1-t)^2*t and A2(t) = 3*(1-t)*t^2.
|
|
4738
|
+
// Then: A1(t)*P1 + A2(t)*P2 = DataPoint - (1-t)^3*P0 - t^3*P3
|
|
4739
|
+
//
|
|
4740
|
+
// This gives a 2x2 linear system (solved independently for x and y).
|
|
4741
|
+
let tmpC11=0,tmpC12=0,tmpC22=0;let tmpRx1=0,tmpRx2=0;let tmpRy1=0,tmpRy2=0;for(let i=0;i<tmpN;i++){let tmpT=tmpTValues[i];let tmpOneMinusT=this.subtractPrecise(1,tmpT);// Basis functions for P1 and P2
|
|
4742
|
+
let tmpA1=this.multiplyPrecise(this.multiplyPrecise(3,this.powerPrecise(tmpOneMinusT,2)),tmpT);let tmpA2=this.multiplyPrecise(this.multiplyPrecise(3,tmpOneMinusT),this.powerPrecise(tmpT,2));// Build normal equations: C * [P1; P2] = R
|
|
4743
|
+
tmpC11=this.addPrecise(tmpC11,this.multiplyPrecise(tmpA1,tmpA1));tmpC12=this.addPrecise(tmpC12,this.multiplyPrecise(tmpA1,tmpA2));tmpC22=this.addPrecise(tmpC22,this.multiplyPrecise(tmpA2,tmpA2));// Right-hand side: DataPoint - (1-t)^3*P0 - t^3*P3
|
|
4744
|
+
let tmpB0=this.powerPrecise(tmpOneMinusT,3);let tmpB3=this.powerPrecise(tmpT,3);let tmpResidualX=this.subtractPrecise(this.subtractPrecise(pXValues[i],this.multiplyPrecise(tmpB0,tmpP0x)),this.multiplyPrecise(tmpB3,tmpP3x));let tmpResidualY=this.subtractPrecise(this.subtractPrecise(pYValues[i],this.multiplyPrecise(tmpB0,tmpP0y)),this.multiplyPrecise(tmpB3,tmpP3y));tmpRx1=this.addPrecise(tmpRx1,this.multiplyPrecise(tmpA1,tmpResidualX));tmpRx2=this.addPrecise(tmpRx2,this.multiplyPrecise(tmpA2,tmpResidualX));tmpRy1=this.addPrecise(tmpRy1,this.multiplyPrecise(tmpA1,tmpResidualY));tmpRy2=this.addPrecise(tmpRy2,this.multiplyPrecise(tmpA2,tmpResidualY));}// Solve the 2x2 system: [[C11, C12], [C12, C22]] * [P1, P2] = [R1, R2]
|
|
4745
|
+
let tmpDet=this.subtractPrecise(this.multiplyPrecise(tmpC11,tmpC22),this.multiplyPrecise(tmpC12,tmpC12));let tmpP1x,tmpP1y,tmpP2x,tmpP2y;if(this.comparePrecise(this.absPrecise(tmpDet),'1e-20')<0){// Degenerate case: place control points at 1/3 and 2/3 along the line
|
|
4746
|
+
tmpP1x=this.addPrecise(tmpP0x,this.dividePrecise(this.subtractPrecise(tmpP3x,tmpP0x),3));tmpP1y=this.addPrecise(tmpP0y,this.dividePrecise(this.subtractPrecise(tmpP3y,tmpP0y),3));tmpP2x=this.addPrecise(tmpP0x,this.multiplyPrecise(this.dividePrecise(this.subtractPrecise(tmpP3x,tmpP0x),3),2));tmpP2y=this.addPrecise(tmpP0y,this.multiplyPrecise(this.dividePrecise(this.subtractPrecise(tmpP3y,tmpP0y),3),2));}else{tmpP1x=this.dividePrecise(this.subtractPrecise(this.multiplyPrecise(tmpC22,tmpRx1),this.multiplyPrecise(tmpC12,tmpRx2)),tmpDet);tmpP1y=this.dividePrecise(this.subtractPrecise(this.multiplyPrecise(tmpC22,tmpRy1),this.multiplyPrecise(tmpC12,tmpRy2)),tmpDet);tmpP2x=this.dividePrecise(this.subtractPrecise(this.multiplyPrecise(tmpC11,tmpRx2),this.multiplyPrecise(tmpC12,tmpRx1)),tmpDet);tmpP2y=this.dividePrecise(this.subtractPrecise(this.multiplyPrecise(tmpC11,tmpRy2),this.multiplyPrecise(tmpC12,tmpRy1)),tmpDet);}return[[tmpP0x.toString(),tmpP0y.toString()],[tmpP1x.toString(),tmpP1y.toString()],[tmpP2x.toString(),tmpP2y.toString()],[tmpP3x.toString(),tmpP3y.toString()]];}}module.exports=FableServiceMath;},{"./Fable-SetConcatArray.js":183,"fable-serviceproviderbase":59}],172:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');/**
|
|
4692
4747
|
* Precedent Meta-Templating
|
|
4693
4748
|
* @author Steven Velozo <steven@velozo.com>
|
|
4694
4749
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|