mirror of
https://github.com/sasjs/core.git
synced 2025-12-29 05:40:04 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aabbf4d0f9 | ||
|
|
2bea8be70d | ||
|
|
9b2368443e | ||
|
|
7915ba2c41 | ||
|
|
cc61e48868 | ||
|
|
62db83dcf6 | ||
|
|
7ea9e0f8e9 | ||
|
|
1c852515f5 | ||
|
|
b7e677bd8e | ||
|
|
f47f0d2cee | ||
|
|
3d0f426a98 | ||
|
|
2cb51f6164 | ||
|
|
b73bf998da | ||
|
|
c9ad38ee98 | ||
|
|
76b1b951c0 | ||
|
|
996054b17a | ||
|
|
7fca3d4e3f | ||
|
|
c4e599c861 | ||
|
|
0f6ff2cc1e | ||
|
|
7cac4c71fb | ||
|
|
1322bdab92 | ||
|
|
f201df606a | ||
|
|
a56fce86b1 |
18
.git-hooks/commit-msg
Executable file
18
.git-hooks/commit-msg
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
RED="\033[1;31m"
|
||||
GREEN="\033[1;32m"
|
||||
|
||||
# Get the commit message (the parameter we're given is just the path to the
|
||||
# temporary file which holds the message).
|
||||
commit_message=$(cat "$1")
|
||||
|
||||
if (echo "$commit_message" | grep -Eq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z \-]+\))?!?: .+$") then
|
||||
echo "${GREEN} ✔ Commit message meets Conventional Commit standards"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "${RED}❌ Commit message does not meet the Conventional Commit standard!"
|
||||
echo "An example of a valid message is:"
|
||||
echo " feat(login): add the 'remember me' button"
|
||||
echo "ℹ More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary"
|
||||
exit 1
|
||||
2
.git-hooks/pre-commit
Executable file
2
.git-hooks/pre-commit
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
sasjs lint
|
||||
@@ -1,5 +1,5 @@
|
||||
tasks:
|
||||
- init: npm i -g @sasjs/cli
|
||||
- init: nvm install --latest-npm && npm i -g @sasjs/cli
|
||||
|
||||
image:
|
||||
file: .gitpod.dockerfile
|
||||
|
||||
@@ -3,8 +3,9 @@ build.py
|
||||
.gitpod*
|
||||
tests/
|
||||
sasjs/
|
||||
.vscode/
|
||||
.github/
|
||||
.git-hooks/
|
||||
.vscode/
|
||||
main.dox
|
||||
make_singlefile.sh
|
||||
*.md
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||

|
||||
[](/LICENSE)
|
||||

