@sasjs/core 4.24.0 → 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/Dockerfile +8 -0
- package/.devcontainer/devcontainer.json +26 -0
- package/base/mf_existfeature.sas +6 -0
- package/base/mp_ds2md.sas +5 -0
- package/package.json +1 -1
- package/server/ms_creategroup.sas +149 -0
- package/server/ms_getgroups.sas +105 -0
- package/server/ms_runstp.sas +3 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.233.0/containers/javascript-node/.devcontainer/base.Dockerfile
|
|
2
|
+
|
|
3
|
+
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
|
|
4
|
+
ARG VARIANT="18-bullseye"
|
|
5
|
+
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
|
|
6
|
+
|
|
7
|
+
RUN apt-get update \
|
|
8
|
+
&& apt-get install -y doxygen
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
|
2
|
+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.233.0/containers/typescript-node
|
|
3
|
+
{
|
|
4
|
+
"name": "Node.js & TypeScript",
|
|
5
|
+
"build": {
|
|
6
|
+
"dockerfile": "Dockerfile",
|
|
7
|
+
// Update 'VARIANT' to pick a Node version: 18, 16, 14.
|
|
8
|
+
// Append -bullseye or -buster to pin to an OS version.
|
|
9
|
+
// Use -bullseye variants on local on arm64/Apple Silicon.
|
|
10
|
+
"args": {
|
|
11
|
+
"VARIANT": "16-bullseye"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
// Set *default* container specific settings.json values on container create.
|
|
15
|
+
"settings": {},
|
|
16
|
+
// Add the IDs of extensions you want installed when the container is created.
|
|
17
|
+
"extensions": [
|
|
18
|
+
"SASjs.sasjs-for-vscode"
|
|
19
|
+
],
|
|
20
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
21
|
+
// "forwardPorts": [],
|
|
22
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
23
|
+
"postCreateCommand": "npm i && npm i -g @sasjs/cli",
|
|
24
|
+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
|
25
|
+
"remoteUser": "node"
|
|
26
|
+
}
|
package/base/mf_existfeature.sas
CHANGED
|
@@ -40,6 +40,12 @@
|
|
|
40
40
|
%else %if "&SYSVLONG" < "9.04.01M3" %then 0;
|
|
41
41
|
%else 1;
|
|
42
42
|
%end;
|
|
43
|
+
%else %if &feature=EXPORTXLS %then %do;
|
|
44
|
+
/* is it possible to PROC EXPORT an excel file? */
|
|
45
|
+
%if "%substr(&sysver,1,1)"="4" or "%substr(&sysver,1,1)"="5" %then 1;
|
|
46
|
+
%else %if %sysfunc(sysprod(SAS/ACCESS Interface to PC Files)) = 1 %then 1;
|
|
47
|
+
%else 0;
|
|
48
|
+
%end;
|
|
43
49
|
%else %do;
|
|
44
50
|
-1
|
|
45
51
|
%put &sysmacroname: &feature not found;
|
package/base/mp_ds2md.sas
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Creates a group on SASjs Server
|
|
4
|
+
@details Creates a group on SASjs Server with the following attributes:
|
|
5
|
+
|
|
6
|
+
@li name
|
|
7
|
+
@li description
|
|
8
|
+
@li isActive
|
|
9
|
+
|
|
10
|
+
Examples:
|
|
11
|
+
|
|
12
|
+
%ms_creategroup(mynewgroup)
|
|
13
|
+
|
|
14
|
+
%ms_creategroup(mynewergroup, desc=The group description)
|
|
15
|
+
|
|
16
|
+
@param [in] groupname The group name to create. No spaces or special chars.
|
|
17
|
+
@param [in] desc= (0) If no description provided, group name will be used.
|
|
18
|
+
@param [in] isactive= (true) Set to false to create an inactive group.
|
|
19
|
+
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages
|
|
20
|
+
@param [out] outds= (work.ms_creategroup) This output dataset will contain the
|
|
21
|
+
values from the JSON response (such as the id of the new group)
|
|
22
|
+
|DESCRIPTION:$1.|GROUPID:best.|ISACTIVE:best.|NAME:$11.|
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
|`The group description`|`2 `|`1 `|`mynewergroup `|
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<h4> SAS Macros </h4>
|
|
29
|
+
@li mf_getuniquefileref.sas
|
|
30
|
+
@li mf_getuniquelibref.sas
|
|
31
|
+
@li mp_abort.sas
|
|
32
|
+
|
|
33
|
+
<h4> Related Files </h4>
|
|
34
|
+
@li ms_creategroup.test.sas
|
|
35
|
+
@li ms_getgroups.sas
|
|
36
|
+
|
|
37
|
+
**/
|
|
38
|
+
|
|
39
|
+
%macro ms_creategroup(groupname
|
|
40
|
+
,desc=0
|
|
41
|
+
,isactive=true
|
|
42
|
+
,outds=work.ms_creategroup
|
|
43
|
+
,mdebug=0
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
%mp_abort(
|
|
47
|
+
iftrue=(&syscc ne 0)
|
|
48
|
+
,mac=ms_creategroup.sas
|
|
49
|
+
,msg=%str(syscc=&syscc on macro entry)
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
%local fref0 fref1 fref2 libref optval rc msg;
|
|
53
|
+
%let fref0=%mf_getuniquefileref();
|
|
54
|
+
%let fref1=%mf_getuniquefileref();
|
|
55
|
+
%let fref2=%mf_getuniquefileref();
|
|
56
|
+
%let libref=%mf_getuniquelibref();
|
|
57
|
+
|
|
58
|
+
/* avoid sending bom marker to API */
|
|
59
|
+
%let optval=%sysfunc(getoption(bomfile));
|
|
60
|
+
options nobomfile;
|
|
61
|
+
|
|
62
|
+
data _null_;
|
|
63
|
+
file &fref0 termstr=crlf;
|
|
64
|
+
name=quote(cats(symget('groupname')));
|
|
65
|
+
description=quote(cats(symget('desc')));
|
|
66
|
+
if cats(description)='"0"' then description=name;
|
|
67
|
+
isactive=symget('isactive');
|
|
68
|
+
%if &mdebug=1 %then %do;
|
|
69
|
+
putlog _all_;
|
|
70
|
+
%end;
|
|
71
|
+
|
|
72
|
+
put '{'@;
|
|
73
|
+
put '"name":' name @;
|
|
74
|
+
put ',"description":' description @;
|
|
75
|
+
put ',"isActive":' isactive @;
|
|
76
|
+
put '}';
|
|
77
|
+
run;
|
|
78
|
+
|
|
79
|
+
data _null_;
|
|
80
|
+
file &fref1 lrecl=1000;
|
|
81
|
+
infile "&_sasjs_tokenfile" lrecl=1000;
|
|
82
|
+
input;
|
|
83
|
+
if _n_=1 then do;
|
|
84
|
+
put "Content-Type: application/json";
|
|
85
|
+
put "accept: application/json";
|
|
86
|
+
end;
|
|
87
|
+
put _infile_;
|
|
88
|
+
run;
|
|
89
|
+
|
|
90
|
+
%if &mdebug=1 %then %do;
|
|
91
|
+
data _null_;
|
|
92
|
+
infile &fref0;
|
|
93
|
+
input;
|
|
94
|
+
put _infile_;
|
|
95
|
+
data _null_;
|
|
96
|
+
infile &fref1;
|
|
97
|
+
input;
|
|
98
|
+
put _infile_;
|
|
99
|
+
run;
|
|
100
|
+
%end;
|
|
101
|
+
|
|
102
|
+
proc http method='POST' in=&fref0 headerin=&fref1 out=&fref2
|
|
103
|
+
url="&_sasjs_apiserverurl/SASjsApi/group";
|
|
104
|
+
%if &mdebug=1 %then %do;
|
|
105
|
+
debug level=1;
|
|
106
|
+
%end;
|
|
107
|
+
run;
|
|
108
|
+
|
|
109
|
+
%mp_abort(
|
|
110
|
+
iftrue=(&syscc ne 0)
|
|
111
|
+
,mac=ms_creategroup.sas
|
|
112
|
+
,msg=%str(Issue submitting query to SASjsApi/group)
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
libname &libref JSON fileref=&fref2;
|
|
116
|
+
|
|
117
|
+
data &outds;
|
|
118
|
+
set &libref..root;
|
|
119
|
+
drop ordinal_root;
|
|
120
|
+
%if &mdebug=1 %then %do;
|
|
121
|
+
putlog _all_;
|
|
122
|
+
%end;
|
|
123
|
+
run;
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
%mp_abort(
|
|
127
|
+
iftrue=(&syscc ne 0)
|
|
128
|
+
,mac=ms_creategroup.sas
|
|
129
|
+
,msg=%str(Issue reading response JSON)
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
/* reset options */
|
|
133
|
+
options &optval;
|
|
134
|
+
|
|
135
|
+
%if &mdebug=0 %then %do;
|
|
136
|
+
filename &fref0 clear;
|
|
137
|
+
filename &fref1 clear;
|
|
138
|
+
filename &fref2 clear;
|
|
139
|
+
libname &libref clear;
|
|
140
|
+
%end;
|
|
141
|
+
%else %do;
|
|
142
|
+
data _null_;
|
|
143
|
+
infile &fref2;
|
|
144
|
+
input;
|
|
145
|
+
putlog _infile_;
|
|
146
|
+
run;
|
|
147
|
+
%end;
|
|
148
|
+
|
|
149
|
+
%mend ms_creategroup;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@file
|
|
3
|
+
@brief Fetches the list of groups from SASjs Server
|
|
4
|
+
@details Fetches the list of groups from SASjs Server and writes them to an
|
|
5
|
+
output dataset.
|
|
6
|
+
|
|
7
|
+
Example:
|
|
8
|
+
|
|
9
|
+
%ms_getgroups(outds=userlist)
|
|
10
|
+
|
|
11
|
+
@param [in] mdebug= (0) Set to 1 to enable DEBUG messages
|
|
12
|
+
@param [out] outds= (work.ms_getgroups) This output dataset will contain the
|
|
13
|
+
list of groups. Format:
|
|
14
|
+
|NAME:$32.|DESCRIPTION:$64.|GROUPID:best.|
|
|
15
|
+
|---|---|---|
|
|
16
|
+
|`SomeGroup `|`A group `|`1`|
|
|
17
|
+
|`Another Group`|`this is a different group`|`2`|
|
|
18
|
+
|`admin`|`Administrators `|`3`|
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<h4> SAS Macros </h4>
|
|
22
|
+
@li mf_getuniquefileref.sas
|
|
23
|
+
@li mf_getuniquelibref.sas
|
|
24
|
+
@li mp_abort.sas
|
|
25
|
+
|
|
26
|
+
<h4> Related Files </h4>
|
|
27
|
+
@li ms_creategroup.sas
|
|
28
|
+
@li ms_getusers.test.sas
|
|
29
|
+
|
|
30
|
+
**/
|
|
31
|
+
|
|
32
|
+
%macro ms_getgroups(
|
|
33
|
+
outds=work.ms_getgroups
|
|
34
|
+
,mdebug=0
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
%mp_abort(
|
|
38
|
+
iftrue=(&syscc ne 0)
|
|
39
|
+
,mac=ms_getusers.sas
|
|
40
|
+
,msg=%str(syscc=&syscc on macro entry)
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
%local fref0 fref1 libref optval rc msg;
|
|
44
|
+
%let fref0=%mf_getuniquefileref();
|
|
45
|
+
%let fref1=%mf_getuniquefileref();
|
|
46
|
+
%let libref=%mf_getuniquelibref();
|
|
47
|
+
|
|
48
|
+
/* avoid sending bom marker to API */
|
|
49
|
+
%let optval=%sysfunc(getoption(bomfile));
|
|
50
|
+
options nobomfile;
|
|
51
|
+
|
|
52
|
+
data _null_;
|
|
53
|
+
file &fref0 lrecl=1000;
|
|
54
|
+
infile "&_sasjs_tokenfile" lrecl=1000;
|
|
55
|
+
input;
|
|
56
|
+
if _n_=1 then put "accept: application/json";
|
|
57
|
+
put _infile_;
|
|
58
|
+
run;
|
|
59
|
+
|
|
60
|
+
%if &mdebug=1 %then %do;
|
|
61
|
+
data _null_;
|
|
62
|
+
infile &fref0;
|
|
63
|
+
input;
|
|
64
|
+
put _infile_;
|
|
65
|
+
run;
|
|
66
|
+
%end;
|
|
67
|
+
|
|
68
|
+
proc http method='GET' headerin=&fref0 out=&fref1
|
|
69
|
+
url="&_sasjs_apiserverurl/SASjsApi/group";
|
|
70
|
+
%if &mdebug=1 %then %do;
|
|
71
|
+
debug level=1;
|
|
72
|
+
%end;
|
|
73
|
+
run;
|
|
74
|
+
|
|
75
|
+
%mp_abort(
|
|
76
|
+
iftrue=(&syscc ne 0)
|
|
77
|
+
,mac=ms_getgroups.sas
|
|
78
|
+
,msg=%str(Issue submitting GET query to SASjsApi/group)
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
libname &libref JSON fileref=&fref1;
|
|
82
|
+
|
|
83
|
+
data &outds;
|
|
84
|
+
length NAME $32 DESCRIPTION $64. GROUPID 8;
|
|
85
|
+
if _n_=1 then call missing(of _all_);
|
|
86
|
+
set &libref..root;
|
|
87
|
+
drop ordinal_root;
|
|
88
|
+
run;
|
|
89
|
+
|
|
90
|
+
%mp_abort(
|
|
91
|
+
iftrue=(&syscc ne 0)
|
|
92
|
+
,mac=ms_getusers.sas
|
|
93
|
+
,msg=%str(Issue reading response JSON)
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
/* reset options */
|
|
97
|
+
options &optval;
|
|
98
|
+
|
|
99
|
+
%if &mdebug=1 %then %do;
|
|
100
|
+
filename &fref0 clear;
|
|
101
|
+
filename &fref1 clear;
|
|
102
|
+
libname &libref clear;
|
|
103
|
+
%end;
|
|
104
|
+
|
|
105
|
+
%mend ms_getgroups;
|
package/server/ms_runstp.sas
CHANGED
|
@@ -162,6 +162,7 @@ proc http method='POST' headerin=&authref in=&mainref out=&outref
|
|
|
162
162
|
%end;
|
|
163
163
|
run;
|
|
164
164
|
%if (&SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 201)
|
|
165
|
+
or &mdebug=1
|
|
165
166
|
%then %do;
|
|
166
167
|
data _null_;infile &outref;input;putlog _infile_;run;
|
|
167
168
|
%end;
|
|
@@ -177,7 +178,7 @@ options &optval;
|
|
|
177
178
|
%if &outlogds ne _null_ or &mdebug=1 %then %do;
|
|
178
179
|
%local dumplib;
|
|
179
180
|
%let dumplib=%mf_getuniquelibref();
|
|
180
|
-
libname &dumplib json
|
|
181
|
+
libname &dumplib json fileref=&outref;
|
|
181
182
|
data &outlogds;
|
|
182
183
|
set &dumplib..log;
|
|
183
184
|
%if &mdebug=1 %then %do;
|
|
@@ -195,4 +196,4 @@ options &optval;
|
|
|
195
196
|
filename &authref;
|
|
196
197
|
filename &mainref;
|
|
197
198
|
%end;
|
|
198
|
-
%mend ms_runstp;
|
|
199
|
+
%mend ms_runstp;
|