systemview 1.11.8 → 1.13.8

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.
Files changed (40) hide show
  1. package/api/Connections.js +27 -6
  2. package/api/connections.txt +1 -1
  3. package/api/index.js +1 -1
  4. package/build/asset-manifest.json +15 -15
  5. package/build/index.html +1 -1
  6. package/build/static/css/main.266787b4.chunk.css +16 -0
  7. package/build/static/css/main.266787b4.chunk.css.map +1 -0
  8. package/build/static/js/2.521d2647.chunk.js +3 -0
  9. package/build/static/js/2.521d2647.chunk.js.LICENSE.txt +87 -0
  10. package/build/static/js/2.521d2647.chunk.js.map +1 -0
  11. package/build/static/js/3.e75f3d01.chunk.js +2 -0
  12. package/build/static/js/3.e75f3d01.chunk.js.map +1 -0
  13. package/build/static/js/main.c351b921.chunk.js +2 -0
  14. package/build/static/js/main.c351b921.chunk.js.map +1 -0
  15. package/build/static/js/{runtime-main.c2e308f2.js → runtime-main.5e778487.js} +2 -2
  16. package/build/static/js/runtime-main.5e778487.js.map +1 -0
  17. package/cli/index.js +14 -8
  18. package/cli/launchApp.js +1 -1
  19. package/cli/openBrowser.js +5 -3
  20. package/cli/runTests.js +60 -48
  21. package/cli/startLineReader.js +4 -5
  22. package/package.json +2 -2
  23. package/testing-utilities/Argument.class.js +2 -2
  24. package/testing-utilities/FullTestController.js +3 -3
  25. package/testing-utilities/Test.class.js +8 -32
  26. package/testing-utilities/createMockFile.js +32 -0
  27. package/testing-utilities/test-helpers.js +59 -29
  28. package/testing-utilities/validators.js +1 -1
  29. package/testing-utilities/validtionMessages.js +18 -19
  30. package/build/static/css/main.fb15c45d.chunk.css +0 -16
  31. package/build/static/css/main.fb15c45d.chunk.css.map +0 -1
  32. package/build/static/js/2.b505d19e.chunk.js +0 -3
  33. package/build/static/js/2.b505d19e.chunk.js.LICENSE.txt +0 -435
  34. package/build/static/js/2.b505d19e.chunk.js.map +0 -1
  35. package/build/static/js/3.9df029f5.chunk.js +0 -2
  36. package/build/static/js/3.9df029f5.chunk.js.map +0 -1
  37. package/build/static/js/main.9330a9fd.chunk.js +0 -2
  38. package/build/static/js/main.9330a9fd.chunk.js.map +0 -1
  39. package/build/static/js/runtime-main.c2e308f2.js.map +0 -1
  40. package/testing-utilities/.DS_Store +0 -0
