@sassoftware/restaflib 5.3.3-6 → 5.3.3-7

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/restaflib.js CHANGED
@@ -984,7 +984,7 @@ eval("/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_
984
984
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
985
985
 
986
986
  "use strict";
987
- eval("/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"../../../node_modules/@babel/runtime/regenerator/index.js\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _caslRun__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../caslRun */ \"./caslRun.js\");\n/*\r\n* Copyright © 2023, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.\r\n* SPDX-License-Identifier: Apache-2.0\r\n*/\n\n\n\n\n\nfunction uploadSrc(_x, _x2, _x3, _x4, _x5) {\n return _uploadSrc.apply(this, arguments);\n}\nfunction _uploadSrc() {\n _uploadSrc = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee(store, session, modelBuf, fileInfo, save) {\n var _fileInfo$output, caslib, name, rx, JSON_Parameters, p, r, casl, _r, text;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _fileInfo$output = fileInfo.output, caslib = _fileInfo$output.caslib, name = _fileInfo$output.name;\n if (!(name == null)) {\n _context.next = 3;\n break;\n }\n throw 'Please specify table as caslib.name';\n case 3:\n _context.next = 5;\n return cleanup(store, session, caslib, name);\n case 5:\n rx = _context.sent;\n JSON_Parameters = {\n casout: {\n caslib: caslib,\n /* a valid caslib */\n name: name /* name of output file on cas server */\n },\n importOptions: {\n fileType: fileInfo.fileType /* type of the file being uploaded */\n }\n };\n if (fileInfo.fileExt === 'sas' || fileInfo.fileExt === 'ds2') {\n JSON_Parameters.importOptions.delimiter = '\\\\';\n }\n p = {\n headers: {\n 'JSON-Parameters': JSON_Parameters,\n 'Content-Type': 'binary/octet-stream'\n },\n data: modelBuf,\n action: 'table.upload'\n };\n _context.next = 11;\n return store.runAction(session, p);\n case 11:\n r = _context.sent;\n if (!(save === true)) {\n _context.next = 17;\n break;\n }\n casl = \"\\n\\t\\t\\n\\t\\t\\taction table.save r = result / \\n\\t\\t\\t\\ttable = {caslib='\".concat(caslib, \"' name='\").concat(name, \"'} \\n\\t\\t\\t\\tcaslib='\").concat(caslib, \"' replace=true;\\n\\t\\t\\t\\n\\t\\t\\taction table.loadTable r = result2 /\\n\\t\\t\\t\\tcaslib='\").concat(caslib, \" casout={caslib='\").concat(caslib, \"' name='\").concat(name, \"' replace=true} \\n\\t\\t\\t\\tpath='\").concat(name, \".sashdat' ;\\n\\t\\t\\t\\tsend_response({save=result, load= result2});\\n\\n\\t\\t\\n\\t\\t send_response({status=result});\\n\\t\\t\\t\");\n _context.next = 16;\n return Object(_caslRun__WEBPACK_IMPORTED_MODULE_2__[/* default */ \"a\"])(store, session, casl, null, true);\n case 16:\n _r = _context.sent;\n case 17:\n text = fileInfo.source == null ? \"inline source\" : fileInfo.source;\n return _context.abrupt(\"return\", r);\n case 19:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return _uploadSrc.apply(this, arguments);\n}\nfunction cleanup(_x6, _x7, _x8, _x9) {\n return _cleanup.apply(this, arguments);\n}\nfunction _cleanup() {\n _cleanup = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2(store, session, caslib, name) {\n var table, deleteSrc, r;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n table = \"\".concat(caslib, \".\").concat(name);\n deleteSrc = \"\\n\\t\\taction table.dropTable/ \\n caslib='\".concat(caslib, \"' name='\").concat(name, \"' quiet=TRUE; \\n \\n action table.deleteSource status=src / \\n caslib='casuser' source= '\").concat(name, \".sashdat' quiet=TRUE; \\n\\t\\tsend_response({casResults = {status=src, results= 'data deleted'}})\\n\\t\\t\");\n _context2.next = 4;\n return Object(_caslRun__WEBPACK_IMPORTED_MODULE_2__[/* default */ \"a\"])(store, session, deleteSrc);\n case 4:\n r = _context2.sent;\n return _context2.abrupt(\"return\", r);\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _cleanup.apply(this, arguments);\n}\n/* harmony default export */ __webpack_exports__[\"a\"] = (uploadSrc);\n\n//# sourceURL=webpack://restaflib/./uploadHandlers/uploadSrc.js?");
987
+ eval("/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"../../../node_modules/@babel/runtime/regenerator/index.js\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _caslRun__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../caslRun */ \"./caslRun.js\");\n/*\r\n* Copyright © 2023, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.\r\n* SPDX-License-Identifier: Apache-2.0\r\n*/\n\n\n\n\n\nfunction uploadSrc(_x, _x2, _x3, _x4, _x5) {\n return _uploadSrc.apply(this, arguments);\n}\nfunction _uploadSrc() {\n _uploadSrc = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee(store, session, modelBuf, fileInfo, save) {\n var _fileInfo$output, caslib, name, rx, JSON_Parameters, p, r, casl, _r, text;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _fileInfo$output = fileInfo.output, caslib = _fileInfo$output.caslib, name = _fileInfo$output.name;\n if (!(name == null)) {\n _context.next = 3;\n break;\n }\n throw 'Please specify table as caslib.name';\n case 3:\n _context.next = 5;\n return cleanup(store, session, caslib, name);\n case 5:\n rx = _context.sent;\n JSON_Parameters = {\n casout: {\n caslib: caslib,\n /* a valid caslib */\n name: name /* name of output file on cas server */\n },\n importOptions: {\n fileType: fileInfo.fileType /* type of the file being uploaded */\n }\n };\n if (fileInfo.fileExt === 'sas' || fileInfo.fileExt === 'ds2') {\n JSON_Parameters.importOptions.delimiter = '\\\\';\n }\n p = {\n headers: {\n 'JSON-Parameters': JSON_Parameters,\n 'Content-Type': 'binary/octet-stream'\n },\n data: modelBuf,\n action: 'table.upload'\n };\n _context.next = 11;\n return store.runAction(session, p);\n case 11:\n r = _context.sent;\n if (!(save === true)) {\n _context.next = 17;\n break;\n }\n casl = \"\\n\\t\\t\\n\\t\\t\\taction table.save r = result / \\n\\t\\t\\t\\ttable = {caslib='\".concat(caslib, \"' name='\").concat(name, \"'} \\n\\t\\t\\t\\tcaslib='\").concat(caslib, \"' name='\").concat(name, \"' replace=true;\\n\\t\\t\\t\\n\\t\\t\\taction table.loadTable r = result2 /\\n\\t\\t\\t\\tcaslib='\").concat(caslib, \"' casout={caslib='\").concat(caslib, \"' name='\").concat(name, \"' replace=true} \\n\\t\\t\\t\\tpath='\").concat(name, \".sashdat' ;\\n\\n\\t\\t\\n\\t\\t send_response({status=result2});\\n\\t\\t\\t\");\n _context.next = 16;\n return Object(_caslRun__WEBPACK_IMPORTED_MODULE_2__[/* default */ \"a\"])(store, session, casl, null, true);\n case 16:\n _r = _context.sent;\n case 17:\n text = fileInfo.source == null ? \"inline source\" : fileInfo.source;\n return _context.abrupt(\"return\", r);\n case 19:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return _uploadSrc.apply(this, arguments);\n}\nfunction cleanup(_x6, _x7, _x8, _x9) {\n return _cleanup.apply(this, arguments);\n}\nfunction _cleanup() {\n _cleanup = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2(store, session, caslib, name) {\n var table, deleteSrc, r;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n table = \"\".concat(caslib, \".\").concat(name);\n deleteSrc = \"\\n\\t\\taction table.dropTable/ \\n caslib='\".concat(caslib, \"' name='\").concat(name, \"' quiet=TRUE; \\n \\n action table.deleteSource status=src / \\n caslib='casuser' source= '\").concat(name, \".sashdat' quiet=TRUE; \\n\\t\\tsend_response({casResults = {status=src, results= 'data deleted'}})\\n\\t\\t\");\n _context2.next = 4;\n return Object(_caslRun__WEBPACK_IMPORTED_MODULE_2__[/* default */ \"a\"])(store, session, deleteSrc);\n case 4:\n r = _context2.sent;\n return _context2.abrupt(\"return\", r);\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _cleanup.apply(this, arguments);\n}\n/* harmony default export */ __webpack_exports__[\"a\"] = (uploadSrc);\n\n//# sourceURL=webpack://restaflib/./uploadHandlers/uploadSrc.js?");
988
988
 
989
989
  /***/ }),
990
990
 
