fable 3.1.51 → 3.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -2
- package/dist/fable.js +21 -12
- package/dist/fable.js.map +1 -1
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/docs/.nojekyll +0 -0
- package/docs/README.md +95 -0
- package/docs/_sidebar.md +42 -0
- package/docs/architecture.md +326 -0
- package/docs/cover.md +11 -0
- package/docs/index.html +51 -0
- package/docs/services/README.md +76 -0
- package/docs/services/anticipate.md +331 -0
- package/docs/services/csv-parser.md +152 -0
- package/docs/services/data-format.md +277 -0
- package/docs/services/data-generation.md +142 -0
- package/docs/services/dates.md +216 -0
- package/docs/services/environment-data.md +44 -0
- package/docs/services/expression-parser-functions/README.md +178 -0
- package/docs/services/expression-parser-functions/abs.md +84 -0
- package/docs/services/expression-parser-functions/aggregationhistogram.md +83 -0
- package/docs/services/expression-parser-functions/aggregationhistogrambyobject.md +64 -0
- package/docs/services/expression-parser-functions/arrayconcat.md +64 -0
- package/docs/services/expression-parser-functions/avg.md +81 -0
- package/docs/services/expression-parser-functions/bucketset.md +69 -0
- package/docs/services/expression-parser-functions/ceil.md +70 -0
- package/docs/services/expression-parser-functions/cleanvaluearray.md +66 -0
- package/docs/services/expression-parser-functions/cleanvalueobject.md +68 -0
- package/docs/services/expression-parser-functions/compare.md +72 -0
- package/docs/services/expression-parser-functions/concat.md +73 -0
- package/docs/services/expression-parser-functions/concatraw.md +73 -0
- package/docs/services/expression-parser-functions/cos.md +75 -0
- package/docs/services/expression-parser-functions/count.md +73 -0
- package/docs/services/expression-parser-functions/countset.md +65 -0
- package/docs/services/expression-parser-functions/countsetelements.md +63 -0
- package/docs/services/expression-parser-functions/createarrayfromabsolutevalues.md +63 -0
- package/docs/services/expression-parser-functions/createvalueobjectbyhashes.md +69 -0
- package/docs/services/expression-parser-functions/cumulativesummation.md +96 -0
- package/docs/services/expression-parser-functions/dateadddays.md +79 -0
- package/docs/services/expression-parser-functions/dateaddhours.md +74 -0
- package/docs/services/expression-parser-functions/dateaddmilliseconds.md +65 -0
- package/docs/services/expression-parser-functions/dateaddminutes.md +72 -0
- package/docs/services/expression-parser-functions/dateaddmonths.md +74 -0
- package/docs/services/expression-parser-functions/dateaddseconds.md +66 -0
- package/docs/services/expression-parser-functions/dateaddweeks.md +73 -0
- package/docs/services/expression-parser-functions/dateaddyears.md +74 -0
- package/docs/services/expression-parser-functions/datedaydifference.md +84 -0
- package/docs/services/expression-parser-functions/datefromparts.md +81 -0
- package/docs/services/expression-parser-functions/datehourdifference.md +64 -0
- package/docs/services/expression-parser-functions/datemathadd.md +72 -0
- package/docs/services/expression-parser-functions/datemilliseconddifference.md +64 -0
- package/docs/services/expression-parser-functions/dateminutedifference.md +64 -0
- package/docs/services/expression-parser-functions/datemonthdifference.md +66 -0
- package/docs/services/expression-parser-functions/dateseconddifference.md +64 -0
- package/docs/services/expression-parser-functions/dateweekdifference.md +65 -0
- package/docs/services/expression-parser-functions/dateyeardifference.md +64 -0
- package/docs/services/expression-parser-functions/distributionhistogram.md +96 -0
- package/docs/services/expression-parser-functions/distributionhistogrambyobject.md +64 -0
- package/docs/services/expression-parser-functions/entryinset.md +72 -0
- package/docs/services/expression-parser-functions/euler.md +77 -0
- package/docs/services/expression-parser-functions/exp.md +74 -0
- package/docs/services/expression-parser-functions/findfirstvaluebyexactmatch.md +67 -0
- package/docs/services/expression-parser-functions/findfirstvaluebystringincludes.md +67 -0
- package/docs/services/expression-parser-functions/flatten.md +76 -0
- package/docs/services/expression-parser-functions/floor.md +70 -0
- package/docs/services/expression-parser-functions/gaussianelimination.md +75 -0
- package/docs/services/expression-parser-functions/generatearrayofobjectsfromsets.md +70 -0
- package/docs/services/expression-parser-functions/getvalue.md +90 -0
- package/docs/services/expression-parser-functions/getvaluearray.md +64 -0
- package/docs/services/expression-parser-functions/getvalueobject.md +67 -0
- package/docs/services/expression-parser-functions/if.md +109 -0
- package/docs/services/expression-parser-functions/iterativeseries.md +107 -0
- package/docs/services/expression-parser-functions/join.md +75 -0
- package/docs/services/expression-parser-functions/joinraw.md +64 -0
- package/docs/services/expression-parser-functions/largestinset.md +63 -0
- package/docs/services/expression-parser-functions/leastsquares.md +66 -0
- package/docs/services/expression-parser-functions/linest.md +58 -0
- package/docs/services/expression-parser-functions/log.md +74 -0
- package/docs/services/expression-parser-functions/match.md +71 -0
- package/docs/services/expression-parser-functions/matrixinverse.md +67 -0
- package/docs/services/expression-parser-functions/matrixmultiply.md +71 -0
- package/docs/services/expression-parser-functions/matrixtranspose.md +72 -0
- package/docs/services/expression-parser-functions/matrixvectormultiply.md +69 -0
- package/docs/services/expression-parser-functions/max.md +73 -0
- package/docs/services/expression-parser-functions/mean.md +63 -0
- package/docs/services/expression-parser-functions/median.md +79 -0
- package/docs/services/expression-parser-functions/min.md +73 -0
- package/docs/services/expression-parser-functions/mode.md +66 -0
- package/docs/services/expression-parser-functions/objectkeystoarray.md +66 -0
- package/docs/services/expression-parser-functions/objectvaluessortbyexternalobjectarray.md +65 -0
- package/docs/services/expression-parser-functions/objectvaluestoarray.md +67 -0
- package/docs/services/expression-parser-functions/percent.md +75 -0
- package/docs/services/expression-parser-functions/pi.md +77 -0
- package/docs/services/expression-parser-functions/polynomialregression.md +69 -0
- package/docs/services/expression-parser-functions/predict.md +71 -0
- package/docs/services/expression-parser-functions/rad.md +85 -0
- package/docs/services/expression-parser-functions/randomfloat.md +63 -0
- package/docs/services/expression-parser-functions/randomfloatbetween.md +72 -0
- package/docs/services/expression-parser-functions/randomfloatupto.md +65 -0
- package/docs/services/expression-parser-functions/randominteger.md +56 -0
- package/docs/services/expression-parser-functions/randomintegerbetween.md +72 -0
- package/docs/services/expression-parser-functions/randomintegerupto.md +64 -0
- package/docs/services/expression-parser-functions/resolvehtmlentities.md +64 -0
- package/docs/services/expression-parser-functions/round.md +111 -0
- package/docs/services/expression-parser-functions/setconcatenate.md +64 -0
- package/docs/services/expression-parser-functions/sin.md +83 -0
- package/docs/services/expression-parser-functions/slice.md +80 -0
- package/docs/services/expression-parser-functions/smallestinset.md +63 -0
- package/docs/services/expression-parser-functions/sorthistogram.md +70 -0
- package/docs/services/expression-parser-functions/sorthistogrambykeys.md +69 -0
- package/docs/services/expression-parser-functions/sortset.md +75 -0
- package/docs/services/expression-parser-functions/sqrt.md +85 -0
- package/docs/services/expression-parser-functions/stdev.md +81 -0
- package/docs/services/expression-parser-functions/stdeva.md +58 -0
- package/docs/services/expression-parser-functions/stdevp.md +83 -0
- package/docs/services/expression-parser-functions/stringcountsegments.md +66 -0
- package/docs/services/expression-parser-functions/stringgetsegments.md +74 -0
- package/docs/services/expression-parser-functions/subtractingsummation.md +66 -0
- package/docs/services/expression-parser-functions/sum.md +78 -0
- package/docs/services/expression-parser-functions/tan.md +78 -0
- package/docs/services/expression-parser-functions/tofixed.md +75 -0
- package/docs/services/expression-parser-functions/var.md +67 -0
- package/docs/services/expression-parser-functions/vara.md +58 -0
- package/docs/services/expression-parser-functions/varp.md +66 -0
- package/docs/services/expression-parser-functions/when.md +98 -0
- package/docs/services/expression-parser.md +314 -0
- package/docs/services/file-persistence.md +279 -0
- package/docs/services/logging.md +237 -0
- package/docs/services/logic.md +166 -0
- package/docs/services/manifest.md +256 -0
- package/docs/services/math.md +279 -0
- package/docs/services/meta-template.md +268 -0
- package/docs/services/object-cache.md +171 -0
- package/docs/services/operation.md +207 -0
- package/docs/services/progress-time.md +167 -0
- package/docs/services/progress-tracker-set.md +222 -0
- package/docs/services/rest-client.md +296 -0
- package/docs/services/settings-manager.md +265 -0
- package/docs/services/template.md +233 -0
- package/docs/services/utility.md +304 -0
- package/docs/services/uuid.md +162 -0
- package/package.json +2 -2
- package/source/services/Fable-Service-DataFormat.js +1 -0
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ValueMarshal.js +6 -4
- package/test/ExpressionParser_tests.js +3 -0
package/README.md
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
|
-
Fable
|
|
1
|
+
Fable
|
|
2
2
|
=====
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
A comprehensive Node.js service dependency injection, configuration management, and logging library. Fable provides a service-oriented architecture with built-in dependency injection, making it easy to build modular, testable applications.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **Service Provider Architecture** - IoC container with dependency injection
|
|
9
|
+
- **Configuration Management** - Centralized settings with environment support
|
|
10
|
+
- **Logging** - Flexible logging with multiple stream support
|
|
11
|
+
- **UUID Generation** - Distributed unique identifier generation
|
|
12
|
+
- **Math Operations** - Arbitrary precision math using big.js
|
|
13
|
+
- **Date Manipulation** - Comprehensive date operations using day.js
|
|
14
|
+
- **Expression Parser** - Evaluate mathematical and logical expressions
|
|
15
|
+
- **REST Client** - HTTP request handling with caching
|
|
16
|
+
- **Template Engine** - Variable substitution and rendering
|
|
17
|
+
- **And much more...**
|
|
18
|
+
|
|
19
|
+
## Documentation
|
|
20
|
+
|
|
21
|
+
Comprehensive documentation is available in the [docs](./docs) folder:
|
|
22
|
+
|
|
23
|
+
- [Overview](./docs/README.md) - Introduction and getting started
|
|
24
|
+
- [Architecture](./docs/architecture.md) - System design and patterns
|
|
25
|
+
- [Services Reference](./docs/services/README.md) - All available services
|
|
26
|
+
- [ExpressionParser Functions](./docs/services/expression-parser-functions/README.md) - 90+ built-in functions
|
|
5
27
|
|
|
6
28
|
## Install
|
|
7
29
|
|
|
@@ -293,3 +315,66 @@ var uuid = fable.getUUID();
|
|
|
293
315
|
|
|
294
316
|
// The uuid variable now contains a unique string.
|
|
295
317
|
```
|
|
318
|
+
|
|
319
|
+
---------------------------------------
|
|
320
|
+
|
|
321
|
+
## Available Services
|
|
322
|
+
|
|
323
|
+
Fable provides a rich set of services organized into three categories:
|
|
324
|
+
|
|
325
|
+
### Pre-initialized Services
|
|
326
|
+
|
|
327
|
+
Available immediately on any Fable instance:
|
|
328
|
+
|
|
329
|
+
- **SettingsManager** - Configuration and settings management
|
|
330
|
+
- **UUID** - Unique identifier generation
|
|
331
|
+
- **Logging** - Flexible logging with multiple outputs
|
|
332
|
+
|
|
333
|
+
### Auto-instantiated Services
|
|
334
|
+
|
|
335
|
+
Created automatically on first access:
|
|
336
|
+
|
|
337
|
+
- **Dates** - Date manipulation and formatting (day.js)
|
|
338
|
+
- **Math** - Arbitrary precision arithmetic (big.js)
|
|
339
|
+
- **Utility** - Common utility functions
|
|
340
|
+
- **DataFormat** - Data transformation helpers
|
|
341
|
+
- **Logic** - Conditional and comparison operations
|
|
342
|
+
- **ProgressTime** - Time-based progress tracking
|
|
343
|
+
- **EnvironmentData** - Environment variable access
|
|
344
|
+
- **DataGeneration** - Random data generation
|
|
345
|
+
|
|
346
|
+
### On-demand Services
|
|
347
|
+
|
|
348
|
+
Instantiated when needed via `fable.instantiateServiceProvider()`:
|
|
349
|
+
|
|
350
|
+
- **Template** - Variable substitution engine
|
|
351
|
+
- **MetaTemplate** - Advanced templating with iterations
|
|
352
|
+
- **RestClient** - HTTP requests with caching
|
|
353
|
+
- **ExpressionParser** - Mathematical expression evaluation
|
|
354
|
+
- **Operation** - Async operation management
|
|
355
|
+
- **CSVParser** - CSV file parsing
|
|
356
|
+
- **FilePersistence** - File system operations
|
|
357
|
+
- **Manifest** - Application manifest handling
|
|
358
|
+
- **ObjectCache** - In-memory object caching
|
|
359
|
+
- **Anticipate** - Promise and callback helpers
|
|
360
|
+
|
|
361
|
+
### Using Services
|
|
362
|
+
|
|
363
|
+
```js
|
|
364
|
+
const libFable = require('fable');
|
|
365
|
+
const fable = new libFable();
|
|
366
|
+
|
|
367
|
+
// Auto-instantiated services - just access them
|
|
368
|
+
const today = fable.Dates.dayJS();
|
|
369
|
+
const sum = fable.Math.addPrecise('10.5', '20.3');
|
|
370
|
+
|
|
371
|
+
// On-demand services - instantiate when needed
|
|
372
|
+
const template = fable.instantiateServiceProvider('Template');
|
|
373
|
+
const result = template.render('Hello ${Name}!', { Name: 'World' });
|
|
374
|
+
|
|
375
|
+
// ExpressionParser for complex calculations
|
|
376
|
+
const parser = fable.instantiateServiceProvider('ExpressionParser');
|
|
377
|
+
const value = parser.solve('SUM(1, 2, 3, 4, 5)', {});
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
See the [Services Documentation](./docs/services/README.md) for detailed information on each service.
|
package/dist/fable.js
CHANGED
|
@@ -667,20 +667,27 @@ switch(pLevel){case'trace':this.logStreamsTrace.push(pLogger);case'debug':this.l
|
|
|
667
667
|
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
668
|
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
669
|
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.
|
|
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.16","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.51","quackage":"^1.0.45","typescript":"^5.9.3"}};},{}],59:[function(require,module,exports){/**
|
|
671
671
|
* Fable Service Base
|
|
672
672
|
* @author <steven@velozo.com>
|
|
673
|
-
*/const libPackage=require('../package.json');class FableServiceProviderBase{
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
673
|
+
*/const libPackage=require('../package.json');class FableServiceProviderBase{/**
|
|
674
|
+
* The constructor can be used in two ways:
|
|
675
|
+
* 1) With a fable, options object and service hash (the options object and service hash are optional)a
|
|
676
|
+
* 2) With an object or nothing as the first parameter, where it will be treated as the options object
|
|
677
|
+
*
|
|
678
|
+
* @param {import('fable')|Record<string, any>} [pFable] - (optional) The fable instance, or the options object if there is no fable
|
|
679
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
680
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
681
|
+
*/constructor(pFable,pOptions,pServiceHash){/** @type {import('fable')} */this.fable;/** @type {string} */this.UUID;/** @type {Record<string, any>} */this.options;/** @type {Record<string, any>} */this.services;/** @type {Record<string, any>} */this.servicesMap;// Check if a fable was passed in; connect it if so
|
|
677
682
|
if(typeof pFable==='object'&&pFable.isFable){this.connectFable(pFable);}else{this.fable=false;}// Initialize the services map if it wasn't passed in
|
|
678
|
-
/** @type {
|
|
683
|
+
/** @type {Record<string, any>} */this._PackageFableServiceProvider=libPackage;// initialize options and UUID based on whether the fable was passed in or not.
|
|
679
684
|
if(this.fable){this.UUID=pFable.getUUID();this.options=typeof pOptions==='object'?pOptions:{};}else{// With no fable, check to see if there was an object passed into either of the first two
|
|
680
685
|
// Parameters, and if so, treat it as the options object
|
|
681
686
|
this.options=typeof pFable==='object'&&!pFable.isFable?pFable:typeof pOptions==='object'?pOptions:{};this.UUID=`CORE-SVC-${Math.floor(Math.random()*(99999-10000)+10000)}`;}// It's expected that the deriving class will set this
|
|
682
687
|
this.serviceType=`Unknown-${this.UUID}`;// The service hash is used to identify the specific instantiation of the service in the services map
|
|
683
|
-
this.Hash=typeof pServiceHash==='string'?pServiceHash:!this.fable&&typeof pOptions==='string'?pOptions:`${this.UUID}`;}
|
|
688
|
+
this.Hash=typeof pServiceHash==='string'?pServiceHash:!this.fable&&typeof pOptions==='string'?pOptions:`${this.UUID}`;}/**
|
|
689
|
+
* @param {import('fable')} pFable
|
|
690
|
+
*/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
|
|
684
691
|
module.exports.CoreServiceProviderBase=FableServiceProviderBase;},{"../package.json":58}],60:[function(require,module,exports){module.exports={"name":"fable-settings","version":"3.0.12","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.33"},"dependencies":{"fable-serviceproviderbase":"^3.0.15","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(){/**
|
|
685
692
|
* Fable Settings Template Processor
|
|
686
693
|
*
|
|
@@ -3181,7 +3188,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
3181
3188
|
// presumably different callback function.
|
|
3182
3189
|
// This makes sure that own properties are retained, so that
|
|
3183
3190
|
// decorations and such are not lost along the way.
|
|
3184
|
-
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.
|
|
3191
|
+
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.53","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.45"},"dependencies":{"async.eachlimit":"^0.5.2","async.waterfall":"^0.5.2","big.js":"^7.0.1","cachetrax":"^1.0.4","cookie":"^1.0.2","data-arithmatic":"^1.0.7","dayjs":"^1.11.19","fable-log":"^3.0.16","fable-serviceproviderbase":"^3.0.16","fable-settings":"^3.0.12","fable-uuid":"^3.0.11","manyfest":"^1.0.43","simple-get":"^4.0.1"}};},{}],150:[function(require,module,exports){/**
|
|
3185
3192
|
* Fable Application Services Support Library
|
|
3186
3193
|
* @author <steven@velozo.com>
|
|
3187
3194
|
*/// Pre-init services
|
|
@@ -3554,7 +3561,8 @@ tmpEnclosureStack.pop();}}return tmpString;}/**
|
|
|
3554
3561
|
*
|
|
3555
3562
|
* @param {string} pString - The input string to encode.
|
|
3556
3563
|
* @returns {string} The encoded string with special characters escaped.
|
|
3557
|
-
*/stringEncodeForJavascript(pString){if(typeof pString!=='string'){return pString;}
|
|
3564
|
+
*/stringEncodeForJavascript(pString){if(typeof pString!=='string'){return pString;}//FIXME: missing regexp
|
|
3565
|
+
return pString.replace(this._Regex_matcherJavascriptEncode,pMatch=>{switch(pMatch){case'"':return'\\"';case'\'':return'\\\'';case'\\':return'\\\\';case'\n':return'\\n';case'\r':return'\\r';default:return pMatch;// Return the original character if no encoding is needed
|
|
3558
3566
|
}});}/**
|
|
3559
3567
|
* Decodes a JavaScript-escaped string by replacing common escape sequences
|
|
3560
3568
|
* (such as \" \\n \\r \\' and \\\\) with their actual character representations.
|
|
@@ -4135,11 +4143,12 @@ tmpToken.Resolved=true;tmpToken.Value=tmpValue;tmpResults.ExpressionParserLog.pu
|
|
|
4135
4143
|
// Sometimes the token is wrapped in {} to indicate it's a direct address reference... we need to strip those off.
|
|
4136
4144
|
// e.g., {0x1234abcd...}
|
|
4137
4145
|
// So we need to strip off the {} if they exist.
|
|
4138
|
-
let tmpAddress=tmpToken.Token;if(tmpAddress.startsWith('{')&&tmpAddress.endsWith('}')){tmpAddress=tmpAddress.substring(1,tmpAddress.length-1);}let tmpValue=tmpManifest.getValueAtAddress(tmpDataSource,tmpAddress);if(
|
|
4146
|
+
let tmpAddress=tmpToken.Token;if(tmpAddress.startsWith('{')&&tmpAddress.endsWith('}')){tmpAddress=tmpAddress.substring(1,tmpAddress.length-1);}let tmpValue=tmpManifest.getValueAtAddress(tmpDataSource,tmpAddress);if(tmpValue==null){tmpResults.ExpressionParserLog.push(`WARNING: ExpressionParser.substituteValuesInTokenizedObjects found no value for the state address ${tmpToken.Token} at index ${i}`);//this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
4139
4147
|
continue;}else{//tmpResults.ExpressionParserLog.push(`INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [${tmpValue}] for the state address ${tmpToken.Token} at index ${i}`);
|
|
4140
4148
|
//this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
4141
|
-
try{let tmpValueParsed=new this.fable.Utility.bigNumber(tmpValue);tmpToken.Resolved=true;tmpToken.Value=tmpValueParsed.toString();}catch(pError){
|
|
4142
|
-
tmpToken.Resolved=
|
|
4149
|
+
try{let tmpValueParsed=new this.fable.Utility.bigNumber(tmpValue);tmpToken.Resolved=true;tmpToken.Value=tmpValueParsed.toString();}catch(pError){// TODO: Should we allow this to be a function? Good god the complexity and beauty of that...
|
|
4150
|
+
tmpToken.Resolved=true;tmpToken.Value=tmpValue;tmpResults.ExpressionParserLog.push(`INFO: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ${tmpToken.Token} at index ${i}; using raw value.`);//this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
4151
|
+
}}}if(pTokenizedObjects[i].Type==='Token.String'&&!tmpToken.Resolved){tmpResults.ExpressionParserLog.push(`INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [${tmpToken.Token}] for the string ${tmpToken.Token} at index ${i}`);if(this.LogNoisiness>1)this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);tmpToken.Resolved=true;// Take the quotes off the string
|
|
4143
4152
|
tmpToken.Value=tmpToken.Token.substring(1,tmpToken.Token.length-1);}if(pTokenizedObjects[i].Type==='Token.Constant'&&!tmpToken.Resolved){tmpResults.ExpressionParserLog.push(`INFO: ExpressionParser.substituteValuesInTokenizedObjects found a value [${tmpToken.Token}] for the constant ${tmpToken.Token} at index ${i}`);if(this.LogNoisiness>1)this.log.info(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);try{let tmpValueParsed=new this.fable.Utility.bigNumber(tmpToken.Token);tmpToken.Resolved=true;tmpToken.Value=tmpValueParsed.toString();}catch(pError){// This constant has the right symbols but apparently isn't a parsable number.
|
|
4144
4153
|
tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.substituteValuesInTokenizedObjects found a non-numeric value for the state address ${tmpToken.Token} at index ${i}`);//this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
4145
4154
|
tmpToken.Resolved=false;}}}return pTokenizedObjects;}}module.exports=ExpressionParserValueMarshal;},{"./Fable-Service-ExpressionParser-Base.js":159}],169:[function(require,module,exports){(function(process){(function(){const libFableServiceBase=require('fable-serviceproviderbase');const libFS=require('fs');const libPath=require('path');const libReadline=require('readline');class FableServiceFilePersistence extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='FilePersistence';if(!('Mode'in this.options)){this.options.Mode=parseInt('0777',8)&~process.umask();}this.libFS=libFS;this.libPath=libPath;this.libReadline=libReadline;}joinPath(){// TODO: Fix anything that's using this before changing this to the new true node join
|