|
||||
[](https://github.com/sasjs/core/issues?q=is%3Aissue+is%3Aclosed)
|
||||
[](https://github.com/sasjs/core/issues)
|
||||

|
||||
[](https://gitpod.io/#https://github.com/sasjs/core)
|
||||
|
||||
@@ -171,7 +173,7 @@ When contributing to this library, it is therefore important to ensure that all
|
||||
|
||||
## Star Gazing
|
||||
|
||||
If you find this library useful, help us grow our star graph!
|
||||
If you find this library useful, please leave a [star](https://github.com/sasjs/core/stargazers) and help us grow our star graph!
|
||||
|
||||

|
||||
|
||||
|
||||
18
SECURITY.md
Normal file
18
SECURITY.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Security Policy
|
||||
|
||||
Security is an extremely high priority when it comes to the SASjs product suite. We take a number of steps across all repositories to minimise risk, such as:
|
||||
|
||||
* Regular dependabot updates
|
||||
* Snyk reports
|
||||
* Minimising dependencies, especially production dependencies (sasjs/core has NONE)
|
||||
* Testing & Code review process
|
||||
|
||||
## Supported Versions
|
||||
|
||||
We support only the latest version
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
We welcome disclosures of all kinds in relation to all the SASjs libraries. You can submit them here: [https://sasapps.io/contact-us](https://sasapps.io/contact-us)
|
||||
|
||||
|
||||
134
all.sas
134
all.sas
@@ -1719,7 +1719,7 @@ Usage:
|
||||
|
||||
/* send response in SASjs JSON format */
|
||||
data _null_;
|
||||
file _webout mod lrecl=32000;
|
||||
file _webout mod lrecl=32000 encoding='utf-8';
|
||||
length msg $32767 debug $8;
|
||||
sasdatetime=datetime();
|
||||
msg=cats(symget('msg'),'\n\nLog Extract:\n',symget('logmsg'));
|
||||
@@ -1753,6 +1753,8 @@ Usage:
|
||||
put ",""SYSCC"" : ""&syscc"" ";
|
||||
put ",""SYSERRORTEXT"" : ""&syserrortext"" ";
|
||||
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
||||
sysvlong=quote(trim(symget('sysvlong')));
|
||||
put ',"SYSVLONG" : ' sysvlong;
|
||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||
put "}" @;
|
||||
@@ -3795,7 +3797,8 @@ run;
|
||||
|
||||
data &outds;
|
||||
if &sqlrc or &syscc or &syserr then do;
|
||||
REASON_CD=coalescec(symget('SYSERRORTEXT'),symget('SYSWARNINGTEXT'));
|
||||
REASON_CD='VALIDATION_ERROR: '!!
|
||||
coalescec(symget('SYSERRORTEXT'),symget('SYSWARNINGTEXT'));
|
||||
output;
|
||||
end;
|
||||
else stop;
|
||||
@@ -3819,7 +3822,7 @@ filename &fref1 clear;
|
||||
%let syscc=1008;
|
||||
%end;
|
||||
|
||||
%mend;
|
||||
%mend mp_filtervalidate;
|
||||
/**
|
||||
@file mp_getconstraints.sas
|
||||
@brief Get constraint details at column level
|
||||
@@ -5191,7 +5194,7 @@ create table &outds (rename=(
|
||||
run;
|
||||
%let ds=&fmtds;
|
||||
%end; /* &fmt=Y */
|
||||
data _null_;file &jref mod ;
|
||||
data _null_;file &jref mod encoding='utf-8';
|
||||
put "["; call symputx('cols',0,'l');
|
||||
proc sort
|
||||
data=sashelp.vcolumn(where=(libname='WORK' & memname="%upcase(&ds)"))
|
||||
@@ -8898,7 +8901,7 @@ Usage:
|
||||
%webout(OBJ,example2) * Object format, easier to work with ;
|
||||
%webout(CLOSE)
|
||||
;;;;
|
||||
%mm_createwebservice(path=/Public/app/common,name=appInit)
|
||||
%mm_createwebservice(path=/Public/app/common,name=appInit,code=ft15f001)
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mm_createstp.sas
|
||||
@@ -8913,12 +8916,15 @@ Usage:
|
||||
@param desc= The description of the service (optional)
|
||||
@param precode= Space separated list of filerefs, pointing to the code that
|
||||
needs to be attached to the beginning of the service (optional)
|
||||
@param code= Space seperated fileref(s) of the actual code to be added
|
||||
@param server= The server which will run the STP. Server name or uri is fine.
|
||||
@param mDebug= set to 1 to show debug messages in the log
|
||||
@param replace= select YES to replace any existing service in that location
|
||||
@param adapter= the macro uses the sasjs adapter by default. To use another
|
||||
adapter, add a (different) fileref here.
|
||||
@param code=(ft15f001) Space seperated fileref(s) of the actual code to be
|
||||
added
|
||||
@param server=(SASApp) The server which will run the STP. Server name or uri
|
||||
is fine.
|
||||
@param mDebug=(0) set to 1 to show debug messages in the log
|
||||
@param replace=(YES) select NO to avoid replacing an existing service in that
|
||||
location
|
||||
@param adapter=(sasjs) the macro uses the sasjs adapter by default. To use
|
||||
another adapter, add a (different) fileref here.
|
||||
|
||||
@version 9.2
|
||||
@author Allan Bowe
|
||||
@@ -8928,11 +8934,11 @@ Usage:
|
||||
%macro mm_createwebservice(path=
|
||||
,name=initService
|
||||
,precode=
|
||||
,code=
|
||||
,code=ft15f001
|
||||
,desc=This stp was created automagically by the mm_createwebservice macro
|
||||
,mDebug=0
|
||||
,server=SASApp
|
||||
,replace=NO
|
||||
,replace=YES
|
||||
,adapter=sasjs
|
||||
)/*/STORE SOURCE*/;
|
||||
|
||||
@@ -9052,7 +9058,7 @@ data _null_;
|
||||
put ' run; ';
|
||||
put ' %let ds=&fmtds; ';
|
||||
put ' %end; /* &fmt=Y */ ';
|
||||
put ' data _null_;file &jref mod ; ';
|
||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
||||
put ' put "["; call symputx(''cols'',0,''l''); ';
|
||||
put ' proc sort ';
|
||||
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
||||
@@ -9195,7 +9201,7 @@ data _null_;
|
||||
put '%end; ';
|
||||
put ' ';
|
||||
put '%else %if &action=ARR or &action=OBJ %then %do; ';
|
||||
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ';
|
||||
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt,jref=&fref ';
|
||||
put ' ,engine=DATASTEP,dbg=%str(&_debug) ';
|
||||
put ' ) ';
|
||||
put '%end; ';
|
||||
@@ -9254,6 +9260,8 @@ data _null_;
|
||||
put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; ';
|
||||
put ' put ",""SYSJOBID"" : ""&sysjobid"" "; ';
|
||||
put ' put ",""SYSSITE"" : ""&syssite"" "; ';
|
||||
put ' sysvlong=quote(trim(symget(''sysvlong''))); ';
|
||||
put ' put '',"SYSVLONG" : '' sysvlong; ';
|
||||
put ' put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; ';
|
||||
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),datetime20.3)" ''" ''; ';
|
||||
put ' put "}" @; ';
|
||||
@@ -9263,7 +9271,7 @@ data _null_;
|
||||
put ' run; ';
|
||||
put '%end; ';
|
||||
put ' ';
|
||||
put '%mend; ';
|
||||
put '%mend mm_webout; ';
|
||||
put ' ';
|
||||
put '%macro mf_getuser(type=META ';
|
||||
put ')/*/STORE SOURCE*/; ';
|
||||
@@ -9342,7 +9350,7 @@ run;
|
||||
%put &url?_PROGRAM=&path/&name;
|
||||
%put ;%put ;%put ;%put ;%put ;%put ;
|
||||
|
||||
%mend;
|
||||
%mend mm_createwebservice;
|
||||
/**
|
||||
@file mm_deletedocument.sas
|
||||
@brief Deletes a Document using path as reference
|
||||
@@ -11640,7 +11648,7 @@ libname _XML_ clear;
|
||||
|
||||
Usage:
|
||||
|
||||
%mm_getusers()
|
||||
%mm_getusers()
|
||||
|
||||
@param outds the dataset to create that contains the list of libraries
|
||||
|
||||
@@ -11702,7 +11710,7 @@ filename sxlemap clear;
|
||||
filename response clear;
|
||||
libname _XML_ clear;
|
||||
|
||||
%mend;
|
||||
%mend mm_getusers;
|
||||
/**
|
||||
@file
|
||||
@brief Retrieves properties of the SAS web app server
|
||||
@@ -12613,7 +12621,8 @@ run;
|
||||
@param action Either FETCH, OPEN, ARR, OBJ or CLOSE
|
||||
@param ds The dataset to send back to the frontend
|
||||
@param dslabel= value to use instead of the real name for sending to JSON
|
||||
@param fmt= set to N to send back unformatted values
|
||||
@param fmt=(Y) Set to N to send back unformatted values
|
||||
@param fref=(_webout) The fileref to which to write the JSON
|
||||
|
||||
@version 9.3
|
||||
@author Allan Bowe
|
||||
@@ -12678,7 +12687,7 @@ run;
|
||||
%end;
|
||||
|
||||
%else %if &action=ARR or &action=OBJ %then %do;
|
||||
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
|
||||
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt,jref=&fref
|
||||
,engine=DATASTEP,dbg=%str(&_debug)
|
||||
)
|
||||
%end;
|
||||
@@ -12737,6 +12746,8 @@ run;
|
||||
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
||||
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
||||
put ",""SYSSITE"" : ""&syssite"" ";
|
||||
sysvlong=quote(trim(symget('sysvlong')));
|
||||
put ',"SYSVLONG" : ' sysvlong;
|
||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||
put "}" @;
|
||||
@@ -12746,7 +12757,7 @@ run;
|
||||
run;
|
||||
%end;
|
||||
|
||||
%mend;
|
||||
%mend mm_webout;
|
||||
/**
|
||||
@file
|
||||
@brief Deletes a metadata folder
|
||||
@@ -12881,17 +12892,22 @@ run;
|
||||
%mend;/**
|
||||
@file mv_createfolder.sas
|
||||
@brief Creates a viya folder if that folder does not already exist
|
||||
@details Expects oauth token in a global macro variable (default
|
||||
ACCESS_TOKEN).
|
||||
@details Creates a viya folder by checking if each parent folder exists, and
|
||||
recursively creating children if needed.
|
||||
Usage:
|
||||
|
||||
%mv_createfolder(path=/Public)
|
||||
|
||||
|
||||
@param path= The full path of the folder to be created
|
||||
@param access_token_var= The global macro variable to contain the access token
|
||||
@param grant_type= (authorization_code) Valid values are "password" or
|
||||
"authorization_code" (unquoted).
|
||||
@param [in] path= The full path of the folder to be created
|
||||
@param [in] access_token_var= The global macro variable to contain the access
|
||||
token, if using authorization_code grant type.
|
||||
@param [in] grant_type= (sas_services) Valid values are:
|
||||
@li password
|
||||
@li authorization_code
|
||||
@li sas_services
|
||||
|
||||
@param [in] mdebug=(0) set to 1 to enable DEBUG messages
|
||||
|
||||
@version VIYA V.03.04
|
||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||
@@ -12908,15 +12924,23 @@ run;
|
||||
%macro mv_createfolder(path=
|
||||
,access_token_var=ACCESS_TOKEN
|
||||
,grant_type=sas_services
|
||||
,mdebug=0
|
||||
);
|
||||
%local dbg;
|
||||
%if &mdebug=1 %then %do;
|
||||
%put &sysmacroname entry vars:;
|
||||
%put _local_;
|
||||
%end;
|
||||
%else %let dbg=*;
|
||||
|
||||
%local oauth_bearer;
|
||||
%if &grant_type=detect %then %do;
|
||||
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
||||
%else %let grant_type=sas_services;
|
||||
%end;
|
||||
%if &grant_type=sas_services %then %do;
|
||||
%let oauth_bearer=oauth_bearer=sas_services;
|
||||
%let &access_token_var=;
|
||||
%let oauth_bearer=oauth_bearer=sas_services;
|
||||
%let &access_token_var=;
|
||||
%end;
|
||||
|
||||
%mp_abort(iftrue=(&grant_type ne authorization_code and &grant_type ne password
|
||||
@@ -12971,12 +12995,21 @@ options noquotelenmax;
|
||||
,mac=&sysmacroname
|
||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
||||
)
|
||||
%if &mdebug=1 %then %do;
|
||||
%put &sysmacroname following check to see if &newpath exists:;
|
||||
%put _local_;
|
||||
data _null_;
|
||||
set &fname1;
|
||||
input;
|
||||
putlog _infile_;
|
||||
run;
|
||||
%end;
|
||||
%if &SYS_PROCHTTP_STATUS_CODE=200 %then %do;
|
||||
%*put &sysmacroname &newpath exists so grab the follow on link ;
|
||||
data _null_;
|
||||
set &libref1..links;
|
||||
if rel='createChild' then
|
||||
call symputx('href',quote("&base_uri"!!trim(href)),'l');
|
||||
call symputx('href',quote(cats("&base_uri",href)),'l');
|
||||
run;
|
||||
%end;
|
||||
%else %if &SYS_PROCHTTP_STATUS_CODE=404 %then %do;
|
||||
@@ -13020,8 +13053,10 @@ options noquotelenmax;
|
||||
%put &sysmacroname &newpath now created. Grabbing the follow on link ;
|
||||
data _null_;
|
||||
set &libref2..links;
|
||||
if rel='createChild' then
|
||||
call symputx('href',quote(trim(href)),'l');
|
||||
if rel='createChild' then do;
|
||||
call symputx('href',quote(cats("&base_uri",href)),'l');
|
||||
&dbg put (_all_)(=);
|
||||
end;
|
||||
run;
|
||||
|
||||
libname &libref2 clear;
|
||||
@@ -13030,7 +13065,7 @@ options noquotelenmax;
|
||||
filename &fname1 clear;
|
||||
libname &libref1 clear;
|
||||
%end;
|
||||
%mend;/**
|
||||
%mend mv_createfolder;/**
|
||||
@file
|
||||
@brief Creates a Viya Job
|
||||
@details
|
||||
@@ -13666,7 +13701,7 @@ data _null_;
|
||||
put ' run; ';
|
||||
put ' %let ds=&fmtds; ';
|
||||
put ' %end; /* &fmt=Y */ ';
|
||||
put ' data _null_;file &jref mod ; ';
|
||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
||||
put ' put "["; call symputx(''cols'',0,''l''); ';
|
||||
put ' proc sort ';
|
||||
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
||||
@@ -13750,7 +13785,7 @@ data _null_;
|
||||
put ' run; ';
|
||||
put '%end; ';
|
||||
put '%mend mp_jsonout; ';
|
||||
put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y); ';
|
||||
put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y); ';
|
||||
put '%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name ';
|
||||
put ' sasjs_tables SYS_JES_JOB_URI; ';
|
||||
put '%if %index("&_debug",log) %then %let _debug=131; ';
|
||||
@@ -13929,17 +13964,19 @@ data _null_;
|
||||
put ' put ",""SYSERRORTEXT"" : ""&syserrortext"" "; ';
|
||||
put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; ';
|
||||
put ' put ",""SYSSITE"" : ""&syssite"" "; ';
|
||||
put ' sysvlong=quote(trim(symget(''sysvlong''))); ';
|
||||
put ' put '',"SYSVLONG" : '' sysvlong; ';
|
||||
put ' put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; ';
|
||||
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),datetime20.3)" ''" ''; ';
|
||||
put ' put "}"; ';
|
||||
put ' ';
|
||||
put ' %if %upcase(&fref) ne _WEBOUT %then %do; ';
|
||||
put ' %if %upcase(&fref) ne _WEBOUT and &stream=Y %then %do; ';
|
||||
put ' data _null_; rc=fcopy("&fref","_webout");run; ';
|
||||
put ' %end; ';
|
||||
put ' ';
|
||||
put '%end; ';
|
||||
put ' ';
|
||||
put '%mend; ';
|
||||
put '%mend mv_webout; ';
|
||||
put ' ';
|
||||
put '%macro mf_getuser(type=META ';
|
||||
put ')/*/STORE SOURCE*/; ';
|
||||
@@ -14694,7 +14731,11 @@ libname &libref1 clear;
|
||||
|
||||
|
||||
@param root= The path for which to return the list of folders
|
||||
@param outds= The output dataset to create (default is work.mv_getfolders)
|
||||
@param outds= The output dataset to create (default is work.mv_getfolders). Format:
|
||||
|ordinal_root|ordinal_items|creationTimeStamp| modifiedTimeStamp|createdBy|modifiedBy|id| uri|added| type|name|description|
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
|1|1|2021-05-25T11:15:04.204Z|2021-05-25T11:15:04.204Z|allbow|allbow|4f1e3945-9655-462b-90f2-c31534b3ca47|/folders/folders/ed701ff3-77e8-468d-a4f5-8c43dec0fd9e|2021-05-25T11:15:04.212Z|child|my_folder_name|My folder Description|
|
||||
|
||||
@param access_token_var= The global macro variable to contain the access token
|
||||
@param grant_type= valid values are "password" or "authorization_code" (unquoted).
|
||||
The default is authorization_code.
|
||||
@@ -14802,7 +14843,7 @@ options noquotelenmax;
|
||||
filename &fname1 clear;
|
||||
libname &libref1 clear;
|
||||
|
||||
%mend;/**
|
||||
%mend mv_getfoldermembers;/**
|
||||
@file mv_getgroupmembers.sas
|
||||
@brief Creates a dataset with a list of group members
|
||||
@details First, be sure you have an access token (which requires an app token).
|
||||
@@ -17531,9 +17572,10 @@ filename &fref1 clear;
|
||||
@param action Either OPEN, ARR, OBJ or CLOSE
|
||||
@param ds The dataset to send back to the frontend
|
||||
@param _webout= fileref for returning the json
|
||||
@param fref= temp fref
|
||||
@param fref=(_mvwtemp) Temp fileref to which to write the output
|
||||
@param dslabel= value to use instead of the real name for sending to JSON
|
||||
@param fmt= change to N to strip formats from output
|
||||
@param fmt=(Y) change to N to strip formats from output
|
||||
@param stream=(Y) Change to N if not streaming to _webout
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mp_jsonout.sas
|
||||
@@ -17543,7 +17585,7 @@ filename &fref1 clear;
|
||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||
|
||||
**/
|
||||
%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y);
|
||||
%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y);
|
||||
%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name
|
||||
sasjs_tables SYS_JES_JOB_URI;
|
||||
%if %index("&_debug",log) %then %let _debug=131;
|
||||
@@ -17722,17 +17764,19 @@ filename &fref1 clear;
|
||||
put ",""SYSERRORTEXT"" : ""&syserrortext"" ";
|
||||
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
||||
put ",""SYSSITE"" : ""&syssite"" ";
|
||||
sysvlong=quote(trim(symget('sysvlong')));
|
||||
put ',"SYSVLONG" : ' sysvlong;
|
||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||
put "}";
|
||||
|
||||
%if %upcase(&fref) ne _WEBOUT %then %do;
|
||||
%if %upcase(&fref) ne _WEBOUT and &stream=Y %then %do;
|
||||
data _null_; rc=fcopy("&fref","_webout");run;
|
||||
%end;
|
||||
|
||||
%end;
|
||||
|
||||
%mend;
|
||||
%mend mv_webout;
|
||||
/**
|
||||
@file ml_json.sas
|
||||
@brief Compiles the json.lua lua file
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
|
||||
/* send response in SASjs JSON format */
|
||||
data _null_;
|
||||
file _webout mod lrecl=32000;
|
||||
file _webout mod lrecl=32000 encoding='utf-8';
|
||||
length msg $32767 debug $8;
|
||||
sasdatetime=datetime();
|
||||
msg=cats(symget('msg'),'\n\nLog Extract:\n',symget('logmsg'));
|
||||
@@ -133,6 +133,8 @@
|
||||
put ",""SYSCC"" : ""&syscc"" ";
|
||||
put ",""SYSERRORTEXT"" : ""&syserrortext"" ";
|
||||
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
||||
sysvlong=quote(trim(symget('sysvlong')));
|
||||
put ',"SYSVLONG" : ' sysvlong;
|
||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||
put "}" @;
|
||||
|
||||
@@ -78,7 +78,8 @@ run;
|
||||
|
||||
data &outds;
|
||||
if &sqlrc or &syscc or &syserr then do;
|
||||
REASON_CD=coalescec(symget('SYSERRORTEXT'),symget('SYSWARNINGTEXT'));
|
||||
REASON_CD='VALIDATION_ERROR: '!!
|
||||
coalescec(symget('SYSERRORTEXT'),symget('SYSWARNINGTEXT'));
|
||||
output;
|
||||
end;
|
||||
else stop;
|
||||
@@ -102,4 +103,4 @@ filename &fref1 clear;
|
||||
%let syscc=1008;
|
||||
%end;
|
||||
|
||||
%mend;
|
||||
%mend mp_filtervalidate;
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
run;
|
||||
%let ds=&fmtds;
|
||||
%end; /* &fmt=Y */
|
||||
data _null_;file &jref mod ;
|
||||
data _null_;file &jref mod encoding='utf-8';
|
||||
put "["; call symputx('cols',0,'l');
|
||||
proc sort
|
||||
data=sashelp.vcolumn(where=(libname='WORK' & memname="%upcase(&ds)"))
|
||||
|
||||
@@ -22,7 +22,7 @@ Usage:
|
||||
%webout(OBJ,example2) * Object format, easier to work with ;
|
||||
%webout(CLOSE)
|
||||
;;;;
|
||||
%mm_createwebservice(path=/Public/app/common,name=appInit)
|
||||
%mm_createwebservice(path=/Public/app/common,name=appInit,code=ft15f001)
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mm_createstp.sas
|
||||
@@ -37,12 +37,15 @@ Usage:
|
||||
@param desc= The description of the service (optional)
|
||||
@param precode= Space separated list of filerefs, pointing to the code that
|
||||
needs to be attached to the beginning of the service (optional)
|
||||
@param code= Space seperated fileref(s) of the actual code to be added
|
||||
@param server= The server which will run the STP. Server name or uri is fine.
|
||||
@param mDebug= set to 1 to show debug messages in the log
|
||||
@param replace= select YES to replace any existing service in that location
|
||||
@param adapter= the macro uses the sasjs adapter by default. To use another
|
||||
adapter, add a (different) fileref here.
|
||||
@param code=(ft15f001) Space seperated fileref(s) of the actual code to be
|
||||
added
|
||||
@param server=(SASApp) The server which will run the STP. Server name or uri
|
||||
is fine.
|
||||
@param mDebug=(0) set to 1 to show debug messages in the log
|
||||
@param replace=(YES) select NO to avoid replacing an existing service in that
|
||||
location
|
||||
@param adapter=(sasjs) the macro uses the sasjs adapter by default. To use
|
||||
another adapter, add a (different) fileref here.
|
||||
|
||||
@version 9.2
|
||||
@author Allan Bowe
|
||||
@@ -52,11 +55,11 @@ Usage:
|
||||
%macro mm_createwebservice(path=
|
||||
,name=initService
|
||||
,precode=
|
||||
,code=
|
||||
,code=ft15f001
|
||||
,desc=This stp was created automagically by the mm_createwebservice macro
|
||||
,mDebug=0
|
||||
,server=SASApp
|
||||
,replace=NO
|
||||
,replace=YES
|
||||
,adapter=sasjs
|
||||
)/*/STORE SOURCE*/;
|
||||
|
||||
@@ -176,7 +179,7 @@ data _null_;
|
||||
put ' run; ';
|
||||
put ' %let ds=&fmtds; ';
|
||||
put ' %end; /* &fmt=Y */ ';
|
||||
put ' data _null_;file &jref mod ; ';
|
||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
||||
put ' put "["; call symputx(''cols'',0,''l''); ';
|
||||
put ' proc sort ';
|
||||
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
||||
@@ -319,7 +322,7 @@ data _null_;
|
||||
put '%end; ';
|
||||
put ' ';
|
||||
put '%else %if &action=ARR or &action=OBJ %then %do; ';
|
||||
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt ';
|
||||
put ' %mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt,jref=&fref ';
|
||||
put ' ,engine=DATASTEP,dbg=%str(&_debug) ';
|
||||
put ' ) ';
|
||||
put '%end; ';
|
||||
@@ -378,6 +381,8 @@ data _null_;
|
||||
put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; ';
|
||||
put ' put ",""SYSJOBID"" : ""&sysjobid"" "; ';
|
||||
put ' put ",""SYSSITE"" : ""&syssite"" "; ';
|
||||
put ' sysvlong=quote(trim(symget(''sysvlong''))); ';
|
||||
put ' put '',"SYSVLONG" : '' sysvlong; ';
|
||||
put ' put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; ';
|
||||
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),datetime20.3)" ''" ''; ';
|
||||
put ' put "}" @; ';
|
||||
@@ -387,7 +392,7 @@ data _null_;
|
||||
put ' run; ';
|
||||
put '%end; ';
|
||||
put ' ';
|
||||
put '%mend; ';
|
||||
put '%mend mm_webout; ';
|
||||
put ' ';
|
||||
put '%macro mf_getuser(type=META ';
|
||||
put ')/*/STORE SOURCE*/; ';
|
||||
@@ -466,4 +471,4 @@ run;
|
||||
%put &url?_PROGRAM=&path/&name;
|
||||
%put ;%put ;%put ;%put ;%put ;%put ;
|
||||
|
||||
%mend;
|
||||
%mend mm_createwebservice;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
Usage:
|
||||
|
||||
%mm_getusers()
|
||||
%mm_getusers()
|
||||
|
||||
@param outds the dataset to create that contains the list of libraries
|
||||
|
||||
@@ -68,4 +68,4 @@ filename sxlemap clear;
|
||||
filename response clear;
|
||||
libname _XML_ clear;
|
||||
|
||||
%mend;
|
||||
%mend mm_getusers;
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
@param action Either FETCH, OPEN, ARR, OBJ or CLOSE
|
||||
@param ds The dataset to send back to the frontend
|
||||
@param dslabel= value to use instead of the real name for sending to JSON
|
||||
@param fmt= set to N to send back unformatted values
|
||||
@param fmt=(Y) Set to N to send back unformatted values
|
||||
@param fref=(_webout) The fileref to which to write the JSON
|
||||
|
||||
@version 9.3
|
||||
@author Allan Bowe
|
||||
@@ -91,7 +92,7 @@
|
||||
%end;
|
||||
|
||||
%else %if &action=ARR or &action=OBJ %then %do;
|
||||
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt
|
||||
%mp_jsonout(&action,&ds,dslabel=&dslabel,fmt=&fmt,jref=&fref
|
||||
,engine=DATASTEP,dbg=%str(&_debug)
|
||||
)
|
||||
%end;
|
||||
@@ -150,6 +151,8 @@
|
||||
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
||||
put ",""SYSJOBID"" : ""&sysjobid"" ";
|
||||
put ",""SYSSITE"" : ""&syssite"" ";
|
||||
sysvlong=quote(trim(symget('sysvlong')));
|
||||
put ',"SYSVLONG" : ' sysvlong;
|
||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||
put "}" @;
|
||||
@@ -159,4 +162,4 @@
|
||||
run;
|
||||
%end;
|
||||
|
||||
%mend;
|
||||
%mend mm_webout;
|
||||
|
||||
146
package-lock.json
generated
146
package-lock.json
generated
@@ -4,9 +4,9 @@
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"@sasjs/adapter": {
|
||||
"version": "2.2.18",
|
||||
"resolved": "https://registry.npmjs.org/@sasjs/adapter/-/adapter-2.2.18.tgz",
|
||||
"integrity": "sha512-Em4cojWXK07ePhR3ovHEwSl2zTWRjJQfeR/2k/iL8uQ7uFSsknKgE9095+MaYDhwseN+heDEMoU8+Q8QB8qU1A==",
|
||||
"version": "2.2.19",
|
||||
"resolved": "https://registry.npmjs.org/@sasjs/adapter/-/adapter-2.2.19.tgz",
|
||||
"integrity": "sha512-M5G9V7GmhNmUOCEEiiPq8WeR9BTcvE1fmyEKFQDfJYuuJF7fG0OC+bZjZ/++qWkW8r3IFteu5y+Id9KswxkNCw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@sasjs/utils": "^2.10.2",
|
||||
@@ -16,13 +16,13 @@
|
||||
}
|
||||
},
|
||||
"@sasjs/cli": {
|
||||
"version": "2.19.3",
|
||||
"resolved": "https://registry.npmjs.org/@sasjs/cli/-/cli-2.19.3.tgz",
|
||||
"integrity": "sha512-H5CmYVHqHqa2jhNW0xKIzUvZcAHomOg20AHUSETrccVdVALAsEschICnhz5PwD2ebga8UzWhwqHhGnBPjYy18A==",
|
||||
"version": "2.22.2",
|
||||
"resolved": "https://registry.npmjs.org/@sasjs/cli/-/cli-2.22.2.tgz",
|
||||
"integrity": "sha512-FdQUWVJ0bAj1HOwfMtChMD8v9I0r49BBcYarJ4lSMMbFWwvVgnUmuD2s5sf6quKdyPP12XM06kz3gMYO++NlPg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@sasjs/adapter": "2.2.18",
|
||||
"@sasjs/core": "2.26.0",
|
||||
"@sasjs/adapter": "2.2.19",
|
||||
"@sasjs/core": "^2.30.6",
|
||||
"@sasjs/lint": "1.8.0",
|
||||
"@sasjs/utils": "2.12.1",
|
||||
"@types/url-parse": "1.4.3",
|
||||
@@ -47,9 +47,9 @@
|
||||
}
|
||||
},
|
||||
"@sasjs/core": {
|
||||
"version": "2.26.0",
|
||||
"resolved": "https://registry.npmjs.org/@sasjs/core/-/core-2.26.0.tgz",
|
||||
"integrity": "sha512-CTuRksG9XSKY5nkBB+Z7Fd4pR606ZzZaPw8IcKFtJp0csPZjLEDrc/qQ91jeB6znRbMjF7/WY+JtK/Sg5ZnEDg==",
|
||||
"version": "2.30.6",
|
||||
"resolved": "https://registry.npmjs.org/@sasjs/core/-/core-2.30.6.tgz",
|
||||
"integrity": "sha512-OqXEGQ58Ex/6O3OHx9IVcxPAkP17H9NpX6L1/ccAKQ3alBeLKf6xXayUSuM7NtgxumxA9rKYf5R7Ijnfn4H2ow==",
|
||||
"dev": true
|
||||
},
|
||||
"@sasjs/lint": {
|
||||
@@ -82,9 +82,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/prompts": {
|
||||
"version": "2.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/prompts/-/prompts-2.0.11.tgz",
|
||||
"integrity": "sha512-dcF5L3rU9VfpLEJIV++FEyhGhuIpJllNEwllVuJ5g8eoVqjf048tW9+spivIwjzgPbtaGAl7mIZW3cmhDAq2UQ==",
|
||||
"version": "2.0.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/prompts/-/prompts-2.0.12.tgz",
|
||||
"integrity": "sha512-Hr6osqfNg3IcQT3pJDXCsSnb0KnldY/hXeJCKJriwbZLnedN9n1e8kcZwLc25GIWULDb6h5aEyOBbf33XpZBXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
@@ -309,14 +309,6 @@
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"colors": "1.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"colors": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
|
||||
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"clone": {
|
||||
@@ -341,9 +333,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"colors": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz",
|
||||
"integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
|
||||
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=",
|
||||
"dev": true
|
||||
},
|
||||
"combined-stream": {
|
||||
@@ -355,12 +347,6 @@
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.1.0.tgz",
|
||||
"integrity": "sha1-0SG7roYNmZKj1Re6lvVliOR8Z4E=",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
@@ -573,16 +559,6 @@
|
||||
"traverse-chain": "~0.1.0"
|
||||
}
|
||||
},
|
||||
"findup": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/findup/-/findup-0.1.5.tgz",
|
||||
"integrity": "sha1-itkpozk7rGJ5V6fl3kYjsGsOLOs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"colors": "~0.6.0-1",
|
||||
"commander": "~2.1.0"
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
|
||||
@@ -654,20 +630,6 @@
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"ghooks": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ghooks/-/ghooks-2.0.4.tgz",
|
||||
"integrity": "sha1-/VDgQP9UiQauQstReToBv+JFZ7k=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"findup": "0.1.5",
|
||||
"lodash.clone": "4.5.0",
|
||||
"manage-path": "2.0.0",
|
||||
"opt-cli": "1.5.1",
|
||||
"path-exists": "3.0.0",
|
||||
"spawn-command": "0.0.2"
|
||||
}
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.7",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
|
||||
@@ -712,12 +674,6 @@
|
||||
"integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
|
||||
"dev": true
|
||||
},
|
||||
"graceful-readlink": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
|
||||
"integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
|
||||
"dev": true
|
||||
},
|
||||
"har-schema": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||
@@ -986,18 +942,6 @@
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"dev": true
|
||||
},
|
||||
"lodash._baseclone": {
|
||||
"version": "4.5.7",
|
||||
"resolved": "https://registry.npmjs.org/lodash._baseclone/-/lodash._baseclone-4.5.7.tgz",
|
||||
"integrity": "sha1-zkKt4IOE711i+nfDD2GkbmhvhDQ=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.clone": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.clone/-/lodash.clone-4.5.0.tgz",
|
||||
"integrity": "sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.groupby": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.groupby/-/lodash.groupby-4.6.0.tgz",
|
||||
@@ -1020,12 +964,6 @@
|
||||
"is-unicode-supported": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"manage-path": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/manage-path/-/manage-path-2.0.0.tgz",
|
||||
"integrity": "sha1-9M+EV7km7u4qg7FzUBQUvHbrlZc=",
|
||||
"dev": true
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.47.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz",
|
||||
@@ -1092,44 +1030,6 @@
|
||||
"mimic-fn": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"opt-cli": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/opt-cli/-/opt-cli-1.5.1.tgz",
|
||||
"integrity": "sha1-BNtEexPJa5kusxaFJm9O0NlzbcI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "2.9.0",
|
||||
"lodash.clone": "4.3.2",
|
||||
"manage-path": "2.0.0",
|
||||
"spawn-command": "0.0.2-1"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
|
||||
"integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-readlink": ">= 1.0.0"
|
||||
}
|
||||
},
|
||||
"lodash.clone": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.clone/-/lodash.clone-4.3.2.tgz",
|
||||
"integrity": "sha1-5WsXa2gjp93jj38r9Y3n1ZcSAOk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash._baseclone": "~4.5.0"
|
||||
}
|
||||
},
|
||||
"spawn-command": {
|
||||
"version": "0.0.2-1",
|
||||
"resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz",
|
||||
"integrity": "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"optionator": {
|
||||
"version": "0.8.3",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
|
||||
@@ -1173,12 +1073,6 @@
|
||||
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==",
|
||||
"dev": true
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
||||
"dev": true
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
@@ -1436,12 +1330,6 @@
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"spawn-command": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz",
|
||||
"integrity": "sha1-lUThpDygRfhTGqwaSMspva5iM44=",
|
||||
"dev": true
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
|
||||
|
||||
11
package.json
11
package.json
@@ -29,16 +29,11 @@
|
||||
"build": "sasjs cbd -t viya",
|
||||
"docs": "sasjs doc && ./sasjs/utils/build.sh",
|
||||
"test": "sasjs test -t viya",
|
||||
"lint": "sasjs lint"
|
||||
"lint": "sasjs lint",
|
||||
"postinstall": "[ -d .git ] && git config core.hooksPath ./.git-hooks || true"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sasjs/cli": "^2.19.3",
|
||||
"ghooks": "^2.0.4"
|
||||
},
|
||||
"config": {
|
||||
"ghooks": {
|
||||
"pre-commit": "sasjs lint"
|
||||
}
|
||||
"@sasjs/cli": "^2.22.2"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"meta",
|
||||
"metax",
|
||||
"viya",
|
||||
"lua"
|
||||
"lua",
|
||||
"tests/base"
|
||||
],
|
||||
"docConfig": {
|
||||
"displayMacroCore": false,
|
||||
@@ -16,6 +17,13 @@
|
||||
"readMe": "../../README.md"
|
||||
}
|
||||
},
|
||||
"testConfig": {
|
||||
"initProgram": "tests/testinit.sas",
|
||||
"termProgram": "tests/testterm.sas",
|
||||
"macroVars": {
|
||||
"mcTestAppLoc": "/Public/temp/macrocore"
|
||||
}
|
||||
},
|
||||
"defaultTarget": "viya",
|
||||
"targets": [
|
||||
{
|
||||
@@ -27,22 +35,18 @@
|
||||
"deployServicePack": true
|
||||
},
|
||||
"macroFolders": [
|
||||
"base",
|
||||
"meta",
|
||||
"metax",
|
||||
"viya",
|
||||
"lua",
|
||||
"tests/base",
|
||||
"tests/viya"
|
||||
],
|
||||
"contextName": "SAS Job Execution compute context",
|
||||
"testConfig": {
|
||||
"initProgram": "tests/testinit.sas",
|
||||
"termProgram": "tests/testterm.sas",
|
||||
"macroVars": {
|
||||
"mcTestAppLoc": "/Public/temp/macrocore"
|
||||
}
|
||||
}
|
||||
"contextName": "SAS Job Execution compute context"
|
||||
},
|
||||
{
|
||||
"name": "sas9",
|
||||
"serverUrl": "https://sas.analytium.co.uk:8343",
|
||||
"serverType": "SAS9",
|
||||
"appLoc": "/Shared Data/temp/macrocore",
|
||||
"macroFolders": [
|
||||
"tests/meta"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
@li mp_filtergenerate.sas
|
||||
@li mp_filtervalidate.sas
|
||||
@li mp_assertdsobs.sas
|
||||
@li mp_assert.sas
|
||||
|
||||
**/
|
||||
|
||||
@@ -41,14 +42,14 @@ run;
|
||||
%mp_filtergenerate(work.inds,outref=myfilter)
|
||||
%mp_filtervalidate(myfilter,sashelp.class,outds=work.results,abort=NO)
|
||||
%mp_assertdsobs(work.results,
|
||||
desc=Valid filter,
|
||||
desc=Empty filter,
|
||||
test=EMPTY,
|
||||
outds=work.test_results
|
||||
)
|
||||
|
||||
|
||||
|
||||
/* invalid filter*/
|
||||
/* invalid filter - char var, num val */
|
||||
data work.inds;
|
||||
infile datalines4 dsd;
|
||||
input GROUP_LOGIC:$3. SUBGROUP_LOGIC:$3. SUBGROUP_ID:8. VARIABLE_NM:$32.
|
||||
@@ -60,9 +61,40 @@ run;
|
||||
%mp_filtergenerate(work.inds,outref=myfilter)
|
||||
%mp_filtervalidate(myfilter,sashelp.class,outds=work.results,abort=NO)
|
||||
%let syscc=0;
|
||||
%mp_assertdsobs(work.results,
|
||||
desc=Valid filter,
|
||||
test=EQUALS 1,
|
||||
%let test3=0;
|
||||
data _null_;
|
||||
set work.results;
|
||||
if REASON_CD=:'VALIDATION_ERROR' then call symputx('test3',1);
|
||||
putlog (_all_)(=);
|
||||
stop;
|
||||
run;
|
||||
%mp_assert(
|
||||
iftrue=(&test3=1),
|
||||
desc=Checking char var could not receive num val,
|
||||
outds=work.test_results
|
||||
)
|
||||
|
||||
/* invalid filter - num var, char val */
|
||||
data work.inds;
|
||||
infile datalines4 dsd;
|
||||
input GROUP_LOGIC:$3. SUBGROUP_LOGIC:$3. SUBGROUP_ID:8. VARIABLE_NM:$32.
|
||||
OPERATOR_NM:$10. RAW_VALUE:$4000.;
|
||||
datalines4;
|
||||
AND,AND,1,age,NE,"'M'"
|
||||
;;;;
|
||||
run;
|
||||
%mp_filtergenerate(work.inds,outref=myfilter)
|
||||
%mp_filtervalidate(myfilter,sashelp.class,outds=work.results,abort=NO)
|
||||
%let syscc=0;
|
||||
%let test4=0;
|
||||
data _null_;
|
||||
set work.results;
|
||||
if REASON_CD=:'VALIDATION_ERROR' then call symputx('test4',1);
|
||||
putlog (_all_)(=);
|
||||
stop;
|
||||
run;
|
||||
%mp_assert(
|
||||
iftrue=(&test4=1),
|
||||
desc=Checking num var could not receive char val,
|
||||
outds=work.test_results
|
||||
)
|
||||
35
tests/meta/mm_webout.test.sas
Normal file
35
tests/meta/mm_webout.test.sas
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mm_webout macro
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_getuniquefileref.sas
|
||||
@li mm_webout.sas
|
||||
@li mp_assert.sas
|
||||
|
||||
**/
|
||||
|
||||
|
||||
%let fref=%mf_getuniquefileref();
|
||||
%global _metaperson;
|
||||
data some datasets;
|
||||
x=1;
|
||||
run;
|
||||
%mm_webout(OPEN,fref=&fref)
|
||||
%mm_webout(ARR,some,fref=&fref)
|
||||
%mm_webout(OBJ,datasets,fref=&fref)
|
||||
%mm_webout(CLOSE,fref=&fref)
|
||||
|
||||
libname test JSON (&fref);
|
||||
data root;
|
||||
set test.root;
|
||||
call symputx('checkval',sysvlong);
|
||||
run;
|
||||
data alldata;
|
||||
set test.alldata;
|
||||
run;
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(%str(&checkval)=%str(&sysvlong)),
|
||||
desc=Check if the sysvlong value was created
|
||||
)
|
||||
32
tests/viya/mv_createfolder.test.sas
Normal file
32
tests/viya/mv_createfolder.test.sas
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mv_createfolder macro
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_uid.sas
|
||||
@li mp_assert.sas
|
||||
@li mv_createfolder.sas
|
||||
@li mv_deleteviyafolder.sas
|
||||
@li mv_getfoldermembers.sas
|
||||
|
||||
**/
|
||||
|
||||
|
||||
%let folder=%mf_uid();
|
||||
|
||||
/* create a folder */
|
||||
%mv_createfolder(path=&mcTestAppLoc/temp/&folder/&folder)
|
||||
|
||||
%mv_getfoldermembers(root=&mcTestAppLoc/temp/&folder, outds=work.folders)
|
||||
|
||||
%let test=0;
|
||||
data _null_;
|
||||
set work.folders;
|
||||
putlog (_all_)(=);
|
||||
if name="&folder" then call symputx('test',1);
|
||||
run;
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(&test=1),
|
||||
desc=Check if temp folder can be successfully created
|
||||
)
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
**/
|
||||
|
||||
options mprint notes;
|
||||
|
||||
/**
|
||||
* Test Case 1
|
||||
*/
|
||||
|
||||
41
tests/viya/mv_webout.test.sas
Normal file
41
tests/viya/mv_webout.test.sas
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mm_webout macro
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_getuniquefileref.sas
|
||||
@li mv_webout.sas
|
||||
@li mp_assert.sas
|
||||
|
||||
**/
|
||||
|
||||
|
||||
%let fref=%mf_getuniquefileref();
|
||||
%global _metaperson;
|
||||
data some datasets;
|
||||
x=1;
|
||||
run;
|
||||
%mv_webout(OPEN,fref=&fref,stream=N)
|
||||
%mv_webout(ARR,some,fref=&fref,stream=N)
|
||||
%mv_webout(OBJ,datasets,fref=&fref,stream=N)
|
||||
%mv_webout(CLOSE,fref=&fref,stream=N)
|
||||
|
||||
data _null_;
|
||||
infile &fref;
|
||||
input;
|
||||
putlog _infile_;
|
||||
run;
|
||||
|
||||
libname test JSON (&fref);
|
||||
data root;
|
||||
set test.root;
|
||||
call symputx('checkval',sysvlong);
|
||||
run;
|
||||
data alldata;
|
||||
set test.alldata;
|
||||
run;
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(%str(&checkval)=%str(&sysvlong)),
|
||||
desc=Check if the sysvlong value was created
|
||||
)
|
||||
@@ -1,17 +1,22 @@
|
||||
/**
|
||||
@file mv_createfolder.sas
|
||||
@brief Creates a viya folder if that folder does not already exist
|
||||
@details Expects oauth token in a global macro variable (default
|
||||
ACCESS_TOKEN).
|
||||
@details Creates a viya folder by checking if each parent folder exists, and
|
||||
recursively creating children if needed.
|
||||
Usage:
|
||||
|
||||
%mv_createfolder(path=/Public)
|
||||
|
||||
|
||||
@param path= The full path of the folder to be created
|
||||
@param access_token_var= The global macro variable to contain the access token
|
||||
@param grant_type= (authorization_code) Valid values are "password" or
|
||||
"authorization_code" (unquoted).
|
||||
@param [in] path= The full path of the folder to be created
|
||||
@param [in] access_token_var= The global macro variable to contain the access
|
||||
token, if using authorization_code grant type.
|
||||
@param [in] grant_type= (sas_services) Valid values are:
|
||||
@li password
|
||||
@li authorization_code
|
||||
@li sas_services
|
||||
|
||||
@param [in] mdebug=(0) set to 1 to enable DEBUG messages
|
||||
|
||||
@version VIYA V.03.04
|
||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||
@@ -28,15 +33,23 @@
|
||||
%macro mv_createfolder(path=
|
||||
,access_token_var=ACCESS_TOKEN
|
||||
,grant_type=sas_services
|
||||
,mdebug=0
|
||||
);
|
||||
%local dbg;
|
||||
%if &mdebug=1 %then %do;
|
||||
%put &sysmacroname entry vars:;
|
||||
%put _local_;
|
||||
%end;
|
||||
%else %let dbg=*;
|
||||
|
||||
%local oauth_bearer;
|
||||
%if &grant_type=detect %then %do;
|
||||
%if %symexist(&access_token_var) %then %let grant_type=authorization_code;
|
||||
%else %let grant_type=sas_services;
|
||||
%end;
|
||||
%if &grant_type=sas_services %then %do;
|
||||
%let oauth_bearer=oauth_bearer=sas_services;
|
||||
%let &access_token_var=;
|
||||
%let oauth_bearer=oauth_bearer=sas_services;
|
||||
%let &access_token_var=;
|
||||
%end;
|
||||
|
||||
%mp_abort(iftrue=(&grant_type ne authorization_code and &grant_type ne password
|
||||
@@ -91,12 +104,21 @@ options noquotelenmax;
|
||||
,mac=&sysmacroname
|
||||
,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
|
||||
)
|
||||
%if &mdebug=1 %then %do;
|
||||
%put &sysmacroname following check to see if &newpath exists:;
|
||||
%put _local_;
|
||||
data _null_;
|
||||
set &fname1;
|
||||
input;
|
||||
putlog _infile_;
|
||||
run;
|
||||
%end;
|
||||
%if &SYS_PROCHTTP_STATUS_CODE=200 %then %do;
|
||||
%*put &sysmacroname &newpath exists so grab the follow on link ;
|
||||
data _null_;
|
||||
set &libref1..links;
|
||||
if rel='createChild' then
|
||||
call symputx('href',quote("&base_uri"!!trim(href)),'l');
|
||||
call symputx('href',quote(cats("&base_uri",href)),'l');
|
||||
run;
|
||||
%end;
|
||||
%else %if &SYS_PROCHTTP_STATUS_CODE=404 %then %do;
|
||||
@@ -140,8 +162,10 @@ options noquotelenmax;
|
||||
%put &sysmacroname &newpath now created. Grabbing the follow on link ;
|
||||
data _null_;
|
||||
set &libref2..links;
|
||||
if rel='createChild' then
|
||||
call symputx('href',quote(trim(href)),'l');
|
||||
if rel='createChild' then do;
|
||||
call symputx('href',quote(cats("&base_uri",href)),'l');
|
||||
&dbg put (_all_)(=);
|
||||
end;
|
||||
run;
|
||||
|
||||
libname &libref2 clear;
|
||||
@@ -150,4 +174,4 @@ options noquotelenmax;
|
||||
filename &fname1 clear;
|
||||
libname &libref1 clear;
|
||||
%end;
|
||||
%mend;
|
||||
%mend mv_createfolder;
|
||||
@@ -327,7 +327,7 @@ data _null_;
|
||||
put ' run; ';
|
||||
put ' %let ds=&fmtds; ';
|
||||
put ' %end; /* &fmt=Y */ ';
|
||||
put ' data _null_;file &jref mod ; ';
|
||||
put ' data _null_;file &jref mod encoding=''utf-8''; ';
|
||||
put ' put "["; call symputx(''cols'',0,''l''); ';
|
||||
put ' proc sort ';
|
||||
put ' data=sashelp.vcolumn(where=(libname=''WORK'' & memname="%upcase(&ds)")) ';
|
||||
@@ -411,7 +411,7 @@ data _null_;
|
||||
put ' run; ';
|
||||
put '%end; ';
|
||||
put '%mend mp_jsonout; ';
|
||||
put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y); ';
|
||||
put '%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y); ';
|
||||
put '%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name ';
|
||||
put ' sasjs_tables SYS_JES_JOB_URI; ';
|
||||
put '%if %index("&_debug",log) %then %let _debug=131; ';
|
||||
@@ -590,17 +590,19 @@ data _null_;
|
||||
put ' put ",""SYSERRORTEXT"" : ""&syserrortext"" "; ';
|
||||
put ' put ",""SYSHOSTNAME"" : ""&syshostname"" "; ';
|
||||
put ' put ",""SYSSITE"" : ""&syssite"" "; ';
|
||||
put ' sysvlong=quote(trim(symget(''sysvlong''))); ';
|
||||
put ' put '',"SYSVLONG" : '' sysvlong; ';
|
||||
put ' put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" "; ';
|
||||
put ' put '',"END_DTTM" : "'' "%sysfunc(datetime(),datetime20.3)" ''" ''; ';
|
||||
put ' put "}"; ';
|
||||
put ' ';
|
||||
put ' %if %upcase(&fref) ne _WEBOUT %then %do; ';
|
||||
put ' %if %upcase(&fref) ne _WEBOUT and &stream=Y %then %do; ';
|
||||
put ' data _null_; rc=fcopy("&fref","_webout");run; ';
|
||||
put ' %end; ';
|
||||
put ' ';
|
||||
put '%end; ';
|
||||
put ' ';
|
||||
put '%mend; ';
|
||||
put '%mend mv_webout; ';
|
||||
put ' ';
|
||||
put '%macro mf_getuser(type=META ';
|
||||
put ')/*/STORE SOURCE*/; ';
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
|
||||
|
||||
@param root= The path for which to return the list of folders
|
||||
@param outds= The output dataset to create (default is work.mv_getfolders)
|
||||
@param outds= The output dataset to create (default is work.mv_getfolders). Format:
|
||||
|ordinal_root|ordinal_items|creationTimeStamp| modifiedTimeStamp|createdBy|modifiedBy|id| uri|added| type|name|description|
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
|1|1|2021-05-25T11:15:04.204Z|2021-05-25T11:15:04.204Z|allbow|allbow|4f1e3945-9655-462b-90f2-c31534b3ca47|/folders/folders/ed701ff3-77e8-468d-a4f5-8c43dec0fd9e|2021-05-25T11:15:04.212Z|child|my_folder_name|My folder Description|
|
||||
|
||||
@param access_token_var= The global macro variable to contain the access token
|
||||
@param grant_type= valid values are "password" or "authorization_code" (unquoted).
|
||||
The default is authorization_code.
|
||||
@@ -116,4 +120,4 @@ options noquotelenmax;
|
||||
filename &fname1 clear;
|
||||
libname &libref1 clear;
|
||||
|
||||
%mend;
|
||||
%mend mv_getfoldermembers;
|
||||
@@ -23,9 +23,10 @@
|
||||
@param action Either OPEN, ARR, OBJ or CLOSE
|
||||
@param ds The dataset to send back to the frontend
|
||||
@param _webout= fileref for returning the json
|
||||
@param fref= temp fref
|
||||
@param fref=(_mvwtemp) Temp fileref to which to write the output
|
||||
@param dslabel= value to use instead of the real name for sending to JSON
|
||||
@param fmt= change to N to strip formats from output
|
||||
@param fmt=(Y) change to N to strip formats from output
|
||||
@param stream=(Y) Change to N if not streaming to _webout
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mp_jsonout.sas
|
||||
@@ -35,7 +36,7 @@
|
||||
@author Allan Bowe, source: https://github.com/sasjs/core
|
||||
|
||||
**/
|
||||
%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y);
|
||||
%macro mv_webout(action,ds,fref=_mvwtemp,dslabel=,fmt=Y,stream=Y);
|
||||
%global _webin_file_count _webin_fileuri _debug _omittextlog _webin_name
|
||||
sasjs_tables SYS_JES_JOB_URI;
|
||||
%if %index("&_debug",log) %then %let _debug=131;
|
||||
@@ -214,14 +215,16 @@
|
||||
put ",""SYSERRORTEXT"" : ""&syserrortext"" ";
|
||||
put ",""SYSHOSTNAME"" : ""&syshostname"" ";
|
||||
put ",""SYSSITE"" : ""&syssite"" ";
|
||||
sysvlong=quote(trim(symget('sysvlong')));
|
||||
put ',"SYSVLONG" : ' sysvlong;
|
||||
put ",""SYSWARNINGTEXT"" : ""&syswarningtext"" ";
|
||||
put ',"END_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '" ';
|
||||
put "}";
|
||||
|
||||
%if %upcase(&fref) ne _WEBOUT %then %do;
|
||||
%if %upcase(&fref) ne _WEBOUT and &stream=Y %then %do;
|
||||
data _null_; rc=fcopy("&fref","_webout");run;
|
||||
%end;
|
||||
|
||||
%end;
|
||||
|
||||
%mend;
|
||||
%mend mv_webout;
|
||||
|
||||
Reference in New Issue
Block a user