@@ -1,4 +1,4 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("restaflib",[],e):"object"==typeof exports?exports.restaflib=e():t.restaflib=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=12)}([function(t,e,n){var r=n(13)();t.exports=r;try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(t,e){function n(t,e,n,r,a,s,o){try{var i=t[s](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,a)}t.exports=function(t){return function(){var e=this,r=arguments;return new Promise((function(a,s){var o=t.apply(e,r);function i(t){n(o,a,s,i,u,"next",t)}function u(t){n(o,a,s,i,u,"throw",t)}i(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";var r=n(9),a=n.n(r);var s=function(){return"\n print _args_;\n\n results = casFetchRows(_args_.table.caslib, _args_.table.name , _args_.start + 1, _args_.limit, _args_.format, _args_.where); \n send_response({casResults = results}); \n \n function casFetchRows(caslib, name, from, count, format, where) ; \n \n rc = checkAndLoadTable(caslib, name);\n \n if (rc ne true) then do;\n text = 'Unable to access ' ||caslib||'.'||name; \n rx = {severity=2,reason=6, status='error',statusCode=2, formatted=text};\n exit(rx); \n end; \n\n /*\n * get tableoinfo to get rowCount\n */\n\n action table.tableinfo r= result/ \n caslib = caslib \n name = name; \n \n rowCount = result.TableInfo[1, 'rows'];\n to = from + count - 1;\n\n \n /*\n * get column information\n */\n\n action table.columninfo r=infoResult /\n table = {caslib=caslib name=name};\n\n columns ={{Column='_Index_',ID=0,Type='double',RawLength=5,FormattedLength=5,NFL=0,NFD=0}};\n i = 2;\n do c over inforesult.columninfo;\n columns[i] = c;\n i = i + 1;\n end;\n \n /*\n * Fetch the current set of rows\n */\n\n rows = {};\n if (from <= rowCount) then do;\n action table.fetch r = result status=rcx/ \n table = {caslib=caslib, name=name where=where} \n from= from to=to format=format sastypes=true\n ;\n if (rcx.severity eq 2) then do;\n exit(rcx);\n end;\n /* \n * create payload to return\n */\n\n i = 1;\n rows ={};\n do row over result.fetch;\n rr = {};\n j = 1;\n do key,v over row;\n rr[j] = override(columns[j].Type, v);\n j = j + 1;\n end;\n rows[i] = rr;\n i = i + 1;\n end;\n end;\n\n currentCount = DIM(rows);\n pagination = {}; \n table = {caslib=caslib, name=name};\n\n pagination = setPagination(from, count, format, where, currentCount, rowCount, table);\n \n lastRequest={start=from-1, limit=count, format=format, currentCount=currentCount, \n rowCount=rowCount, where=where, table=table, version='3'};\n scrollOptions = getKeys(pagination);\n return( \n {pagination = pagination, data = {schema=columns, rows=rows , scrollOptions=scrollOptions}, lasRequest=lastRequest}\n );\n end; \n \n \n /*\n * For non-primary column types set new content\n */\n\n function setPagination(from, count, format, where, currentCount, rowCount, table);\n\n\n prevStart = max(from - count - 1, 0);\n\n if (currentCount lt count) then do; \n pagination.prev = {start=prevStart, limit=count, format=format, where=' ', table=table};\n if (prevStart ne 0) then do;\n pagination.first = {start=0, limit=count, format=format, where=' ', table=table};\n end; \n return pagination;\n end;\n currentStart = from -1;\n if (currentStart eq 0) then do;\n pagination.next = {start=count, limit=count, format=format, where=' ', table=table};\n return pagination;\n end;\n\n nextStart = currentStart + count;\n pagination.next = {start=nextStart, limit=count, format=format, where=' ', table=table};\n pagination.prev = {start=prevStart, limit=count, format=format, where=' ', table=table};\n if (prevStart ne 0) then do;\n pagination.first = {start=0, limit=count, format=format, where=' ', table=table};\n end; \n return pagination;\n end;\n\n\n\n\n function override(type, iv);\n if (type EQ 'varbinary') then v = '...varbinary';\n else if (type EQ 'blob') then v = '...blob';\n else if (type EQ 'table') then v = '...table';\n else if (type EQ 'dictionary') then v = '...dictionary';\n else if (type EQ 'list') then v = '...list';\n else if (type EQ 'isArray') then v = '...array';\n else v = iv;\n return v;\n end;\n\n \n "};var o=function(){return"\n function checkAndLoadTable(caslib, name); \n \n /* verify caslib is there */\n table.queryCaslib status=status result=result/\n caslib = caslib;\n do k,v over result; /* to handle casuser[user] */ \n rc = v;\n end;\n if ( rc eq false ) then \n return -1;\n /* \n * Check to see if table is already loaded \n */ \n action table.tableExists r=result/ \n caslib = caslib \n name = name; \n /* \n * if not loaded then try to load it \n */ \n rc = true;\n if (result.exists eq 0 or result.exists eq 2) then do; \n path = lookupPath(caslib, name);\n if (path eq '*') then do;\n rc = false;\n end;\n else do;\n action table.loadTable status=status/ \n caslib = caslib \n source = path \n casout={caslib= caslib name=name}; \n if (status.statusCode ne 0 ) then rc = false;\n end; \n end; \n return rc; \n end; \n \n function saveAndLoadTable(caslib, source, targetlib, targetname,promote);\n \n /* load source */\n r = checkAndLoadTable(caslib, source);\n \n sashdat = target||\".sashdat\";\n table.save /\n caslib= targetlib name=sashdat\n table = {caslib=caslib name=source} replace=true;\n \n table.droptable /\n caslib=targetlib name=target quiet=true;\n \n table.loadtable result=r status=rc/\n caslib=targetlib casout={caslib=targetlib name=target replace=TRUE}\n path=sashdat;\n \n if (promote eq true) then do;\n table.promote result=r status=rc/\n caslib=caslib name=target quiet=true\n targetLib=caslib target=target;\n end;\n if (rc.severity eq 2) then do;\n print rc;\n print 'Ignoring error';\n end;\n r = 0;\n return r;\n \n end;\n \n function lookupPath(caslib, name ) ; \n table.fileInfo r = result/\n caslib=caslib; \n \n names = result.fileInfo[,4]; \n nameu = upcase(name)||'.SASHDAT'; \n cpath = '*'; \n count = 0; \n \n do n over names; \n if (upcase(n) eq nameu) then do; \n count = count + 1; \n if ( cpath eq '*') then do; \n cpath = n; \n end; \n end; \n end; \n \n if (count GT 1 ) then do; \n print 'Warning: ' count 'Files with names only different in case exist - First one chosen';\n print 'Path: ' cpath ' will be used****'; \n end; \n r = cpath; \n return r; \n end; \n /*-----------------------------------------*/ \n /* isModel: is it model table */ \n /*-----------------------------------------*/ \n \n function isModel(caslib, name) ; \n table.columnInfo r = result / \n table = {caslib=caslib , name=name}; \n validTable = false; \n mtype = 'bad'; \n do c over result.columninfo; \n cu = upCase(c.Column); \n if ( cu eq 'DATASTEPSRC') then do; \n mtype = 'ds'; \n end; \n else if ( cu eq '_STATE_' ) then do; \n mtype = 'astore'; \n end; \n else if (cu eq 'MODELMETADATA') then do; \n mtype = 'ds2'; \n end; \n end; \n print 'Specified model type: ' || mtype; \n return mtype; \n end; \n \n /*-----------------------------------------*/ \n /* Returns contents of the specified table */ \n /*-----------------------------------------*/ \n \n function contents(caslib, name) ; \n table.columnInfo r = result / \n table = {caslib=caslib , name=name}; \n /* columns ={{Column='_Index_',ID=0,Type='double',RawLength=5,FormattedLength=5,NFL=0,NFD=0}}; */ \n i = 1; \n columns = {}; \n do c over result.columninfo; \n columns[i] = c; \n i = i + 1; \n end; \n return {describe = columns, table = {}}; \n end; \n \n /*------------------------------------------*/ \n /* Returns unique values */ \n /*-----------------------------------------*/ \n \n function selectionLists(idvars,caslib, name, where); \n \n s = checkAndLoadTable(caslib, name); \n if ( s ne true) then do; \n results = {Errors= 'Unable to access ' ||caslib||'.'||name, statusCode = s}; \n \n end; \n print idvars;\n do k over idvars; \n r = _getValues(k, caslib, name, where); \n results[k] = r; \n end; \n return { data=results, statusCode=0}; \n end; \n function _getValues(id, caslib, name, where) ; \n \n action table.dropTable/ \n caslib='casuser' name='dtemp1' quiet=TRUE; \n \n action table.deleteSource status=src / \n caslib='casuser' source= 'dtemp1.sashdat' quiet=TRUE; \n \n action simple.groupby result=r status=rc/ \n aggregator = 'N' \n inputs = {id} \n table = {caslib=caslib name=name, where=where} \n casout = {caslib='casuser' name='dtemp1'} \n ; \n action table.fetch result=r/ \n table={caslib='casuser' name='dtemp1'} \n sortby={{name=id, order='ascending'}}; \n result = r.Fetch[,2]; \n return result; \n end; \n /*------------------------------------------*/ \n /* get a record */ \n /*------------------------------------------*/ \n \n function _fetchData(filter, table); \n s = checkAndLoadTable(table.caslib, table.name); \n if ( s ne 0 ) then do; \n results = {Errors= 'Unable to access ' ||table.caslib||'.'||table.name}; \n return results; \n end; \n wherex = dictTowhere(filter); \n /* wherex = table.caslib||'.'||table.name||'(where=('||wherex||'));'; \n \n destroyTable('casuser', 'input'); \n \n action datastep.runCode r=result status=rc/ \n single='yes' \n code = 'data casuser.input; set ' || wherex||'run;'; \n */ \n \n action table.fetch r = result / \n table={caslib=table.caslib name=table.name where=wherex}; \n \n rows = resultsToDict(result.Fetch); \n return {scenario = rows, table = result.Fetch}; \n \n end; \n function destroyTable(caslib,name); \n action table.dropTable/ \n caslib=caslib name=name quiet=TRUE; \n \n action table.deleteSource status=src / \n caslib=caslib source= name||'.sashdat' quiet=TRUE; \n \n return true; \n end; \n \n \n function dictToWhere(filter); \n where =''; \n andbit=' '; \n do k,v over filter; \n if (isString(v) ) then do; \n where = where || andbit || k || ' eq ' || '\"'||v||'\"'; \n end; \n else do; \n where = where || andbit || k || ' eq ' || v ; \n end; \n andbit =' and '; \n end; \n return where; \n end; \n \n function resultsToDict(r); \n casResults = {}; \n i = 1; \n do row over r; \n casResults[i] = row; \n i = i + 1; \n end; \n return casResults; \n end; \n \n function argsToTable(_arg_, caslib, name ); \n action table.droptable/ \n caslib=caslib name=name quiet=TRUE; \n i = 1; \n do key,obj over _arg_; \n columns[i] = key; \n row[i] = obj; \n if ( isString(obj) ) then \n type[i] = 'varchar'; \n else if ( isInteger(obj) ) then \n type[i] = 'int'; \n else type[i] = 'double'; \n i = i + 1; \n end; \n \n data1 = newTable('data1', columns, type, row ); \n \n saveresult data1 casout=name caslib=caslib replace; \n end; \n \n function saveAndPromoteTable(caslib, target, source);\n sashdat = target||\".sashdat\";\n rc = checkAndLoadTable(caslib, source);\n table.droptable /\n caslib=caslib name=target quiet=true;\n \n table.save /\n caslib= caslib name=sashdat\n table = {caslib=caslib name=source} replace=true;\n \n table.loadtable result=r/\n caslib=caslib casout={caslib=caslib name=target replace=TRUE}\n path=sashdat;\n \n table.promote result=r status=rc/\n caslib=caslib name=target quiet=true\n targetLib=caslib target=target;\n print rc;\n r = rc.severity;\n if (rc.severity gt 0) then do;\n print rc;\n print 'Ignoring error';\n rc = 0;\n end;\n \n return r;\n end; \n \n "};var i=function(){return"\n results = casFetchRows(_args_.table.caslib, _args_.table.name , _args_.from, _args_.count, _args_.format, _args_.where); \n send_response({casResults = results}); \n \n function casFetchRows(caslib, name, from, count, format, where) ; \n \n rc = checkAndLoadTable(caslib, name);\n \n if (rc ne true) then do;\n text = 'Unable to access ' ||caslib||'.'||name; \n rx = {severity=2,reason=6, status='error',statusCode=2, formatted=text};\n exit(rx); \n end; \n\n /*\n * get all table to get rowCount\n */\n\n action table.tableinfo r= result/ \n caslib = caslib \n name = name; \n \n rowCount = result.TableInfo[1, 'rows']; \n \n to = from + count - 1; \n \n /*\n * get column information\n */\n\n action table.columninfo r=infoResult /\n table = {caslib=caslib name=name};\n\n columns ={{Column='_Index_',ID=0,Type='double',RawLength=5,FormattedLength=5,NFL=0,NFD=0}};\n i = 2;\n do c over inforesult.columninfo;\n columns[i] = c;\n i = i + 1;\n end;\n \n /*\n * Fetch the current set of rows\n */\n /* wherex = dictTowhere(where); let user send in the where clause */\n print where;\n\n action table.fetch r = result / \n table = {caslib=caslib, name=name where=where} \n from= from to=to format=format sastypes=true\n ;\n\n /* \n * create payload to return\n */\n\n i = 1;\n rows ={};\n do row over result.fetch;\n rr = {};\n j = 1;\n do key,v over row;\n rr[j] = override(columns[j].Type, v);\n j = j + 1;\n end;\n rows[i] = rr;\n i = i + 1;\n end;\n\n pagePrev = max(from - count, 1);\n \n if ( to eq rowCount ) then do; \n pageNext = -1; \n end; \n else do ; \n pageNext = min(to + 1, rowCount); \n end; \n table = {caslib=caslib, name=name};\n pagination = {next= {from=pageNext, count=count, format=format, where=where table=table}, prev={from=pagePrev, count=count, format=format, where=where, table=table}};\n pagination.current = {from = from, to=to, rowCount=rowCount, version=1};\n return( \n {pagination = pagination, data = {schema=columns, rows=rows }}\n );\n end; \n \n \n /*\n * For non-primary column types set new content\n */\n\n function override(type, iv);\n if (type EQ 'varbinary') then v = '...varbinary';\n else if (type EQ 'blob') then v = '...blob';\n else if (type EQ 'table') then v = '...table';\n else if (type EQ 'dictionary') then v = '...dictionary';\n else if (type EQ 'list') then v = '...list';\n else if (type EQ 'isArray') then v = '...array';\n else v = iv;\n return v;\n end;\n\n \n "};var u=function(){return"\n rc = checkAndLoadTable(_args_.masterTable.caslib, _args_.masterTable.name);\n\n if (rc ne true) then do;\n text = 'Unable to access ' ||_args_.masterTable.caslib||'.'||_args_.masterTable.name; \n rx = {severity=2,reason=6, status='error',statusCode=2, formatted=text};\n exit(rx); \n end; \n \n rc = checkAndLoadTable(_args_.setTable.caslib, _args_.setTable.name);\n if (rc ne true) then do;\n text = 'Unable to access ' ||_args_.setTable.caslib||'.'||_args_.setTable.name; \n rx = {severity=2,reason=6, status='error',statusCode=2, formatted=text};\n return rx;\n end;\n\n\n setdata = _args_.setTable.caslib ||'.'||_args_.setTable.name;\n masterdata = _args_.masterTable.caslib ||'.'||_args_.masterTable.name;\n\n action datastep.runCode r=result status=rc/\n code='data ' ||masterdata||'(append=YES);set ' || setdata ||'; run;';\n\n if (rc.statusCode ne 0) then do;\n exit(rc);\n end; \n else do;\n results = {msg= 'Append succeeded', statusCode=true};\n end;\n \n send_response({casResults = results});\n "};e.a={commonCasl:o,casFetchData:s,casFetchRows:i,scoreCasl:a.a,casAppendTable:u,casRowSets:s}},function(t,e,n){"use strict";var r=n(1),a=n.n(r),s=n(0),o=n.n(s),i=n(7);function u(){return(u=a()(o.a.mark((function t(e,n,r,a){var s,u,c,l,f,p,h,d=arguments;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(s=Object(i.a)(null!==a?a:{},"_args_"),u=(u=s+" "+r).replace(/\r?\n|\r/g,""),c={action:"sccasl.runcasl",data:{code:u}},l=d.length,f=new Array(l>4?l-4:0),p=4;p<l;p++)f[p-4]=d[p];return t.next=7,e.runAction.apply(e,[n,c].concat(f));case 7:return h=t.sent,t.abrupt("return",h);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}e.a=function(t,e,n,r){return u.apply(this,arguments)}},function(t,e){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";var r=n(1),a=n.n(r),s=n(0),o=n.n(s),i=n(3),u=n(2);function c(){return(c=a()(o.a.mark((function t(e,n,r,a,s){var c,l,f,p,h,d=arguments;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(c=r,!1!==s&&(c=u.a.commonCasl()+" "+r),l=d.length,f=new Array(l>5?l-5:0),p=5;p<l;p++)f[p-5]=d[p];return t.next=5,i.a.apply(void 0,[e,n,c,a].concat(f));case 5:return h=t.sent,t.abrupt("return",h.items().toJS());case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}e.a=function(t,e,n,r,a){return c.apply(this,arguments)}},function(t,e,n){var r=n(14);t.exports=function(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";var r=n(4),a=n.n(r);function s(t){var e="{ ",n=" ";for(var r in t){if(!0===Array.isArray(t[r])){var i=o(t[r]);e=e+n+"".concat(r,"=")+i}else{var u=a()(t[r]);if("object"===u){var c=s(t[r]);e=e+n+"".concat(r,"=")+c}else e=e+n+"".concat(r,"=")+("string"===u?' "'.concat(t[r],'" '):"".concat(t[r]," "))}n=","}return e+="} "}function o(t){for(var e="{",n=" ",r=t.length,i=0;i<r;i++)if(!0===Array.isArray(t[i])){var u=o(t[i]);e=e+n+"".concat(i,"=")+u}else{var c=a()(t[i]);if("object"===c)e=e+n+s(t[i]);else e=e+n+("string"===c?' "'.concat(t[i],'" '):"".concat(t[i]," "));n=","}return e+="}"}e.a=function(t,e){var n;return n=null===t?"{}":!0===Array.isArray(t)?o(t):s(t),"".concat(e," = ").concat(n,";")}},function(t,e,n){"use strict";n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return h}));var r=n(1),a=n.n(r),s=n(0),o=n.n(s);function i(){return(i=a()(o.a.mark((function t(e,n,r,a){var s,i,u,c,l;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s=a.output,i=s.caslib,null!=(u=s.name)){t.next=3;break}throw"Please specify table as caslib.name";case 3:return u=u.toLowerCase(u),c="\n action table.droptable /\n caslib= '".concat(i,"' name= '").concat(u,"' quiet=true;\n\n action table.deleteSource/\n caslib= '").concat(i,"' source= '").concat(u,".sashdat' quiet=true; \n "),l={action:"sccasl.runcasl",data:{code:c}},t.next=8,e.runAction(n,l);case 8:return l={action:"astore.upload",data:{rstore:{name:"".concat(u),caslib:"".concat(i),replace:!0},store:r}},t.next=11,e.runAction(n,l);case 11:return t.sent,t.abrupt("return","Upload of ".concat(a.source," to ").concat(i,".").concat(u," completed"));case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var u=function(t,e,n,r){return i.apply(this,arguments)},c=n(5);function l(){return(l=a()(o.a.mark((function t(e,n,r,a,s){var i,u,l,p,h,d,b;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=a.output,u=i.caslib,null!=(l=i.name)){t.next=3;break}throw"Please specify table as caslib.name";case 3:return t.next=5,f(e,n,u,l);case 5:return t.sent,p={casout:{caslib:u,name:l},importOptions:{fileType:a.fileType}},"sas"!==a.fileExt&&"ds2"!==a.fileExt||(p.importOptions.delimiter="\\"),h={headers:{"JSON-Parameters":p,"Content-Type":"binary/octet-stream"},data:r,action:"table.upload"},t.next=11,e.runAction(n,h);case 11:if(d=t.sent,!0!==s){t.next=17;break}return b="\n\t\t\n\t\t\taction table.save r = result / \n\t\t\t\ttable = {caslib='".concat(u,"' name='").concat(l,"'} \n\t\t\t\tcaslib='").concat(u,"' replace=true;\n\t\t\t\n\t\t\taction table.loadTable r = result2 /\n\t\t\t\tcaslib='").concat(u," casout={caslib='").concat(u,"' name='").concat(l,"' replace=true} \n\t\t\t\tpath='").concat(l,".sashdat' ;\n\t\t\t\tsend_response({save=result, load= result2});\n\n\t\t\n\t\t send_response({status=result});\n\t\t\t"),t.next=16,Object(c.a)(e,n,b,null,!0);case 16:t.sent;case 17:return null==a.source?"inline source":a.source,t.abrupt("return",d);case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function f(t,e,n,r){return p.apply(this,arguments)}function p(){return(p=a()(o.a.mark((function t(e,n,r,a){var s,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"".concat(r,".").concat(a),s="\n\t\taction table.dropTable/ \n caslib='".concat(r,"' name='").concat(a,"' quiet=TRUE; \n \n action table.deleteSource status=src / \n caslib='casuser' source= '").concat(a,".sashdat' quiet=TRUE; \n\t\tsend_response({casResults = {status=src, results= 'data deleted'}})\n\t\t"),t.next=4,Object(c.a)(e,n,s);case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var h=function(t,e,n,r,a){return l.apply(this,arguments)}},function(t,e){t.exports=function(){return"\n result = runMain(_args_); \n send_response(result); \n /* print result; */\n \n \n function runMain(_args_) ; \n r = {Error= 'No path'}; \n if ( _args_.path eq '/selectors') then do; \n r = selectionLists(_args_.selectors, _args_.table.caslib, _args_.table.name); \n end; \n else if ( _args_.path eq '/contents') then do; \n r = contents(_args_.table.caslib, _args_.table.name); \n end; \n else if (_args_.path eq '/describe') then do; \n r = describeModel(_args_); \n end; \n else if (_args_.path eq '/scenario' ) then do;\n r = fetchData(_args_.filter, _args_.table);\n end;\n else if (_args_.path eq '/score') then do; \n if( exists(_args_, 'modelName') eq false ) then\n modelname = '';\n else modelName =_args_.modelName;\n r = runScoreCode(_args_.model, _args_.scenario, modelName); \n end; \n else do; \n r = {icasResults={Errors = 'Invalid action option specified' || _args_.path}, statusCode=404}; \n end; \n print r;\n if ( r.statusCode ne 0) then do;\n print r.icasResults;\n exit({severity=2,reason=6, status=r.iCasResults.Errors,statusCode=r.statusCode});\n end;\n result = {casResults = r.icasResults}; \n print '***************************************************************'; \n print result; \n print '***************************************************************'; \n return result; \n end; \n \n /*-----------------------------------------*/ \n /* describeModel */ \n /*-----------------------------------------*/ \n \n function describeModel(_args_) ; \n s = checkAndLoadTable(_args_.model.caslib, _args_.model.name); \n if ( s ne true) then do; \n results = {Errors= 'Unable to access ' ||_args_.model.caslib||'.'||_args_.model.name}; \n return {icasResults=results, statusCode=404}; \n end; \n \n mtype = isModel(_args_.model.caslib, _args_.model.name); \n if ( mtype EQ 'astore' ) then do; \n r = astoreDescribe(_args_.model); \n end; \n else if (mtype EQ 'ds' or mtype EQ 'ds2') then do;\n s = checkAndLoadTable(_args_.table.caslib, _args_.table.name); \n if ( s ne true ) then do; \n results = {Errors= 'Unable to access ' ||_args_.table.caslib||'.'||_args_.table.name}; \n return {icasResults=results, statusCode=404}; \n end; \n r = contents( _args_.table.caslib, _args_.table.name); \n end; \n return {icasResults= r, statusCode=0} ;\n end; \n \n /*------------------------------------------*/ \n /* astoreDescribe */ \n /*------------------------------------------*/ \n \n function astoreDescribe(model); \n action astore.describe r=result/ \n rstore = { caslib= model.caslib name = model.name }; \n rows = resultsToDict(result.InputVariables); \n return {describe = rows, table = result.InputVariables}; \n end; \n \n /*------------------------------------------*/ \n /* score */ \n /*------------------------------------------*/ \n function runScoreCode( model, scenario, modelName); \n print model; \n s = checkAndLoadTable(model.caslib, model.name); \n if ( s ne true ) then do; \n results = {Errors= 'Unable to access ' ||model.caslib||'.'||model.name}; \n return {icasResults=results, statusCode=404}; \n end;\n \n mtype = isModel(model.caslib, model.name); \n \n if ( mtype eq 'bad' ) then do; \n results = {Error= model.caslib||'.'||model.name || ' is not recognized as a valid supported model. Please check your values'};\n return {icasResults=results, statusCode=400};\n end; \n destroyTable('casuser', 'input'); \n argsToTable(scenario, 'casuser', 'input'); \n \n destroyTable('casuser', 'output'); \n \n if (mtype eq 'astore') then do; \n print 'Scoring with astore'; \n action astore.score r = result/ \n rstore = {caslib=model.caslib name=model.name} \n out = {caslib='casuser' name='output'} \n table = {caslib='casuser' name='input'}; \n end; \n else if (mtype eq 'ds') then do; \n print 'scoring with datastep code'; \n action datastep.runcodetable r = result/ \n single='YES' \n codeTable= {caslib=model.caslib name=model.name} \n casout = {caslib='casuser' name='output'} \n table = {caslib='casuser' name='input'}; \n end; \n else if (mtype eq 'ds2' ) then do; \n print 'Scoring with d2'; \n if ( missing(modelName) eq true) then do;\n results = {Error= 'modelName is missing. Please check your values'};\n return {icasResults=results, statusCode=400};\n end;\n\n action ds2.runModel r = result/ \n modelTable = {caslib=model.caslib, name=model.name} \n modelName = modelName \n table = {caslib= 'casuser', name='input'} \n casOut = {caslib= 'casuser' name='output'}; \n end; \n \n \n action table.fetch r = result / \n table={caslib='casuser' name='output'}; \n \n rows = resultsToDict(result.Fetch); \n \n return {icasResults= rows, statusCode=0} ;\n end; \n \n \n "}},function(t,e,n){"use strict";(function(t){var r=n(11),a=n.n(r),s=n(8);e.a=function(e,n){var r,o,i=null,u=s.b,c=function(t){return t};switch(o=null==e?"csv":e.split(".").pop().toLowerCase()){case"sas7bdat":r="basesas";break;case"sashdat":r="hdat";break;case"csv":r=o,i="UTF8";break;case"xslx":case"xsl":r=o;break;case"astore":case"sasast":r=o,u=s.a,c=function(e){return new t.from(e).toString("base64")};break;case"ds2":case"sas":r="csv",i="UTF8",u=s.b,c=function(t,e){var n=t.replace(/[^\x00-\x7F]/g,"").replace(/\r?\n/g,""),r=e.fileExt;return"modelName\\"+("sas"===r?"dataStepSrc":"ds2"===r?"ds2Src":"casl"===r?"caslSrc":"dataStepsrc")+"\n"+e.output.name+"\\ "+n+"\n"};break;default:throw"Currently file type of ".concat(o," is not supported")}var l=n.split("."),f=a()(l,2);return{source:e,output:{caslib:f[0],name:f[1].toLowerCase()},fileType:r,fileExt:o,fileOptions:i,transform:c,contentType:"binary/octet-stream",handler:u}}}).call(this,n(16).Buffer)},function(t,e,n){var r=n(20),a=n(21),s=n(22),o=n(24);t.exports=function(t,e){return r(t)||a(t,e)||s(t,e)||o()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){t.exports=n(25)},function(t,e,n){var r=n(4).default;function a(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=a=function(){return n},t.exports.__esModule=!0,t.exports.default=t.exports;var e,n={},s=Object.prototype,o=s.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function p(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(e){p=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var a=e&&e.prototype instanceof v?e:v,s=Object.create(a.prototype),o=new P(r||[]);return i(s,"_invoke",{value:R(t,n,o)}),s}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=h;var b="suspendedStart",m="executing",y="completed",g={};function v(){}function w(){}function x(){}var _={};p(_,c,(function(){return this}));var S=Object.getPrototypeOf,k=S&&S(S(L([])));k&&k!==s&&o.call(k,c)&&(_=k);var E=x.prototype=v.prototype=Object.create(_);function C(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function n(a,s,i,u){var c=d(t[a],t,s);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==r(f)&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,i,u)}),(function(t){n("throw",t,i,u)})):e.resolve(f).then((function(t){l.value=t,i(l)}),(function(t){return n("throw",t,i,u)}))}u(c.arg)}var a;i(this,"_invoke",{value:function(t,r){function s(){return new e((function(e,a){n(t,r,e,a)}))}return a=a?a.then(s,s):s()}})}function R(t,n,r){var a=b;return function(s,o){if(a===m)throw new Error("Generator is already running");if(a===y){if("throw"===s)throw o;return{value:e,done:!0}}for(r.method=s,r.arg=o;;){var i=r.delegate;if(i){var u=A(i,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===b)throw a=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=m;var c=d(t,n,r);if("normal"===c.type){if(a=r.done?y:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(a=y,r.method="throw",r.arg=c.arg)}}}function A(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,A(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var s=d(a,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,g;var o=s.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,s=function n(){for(;++a<t.length;)if(o.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(r(t)+" is not iterable")}return w.prototype=x,i(E,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(E),t},n.awrap=function(t){return{__await:t}},C(T.prototype),p(T.prototype,l,(function(){return this})),n.AsyncIterator=T,n.async=function(t,e,r,a,s){void 0===s&&(s=Promise);var o=new T(h(t,e,r,a),s);return n.isGeneratorFunction(e)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},C(E),p(E,f,"Generator"),p(E,c,(function(){return this})),p(E,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=L,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(j),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,a){return i.type="throw",i.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var u=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=t,s.arg=e,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;j(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(4).default,a=n(15);t.exports=function(t){var e=a(t,"string");return"symbol"===r(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(4).default;t.exports=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,e||"default");if("object"!==r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("restaflib",[],e):"object"==typeof exports?exports.restaflib=e():t.restaflib=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=12)}([function(t,e,n){var r=n(13)();t.exports=r;try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(t,e){function n(t,e,n,r,a,s,o){try{var i=t[s](o),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,a)}t.exports=function(t){return function(){var e=this,r=arguments;return new Promise((function(a,s){var o=t.apply(e,r);function i(t){n(o,a,s,i,u,"next",t)}function u(t){n(o,a,s,i,u,"throw",t)}i(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";var r=n(9),a=n.n(r);var s=function(){return"\n print _args_;\n\n results = casFetchRows(_args_.table.caslib, _args_.table.name , _args_.start + 1, _args_.limit, _args_.format, _args_.where); \n send_response({casResults = results}); \n \n function casFetchRows(caslib, name, from, count, format, where) ; \n \n rc = checkAndLoadTable(caslib, name);\n \n if (rc ne true) then do;\n text = 'Unable to access ' ||caslib||'.'||name; \n rx = {severity=2,reason=6, status='error',statusCode=2, formatted=text};\n exit(rx); \n end; \n\n /*\n * get tableoinfo to get rowCount\n */\n\n action table.tableinfo r= result/ \n caslib = caslib \n name = name; \n \n rowCount = result.TableInfo[1, 'rows'];\n to = from + count - 1;\n\n \n /*\n * get column information\n */\n\n action table.columninfo r=infoResult /\n table = {caslib=caslib name=name};\n\n columns ={{Column='_Index_',ID=0,Type='double',RawLength=5,FormattedLength=5,NFL=0,NFD=0}};\n i = 2;\n do c over inforesult.columninfo;\n columns[i] = c;\n i = i + 1;\n end;\n \n /*\n * Fetch the current set of rows\n */\n\n rows = {};\n if (from <= rowCount) then do;\n action table.fetch r = result status=rcx/ \n table = {caslib=caslib, name=name where=where} \n from= from to=to format=format sastypes=true\n ;\n if (rcx.severity eq 2) then do;\n exit(rcx);\n end;\n /* \n * create payload to return\n */\n\n i = 1;\n rows ={};\n do row over result.fetch;\n rr = {};\n j = 1;\n do key,v over row;\n rr[j] = override(columns[j].Type, v);\n j = j + 1;\n end;\n rows[i] = rr;\n i = i + 1;\n end;\n end;\n\n currentCount = DIM(rows);\n pagination = {}; \n table = {caslib=caslib, name=name};\n\n pagination = setPagination(from, count, format, where, currentCount, rowCount, table);\n \n lastRequest={start=from-1, limit=count, format=format, currentCount=currentCount, \n rowCount=rowCount, where=where, table=table, version='3'};\n scrollOptions = getKeys(pagination);\n return( \n {pagination = pagination, data = {schema=columns, rows=rows , scrollOptions=scrollOptions}, lasRequest=lastRequest}\n );\n end; \n \n \n /*\n * For non-primary column types set new content\n */\n\n function setPagination(from, count, format, where, currentCount, rowCount, table);\n\n\n prevStart = max(from - count - 1, 0);\n\n if (currentCount lt count) then do; \n pagination.prev = {start=prevStart, limit=count, format=format, where=' ', table=table};\n if (prevStart ne 0) then do;\n pagination.first = {start=0, limit=count, format=format, where=' ', table=table};\n end; \n return pagination;\n end;\n currentStart = from -1;\n if (currentStart eq 0) then do;\n pagination.next = {start=count, limit=count, format=format, where=' ', table=table};\n return pagination;\n end;\n\n nextStart = currentStart + count;\n pagination.next = {start=nextStart, limit=count, format=format, where=' ', table=table};\n pagination.prev = {start=prevStart, limit=count, format=format, where=' ', table=table};\n if (prevStart ne 0) then do;\n pagination.first = {start=0, limit=count, format=format, where=' ', table=table};\n end; \n return pagination;\n end;\n\n\n\n\n function override(type, iv);\n if (type EQ 'varbinary') then v = '...varbinary';\n else if (type EQ 'blob') then v = '...blob';\n else if (type EQ 'table') then v = '...table';\n else if (type EQ 'dictionary') then v = '...dictionary';\n else if (type EQ 'list') then v = '...list';\n else if (type EQ 'isArray') then v = '...array';\n else v = iv;\n return v;\n end;\n\n \n "};var o=function(){return"\n function checkAndLoadTable(caslib, name); \n \n /* verify caslib is there */\n table.queryCaslib status=status result=result/\n caslib = caslib;\n do k,v over result; /* to handle casuser[user] */ \n rc = v;\n end;\n if ( rc eq false ) then \n return -1;\n /* \n * Check to see if table is already loaded \n */ \n action table.tableExists r=result/ \n caslib = caslib \n name = name; \n /* \n * if not loaded then try to load it \n */ \n rc = true;\n if (result.exists eq 0 or result.exists eq 2) then do; \n path = lookupPath(caslib, name);\n if (path eq '*') then do;\n rc = false;\n end;\n else do;\n action table.loadTable status=status/ \n caslib = caslib \n source = path \n casout={caslib= caslib name=name}; \n if (status.statusCode ne 0 ) then rc = false;\n end; \n end; \n return rc; \n end; \n \n function saveAndLoadTable(caslib, source, targetlib, targetname,promote);\n \n /* load source */\n r = checkAndLoadTable(caslib, source);\n \n sashdat = target||\".sashdat\";\n table.save /\n caslib= targetlib name=sashdat\n table = {caslib=caslib name=source} replace=true;\n \n table.droptable /\n caslib=targetlib name=target quiet=true;\n \n table.loadtable result=r status=rc/\n caslib=targetlib casout={caslib=targetlib name=target replace=TRUE}\n path=sashdat;\n \n if (promote eq true) then do;\n table.promote result=r status=rc/\n caslib=caslib name=target quiet=true\n targetLib=caslib target=target;\n end;\n if (rc.severity eq 2) then do;\n print rc;\n print 'Ignoring error';\n end;\n r = 0;\n return r;\n \n end;\n \n function lookupPath(caslib, name ) ; \n table.fileInfo r = result/\n caslib=caslib; \n \n names = result.fileInfo[,4]; \n nameu = upcase(name)||'.SASHDAT'; \n cpath = '*'; \n count = 0; \n \n do n over names; \n if (upcase(n) eq nameu) then do; \n count = count + 1; \n if ( cpath eq '*') then do; \n cpath = n; \n end; \n end; \n end; \n \n if (count GT 1 ) then do; \n print 'Warning: ' count 'Files with names only different in case exist - First one chosen';\n print 'Path: ' cpath ' will be used****'; \n end; \n r = cpath; \n return r; \n end; \n /*-----------------------------------------*/ \n /* isModel: is it model table */ \n /*-----------------------------------------*/ \n \n function isModel(caslib, name) ; \n table.columnInfo r = result / \n table = {caslib=caslib , name=name}; \n validTable = false; \n mtype = 'bad'; \n do c over result.columninfo; \n cu = upCase(c.Column); \n if ( cu eq 'DATASTEPSRC') then do; \n mtype = 'ds'; \n end; \n else if ( cu eq '_STATE_' ) then do; \n mtype = 'astore'; \n end; \n else if (cu eq 'MODELMETADATA') then do; \n mtype = 'ds2'; \n end; \n end; \n print 'Specified model type: ' || mtype; \n return mtype; \n end; \n \n /*-----------------------------------------*/ \n /* Returns contents of the specified table */ \n /*-----------------------------------------*/ \n \n function contents(caslib, name) ; \n table.columnInfo r = result / \n table = {caslib=caslib , name=name}; \n /* columns ={{Column='_Index_',ID=0,Type='double',RawLength=5,FormattedLength=5,NFL=0,NFD=0}}; */ \n i = 1; \n columns = {}; \n do c over result.columninfo; \n columns[i] = c; \n i = i + 1; \n end; \n return {describe = columns, table = {}}; \n end; \n \n /*------------------------------------------*/ \n /* Returns unique values */ \n /*-----------------------------------------*/ \n \n function selectionLists(idvars,caslib, name, where); \n \n s = checkAndLoadTable(caslib, name); \n if ( s ne true) then do; \n results = {Errors= 'Unable to access ' ||caslib||'.'||name, statusCode = s}; \n \n end; \n print idvars;\n do k over idvars; \n r = _getValues(k, caslib, name, where); \n results[k] = r; \n end; \n return { data=results, statusCode=0}; \n end; \n function _getValues(id, caslib, name, where) ; \n \n action table.dropTable/ \n caslib='casuser' name='dtemp1' quiet=TRUE; \n \n action table.deleteSource status=src / \n caslib='casuser' source= 'dtemp1.sashdat' quiet=TRUE; \n \n action simple.groupby result=r status=rc/ \n aggregator = 'N' \n inputs = {id} \n table = {caslib=caslib name=name, where=where} \n casout = {caslib='casuser' name='dtemp1'} \n ; \n action table.fetch result=r/ \n table={caslib='casuser' name='dtemp1'} \n sortby={{name=id, order='ascending'}}; \n result = r.Fetch[,2]; \n return result; \n end; \n /*------------------------------------------*/ \n /* get a record */ \n /*------------------------------------------*/ \n \n function _fetchData(filter, table); \n s = checkAndLoadTable(table.caslib, table.name); \n if ( s ne 0 ) then do; \n results = {Errors= 'Unable to access ' ||table.caslib||'.'||table.name}; \n return results; \n end; \n wherex = dictTowhere(filter); \n /* wherex = table.caslib||'.'||table.name||'(where=('||wherex||'));'; \n \n destroyTable('casuser', 'input'); \n \n action datastep.runCode r=result status=rc/ \n single='yes' \n code = 'data casuser.input; set ' || wherex||'run;'; \n */ \n \n action table.fetch r = result / \n table={caslib=table.caslib name=table.name where=wherex}; \n \n rows = resultsToDict(result.Fetch); \n return {scenario = rows, table = result.Fetch}; \n \n end; \n function destroyTable(caslib,name); \n action table.dropTable/ \n caslib=caslib name=name quiet=TRUE; \n \n action table.deleteSource status=src / \n caslib=caslib source= name||'.sashdat' quiet=TRUE; \n \n return true; \n end; \n \n \n function dictToWhere(filter); \n where =''; \n andbit=' '; \n do k,v over filter; \n if (isString(v) ) then do; \n where = where || andbit || k || ' eq ' || '\"'||v||'\"'; \n end; \n else do; \n where = where || andbit || k || ' eq ' || v ; \n end; \n andbit =' and '; \n end; \n return where; \n end; \n \n function resultsToDict(r); \n casResults = {}; \n i = 1; \n do row over r; \n casResults[i] = row; \n i = i + 1; \n end; \n return casResults; \n end; \n \n function argsToTable(_arg_, caslib, name ); \n action table.droptable/ \n caslib=caslib name=name quiet=TRUE; \n i = 1; \n do key,obj over _arg_; \n columns[i] = key; \n row[i] = obj; \n if ( isString(obj) ) then \n type[i] = 'varchar'; \n else if ( isInteger(obj) ) then \n type[i] = 'int'; \n else type[i] = 'double'; \n i = i + 1; \n end; \n \n data1 = newTable('data1', columns, type, row ); \n \n saveresult data1 casout=name caslib=caslib replace; \n end; \n \n function saveAndPromoteTable(caslib, target, source);\n sashdat = target||\".sashdat\";\n rc = checkAndLoadTable(caslib, source);\n table.droptable /\n caslib=caslib name=target quiet=true;\n \n table.save /\n caslib= caslib name=sashdat\n table = {caslib=caslib name=source} replace=true;\n \n table.loadtable result=r/\n caslib=caslib casout={caslib=caslib name=target replace=TRUE}\n path=sashdat;\n \n table.promote result=r status=rc/\n caslib=caslib name=target quiet=true\n targetLib=caslib target=target;\n print rc;\n r = rc.severity;\n if (rc.severity gt 0) then do;\n print rc;\n print 'Ignoring error';\n rc = 0;\n end;\n \n return r;\n end; \n \n "};var i=function(){return"\n results = casFetchRows(_args_.table.caslib, _args_.table.name , _args_.from, _args_.count, _args_.format, _args_.where); \n send_response({casResults = results}); \n \n function casFetchRows(caslib, name, from, count, format, where) ; \n \n rc = checkAndLoadTable(caslib, name);\n \n if (rc ne true) then do;\n text = 'Unable to access ' ||caslib||'.'||name; \n rx = {severity=2,reason=6, status='error',statusCode=2, formatted=text};\n exit(rx); \n end; \n\n /*\n * get all table to get rowCount\n */\n\n action table.tableinfo r= result/ \n caslib = caslib \n name = name; \n \n rowCount = result.TableInfo[1, 'rows']; \n \n to = from + count - 1; \n \n /*\n * get column information\n */\n\n action table.columninfo r=infoResult /\n table = {caslib=caslib name=name};\n\n columns ={{Column='_Index_',ID=0,Type='double',RawLength=5,FormattedLength=5,NFL=0,NFD=0}};\n i = 2;\n do c over inforesult.columninfo;\n columns[i] = c;\n i = i + 1;\n end;\n \n /*\n * Fetch the current set of rows\n */\n /* wherex = dictTowhere(where); let user send in the where clause */\n print where;\n\n action table.fetch r = result / \n table = {caslib=caslib, name=name where=where} \n from= from to=to format=format sastypes=true\n ;\n\n /* \n * create payload to return\n */\n\n i = 1;\n rows ={};\n do row over result.fetch;\n rr = {};\n j = 1;\n do key,v over row;\n rr[j] = override(columns[j].Type, v);\n j = j + 1;\n end;\n rows[i] = rr;\n i = i + 1;\n end;\n\n pagePrev = max(from - count, 1);\n \n if ( to eq rowCount ) then do; \n pageNext = -1; \n end; \n else do ; \n pageNext = min(to + 1, rowCount); \n end; \n table = {caslib=caslib, name=name};\n pagination = {next= {from=pageNext, count=count, format=format, where=where table=table}, prev={from=pagePrev, count=count, format=format, where=where, table=table}};\n pagination.current = {from = from, to=to, rowCount=rowCount, version=1};\n return( \n {pagination = pagination, data = {schema=columns, rows=rows }}\n );\n end; \n \n \n /*\n * For non-primary column types set new content\n */\n\n function override(type, iv);\n if (type EQ 'varbinary') then v = '...varbinary';\n else if (type EQ 'blob') then v = '...blob';\n else if (type EQ 'table') then v = '...table';\n else if (type EQ 'dictionary') then v = '...dictionary';\n else if (type EQ 'list') then v = '...list';\n else if (type EQ 'isArray') then v = '...array';\n else v = iv;\n return v;\n end;\n\n \n "};var u=function(){return"\n rc = checkAndLoadTable(_args_.masterTable.caslib, _args_.masterTable.name);\n\n if (rc ne true) then do;\n text = 'Unable to access ' ||_args_.masterTable.caslib||'.'||_args_.masterTable.name; \n rx = {severity=2,reason=6, status='error',statusCode=2, formatted=text};\n exit(rx); \n end; \n \n rc = checkAndLoadTable(_args_.setTable.caslib, _args_.setTable.name);\n if (rc ne true) then do;\n text = 'Unable to access ' ||_args_.setTable.caslib||'.'||_args_.setTable.name; \n rx = {severity=2,reason=6, status='error',statusCode=2, formatted=text};\n return rx;\n end;\n\n\n setdata = _args_.setTable.caslib ||'.'||_args_.setTable.name;\n masterdata = _args_.masterTable.caslib ||'.'||_args_.masterTable.name;\n\n action datastep.runCode r=result status=rc/\n code='data ' ||masterdata||'(append=YES);set ' || setdata ||'; run;';\n\n if (rc.statusCode ne 0) then do;\n exit(rc);\n end; \n else do;\n results = {msg= 'Append succeeded', statusCode=true};\n end;\n \n send_response({casResults = results});\n "};e.a={commonCasl:o,casFetchData:s,casFetchRows:i,scoreCasl:a.a,casAppendTable:u,casRowSets:s}},function(t,e,n){"use strict";var r=n(1),a=n.n(r),s=n(0),o=n.n(s),i=n(7);function u(){return(u=a()(o.a.mark((function t(e,n,r,a){var s,u,c,l,f,p,h,d=arguments;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(s=Object(i.a)(null!==a?a:{},"_args_"),u=(u=s+" "+r).replace(/\r?\n|\r/g,""),c={action:"sccasl.runcasl",data:{code:u}},l=d.length,f=new Array(l>4?l-4:0),p=4;p<l;p++)f[p-4]=d[p];return t.next=7,e.runAction.apply(e,[n,c].concat(f));case 7:return h=t.sent,t.abrupt("return",h);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}e.a=function(t,e,n,r){return u.apply(this,arguments)}},function(t,e){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";var r=n(1),a=n.n(r),s=n(0),o=n.n(s),i=n(3),u=n(2);function c(){return(c=a()(o.a.mark((function t(e,n,r,a,s){var c,l,f,p,h,d=arguments;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(c=r,!1!==s&&(c=u.a.commonCasl()+" "+r),l=d.length,f=new Array(l>5?l-5:0),p=5;p<l;p++)f[p-5]=d[p];return t.next=5,i.a.apply(void 0,[e,n,c,a].concat(f));case 5:return h=t.sent,t.abrupt("return",h.items().toJS());case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}e.a=function(t,e,n,r,a){return c.apply(this,arguments)}},function(t,e,n){var r=n(14);t.exports=function(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";var r=n(4),a=n.n(r);function s(t){var e="{ ",n=" ";for(var r in t){if(!0===Array.isArray(t[r])){var i=o(t[r]);e=e+n+"".concat(r,"=")+i}else{var u=a()(t[r]);if("object"===u){var c=s(t[r]);e=e+n+"".concat(r,"=")+c}else e=e+n+"".concat(r,"=")+("string"===u?' "'.concat(t[r],'" '):"".concat(t[r]," "))}n=","}return e+="} "}function o(t){for(var e="{",n=" ",r=t.length,i=0;i<r;i++)if(!0===Array.isArray(t[i])){var u=o(t[i]);e=e+n+"".concat(i,"=")+u}else{var c=a()(t[i]);if("object"===c)e=e+n+s(t[i]);else e=e+n+("string"===c?' "'.concat(t[i],'" '):"".concat(t[i]," "));n=","}return e+="}"}e.a=function(t,e){var n;return n=null===t?"{}":!0===Array.isArray(t)?o(t):s(t),"".concat(e," = ").concat(n,";")}},function(t,e,n){"use strict";n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return h}));var r=n(1),a=n.n(r),s=n(0),o=n.n(s);function i(){return(i=a()(o.a.mark((function t(e,n,r,a){var s,i,u,c,l;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s=a.output,i=s.caslib,null!=(u=s.name)){t.next=3;break}throw"Please specify table as caslib.name";case 3:return u=u.toLowerCase(u),c="\n action table.droptable /\n caslib= '".concat(i,"' name= '").concat(u,"' quiet=true;\n\n action table.deleteSource/\n caslib= '").concat(i,"' source= '").concat(u,".sashdat' quiet=true; \n "),l={action:"sccasl.runcasl",data:{code:c}},t.next=8,e.runAction(n,l);case 8:return l={action:"astore.upload",data:{rstore:{name:"".concat(u),caslib:"".concat(i),replace:!0},store:r}},t.next=11,e.runAction(n,l);case 11:return t.sent,t.abrupt("return","Upload of ".concat(a.source," to ").concat(i,".").concat(u," completed"));case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var u=function(t,e,n,r){return i.apply(this,arguments)},c=n(5);function l(){return(l=a()(o.a.mark((function t(e,n,r,a,s){var i,u,l,p,h,d,b;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=a.output,u=i.caslib,null!=(l=i.name)){t.next=3;break}throw"Please specify table as caslib.name";case 3:return t.next=5,f(e,n,u,l);case 5:return t.sent,p={casout:{caslib:u,name:l},importOptions:{fileType:a.fileType}},"sas"!==a.fileExt&&"ds2"!==a.fileExt||(p.importOptions.delimiter="\\"),h={headers:{"JSON-Parameters":p,"Content-Type":"binary/octet-stream"},data:r,action:"table.upload"},t.next=11,e.runAction(n,h);case 11:if(d=t.sent,!0!==s){t.next=17;break}return b="\n\t\t\n\t\t\taction table.save r = result / \n\t\t\t\ttable = {caslib='".concat(u,"' name='").concat(l,"'} \n\t\t\t\tcaslib='").concat(u,"' name='").concat(l,"' replace=true;\n\t\t\t\n\t\t\taction table.loadTable r = result2 /\n\t\t\t\tcaslib='").concat(u,"' casout={caslib='").concat(u,"' name='").concat(l,"' replace=true} \n\t\t\t\tpath='").concat(l,".sashdat' ;\n\n\t\t\n\t\t send_response({status=result2});\n\t\t\t"),t.next=16,Object(c.a)(e,n,b,null,!0);case 16:t.sent;case 17:return null==a.source?"inline source":a.source,t.abrupt("return",d);case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function f(t,e,n,r){return p.apply(this,arguments)}function p(){return(p=a()(o.a.mark((function t(e,n,r,a){var s,i;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"".concat(r,".").concat(a),s="\n\t\taction table.dropTable/ \n caslib='".concat(r,"' name='").concat(a,"' quiet=TRUE; \n \n action table.deleteSource status=src / \n caslib='casuser' source= '").concat(a,".sashdat' quiet=TRUE; \n\t\tsend_response({casResults = {status=src, results= 'data deleted'}})\n\t\t"),t.next=4,Object(c.a)(e,n,s);case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var h=function(t,e,n,r,a){return l.apply(this,arguments)}},function(t,e){t.exports=function(){return"\n result = runMain(_args_); \n send_response(result); \n /* print result; */\n \n \n function runMain(_args_) ; \n r = {Error= 'No path'}; \n if ( _args_.path eq '/selectors') then do; \n r = selectionLists(_args_.selectors, _args_.table.caslib, _args_.table.name); \n end; \n else if ( _args_.path eq '/contents') then do; \n r = contents(_args_.table.caslib, _args_.table.name); \n end; \n else if (_args_.path eq '/describe') then do; \n r = describeModel(_args_); \n end; \n else if (_args_.path eq '/scenario' ) then do;\n r = fetchData(_args_.filter, _args_.table);\n end;\n else if (_args_.path eq '/score') then do; \n if( exists(_args_, 'modelName') eq false ) then\n modelname = '';\n else modelName =_args_.modelName;\n r = runScoreCode(_args_.model, _args_.scenario, modelName); \n end; \n else do; \n r = {icasResults={Errors = 'Invalid action option specified' || _args_.path}, statusCode=404}; \n end; \n print r;\n if ( r.statusCode ne 0) then do;\n print r.icasResults;\n exit({severity=2,reason=6, status=r.iCasResults.Errors,statusCode=r.statusCode});\n end;\n result = {casResults = r.icasResults}; \n print '***************************************************************'; \n print result; \n print '***************************************************************'; \n return result; \n end; \n \n /*-----------------------------------------*/ \n /* describeModel */ \n /*-----------------------------------------*/ \n \n function describeModel(_args_) ; \n s = checkAndLoadTable(_args_.model.caslib, _args_.model.name); \n if ( s ne true) then do; \n results = {Errors= 'Unable to access ' ||_args_.model.caslib||'.'||_args_.model.name}; \n return {icasResults=results, statusCode=404}; \n end; \n \n mtype = isModel(_args_.model.caslib, _args_.model.name); \n if ( mtype EQ 'astore' ) then do; \n r = astoreDescribe(_args_.model); \n end; \n else if (mtype EQ 'ds' or mtype EQ 'ds2') then do;\n s = checkAndLoadTable(_args_.table.caslib, _args_.table.name); \n if ( s ne true ) then do; \n results = {Errors= 'Unable to access ' ||_args_.table.caslib||'.'||_args_.table.name}; \n return {icasResults=results, statusCode=404}; \n end; \n r = contents( _args_.table.caslib, _args_.table.name); \n end; \n return {icasResults= r, statusCode=0} ;\n end; \n \n /*------------------------------------------*/ \n /* astoreDescribe */ \n /*------------------------------------------*/ \n \n function astoreDescribe(model); \n action astore.describe r=result/ \n rstore = { caslib= model.caslib name = model.name }; \n rows = resultsToDict(result.InputVariables); \n return {describe = rows, table = result.InputVariables}; \n end; \n \n /*------------------------------------------*/ \n /* score */ \n /*------------------------------------------*/ \n function runScoreCode( model, scenario, modelName); \n print model; \n s = checkAndLoadTable(model.caslib, model.name); \n if ( s ne true ) then do; \n results = {Errors= 'Unable to access ' ||model.caslib||'.'||model.name}; \n return {icasResults=results, statusCode=404}; \n end;\n \n mtype = isModel(model.caslib, model.name); \n \n if ( mtype eq 'bad' ) then do; \n results = {Error= model.caslib||'.'||model.name || ' is not recognized as a valid supported model. Please check your values'};\n return {icasResults=results, statusCode=400};\n end; \n destroyTable('casuser', 'input'); \n argsToTable(scenario, 'casuser', 'input'); \n \n destroyTable('casuser', 'output'); \n \n if (mtype eq 'astore') then do; \n print 'Scoring with astore'; \n action astore.score r = result/ \n rstore = {caslib=model.caslib name=model.name} \n out = {caslib='casuser' name='output'} \n table = {caslib='casuser' name='input'}; \n end; \n else if (mtype eq 'ds') then do; \n print 'scoring with datastep code'; \n action datastep.runcodetable r = result/ \n single='YES' \n codeTable= {caslib=model.caslib name=model.name} \n casout = {caslib='casuser' name='output'} \n table = {caslib='casuser' name='input'}; \n end; \n else if (mtype eq 'ds2' ) then do; \n print 'Scoring with d2'; \n if ( missing(modelName) eq true) then do;\n results = {Error= 'modelName is missing. Please check your values'};\n return {icasResults=results, statusCode=400};\n end;\n\n action ds2.runModel r = result/ \n modelTable = {caslib=model.caslib, name=model.name} \n modelName = modelName \n table = {caslib= 'casuser', name='input'} \n casOut = {caslib= 'casuser' name='output'}; \n end; \n \n \n action table.fetch r = result / \n table={caslib='casuser' name='output'}; \n \n rows = resultsToDict(result.Fetch); \n \n return {icasResults= rows, statusCode=0} ;\n end; \n \n \n "}},function(t,e,n){"use strict";(function(t){var r=n(11),a=n.n(r),s=n(8);e.a=function(e,n){var r,o,i=null,u=s.b,c=function(t){return t};switch(o=null==e?"csv":e.split(".").pop().toLowerCase()){case"sas7bdat":r="basesas";break;case"sashdat":r="hdat";break;case"csv":r=o,i="UTF8";break;case"xslx":case"xsl":r=o;break;case"astore":case"sasast":r=o,u=s.a,c=function(e){return new t.from(e).toString("base64")};break;case"ds2":case"sas":r="csv",i="UTF8",u=s.b,c=function(t,e){var n=t.replace(/[^\x00-\x7F]/g,"").replace(/\r?\n/g,""),r=e.fileExt;return"modelName\\"+("sas"===r?"dataStepSrc":"ds2"===r?"ds2Src":"casl"===r?"caslSrc":"dataStepsrc")+"\n"+e.output.name+"\\ "+n+"\n"};break;default:throw"Currently file type of ".concat(o," is not supported")}var l=n.split("."),f=a()(l,2);return{source:e,output:{caslib:f[0],name:f[1].toLowerCase()},fileType:r,fileExt:o,fileOptions:i,transform:c,contentType:"binary/octet-stream",handler:u}}}).call(this,n(16).Buffer)},function(t,e,n){var r=n(20),a=n(21),s=n(22),o=n(24);t.exports=function(t,e){return r(t)||a(t,e)||s(t,e)||o()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){t.exports=n(25)},function(t,e,n){var r=n(4).default;function a(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=a=function(){return n},t.exports.__esModule=!0,t.exports.default=t.exports;var e,n={},s=Object.prototype,o=s.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function p(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(e){p=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var a=e&&e.prototype instanceof v?e:v,s=Object.create(a.prototype),o=new P(r||[]);return i(s,"_invoke",{value:R(t,n,o)}),s}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=h;var b="suspendedStart",m="executing",y="completed",g={};function v(){}function w(){}function x(){}var _={};p(_,c,(function(){return this}));var S=Object.getPrototypeOf,k=S&&S(S(L([])));k&&k!==s&&o.call(k,c)&&(_=k);var E=x.prototype=v.prototype=Object.create(_);function C(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function n(a,s,i,u){var c=d(t[a],t,s);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==r(f)&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,i,u)}),(function(t){n("throw",t,i,u)})):e.resolve(f).then((function(t){l.value=t,i(l)}),(function(t){return n("throw",t,i,u)}))}u(c.arg)}var a;i(this,"_invoke",{value:function(t,r){function s(){return new e((function(e,a){n(t,r,e,a)}))}return a=a?a.then(s,s):s()}})}function R(t,n,r){var a=b;return function(s,o){if(a===m)throw new Error("Generator is already running");if(a===y){if("throw"===s)throw o;return{value:e,done:!0}}for(r.method=s,r.arg=o;;){var i=r.delegate;if(i){var u=A(i,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===b)throw a=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=m;var c=d(t,n,r);if("normal"===c.type){if(a=r.done?y:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(a=y,r.method="throw",r.arg=c.arg)}}}function A(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,A(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var s=d(a,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,g;var o=s.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,s=function n(){for(;++a<t.length;)if(o.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(r(t)+" is not iterable")}return w.prototype=x,i(E,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(E),t},n.awrap=function(t){return{__await:t}},C(T.prototype),p(T.prototype,l,(function(){return this})),n.AsyncIterator=T,n.async=function(t,e,r,a,s){void 0===s&&(s=Promise);var o=new T(h(t,e,r,a),s);return n.isGeneratorFunction(e)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},C(E),p(E,f,"Generator"),p(E,c,(function(){return this})),p(E,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=L,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(j),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,a){return i.type="throw",i.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],i=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var u=o.call(s,"catchLoc"),c=o.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=t,s.arg=e,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;j(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(4).default,a=n(15);t.exports=function(t){var e=a(t,"string");return"symbol"===r(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){var r=n(4).default;t.exports=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,e||"default");if("object"!==r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,n){"use strict";
2
2
  /*!
3
3
  * The buffer module from node.js, for the browser.
4
4
  *
package/lib/restaflib.js CHANGED
@@ -922,7 +922,7 @@ eval("/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_
922
922
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
923
923
 
924
924
  "use strict";
925
- eval("/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"../../../node_modules/@babel/runtime/regenerator/index.js\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _caslRun__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../caslRun */ \"./caslRun.js\");\n/*\r\n* Copyright © 2023, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.\r\n* SPDX-License-Identifier: Apache-2.0\r\n*/\n\n\n\n\n\nfunction uploadSrc(_x, _x2, _x3, _x4, _x5) {\n return _uploadSrc.apply(this, arguments);\n}\nfunction _uploadSrc() {\n _uploadSrc = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee(store, session, modelBuf, fileInfo, save) {\n var _fileInfo$output, caslib, name, rx, JSON_Parameters, p, r, casl, _r, text;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _fileInfo$output = fileInfo.output, caslib = _fileInfo$output.caslib, name = _fileInfo$output.name;\n if (!(name == null)) {\n _context.next = 3;\n break;\n }\n throw 'Please specify table as caslib.name';\n case 3:\n _context.next = 5;\n return cleanup(store, session, caslib, name);\n case 5:\n rx = _context.sent;\n JSON_Parameters = {\n casout: {\n caslib: caslib,\n /* a valid caslib */\n name: name /* name of output file on cas server */\n },\n importOptions: {\n fileType: fileInfo.fileType /* type of the file being uploaded */\n }\n };\n if (fileInfo.fileExt === 'sas' || fileInfo.fileExt === 'ds2') {\n JSON_Parameters.importOptions.delimiter = '\\\\';\n }\n p = {\n headers: {\n 'JSON-Parameters': JSON_Parameters,\n 'Content-Type': 'binary/octet-stream'\n },\n data: modelBuf,\n action: 'table.upload'\n };\n _context.next = 11;\n return store.runAction(session, p);\n case 11:\n r = _context.sent;\n if (!(save === true)) {\n _context.next = 17;\n break;\n }\n casl = \"\\n\\t\\t\\n\\t\\t\\taction table.save r = result / \\n\\t\\t\\t\\ttable = {caslib='\".concat(caslib, \"' name='\").concat(name, \"'} \\n\\t\\t\\t\\tcaslib='\").concat(caslib, \"' replace=true;\\n\\t\\t\\t\\n\\t\\t\\taction table.loadTable r = result2 /\\n\\t\\t\\t\\tcaslib='\").concat(caslib, \" casout={caslib='\").concat(caslib, \"' name='\").concat(name, \"' replace=true} \\n\\t\\t\\t\\tpath='\").concat(name, \".sashdat' ;\\n\\t\\t\\t\\tsend_response({save=result, load= result2});\\n\\n\\t\\t\\n\\t\\t send_response({status=result});\\n\\t\\t\\t\");\n _context.next = 16;\n return Object(_caslRun__WEBPACK_IMPORTED_MODULE_2__[/* default */ \"a\"])(store, session, casl, null, true);\n case 16:\n _r = _context.sent;\n case 17:\n text = fileInfo.source == null ? \"inline source\" : fileInfo.source;\n return _context.abrupt(\"return\", r);\n case 19:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return _uploadSrc.apply(this, arguments);\n}\nfunction cleanup(_x6, _x7, _x8, _x9) {\n return _cleanup.apply(this, arguments);\n}\nfunction _cleanup() {\n _cleanup = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2(store, session, caslib, name) {\n var table, deleteSrc, r;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n table = \"\".concat(caslib, \".\").concat(name);\n deleteSrc = \"\\n\\t\\taction table.dropTable/ \\n caslib='\".concat(caslib, \"' name='\").concat(name, \"' quiet=TRUE; \\n \\n action table.deleteSource status=src / \\n caslib='casuser' source= '\").concat(name, \".sashdat' quiet=TRUE; \\n\\t\\tsend_response({casResults = {status=src, results= 'data deleted'}})\\n\\t\\t\");\n _context2.next = 4;\n return Object(_caslRun__WEBPACK_IMPORTED_MODULE_2__[/* default */ \"a\"])(store, session, deleteSrc);\n case 4:\n r = _context2.sent;\n return _context2.abrupt(\"return\", r);\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _cleanup.apply(this, arguments);\n}\n/* harmony default export */ __webpack_exports__[\"a\"] = (uploadSrc);\n\n//# sourceURL=webpack://restaflib/./uploadHandlers/uploadSrc.js?");
925
+ eval("/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"../../../node_modules/@babel/runtime/regenerator/index.js\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _caslRun__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../caslRun */ \"./caslRun.js\");\n/*\r\n* Copyright © 2023, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.\r\n* SPDX-License-Identifier: Apache-2.0\r\n*/\n\n\n\n\n\nfunction uploadSrc(_x, _x2, _x3, _x4, _x5) {\n return _uploadSrc.apply(this, arguments);\n}\nfunction _uploadSrc() {\n _uploadSrc = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee(store, session, modelBuf, fileInfo, save) {\n var _fileInfo$output, caslib, name, rx, JSON_Parameters, p, r, casl, _r, text;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _fileInfo$output = fileInfo.output, caslib = _fileInfo$output.caslib, name = _fileInfo$output.name;\n if (!(name == null)) {\n _context.next = 3;\n break;\n }\n throw 'Please specify table as caslib.name';\n case 3:\n _context.next = 5;\n return cleanup(store, session, caslib, name);\n case 5:\n rx = _context.sent;\n JSON_Parameters = {\n casout: {\n caslib: caslib,\n /* a valid caslib */\n name: name /* name of output file on cas server */\n },\n importOptions: {\n fileType: fileInfo.fileType /* type of the file being uploaded */\n }\n };\n if (fileInfo.fileExt === 'sas' || fileInfo.fileExt === 'ds2') {\n JSON_Parameters.importOptions.delimiter = '\\\\';\n }\n p = {\n headers: {\n 'JSON-Parameters': JSON_Parameters,\n 'Content-Type': 'binary/octet-stream'\n },\n data: modelBuf,\n action: 'table.upload'\n };\n _context.next = 11;\n return store.runAction(session, p);\n case 11:\n r = _context.sent;\n if (!(save === true)) {\n _context.next = 17;\n break;\n }\n casl = \"\\n\\t\\t\\n\\t\\t\\taction table.save r = result / \\n\\t\\t\\t\\ttable = {caslib='\".concat(caslib, \"' name='\").concat(name, \"'} \\n\\t\\t\\t\\tcaslib='\").concat(caslib, \"' name='\").concat(name, \"' replace=true;\\n\\t\\t\\t\\n\\t\\t\\taction table.loadTable r = result2 /\\n\\t\\t\\t\\tcaslib='\").concat(caslib, \"' casout={caslib='\").concat(caslib, \"' name='\").concat(name, \"' replace=true} \\n\\t\\t\\t\\tpath='\").concat(name, \".sashdat' ;\\n\\n\\t\\t\\n\\t\\t send_response({status=result2});\\n\\t\\t\\t\");\n _context.next = 16;\n return Object(_caslRun__WEBPACK_IMPORTED_MODULE_2__[/* default */ \"a\"])(store, session, casl, null, true);\n case 16:\n _r = _context.sent;\n case 17:\n text = fileInfo.source == null ? \"inline source\" : fileInfo.source;\n return _context.abrupt(\"return\", r);\n case 19:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return _uploadSrc.apply(this, arguments);\n}\nfunction cleanup(_x6, _x7, _x8, _x9) {\n return _cleanup.apply(this, arguments);\n}\nfunction _cleanup() {\n _cleanup = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee2(store, session, caslib, name) {\n var table, deleteSrc, r;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n table = \"\".concat(caslib, \".\").concat(name);\n deleteSrc = \"\\n\\t\\taction table.dropTable/ \\n caslib='\".concat(caslib, \"' name='\").concat(name, \"' quiet=TRUE; \\n \\n action table.deleteSource status=src / \\n caslib='casuser' source= '\").concat(name, \".sashdat' quiet=TRUE; \\n\\t\\tsend_response({casResults = {status=src, results= 'data deleted'}})\\n\\t\\t\");\n _context2.next = 4;\n return Object(_caslRun__WEBPACK_IMPORTED_MODULE_2__[/* default */ \"a\"])(store, session, deleteSrc);\n case 4:\n r = _context2.sent;\n return _context2.abrupt(\"return\", r);\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n return _cleanup.apply(this, arguments);\n}\n/* harmony default export */ __webpack_exports__[\"a\"] = (uploadSrc);\n\n//# sourceURL=webpack://restaflib/./uploadHandlers/uploadSrc.js?");
926
926
 
927
927
  /***/ }),
928
928
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassoftware/restaflib",
3
- "version": "5.3.3-6",
3
+ "version": "5.3.3-7",
4
4
  "description": "collection of useful functions for common scenarios",
5
5
  "repository": {
6
6
  "type": "git",