pict 1.0.377 → 1.0.380
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.js +25 -8
- 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 +49 -26
- package/source/filters/Filter.js +14 -1
- package/types/source/Pict-Meadow-EntityProvider.d.ts +43 -7
- package/types/source/Pict-Meadow-EntityProvider.d.ts.map +1 -1
- package/types/source/filters/Filter.d.ts.map +1 -1
- package/types/source/providers/Pict-Icons-Base.d.ts +73 -0
- package/types/source/providers/Pict-Icons-Base.d.ts.map +1 -0
- package/types/source/providers/Provider-Icon.d.ts +70 -0
- package/types/source/providers/Provider-Icon.d.ts.map +1 -0
- package/types/source/templates/Pict-Template-AddressedTemplate.d.ts +32 -0
- package/types/source/templates/Pict-Template-AddressedTemplate.d.ts.map +1 -0
- package/types/source/templates/Pict-Template-Function.d.ts +36 -0
- package/types/source/templates/Pict-Template-Function.d.ts.map +1 -0
- package/types/source/templates/Pict-Template-Icon.d.ts +36 -0
- package/types/source/templates/Pict-Template-Icon.d.ts.map +1 -0
- package/types/source/templates/Pict-Template-InlineTemplate.d.ts +29 -0
- package/types/source/templates/Pict-Template-InlineTemplate.d.ts.map +1 -0
- package/dist/indoctrinate_content_staging/Indoctrinate-Catalog-AppData.json +0 -12921
package/dist/pict.js
CHANGED
|
@@ -5184,7 +5184,8 @@ if($m){return $mapGet($m,key);}},has:function(key){if($m){return $mapHas($m,key)
|
|
|
5184
5184
|
$m=new $Map();}$mapSet($m,key,value);}};// @ts-expect-error TODO: figure out why TS is erroring here
|
|
5185
5185
|
return channel;};},{"call-bound":30,"es-errors/type":47,"get-intrinsic":104,"object-inspect":136}],163:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBound=require('call-bound');var inspect=require('object-inspect');var getSideChannelMap=require('side-channel-map');var $TypeError=require('es-errors/type');var $WeakMap=GetIntrinsic('%WeakMap%',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => V} */var $weakMapGet=callBound('WeakMap.prototype.get',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K, value: V) => void} */var $weakMapSet=callBound('WeakMap.prototype.set',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */var $weakMapHas=callBound('WeakMap.prototype.has',true);/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */var $weakMapDelete=callBound('WeakMap.prototype.delete',true);/** @type {import('.')} */module.exports=$WeakMap?/** @type {Exclude<import('.'), false>} */function getSideChannelWeakMap(){/** @typedef {ReturnType<typeof getSideChannelWeakMap>} Channel *//** @typedef {Parameters<Channel['get']>[0]} K *//** @typedef {Parameters<Channel['set']>[1]} V *//** @type {WeakMap<K & object, V> | undefined} */var $wm;/** @type {Channel | undefined} */var $m;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if($wm){return $weakMapDelete($wm,key);}}else if(getSideChannelMap){if($m){return $m['delete'](key);}}return false;},get:function(key){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if($wm){return $weakMapGet($wm,key);}}return $m&&$m.get(key);},has:function(key){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if($wm){return $weakMapHas($wm,key);}}return!!$m&&$m.has(key);},set:function(key,value){if($WeakMap&&key&&(typeof key==='object'||typeof key==='function')){if(!$wm){$wm=new $WeakMap();}$weakMapSet($wm,key,value);}else if(getSideChannelMap){if(!$m){$m=getSideChannelMap();}// eslint-disable-next-line no-extra-parens
|
|
5186
5186
|
/** @type {NonNullable<typeof $m>} */$m.set(key,value);}}};// @ts-expect-error TODO: figure out why this is erroring
|
|
5187
|
-
return channel;}:getSideChannelMap;},{"call-bound":30,"es-errors/type":47,"get-intrinsic":104,"object-inspect":136,"side-channel-map":162}],164:[function(require,module,exports){'use strict';var $TypeError=require('es-errors/type');var inspect=require('object-inspect');var getSideChannelList=require('side-channel-list');var getSideChannelMap=require('side-channel-map');var getSideChannelWeakMap=require('side-channel-weakmap');var makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;/** @type {import('.')} */module.exports=function getSideChannel(){/** @typedef {ReturnType<typeof getSideChannel>} Channel *//** @type {Channel | undefined} */var $channelData;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){
|
|
5187
|
+
return channel;}:getSideChannelMap;},{"call-bound":30,"es-errors/type":47,"get-intrinsic":104,"object-inspect":136,"side-channel-map":162}],164:[function(require,module,exports){'use strict';var $TypeError=require('es-errors/type');var inspect=require('object-inspect');var getSideChannelList=require('side-channel-list');var getSideChannelMap=require('side-channel-map');var getSideChannelWeakMap=require('side-channel-weakmap');var makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;/** @type {import('.')} */module.exports=function getSideChannel(){/** @typedef {ReturnType<typeof getSideChannel>} Channel *//** @type {Channel | undefined} */var $channelData;/** @type {Channel} */var channel={assert:function(key){if(!channel.has(key)){throw new $TypeError('Side channel does not contain '+inspect(key));}},'delete':function(key){return!!$channelData&&$channelData['delete'](key);},get:function(key){return $channelData&&$channelData.get(key);},has:function(key){return!!$channelData&&$channelData.has(key);},set:function(key,value){if(!$channelData){$channelData=makeChannel();}$channelData.set(key,value);}};// @ts-expect-error TODO: figure out why this is erroring
|
|
5188
|
+
return channel;};},{"es-errors/type":47,"object-inspect":136,"side-channel-list":161,"side-channel-map":162,"side-channel-weakmap":163}],165:[function(require,module,exports){(function(Buffer){(function(){/*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=function(stream,cb){var chunks=[];stream.on('data',function(chunk){chunks.push(chunk);});stream.once('end',function(){if(cb)cb(null,Buffer.concat(chunks));cb=null;});stream.once('error',function(err){if(cb)cb(err);cb=null;});};}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":20}],166:[function(require,module,exports){(function(Buffer){(function(){/*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=simpleGet;const concat=require('simple-concat');const decompressResponse=require('decompress-response');// excluded from browser build
|
|
5188
5189
|
const http=require('http');const https=require('https');const once=require('once');const querystring=require('querystring');const url=require('url');const isStream=o=>o!==null&&typeof o==='object'&&typeof o.pipe==='function';function simpleGet(opts,cb){opts=Object.assign({maxRedirects:10},typeof opts==='string'?{url:opts}:opts);cb=once(cb);if(opts.url){const _url$parse=url.parse(opts.url),hostname=_url$parse.hostname,port=_url$parse.port,protocol=_url$parse.protocol,auth=_url$parse.auth,path=_url$parse.path;// eslint-disable-line node/no-deprecated-api
|
|
5189
5190
|
delete opts.url;if(!hostname&&!port&&!protocol&&!auth)opts.path=path;// Relative redirect
|
|
5190
5191
|
else Object.assign(opts,{hostname,port,protocol,auth,path});// Absolute redirect
|
|
@@ -6105,7 +6106,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
6105
6106
|
// presumably different callback function.
|
|
6106
6107
|
// This makes sure that own properties are retained, so that
|
|
6107
6108
|
// decorations and such are not lost along the way.
|
|
6108
|
-
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;}}},{}],191:[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;}},{}],192:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.
|
|
6109
|
+
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;}}},{}],191:[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;}},{}],192:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.380","description":"Pict browser library.","main":"source/Pict.js","scripts":{"start":"node source/Pict.js","test":"npx quack test","tests":"npx quack test -g","coverage":"npx quack coverage","build":"npx quack build","prepublishOnly":"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 ."},"files":["source/","dist/","types/"],"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/fable-retold/pict/issues"},"homepage":"https://github.com/fable-retold/pict#readme","devDependencies":{"@eslint/js":"^9.39.1","@types/jquery":"^3.5.33","@types/sinon":"^17.0.4","eslint":"^9.39.1","globals":"^16.5.0","pict-docuserve":"^1.4.19","quackage":"^1.3.0","sinon":"^20.0.0","typescript":"^5.9.3"},"dependencies":{"cachetrax":"^1.0.6","fable":"^3.1.75","pict-application":"^1.0.34","pict-provider":"^1.0.13","pict-template":"^1.0.15","pict-view":"^1.0.68"}};},{}],193:[function(require,module,exports){// This assumes Pict has been required in the browser. Delcare these as globals so linter can do its job.
|
|
6109
6110
|
/* global Pict, _Pict: writeable *//**
|
|
6110
6111
|
* Simple function to load a pict Application
|
|
6111
6112
|
*
|
|
@@ -6535,8 +6536,20 @@ this.initializeCache(tmpEntityName,pScope);const tmpCacheKey=this._cacheKey(tmpE
|
|
|
6535
6536
|
// fetch each one individually. prune is synchronous.
|
|
6536
6537
|
this.recordCache[tmpCacheKey].prune(()=>{});// First pass: gather IDs to fetch
|
|
6537
6538
|
for(const tmpRecord of pRecordSet){const tmpIDValue=tmpRecord[tmpEntityIDSourceField];if(tmpIDValue){const tmpCachedRecord=this.recordCache[tmpCacheKey].read(tmpIDValue);if(!tmpCachedRecord){tmpEntityIDsToFetch.add(tmpIDValue);}}}// Now if there are records to fetch, do the request.
|
|
6538
|
-
if(tmpEntityIDsToFetch.size>0){tmpAnticipate.anticipate(function(fRequestComplete){const tmpIDRecordsArray=Array.from(tmpEntityIDsToFetch);
|
|
6539
|
-
|
|
6539
|
+
if(tmpEntityIDsToFetch.size>0){tmpAnticipate.anticipate(function(fRequestComplete){const tmpIDRecordsArray=Array.from(tmpEntityIDsToFetch);this.getEntitySetByIDListChunked(tmpEntityName,tmpIDRecordsArray,{NoCount:true,Scope:pScope},fRequestComplete);}.bind(this));}}tmpAnticipate.wait(pError=>{if(pError){this.log.error(`cacheConnectedEntityRecords error gathering connected entity records: ${pError}`,{Stack:pError.stack});return fCallback(pError);}return fCallback();});}/**
|
|
6540
|
+
* Fetch a set of entity records by primary-key ID list, chunking the meadow IN
|
|
6541
|
+
* filter so the generated GET URL never exceeds HTTP/2 header-size limits on
|
|
6542
|
+
* large sets (oversized URLs trip a connection-level reset that takes sibling
|
|
6543
|
+
* multiplexed requests down with it). Records are cached as a side effect of
|
|
6544
|
+
* getEntitySet; the callback returns no data.
|
|
6545
|
+
*
|
|
6546
|
+
* @param {string} pEntityName - The entity name (e.g. 'Project').
|
|
6547
|
+
* @param {Array<number|string>} pIDRecordsArray - The primary-key IDs to fetch.
|
|
6548
|
+
* @param {Object} pOptions - Options passed through to getEntitySet (Scope, NoCount, etc).
|
|
6549
|
+
* @param {(error?: Error) => void} fCallback - Completion callback.
|
|
6550
|
+
*
|
|
6551
|
+
* @return {void}
|
|
6552
|
+
*/getEntitySetByIDListChunked(pEntityName,pIDRecordsArray,pOptions,fCallback){if(!Array.isArray(pIDRecordsArray)||pIDRecordsArray.length<1){return fCallback();}const tmpAnticipate=this.fable.newAnticipate();const tmpChunkSize=this.options&&this.options.ConnectedEntityIDChunkSize||200;for(let i=0;i<pIDRecordsArray.length;i+=tmpChunkSize){const tmpIDChunk=pIDRecordsArray.slice(i,i+tmpChunkSize);tmpAnticipate.anticipate(function(fChunkComplete){const tmpMeadowFilterExpression=`FBL~ID${pEntityName}~INN~${tmpIDChunk.join(',')}`;this.getEntitySet(pEntityName,tmpMeadowFilterExpression,pError=>{if(pError){this.log.error(`getEntitySetByIDListChunked error getting connected entity records for [${pEntityName}] with IDs [${tmpIDChunk.join(',')}]: ${pError}`,{Stack:pError.stack});return fChunkComplete(pError);}return fChunkComplete();},null,pOptions);}.bind(this));}tmpAnticipate.wait(fCallback);}/**
|
|
6540
6553
|
* For a given list of objects, cache connected entity records.
|
|
6541
6554
|
*
|
|
6542
6555
|
* @param {Array} pRecordSet - An array of objects to check cache on joined records for, and, get/cache the records as needed.
|
|
@@ -6555,8 +6568,7 @@ this.initializeCache(tmpEntityName,pScope);const tmpCacheKey=this._cacheKey(tmpE
|
|
|
6555
6568
|
// fetch each one individually. prune is synchronous.
|
|
6556
6569
|
this.recordCache[tmpCacheKey].prune(()=>{});// First pass: gather IDs to fetch
|
|
6557
6570
|
for(const tmpRecord of pRecordSet){const tmpIDValue=tmpRecord[tmpEntityIDSourceField];if(tmpIDValue){const tmpCachedRecord=this.recordCache[tmpCacheKey].read(tmpIDValue);if(!tmpCachedRecord){tmpEntityIDsToFetch.add(tmpIDValue);}}}// Now if there are records to fetch, do the request.
|
|
6558
|
-
if(tmpEntityIDsToFetch.size>0){tmpAnticipate.anticipate(function(fRequestComplete){const tmpIDRecordsArray=Array.from(tmpEntityIDsToFetch);
|
|
6559
|
-
return fRequestComplete();},null,{Scope:pScope});}.bind(this));}}tmpAnticipate.wait(pError=>{if(pError){this.log.error(`cacheConnectedEntityRecords error gathering connected entity records: ${pError}`,{Stack:pError.stack});return fCallback(pError);}return fCallback();});}/**
|
|
6571
|
+
if(tmpEntityIDsToFetch.size>0){tmpAnticipate.anticipate(function(fRequestComplete){const tmpIDRecordsArray=Array.from(tmpEntityIDsToFetch);this.getEntitySetByIDListChunked(tmpEntityName,tmpIDRecordsArray,{Scope:pScope},fRequestComplete);}.bind(this));}}tmpAnticipate.wait(pError=>{if(pError){this.log.error(`cacheConnectedEntityRecords error gathering connected entity records: ${pError}`,{Stack:pError.stack});return fCallback(pError);}return fCallback();});}/**
|
|
6560
6572
|
* Cache an array of records, likely from a meadow endpoint
|
|
6561
6573
|
*
|
|
6562
6574
|
* @param {string} pEntity - The entity type to cache individual records for
|
|
@@ -7263,7 +7275,12 @@ case'InternalJoinMatch':case'InternalJoinStringMatch':case'InternalJoinDateMatch
|
|
|
7263
7275
|
"JoinExternalConnectionColumn": "IDUser",
|
|
7264
7276
|
"JoinInternalConnectionColumn": "CreatingIDUser",
|
|
7265
7277
|
*/if(!tmpFilterByColumns){tmpFilterByColumns=tmpFilterConfig.ExternalFilterByColumns||(tmpFilterConfig.ExternalFilterByColumn?[tmpFilterConfig.ExternalFilterByColumn]:['Name']);}for(const tmpField of tmpFilterByColumns){for(const tmpValue of tmpValuesArray){const tmpFilter={Index:0,Entity:tmpFilterConfig.RemoteTable,Instruction:'FBVOR',Field:tmpField};if(tmpFilterConfig.ExactMatch||typeof tmpFilterConfig.ExactMatch==='undefined'&&(tmpFilterConfig.Type=='InternalJoinNumericMatch'||tmpFilterConfig.Type=='InternalJoinDateMatch'||tmpFilterConfig.Type=='InternalJoinSelectedValue'||tmpFilterConfig.Type=='InternalJoinSelectedValueList')){//TODO: optimize this to use in-list, but requires restructuring of this code
|
|
7266
|
-
tmpFilter.Operator='EQ';tmpFilter.Value=tmpValue;}else{tmpFilter.Operator='LK';tmpFilter.Value=`%25${tmpValue}%25`;}tmpFilterResult.Filters.push(tmpFilter);}}if(tmpFilterResult.Filters.length>0){if(!tmpFilterConfig.JoinInternalConnectionColumn){this.log.error(`${tmpFilterConfig.Type} filter missing JoinInternalConnectionColumn, cannot filter core table [${pFilterState.Entity}].`);break;}tmpFilterResult.JoinConfig={Instruction:'FBLOR',CoreEntity:pFilterState.Entity,Fields:[tmpFilterConfig.JoinInternalConnectionColumn],Operator:'INN',ValueTemplate:`{~PJU:,^${tmpFilterConfig.JoinExternalConnectionColumn}^Record.State[Step0]~}`};}break;case'RawFilter':if(!tmpFilterConfig.Value){this.log.warn(`RawFilter configuration missing Value, not adding filter.`,{FilterConfig:tmpFilterConfig});break;}pFilterState.UserFilters.push(tmpFilterConfig.Value);break;default:this.log.warn(`Unknown filter type ${tmpFilterConfig.Type} in filter configuration.`,{FilterConfig:tmpFilterConfig});}
|
|
7278
|
+
tmpFilter.Operator='EQ';tmpFilter.Value=tmpValue;}else{tmpFilter.Operator='LK';tmpFilter.Value=`%25${tmpValue}%25`;}tmpFilterResult.Filters.push(tmpFilter);}}if(tmpFilterResult.Filters.length>0){if(!tmpFilterConfig.JoinInternalConnectionColumn){this.log.error(`${tmpFilterConfig.Type} filter missing JoinInternalConnectionColumn, cannot filter core table [${pFilterState.Entity}].`);break;}tmpFilterResult.JoinConfig={Instruction:'FBLOR',CoreEntity:pFilterState.Entity,Fields:[tmpFilterConfig.JoinInternalConnectionColumn],Operator:'INN',ValueTemplate:`{~PJU:,^${tmpFilterConfig.JoinExternalConnectionColumn}^Record.State[Step0]~}`};}break;case'RawFilter':if(!tmpFilterConfig.Value){this.log.warn(`RawFilter configuration missing Value, not adding filter.`,{FilterConfig:tmpFilterConfig});break;}pFilterState.UserFilters.push(tmpFilterConfig.Value);break;default:this.log.warn(`Unknown filter type ${tmpFilterConfig.Type} in filter configuration.`,{FilterConfig:tmpFilterConfig});}// Per-clause URLPrefix knob: the remote-table resolution requests (the join lookup
|
|
7279
|
+
// against RemoteTable) otherwise inherit the recordset entity provider's URLPrefix.
|
|
7280
|
+
// When a clause's remote entity lives at a different API root than the recordset
|
|
7281
|
+
// (e.g. a lake-backed recordset joining to a main-API entity), set URLPrefix on the
|
|
7282
|
+
// clause to resolve the join there. The core-entity (recordset) request is unaffected.
|
|
7283
|
+
if(tmpFilterConfig.URLPrefix){for(const tmpRemoteResolutionFilter of tmpFilterResult.Filters){tmpRemoteResolutionFilter.URLPrefix=tmpFilterConfig.URLPrefix;}}if(tmpFilterResult.Filters.length>0){if(tmpFilterConfig.GUIDGroup){if(groupedFilterStates[tmpFilterConfig.GUIDGroup]){groupedFilterStates[tmpFilterConfig.GUIDGroup].PreparedFilters.push(tmpFilterResult);}else{groupedFilterStates[tmpFilterConfig.GUIDGroup]={PreparedFilters:[tmpFilterResult],Junction:'AND',Ordinal:0};}}else{tmpResult.push(tmpFilterResult);}}}const sortSet=arr=>{for(let x=0;x<arr.length;x++){arr[x].Ordinal=arr[x].Ordinal||0;}return arr.sort((a,b)=>{if(a.Ordinal>b.Ordinal){return 1;}else if(b.Ordinal>a.Ordinal){return-1;}return 0;});};const spreadGroupings=arr=>{const outputSet=[];for(const group of arr){if(group.PreparedFilters){group.PreparedFilters[0].GroupOpen=true;group.PreparedFilters[0].GroupJunction=group.Junction;group.PreparedFilters[group.PreparedFilters.length-1].GroupClose=true;for(let x=0;x<group.PreparedFilters.length;x++){outputSet.push(group.PreparedFilters[x]);}}else{outputSet.push(group);}}return outputSet;};for(let g of Object.keys(groupedFilterStates)){var _groupedFilterStates$;if((_groupedFilterStates$=groupedFilterStates[g].PreparedFilters)!==null&&_groupedFilterStates$!==void 0&&_groupedFilterStates$.length){groupedFilterStates[g].PreparedFilters=sortSet(groupedFilterStates[g].PreparedFilters);}tmpResult.push(groupedFilterStates[g]);}tmpResult=spreadGroupings(sortSet(tmpResult));pFilterState.PreparedFilters=tmpResult;}/**
|
|
7267
7284
|
* @param {FilterState} pFilterState
|
|
7268
7285
|
*/linkPreparedFilters(pFilterState){const tmpGroupedStanzas=[];for(const tmpPreparedFilter of pFilterState.PreparedFilters||[]){if(tmpPreparedFilter.JoinConfig){const tmpSubGroup=tmpPreparedFilter.Filters;const tmpJoinConfig=tmpPreparedFilter.JoinConfig;for(const tmpField of tmpJoinConfig.Fields||[]){const tmpStanza={Index:1,CoreEntity:true,Entity:tmpPreparedFilter.JoinConfig.CoreEntity,Instruction:tmpPreparedFilter.JoinConfig.Instruction||'FBVOR',Field:tmpField,Operator:tmpJoinConfig.Operator,Value:tmpJoinConfig.Value,ValueTemplate:tmpJoinConfig.ValueTemplate};tmpSubGroup.push(tmpStanza);}tmpGroupedStanzas.push(tmpSubGroup);}else{tmpGroupedStanzas.push(tmpPreparedFilter.Filters);}}return tmpGroupedStanzas;}/**
|
|
7269
7286
|
* Generate a computed index for each filter in the meadow filter stanzas such that the overall address space is non-overlapping and stable.
|
|
@@ -7274,7 +7291,7 @@ tmpFilter.Operator='EQ';tmpFilter.Value=tmpValue;}else{tmpFilter.Operator='LK';t
|
|
|
7274
7291
|
*/compileMeadowFilterStanzas(pFilterState){const tmpBundleConfig=[];//TODO: mathematically solve the number line
|
|
7275
7292
|
// planned synthesized syntax for running on the server
|
|
7276
7293
|
// FBV-3_Author~Name~LK~%25Ann%25~FBL-2_BookAuthorJoin~IDAuthor~INN~{~PJU:,^State[Step-3]^IDAuthor~}~FBV-1~User~NameFirst~LK~%25Bob%25~FBVOR-1~User~NameLast~LK~%25Bob%25~FBV~CreateDate~GT~2023-01-01T00:00:00Z~FBV~CreateDate~LT~2024-01-01T00:00:00Z~FBL~IDBook~INN~{~PJU:,^State[Step-2]^IDBook~}
|
|
7277
|
-
if(!pFilterState.Filter){pFilterState.Filter=`${pFilterState.Entity||'Unknown'}-${this.pict.getUUID()}`;}tmpBundleConfig.push({Type:'SetStateAddress',StateAddress:`Bundle[${pFilterState.Filter}]`});const tmpGroupedFilters={};const tmpGroupedFilterKeys=[];const tmpGroupedCoreFilters=[];const tmpGroupedCoreFilterKeys=[];let tmpCoreEntity;const tmpCoreFilterStrings=[];for(const tmpFilterGroup of pFilterState.PreparedFilters){for(const tmpFilter of tmpFilterGroup.Filters){if(tmpFilter.CoreEntity){tmpCoreEntity=tmpFilter.Entity;const tmpFilterGUID=`${tmpFilterGroup.GUID}-${tmpFilter.ComputedIndex}`;if(!tmpGroupedCoreFilterKeys.find(v=>v==tmpFilterGUID)){tmpGroupedCoreFilterKeys.push(tmpFilterGUID);}if(!tmpGroupedCoreFilters[tmpFilterGUID]){tmpGroupedCoreFilters[tmpFilterGUID]={Stanzas:[],ComputedIndex:tmpFilter.ComputedIndex,Entity:tmpFilter.Entity,Junction:tmpFilterGroup.Junction||'AND',GroupOpen:tmpFilterGroup.GroupOpen||false,GroupJunction:tmpFilterGroup.GroupJunction||'AND',GroupClose:tmpFilterGroup.GroupClose||false};}tmpGroupedCoreFilters[tmpFilterGUID].Stanzas.push(this._compileSimpleFilterToString(tmpFilter));}else{const tmpFilterGroupGUID=`${tmpFilterGroup.GUID}-${tmpFilter.ComputedIndex}`;if(!tmpGroupedFilterKeys.find(v=>v==tmpFilterGroupGUID)){tmpGroupedFilterKeys.push(tmpFilterGroupGUID);}if(!tmpGroupedFilters[tmpFilterGroupGUID]){tmpGroupedFilters[tmpFilterGroupGUID]={Stanzas:[],ComputedIndex:tmpFilter.ComputedIndex,Entity:tmpFilter.Entity};}tmpGroupedFilters[tmpFilterGroupGUID].Stanzas.push(this._compileSimpleFilterToString(tmpFilter));}}for(const tmpFilterGroupKey of tmpGroupedFilterKeys){tmpGroupedFilters[tmpFilterGroupKey].Stanzas=tmpGroupedFilters[tmpFilterGroupKey].Stanzas.filter(f=>f.length>0);if(tmpGroupedFilters[tmpFilterGroupKey].Stanzas.length>0){tmpBundleConfig.push({Type:'MeadowEntity',AllRecords:true,Entity:tmpGroupedFilters[tmpFilterGroupKey].Entity,Filter:tmpGroupedFilters[tmpFilterGroupKey].Stanzas.join('~'),Destination:`State[Step${tmpGroupedFilters[tmpFilterGroupKey].ComputedIndex}]`});}}}for(const tmpCoreFilterKey of tmpGroupedCoreFilterKeys){tmpGroupedCoreFilters[tmpCoreFilterKey].Stanzas=tmpGroupedCoreFilters[tmpCoreFilterKey].Stanzas.filter(f=>f.length>0);if(tmpGroupedCoreFilters[tmpCoreFilterKey].Stanzas.length>0){let stringConstruct='';if(tmpGroupedCoreFilters[tmpCoreFilterKey].GroupOpen){stringConstruct+=tmpGroupedCoreFilters[tmpCoreFilterKey].GroupJunction=='OR'?'FOPOR~0~(~0~':'FOP~0~(~0~';}stringConstruct+=[tmpGroupedCoreFilters[tmpCoreFilterKey].Junction=='OR'?'FOPOR~0~(~0':'FOP~0~(~0',...tmpGroupedCoreFilters[tmpCoreFilterKey].Stanzas,'FCP~0~)~0'].join('~');if(tmpGroupedCoreFilters[tmpCoreFilterKey].GroupClose){stringConstruct+='~FCP~0~)~0';}tmpCoreFilterStrings.push(stringConstruct);}}if(!tmpCoreEntity){tmpCoreEntity=pFilterState.Entity;}const tmpCoreLoadStep={Type:pFilterState.Mode==='Count'?'MeadowEntityCount':'MeadowEntity',Entity:tmpCoreEntity,Filter:tmpCoreFilterStrings.join('~'),AllRecords:typeof pFilterState.PageSize==='undefined',RecordStartCursor:pFilterState.RecordOffset,Postfix:pFilterState.Postfix||'',Scope:pFilterState.Scope||'',Projection:pFilterState.Projection,PageSize:pFilterState.PageSize,Destination:pFilterState.ResultDestinationAddress};if(pFilterState.UserFilters.length>0){let tmpAllSorts='';let tmpFilter='';for(const tmpUserFilter of pFilterState.UserFilters){let tmpSorts;let tmpSanitizedUserFilter=tmpUserFilter;if(pFilterState.Mode==='Count'){tmpSanitizedUserFilter=this._sanitizeFilterForCount(tmpUserFilter);}else{var _this$_extractSortsFr=this._extractSortsFromFilter(tmpUserFilter);var _this$_extractSortsFr2=_slicedToArray(_this$_extractSortsFr,2);tmpSanitizedUserFilter=_this$_extractSortsFr2[0];tmpSorts=_this$_extractSortsFr2[1];if(tmpSorts){if(tmpAllSorts.length>0){tmpAllSorts+='~';}tmpAllSorts+=tmpSorts;}if(!tmpSanitizedUserFilter){continue;}}if(!tmpSanitizedUserFilter){continue;}if(tmpFilter.length>0){tmpFilter+='~';}// The user-filter and core-filter strings already carry their
|
|
7294
|
+
if(!pFilterState.Filter){pFilterState.Filter=`${pFilterState.Entity||'Unknown'}-${this.pict.getUUID()}`;}tmpBundleConfig.push({Type:'SetStateAddress',StateAddress:`Bundle[${pFilterState.Filter}]`});const tmpGroupedFilters={};const tmpGroupedFilterKeys=[];const tmpGroupedCoreFilters=[];const tmpGroupedCoreFilterKeys=[];let tmpCoreEntity;const tmpCoreFilterStrings=[];for(const tmpFilterGroup of pFilterState.PreparedFilters){for(const tmpFilter of tmpFilterGroup.Filters){if(tmpFilter.CoreEntity){tmpCoreEntity=tmpFilter.Entity;const tmpFilterGUID=`${tmpFilterGroup.GUID}-${tmpFilter.ComputedIndex}`;if(!tmpGroupedCoreFilterKeys.find(v=>v==tmpFilterGUID)){tmpGroupedCoreFilterKeys.push(tmpFilterGUID);}if(!tmpGroupedCoreFilters[tmpFilterGUID]){tmpGroupedCoreFilters[tmpFilterGUID]={Stanzas:[],ComputedIndex:tmpFilter.ComputedIndex,Entity:tmpFilter.Entity,Junction:tmpFilterGroup.Junction||'AND',GroupOpen:tmpFilterGroup.GroupOpen||false,GroupJunction:tmpFilterGroup.GroupJunction||'AND',GroupClose:tmpFilterGroup.GroupClose||false};}tmpGroupedCoreFilters[tmpFilterGUID].Stanzas.push(this._compileSimpleFilterToString(tmpFilter));}else{const tmpFilterGroupGUID=`${tmpFilterGroup.GUID}-${tmpFilter.ComputedIndex}`;if(!tmpGroupedFilterKeys.find(v=>v==tmpFilterGroupGUID)){tmpGroupedFilterKeys.push(tmpFilterGroupGUID);}if(!tmpGroupedFilters[tmpFilterGroupGUID]){tmpGroupedFilters[tmpFilterGroupGUID]={Stanzas:[],ComputedIndex:tmpFilter.ComputedIndex,Entity:tmpFilter.Entity,URLPrefix:tmpFilter.URLPrefix};}tmpGroupedFilters[tmpFilterGroupGUID].Stanzas.push(this._compileSimpleFilterToString(tmpFilter));}}for(const tmpFilterGroupKey of tmpGroupedFilterKeys){tmpGroupedFilters[tmpFilterGroupKey].Stanzas=tmpGroupedFilters[tmpFilterGroupKey].Stanzas.filter(f=>f.length>0);if(tmpGroupedFilters[tmpFilterGroupKey].Stanzas.length>0){tmpBundleConfig.push({Type:'MeadowEntity',AllRecords:true,Entity:tmpGroupedFilters[tmpFilterGroupKey].Entity,URLPrefix:tmpGroupedFilters[tmpFilterGroupKey].URLPrefix,Filter:tmpGroupedFilters[tmpFilterGroupKey].Stanzas.join('~'),Destination:`State[Step${tmpGroupedFilters[tmpFilterGroupKey].ComputedIndex}]`});}}}for(const tmpCoreFilterKey of tmpGroupedCoreFilterKeys){tmpGroupedCoreFilters[tmpCoreFilterKey].Stanzas=tmpGroupedCoreFilters[tmpCoreFilterKey].Stanzas.filter(f=>f.length>0);if(tmpGroupedCoreFilters[tmpCoreFilterKey].Stanzas.length>0){let stringConstruct='';if(tmpGroupedCoreFilters[tmpCoreFilterKey].GroupOpen){stringConstruct+=tmpGroupedCoreFilters[tmpCoreFilterKey].GroupJunction=='OR'?'FOPOR~0~(~0~':'FOP~0~(~0~';}stringConstruct+=[tmpGroupedCoreFilters[tmpCoreFilterKey].Junction=='OR'?'FOPOR~0~(~0':'FOP~0~(~0',...tmpGroupedCoreFilters[tmpCoreFilterKey].Stanzas,'FCP~0~)~0'].join('~');if(tmpGroupedCoreFilters[tmpCoreFilterKey].GroupClose){stringConstruct+='~FCP~0~)~0';}tmpCoreFilterStrings.push(stringConstruct);}}if(!tmpCoreEntity){tmpCoreEntity=pFilterState.Entity;}const tmpCoreLoadStep={Type:pFilterState.Mode==='Count'?'MeadowEntityCount':'MeadowEntity',Entity:tmpCoreEntity,Filter:tmpCoreFilterStrings.join('~'),AllRecords:typeof pFilterState.PageSize==='undefined',RecordStartCursor:pFilterState.RecordOffset,Postfix:pFilterState.Postfix||'',Scope:pFilterState.Scope||'',Projection:pFilterState.Projection,PageSize:pFilterState.PageSize,Destination:pFilterState.ResultDestinationAddress};if(pFilterState.UserFilters.length>0){let tmpAllSorts='';let tmpFilter='';for(const tmpUserFilter of pFilterState.UserFilters){let tmpSorts;let tmpSanitizedUserFilter=tmpUserFilter;if(pFilterState.Mode==='Count'){tmpSanitizedUserFilter=this._sanitizeFilterForCount(tmpUserFilter);}else{var _this$_extractSortsFr=this._extractSortsFromFilter(tmpUserFilter);var _this$_extractSortsFr2=_slicedToArray(_this$_extractSortsFr,2);tmpSanitizedUserFilter=_this$_extractSortsFr2[0];tmpSorts=_this$_extractSortsFr2[1];if(tmpSorts){if(tmpAllSorts.length>0){tmpAllSorts+='~';}tmpAllSorts+=tmpSorts;}if(!tmpSanitizedUserFilter){continue;}}if(!tmpSanitizedUserFilter){continue;}if(tmpFilter.length>0){tmpFilter+='~';}// The user-filter and core-filter strings already carry their
|
|
7278
7295
|
// own paren grouping from the per-group serializer above (the
|
|
7279
7296
|
// `FOP(stanzas)` wrap at line 822). Wrapping a SECOND time here
|
|
7280
7297
|
// produces `FOP(FOP(...))` which meadow-endpoints'
|