diff --git a/complete/completion_oafp.sh b/complete/completion_oafp.sh index ba537c7c..97bc8177 100644 --- a/complete/completion_oafp.sh +++ b/complete/completion_oafp.sh @@ -8,7 +8,7 @@ F_in__in_ch=0 F_in__in_ch_inch=1 F_in__in_ch_inchall=1 F_in__in_csv=0 -F_in__in_csv_csv_=1 +F_in__in_csv_incsv_=1 F_in__in_db=0 F_in__in_db_indbjdbc_=1 F_in__in_db_indbuser_=1 @@ -85,15 +85,10 @@ F_out__out_cmd_outcmdjoin_=1 F_out__out_cmd_outcmdseq_=1 F_out__out_cmd_outcmdnl_=1 F_out__out_cmd_outcmdparam_=1 +F_out__out_cmd_outcmdtmpl_=1 F_out__out_cslon=0 F_out__out_csv=0 -F_out__out_csv_format_=1 -F_out__out_csv_withHeader_=1 -F_out__out_csv_withHeaders_=1 -F_out__out_csv_quoteMode_=1 -F_out__out_csv_withDelimiter_=1 -F_out__out_csv_withEscape_=1 -F_out__out_csv_withNullString_=1 +F_out__out_csv_csv_=1 F_out__out_ctable=0 F_out__out_ctree=0 F_out__out_cyaml=0 @@ -153,6 +148,7 @@ F_out__out_template=0 F_out__out_template_template_=1 F_out__out_template_templatepath_=1 F_out__out_template_templatedata_=1 +F_out__out_template_templatetmpl_=1 F_out__out_text=0 F_out__out_toml=0 F_out__out_tree=0 @@ -250,7 +246,7 @@ if [ $# -gt 0 ]; then if [ "${arg#inch}" != "$arg" ]; then FFOUND=1; F_in__in_ch_inch=0; fi if [ "${arg#inchall}" != "$arg" ]; then FFOUND=1; F_in__in_ch_inchall=0; fi if [ "$arg" = "in=csv" ]; then FFOUND=1; F_in__in_csv=1; F_in_=0; fi - if [ "${arg#csv=}" != "$arg" ]; then FFOUND=1; F_in__in_csv_csv_=0; fi + if [ "${arg#incsv=}" != "$arg" ]; then FFOUND=1; F_in__in_csv_incsv_=0; fi if [ "$arg" = "in=db" ]; then FFOUND=1; F_in__in_db=1; F_in_=0; fi if [ "${arg#indbjdbc=}" != "$arg" ]; then FFOUND=1; F_in__in_db_indbjdbc_=0; fi if [ "${arg#indbuser=}" != "$arg" ]; then FFOUND=1; F_in__in_db_indbuser_=0; fi @@ -327,15 +323,10 @@ if [ $# -gt 0 ]; then if [ "${arg#outcmdseq=}" != "$arg" ]; then FFOUND=1; F_out__out_cmd_outcmdseq_=0; fi if [ "${arg#outcmdnl=}" != "$arg" ]; then FFOUND=1; F_out__out_cmd_outcmdnl_=0; fi if [ "${arg#outcmdparam=}" != "$arg" ]; then FFOUND=1; F_out__out_cmd_outcmdparam_=0; fi + if [ "${arg#outcmdtmpl=}" != "$arg" ]; then FFOUND=1; F_out__out_cmd_outcmdtmpl_=0; fi if [ "$arg" = "out=cslon" ]; then FFOUND=1; F_out__out_cslon=1; F_out_=0; fi if [ "$arg" = "out=csv" ]; then FFOUND=1; F_out__out_csv=1; F_out_=0; fi - if [ "${arg#format=}" != "$arg" ]; then FFOUND=1; F_out__out_csv_format_=0; fi - if [ "${arg#withHeader=}" != "$arg" ]; then FFOUND=1; F_out__out_csv_withHeader_=0; fi - if [ "${arg#withHeaders=}" != "$arg" ]; then FFOUND=1; F_out__out_csv_withHeaders_=0; fi - if [ "${arg#quoteMode=}" != "$arg" ]; then FFOUND=1; F_out__out_csv_quoteMode_=0; fi - if [ "${arg#withDelimiter=}" != "$arg" ]; then FFOUND=1; F_out__out_csv_withDelimiter_=0; fi - if [ "${arg#withEscape=}" != "$arg" ]; then FFOUND=1; F_out__out_csv_withEscape_=0; fi - if [ "${arg#withNullString=}" != "$arg" ]; then FFOUND=1; F_out__out_csv_withNullString_=0; fi + if [ "${arg#csv=}" != "$arg" ]; then FFOUND=1; F_out__out_csv_csv_=0; fi if [ "$arg" = "out=ctable" ]; then FFOUND=1; F_out__out_ctable=1; F_out_=0; fi if [ "$arg" = "out=ctree" ]; then FFOUND=1; F_out__out_ctree=1; F_out_=0; fi if [ "$arg" = "out=cyaml" ]; then FFOUND=1; F_out__out_cyaml=1; F_out_=0; fi @@ -395,6 +386,7 @@ if [ $# -gt 0 ]; then if [ "${arg#template=}" != "$arg" ]; then FFOUND=1; F_out__out_template_template_=0; fi if [ "${arg#templatepath=}" != "$arg" ]; then FFOUND=1; F_out__out_template_templatepath_=0; fi if [ "${arg#templatedata=}" != "$arg" ]; then FFOUND=1; F_out__out_template_templatedata_=0; fi + if [ "${arg#templatetmpl=}" != "$arg" ]; then FFOUND=1; F_out__out_template_templatetmpl_=0; fi if [ "$arg" = "out=text" ]; then FFOUND=1; F_out__out_text=1; F_out_=0; fi if [ "$arg" = "out=toml" ]; then FFOUND=1; F_out__out_toml=1; F_out_=0; fi if [ "$arg" = "out=tree" ]; then FFOUND=1; F_out__out_tree=1; F_out_=0; fi @@ -573,8 +565,8 @@ if [ $F_in__in_ch -eq 1 ]; then fi fi if [ $F_in__in_csv -eq 1 ]; then - if [ $F_in__in_csv_csv_ -eq 1 ]; then - echo "csv= If type=csv, the CSV options to use" + if [ $F_in__in_csv_incsv_ -eq 1 ]; then + echo "incsv= If in=csv, the CSV options to use" fi fi if [ $F_in__in_db -eq 1 ]; then @@ -787,28 +779,13 @@ if [ $F_out__out_cmd -eq 1 ]; then if [ $F_out__out_cmd_outcmdparam_ -eq 1 ]; then echo "outcmdparam= If true the input entry will be replaced on the 'outcmd' where '{}' is found" fi + if [ $F_out__out_cmd_outcmdtmpl_ -eq 1 ]; then + echo "outcmdtmpl= If true the input entry will be considered as an OpenAF template" + fi fi if [ $F_out__out_csv -eq 1 ]; then - if [ $F_out__out_csv_format_ -eq 1 ]; then - echo "format= You can choose between DEFAULT, EXCEL, INFORMIX_UNLOAD, INFORMIX_UNLOAD_CSV, MYSQL, RFC4180, ORACLE, POSTGRESQL_CSV, POSTGRESQL_TEXT and TDF" - fi - if [ $F_out__out_csv_withHeader_ -eq 1 ]; then - echo "withHeader= If true tries to automatically use the available header" - fi - if [ $F_out__out_csv_withHeaders_ -eq 1 ]; then - echo "withHeaders= A list of headers to use with the corresponding order" - fi - if [ $F_out__out_csv_quoteMode_ -eq 1 ]; then - echo "quoteMode= You can choose between ALL, ALL_NON_NULL, MINIMAL, NON_NUMERIC and NONE." - fi - if [ $F_out__out_csv_withDelimiter_ -eq 1 ]; then - echo "withDelimiter= A single character as a custom delimiter" - fi - if [ $F_out__out_csv_withEscape_ -eq 1 ]; then - echo "withEscape= A single character as a custom escape" - fi - if [ $F_out__out_csv_withNullString_ -eq 1 ]; then - echo "withNullString= String to use as representation of null values" + if [ $F_out__out_csv_csv_ -eq 1 ]; then + echo "csv= If out=csv, the CSV options to use" fi fi if [ $F_out__out_db -eq 1 ]; then @@ -914,7 +891,7 @@ if [ $F_out__out_sql -eq 1 ]; then fi if [ $F_out__out_template -eq 1 ]; then if [ $F_out__out_template_template_ -eq 1 ]; then - echo "template= A file path to a HandleBars' template" + echo "template= A file path to a HandleBars' template or a string template definition if 'templatetmpl' is true" fi if [ $F_out__out_template_templatepath_ -eq 1 ]; then echo "templatepath= If 'template' is not provided a path to the template definition -pre-transformation-" @@ -922,6 +899,9 @@ if [ $F_out__out_template -eq 1 ]; then if [ $F_out__out_template_templatedata_ -eq 1 ]; then echo "templatedata= If defined the template data will be retrieved from the provided path" fi + if [ $F_out__out_template_templatetmpl_ -eq 1 ]; then + echo "templatetmpl= If true the 'template' will be interpreted as the template defintion instead of a file path" + fi fi if [ $F_out__out_xls -eq 1 ]; then if [ $F_out__out_xls_xlsfile_ -eq 1 ]; then diff --git a/complete/completion_oafp.yaml b/complete/completion_oafp.yaml index c9fca780..addde48d 100644 --- a/complete/completion_oafp.yaml +++ b/complete/completion_oafp.yaml @@ -17,8 +17,8 @@ complete: - name: in=csv desc: A CSV format -auto-detected- opts: - - name: csv= - desc: If type=csv, the CSV options to use + - name: incsv= + desc: If in=csv, the CSV options to use - name: in=db desc: A JDBC query to a database opts: @@ -189,25 +189,15 @@ complete: desc: If true each command execution output will be appended with a new-line - name: outcmdparam= desc: If true the input entry will be replaced on the 'outcmd' where '{}' is found + - name: outcmdtmpl= + desc: If true the input entry will be considered as an OpenAF template - name: out=cslon desc: A SLON format forcely colored - name: out=csv desc: A CSV format -only for list outputs- opts: - - name: format= - desc: You can choose between DEFAULT, EXCEL, INFORMIX_UNLOAD, INFORMIX_UNLOAD_CSV, MYSQL, RFC4180, ORACLE, POSTGRESQL_CSV, POSTGRESQL_TEXT and TDF - - name: withHeader= - desc: If true tries to automatically use the available header - - name: withHeaders= - desc: A list of headers to use with the corresponding order - - name: quoteMode= - desc: You can choose between ALL, ALL_NON_NULL, MINIMAL, NON_NUMERIC and NONE. - - name: withDelimiter= - desc: A single character as a custom delimiter - - name: withEscape= - desc: A single character as a custom escape - - name: withNullString= - desc: String to use as representation of null values + - name: csv= + desc: If out=csv, the CSV options to use - name: out=ctable desc: A table-like forcely colored format -only for list outputs- - name: out=ctree @@ -332,11 +322,13 @@ complete: desc: A Handlebars template format opts: - name: template= - desc: A file path to a HandleBars' template + desc: A file path to a HandleBars' template or a string template definition if 'templatetmpl' is true - name: templatepath= desc: If 'template' is not provided a path to the template definition -pre-transformation- - name: templatedata= desc: If defined the template data will be retrieved from the provided path + - name: templatetmpl= + desc: If true the 'template' will be interpreted as the template defintion instead of a file path - name: out=text desc: A string text format - name: out=toml diff --git a/js/oafp.js b/js/oafp.js index 93f9d41b..f0bb8ef0 100755 --- a/js/oafp.js +++ b/js/oafp.js @@ -1,5 +1,5 @@ var params=processExpr(" "); -// (author: Nuno Aguiar, version: 20240904, license: Apache 2.0, url: https://github.com/openaf/oafp) +// (author: Nuno Aguiar, version: 20240925, license: Apache 2.0, url: https://github.com/openaf/oafp) // --- const _oafphelp={'docs/EXAMPLES.md':af.fromBytes2String(io.gunzip(af.fromBase64("H4sIAAAAAAAA/+1aS28byRG+81cUqASUBA7f5JAM5IVWWnu1th6wZO8uJGPdM9PktDUzPds9I4leLxDsJcl997ZADkEOewgQIEBOufmf+BfkJ6S6Z4YzfNmivVYOCW0N2dNV1V9Vd1dVPzbgOKTB7n0IBbeplFwAvSF+6FFZKm1swL///Nc/wadEMlsVN+D4ydnJk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PCxXdtmywPRfUssBqDnCI9cin+6UgpwcbQnB7AHqAeqi5Z1VQeWchu8KgMHPtDiWl1Xqtx0gkArt4FKAIJWZYligUdb/M6KoUFBX9UId63MSoQJ/Txtq/21t6jTek1/fwt35VEluoCAl7YNidsbV5R6ruW6rgPxtJMT66eHgHEjuYlf9WqCrjUa0YlrRSEWnaRwCwMz4qhW4y+Wsxvv9o/yudX95OgsdleHUwPezxP6sz5Y6HIQAA"))), @@ -10,14 +10,14 @@ const oafp=b=>{if(!isUnDef(b)&&!isDef(b.____ojob)){Object.keys(b).forEach(a=>{if break;default:d=__}if(isArray(a)&&0{isUnDef(e.table)&&k(-1,"One 'table' not defined in isqlfiltertables");e.path=_$(e.path,"isqlfiltertables table "+e.table+" path").isString().default("@");var g=$path(a,e.path);isArray(g)&&(f=f.table(e.table,g))}),a=f.closeQuery(c.__isql.trim()))}else a=$sql(a,c.__isql.trim(),d);delete c.__isql}c.__path&&(a=$path(a,c.__path.trim()),delete c.__path);if(isString(a))return N(a); a=N(a);c.__from&&(a=$from(a).query(af.fromNLinq(c.__from.trim())),delete c.__from);if(c.__sql){d=__;if(isString(b.sqlfilter))switch(b.sqlfilter.toLowerCase()){case "simple":d="nlinq";break;case "advanced":d="h2";break;default:d=__}isArray(a)&&0{isUnDef(e.table)&&k(-1,"One 'table' not defined in sqlfiltertables");e.path=_$(e.path,"sqlfiltertables table "+e.table+" path").isString().default("@");var g= $path(a,e.path);isArray(g)&&(f=f.table(e.table,g))}),a=f.closeQuery(c.__sql.trim()))):a=$sql(a,c.__sql.trim(),d));delete c.__sql}c.__opath&&(a=$path(a,c.__opath.trim()),delete c.__opath);return a},l=(a,c,d)=>{c=clone(c);toBoolean(b.color)?__conConsole=!0:isDef(b.color)&&(__conAnsi=!1);a=isString(a)?a.trim().startsWith("{")&&a.trim().endsWith("}")?J(jsonParse(a,__,__,!0),c):J(a,c):d?J([a],c)[0]:J(a,c);isDef(b.outputkey)&&(a=$$({}).set(b.outputkey,a));isDef(b.outkey)&&(a=$$({}).set(b.outkey,a));Q(); -isUnDef(c.__format)&&(c.__format=getEnvsDef("OAFP_OUTPUT",c.__format,"tree"));G.has(c.__format)?G.get(c.__format)(a,c):q(a,c,__)},C=(a,c)=>{var d=af.fromString2Bytes(""),f=af.newOutputStream();$sh(a).cb((e,g,h)=>{ioStreamCopy(f,e);e=f.toByteArray();0{if(!isString(a)||""==a||isNull(a))return"";a=a.trim();return a.startsWith("{")?jsonParse(a,__,__,!0):af.fromSLON(a)},K=(a,c,d,f)=>{d=_$(d).isString().default("_oafp_fn_");c=splitBySepWithEnc(c, -" ",[['"','"'],["'","'"]]);let e=[];$ch("__oaf::chart").create();if(1{if(0==n){if(m.startsWith("-"))return m;global[d+g]=()=>{if(isString(f)){var r=$ch("__oaf::chart").get({name:f});r=isUnDef(r)?[]:r.data;var w=$path(a,m);if(isArray(w))return w.forEach((A,y)=>{isArray(r[y])?r[y].push(A):r[y]=[A]}),w=r.pop(),$ch("__oaf::chart").set({name:f},{name:f,data:r}),w[0]}else return $path(a, -m)};return d+g}return m}).join(":");e.push(h)}return e.join(" ")}return""},p=a=>{"undefined"!==typeof a&&("undefined"===typeof b.outfile?(toBoolean(b.loopcls)&&cls(),print(a)):("undefined"===typeof global.__oafp_streams&&(global.__oafp_streams={}),"undefined"!==typeof global.__oafp_streams[b.outfile]&&ioStreamWrite(global.__oafp_streams[b.outfile].s,a+(toBoolean(b.outfileappend)?"\n":""))))},q=(a,c,d)=>{"undefined"!==typeof a&&(a=$o(a,c,d,!0),isDef(a)&&p(a))},t=a=>{"grid"==b.out||b.__inception||toBoolean(b.loopcls)|| -toBoolean(b.chartcls)||printErrnl(_$(a).default("(processing data...)"))},Q=a=>{"grid"==b.out||b.__inception||toBoolean(b.loopcls)||toBoolean(b.chartcls)||printErrnl("\r"+" ".repeat(_$(a).default("(processing data...)").length)+"\r")},k=(a,c)=>{isUnDef(c)&&(c="exit: "+a);if(isUnDef(ow.oJob)&&!toBoolean(b.noexit))0!=a&&printErr(c),exit(a);else throw c;},x=()=>{__initializeCon();b.help=_$(b.help,"help").isString().default("");switch(b.help.toLowerCase()){case "filters":var a="docs/FILTERS.md";break; -case "template":a="docs/TEMPLATE.md";break;case "examples":a="docs/EXAMPLES.md";break;case "readme":case "usage":a="docs/USAGE.md";break;default:a=b.help.toLowerCase(),a=isDef(D[a])?"docs/"+a+".md":"docs/USAGE.md"}var c=(getOPackPath("oafproc")||".")+"/"+a;let d="";if("docs/USAGE.md"==a&&0{var a=(getOPackPath("oafproc")||".")+"/.package.yaml";a={oafp:{version:io.fileExists(a)?io.readFileYAML(a).version:"(not available/embedded)",inputs:Array.from(F.keys()).filter(c=>"?"!=c).sort(), -transforms:Object.keys(E).filter(c=>"transforms"!=c).sort(),outputs:Array.from(G.keys()).filter(c=>"?"!=c).sort(),flags:__flags.OAFP},openaf:{version:getVersion(),distribution:getDistribution(),home:getOpenAFPath(),opacks:$from($m4a(getOPackLocalDB())).notEquals("name","OpenAF").sort("name").select({name:"",version:""})},java:{version:ow.format.getJavaVersion(),home:ow.format.getJavaHome(),vendor:String(java.lang.System.getProperty("java.vendor")),params:af.fromJavaArray(java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments())}, +isUnDef(c.__format)&&(c.__format=getEnvsDef("OAFP_OUTPUT",c.__format,"tree"));G.has(c.__format)?G.get(c.__format)(a,c):q(a,c,__)},C=(a,c)=>{var d=af.fromString2Bytes(""),f=af.newOutputStream();$sh(a).cb((e,g,h)=>{ioStreamCopy(f,e);e=f.toByteArray();0{if(!isString(a)||""==a||isNull(a))return"";a=a.trim();return isDef(af.fromJSSLON)?af.fromJSSLON(a):a.startsWith("{")?jsonParse(a,__,__,!0):af.fromSLON(a)},K=(a,c,d,f)=>{d=_$(d).isString().default("_oafp_fn_"); +c=splitBySepWithEnc(c," ",[['"','"'],["'","'"]]);let e=[];$ch("__oaf::chart").create();if(1{if(0==n){if(m.startsWith("-"))return m;global[d+g]=()=>{if(isString(f)){var r=$ch("__oaf::chart").get({name:f});r=isUnDef(r)?[]:r.data;var w=$path(a,m);if(isArray(w))return w.forEach((A,y)=>{isArray(r[y])?r[y].push(A):r[y]=[A]}),w=r.pop(),$ch("__oaf::chart").set({name:f},{name:f, +data:r}),w[0]}else return $path(a,m)};return d+g}return m}).join(":");e.push(h)}return e.join(" ")}return""},p=a=>{"undefined"!==typeof a&&("undefined"===typeof b.outfile?(toBoolean(b.loopcls)&&cls(),print(a)):("undefined"===typeof global.__oafp_streams&&(global.__oafp_streams={}),"undefined"!==typeof global.__oafp_streams[b.outfile]&&ioStreamWrite(global.__oafp_streams[b.outfile].s,a+(toBoolean(b.outfileappend)?"\n":""))))},q=(a,c,d)=>{"undefined"!==typeof a&&(a=$o(a,c,d,!0),isDef(a)&&p(a))},t=a=> +{"grid"==b.out||b.__inception||toBoolean(b.loopcls)||toBoolean(b.chartcls)||printErrnl(_$(a).default("(processing data...)"))},Q=a=>{"grid"==b.out||b.__inception||toBoolean(b.loopcls)||toBoolean(b.chartcls)||printErrnl("\r"+" ".repeat(_$(a).default("(processing data...)").length)+"\r")},k=(a,c)=>{isUnDef(c)&&(c="exit: "+a);if(isUnDef(ow.oJob)&&!toBoolean(b.noexit))0!=a&&printErr(c),exit(a);else throw c;},x=()=>{__initializeCon();b.help=_$(b.help,"help").isString().default("");switch(b.help.toLowerCase()){case "filters":var a= +"docs/FILTERS.md";break;case "template":a="docs/TEMPLATE.md";break;case "examples":a="docs/EXAMPLES.md";break;case "readme":case "usage":a="docs/USAGE.md";break;default:a=b.help.toLowerCase(),a=isDef(D[a])?"docs/"+a+".md":"docs/USAGE.md"}var c=(getOPackPath("oafproc")||".")+"/"+a;let d="";if("docs/USAGE.md"==a&&0{var a=(getOPackPath("oafproc")||".")+"/.package.yaml";a={oafp:{version:io.fileExists(a)?io.readFileYAML(a).version:"(not available/embedded)",inputs:Array.from(F.keys()).filter(c=> +"?"!=c).sort(),transforms:Object.keys(E).filter(c=>"transforms"!=c).sort(),outputs:Array.from(G.keys()).filter(c=>"?"!=c).sort(),flags:__flags.OAFP},openaf:{version:getVersion(),distribution:getDistribution(),home:getOpenAFPath(),opacks:$from($m4a(getOPackLocalDB())).notEquals("name","OpenAF").sort("name").select({name:"",version:""})},java:{version:ow.format.getJavaVersion(),home:ow.format.getJavaHome(),vendor:String(java.lang.System.getProperty("java.vendor")),params:af.fromJavaArray(java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments())}, os:{name:String(java.lang.System.getProperty("os.name")),version:String(java.lang.System.getProperty("os.version")),arch:ow.format.getOSArch(),cpuCores:getNumberOfCores(!0),mem:{max:Number(java.lang.Runtime.getRuntime().maxMemory()),total:Number(java.lang.Runtime.getRuntime().totalMemory())},store:{tmpDirPath:String(java.lang.System.getProperty("java.io.tmpdir")),freeTmpDirBytes:Number(java.nio.file.Files.getFileStore(java.nio.file.Paths.get(java.lang.System.getProperty("java.io.tmpdir"))).getUsableSpace())}}}; return stringify(a,__,"")};ow.loadFormat();b.format=b.output||b.format||b.out;b.type=b.input||b.type||b.in;b.out=b.format;b.output=b.format;b.in=b.type;b.input=b.type;if(isUnDef(b.file)&&isUnDef(b.cmd)){var H=__;for(let a in b)if(""===b[a]&&"-debug"!=a&&"-v"!=a&&"-examples"!=a){H=a;break}b.file=H}"[object Object]"==Object.prototype.toString.call(b.data)&&(b.data=stringify(b.data,__,""));var L=new Map([[".json","json"],[".ndjson","ndjson"],[".slon","slon"],[".yaml","yaml"],[".xml","xml"],[".csv","csv"], [".ini","ini"],[".md","md"],[".xls","xls"],[".xlsx","xls"],[".sql","sql"],[".toml","toml"],[".jwt","jwt"]]),O=new Set(["csv","ndjson"]),P={lines:(a,c)=>{isBoolean(b.linesjoin)||(b.linesjoin=toBoolean(_$(b.linesjoin,"linesjoin").isString().default(__)));if(!b.linesjoin&&isString(a))0!=a.trim().length&&(0{isBoolean(b.ndjsonjoin)||(b.ndjsonjoin=toBoolean(_$(b.ndjsonjoin,"ndjsonjoin").isString().default(__)));if(b.ndjsonjoin)return!0; @@ -72,27 +72,28 @@ isDef(a.claims.nbf)&&(a.claims.nbf=new Date(1E3*a.claims.nbf)));l(a,c)}],["sql", k(-1,"inch.type is not defined.");isDef(b.inch.lib)&&loadLib(b.inch.lib);"remote"==b.inch.type?$ch("oafp::indata").createRemote(b.inch.url):$ch("oafp::indata").create(b.inch.type,b.inch.options);var d=v(a);toBoolean(b.inchall)||0==a.trim().length?l($ch("oafp::indata").getAll(isMap(d)?d:__),c):l($ch("oafp::indata").get(isMap(d)?d:__),c);$ch("oafp::indata").destroy()}else k(-1,"inch is not a valid map.")}],["db",(a,c)=>{if(isString(a)){t();isString(b.indbjdbc)||k(-1,"indbjdbc URL is not defined."); try{isDef(b.indblib)&&loadLib("jdbc-"+b.indblib+".js");var d=new DB(b.indbjdbc,b.indbuser,b.indbpass,b.indbtimeout);d.convertDates(!0);if(toBoolean(b.indbexec)){var f=d.u(a);l({affectedRows:f},c);d.commit()}else f=d.q(a),isMap(f)&&isArray(f.results)?l(f.results,c):k(-1,"Invalid DB result: "+stringify(f))}catch(e){printErr(e.message),isDef(d)&&d.rollback(),k(-1,"Error executing SQL: "+e.message)}finally{isDef(d)&&(d.rollback(),d.close())}}else k(-1,"db is only supported with a SQL string.")}],["xls", (a,c)=>{t();try{includeOPack("plugin-XLS")}catch(f){k(-1,"plugin-XLS not found. You need to install it to use the XLS output (opack install plugin-XLS)")}b.xlssheet=_$(b.xlssheet,"xlssheet").isString().default(0);b.xlsevalformulas=toBoolean(_$(b.xlsevalformulas,"xlsevalformulas").isString().default(!0));b.xlscol=_$(b.xlscol,"xlscol").isString().default("A");b.xlsrow=_$(b.xlsrow,"xlsrow").isString().default(1);plugin("XLS");if(isDef(b.file)||isDef(b.cmd)){a=new XLS(isDef(b.cmd)?C(b.cmd):b.file);var d= -a.getSheet(b.xlssheet);d=a.getTable(d,b.xlsevalformulas,b.xlscol,b.xlsrow);a.close();isDef(d)&&isMap(d)&&(d=d.table);l(d,c)}else k(-1,"XLS is only support with 'file' or 'cmd' defined. Please provide a file=... or a cmd=...")}],["csv",(a,c)=>{t();if(isDef(b.file)||isDef(b.cmd)){var d=isDef(b.cmd)?af.fromBytes2InputStream(C(b.cmd)):io.readFileStream(b.file);a=$csv(b.inputcsv).fromInStream(d).toOutArray();d.close()}else a=$csv(b.inputcsv).fromInString(a).toOutArray();l(a,c)}],["hsperf",(a,c)=>{if(isDef(b.file)|| -isDef(b.cmd)){t();ow.loadJava();var d=isDef(b.cmd)?ow.java.parseHSPerf(C(b.cmd)):ow.java.parseHSPerf(b.file);d.__ts=new Date;var f=0,e=0;d.sun.gc.generation.forEach(g=>{g.space.forEach(h=>{e+=Number(h.used);f=isNumber(h.capacity)?f+Number(h.capacity):f;d.sun.gc["__percUsed_"+h.name]=100*h.used/h.capacity})});d.sun.gc.__percUsed_meta=100*d.sun.gc.metaspace.used/d.sun.gc.metaspace.capacity;d.sun.gc.__percUsed_ccs=100*d.sun.gc.compressedclassspace.used/d.sun.gc.compressedclassspace.capacity;a=$from(d.sun.gc.collector).equals("name", -"PSScavenge").at(0);d.sun.gc.__ygc=isDef(a)?Number(a.invocations):0;d.sun.gc.__ygct=isDef(a)?Number(a.time/1E9):0;a=$from(d.sun.gc.collector).equals("name","PSParallelCompact").orEquals("name","").at(0);d.sun.gc.__fgc=isDef(a)?Number(a.invocations):0;d.sun.gc.__fgct=isDef(a)?Number(a.time/1E9):0;d.sun.gc.__gct=$from(d.sun.gc.collector).sum("time")/1E9;d.java.__mem={total:f,used:e,free:f-e,metaMax:d.sun.gc.metaspace.maxCapacity,metaTotal:d.sun.gc.metaspace.capacity,metaUsed:d.sun.gc.metaspace.used, -metaFree:d.sun.gc.metaspace.capacity-d.sun.gc.metaspace.used};l(d,c)}else k(-1,"hsperf is only supported with either 'file' or 'cmd' defined.")}],["rawhex",(a,c)=>{b.inrawhexline=_$(b.inrawhexline,"inrawhexline").isNumber().default(__);t();a=isDef(b.file)||isDef(b.cmd)?isDef(b.cmd)?C(b.cmd):io.readFileBytes(b.file):af.fromString2Bytes(a);a=ow.format.string.toHexArray(a,b.inrawhexline);a.forEach(d=>{d.characters=d.characters.replace(/[\x00-\x1F\x80-\xFF]/g,".")});l(a,c)}],["base64",(a,c)=>{t();a=toBoolean(b.base64gzip)? -af.fromBytes2String(io.gunzip(af.fromBase64(a,!0))):af.fromBytes2String(af.fromBase64(a));l(a,c)}],["gb64json",(a,c)=>{t();a=af.fromBytes2String(io.gunzip(af.fromBase64(a,!0)));l(a,c)}],["oaf",(a,c)=>{isString(a)||k(-1,"oaf is only supported with a string.");t();a=af.eval(a);l(a,c)}],["oafp",(a,c)=>{b.__inception=!0;a=v(a);var d="_oafp_key_"+genUUID();if(isMap(a))a.out="key",a.__key=d,a.__inception=!0,oafp(a),a=$get(d),$unset(d),l(a,c);else if(isArray(a)){ow.loadObj();$set(d,!0);var f=new ow.obj.syncArray; -a=a.map((e,g)=>{var h=d+"_"+String(g);e.out="key";e.__key=h;e.__inception=!0;return $do(()=>{oafp(e);f.add($get(h));$unset(h)}).catch(m=>{sprintErr(m)})});$doWait($doAll(a));l(f.toArray(),c)}else k(-1,"oafp input data needs to be a map or an array.")}],["sh",(a,c)=>{t();a=v(a);if(isString(a))a=$sh(a).get(0);else{isMap(a)||k(-1,"For in=sh the input data needs to a string or a map");var d=$sh();isUnDef(a.cmd)&&k(-1,"For in=sh the input data needs to a string or a map with the a 'cmd'");d=d.sh(a.cmd); -isDef(a.envs)&&(d=d.envs(a.envs,a.envsall));isDef(a.prefix)&&(d=d.prefix(a.prefix));isDef(a.pwd)&&(d=d.pwd(a.pwd));switch(b.inshformat){case "raw":a=d.get(0);break;case "yaml":a=d.getYaml(0);break;default:a=d.getJson(0)}}l(a,c)}],["llm",(a,c)=>{b.llmenv=_$(b.llmenv,"llmenv").isString().default("OAFP_MODEL");b.llmoptions=_$(b.llmoptions,"llmoptions").isString().default(__);isUnDef(b.llmoptions)&&!isString(getEnv(b.llmenv))&&k(-1,"llmoptions not defined and "+b.llmenv+" not found.");t();var d=$llm(isDef(b.llmoptions)? -b.llmoptions:$sec("system","envs").get(b.llmenv));isDef(b.llmconversation)&&io.fileExists(b.llmconversation)&&d.getGPT().setConversation(io.readFileJSON(b.llmconversation));let f;isString(b.llmimage)&&(b.llmimage.toLowerCase().match(/^https?:\/\//)?f=af.fromBytes2String(af.toBase64Bytes(af.fromInputStream2Bytes($rest().get2Stream(b.llmimage)))):io.fileExists(b.llmimage)&&(f=af.fromBytes2String(af.toBase64Bytes(io.readFileBytes(b.llmimage)))));a="md"==b.output||"mdtable"==b.output||"raw"==b.output? -isDef(f)?d.promptImage(a,f):d.prompt(a):isDef(f)?d.promptImage(a,f,__,__,__,__,!0):d.promptJSON(a);isDef(b.llmconversation)&&(d=d.getGPT().getConversation(),d.push({role:"assistant",content:stringify(a,__,"")}),io.writeFileJSON(b.llmconversation,d,""));l(jsonParse(a,__,__,isString(a)),c)}],["llmmodels",(a,c)=>{b.llmenv=_$(b.llmenv,"llmenv").isString().default("OAFP_MODEL");b.llmoptions=_$(b.llmoptions,"llmoptions").isString().default(__);isUnDef(b.llmoptions)&&!isString(getEnv(b.llmenv))&&k(-1,"llmoptions not defined and "+ -b.llmenv+" not found.");t();a=$llm(isDef(b.llmoptions)?b.llmoptions:$sec("system","envs").get(b.llmenv));isUnDef(a.getModels)&&k(-1,"OpenAF support for llm model listing API not found.");l(a.getModels(),c)}],["ls",(a,c)=>{t();if(isString(a)){var d=toBoolean(b.lsposix);isDef(b.file)&&(a=b.file);var f=io.fileExists(a),e;f&&(e=io.fileInfo(a));if(f&&e.isFile)switch(isDef(b.lsext)?b.lsext:e.filename.replace(/^.*\./,"").toLowerCase()){case "tgz":case "gz":a=io.listFilesTAR(a,!0);break;case "tar":a=io.listFilesTAR(a); -break;default:plugin("ZIP"),a=$m4a((new ZIP).list(a))}else a=toBoolean(b.lsrecursive)?listFilesRecursive(a,d):io.listFiles(a,d).files;l(a,c)}else k(-1,"ls is only supported with a string.")}],["toml",(a,c)=>{t();isUnDef(af.fromTOML)&&k(-1,"TOML support not found.");l(af.fromTOML(a),c)}],["slon",(a,c)=>{t();l(af.fromSLON(a),c)}],["json",(a,c)=>{t();l(jsonParse(a,__,__,isString(a)),c)}]]),D={};isString(b.libs)&&(b.libs=b.libs.split(",").map(a=>a.trim()).filter(a=>0{try{var c=require("oafp_"+a+".js");if(isDef(c.oafplib)){var d=c.oafplib(clone(b),l,q,{_runCmd2Bytes:C,_fromJSSLON:v,_msg:"(processing data...)",_showTmpMsg:t,_clearTmpMsg:Q,_chartPathParse:K,_exit:k,_print:p,_o$o:q});isMap(d)&&(isArray(d.fileExtensions)&&d.fileExtensions.forEach(f=>{var e=f.ext;f=f.type;L.has(e)?printErr("WARN: Extension '"+e+"' already exists."): -L.set(e,f)}),isArray(d.fileExtensionsNoMem)&&d.fileExtensionsNoMem.forEach(f=>{f=f.ext;O.has(f)?printErr("WARN: Extension '"+f+"' already exists."):O.add(f)}),isArray(d.input)&&d.input.forEach(f=>{var e=f.type;f=f.fn;F.has(e)?printErr("WARN: Input type '"+e+"' already exists."):F.set(e,f)}),isArray(d.inputLine)&&d.inputLine.forEach(f=>{var e=f.type;f=f.fn;isUnDef(_inputLinesFns[e])?P[e]=f:printErr("WARN: Input type '"+e+"' already exists.")}),isArray(d.transform)&&d.transform.forEach(f=>{var e=f.type; -f=f.fn;isUnDef(E[e])?E[e]=f:printErr("WARN: Transform '"+e+"' already exists.")}),isArray(d.output)&&d.output.forEach(f=>{var e=f.type;f=f.fn;G.has(e)?printErr("WARN: Output type '"+e+"' already exists."):G.set(e,f)}),isString(d.help)&&(D[a.toLowerCase()]=d.help))}else printErr("WARN: Library '"+a+"' does not have oafplib.")}catch(f){printErr("WARN: Library '"+a+"' error: "+f)}});(""==b["-h"]||isString(b.help)&&0b[c]=a[c])}var B={__format:b.format,__from:b.from,__ifrom:b.ifrom,__isql:b.isql,__sql:b.sql,__path:b.path,__opath:b.opath,__csv:b.csv,__pause:b.pause,__key:b.__key};isDef(b.inputcsv)&&(b.inputcsv=v(b.inputcsv));isDef(b.incsv)&& -(b.incsv=v(b.incsv));isDef(b.csv)&&(b.csv=v(b.csv));var S=!1;if(""==b["-v"]||isString(b.version)&&00{isMap(a)?isString(a.name)&&isString(a.type)?$ch(a.name).create(a.type,a.options):k(-1,"ERROR: chs must have a name and a type."):k(-1,"ERROR: chs must be an object or array of objects with name and a type")}));x=()=>{if(S)u=R();else if(b.jsonprefix=_$(b.jsonprefix,"jsonprefix").isString().default(__), -b.jsondesc=toBoolean(_$(b.jsondesc,"jsondesc").default("false")),isDef(b.insecure)&&toBoolean(b.insecure)&&ow.loadJava().setIgnoreSSLDomains(),isDef(b.file)){if(0>b.file.indexOf("::")&&!io.fileExists(b.file)&&k(-1,"ERROR: File not found: '"+b.file+"'"),!O.has(b.type))if("json"==b.type||isUnDef(b.type))if(b.jsondesc){var a=new Set;io.readStreamJSON(b.file,d=>{d=d.substring(2);isDef(b.jsonprefix)?d.startsWith(b.jsonprefix)&&a.add(d):a.add(d);return!1});u=stringify(Array.from(a),__,"")}else if(isDef(b.jsonprefix)){var c= -io.readStreamJSON(b.file,d=>d.substring(2).startsWith(b.jsonprefix));u=stringify(c,__,"")}else u=io.readFileString(b.file),toBoolean(b._shebang)&&(u=u.replace(/^#!.*\n/,""));else u=io.readFileString(b.file),toBoolean(b._shebang)&&(u=u.replace(/^#!.*\n/,""))}else if(b.jsondesc&&k(-1,"ERROR: jsondesc only available for file input."),b.jsonprefix&&k(-1,"ERROR: jsonprefix only available for file input."),isDef(b.cmd))u=C(b.cmd,!0);else if(isString(b.data))u=b.data;else if(isDef(b.url)){b.urlmethod=_$(b.urlmethod, -"urlmethod").isString().default("GET");c=v(_$(b.urlparams).isString().default("{}"));let d;isDef(b.urldata)&&(d=v(b.urldata));switch(b.urlmethod.toLowerCase()){case "post":u=$rest(c).post(b.url,d);break;case "put":u=$rest(c).put(b.url,d);break;case "delete":u=$rest(c).delete(b.url,d);break;default:u=$rest(c).get(b.url)}isObject(u)&&(u=stringify(u,__,""))}else"pm"!=b.input&&(u=[],io.pipeLn(d=>{isDef(P[b.type])?P[b.type](N(d),clone(B))&&u.push(d):u.push(d);return!1}),u=u.join("\n"));M||(isUnDef(b.type)&& -(isDef(b.file)&&(c=b.file.substring(b.file.lastIndexOf(".")),L.has(c)&&(b.type=L.get(c))),isUnDef(b.type)&&(c=u.trim(),c.startsWith("{")||c.startsWith("[")?b.type="json":c.startsWith("(")?b.type="slon":c.startsWith("<")?b.type="xml":isString(c)&&0global.__oafp_streams[a].s.close())}};oafp(params); +a.getSheet(b.xlssheet);d=a.getTable(d,b.xlsevalformulas,b.xlscol,b.xlsrow);a.close();isDef(d)&&isMap(d)&&(d=d.table);l(d,c)}else k(-1,"XLS is only support with 'file' or 'cmd' defined. Please provide a file=... or a cmd=...")}],["csv",(a,c)=>{t();isUnDef(b.inputcsv)&&isDef(b.incsv)&&(b.inputcsv=b.incsv);if(isDef(b.file)||isDef(b.cmd)){var d=isDef(b.cmd)?af.fromBytes2InputStream(C(b.cmd)):io.readFileStream(b.file);a=$csv(b.inputcsv).fromInStream(d).toOutArray();d.close()}else a=$csv(b.inputcsv).fromInString(a).toOutArray(); +l(a,c)}],["hsperf",(a,c)=>{if(isDef(b.file)||isDef(b.cmd)){t();ow.loadJava();var d=isDef(b.cmd)?ow.java.parseHSPerf(C(b.cmd)):ow.java.parseHSPerf(b.file);d.__ts=new Date;var f=0,e=0;d.sun.gc.generation.forEach(g=>{g.space.forEach(h=>{e+=Number(h.used);f=isNumber(h.capacity)?f+Number(h.capacity):f;d.sun.gc["__percUsed_"+h.name]=100*h.used/h.capacity})});d.sun.gc.__percUsed_meta=100*d.sun.gc.metaspace.used/d.sun.gc.metaspace.capacity;d.sun.gc.__percUsed_ccs=100*d.sun.gc.compressedclassspace.used/d.sun.gc.compressedclassspace.capacity; +a=$from(d.sun.gc.collector).equals("name","PSScavenge").at(0);d.sun.gc.__ygc=isDef(a)?Number(a.invocations):0;d.sun.gc.__ygct=isDef(a)?Number(a.time/1E9):0;a=$from(d.sun.gc.collector).equals("name","PSParallelCompact").orEquals("name","").at(0);d.sun.gc.__fgc=isDef(a)?Number(a.invocations):0;d.sun.gc.__fgct=isDef(a)?Number(a.time/1E9):0;d.sun.gc.__gct=$from(d.sun.gc.collector).sum("time")/1E9;d.java.__mem={total:f,used:e,free:f-e,metaMax:d.sun.gc.metaspace.maxCapacity,metaTotal:d.sun.gc.metaspace.capacity, +metaUsed:d.sun.gc.metaspace.used,metaFree:d.sun.gc.metaspace.capacity-d.sun.gc.metaspace.used};l(d,c)}else k(-1,"hsperf is only supported with either 'file' or 'cmd' defined.")}],["rawhex",(a,c)=>{b.inrawhexline=_$(b.inrawhexline,"inrawhexline").isNumber().default(__);t();a=isDef(b.file)||isDef(b.cmd)?isDef(b.cmd)?C(b.cmd):io.readFileBytes(b.file):af.fromString2Bytes(a);a=ow.format.string.toHexArray(a,b.inrawhexline);a.forEach(d=>{d.characters=d.characters.replace(/[\x00-\x1F\x80-\xFF]/g,".")});l(a, +c)}],["base64",(a,c)=>{t();a=toBoolean(b.base64gzip)?af.fromBytes2String(io.gunzip(af.fromBase64(a,!0))):af.fromBytes2String(af.fromBase64(a));l(a,c)}],["gb64json",(a,c)=>{t();a=af.fromBytes2String(io.gunzip(af.fromBase64(a,!0)));l(a,c)}],["oaf",(a,c)=>{isString(a)||k(-1,"oaf is only supported with a string.");t();a=af.eval(a);l(a,c)}],["oafp",(a,c)=>{b.__inception=!0;a=v(a);var d="_oafp_key_"+genUUID();if(isMap(a))a.out="key",a.__key=d,a.__inception=!0,oafp(a),a=$get(d),$unset(d),l(a,c);else if(isArray(a)){ow.loadObj(); +$set(d,!0);var f=new ow.obj.syncArray;a=a.map((e,g)=>{var h=d+"_"+String(g);e.out="key";e.__key=h;e.__inception=!0;return $do(()=>{oafp(e);f.add($get(h));$unset(h)}).catch(m=>{sprintErr(m)})});$doWait($doAll(a));l(f.toArray(),c)}else k(-1,"oafp input data needs to be a map or an array.")}],["sh",(a,c)=>{t();a=v(a);if(isString(a))a=$sh(a).get(0);else{isMap(a)||k(-1,"For in=sh the input data needs to a string or a map");var d=$sh();isUnDef(a.cmd)&&k(-1,"For in=sh the input data needs to a string or a map with the a 'cmd'"); +d=d.sh(a.cmd);isDef(a.envs)&&(d=d.envs(a.envs,a.envsall));isDef(a.prefix)&&(d=d.prefix(a.prefix));isDef(a.pwd)&&(d=d.pwd(a.pwd));switch(b.inshformat){case "raw":a=d.get(0);break;case "yaml":a=d.getYaml(0);break;default:a=d.getJson(0)}}l(a,c)}],["llm",(a,c)=>{b.llmenv=_$(b.llmenv,"llmenv").isString().default("OAFP_MODEL");b.llmoptions=_$(b.llmoptions,"llmoptions").isString().default(__);isUnDef(b.llmoptions)&&!isString(getEnv(b.llmenv))&&k(-1,"llmoptions not defined and "+b.llmenv+" not found.");t(); +var d=$llm(isDef(b.llmoptions)?v(b.llmoptions):$sec("system","envs").get(b.llmenv));isDef(b.llmconversation)&&io.fileExists(b.llmconversation)&&d.getGPT().setConversation(io.readFileJSON(b.llmconversation));let f;isString(b.llmimage)&&(b.llmimage.toLowerCase().match(/^https?:\/\//)?f=af.fromBytes2String(af.toBase64Bytes(af.fromInputStream2Bytes($rest().get2Stream(b.llmimage)))):io.fileExists(b.llmimage)&&(f=af.fromBytes2String(af.toBase64Bytes(io.readFileBytes(b.llmimage)))));a="md"==b.output||"mdtable"== +b.output||"raw"==b.output?isDef(f)?d.promptImage(a,f):d.prompt(a):isDef(f)?d.promptImage(a,f,__,__,__,__,!0):d.promptJSON(a);isDef(b.llmconversation)&&(d=d.getGPT().getConversation(),d.push({role:"assistant",content:stringify(a,__,"")}),io.writeFileJSON(b.llmconversation,d,""));l(jsonParse(a,__,__,isString(a)),c)}],["llmmodels",(a,c)=>{b.llmenv=_$(b.llmenv,"llmenv").isString().default("OAFP_MODEL");b.llmoptions=_$(b.llmoptions,"llmoptions").isString().default(__);isUnDef(b.llmoptions)&&!isString(getEnv(b.llmenv))&& +k(-1,"llmoptions not defined and "+b.llmenv+" not found.");t();a=$llm(isDef(b.llmoptions)?v(b.llmoptions):$sec("system","envs").get(b.llmenv));isUnDef(a.getModels)&&k(-1,"OpenAF support for llm model listing API not found.");l(a.getModels(),c)}],["ls",(a,c)=>{t();if(isString(a)){var d=toBoolean(b.lsposix);isDef(b.file)&&(a=b.file);var f=io.fileExists(a),e;f&&(e=io.fileInfo(a));if(f&&e.isFile)switch(isDef(b.lsext)?b.lsext:e.filename.replace(/^.*\./,"").toLowerCase()){case "tgz":case "gz":a=io.listFilesTAR(a, +!0);break;case "tar":a=io.listFilesTAR(a);break;default:plugin("ZIP"),a=$m4a((new ZIP).list(a))}else a=toBoolean(b.lsrecursive)?listFilesRecursive(a,d):io.listFiles(a,d).files;l(a,c)}else k(-1,"ls is only supported with a string.")}],["toml",(a,c)=>{t();isUnDef(af.fromTOML)&&k(-1,"TOML support not found.");l(af.fromTOML(a),c)}],["slon",(a,c)=>{t();l(af.fromSLON(a),c)}],["json",(a,c)=>{t();l(jsonParse(a,__,__,isString(a)),c)}]]),D={};isString(b.libs)&&(b.libs=b.libs.split(",").map(a=>a.trim()).filter(a=> +0{try{var c=require("oafp_"+a+".js");if(isDef(c.oafplib)){var d=c.oafplib(clone(b),l,q,{_runCmd2Bytes:C,_fromJSSLON:v,_msg:"(processing data...)",_showTmpMsg:t,_clearTmpMsg:Q,_chartPathParse:K,_exit:k,_print:p,_o$o:q});isMap(d)&&(isArray(d.fileExtensions)&&d.fileExtensions.forEach(f=>{var e=f.ext;f=f.type; +L.has(e)?printErr("WARN: Extension '"+e+"' already exists."):L.set(e,f)}),isArray(d.fileExtensionsNoMem)&&d.fileExtensionsNoMem.forEach(f=>{f=f.ext;O.has(f)?printErr("WARN: Extension '"+f+"' already exists."):O.add(f)}),isArray(d.input)&&d.input.forEach(f=>{var e=f.type;f=f.fn;F.has(e)?printErr("WARN: Input type '"+e+"' already exists."):F.set(e,f)}),isArray(d.inputLine)&&d.inputLine.forEach(f=>{var e=f.type;f=f.fn;isUnDef(_inputLinesFns[e])?P[e]=f:printErr("WARN: Input type '"+e+"' already exists.")}), +isArray(d.transform)&&d.transform.forEach(f=>{var e=f.type;f=f.fn;isUnDef(E[e])?E[e]=f:printErr("WARN: Transform '"+e+"' already exists.")}),isArray(d.output)&&d.output.forEach(f=>{var e=f.type;f=f.fn;G.has(e)?printErr("WARN: Output type '"+e+"' already exists."):G.set(e,f)}),isString(d.help)&&(D[a.toLowerCase()]=d.help))}else printErr("WARN: Library '"+a+"' does not have oafplib.")}catch(f){printErr("WARN: Library '"+a+"' error: "+f)}});(""==b["-h"]||isString(b.help)&&0b[c]=a[c])}var B={__format:b.format,__from:b.from,__ifrom:b.ifrom,__isql:b.isql,__sql:b.sql,__path:b.path,__opath:b.opath,__csv:b.csv,__pause:b.pause,__key:b.__key}; +isDef(b.inputcsv)&&(b.inputcsv=v(b.inputcsv));isDef(b.incsv)&&(b.incsv=v(b.incsv));isDef(b.csv)&&(b.csv=v(b.csv));var S=!1;if(""==b["-v"]||isString(b.version)&&00< +a.length),B.__sql=1==x.length?"select * where c like '"+x[0]+"'":"select * where c like '"+x[0]+"' and s like '"+x[1]+"'"):"?"==b.examples.trim()?(B.__path="data.sort(map(&concat(c,concat('::',s)),[]))",b.removedups=!0):B.__sql="select * where d like '%"+b.examples+"%' or s like '%"+b.examples+"%' or c like '%"+b.examples+"%'"):(B.__path="data[].{category:c,subCategory:s,description:d}",B.__from="sort(category,subCategory,description)",B.__format="ctable"),delete b["-examples"];var u="",M=!1;isDef(b.outfile)&& +("undefined"===typeof global.__oafp_streams&&(global.__oafp_streams={}),"undefined"===typeof global.__oafp_streams[b.outfile]&&(global.__oafp_streams[b.outfile]={s:io.writeFileStream(b.outfile,toBoolean(b.outfileappend))}));isString(b.chs)&&(x=af.fromJSSLON(b.chs),isArray(x)||(x=[x]),x.forEach(a=>{isMap(a)?isString(a.name)&&isString(a.type)?$ch(a.name).create(a.type,a.options):k(-1,"ERROR: chs must have a name and a type."):k(-1,"ERROR: chs must be an object or array of objects with name and a type")})); +x=()=>{if(S)u=R();else if(b.jsonprefix=_$(b.jsonprefix,"jsonprefix").isString().default(__),b.jsondesc=toBoolean(_$(b.jsondesc,"jsondesc").default("false")),isDef(b.insecure)&&toBoolean(b.insecure)&&ow.loadJava().setIgnoreSSLDomains(),isDef(b.file)){if(0>b.file.indexOf("::")&&!io.fileExists(b.file)&&k(-1,"ERROR: File not found: '"+b.file+"'"),!O.has(b.type))if("json"==b.type||isUnDef(b.type))if(b.jsondesc){var a=new Set;io.readStreamJSON(b.file,d=>{d=d.substring(2);isDef(b.jsonprefix)?d.startsWith(b.jsonprefix)&& +a.add(d):a.add(d);return!1});u=stringify(Array.from(a),__,"")}else if(isDef(b.jsonprefix)){var c=io.readStreamJSON(b.file,d=>d.substring(2).startsWith(b.jsonprefix));u=stringify(c,__,"")}else u=io.readFileString(b.file),toBoolean(b._shebang)&&(u=u.replace(/^#!.*\n/,""));else u=io.readFileString(b.file),toBoolean(b._shebang)&&(u=u.replace(/^#!.*\n/,""))}else if(b.jsondesc&&k(-1,"ERROR: jsondesc only available for file input."),b.jsonprefix&&k(-1,"ERROR: jsonprefix only available for file input."), +isDef(b.cmd))u=C(b.cmd,!0);else if(isString(b.data))u=b.data;else if(isDef(b.url)){b.urlmethod=_$(b.urlmethod,"urlmethod").isString().default("GET");c=v(_$(b.urlparams).isString().default("{}"));let d;isDef(b.urldata)&&(d=v(b.urldata));switch(b.urlmethod.toLowerCase()){case "post":u=$rest(c).post(b.url,d);break;case "put":u=$rest(c).put(b.url,d);break;case "delete":u=$rest(c).delete(b.url,d);break;default:u=$rest(c).get(b.url)}isObject(u)&&(u=stringify(u,__,""))}else"pm"!=b.input&&(u=[],io.pipeLn(d=> +{isDef(P[b.type])?P[b.type](N(d),clone(B))&&u.push(d):u.push(d);return!1}),u=u.join("\n"));M||(isUnDef(b.type)&&(isDef(b.file)&&(c=b.file.substring(b.file.lastIndexOf(".")),L.has(c)&&(b.type=L.get(c))),isUnDef(b.type)&&(c=u.trim(),c.startsWith("{")||c.startsWith("[")?b.type="json":c.startsWith("(")?b.type="slon":c.startsWith("<")?b.type="xml":isString(c)&&0 +global.__oafp_streams[a].s.close())}};oafp(params); diff --git a/js/openaf.js b/js/openaf.js index 97b4c49a..678591ba 100644 --- a/js/openaf.js +++ b/js/openaf.js @@ -8763,10 +8763,10 @@ AF.prototype.toYAML = function(aJson, multiDoc, sanitize, shouldColor) { } _r = pForEach(_r.split("\n"), s => { var change = false - if (!change && /^(\-|\s+\-)([^(\#|\/\/|\:)]+)\:( +)?(.*)?/.test(s)) { + if (!change && /^(\-|\s+\-)([^(\#|\/\/|\:)]+)\:( +.*)?$/.test(s)) { // key in array if (!/^(\-|\s+\-)\s+['"][^'"]+:/.test(s.trim())) { - s = s.replace(/^(\-|\s+\-)([^(\#|\/\/|\:)]+)\:( +)?(.*)?/, ansiColor(__colorFormat.key, "$1") + ansiColor(__colorFormat.key, "$2:") + "$3" + fn("$4", s.replace(/^(\-|\s+\-)([^(\#|\/\/|\:)]+)\:( +)?(.*)?/, "$4"))) + s = s.replace(/^(\-|\s+\-)([^(\#|\/\/|\:)]+)\:( +.*)?$/, ansiColor(__colorFormat.key, "$1") + ansiColor(__colorFormat.key, "$2:") + fn("$3", s.replace(/^(\-|\s+\-)([^(\#|\/\/|\:)]+)\:( +.*)?$/, "$3"))) change = true } } @@ -8775,16 +8775,16 @@ AF.prototype.toYAML = function(aJson, multiDoc, sanitize, shouldColor) { s = s.replace(/^(\-|\s+\-)(.+)/, ansiColor(__colorFormat.default, "$1") + fn("$2", s.replace(/^(\-|\s+\-)(.+)/, "$2"))) change = true } - if (!change && /^([^(\#|\/\/|\:)]+)\:( +)?(.*)?/.test(s)) { + if (!change && /^([^(\#|\/\/|\:)]+)\:( +.*)?$/.test(s)) { // key with value - s = s.replace(/^([^(\#|\/\/|\:)]+)\:( +)?(.*)?/, ansiColor(__colorFormat.key, "$1:") + "$2" + fn("$3", s.replace(/^([^(\#|\/\/|\:)]+)\:( +)?(.*)?/, "$3"))) + s = s.replace(/^([^(\#|\/\/|\:)]+)\:( +.*)?$/, ansiColor(__colorFormat.key, "$1:") + fn("$2", s.replace(/^([^(\#|\/\/|\:)]+)\:( +.*)?$/, "$2"))) change = true - } - if (/((\#|\/\/)+.+)$/.test(s)) { + } + /*if (/((\#|\/\/)+.+)$/.test(s)) { // comment s = s.replace(/((\#|\/\/)+.+)$/, ansiColor("faint,italic", "$1")) change = true - } + }*/ if (!change) { // default s = ansiColor(__colorFormat.default, s) diff --git a/js/owrap.net.js b/js/owrap.net.js index 9332b0c2..82a5ae17 100644 --- a/js/owrap.net.js +++ b/js/owrap.net.js @@ -816,3 +816,52 @@ OpenWrap.net.prototype.ipv4SubNetInRange = function(aAddr, aCIDR, aMask) { return result; }; +/** + * + * ow.net.getIP2ASNCache() : Array + * Retrieves the current IP to ASN cache from the iptoasn.com service returning as an array. + * + */ +OpenWrap.net.prototype.getIP2ASNCache = function() { + var tmpfs = io.createTempFile("ip2asn", "tsv.gz") + $rest().get2File(tmpfs, "https://api.iptoasn.com/data/ip2asn-combined.tsv.gz") + var gzStream = io.readFileGzipStream(tmpfs) + var outStream = af.newOutputStream() + ioStreamCopy(outStream, gzStream) + gzStream.close() + + var str = String(outStream.toString()) + outStream.close() + var data = $path(str.split("\n"), "[?length(@)>'0'].split(@,'\t').{start:[0],end:[1],asn:[2],area:[3],name:[4]}") + str = __ + + ow.loadFormat() + data.forEach(r => { + r.istart = ow.format.IP2int(r.start) + r.iend = ow.format.IP2int(r.end) + }) + return data +} + +/** + * + * ow.net.getIP2ASN(aIP, aIP2ASNCache, aTimeout) : Map + * Given an aIP will try to retrieve the corresponding ASN information from the aIP2ASNCache (defaults to the one retrieved + * by ow.net.getIP2ASNCache()). If aIP2ASNCache is not provided it will be retrieved and cached as "ow.net.ip2asn" with aTimeout + * by default of 24 hours. Returns a map with the ASN information. + * + */ +OpenWrap.net.prototype.getIP2ASN = function(aIP, aIP2ASNCache, aTimeout) { + _$(aIP, "IP").isString().$_() + aTimeout = _$(aTimeout, "aTimeout").isNumber().default(1000 * 60 * 60 * 24) + if (isUnDef(aIP2ASNCache)) { + $cache("ow.net.ip2asn") + .ttl(aTimeout) + .fn(k => ow.net.getIP2ASNCache()) + .create() + aIP2ASNCache = $cache("ow.net.ip2asn").get({}) + } + var iip = ow.format.IP2int(ow.net.getHost2IP(aIP)) + var res = aIP2ASNCache.find(r => r.istart <= iip && r.iend >= iip) + return res +} \ No newline at end of file diff --git a/js/owrap.sec.js b/js/owrap.sec.js index 44da7fdf..13a9141d 100644 --- a/js/owrap.sec.js +++ b/js/owrap.sec.js @@ -40,7 +40,7 @@ OpenWrap.sec.prototype.openSBuckets = function(aRepo, aMainSecret, aFile) { $ch("___openaf_sbuckets" + rep).create(); var evs = getEnvs(), envs = {}; Object.keys(evs).forEach(env => { - if (evs[env].trim().indexOf("{") == 0) { + /*if (evs[env].trim().indexOf("{") == 0) { envs[env] = jsonParse(evs[env], true, __, true) } else { if (evs[env].trim().indexOf("(") == 0) { @@ -48,7 +48,8 @@ OpenWrap.sec.prototype.openSBuckets = function(aRepo, aMainSecret, aFile) { } else { envs[env] = evs[env] } - } + }*/ + envs[env] = af.fromJSSLON(evs[env]) }) $ch("___openaf_sbuckets" + rep).set({ sbucket: "envs" }, envs); } diff --git a/lib/jna-5.14.0.jar b/lib/jna-5.14.0.jar deleted file mode 100644 index e27f9c54..00000000 Binary files a/lib/jna-5.14.0.jar and /dev/null differ diff --git a/lib/jna-5.15.0.jar b/lib/jna-5.15.0.jar new file mode 100644 index 00000000..a2169356 Binary files /dev/null and b/lib/jna-5.15.0.jar differ diff --git a/lib/jna-platform-5.14.0.jar b/lib/jna-platform-5.14.0.jar deleted file mode 100644 index 05984f71..00000000 Binary files a/lib/jna-platform-5.14.0.jar and /dev/null differ diff --git a/lib/jna-platform-5.15.0.jar b/lib/jna-platform-5.15.0.jar new file mode 100644 index 00000000..645b6923 Binary files /dev/null and b/lib/jna-platform-5.15.0.jar differ diff --git a/lib/jsch-0.2.19.jar b/lib/jsch-0.2.20.jar similarity index 83% rename from lib/jsch-0.2.19.jar rename to lib/jsch-0.2.20.jar index 9a4e581f..3e9e95e2 100644 Binary files a/lib/jsch-0.2.19.jar and b/lib/jsch-0.2.20.jar differ diff --git a/lib/okio-3.9.0.jar b/lib/okio-3.9.1.jar similarity index 58% rename from lib/okio-3.9.0.jar rename to lib/okio-3.9.1.jar index 8768d0e0..a6d7b8f2 100644 Binary files a/lib/okio-3.9.0.jar and b/lib/okio-3.9.1.jar differ diff --git a/lib/okio-jvm-3.9.0.jar b/lib/okio-jvm-3.9.1.jar similarity index 77% rename from lib/okio-jvm-3.9.0.jar rename to lib/okio-jvm-3.9.1.jar index c59091ca..211e015b 100644 Binary files a/lib/okio-jvm-3.9.0.jar and b/lib/okio-jvm-3.9.1.jar differ diff --git a/pom.xml b/pom.xml index f40d545d..0e43772a 100644 --- a/pom.xml +++ b/pom.xml @@ -215,12 +215,12 @@ net.java.dev.jna jna-platform - 5.14.0 + 5.15.0 net.java.dev.jna jna - 5.14.0 + 5.15.0 org.jodd @@ -270,12 +270,12 @@ com.squareup.okio okio - 3.9.0 + 3.9.1 com.squareup.okio okio-jvm - 3.9.0 + 3.9.1 dnsjava @@ -295,7 +295,7 @@ com.github.mwiede jsch - 0.2.19 + 0.2.20 com.github.vertical-blank diff --git a/versionsAndDeps.json b/versionsAndDeps.json index a4147f80..ce96a6cd 100644 --- a/versionsAndDeps.json +++ b/versionsAndDeps.json @@ -242,7 +242,7 @@ },*/ { "description": "OkHTTP Client", - "path": ["okhttp-4.12.0.jar", "okio-3.9.0.jar", "okio-jvm-3.9.0.jar", "kotlin-stdlib-2.0.20.jar"], + "path": ["okhttp-4.12.0.jar", "okio-3.9.1.jar", "okio-jvm-3.9.1.jar", "kotlin-stdlib-2.0.20.jar"], "version": "4.12.0", "changes": false, "type": ["java"], @@ -442,7 +442,7 @@ "lib/commons-io-2.16.1.jar" ], "deps": [ - "lib/jsch-0.2.19.jar", + "lib/jsch-0.2.20.jar", "lib/jsch.agentproxy.connector-factory-0.0.9.jar", "lib/jsch.agentproxy.core-0.0.9.jar", "lib/jsch.agentproxy.jsch-0.0.9.jar",