pict 1.0.272 → 1.0.273
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/dist/pict.compatible.js +84 -32
- package/dist/pict.compatible.js.map +1 -1
- package/dist/pict.compatible.min.js +2 -2
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +80 -28
- package/dist/pict.js.map +1 -1
- package/dist/pict.min.js +2 -2
- package/dist/pict.min.js.map +1 -1
- package/package.json +5 -5
- package/source/Pict-Meadow-EntityProvider.js +219 -13
- package/test/Pict_entityprovider_tests.js +51 -0
- package/test/Pict_template_tests.js +1 -0
- package/types/source/Pict-Meadow-EntityProvider.d.ts +55 -2
- package/types/source/Pict-Meadow-EntityProvider.d.ts.map +1 -1
package/dist/pict.compatible.js
CHANGED
|
@@ -3230,20 +3230,20 @@ if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1;}else if(start
|
|
|
3230
3230
|
// have a good chance at having a non-empty extension
|
|
3231
3231
|
preDotState=-1;}}if(startDot===-1||end===-1||// We saw a non-dot character immediately before the dot
|
|
3232
3232
|
preDotState===0||// The (right-most) trimmed path component is exactly '..'
|
|
3233
|
-
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":149}],138:[function(require,module,exports){module.exports={"name":"pict-application","version":"1.0.
|
|
3233
|
+
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":149}],138:[function(require,module,exports){module.exports={"name":"pict-application","version":"1.0.27","description":"Application base class for a pict view-based application","main":"source/Pict-Application.js","scripts":{"test":"npx mocha -u tdd -R spec","start":"node source/Pict-Application.js","coverage":"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-application-image:local","docker-dev-run":"docker run -it -d --name pict-application-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict-application\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-application-image:local","docker-dev-shell":"docker exec -it pict-application-dev /bin/bash","tests":"npx mocha -u tdd --exit -R spec --grep","lint":"eslint source/**","types":"tsc -p ."},"types":"types/source/Pict-Application.d.ts","repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-application.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-application/issues"},"homepage":"https://github.com/stevenvelozo/pict-application#readme","devDependencies":{"@eslint/js":"^9.28.0","browser-env":"^3.3.0","eslint":"^9.28.0","pict":"^1.0.272","pict-provider":"^1.0.5","pict-view":"^1.0.60","quackage":"^1.0.41"},"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"]},"dependencies":{"fable-serviceproviderbase":"^3.0.15"}};},{}],139:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libPackage=require('../package.json');var defaultPictSettings={Name:'DefaultPictApplication',// The main "viewport" is the view that is used to host our application
|
|
3234
3234
|
MainViewportViewIdentifier:'Default-View',MainViewportRenderableHash:false,MainViewportDestinationAddress:false,MainViewportDefaultDataAddress:false,// Whether or not we should automatically render the main viewport and other autorender views after we initialize the pict application
|
|
3235
3235
|
AutoSolveAfterInitialize:true,AutoRenderMainViewportViewAfterInitialize:true,AutoRenderViewsAfterInitialize:false,AutoLoginAfterInitialize:false,AutoLoadDataAfterLogin:false,ConfigurationOnlyViews:[],Manifests:{},// The prefix to prepend on all template destination hashes
|
|
3236
3236
|
IdentifierAddressPrefix:'PICT-'};/**
|
|
3237
3237
|
* Base class for pict applications.
|
|
3238
3238
|
*/var PictApplication=/*#__PURE__*/function(_libFableServiceBase15){/**
|
|
3239
3239
|
* @param {import('fable')} pFable
|
|
3240
|
-
* @param {any} [pOptions]
|
|
3240
|
+
* @param {Record<string, any>} [pOptions]
|
|
3241
3241
|
* @param {string} [pServiceHash]
|
|
3242
3242
|
*/function PictApplication(pFable,pOptions,pServiceHash){var _this52;_classCallCheck2(this,PictApplication);var tmpCarryOverConfiguration=_typeof(pFable.settings.PictApplicationConfiguration)==='object'?pFable.settings.PictApplicationConfiguration:{};var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),tmpCarryOverConfiguration,pOptions);_this52=_callSuper(this,PictApplication,[pFable,tmpOptions,pServiceHash]);/** @type {any} */_this52.options;/** @type {any} */_this52.log;/** @type {import('pict') & import('fable')} */_this52.fable;/** @type {string} */_this52.UUID;/** @type {string} */_this52.Hash;/**
|
|
3243
3243
|
* @type {{ [key: string]: any }}
|
|
3244
3244
|
*/_this52.servicesMap;_this52.serviceType='PictApplication';/** @type {Record<string, any>} */_this52._Package=libPackage;// Convenience and consistency naming
|
|
3245
3245
|
_this52.pict=_this52.fable;// Wire in the essential Pict state
|
|
3246
|
-
_this52.AppData=_this52.fable.AppData;/** @type {number} */_this52.initializeTimestamp;/** @type {number} */_this52.lastSolvedTimestamp;/** @type {number} */_this52.lastLoginTimestamp;/** @type {number} */_this52.lastMarshalFromViewsTimestamp;/** @type {number} */_this52.lastMarshalToViewsTimestamp;/** @type {number} */_this52.lastAutoRenderTimestamp;/** @type {number} */_this52.lastLoadDataTimestamp;// Load all the manifests for the application
|
|
3246
|
+
/** @type {Record<string, any>} */_this52.AppData=_this52.fable.AppData;/** @type {Record<string, any>} */_this52.Bundle=_this52.fable.Bundle;/** @type {number} */_this52.initializeTimestamp;/** @type {number} */_this52.lastSolvedTimestamp;/** @type {number} */_this52.lastLoginTimestamp;/** @type {number} */_this52.lastMarshalFromViewsTimestamp;/** @type {number} */_this52.lastMarshalToViewsTimestamp;/** @type {number} */_this52.lastAutoRenderTimestamp;/** @type {number} */_this52.lastLoadDataTimestamp;// Load all the manifests for the application
|
|
3247
3247
|
var tmpManifestKeys=Object.keys(_this52.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
3248
3248
|
var tmpManifestKey=tmpManifestKeys[i];_this52.fable.instantiateServiceProvider('Manifest',_this52.options.Manifests[tmpManifestKey],tmpManifestKey);}}return _this52;}/* -------------------------------------------------------------------------- *//* Code Section: Solve All Views *//* -------------------------------------------------------------------------- *//**
|
|
3249
3249
|
* @return {boolean}
|
|
@@ -3428,16 +3428,16 @@ var tmpLoadedViews=Object.keys(this.pict.views);// Sort the views by their prior
|
|
|
3428
3428
|
// If they are all the default priority 0, it will end up being add order due to JSON Object Property Key order stuff
|
|
3429
3429
|
tmpLoadedViews.sort(function(a,b){return _this62.pict.views[a].options.AutoRenderOrdinal-_this62.pict.views[b].options.AutoRenderOrdinal;});for(var i=0;i<tmpLoadedViews.length;i++){var tmpView=this.pict.views[tmpLoadedViews[i]];if(tmpView.options.AutoRender){tmpAnticipate.anticipate(tmpView.renderAsync.bind(tmpView));}}tmpAnticipate.wait(function(pError){_this62.lastAutoRenderTimestamp=_this62.fable.log.getTimeStamp();if(_this62.pict.LogNoisiness>0){_this62.log.trace("PictApp [".concat(_this62.UUID,"]::[").concat(_this62.Hash,"] ").concat(_this62.options.Name," renderAutoViewsAsync complete."));}return tmpCallback(pError);});}/**
|
|
3430
3430
|
* @return {boolean}
|
|
3431
|
-
*/},{key:"isPictApplication",get:function get(){return true;}}]);}(libFableServiceBase);module.exports=PictApplication;},{"../package.json":138,"fable-serviceproviderbase":59}],140:[function(require,module,exports){module.exports={"name":"pict-provider","version":"1.0.
|
|
3431
|
+
*/},{key:"isPictApplication",get:function get(){return true;}}]);}(libFableServiceBase);module.exports=PictApplication;},{"../package.json":138,"fable-serviceproviderbase":59}],140:[function(require,module,exports){module.exports={"name":"pict-provider","version":"1.0.6","description":"Pict Provider Base Class","main":"source/Pict-Provider.js","scripts":{"start":"node source/Pict-Provider.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","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-provider-image:local","docker-dev-run":"docker run -it -d --name pict-provider-dev -p 24125:8080 -p 30027:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict-provider\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-provider-image:local","docker-dev-shell":"docker exec -it pict-provider-dev /bin/bash","lint":"eslint source/**","types":"tsc -p ."},"types":"types/source/Pict-Provider.d.ts","repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-provider.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-provider/issues"},"homepage":"https://github.com/stevenvelozo/pict-provider#readme","devDependencies":{"@eslint/js":"^9.28.0","eslint":"^9.28.0","pict":"^1.0.270","quackage":"^1.0.41","typescript":"^5.8.3"},"dependencies":{"fable-serviceproviderbase":"^3.0.15"},"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"]}};},{}],141:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libPackage=require('../package.json');var defaultPictProviderSettings={ProviderIdentifier:false,// If this is set to true, when the App initializes this will.
|
|
3432
3432
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
3433
3433
|
AutoInitialize:true,AutoInitializeOrdinal:0,AutoLoadDataWithApp:true,AutoSolveWithApp:true,AutoSolveOrdinal:0,Manifests:{},Templates:[]};var PictProvider=/*#__PURE__*/function(_libFableServiceBase16){/**
|
|
3434
3434
|
* @param {import('fable')} pFable - The Fable instance.
|
|
3435
3435
|
* @param {Record<string, any>} [pOptions] - The options for the provider.
|
|
3436
3436
|
* @param {string} [pServiceHash] - The service hash for the provider.
|
|
3437
3437
|
*/function PictProvider(pFable,pOptions,pServiceHash){var _this63;_classCallCheck2(this,PictProvider);// Intersect default options, parent constructor, service information
|
|
3438
|
-
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);_this63=_callSuper(this,PictProvider,[pFable,tmpOptions,pServiceHash]);/** @type {import('fable') & import('pict') & { instantiateServiceProviderWithoutRegistration(pServiceType: string, pOptions?: Record<string, any>, pCustomServiceHash?: string): any }} */_this63.fable;/** @type {import('fable') & import('pict') & { instantiateServiceProviderWithoutRegistration(pServiceType: string, pOptions?: Record<string, any>, pCustomServiceHash?: string): any }} */_this63.pict;/** @type {any} */_this63.log;/** @type {Record<string, any>} */_this63.options;/** @type {string} */_this63.UUID;/** @type {string} */_this63.Hash;if(!_this63.options.ProviderIdentifier){_this63.options.ProviderIdentifier="AutoProviderID-".concat(_this63.fable.getUUID());}_this63.serviceType='PictProvider';/** @type {
|
|
3438
|
+
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictProviderSettings)),pOptions);_this63=_callSuper(this,PictProvider,[pFable,tmpOptions,pServiceHash]);/** @type {import('fable') & import('pict') & { instantiateServiceProviderWithoutRegistration(pServiceType: string, pOptions?: Record<string, any>, pCustomServiceHash?: string): any }} */_this63.fable;/** @type {import('fable') & import('pict') & { instantiateServiceProviderWithoutRegistration(pServiceType: string, pOptions?: Record<string, any>, pCustomServiceHash?: string): any }} */_this63.pict;/** @type {any} */_this63.log;/** @type {Record<string, any>} */_this63.options;/** @type {string} */_this63.UUID;/** @type {string} */_this63.Hash;if(!_this63.options.ProviderIdentifier){_this63.options.ProviderIdentifier="AutoProviderID-".concat(_this63.fable.getUUID());}_this63.serviceType='PictProvider';/** @type {Record<string, any>} */_this63._Package=libPackage;// Convenience and consistency naming
|
|
3439
3439
|
_this63.pict=_this63.fable;// Wire in the essential Pict application state
|
|
3440
|
-
_this63.AppData=_this63.pict.AppData;_this63.initializeTimestamp=false;_this63.lastSolvedTimestamp=false;for(var i=0;i<_this63.options.Templates.length;i++){var tmpDefaultTemplate=_this63.options.Templates[i];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this63.log.error("PictProvider [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ProviderIdentifier," could not load Default Template ").concat(i," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictProvider [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ProviderIdentifier," options object.");}_this63.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}return _this63;}/* -------------------------------------------------------------------------- *//* Code Section: Initialization *//* -------------------------------------------------------------------------- */_inherits(PictProvider,_libFableServiceBase16);return _createClass2(PictProvider,[{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onBeforeInitialize:"));}return true;}},{key:"onBeforeInitializeAsync",value:function onBeforeInitializeAsync(fCallback){this.onBeforeInitialize();return fCallback();}},{key:"onInitialize",value:function onInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onInitialize:"));}return true;}},{key:"onInitializeAsync",value:function onInitializeAsync(fCallback){this.onInitialize();return fCallback();}},{key:"initialize",value:function initialize(){if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow PROVIDER [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," initialize:"));}if(!this.initializeTimestamp){this.onBeforeInitialize();this.onInitialize();this.onAfterInitialize();this.initializeTimestamp=this.pict.log.getTimeStamp();return true;}else{this.log.warn("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this64=this;if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow PROVIDER [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," initializeAsync:"));}if(!this.initializeTimestamp){var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');if(this.pict.LogNoisiness>0){this.log.info("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," beginning initialization..."));}tmpAnticipate.anticipate(this.onBeforeInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));tmpAnticipate.wait(function(pError){_this64.initializeTimestamp=_this64.pict.log.getTimeStamp();if(pError){_this64.log.error("PictProvider [".concat(_this64.UUID,"]::[").concat(_this64.Hash,"] ").concat(_this64.options.ProviderIdentifier," initialization failed: ").concat(pError.message||pError),{Stack:pError.stack});}else if(_this64.pict.LogNoisiness>0){_this64.log.info("PictProvider [".concat(_this64.UUID,"]::[").concat(_this64.Hash,"] ").concat(_this64.options.ProviderIdentifier," initialization complete."));}return fCallback();});}else{this.log.warn("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," async initialize called but initialization is already completed. Aborting."));// TODO: Should this be an error?
|
|
3440
|
+
/** @type {Record<string, any>} */_this63.AppData=_this63.pict.AppData;/** @type {Record<string, any>} */_this63.Bundle=_this63.pict.Bundle;_this63.initializeTimestamp=false;_this63.lastSolvedTimestamp=false;for(var i=0;i<_this63.options.Templates.length;i++){var tmpDefaultTemplate=_this63.options.Templates[i];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this63.log.error("PictProvider [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ProviderIdentifier," could not load Default Template ").concat(i," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictProvider [".concat(_this63.UUID,"]::[").concat(_this63.Hash,"] ").concat(_this63.options.ProviderIdentifier," options object.");}_this63.pict.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}return _this63;}/* -------------------------------------------------------------------------- *//* Code Section: Initialization *//* -------------------------------------------------------------------------- */_inherits(PictProvider,_libFableServiceBase16);return _createClass2(PictProvider,[{key:"onBeforeInitialize",value:function onBeforeInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onBeforeInitialize:"));}return true;}},{key:"onBeforeInitializeAsync",value:function onBeforeInitializeAsync(fCallback){this.onBeforeInitialize();return fCallback();}},{key:"onInitialize",value:function onInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onInitialize:"));}return true;}},{key:"onInitializeAsync",value:function onInitializeAsync(fCallback){this.onInitialize();return fCallback();}},{key:"initialize",value:function initialize(){if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow PROVIDER [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," initialize:"));}if(!this.initializeTimestamp){this.onBeforeInitialize();this.onInitialize();this.onAfterInitialize();this.initializeTimestamp=this.pict.log.getTimeStamp();return true;}else{this.log.warn("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," initialize called but initialization is already completed. Aborting."));return false;}}},{key:"initializeAsync",value:function initializeAsync(fCallback){var _this64=this;if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow PROVIDER [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," initializeAsync:"));}if(!this.initializeTimestamp){var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');if(this.pict.LogNoisiness>0){this.log.info("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," beginning initialization..."));}tmpAnticipate.anticipate(this.onBeforeInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onInitializeAsync.bind(this));tmpAnticipate.anticipate(this.onAfterInitializeAsync.bind(this));tmpAnticipate.wait(function(pError){_this64.initializeTimestamp=_this64.pict.log.getTimeStamp();if(pError){_this64.log.error("PictProvider [".concat(_this64.UUID,"]::[").concat(_this64.Hash,"] ").concat(_this64.options.ProviderIdentifier," initialization failed: ").concat(pError.message||pError),{Stack:pError.stack});}else if(_this64.pict.LogNoisiness>0){_this64.log.info("PictProvider [".concat(_this64.UUID,"]::[").concat(_this64.Hash,"] ").concat(_this64.options.ProviderIdentifier," initialization complete."));}return fCallback();});}else{this.log.warn("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," async initialize called but initialization is already completed. Aborting."));// TODO: Should this be an error?
|
|
3441
3441
|
return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onAfterInitialize:"));}return true;}},{key:"onAfterInitializeAsync",value:function onAfterInitializeAsync(fCallback){this.onAfterInitialize();return fCallback();}},{key:"onPreRender",value:function onPreRender(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onPreRender:"));}return true;}},{key:"onPreRenderAsync",value:function onPreRenderAsync(fCallback){this.onPreRender();return fCallback();}},{key:"render",value:function render(){return this.onPreRender();}},{key:"renderAsync",value:function renderAsync(fCallback){this.onPreRender();return fCallback();}},{key:"onPreSolve",value:function onPreSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onPreSolve:"));}return true;}},{key:"onPreSolveAsync",value:function onPreSolveAsync(fCallback){this.onPreSolve();return fCallback();}},{key:"solve",value:function solve(){return this.onPreSolve();}},{key:"solveAsync",value:function solveAsync(fCallback){this.onPreSolve();return fCallback();}/**
|
|
3442
3442
|
* @param {(pError?: Error) => void} fCallback - The callback to call after the data pre-load.
|
|
3443
3443
|
*/},{key:"onBeforeLoadDataAsync",value:function onBeforeLoadDataAsync(fCallback){return fCallback();}/**
|
|
@@ -3454,16 +3454,16 @@ return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize
|
|
|
3454
3454
|
* @param {(pError?: Error) => void} fCallback - The callback to call after the data load.
|
|
3455
3455
|
*/},{key:"onSaveDataAsync",value:function onSaveDataAsync(fCallback){if(this.pict.LogNoisiness>3){this.log.trace("PictProvider [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ProviderIdentifier," onSaveDataAsync:"));}return fCallback();}/**
|
|
3456
3456
|
* @param {(pError?: Error) => void} fCallback - The callback to call after the data post-load.
|
|
3457
|
-
*/},{key:"onAfterSaveDataAsync",value:function onAfterSaveDataAsync(fCallback){return fCallback();}}]);}(libFableServiceBase);module.exports=PictProvider;},{"../package.json":140,"fable-serviceproviderbase":59}],142:[function(require,module,exports){module.exports={"name":"pict-template","version":"1.0.
|
|
3457
|
+
*/},{key:"onAfterSaveDataAsync",value:function onAfterSaveDataAsync(fCallback){return fCallback();}}]);}(libFableServiceBase);module.exports=PictProvider;},{"../package.json":140,"fable-serviceproviderbase":59}],142:[function(require,module,exports){module.exports={"name":"pict-template","version":"1.0.11","description":"Pict Template Base Class","main":"source/Pict-Template.js","scripts":{"start":"node source/Pict-Template.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 ."},"types":"types/source/Pict-Template.d.ts","repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-view.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-view/issues"},"homepage":"https://github.com/stevenvelozo/pict-view#readme","devDependencies":{"pict":"^1.0.272","quackage":"^1.0.41","typescript":"^5.8.3"},"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"]},"dependencies":{"fable-serviceproviderbase":"^3.0.15"}};},{}],143:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libPackage=require('../package.json');/** @typedef {import('pict') & {
|
|
3458
3458
|
* [key: string]: any, // represent services for now as a workaround
|
|
3459
3459
|
* }} Pict *//**
|
|
3460
3460
|
* @class PictTemplateExpression
|
|
3461
3461
|
* @classdesc The PictTemplateExpression class is a service provider for the pict anti-framework that provides template rendering services.
|
|
3462
3462
|
*/var PictTemplateExpression=/*#__PURE__*/function(_libFableServiceBase17){/**
|
|
3463
3463
|
* @param {Pict} pFable - The Fable Framework instance
|
|
3464
|
-
* @param {any} [pOptions] - The options for the service
|
|
3465
|
-
* @param {
|
|
3466
|
-
*/function PictTemplateExpression(pFable,pOptions,pServiceHash){var _this65;_classCallCheck2(this,PictTemplateExpression);_this65=_callSuper(this,PictTemplateExpression,[pFable,pOptions,pServiceHash]);/** @type {Pict} */_this65.fable;/** @type {Pict} */_this65.pict=_this65.fable;_this65.serviceType='PictTemplate';/** @type {
|
|
3464
|
+
* @param {Record<string, any>} [pOptions] - The options for the service
|
|
3465
|
+
* @param {string} [pServiceHash] - The hash of the service
|
|
3466
|
+
*/function PictTemplateExpression(pFable,pOptions,pServiceHash){var _this65;_classCallCheck2(this,PictTemplateExpression);_this65=_callSuper(this,PictTemplateExpression,[pFable,pOptions,pServiceHash]);/** @type {Pict} */_this65.fable;/** @type {Pict} */_this65.pict=_this65.fable;_this65.serviceType='PictTemplate';/** @type {Record<string, any>} */_this65._Package=libPackage;return _this65;}/**
|
|
3467
3467
|
* Render a template expression, returning a string with the resulting content.
|
|
3468
3468
|
*
|
|
3469
3469
|
* @param {string} pTemplateHash - The hash contents of the template (what's between the template start and stop tags)
|
|
@@ -3491,12 +3491,12 @@ return fCallback();}}},{key:"onAfterInitialize",value:function onAfterInitialize
|
|
|
3491
3491
|
* Read a value from a nested object using a dot notation string.
|
|
3492
3492
|
*
|
|
3493
3493
|
* @param {string} pAddress - The address to resolve
|
|
3494
|
-
* @param {any} pRecord - The record to resolve
|
|
3495
|
-
* @param {Array<any>} pContextArray - The context array to resolve (optional)
|
|
3496
|
-
* @param {any} pRootDataObject - The root data object to resolve (optional)
|
|
3494
|
+
* @param {Record<string, any>} pRecord - The record to resolve
|
|
3495
|
+
* @param {Array<any>} [pContextArray] - The context array to resolve (optional)
|
|
3496
|
+
* @param {Record<string, any>} [pRootDataObject] - The root data object to resolve (optional)
|
|
3497
3497
|
*
|
|
3498
3498
|
* @return {any} The value at the given address, or undefined
|
|
3499
|
-
*/},{key:"resolveStateFromAddress",value:function resolveStateFromAddress(pAddress,pRecord,pContextArray,pRootDataObject){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this.pict];var tmpRootDataObject=_typeof(pRootDataObject)==='object'?pRootDataObject:{};tmpRootDataObject.Pict=this.pict;tmpRootDataObject.AppData=this.pict.AppData;tmpRootDataObject.Bundle=this.pict.Bundle;tmpRootDataObject.Context=tmpContextArray;tmpRootDataObject.Record=pRecord;return this.pict.manifest.getValueByHash(tmpRootDataObject,pAddress);}}]);}(libFableServiceBase);module.exports=PictTemplateExpression;module.exports.template_hash='Default';},{"../package.json":142,"fable-serviceproviderbase":59}],144:[function(require,module,exports){module.exports={"name":"pict-view","version":"1.0.
|
|
3499
|
+
*/},{key:"resolveStateFromAddress",value:function resolveStateFromAddress(pAddress,pRecord,pContextArray,pRootDataObject){var tmpContextArray=Array.isArray(pContextArray)?pContextArray:[this.pict];var tmpRootDataObject=_typeof(pRootDataObject)==='object'?pRootDataObject:{};tmpRootDataObject.Fable=this.pict;tmpRootDataObject.Pict=this.pict;tmpRootDataObject.AppData=this.pict.AppData;tmpRootDataObject.Bundle=this.pict.Bundle;tmpRootDataObject.Context=tmpContextArray;tmpRootDataObject.Record=pRecord;return this.pict.manifest.getValueByHash(tmpRootDataObject,pAddress);}}]);}(libFableServiceBase);module.exports=PictTemplateExpression;module.exports.template_hash='Default';},{"../package.json":142,"fable-serviceproviderbase":59}],144:[function(require,module,exports){module.exports={"name":"pict-view","version":"1.0.61","description":"Pict View Base Class","main":"source/Pict-View.js","scripts":{"test":"./node_modules/.bin/mocha -u tdd -R spec","start":"node source/Pict-View.js","coverage":"./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec","build":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-view-image:local","docker-dev-run":"docker run -it -d --name pict-view-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict-view\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-view-image:local","docker-dev-shell":"docker exec -it pict-view-dev /bin/bash","types":"tsc -p .","lint":"eslint source/**"},"types":"types/source/Pict-View.d.ts","repository":{"type":"git","url":"git+https://github.com/stevenvelozo/pict-view.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict-view/issues"},"homepage":"https://github.com/stevenvelozo/pict-view#readme","devDependencies":{"@eslint/js":"^9.28.0","browser-env":"^3.3.0","eslint":"^9.28.0","pict":"^1.0.272","quackage":"^1.0.41","typescript":"^5.8.3"},"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"]},"dependencies":{"fable":"^3.1.11","fable-serviceproviderbase":"^3.0.15"}};},{}],145:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var libPackage=require('../package.json');var defaultPictViewSettings={DefaultRenderable:false,DefaultDestinationAddress:false,DefaultTemplateRecordAddress:false,ViewIdentifier:false,// If this is set to true, when the App initializes this will.
|
|
3500
3500
|
// After the App initializes, initialize will be called as soon as it's added.
|
|
3501
3501
|
AutoInitialize:true,AutoInitializeOrdinal:0,// If this is set to true, when the App autorenders (on load) this will.
|
|
3502
3502
|
// After the App initializes, render will be called as soon as it's added.
|
|
@@ -3519,9 +3519,9 @@ AutoRender:true,AutoRenderOrdinal:0,AutoSolveWithApp:true,AutoSolveOrdinal:0,CSS
|
|
|
3519
3519
|
* @param {string} [pServiceHash] - (optional) The hash of the service.
|
|
3520
3520
|
*/function PictView(pFable,pOptions,pServiceHash){var _this66;_classCallCheck2(this,PictView);// Intersect default options, parent constructor, service information
|
|
3521
3521
|
var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this66=_callSuper(this,PictView,[pFable,tmpOptions,pServiceHash]);//FIXME: add types to fable and ancillaries
|
|
3522
|
-
/** @type {any} */_this66.fable;/** @type {any} */_this66.options;/** @type {String} */_this66.UUID;/** @type {String} */_this66.Hash;/** @type {any} */_this66.log;if(!_this66.options.ViewIdentifier){_this66.options.ViewIdentifier="AutoViewID-".concat(_this66.fable.getUUID());}_this66.serviceType='PictView';/** @type {
|
|
3522
|
+
/** @type {any} */_this66.fable;/** @type {any} */_this66.options;/** @type {String} */_this66.UUID;/** @type {String} */_this66.Hash;/** @type {any} */_this66.log;if(!_this66.options.ViewIdentifier){_this66.options.ViewIdentifier="AutoViewID-".concat(_this66.fable.getUUID());}_this66.serviceType='PictView';/** @type {Record<string, any>} */_this66._Package=libPackage;// Convenience and consistency naming
|
|
3523
3523
|
/** @type {import('pict') & { log: any, instantiateServiceProviderWithoutRegistration: (hash: String) => any }} */_this66.pict=_this66.fable;// Wire in the essential Pict application state
|
|
3524
|
-
_this66.AppData=_this66.pict.AppData;/** @type {PictTimestamp} */_this66.initializeTimestamp=false;/** @type {PictTimestamp} */_this66.lastSolvedTimestamp=false;/** @type {PictTimestamp} */_this66.lastRenderedTimestamp=false;/** @type {PictTimestamp} */_this66.lastMarshalFromViewTimestamp=false;/** @type {PictTimestamp} */_this66.lastMarshalToViewTimestamp=false;// Load all templates from the array in the options
|
|
3524
|
+
_this66.AppData=_this66.pict.AppData;_this66.Bundle=_this66.pict.Bundle;/** @type {PictTimestamp} */_this66.initializeTimestamp=false;/** @type {PictTimestamp} */_this66.lastSolvedTimestamp=false;/** @type {PictTimestamp} */_this66.lastRenderedTimestamp=false;/** @type {PictTimestamp} */_this66.lastMarshalFromViewTimestamp=false;/** @type {PictTimestamp} */_this66.lastMarshalToViewTimestamp=false;// Load all templates from the array in the options
|
|
3525
3525
|
// Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
|
|
3526
3526
|
for(var i=0;i<_this66.options.Templates.length;i++){var tmpTemplate=_this66.options.Templates[i];if(!('Hash'in tmpTemplate)||!('Template'in tmpTemplate)){_this66.log.error("PictView [".concat(_this66.UUID,"]::[").concat(_this66.Hash,"] ").concat(_this66.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this66.UUID,"]::[").concat(_this66.Hash,"] ").concat(_this66.options.ViewIdentifier," options object.");}_this66.pict.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
|
|
3527
3527
|
// Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
|
|
@@ -3614,7 +3614,7 @@ this.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpRecord,tmpConten
|
|
|
3614
3614
|
*
|
|
3615
3615
|
* @return {void}
|
|
3616
3616
|
*/},{key:"renderAsync",value:function renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var _this68=this;var tmpRenderableHash=typeof pRenderableHash==='string'?pRenderableHash:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;// Allow the callback to be passed in as the last parameter no matter what
|
|
3617
|
-
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:
|
|
3617
|
+
/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:null;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," renderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this68.log.error("PictView [".concat(_this68.UUID,"]::[").concat(_this68.Hash,"] ").concat(_this68.options.Name," renderAsync Auto Callback Error: ").concat(pError),pError);}};}if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,"because it is not a valid renderable."));return tmpCallback(new Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,"because it is not a valid renderable.")));}var tmpRenderable;if(tmpRenderableHash=='__Virtual'){tmpRenderable={RenderableHash:'__Virtual',TemplateHash:this.renderables[this.options.DefaultRenderable].TemplateHash,DestinationAddress:pRenderDestinationAddress,RenderMethod:'virtual-assignment'};}else{tmpRenderable=this.renderables[tmpRenderableHash];}if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,") because it does not exist."));return tmpCallback(new Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,") because it does not exist.")));}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,") because it does not have a valid destination address."));return tmpCallback(new Error("Could not render ".concat(tmpRenderableHash)));}var tmpRecordAddress;var tmpRecord;if(_typeof(pTemplateRecordAddress)==='object'){tmpRecord=pTemplateRecordAddress;tmpRecordAddress='Passed in as object';}else{tmpRecordAddress=typeof pTemplateRecordAddress==='string'?pTemplateRecordAddress:typeof tmpRenderable.DefaultTemplateRecordAddress==='string'?tmpRenderable.DefaultTemplateRecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;tmpRecord=typeof tmpRecordAddress==='string'?this.pict.DataProvider.getDataByAddress(tmpRecordAddress):undefined;}if(this.pict.LogControlFlow){this.log.trace("PICT-ControlFlow VIEW [".concat(this.UUID,"]::[").concat(this.Hash,"] Renderable[").concat(tmpRenderableHash,"] Destination[").concat(tmpRenderDestinationAddress,"] TemplateRecordAddress[").concat(tmpRecordAddress,"] renderAsync:"));}if(this.pict.LogNoisiness>2){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," Beginning Asynchronous Render (callback-style)..."));}var tmpAnticipate=this.fable.newAnticipate();tmpAnticipate.anticipate(function(fOnBeforeRenderCallback){_this68.onBeforeRender(tmpRenderable,tmpRenderDestinationAddress,tmpRecord);_this68.onBeforeRenderAsync(fOnBeforeRenderCallback);});var tmpContent;tmpAnticipate.anticipate(function(fAsyncTemplateCallback){// Render the template (asynchronously)
|
|
3618
3618
|
_this68.pict.parseTemplateByHash(tmpRenderable.TemplateHash,tmpRecord,function(pError,pContent){if(pError){_this68.log.error("PictView [".concat(_this68.UUID,"]::[").concat(_this68.Hash,"] ").concat(_this68.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderableHash,") because it did not parse the template."),pError);return fAsyncTemplateCallback(pError);}tmpContent=pContent;if(_this68.pict.LogNoisiness>0){_this68.log.trace("PictView [".concat(_this68.UUID,"]::[").concat(_this68.Hash,"] ").concat(_this68.options.ViewIdentifier," Assigning Renderable[").concat(tmpRenderableHash,"] content length ").concat(pContent.length," to Destination [").concat(tmpRenderDestinationAddress,"] using Async render method ").concat(tmpRenderable.RenderMethod,"."));}_this68.pict.ContentAssignment.projectContent(tmpRenderable.RenderMethod,tmpRenderDestinationAddress,pContent,tmpRenderable.TestAddress);// Execute the developer-overridable asynchronous post-render behavior
|
|
3619
3619
|
_this68.lastRenderedTimestamp=_this68.pict.log.getTimeStamp();return fAsyncTemplateCallback();},[_this68]);});tmpAnticipate.anticipate(function(fOnAfterRenderCallback){_this68.onAfterRender(tmpRenderable,tmpRenderDestinationAddress,tmpRecord,tmpContent);_this68.onAfterRenderAsync(fOnAfterRenderCallback);});tmpAnticipate.wait(tmpCallback);}/**
|
|
3620
3620
|
* Renders the default renderable.
|
|
@@ -3628,10 +3628,13 @@ this.renderAsync(fCallback);}/**
|
|
|
3628
3628
|
*/},{key:"basicRender",value:function basicRender(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress){var tmpRenderOptions=this.buildRenderOptions(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress);if(tmpRenderOptions.Valid){this.assignRenderContent(tmpRenderOptions.Renderable,tmpRenderOptions.DestinationAddress,this.pict.parseTemplateByHash(tmpRenderOptions.Renderable.TemplateHash,tmpRenderOptions.Record,null,[this]));return true;}else{this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not perform a basic render of ").concat(tmpRenderOptions.RenderableHash," because it is not valid."));return false;}}/**
|
|
3629
3629
|
* @param {string|ErrorCallback} [pRenderableHash] - The hash of the renderable to render.
|
|
3630
3630
|
* @param {string|ErrorCallback} [pRenderDestinationAddress] - The address where the renderable will be rendered.
|
|
3631
|
-
* @param {string|
|
|
3631
|
+
* @param {string|Object|ErrorCallback} [pTemplateRecordAddress] - The address of (or actual obejct) where the data for the template is stored.
|
|
3632
3632
|
* @param {ErrorCallback} [fCallback] - The callback to call when the async operation is complete.
|
|
3633
3633
|
*/},{key:"basicRenderAsync",value:function basicRenderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress,fCallback){var _this69=this;// Allow the callback to be passed in as the last parameter no matter what
|
|
3634
|
-
var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:
|
|
3634
|
+
/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAddress==='function'?pTemplateRecordAddress:typeof pRenderDestinationAddress==='function'?pRenderDestinationAddress:typeof pRenderableHash==='function'?pRenderableHash:null;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," basicRenderAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this69.log.error("PictView [".concat(_this69.UUID,"]::[").concat(_this69.Hash,"] ").concat(_this69.options.Name," basicRenderAsync Auto Callback Error: ").concat(pError),pError);}};}var tmpRenderOptions=this.buildRenderOptions(pRenderableHash,pRenderDestinationAddress,pTemplateRecordAddress);if(tmpRenderOptions.Valid){this.pict.parseTemplateByHash(tmpRenderOptions.Renderable.TemplateHash,tmpRenderOptions.Record,/**
|
|
3635
|
+
* @param {Error} [pError] - The error that occurred during template parsing.
|
|
3636
|
+
* @param {string} [pContent] - The content that was rendered from the template.
|
|
3637
|
+
*/function(pError,pContent){if(pError){_this69.log.error("PictView [".concat(_this69.UUID,"]::[").concat(_this69.Hash,"] ").concat(_this69.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderOptions.RenderableHash," because it did not parse the template."),pError);return tmpCallback(pError);}_this69.assignRenderContent(tmpRenderOptions.Renderable,tmpRenderOptions.DestinationAddress,pContent);return tmpCallback();},[this]);}else{var tmpErrorMessage="PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not perform a basic render of ").concat(tmpRenderOptions.RenderableHash," because it is not valid.");this.log.error(tmpErrorMessage);return tmpCallback(new Error(tmpErrorMessage));}}/**
|
|
3635
3638
|
* Lifecycle hook that triggers after the view is rendered.
|
|
3636
3639
|
*
|
|
3637
3640
|
* @param {Renderable} pRenderable - The renderable that was rendered.
|
|
@@ -3662,7 +3665,7 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAd
|
|
|
3662
3665
|
* Performs view solving and triggers lifecycle hooks (async flow).
|
|
3663
3666
|
*
|
|
3664
3667
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3665
|
-
*/},{key:"solveAsync",value:function solveAsync(fCallback){var _this70=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate')
|
|
3668
|
+
*/},{key:"solveAsync",value:function solveAsync(fCallback){var _this70=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:null;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," solveAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this70.log.error("PictView [".concat(_this70.UUID,"]::[").concat(_this70.Hash,"] ").concat(_this70.options.Name," solveAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeSolveAsync.bind(this));tmpAnticipate.anticipate(this.onSolveAsync.bind(this));tmpAnticipate.anticipate(this.onAfterSolveAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this70.pict.LogNoisiness>2){_this70.log.trace("PictView [".concat(_this70.UUID,"]::[").concat(_this70.Hash,"] ").concat(_this70.options.ViewIdentifier," solveAsync() complete."));}_this70.lastSolvedTimestamp=_this70.pict.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3666
3669
|
* Lifecycle hook that triggers after the view is solved.
|
|
3667
3670
|
*/},{key:"onAfterSolve",value:function onAfterSolve(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterSolve:"));}return true;}/**
|
|
3668
3671
|
* Lifecycle hook that triggers after the view is solved (async flow).
|
|
@@ -3690,7 +3693,7 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAd
|
|
|
3690
3693
|
* Marshals data from the view (async flow).
|
|
3691
3694
|
*
|
|
3692
3695
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3693
|
-
*/},{key:"marshalFromViewAsync",value:function marshalFromViewAsync(fCallback){var _this71=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate')
|
|
3696
|
+
*/},{key:"marshalFromViewAsync",value:function marshalFromViewAsync(fCallback){var _this71=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:null;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalFromViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this71.log.error("PictView [".concat(_this71.UUID,"]::[").concat(_this71.Hash,"] ").concat(_this71.options.Name," marshalFromViewAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeMarshalFromViewAsync.bind(this));tmpAnticipate.anticipate(this.onMarshalFromViewAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalFromViewAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this71.pict.LogNoisiness>2){_this71.log.trace("PictView [".concat(_this71.UUID,"]::[").concat(_this71.Hash,"] ").concat(_this71.options.ViewIdentifier," marshalFromViewAsync() complete."));}_this71.lastMarshalFromViewTimestamp=_this71.pict.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3694
3697
|
* Lifecycle hook that triggers after data is marshaled from the view.
|
|
3695
3698
|
*/},{key:"onAfterMarshalFromView",value:function onAfterMarshalFromView(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterMarshalFromView:"));}return true;}/**
|
|
3696
3699
|
* Lifecycle hook that triggers after data is marshaled from the view (async flow).
|
|
@@ -3716,7 +3719,7 @@ var tmpCallback=typeof fCallback==='function'?fCallback:typeof pTemplateRecordAd
|
|
|
3716
3719
|
* Marshals data into the view (async flow).
|
|
3717
3720
|
*
|
|
3718
3721
|
* @param {ErrorCallback} fCallback - The callback to call when the async operation is complete.
|
|
3719
|
-
*/},{key:"marshalToViewAsync",value:function marshalToViewAsync(fCallback){var _this72=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate')
|
|
3722
|
+
*/},{key:"marshalToViewAsync",value:function marshalToViewAsync(fCallback){var _this72=this;var tmpAnticipate=this.pict.instantiateServiceProviderWithoutRegistration('Anticipate');/** @type {ErrorCallback} */var tmpCallback=typeof fCallback==='function'?fCallback:null;if(!tmpCallback){this.log.warn("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," marshalToViewAsync was called without a valid callback. A callback will be generated but this could lead to race conditions."));tmpCallback=function tmpCallback(pError){if(pError){_this72.log.error("PictView [".concat(_this72.UUID,"]::[").concat(_this72.Hash,"] ").concat(_this72.options.Name," marshalToViewAsync Auto Callback Error: ").concat(pError),pError);}};}tmpAnticipate.anticipate(this.onBeforeMarshalToViewAsync.bind(this));tmpAnticipate.anticipate(this.onMarshalToViewAsync.bind(this));tmpAnticipate.anticipate(this.onAfterMarshalToViewAsync.bind(this));tmpAnticipate.wait(function(pError){if(_this72.pict.LogNoisiness>2){_this72.log.trace("PictView [".concat(_this72.UUID,"]::[").concat(_this72.Hash,"] ").concat(_this72.options.ViewIdentifier," marshalToViewAsync() complete."));}_this72.lastMarshalToViewTimestamp=_this72.pict.log.getTimeStamp();return tmpCallback(pError);});}/**
|
|
3720
3723
|
* Lifecycle hook that triggers after data is marshaled into the view.
|
|
3721
3724
|
*/},{key:"onAfterMarshalToView",value:function onAfterMarshalToView(){if(this.pict.LogNoisiness>3){this.log.trace("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," onAfterMarshalToView:"));}return true;}/**
|
|
3722
3725
|
* Lifecycle hook that triggers after data is marshaled into the view (async flow).
|
|
@@ -5024,7 +5027,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
5024
5027
|
// presumably different callback function.
|
|
5025
5028
|
// This makes sure that own properties are retained, so that
|
|
5026
5029
|
// decorations and such are not lost along the way.
|
|
5027
|
-
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;}}},{}],190:[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;}},{}],191:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.
|
|
5030
|
+
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;}}},{}],190:[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;}},{}],191:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.273","description":"Pict browser library.","main":"source/Pict.js","scripts":{"start":"node source/Pict.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","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-image:local","docker-dev-run":"docker run -it -d --name pict-dev -p 37447:8080 -p 19506:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-image:local","docker-dev-shell":"docker exec -it pict-dev /bin/bash","lint":"eslint source/**/*.js test/**/*.js","types":"tsc -p ."},"types":"types/source/Pict.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":"git+https://stevenvelozo@github.com/stevenvelozo/pict.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/stevenvelozo/pict/issues"},"homepage":"https://github.com/stevenvelozo/pict#readme","devDependencies":{"@eslint/js":"^9.27.0","@types/jquery":"^3.5.32","@types/sinon":"^17.0.4","eslint":"^9.27.0","globals":"^16.2.0","quackage":"^1.0.41","sinon":"^20.0.0"},"dependencies":{"cachetrax":"^1.0.4","fable":"^3.1.11","pict-application":"^1.0.27","pict-provider":"^1.0.6","pict-template":"^1.0.11","pict-view":"^1.0.61","typescript":"^5.8.3"}};},{}],192:[function(require,module,exports){// This assumes Pict has been required in the browser. Delcare these as globals so linter can do its job.
|
|
5028
5031
|
/* global Pict, _Pict: writeable *//**
|
|
5029
5032
|
* Simple function to load a pict Application
|
|
5030
5033
|
*
|
|
@@ -5201,9 +5204,54 @@ this.recordSetCache[pEntity].maxAge=10000;this.recordSetCache[pEntity].maxLength
|
|
|
5201
5204
|
if(!('Entity'in pEntityInformation)||typeof pEntityInformation.Entity!='string'){this.log.warn("EntityBundleRequest failed to parse entity request because the entity stanza did not contain an Entity string.");return fCallback();}if(!('Destination'in pEntityInformation)||typeof pEntityInformation.Destination!='string'){this.log.warn("EntityBundleRequest failed to parse entity request because the entity stanza did not contain a Destination string.");return fCallback();}if(!('Filter'in pEntityInformation)||typeof pEntityInformation.Filter!='string'){pEntityInformation.Filter='';}if(!('FilterData'in pEntityInformation)||_typeof(pEntityInformation.FilterData)!='object'){pEntityInformation.FilterData={};}pContext.StepData=pEntityInformation.FilterData;if(!('RecordStartCursor'in pEntityInformation)||typeof pEntityInformation.RecordStartCursor!='number'){pEntityInformation.RecordStartCursor=0;}if(!('PageSize'in pEntityInformation)||typeof pEntityInformation.PageSize!='number'){pEntityInformation.PageSize=100;}var tmpRecordStartCursor=null;var tmpRecordCount=null;if(pEntityInformation.RecordCount){tmpRecordStartCursor=pEntityInformation.RecordStartCursor;tmpRecordCount=pEntityInformation.RecordCount;}// Parse the filter template
|
|
5202
5205
|
var tmpFilterString=this.fable.parseTemplate(pEntityInformation.Filter,pContext);// Create a callback function to handle receiving the record set
|
|
5203
5206
|
var fRecordFetchComplete=function fRecordFetchComplete(pError,pRecordSet){if(pError){_this78.log.error("EntityBundleRequest request Error getting entity set for [".concat(pEntityInformation.Entity,"] with filter [").concat(tmpFilterString,"]: ").concat(pError),pError);return fCallback(pError,'');}_this78.log.trace("EntityBundleRequest found ".concat(pRecordSet.length," records for ").concat(pEntityInformation.Entity," filtered to [").concat(tmpFilterString,"]"));// Now assign it back to the destination; because this is not view specific it doesn't use the manifests from them (to deal with scope overlap with subgrids).
|
|
5204
|
-
if(pEntityInformation.SingleRecord){if(pRecordSet.length>1){_this78.log.warn("EntityBundleRequest found more than one record for ".concat(pEntityInformation.Entity," filtered to [").concat(tmpFilterString,"] but SingleRecord is true; setting the first record."));}if(pRecordSet.length<1){_this78.fable.manifest.setValueByHash(pContext,pEntityInformation.Destination,false);}_this78.fable.manifest.setValueByHash(pContext,pEntityInformation.Destination,pRecordSet[0]);}else{_this78.fable.manifest.setValueByHash(pContext,pEntityInformation.Destination,pRecordSet);}return fCallback();};if(tmpRecordCount){this.getEntitySetPage(pEntityInformation.Entity,tmpFilterString,tmpRecordStartCursor,tmpRecordCount,fRecordFetchComplete);}else{this.getEntitySet(pEntityInformation.Entity,tmpFilterString,fRecordFetchComplete);}}},{key:"mapJoinSingleDestination",value:function mapJoinSingleDestination(pDestinationEntity,pCustomRequestInformation,pContext
|
|
5205
|
-
this.fable.manifest.setValueByHash(pDestinationEntity,tmpBucketAddress,_tmpSourceEntity);}else{var tmpBucketArray=this.fable.manifest.getValueByHash(pDestinationEntity,tmpBucketAddress,_tmpSourceEntity);if(!tmpBucketArray){tmpBucketArray=[];this.fable.manifest.setValueByHash(pDestinationEntity,tmpBucketAddress,tmpBucketArray);}tmpBucketArray.push(_tmpSourceEntity);}}else if(pCustomRequestInformation.SingleRecord){if(pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]&&this.fable.LogNoisiness>1){this.fable.log.warn("EntityBundleRequest found more than one record for [".concat(pCustomRequestInformation.RecordDestinationAddress,"] in mapJoin mapped as SingleRecord."));}pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=_tmpSourceEntity;}else{pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]||[];pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress].push(_tmpSourceEntity);}}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}
|
|
5206
|
-
this.fable.manifest.setValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpSourceEntity);}else{var tmpBucketArray=this.fable.manifest.getValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpSourceEntity);if(!tmpBucketArray){tmpBucketArray=[];this.fable.manifest.setValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpBucketArray);}tmpBucketArray.push(tmpSourceEntity);}}else if(pCustomRequestInformation.SingleRecord){if(tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]&&this.fable.LogNoisiness>1){this.fable.log.warn("EntityBundleRequest found more than one record for [".concat(pCustomRequestInformation.RecordDestinationAddress,"] in mapJoin mapped as SingleRecord."));}tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=tmpSourceEntity;}else{tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]||[];tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress].push(tmpSourceEntity);}}}
|
|
5207
|
+
if(pEntityInformation.SingleRecord){if(pRecordSet.length>1){_this78.log.warn("EntityBundleRequest found more than one record for ".concat(pEntityInformation.Entity," filtered to [").concat(tmpFilterString,"] but SingleRecord is true; setting the first record."));}if(pRecordSet.length<1){_this78.fable.manifest.setValueByHash(pContext,pEntityInformation.Destination,false);}_this78.fable.manifest.setValueByHash(pContext,pEntityInformation.Destination,pRecordSet[0]);}else{_this78.fable.manifest.setValueByHash(pContext,pEntityInformation.Destination,pRecordSet);}return fCallback();};if(tmpRecordCount){this.getEntitySetPage(pEntityInformation.Entity,tmpFilterString,tmpRecordStartCursor,tmpRecordCount,fRecordFetchComplete);}else{this.getEntitySet(pEntityInformation.Entity,tmpFilterString,fRecordFetchComplete);}}},{key:"mapJoinSingleDestination",value:function mapJoinSingleDestination(pDestinationEntity,pCustomRequestInformation,pContext){var tmpSourceEntities=this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.JoinRecordSetAddress);if(!Array.isArray(tmpSourceEntities)){throw new Error("EntityBundleRequest failed to map join because the source [".concat(pCustomRequestInformation.JoinRecordSetAddress,"] did not return an array."));}var tmpSourceLookup={};var _iterator3=_createForOfIteratorHelper(tmpSourceEntities),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var tmpSourceEntity=_step3.value;var tmpSourceJoinValue=tmpSourceEntity[pCustomRequestInformation.JoinValue];tmpSourceLookup[tmpSourceJoinValue]=tmpSourceEntity;}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}var _iterator4=_createForOfIteratorHelper(tmpSourceEntities),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _tmpSourceEntity=_step4.value;if(!_tmpSourceEntity){this.log.error("EntityBundleRequest failed to map join because the source entity was not found in the source lookup.");continue;}if(pCustomRequestInformation.BucketBy||pCustomRequestInformation.BucketByTemplate){var tmpBucketValues=[];if(pCustomRequestInformation.BucketBy){var tmpBucketByKeys=Array.isArray(pCustomRequestInformation.BucketBy)?pCustomRequestInformation.BucketBy:[pCustomRequestInformation.BucketBy];var _iterator5=_createForOfIteratorHelper(tmpBucketByKeys),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var tmpBucketByKey=_step5.value;var tmpBucketValue=this.fable.manifest.getValueByHash(_tmpSourceEntity,tmpBucketByKey);tmpBucketValues.push(tmpBucketValue);}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}else{var tmpBucketByTemplates=Array.isArray(pCustomRequestInformation.BucketByTemplate)?pCustomRequestInformation.BucketByTemplate:[pCustomRequestInformation.BucketByTemplate];var _iterator6=_createForOfIteratorHelper(tmpBucketByTemplates),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var tmpBucketByTemplate=_step6.value;var _tmpBucketValue=this.fable.parseTemplate(tmpBucketByTemplate,_tmpSourceEntity);tmpBucketValues.push(_tmpBucketValue);}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}}var tmpBucketAddress="".concat(pCustomRequestInformation.RecordDestinationAddress,".").concat(tmpBucketValues.join('.'));if(pCustomRequestInformation.SingleRecord){//TODO: warn if there is a collision?
|
|
5208
|
+
this.fable.manifest.setValueByHash(pDestinationEntity,tmpBucketAddress,_tmpSourceEntity);}else{var tmpBucketArray=this.fable.manifest.getValueByHash(pDestinationEntity,tmpBucketAddress,_tmpSourceEntity);if(!tmpBucketArray){tmpBucketArray=[];this.fable.manifest.setValueByHash(pDestinationEntity,tmpBucketAddress,tmpBucketArray);}tmpBucketArray.push(_tmpSourceEntity);}}else if(pCustomRequestInformation.SingleRecord){if(pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]&&this.fable.LogNoisiness>1){this.fable.log.warn("EntityBundleRequest found more than one record for [".concat(pCustomRequestInformation.RecordDestinationAddress,"] in mapJoin mapped as SingleRecord."));}pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=_tmpSourceEntity;}else{pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]||[];pDestinationEntity[pCustomRequestInformation.RecordDestinationAddress].push(_tmpSourceEntity);}}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}return[pDestinationEntity];}},{key:"mapJoin",value:function mapJoin(pCustomRequestInformation,pContext){var tmpSingleDestinationEntity=pCustomRequestInformation.DestinationRecordAddress?this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.DestinationRecordAddress):null;var tmpDestinationEntities=pCustomRequestInformation.DestinationRecordSetAddress?this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.DestinationRecordSetAddress):null;if(!Array.isArray(tmpDestinationEntities)&&!tmpSingleDestinationEntity){throw new Error("EntityBundleRequest failed to map join because the destination [".concat(pCustomRequestInformation.DestinationRecordSetAddress,"] did not return an array."));}if(tmpSingleDestinationEntity){return this.mapJoinSingleDestination(tmpSingleDestinationEntity,pCustomRequestInformation,pContext);}var tmpJoinEntities=this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.Joins);if(!Array.isArray(tmpJoinEntities)){throw new Error("EntityBundleRequest failed to map join because the join [".concat(pCustomRequestInformation.Joins,"] did not return an array."));}var tmpSourceEntities=this.fable.manifest.getValueByHash(pContext,pCustomRequestInformation.JoinRecordSetAddress);if(!Array.isArray(tmpSourceEntities)){throw new Error("EntityBundleRequest failed to map join because the source [".concat(pCustomRequestInformation.JoinRecordSetAddress,"] did not return an array."));}var tmpLHSJoinKey=pCustomRequestInformation.JoinJoinValueLHS||pCustomRequestInformation.DestinationJoinValue;var tmpRHSJoinKey=pCustomRequestInformation.JoinJoinValueRHS||pCustomRequestInformation.JoinValue;var tmpDestinationLookup={};var tmpSourceLookup={};var tmpJoinMap={};var _iterator7=_createForOfIteratorHelper(tmpDestinationEntities||[]),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _tmpDestinationEntity=_step7.value;var tmpDestinationJoinValue=_tmpDestinationEntity[pCustomRequestInformation.DestinationJoinValue];tmpDestinationLookup[tmpDestinationJoinValue]=_tmpDestinationEntity;}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}var _iterator8=_createForOfIteratorHelper(tmpSourceEntities),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _tmpSourceEntity2=_step8.value;var tmpSourceJoinValue=_tmpSourceEntity2[pCustomRequestInformation.JoinValue];tmpSourceLookup[tmpSourceJoinValue]=_tmpSourceEntity2;}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}var _iterator9=_createForOfIteratorHelper(tmpJoinEntities),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var tmpJoinEntity=_step9.value;var _tmpLHSJoinValue=tmpJoinEntity[tmpLHSJoinKey];var _tmpRHSJoinValue=tmpJoinEntity[tmpRHSJoinKey];tmpJoinMap[_tmpLHSJoinValue]=tmpJoinMap[_tmpLHSJoinValue]||new Set();tmpJoinMap[_tmpLHSJoinValue].add(_tmpRHSJoinValue);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}for(var _i64=0,_Object$keys=Object.keys(tmpJoinMap);_i64<_Object$keys.length;_i64++){var tmpLHSJoinValue=_Object$keys[_i64];var tmpRHSJoinValues=Array.from(tmpJoinMap[tmpLHSJoinValue]);var tmpDestinationEntity=tmpDestinationLookup[tmpLHSJoinValue];if(!tmpDestinationEntity){this.log.error("EntityBundleRequest failed to map join because the LHS join value [".concat(tmpLHSJoinValue,"] was not found in the destination lookup."));continue;}for(var _i65=0,_tmpRHSJoinValues=tmpRHSJoinValues;_i65<_tmpRHSJoinValues.length;_i65++){var tmpRHSJoinValue=_tmpRHSJoinValues[_i65];var tmpSourceEntity=tmpSourceLookup[tmpRHSJoinValue];if(!tmpSourceEntity){this.log.error("EntityBundleRequest failed to map join because the RHS join value [".concat(tmpRHSJoinValue,"] was not found in the source lookup."));continue;}if(pCustomRequestInformation.BucketBy||pCustomRequestInformation.BucketByTemplate){var tmpBucketValues=[];if(pCustomRequestInformation.BucketBy){var tmpBucketByKeys=Array.isArray(pCustomRequestInformation.BucketBy)?pCustomRequestInformation.BucketBy:[pCustomRequestInformation.BucketBy];var _iterator10=_createForOfIteratorHelper(tmpBucketByKeys),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var tmpBucketByKey=_step10.value;var tmpBucketValue=this.fable.manifest.getValueByHash(tmpSourceEntity,tmpBucketByKey);tmpBucketValues.push(tmpBucketValue);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}else{var tmpBucketByTemplates=Array.isArray(pCustomRequestInformation.BucketByTemplate)?pCustomRequestInformation.BucketByTemplate:[pCustomRequestInformation.BucketByTemplate];var _iterator11=_createForOfIteratorHelper(tmpBucketByTemplates),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var tmpBucketByTemplate=_step11.value;var _tmpBucketValue2=this.fable.parseTemplate(tmpBucketByTemplate,tmpSourceEntity);tmpBucketValues.push(_tmpBucketValue2);}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}}if(!tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]){tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]={};}var tmpBucketAddress="".concat(pCustomRequestInformation.RecordDestinationAddress,".").concat(tmpBucketValues.join('.'));if(pCustomRequestInformation.SingleRecord){//TODO: warn if there is a collision?
|
|
5209
|
+
this.fable.manifest.setValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpSourceEntity);}else{var tmpBucketArray=this.fable.manifest.getValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpSourceEntity);if(!tmpBucketArray){tmpBucketArray=[];this.fable.manifest.setValueByHash(tmpDestinationEntity,tmpBucketAddress,tmpBucketArray);}tmpBucketArray.push(tmpSourceEntity);}}else if(pCustomRequestInformation.SingleRecord){if(tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]&&this.fable.LogNoisiness>1){this.fable.log.warn("EntityBundleRequest found more than one record for [".concat(pCustomRequestInformation.RecordDestinationAddress,"] in mapJoin mapped as SingleRecord."));}tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=tmpSourceEntity;}else{tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]=tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress]||[];tmpDestinationEntity[pCustomRequestInformation.RecordDestinationAddress].push(tmpSourceEntity);}}}return tmpDestinationEntities;}/**
|
|
5210
|
+
* ExampleConfig:
|
|
5211
|
+
* {
|
|
5212
|
+
* "InputRecordsetAddress": "AppData.DocumentData.ReportData.Observations[]<<~?ObservationType,==,WalbecNDTRollerTests?~>>",
|
|
5213
|
+
* "OutputRecordsetAddress": "AppData.DocumentData.ReportData.FormData.ADDTests",
|
|
5214
|
+
* "OutputRecordsetAddressMapping":
|
|
5215
|
+
* {
|
|
5216
|
+
* "InputRecord.Tags[],AnyContains,HR": "AppData.DocumentData.ReportData.FormData.HRTests",
|
|
5217
|
+
* "InputRecord.Tags[],AnyContains,CR": "AppData.DocumentData.ReportData.FormData.CRTests",
|
|
5218
|
+
* "InputRecord.Tags[],AnyContains,IR": "AppData.DocumentData.ReportData.FormData.IRTests"
|
|
5219
|
+
* },
|
|
5220
|
+
* "RecordPrototypeAddress": "OutputRecordSet[]<<~?IDObservation,==,{~D:InputRecord.IDObservation~}?~>>",
|
|
5221
|
+
* "RecordFieldMapping":
|
|
5222
|
+
* {
|
|
5223
|
+
* "AppData.DocumentData.ReportData.FormData.HRTests":
|
|
5224
|
+
* {
|
|
5225
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.MaterialTemperature": "OutputRecord.Temp",
|
|
5226
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.PercentDensity": "OutputRecord.Density",
|
|
5227
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.Offset": "OutputRecord.Offset",
|
|
5228
|
+
* "InputRecord.IDObservation": "OutputRecord.IDObservation"
|
|
5229
|
+
* },
|
|
5230
|
+
* "AppData.DocumentData.ReportData.FormData.CRTests":
|
|
5231
|
+
* {
|
|
5232
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.MaterialTemperature": "OutputRecord.CRTemp",
|
|
5233
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.PercentDensity": "OutputRecord.CRDensity",
|
|
5234
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.Offset": "OutputRecord.CROffset",
|
|
5235
|
+
* "InputRecord.IDObservation": "OutputRecord.IDObservation"
|
|
5236
|
+
* },
|
|
5237
|
+
* "AppData.DocumentData.ReportData.FormData.IRTests":
|
|
5238
|
+
* {
|
|
5239
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.MaterialTemperature": "OutputRecord.IRTemp",
|
|
5240
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.PercentDensity": "OutputRecord.IRDensity",
|
|
5241
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.Offset": "OutputRecord.IROffset",
|
|
5242
|
+
* "InputRecord.IDObservation": "OutputRecord.IDObservation"
|
|
5243
|
+
* },
|
|
5244
|
+
* "Default":
|
|
5245
|
+
* {
|
|
5246
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.MaterialTemperature": "OutputRecord.ADDTemp",
|
|
5247
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.PercentDensity": "OutputRecord.ADDDensity",
|
|
5248
|
+
* "InputRecord.Details.WalbecNDTRollerTests[0].Datum.Offset": "OutputRecord.ADDOffset",
|
|
5249
|
+
* "InputRecord.IDObservation": "OutputRecord.IDObservation"
|
|
5250
|
+
* }
|
|
5251
|
+
* }
|
|
5252
|
+
* }
|
|
5253
|
+
*/},{key:"projectDataset",value:function projectDataset(pConfiguration,pContext){var tmpInputRecordset=this.fable.manifest.getValueByHash(pContext,pConfiguration.InputRecordsetAddress);if(!Array.isArray(tmpInputRecordset)){throw new Error("EntityBundleRequest failed to project dataset because the input recordset [".concat(pConfiguration.InputRecordsetAddress,"] did not return an array."));}var tmpDefaultOutputRecordset=this.fable.manifest.getValueByHash(pContext,pConfiguration.OutputRecordsetAddress);if(!tmpDefaultOutputRecordset){tmpDefaultOutputRecordset=[];this.fable.manifest.setValueByHash(pContext,pConfiguration.OutputRecordsetAddress,tmpDefaultOutputRecordset);}var _iterator12=_createForOfIteratorHelper(tmpInputRecordset),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var tmpInputRecord=_step12.value;var tmpOutputRecordset=tmpDefaultOutputRecordset;var tmpOutputRecordsetAddressOverride=void 0;if(_typeof(pConfiguration.OutputRecordsetAddressMapping)==='object'){tmpOutputRecordsetAddressOverride=this._resolveOutputRecordsetAddressMapping(pConfiguration,pContext,tmpInputRecord);if(tmpOutputRecordsetAddressOverride){tmpOutputRecordset=this.fable.manifest.getValueByHash(pContext,tmpOutputRecordsetAddressOverride);if(!tmpOutputRecordset){tmpOutputRecordset=[];this.fable.manifest.setValueByHash(pContext,tmpOutputRecordsetAddressOverride,tmpOutputRecordset);}}if(!tmpOutputRecordset||!Array.isArray(tmpOutputRecordset)){tmpOutputRecordset=tmpDefaultOutputRecordset;}}var tmpPrototypeAddress=this.fable.parseTemplate(pConfiguration.RecordPrototypeAddress,Object.assign({InputRecord:tmpInputRecord},pContext));var tmpRecordPrototype=this.fable.manifest.getValueByHash(Object.assign({InputRecord:tmpInputRecord,OutputRecordset:tmpOutputRecordset},pContext),tmpPrototypeAddress);var tmpOutputRecord={};if(Array.isArray(tmpRecordPrototype)&&tmpRecordPrototype.length>0){tmpOutputRecord=tmpRecordPrototype[0];}else{tmpOutputRecordset.push(tmpOutputRecord);}var tmpRecordFieldMapping=pConfiguration.RecordFieldMapping[tmpOutputRecordsetAddressOverride]||pConfiguration.RecordFieldMapping.Default;if(!tmpRecordFieldMapping){tmpRecordFieldMapping=pConfiguration.RecordFieldMapping[Object.keys(pConfiguration.RecordFieldMapping)[0]];}if(!tmpRecordFieldMapping){throw new Error("EntityBundleRequest failed to project dataset because the record field mapping for [".concat(tmpOutputRecordsetAddressOverride,"] did not return a mapping."));}for(var _i66=0,_Object$keys2=Object.keys(tmpRecordFieldMapping);_i66<_Object$keys2.length;_i66++){var tmpInputFieldAddress=_Object$keys2[_i66];var tmpOutputFieldAddress=tmpRecordFieldMapping[tmpInputFieldAddress];var tmpInputFieldValue=this.fable.manifest.getValueByHash(Object.assign({InputRecord:tmpInputRecord},pContext),tmpInputFieldAddress);this.fable.manifest.setValueByHash(Object.assign({OutputRecord:tmpOutputRecord},pContext),tmpOutputFieldAddress,tmpInputFieldValue);}}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}}},{key:"_resolveOutputRecordsetAddressMapping",value:function _resolveOutputRecordsetAddressMapping(pConfiguration,pContext,pInputRecord){var tmpAddressSpace=Object.assign({InputRecord:pInputRecord},pContext);for(var _i67=0,_Object$keys3=Object.keys(pConfiguration.OutputRecordsetAddressMapping);_i67<_Object$keys3.length;_i67++){var tmpRule=_Object$keys3[_i67];var _tmpRule$split=tmpRule.split(','),_tmpRule$split2=_slicedToArray(_tmpRule$split,3),tmpLHSAddress=_tmpRule$split2[0],tmpOperator=_tmpRule$split2[1],tmpMatchValue=_tmpRule$split2[2];var tmpLHS=this.fable.manifest.getValueByHash(tmpAddressSpace,tmpLHSAddress);if(!tmpLHS){if(this.fable.LogNoisiness>0){this.log.warn("EntityBundleRequest failed to project dataset because the LHS address [".concat(tmpLHSAddress,"] did not return a value."));}continue;}switch(tmpOperator){case'AnyContains':if(!Array.isArray(tmpLHS)){//TODO: consider making this use objects as well?
|
|
5254
|
+
this.log.error("EntityBundleRequest failed to project dataset because the LHS address [".concat(tmpLHSAddress,"] did not return an array."));continue;}var _iterator13=_createForOfIteratorHelper(tmpLHS),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var tmpLHSValue=_step13.value;if(String(tmpLHSValue).includes(tmpMatchValue)){return pConfiguration.OutputRecordsetAddressMapping[tmpRule];}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return null;}}}},{key:"gatherCustomDataSet",value:function gatherCustomDataSet(pCustomRequestInformation,pContext,fCallback){var _this79=this;// First sanity check the pCustomRequestInformation
|
|
5207
5255
|
if(!('URL'in pCustomRequestInformation)||typeof pCustomRequestInformation.URL!='string'){this.log.warn("EntityBundleRequest failed to parse custom data request because the stanza did not contain a URL string.");return fCallback();}if(!('URLData'in pCustomRequestInformation)||_typeof(pCustomRequestInformation.URLData)!='object'){pCustomRequestInformation.URLData={};}pContext.StepData=pCustomRequestInformation.URLData;// Parse the filter template
|
|
5208
5256
|
var tmpURLTemplateString=this.fable.parseTemplate(pCustomRequestInformation.URL,pContext);if(tmpURLTemplateString==''){// We may want to continue, but for now let's say nah and nope out.
|
|
5209
5257
|
this.log.warn("EntityBundleRequest failed to parse custom data request because the entity Filter did not return a string for FilterBy");}var tmpURLPrefix='';// This will only be true if the "Host" is set.
|
|
@@ -5211,12 +5259,16 @@ var tmpCustomURIHost=pCustomRequestInformation.Host?pCustomRequestInformation.Ho
|
|
|
5211
5259
|
var tmpCustomURIProtocol=pCustomRequestInformation.Protocol?pCustomRequestInformation.Protocol:'https';var tmpCustomURIPort=pCustomRequestInformation.Port?pCustomRequestInformation.Port:false;if(tmpCustomURIHost){tmpURLPrefix="".concat(tmpCustomURIProtocol,"://").concat(tmpCustomURIHost);if(tmpCustomURIPort){tmpURLPrefix+=":".concat(tmpCustomURIPort);}}else{tmpURLPrefix=this.fable.EntityProvider.options.urlPrefix;}// Now get the records
|
|
5212
5260
|
var callback=function callback(pError,pResponse,pData){if(pError){_this79.log.error("EntityBundleRequest request Error getting data set for [".concat(pCustomRequestInformation.Entity,"] with filter [").concat(tmpURLTemplateString,"]: ").concat(pError),pError);return fCallback(pError,'');}_this79.log.trace("EntityBundleRequest completed request for ".concat(pCustomRequestInformation.Entity," filtered to [").concat(tmpURLTemplateString,"]"));// Since this is a templated endpoint it can be used for logging etc.
|
|
5213
5261
|
if(pCustomRequestInformation.Destination){_this79.fable.manifest.setValueByHash(pContext,pCustomRequestInformation.Destination,pData);}return fCallback();};var tmpOptions={url:"".concat(tmpURLPrefix).concat(tmpURLTemplateString)};tmpOptions=this.fable.EntityProvider.prepareRequestOptions(tmpOptions);return this.fable.EntityProvider.restClient.getJSON(tmpOptions,callback);}/**
|
|
5262
|
+
* Local version of gatherDataFromServer that only support synchronous operations.
|
|
5263
|
+
*
|
|
5264
|
+
* @param {Array<Record<string, any>>} pEntitiesBundleDescription - The entity bundle description object.
|
|
5265
|
+
*/},{key:"processBundle",value:function processBundle(pEntitiesBundleDescription){if(!Array.isArray(pEntitiesBundleDescription)){this.log.error("EntityBundleRequest failed to parse entity bundle request because the input was not an array.");throw new Error('EntityBundleRequest failed to parse entity bundle request because the input was not an array.');}var tmpStateStack=[];var tmpState={};var _iterator14=_createForOfIteratorHelper(pEntitiesBundleDescription),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var tmpEntityBundleEntry=_step14.value;try{switch(tmpEntityBundleEntry.Type){case'SetStateAddress':tmpStateStack.push(tmpState);tmpState=this.fable.manifest.getValueByHash(this.fable,tmpEntityBundleEntry.StateAddress);if(typeof tmpState==='undefined'){tmpState={};this.fable.manifest.setValueByHash(this.fable,tmpEntityBundleEntry.StateAddress,tmpState);}break;case'PopState':if(tmpStateStack.length>0){tmpState=tmpStateStack.pop();}else{this.log.warn("EntityBundleRequest encountered a PopState without a matching SetStateAddress.");}break;case'MapJoin':this.mapJoin(tmpEntityBundleEntry,this.prepareState(tmpState,tmpEntityBundleEntry));break;case'ProjectDataset':this.projectDataset(tmpEntityBundleEntry,this.prepareState(tmpState,tmpEntityBundleEntry));break;default:this.log.error("EntityBundleRequest encountered an unsupported type [".concat(tmpEntityBundleEntry.Type,"] in the entity bundle description."));}}catch(pError){this.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),{Stack:pError.stack});}}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}/**
|
|
5214
5266
|
* Gather data from the server returning a promise when it is complete.
|
|
5215
5267
|
*
|
|
5216
5268
|
* @param {Array<Record<string, any>>} pEntitiesBundleDescription - The entity bundle description object.
|
|
5217
5269
|
* @param {(error?: Error) => void} fCallback - The callback function to call when the data gathering is complete.
|
|
5218
|
-
*/},{key:"gatherDataFromServer",value:function gatherDataFromServer(pEntitiesBundleDescription,fCallback){var _this80=this;if(!Array.isArray(pEntitiesBundleDescription)){this.log.error("EntityBundleRequest failed to parse entity bundle request because the input was not an array.");return fCallback(new Error('EntityBundleRequest failed to parse entity bundle request because the input was not an array.'));}var tmpAnticipate=this.fable.newAnticipate();var tmpStateStack=[];var tmpState={};var _loop3=function _loop3(){var tmpEntityBundleEntry=pEntitiesBundleDescription[i];tmpAnticipate.anticipate(function(fNext){try{switch(tmpEntityBundleEntry.Type){case'SetStateAddress':tmpStateStack.push(tmpState);tmpState=_this80.fable.manifest.getValueByHash(_this80.fable,tmpEntityBundleEntry.StateAddress);if(typeof tmpState==='undefined'){tmpState={};_this80.fable.manifest.setValueByHash(_this80.fable,tmpEntityBundleEntry.StateAddress,tmpState);}
|
|
5219
|
-
case'MeadowEntity':default:return _this80.gatherEntitySet(tmpEntityBundleEntry,_this80.prepareState(tmpState,tmpEntityBundleEntry),fNext);}}catch(pError){_this80.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),{Stack:pError.stack});
|
|
5270
|
+
*/},{key:"gatherDataFromServer",value:function gatherDataFromServer(pEntitiesBundleDescription,fCallback){var _this80=this;if(!Array.isArray(pEntitiesBundleDescription)){this.log.error("EntityBundleRequest failed to parse entity bundle request because the input was not an array.");return fCallback(new Error('EntityBundleRequest failed to parse entity bundle request because the input was not an array.'));}var tmpAnticipate=this.fable.newAnticipate();var tmpStateStack=[];var tmpState={};var _loop3=function _loop3(){var tmpEntityBundleEntry=pEntitiesBundleDescription[i];tmpAnticipate.anticipate(function(fNext){try{switch(tmpEntityBundleEntry.Type){case'SetStateAddress':tmpStateStack.push(tmpState);tmpState=_this80.fable.manifest.getValueByHash(_this80.fable,tmpEntityBundleEntry.StateAddress);if(typeof tmpState==='undefined'){tmpState={};_this80.fable.manifest.setValueByHash(_this80.fable,tmpEntityBundleEntry.StateAddress,tmpState);}return fNext();case'PopState':if(tmpStateStack.length>0){tmpState=tmpStateStack.pop();}else{_this80.log.warn("EntityBundleRequest encountered a PopState without a matching SetStateAddress.");}return fNext();case'Custom':return _this80.gatherCustomDataSet(tmpEntityBundleEntry,_this80.prepareState(tmpState,tmpEntityBundleEntry),fNext);case'MapJoin':_this80.mapJoin(tmpEntityBundleEntry,_this80.prepareState(tmpState,tmpEntityBundleEntry));return fNext();case'ProjectDataset':_this80.projectDataset(tmpEntityBundleEntry,_this80.prepareState(tmpState,tmpEntityBundleEntry));return fNext();// This is the default case, for a meadow entity set or single entity
|
|
5271
|
+
case'MeadowEntity':default:return _this80.gatherEntitySet(tmpEntityBundleEntry,_this80.prepareState(tmpState,tmpEntityBundleEntry),fNext);}}catch(pError){_this80.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),{Stack:pError.stack});return fNext();}});};for(var i=0;i<pEntitiesBundleDescription.length;i++){_loop3();}tmpAnticipate.wait(function(pError){//FIXME: should we be ignoring this error? rejecting here is unsafe since the result isn't guaranteed to be handled, so will crash stuff currently
|
|
5220
5272
|
if(pError){_this80.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),{Stack:pError.stack});return fCallback(pError);}return fCallback();});}/**
|
|
5221
5273
|
* Creates a wrapper state object to allow referencing common global state in addition to flow-state.
|
|
5222
5274
|
*
|
|
@@ -5480,7 +5532,7 @@ if(!tmpTemplateString){tmpTemplateString="";}return this.parseTemplate(tmpTempla
|
|
|
5480
5532
|
*
|
|
5481
5533
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
5482
5534
|
*/},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback,pContextArray){var _this86=this;// TODO: This will need streaming -- for now janky old string append does the trick
|
|
5483
|
-
var tmpValue="";if(typeof fCallback=="function"){if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this86.parseTemplate(pTemplateString,pRecord,function(pError,pTemplateResult){tmpValue+=pTemplateResult;return fRecordTemplateCallback();});},function(pError){return fCallback(pError,tmpValue);});}else{return fCallback(Error("Pict: Template Set: pDataSet is not an array or object."),"");}}else{if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){if(Array.isArray(pDataSet)){for(var i=0;i<pDataSet.length;i++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[i],null,pContextArray);}}else{var tmpKeys=Object.keys(pDataSet);for(var
|
|
5535
|
+
var tmpValue="";if(typeof fCallback=="function"){if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this86.parseTemplate(pTemplateString,pRecord,function(pError,pTemplateResult){tmpValue+=pTemplateResult;return fRecordTemplateCallback();});},function(pError){return fCallback(pError,tmpValue);});}else{return fCallback(Error("Pict: Template Set: pDataSet is not an array or object."),"");}}else{if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){if(Array.isArray(pDataSet)){for(var i=0;i<pDataSet.length;i++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[i],null,pContextArray);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i68=0;_i68<tmpKeys.length;_i68++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i68]],null,pContextArray);}}return tmpValue;}else{return"";}}}/**
|
|
5484
5536
|
* Parse a template set by hash.
|
|
5485
5537
|
*
|
|
5486
5538
|
* @param {String} pTemplateHash - The hash of the template to parse
|
|
@@ -5500,7 +5552,7 @@ if(!tmpTemplateString){tmpTemplateString="";}return this.parseTemplateSet(tmpTem
|
|
|
5500
5552
|
*
|
|
5501
5553
|
* @return {String?} The parsed template string, or undefined if a callback was provided
|
|
5502
5554
|
*/},{key:"parseTemplateSetWithPayload",value:function parseTemplateSetWithPayload(pTemplateString,pDataSet,pPayload,fCallback,pContextArray){var _this87=this;// TODO: This will need streaming -- for now janky old string append does the trick
|
|
5503
|
-
var tmpValue="";if(typeof fCallback=="function"){if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this87.parseTemplate(pTemplateString,{Data:pRecord,Payload:pPayload},function(pError,pTemplateResult){tmpValue+=pTemplateResult;return fRecordTemplateCallback();});},function(pError){return fCallback(pError,tmpValue);});}else{return fCallback(Error("Pict: Template Set: pDataSet is not an array or object."),"");}}else{if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){if(Array.isArray(pDataSet)){for(var i=0;i<pDataSet.length;i++){tmpValue+=this.parseTemplate(pTemplateString,{Data:pDataSet[i],Payload:pPayload},null,pContextArray);}}else{var tmpKeys=Object.keys(pDataSet);for(var
|
|
5555
|
+
var tmpValue="";if(typeof fCallback=="function"){if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){this.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this87.parseTemplate(pTemplateString,{Data:pRecord,Payload:pPayload},function(pError,pTemplateResult){tmpValue+=pTemplateResult;return fRecordTemplateCallback();});},function(pError){return fCallback(pError,tmpValue);});}else{return fCallback(Error("Pict: Template Set: pDataSet is not an array or object."),"");}}else{if(Array.isArray(pDataSet)||_typeof(pDataSet)=="object"){if(Array.isArray(pDataSet)){for(var i=0;i<pDataSet.length;i++){tmpValue+=this.parseTemplate(pTemplateString,{Data:pDataSet[i],Payload:pPayload},null,pContextArray);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i69=0;_i69<tmpKeys.length;_i69++){tmpValue+=this.parseTemplate(pTemplateString,{Data:pDataSet[tmpKeys[_i69]],Payload:pPayload},null,pContextArray);}}return tmpValue;}else{return"";}}}/**
|
|
5504
5556
|
* Parse a template set by hash.
|
|
5505
5557
|
*
|
|
5506
5558
|
* @param {String} pTemplateHash - The hash of the template to parse
|
|
@@ -5926,7 +5978,7 @@ var tmpTemplateHashes=tmpHash.trim().split(':');if(tmpTemplateHashes.length<3){t
|
|
|
5926
5978
|
* @return {string} The rendered template
|
|
5927
5979
|
*/_inherits(PictTemplateProviderTemplateValueSet,_libPictTemplate14);return _createClass2(PictTemplateProviderTemplateValueSet,[{key:"render",value:function render(pTemplateHash,pRecord,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateValueSetRender]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.log.trace("PICT Template [fTemplateValueSetRender]::[".concat(tmpHash,"]"));}var tmpTemplateHash;var tmpAddressOfData;// This is just a simple 2 part hash (the entity and the ID)
|
|
5928
5980
|
var tmpHashTemplateSeparator=tmpHash.indexOf(':');tmpTemplateHash=tmpHash.substring(0,tmpHashTemplateSeparator);if(tmpHashTemplateSeparator>-1){tmpAddressOfData=tmpHash.substring(tmpHashTemplateSeparator+1);}else{tmpTemplateHash=tmpHash;}// No template hash
|
|
5929
|
-
if(!tmpTemplateHash){this.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return'';}tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var
|
|
5981
|
+
if(!tmpTemplateHash){this.log.warn("Pict: Template Render: TemplateHash not resolved for [".concat(tmpHash,"]"));return'';}tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i70=0;_i70<tmpValueKeys.length;_i70++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i70]],Key:tmpValueKeys[_i70]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
5930
5982
|
return this.pict.parseTemplateSetByHash(tmpTemplateHash,pRecord,null,pContextArray);}else{return this.pict.parseTemplateSetByHash(tmpTemplateHash,tmpData,null,pContextArray);}}/**
|
|
5931
5983
|
* Render a template expression, deliver a string with the resulting content to a callback function.
|
|
5932
5984
|
*
|
|
@@ -5939,7 +5991,7 @@ return this.pict.parseTemplateSetByHash(tmpTemplateHash,pRecord,null,pContextArr
|
|
|
5939
5991
|
*/},{key:"renderAsync",value:function renderAsync(pTemplateHash,pRecord,fCallback,pContextArray){var tmpHash=pTemplateHash.trim();var tmpData=_typeof(pRecord)==='object'?pRecord:{};var tmpCallback=typeof fCallback==='function'?fCallback:function(){return'';};if(this.pict.LogNoisiness>4){this.log.trace("PICT Template [fTemplateValueSetRenderAsync]::[".concat(tmpHash,"] with tmpData:"),tmpData);}else if(this.pict.LogNoisiness>0){this.log.trace("PICT Template [fTemplateValueSetRenderAsync]::[".concat(tmpHash,"]"));}var tmpTemplateFromMapHash;var tmpAddressOfData;// This is a 3 part hash with the map address and the key address both
|
|
5940
5992
|
var tmpTemplateHashPart=tmpHash.split(':');if(tmpTemplateHashPart.length<2){this.log.trace("PICT TemplateFromMap [fTemplateRenderAsync]::[".concat(tmpHash,"] failed because there were not three stanzas in the expression [").concat(pTemplateHash,"]"));return fCallback(null,'');}tmpTemplateFromMapHash=tmpTemplateHashPart[0];tmpAddressOfData=tmpTemplateHashPart[1];// No TemplateFromMap hash
|
|
5941
5993
|
if(!tmpTemplateFromMapHash){this.log.warn("Pict: TemplateFromMap Render Async: TemplateFromMapHash not resolved for [".concat(tmpHash,"]"));return fCallback(null,'');}// Now resolve the data
|
|
5942
|
-
tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var
|
|
5994
|
+
tmpData=this.resolveStateFromAddress(tmpAddressOfData,tmpData,pContextArray);var tmpDataValueSet=[];if(Array.isArray(tmpData)){for(var i=0;i<tmpData.length;i++){tmpDataValueSet.push({Value:tmpData[i],Key:i});}}else if(_typeof(tmpData)==='object'){var tmpValueKeys=Object.keys(tmpData);for(var _i71=0;_i71<tmpValueKeys.length;_i71++){tmpDataValueSet.push({Value:tmpData[tmpValueKeys[_i71]],Key:tmpData[tmpValueKeys[_i71]]});}}else{tmpDataValueSet.push({Value:tmpData});}tmpData=tmpDataValueSet;if(!tmpData){// No address was provided, just render the template with what this template has.
|
|
5943
5995
|
// The async portion of this is a mind bender because of how entry can happen dynamically from templates
|
|
5944
5996
|
this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,pRecord,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}else{this.pict.parseTemplateSetByHash(tmpTemplateFromMapHash,tmpData,function(pError,pValue){if(pError){return tmpCallback(pError,'');}return tmpCallback(null,pValue);},pContextArray);}}}]);}(libPictTemplate);module.exports=PictTemplateProviderTemplateValueSet;},{"pict-template":143}],216:[function(require,module,exports){var libPictTemplate=require('pict-template');var PictTemplateProviderView=/*#__PURE__*/function(_libPictTemplate15){/**
|
|
5945
5997
|
* @param {Object} pFable - The Fable Framework instance
|