@@ -1,2 +1,2 @@
1
- !function(e){function t(t){for(var n,i,a=t[0],c=t[1],l=t[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);p.length;)p.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,a=1;a<r.length;a++){var c=r[a];0!==o[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"9df029f5"}[e]+".chunk.js"}(e);var c=new Error;u=function(t){a.onerror=a.onload=null,clearTimeout(l);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),u=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,r[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this.webpackJsonpsystemview=this.webpackJsonpsystemview||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var f=c;r()}([]);
2
- //# sourceMappingURL=runtime-main.c2e308f2.js.map
1
+ !function(e){function t(t){for(var n,i,a=t[0],c=t[1],l=t[2],f=0,p=[];f<a.length;f++)i=a[f],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(s&&s(t);p.length;)p.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,a=1;a<r.length;a++){var c=r[a];0!==o[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"e75f3d01"}[e]+".chunk.js"}(e);var c=new Error;u=function(t){a.onerror=a.onload=null,clearTimeout(l);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),u=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,r[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this.webpackJsonpsystemview=this.webpackJsonpsystemview||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var s=c;r()}([]);
2
+ //# sourceMappingURL=runtime-main.5e778487.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","e","promises","installedChunkData","promise","Promise","resolve","reject","onScriptComplete","script","document","createElement","charset","timeout","nc","setAttribute","src","p","jsonpScriptSrc","error","Error","event","onerror","onload","clearTimeout","chunk","errorType","type","realSrc","target","message","name","request","undefined","setTimeout","head","appendChild","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","oe","err","console","jsonpArray","this","oldJsonpFunction","slice"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAKlC,IAFGe,GAAqBA,EAAoBhB,GAEtCO,EAASC,QACdD,EAASU,OAATV,GAOD,OAHAW,EAAgBJ,KAAKK,MAAMD,EAAiBb,GAAkB,IAGvDe,IAER,SAASA,IAER,IADA,IAAIC,EACIf,EAAI,EAAGA,EAAIY,EAAgBV,OAAQF,IAAK,CAG/C,IAFA,IAAIgB,EAAiBJ,EAAgBZ,GACjCiB,GAAY,EACRC,EAAI,EAAGA,EAAIF,EAAed,OAAQgB,IAAK,CAC9C,IAAIC,EAAQH,EAAeE,GACG,IAA3BX,EAAgBY,KAAcF,GAAY,GAE3CA,IACFL,EAAgBQ,OAAOpB,IAAK,GAC5Be,EAASM,EAAoBA,EAAoBC,EAAIN,EAAe,KAItE,OAAOD,EAIR,IAAIQ,EAAmB,GAKnBhB,EAAkB,CACrBiB,EAAG,GAGAZ,EAAkB,GAQtB,SAASS,EAAoB1B,GAG5B,GAAG4B,EAAiB5B,GACnB,OAAO4B,EAAiB5B,GAAU8B,QAGnC,IAAIC,EAASH,EAAiB5B,GAAY,CACzCK,EAAGL,EACHgC,GAAG,EACHF,QAAS,IAUV,OANAhB,EAAQd,GAAUW,KAAKoB,EAAOD,QAASC,EAAQA,EAAOD,QAASJ,GAG/DK,EAAOC,GAAI,EAGJD,EAAOD,QAKfJ,EAAoBO,EAAI,SAAuBhC,GAC9C,IAAIiC,EAAW,GAKXC,EAAqBvB,EAAgBX,GACzC,GAA0B,IAAvBkC,EAGF,GAAGA,EACFD,EAASrB,KAAKsB,EAAmB,QAC3B,CAEN,IAAIC,EAAU,IAAIC,SAAQ,SAASC,EAASC,GAC3CJ,EAAqBvB,EAAgBX,GAAW,CAACqC,EAASC,MAE3DL,EAASrB,KAAKsB,EAAmB,GAAKC,GAGtC,IACII,EADAC,EAASC,SAASC,cAAc,UAGpCF,EAAOG,QAAU,QACjBH,EAAOI,QAAU,IACbnB,EAAoBoB,IACvBL,EAAOM,aAAa,QAASrB,EAAoBoB,IAElDL,EAAOO,IA1DV,SAAwB/C,GACvB,OAAOyB,EAAoBuB,EAAI,cAAgB,GAAGhD,IAAUA,GAAW,IAAM,CAAC,EAAI,YAAYA,GAAW,YAyD1FiD,CAAejD,GAG5B,IAAIkD,EAAQ,IAAIC,MAChBZ,EAAmB,SAAUa,GAE5BZ,EAAOa,QAAUb,EAAOc,OAAS,KACjCC,aAAaX,GACb,IAAIY,EAAQ7C,EAAgBX,GAC5B,GAAa,IAAVwD,EAAa,CACf,GAAGA,EAAO,CACT,IAAIC,EAAYL,IAAyB,SAAfA,EAAMM,KAAkB,UAAYN,EAAMM,MAChEC,EAAUP,GAASA,EAAMQ,QAAUR,EAAMQ,OAAOb,IACpDG,EAAMW,QAAU,iBAAmB7D,EAAU,cAAgByD,EAAY,KAAOE,EAAU,IAC1FT,EAAMY,KAAO,iBACbZ,EAAMQ,KAAOD,EACbP,EAAMa,QAAUJ,EAChBH,EAAM,GAAGN,GAEVvC,EAAgBX,QAAWgE,IAG7B,IAAIpB,EAAUqB,YAAW,WACxB1B,EAAiB,CAAEmB,KAAM,UAAWE,OAAQpB,MAC1C,MACHA,EAAOa,QAAUb,EAAOc,OAASf,EACjCE,SAASyB,KAAKC,YAAY3B,GAG5B,OAAOJ,QAAQgC,IAAInC,IAIpBR,EAAoB4C,EAAIxD,EAGxBY,EAAoB6C,EAAI3C,EAGxBF,EAAoB8C,EAAI,SAAS1C,EAASiC,EAAMU,GAC3C/C,EAAoBgD,EAAE5C,EAASiC,IAClCvD,OAAOmE,eAAe7C,EAASiC,EAAM,CAAEa,YAAY,EAAMC,IAAKJ,KAKhE/C,EAAoBoD,EAAI,SAAShD,GACX,qBAAXiD,QAA0BA,OAAOC,aAC1CxE,OAAOmE,eAAe7C,EAASiD,OAAOC,YAAa,CAAEC,MAAO,WAE7DzE,OAAOmE,eAAe7C,EAAS,aAAc,CAAEmD,OAAO,KAQvDvD,EAAoBwD,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQvD,EAAoBuD,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,kBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAK7E,OAAO8E,OAAO,MAGvB,GAFA5D,EAAoBoD,EAAEO,GACtB7E,OAAOmE,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOvD,EAAoB8C,EAAEa,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIR3D,EAAoB+D,EAAI,SAAS1D,GAChC,IAAI0C,EAAS1C,GAAUA,EAAOqD,WAC7B,WAAwB,OAAOrD,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAL,EAAoB8C,EAAEC,EAAQ,IAAKA,GAC5BA,GAIR/C,EAAoBgD,EAAI,SAASgB,EAAQC,GAAY,OAAOnF,OAAOC,UAAUC,eAAeC,KAAK+E,EAAQC,IAGzGjE,EAAoBuB,EAAI,IAGxBvB,EAAoBkE,GAAK,SAASC,GAA2B,MAApBC,QAAQ3C,MAAM0C,GAAYA,GAEnE,IAAIE,EAAaC,KAA6B,uBAAIA,KAA6B,wBAAK,GAChFC,EAAmBF,EAAWlF,KAAK2E,KAAKO,GAC5CA,EAAWlF,KAAOf,EAClBiG,EAAaA,EAAWG,QACxB,IAAI,IAAI7F,EAAI,EAAGA,EAAI0F,EAAWxF,OAAQF,IAAKP,EAAqBiG,EAAW1F,IAC3E,IAAIU,EAAsBkF,EAI1B9E,I","file":"static/js/runtime-main.5e778487.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"static/js/\" + ({}[chunkId]||chunkId) + \".\" + {\"3\":\"e75f3d01\"}[chunkId] + \".chunk.js\"\n \t}\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = this[\"webpackJsonpsystemview\"] = this[\"webpackJsonpsystemview\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""}
package/cli/index.js CHANGED
@@ -24,6 +24,7 @@ const DEFAULT_PORT = 3000;
24
24
 
25
25
  async function startApp() {
26
26
  const port = isNaN(input[1]) ? DEFAULT_PORT : input[1];
27
+
27
28
  try {
28
29
  await launchApp(port);
29
30
  } catch (error) {
@@ -33,13 +34,17 @@ async function startApp() {
33
34
  }
34
35
 
35
36
  async function startTest() {
36
- const api = `http://localhost:${DEFAULT_PORT}/systemview/api`;
37
+ const url = `http://localhost:${DEFAULT_PORT}`;
37
38
  input.shift();
38
39
  try {
39
40
  const lineReader = await launchApp(DEFAULT_PORT);
40
41
  setTimeout(async () => {
41
- await runTests(api, ...input);
42
- if (lineReader) lineReader.prompt();
42
+ await runTests(url, ...input);
43
+ if (lineReader) {
44
+ lineReader.prompt();
45
+ } else {
46
+ process.exit(0);
47
+ }
43
48
  }, 0);
44
49
  } catch (error) {
45
50
  console.error("Error executing tests:", error.message);
@@ -47,15 +52,16 @@ async function startTest() {
47
52
  }
48
53
 
49
54
  async function open() {
50
- const port = isNaN(input[1]) ? DEFAULT_PORT : input[1];
55
+ const project_code = input[1];
56
+ const namespace = input[2];
51
57
  const ui = `http://localhost:${DEFAULT_PORT}`;
52
58
  const api = `${ui}/systemview/api`;
53
59
  if (await appIsRunning(api)) {
54
- openBrowser(ui);
60
+ openBrowser(ui, project_code, namespace);
55
61
  process.exit(0);
56
62
  } else {
57
- await launchApp(port);
58
- openBrowser(ui);
63
+ await launchApp(DEFAULT_PORT);
64
+ openBrowser(ui, project_code, namespace);
59
65
  }
60
66
  }
61
67
  async function quitApp() {
@@ -93,7 +99,7 @@ async function quitApp() {
93
99
  cli.showHelp(0);
94
100
  } else if (input.includes("test")) {
95
101
  startTest();
96
- } else if (["exit", "q", "shutdown"].includes(input[0])) {
102
+ } else if (["exit", "q", "shutdown", "stop"].includes(input[0])) {
97
103
  quitApp();
98
104
  } else if (input[0] === "start") {
99
105
  startApp();
package/cli/launchApp.js CHANGED
@@ -9,7 +9,7 @@ module.exports = async function launchApp(port) {
9
9
  function logConnection() {
10
10
  log("connected!", "success");
11
11
  console.log(`SystemView UI running @${ui}`);
12
- console.log(`SystemView API running @${api}`);
12
+ console.log(`SystemView API running @${api}\n`);
13
13
  }
14
14
 
15
15
  if (await appIsRunning(api)) {
@@ -1,14 +1,16 @@
1
1
  const { exec } = require("child_process");
2
2
 
3
- module.exports = function openBrowser(url) {
3
+ module.exports = function openBrowser(url, project_code, namespace) {
4
4
  if (!url || typeof url !== "string" || url.trim() === "") {
5
5
  console.error("Invalid URL provided");
6
6
  return;
7
7
  }
8
8
 
9
9
  const browserCommand = process.platform === "win32" ? "start" : "open";
10
-
11
- exec(`${browserCommand} ${url}`, (error, stdout, stderr) => {
10
+ const code = project_code ? "/" + project_code : "";
11
+ const nsp = code && namespace ? "/" + namespace.replace(/\./g, "/") : "";
12
+ console.log(`opening... ${url}${code}${nsp}`);
13
+ exec(`${browserCommand} ${url}${code}${nsp}`, (error, stdout, stderr) => {
12
14
  if (error) {
13
15
  console.error(`Failed to open browser: ${error.message}`);
14
16
  } else if (stderr) {
package/cli/runTests.js CHANGED
@@ -6,17 +6,14 @@ const validationMessages = require("../testing-utilities/validtionMessages");
6
6
  const { runFullTest } = new FullTestController();
7
7
 
8
8
  const PARTITION =
9
- "-------------------------------------------------------------------------";
9
+ "-----------------------------------------------------------------------------";
10
10
 
11
- module.exports = async function runTests(
12
- api,
13
- project_code,
14
- namespace,
15
- printAll,
16
- trackTime
17
- ) {
11
+ module.exports = async function runTests(url, project_code, namespace) {
12
+ const api = `${url}/systemview/api`;
18
13
  if (!project_code) {
19
- return log("project_code or service_url are required", "warning", "warning");
14
+ log("project_code and/or service_url are required", "warning", "warning");
15
+ console.log(`Example -> systemview test myAPI Users`);
16
+ return;
20
17
  }
21
18
  // get connected services from the systemview api
22
19
  const connectedServices = await getConnectedServices(api, project_code);
@@ -34,7 +31,6 @@ module.exports = async function runTests(
34
31
  }
35
32
 
36
33
  const testsReceived = await getTests(connectedServices);
37
-
38
34
  const testToRun = !namespace
39
35
  ? testsReceived
40
36
  : testsReceived
@@ -46,61 +42,71 @@ module.exports = async function runTests(
46
42
  .filter((testList) => testList.length);
47
43
 
48
44
  if (testToRun.length) {
49
- const executeTest = async (savedTests) => {
50
- const tests = initializeSavedTests(savedTests, connectedServices);
51
- await runAllTests(tests, trackTime);
52
- };
53
-
45
+ const summary = {};
54
46
  await new Promise((resolve) => {
55
47
  async function recursiveExecuteTest(i = 0) {
56
48
  if (i === testToRun.length) resolve();
57
49
  else {
58
50
  const { serviceId } = testToRun[i][0].namespace;
59
51
  log(`Initializing Tests...`, "info", serviceId);
60
- executeTest(testToRun[i]).then(() => recursiveExecuteTest(i + 1));
52
+
53
+ try {
54
+ const tests = initializeSavedTests(testToRun[i], connectedServices);
55
+ summary[serviceId] = await runAllTests(tests, url, project_code);
56
+ } catch (error) {
57
+ log(`Unexpected error halting test`, "error", serviceId);
58
+ } finally {
59
+ recursiveExecuteTest(i + 1);
60
+ }
61
61
  }
62
62
  }
63
63
  recursiveExecuteTest();
64
64
  });
65
+ console.log(PARTITION);
66
+ console.log(PARTITION);
67
+ log("TEST COMPLETE!", "info");
68
+ for (let key in summary) {
69
+ const { passed, failed } = summary[key];
70
+ log(
71
+ `tests: ${passed + failed}, passed: ${passed}, failed: ${failed}`,
72
+ failed ? "error" : "success",
73
+ key
74
+ );
75
+ }
65
76
  } else {
66
77
  log(`No tests found matching ${project_code} ${namespace}`, "warning", "warning");
67
78
  }
68
79
  };
69
80
 
70
- const Logger = function (trackTime) {
71
- this.start = (test) => {
72
- // if (trackTime) {
73
- // console.log
74
- // }
75
- };
76
-
77
- this.end = ({ errors, results, namespace, title }) => {
78
- // const { moduleName, methodName, serviceId } = namespace;
79
- // if (errors.length) {
80
- // log(title, "error", "failed");
81
- // console.error(results);
82
- // errors.forEach((err) => console.log(validationMessages(err)));
83
- // } else {
84
- // log(title, "success", "passed");
85
- // console.log(`${serviceId}.${moduleName}.${methodName}(...)`);
86
- // }
87
- };
88
- };
89
-
90
- const runAllTests = async (savedTest, trackTime) => {
81
+ const runAllTests = async (savedTest, url, project_code) => {
82
+ const sum = { passed: 0, failed: 0 };
91
83
  const runTest = async ({ Before, Main, Events, After }) => {
92
84
  const fullTest = [Before, Main, Events, After];
93
- await runFullTest(fullTest, new Logger(trackTime));
94
85
  const { namespace } = Main[0];
95
- const { moduleName, methodName } = namespace;
86
+ const { moduleName, methodName, serviceId } = namespace;
96
87
 
97
- log(`Testing: ${moduleName}.${methodName}(...)`, "info", namespace.serviceId);
98
88
  console.log(PARTITION);
89
+ log(
90
+ `testing -> ${serviceId}.${moduleName}.${methodName}(...)`,
91
+ "info",
92
+ namespace.serviceId
93
+ );
94
+ console.log(
95
+ `systemview ui -> @${url}/${project_code}/${serviceId}/${moduleName}/${methodName}`
96
+ );
99
97
  console.log(PARTITION);
100
- logTestSection(Before, "Before");
101
- logTestSection(Main, "Main", true);
102
- logTestSection(Events, "Events");
103
- logTestSection(After, "After");
98
+
99
+ await runFullTest(fullTest);
100
+ if (
101
+ logResults(Before, "Before") +
102
+ logResults(Main, "Main", true) +
103
+ logResults(Events, "Events") +
104
+ logResults(After, "After")
105
+ ) {
106
+ sum.failed++;
107
+ } else {
108
+ sum.passed++;
109
+ }
104
110
  };
105
111
 
106
112
  await new Promise((resolve) => {
@@ -110,21 +116,27 @@ const runAllTests = async (savedTest, trackTime) => {
110
116
  }
111
117
  recursiveRunTest();
112
118
  });
113
- };
114
119
 
115
- function logTestSection(tests, section, logSuccess = false) {
116
- tests.forEach(({ errors, results, namespace, title, response_type }, i) => {
120
+ return sum;
121
+ };
122
+ function logResults(tests, section, logSuccess = false) {
123
+ let failed = 0;
124
+ tests.forEach(({ errors, results, namespace, title, response_type }) => {
117
125
  const { serviceId, moduleName, methodName } = namespace;
118
126
  const LOG_TYPE = errors.length ? "error" : "success";
119
127
  const LABEL = LOG_TYPE === "error" ? "FAILED" : "PASSED";
128
+
120
129
  if (LOG_TYPE === "error" || logSuccess) {
121
130
  log(title, "info", section + ":");
122
131
  log(`${serviceId}.${moduleName}.${methodName}(...)`, LOG_TYPE, `${LABEL}`);
123
132
  console.log(`${response_type}:`, results);
133
+ errors.length && log(`${errors.length} errors`, "warning", "validations");
124
134
  errors.forEach((err) => console.log(`-> ${validationMessages(err)}`));
125
135
  console.log(PARTITION);
136
+ if (!failed && errors.length) failed = 1;
126
137
  }
127
138
  });
139
+ return failed;
128
140
  }
129
141
  async function getTests(connectedServices) {
130
142
  return await new Promise(async (resolve) => {
@@ -136,7 +148,7 @@ async function getTests(connectedServices) {
136
148
  try {
137
149
  results.push(await Client.createService(connectionData).Plugin.getTests());
138
150
  } catch (error) {
139
- console.log(`Failed to retrieve test from:${connectionData.serviceUrl}`);
151
+ console.log(`Failed to retrieve test from:${connectionData.serviceUrl}:\n`);
140
152
  }
141
153
 
142
154
  await recursiveGetTests(i + 1);
@@ -3,8 +3,7 @@ const cli = require("./utils/cli");
3
3
  const openBrowser = require("./openBrowser");
4
4
  const readline = require("readline");
5
5
 
6
- module.exports = function startLineReader(ui) {
7
- const api = `${ui}/systemview/api`;
6
+ module.exports = function startLineReader(url) {
8
7
  const lineReader = readline.createInterface({
9
8
  input: process.stdin,
10
9
  output: process.stdout,
@@ -12,18 +11,18 @@ module.exports = function startLineReader(ui) {
12
11
  const handleInput = (input = "") => {
13
12
  const args = input.split(" ").map((s) => s.trim());
14
13
  const command = args.shift();
15
- if (["exit", "q", "shutdown"].includes(command)) {
14
+ if (["exit", "q", "shutdown", "stop"].includes(command)) {
16
15
  process.exit(0);
17
16
  } else if (command === "test") {
18
17
  try {
19
- runTests(api, ...args);
18
+ runTests(url, ...args);
20
19
  } catch (error) {
21
20
  console.error("Error executing tests:", error.message);
22
21
  }
23
22
  } else if (command === "help") {
24
23
  cli.showHelp(0);
25
24
  } else if (command === "open") {
26
- openBrowser(ui);
25
+ openBrowser(url, ...args);
27
26
  }
28
27
  lineReader.prompt();
29
28
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "systemview",
3
3
  "description": "A documentation and testing suite for SystemLynx",
4
- "version": "1.11.8",
4
+ "version": "1.13.8",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {
7
7
  "systemview": "cli/index.js"
@@ -30,7 +30,7 @@
30
30
  "react-syntax-highlighter": "^15.5.0",
31
31
  "readline": "^1.3.0",
32
32
  "remark-gfm": "^3.0.1",
33
- "systemlynx": "^1.10.6",
33
+ "systemlynx": "^1.11.8",
34
34
  "web-vitals": "^0.2.4"
35
35
  },
36
36
  "scripts": {
@@ -55,7 +55,7 @@ function Argument(name, FullTest, input_type = "undefined", input, targetValues
55
55
  //keep if the target value string still exist on this.input...
56
56
  this.targetValues = this.targetValues.filter(
57
57
  ({ target_namespace, source_map, source_index }) => {
58
- const value = obj(this).valueAt(source_map);
58
+ const value = obj(this).get(source_map);
59
59
  return (
60
60
  typeof value === "string" &&
61
61
  value.indexOf(target_namespace, source_index) === source_index
@@ -83,7 +83,7 @@ function Argument(name, FullTest, input_type = "undefined", input, targetValues
83
83
  .replace(test, { beforeTest: 0, mainTest: 1, Events: 2, afterTest: 3 }[test])
84
84
  .replace(action, parseInt(action.replace("Action", "")) - 1)
85
85
  .replace("error", "results");
86
- return obj(FullTest).valueAtNsp(nsp);
86
+ return obj(FullTest).get(nsp);
87
87
  };
88
88
  }
89
89
 
@@ -3,13 +3,13 @@ const Test = require("./Test.class");
3
3
  const sections = ["Before", "Main", "Events", "After"];
4
4
 
5
5
  module.exports = function FullTestController({ FullTest, connectedServices } = {}) {
6
- this.runFullTest = async ([Before, Main, Events, After] = FullTest || [], Logger) => {
7
- Events.forEach((test) => test.runTest(Logger));
6
+ this.runFullTest = async ([Before, Main, Events, After] = FullTest || []) => {
7
+ Events.forEach((test) => test.runTest());
8
8
 
9
9
  await new Promise((resolve) => {
10
10
  function recursiveRunTest(tests, i = 0) {
11
11
  if (i === tests.length) resolve();
12
- else tests[i].runTest(Logger).then(() => recursiveRunTest(tests, i + 1));
12
+ else tests[i].runTest().then(() => recursiveRunTest(tests, i + 1));
13
13
  }
14
14
  recursiveRunTest([...Before, ...Main, ...After]);
15
15
  });
@@ -11,6 +11,7 @@ module.exports = function Test({
11
11
  savedEvaluations = [],
12
12
  index,
13
13
  editMode = true,
14
+ logger,
14
15
  }) {
15
16
  this.index = index;
16
17
  this.connection = {};
@@ -49,8 +50,7 @@ module.exports = function Test({
49
50
 
50
51
  this.validate = validateResults.bind(this);
51
52
 
52
- this.runTest = async (_logger) => {
53
- const logger = _logger || new TestLogger(this);
53
+ this.runTest = async () => {
54
54
  const { serviceId, moduleName, methodName } = this.namespace;
55
55
  const args = this.args.map((arg) => arg.value());
56
56
 
@@ -62,25 +62,25 @@ module.exports = function Test({
62
62
  this.test_end = moment().toJSON();
63
63
  this.response_type = "event";
64
64
  this.shouldValidate && this.validate();
65
- logger.end(this);
66
- Module.$clearEvent(args[0], "eventTest");
65
+ if (logger) logger.end(this);
66
+ Module.$clearEvent(args[0], eventTest);
67
67
  };
68
- logger.start(args);
68
+ if (logger) logger.start(args);
69
69
  Module.on(args[0], eventTest);
70
70
  } else {
71
71
  try {
72
- logger.start(args);
72
+ if (logger) logger.start(args);
73
73
  this.results = await Module[methodName](...args);
74
74
  this.test_end = moment().toJSON();
75
75
  this.response_type = "results";
76
76
  this.shouldValidate && this.validate();
77
- logger.end(this);
77
+ if (logger) logger.end(this);
78
78
  } catch (error) {
79
79
  this.test_end = moment().toJSON();
80
80
  this.results = error;
81
81
  this.response_type = "error";
82
82
  this.shouldValidate && this.validate();
83
- logger.end(this);
83
+ if (logger) logger.end(this);
84
84
  }
85
85
  }
86
86
  return this;
@@ -137,27 +137,3 @@ module.exports = function Test({
137
137
  );
138
138
  };
139
139
  };
140
-
141
- function TestLogger(test) {
142
- this.start = (args) => {
143
- const { serviceId, moduleName, methodName } = test.namespace;
144
-
145
- console.log(
146
- `[${moment(this.test_start).format(
147
- "L LTS"
148
- )}]> [invoking]:${serviceId}.${moduleName}.${methodName}()`
149
- );
150
- console.log.apply({}, ["args:"].concat(args));
151
- };
152
- this.end = () => {
153
- const { serviceId, moduleName, methodName } = test.namespace;
154
- const { results, response_type } = test;
155
- console.log(
156
- `[${moment(this.test_end).format(
157
- "L LTS"
158
- )}]> [${response_type}]:${serviceId}.${moduleName}.${methodName}()`,
159
- `${response_type}:`,
160
- results
161
- );
162
- };
163
- }
@@ -0,0 +1,32 @@
1
+ const fs = require("fs");
2
+ const fileTypes = {
3
+ txt: "text/plain",
4
+ csv: "text/csv",
5
+ json: "application/json",
6
+ pdf: "application/pdf",
7
+ doc: "application/msword",
8
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
9
+ xls: "application/vnd.ms-excel",
10
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
11
+ ppt: "application/vnd.ms-powerpoint",
12
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
13
+ jpg: "image/jpeg",
14
+ jpeg: "image/jpeg",
15
+ png: "image/png",
16
+ gif: "image/gif",
17
+ svg: "image/svg+xml",
18
+ };
19
+ module.exports = function createMockFile(fileName) {
20
+ // Split the file name and extension
21
+ const fileParts = fileName.split(".");
22
+ const fileExtension = fileParts.pop();
23
+ const fileNameWithoutExtension = fileParts.join(".");
24
+
25
+ if (fileTypes[fileExtension]) {
26
+ const fileContent = `Mock content for ${fileNameWithoutExtension}.${fileExtension}`;
27
+ fs.writeFileSync(fileName, fileContent);
28
+ return fs.readFileSync(fileName);
29
+ } else {
30
+ return null;
31
+ }
32
+ };
@@ -1,15 +1,16 @@
1
1
  const moment = require("moment");
2
+ const createMockFile = require("./createMockFile");
2
3
  moment.suppressDeprecationWarnings = true;
3
4
  const rnb = (min, max) => Math.floor(Math.random() * (max - min + 1) + min);
4
5
 
5
6
  const isTargetNamespace = (str) =>
6
- /^(?:before|main|after)Test\.Action\d+\.(?:error|results)(?:\.(?![0-9])[a-zA-Z0-9$_]+(?:\[\d\])*)*$/.test(
7
+ /^(?:before|main|after)Test\.Action\d+\.(?:error|results)(?:\[(?:\d+)\]|\.(?:(?![0-9])[a-zA-Z0-9$_]+(?:\[(?:\d+)\])?))*$/.test(
7
8
  str
8
9
  );
9
10
  const targetValueFnRegex =
10
- /tv\((?:before|main|after)Test\.Action\d+\.(?:error|results)(?:\.(?![0-9])[a-zA-Z0-9$_]+(?:\[\d\])*)*\)/g;
11
+ /tv\((?:before|main|after)Test\.Action\d+\.(?:error|results)(?:\[(?:\d+)\]|\.(?:(?![0-9])[a-zA-Z0-9$_]+(?:\[(?:\d+)\])?))*\)/g;
11
12
  const isTargetValueFn = (str) =>
12
- /^tv\((?:before|main|after)Test\.Action\d+\.(?:error|results)(?:\.(?![0-9])[a-zA-Z0-9$_]+(?:\[\d\])*)*\)$/.test(
13
+ /^tv\((?:before|main|after)Test\.Action\d+\.(?:error|results)(?:\[(?:\d+)\]|\.(?:(?![0-9])[a-zA-Z0-9$_]+(?:\[(?:\d+)\])?))*\)$/.test(
13
14
  str
14
15
  );
15
16
  const isEqualArrays = (a, b) => a.join(".") === b.join("."); //specifically for arrays of strings
@@ -54,22 +55,47 @@ const switchArrayIndices = (nsp, replace) => {
54
55
  };
55
56
 
56
57
  //separate prop names from other prop names and indices (ie. 'test.results[0][0]'...);
57
- const mapNamespace = (nsp) =>
58
- nsp
59
- .replace(/(?:\.|\[|\])/g, " ")
60
- .split(" ")
61
- .reduce((sum, str) => sum.concat(str.trim() || []), []);
58
+ const mapNamespace = (nsp) => nsp.split(/(?:\.|\[|\])/g).filter((str) => str.trim());
62
59
 
63
60
  const obj = function ObjectParser(obj) {
64
61
  const parser = this || {};
65
- parser.parse = (map) =>
66
- map.reduce(([placeholder], key) => [placeholder?.[key], placeholder, key], [obj]);
67
-
68
- parser.valueAt = (map) => parser.parse(map)[0];
69
-
70
- parser.valueAtNsp = (nsp) => parser.valueAt(mapNamespace(nsp));
71
-
72
- parser.parseNsp = (nsp) => parser.parse(mapNamespace(nsp));
62
+ const parseObject = (keys) =>
63
+ keys.reduce(([placeholder], key) => [placeholder?.[key], placeholder, key], [obj]);
64
+
65
+ parser.parse = (keys) => {
66
+ if (Array.isArray(keys)) {
67
+ return parseObject(keys);
68
+ } else if (typeof keys === "string") {
69
+ return parseObject(mapNamespace(keys));
70
+ } else
71
+ throw Error(
72
+ "ObjectParser.parse requires a string namespace or an array of keys a the first parameter."
73
+ );
74
+ };
75
+
76
+ parser.get = (keys) => {
77
+ if (Array.isArray(keys)) {
78
+ return parseObject(keys)[0];
79
+ } else if (typeof keys === "string") {
80
+ return parseObject(mapNamespace(keys))[0];
81
+ } else
82
+ throw Error(
83
+ "ObjectParser.get requires a string namespace or an array of keys a the first parameter."
84
+ );
85
+ };
86
+
87
+ parser.apply = (keys, newValue) => {
88
+ if (Array.isArray(keys)) {
89
+ const [currentValue, placeholder, key] = parseObject(keys);
90
+ placeholder[key] = newValue;
91
+ } else if (typeof keys === "string") {
92
+ const [currentValue, placeholder, key] = parseObject(mapNamespace(keys));
93
+ placeholder[key] = newValue;
94
+ } else
95
+ throw Error(
96
+ "ObjectParser.apply requires a string namespace or an array of keys a the first parameter."
97
+ );
98
+ };
73
99
  //using JSON to create a deep copy in order to lose refs to original
74
100
  parser.clone = () => JSON.parse(JSON.stringify(obj));
75
101
 
@@ -87,19 +113,6 @@ const arr = function ArrayParser(arr) {
87
113
  return parser;
88
114
  };
89
115
 
90
- const isFn = /^\w+\(([^,)]*(,[^,)]*)*)\)$/;
91
- const parseArgs = (str) => str.split(",").map((value) => value.trim());
92
- const isFunction = (str) => isFn.test(str);
93
- const isDateFunction = (str) => /^[dD]ate\(([^,)]*(,[^,)]*)*)\)$/.test(str);
94
-
95
- const strFn = (str) => {
96
- if (isDateFunction(str)) {
97
- const [fullStr, args] = str.match(isFn);
98
- return moment(args).toJSON();
99
- }
100
-
101
- return str;
102
- };
103
116
  function getType(value) {
104
117
  switch (true) {
105
118
  case typeof value === "object":
@@ -121,6 +134,23 @@ function getType(value) {
121
134
  }
122
135
  const isObjectLike = (value) =>
123
136
  ["object", "array", "string"].indexOf(getType(value)) > -1;
137
+
138
+ const isFnRegEx = /^\w+\(([^,)]*(,[^,)]*)*)\)$/;
139
+ const parseArgs = (str) => str.split(",").map((value) => value.trim());
140
+ const isFunction = (str) => isFnRegEx.test(str);
141
+ const isDateFunction = (str) => /^[dD]ate\(([^,)]*(,[^,)]*)*)\)$/.test(str);
142
+ const isMockFileFunction = (str) => /^mockFile\(([^,)]*(,[^,)]*)*)\)$/.test(str);
143
+ const strFn = (str) => {
144
+ if (isDateFunction(str)) {
145
+ const [fullStr, args] = str.match(isFnRegEx);
146
+ return moment(args).toJSON();
147
+ }
148
+ if (isMockFileFunction(str)) {
149
+ const [fullStr, args] = str.match(isFnRegEx);
150
+ return createMockFile(args);
151
+ }
152
+ return str;
153
+ };
124
154
  module.exports = {
125
155
  rnb,
126
156
  isObjectLike,
@@ -89,7 +89,7 @@ function validateResults() {
89
89
  //evaluate based on the saved evaluations
90
90
  const objParser = new obj({ [response_type]: results });
91
91
  savedEvalClone.forEach(({ namespace, ...e }) => {
92
- const value = objParser.valueAtNsp(namespace);
92
+ const value = objParser.get(namespace);
93
93
  if (e.save) addEvaluation(evaluate(value, namespace, e));
94
94
  });
95
95