pict 1.0.261 → 1.0.262
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 +11 -5
- package/dist/pict.compatible.js.map +1 -1
- package/dist/pict.compatible.min.js +1 -1
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +11 -5
- package/dist/pict.js.map +1 -1
- package/dist/pict.min.js +1 -1
- package/dist/pict.min.js.map +1 -1
- package/package.json +1 -1
- package/source/Pict-Meadow-EntityProvider.js +13 -3
- package/types/source/Pict-Meadow-EntityProvider.d.ts +8 -15
- package/types/source/Pict-Meadow-EntityProvider.d.ts.map +1 -1
package/dist/pict.compatible.js
CHANGED
|
@@ -4968,7 +4968,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
4968
4968
|
// presumably different callback function.
|
|
4969
4969
|
// This makes sure that own properties are retained, so that
|
|
4970
4970
|
// decorations and such are not lost along the way.
|
|
4971
|
-
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.
|
|
4971
|
+
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.262","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.25","pict-provider":"^1.0.3","pict-template":"^1.0.10","pict-view":"^1.0.60","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.
|
|
4972
4972
|
/* global Pict, _Pict: writeable *//**
|
|
4973
4973
|
* Simple function to load a pict Application
|
|
4974
4974
|
*
|
|
@@ -5159,7 +5159,13 @@ if(pCustomRequestInformation.Destination){_this76.fable.manifest.setValueByHash(
|
|
|
5159
5159
|
* @param {(error?: Error) => void} fCallback - The callback function to call when the data gathering is complete.
|
|
5160
5160
|
*/},{key:"gatherDataFromServer",value:function gatherDataFromServer(pEntitiesBundleDescription,fCallback){var _this77=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=_this77.fable.manifest.getValueByHash(_this77.fable,tmpEntityBundleEntry.StateAddress);if(typeof tmpState==='undefined'){tmpState={};_this77.fable.manifest.setValueByHash(_this77.fable,tmpEntityBundleEntry.StateAddress,tmpState);}break;case'PopState':if(tmpStateStack.length>0){tmpState=tmpStateStack.pop();}else{_this77.log.warn("EntityBundleRequest encountered a PopState without a matching SetStateAddress.");}break;case'Custom':return _this77.gatherCustomDataSet(tmpEntityBundleEntry,_this77.prepareState(tmpState,tmpEntityBundleEntry),fNext);case'MapJoin':return _this77.mapJoin(tmpEntityBundleEntry,_this77.prepareState(tmpState,tmpEntityBundleEntry),fNext);// This is the default case, for a meadow entity set or single entity
|
|
5161
5161
|
case'MeadowEntity':default:return _this77.gatherEntitySet(tmpEntityBundleEntry,_this77.prepareState(tmpState,tmpEntityBundleEntry),fNext);}}catch(pError){_this77.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),pError);}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
|
|
5162
|
-
if(pError){_this77.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),pError);return fCallback(pError);}return fCallback();});}
|
|
5162
|
+
if(pError){_this77.log.error("EntityBundleRequest error gathering entity set: ".concat(pError),pError);return fCallback(pError);}return fCallback();});}/**
|
|
5163
|
+
* Creates a wrapper state object to allow referencing common global state in addition to flow-state.
|
|
5164
|
+
*
|
|
5165
|
+
* @param {Record<string, any>} pState - The state object to prepare.
|
|
5166
|
+
* @param {any} [pStepConfiguration] - (optional) The step configuration object provided in the config, if any.
|
|
5167
|
+
* @return {Record<string, any>} - The prepared state object.
|
|
5168
|
+
*/},{key:"prepareState",value:function prepareState(pState,pStepConfiguration){return{State:pState,AppData:this.fable.AppData,Pict:this.fable,Fable:this.fable,StepConfiguration:pStepConfiguration};}},{key:"getEntity",value:function getEntity(pEntity,pIDRecord,fCallback){this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
5163
5169
|
this.recordCache[pEntity].prune(function(){var _this78=this;var tmpPossibleRecord=this.recordCache[pEntity].read(pIDRecord);if(tmpPossibleRecord){return fCallback(null,tmpPossibleRecord);}var tmpOptions={url:"".concat(this.options.urlPrefix).concat(pEntity,"/").concat(pIDRecord)};tmpOptions=this.prepareRequestOptions(tmpOptions);return this.restClient.getJSON(tmpOptions,function(pError,pResponse,pBody){/*
|
|
5164
5170
|
* FIXME: This breaks entity reads for nonexistent records. Putting this back for now until we can audit and fix all the places that may rely on this.
|
|
5165
5171
|
if (pResponse && pResponse.statusCode && pResponse.statusCode >= 400)
|
|
@@ -5167,12 +5173,12 @@ this.recordCache[pEntity].prune(function(){var _this78=this;var tmpPossibleRecor
|
|
|
5167
5173
|
this.log.error(`Error getting entity [${pEntity}] with ID [${pIDRecord}] from url [${tmpOptions.url}]: ${pResponse.statusCode} ${pResponse.statusMessage}`);
|
|
5168
5174
|
return fCallback(new Error(`Error getting entity [${pEntity}] with ID [${pIDRecord}] from url [${tmpOptions.url}]: ${pResponse.statusCode} ${JSON.stringify(pBody || {})}`));
|
|
5169
5175
|
}
|
|
5170
|
-
*/if(pBody){_this78.recordCache[pEntity].put(pBody,pIDRecord);}return fCallback(pError,pBody);});}.bind(this));}},{key:"getEntitySetPage",value:function getEntitySetPage(pEntity,pMeadowFilterExpression,pRecordStartCursor,pRecordCount,fCallback){var tmpURL="".concat(this.options.urlPrefix).concat(pEntity,"s
|
|
5176
|
+
*/if(pBody){_this78.recordCache[pEntity].put(pBody,pIDRecord);}return fCallback(pError,pBody);});}.bind(this));}},{key:"getEntitySetPage",value:function getEntitySetPage(pEntity,pMeadowFilterExpression,pRecordStartCursor,pRecordCount,fCallback){var tmpFilterStanza=pMeadowFilterExpression?"/FilteredTo/".concat(pMeadowFilterExpression):'';var tmpURL="".concat(this.options.urlPrefix).concat(pEntity,"s").concat(tmpFilterStanza,"/").concat(pRecordStartCursor,"/").concat(pRecordCount);return this.restClient.getJSON(tmpURL,function(pDownloadError,pDownloadResponse,pDownloadBody){if(pDownloadResponse&&pDownloadResponse.statusCode&&pDownloadResponse.statusCode>=400){this.log.error("Error getting entity set of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pDownloadResponse.statusCode," ").concat(pDownloadResponse.statusMessage));return fCallback(new Error("Error getting entity set of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pDownloadResponse.statusCode," ").concat(JSON.stringify(pDownloadBody||{}))));}return fCallback(pDownloadError,pDownloadBody);}.bind(this));}},{key:"getEntitySetRecordCount",value:function getEntitySetRecordCount(pEntity,pMeadowFilterExpression,fCallback){var tmpFilterStanza=pMeadowFilterExpression?"/FilteredTo/".concat(pMeadowFilterExpression):'';var tmpURL="".concat(this.options.urlPrefix).concat(pEntity,"s/Count").concat(tmpFilterStanza);return this.restClient.getJSON(tmpURL,function(pError,pResponse,pBody){if(pResponse&&pResponse.statusCode&&pResponse.statusCode>=400){this.log.error("Error getting entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pResponse.statusCode," ").concat(pResponse.statusMessage));return fCallback(new Error("Error getting entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pResponse.statusCode," ").concat(JSON.stringify(pBody||{}))));}if(pError){this.log.error("Error getting entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(tmpURL,"]: ").concat(pError));return fCallback(pError);}var tmpRecordCount=0;if(pBody.Count){tmpRecordCount=pBody.Count;}return fCallback(pError,tmpRecordCount);}.bind(this));}},{key:"getEntitySet",value:function getEntitySet(pEntity,pMeadowFilterExpression,fCallback){// TODO: Should we test for too many record IDs here by string length in pMeadowFilterExpression?
|
|
5171
5177
|
// FBL~ID${pDestinationEntity}~INN~${tmpIDRecordsCommaSeparated}
|
|
5172
5178
|
// If the list is mega-long we can parse it and break it into chunks.
|
|
5173
5179
|
this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
|
|
5174
|
-
this.recordSetCache[pEntity].prune(function(){var _this79=this;var tmpPossibleRecords=this.recordSetCache[pEntity].read(pMeadowFilterExpression);if(tmpPossibleRecords){return fCallback(null,tmpPossibleRecords);}return this.getEntitySetRecordCount(pEntity,pMeadowFilterExpression,function(pRecordCountError,pRecordCount){if(pRecordCountError){return fCallback(pRecordCountError);}var tmpRecordCount=pRecordCount;if(isNaN(pRecordCount)){_this79.log.error("Entity count did not return a number for [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"]... something is fatally wrong from the server accessed in getEntitySet call."));return fCallback(new Error('Entity count did not return a number in getEntitySet.'));}var tmpDownloadURIFragments=[];var tmpDownloadBatchSize=_this79.options.downloadBatchSize;for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
|
|
5175
|
-
tmpDownloadURIFragments.push("".concat(_this79.options.urlPrefix).concat(pEntity,"s
|
|
5180
|
+
this.recordSetCache[pEntity].prune(function(){var _this79=this;var tmpPossibleRecords=this.recordSetCache[pEntity].read(pMeadowFilterExpression);if(tmpPossibleRecords){return fCallback(null,tmpPossibleRecords);}return this.getEntitySetRecordCount(pEntity,pMeadowFilterExpression,function(pRecordCountError,pRecordCount){if(pRecordCountError){return fCallback(pRecordCountError);}var tmpRecordCount=pRecordCount;if(isNaN(pRecordCount)){_this79.log.error("Entity count did not return a number for [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"]... something is fatally wrong from the server accessed in getEntitySet call."));return fCallback(new Error('Entity count did not return a number in getEntitySet.'));}var tmpDownloadURIFragments=[];var tmpDownloadBatchSize=_this79.options.downloadBatchSize;var tmpFilterStanza=pMeadowFilterExpression?"/FilteredTo/".concat(pMeadowFilterExpression):'';for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
|
|
5181
|
+
tmpDownloadURIFragments.push("".concat(_this79.options.urlPrefix).concat(pEntity,"s").concat(tmpFilterStanza,"/").concat(i*tmpDownloadBatchSize,"/").concat(tmpDownloadBatchSize));}var tmpEntitySet=[];// Now run these in series (it's possible to parallelize the requests but they would not be in server order)
|
|
5176
5182
|
_this79.fable.Utility.eachLimit(tmpDownloadURIFragments,1,function(pURIFragment,fDownloadCallback){_this79.restClient.getJSON(pURIFragment,function(pDownloadError,pDownloadResponse,pDownloadBody){if(pDownloadResponse&&pDownloadResponse.statusCode&&pDownloadResponse.statusCode>=400){_this79.log.error("Error getting entity set of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(pURIFragment,"]: ").concat(pDownloadResponse.statusCode," ").concat(pDownloadResponse.statusMessage));return fDownloadCallback(new Error("Error getting entity set of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from url [").concat(pURIFragment,"]: ").concat(pDownloadResponse.statusCode," ").concat(JSON.stringify(pDownloadBody||{}))));}tmpEntitySet=tmpEntitySet.concat(pDownloadBody);// Should we be caching each record?
|
|
5177
5183
|
return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){if(tmpEntitySet){_this79.recordSetCache[pEntity].put(tmpEntitySet,pMeadowFilterExpression);}return fCallback(pFullDownloadError,tmpEntitySet);});});}.bind(this));}}]);}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":68}],198:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase23){/**
|
|
5178
5184
|
* @param {Object} pFable - The Fable Framework instance
|