@sasjs/core 4.23.3 → 4.25.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/mp_copyfolder.sas +8 -5
- package/base/mp_ds2md.sas +5 -0
- package/base/mp_hashdataset.sas +3 -2
- package/package.json +1 -1
- package/server/ms_creategroup.sas +149 -0
- package/server/ms_getgroups.sas +105 -0
|
@@ -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/mp_copyfolder.sas
CHANGED
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
%mp_copyfolder(&rootdir,©dir)
|
|
18
18
|
|
|
19
|
-
@param source Unquoted path to the folder to copy from.
|
|
20
|
-
@param target Unquoted path to the folder to copy to.
|
|
19
|
+
@param [in] source Unquoted path to the folder to copy from.
|
|
20
|
+
@param [out] target Unquoted path to the folder to copy to.
|
|
21
|
+
@param [in] copymax=(MAX) Set to a positive integer to indicate the level of
|
|
22
|
+
subdirectory copy recursion - eg 3, to go `./3/levels/deep`. For unlimited
|
|
23
|
+
recursion, set to MAX.
|
|
21
24
|
|
|
22
25
|
<h4> SAS Macros </h4>
|
|
23
26
|
@li mf_getuniquename.sas
|
|
@@ -31,7 +34,7 @@
|
|
|
31
34
|
|
|
32
35
|
**/
|
|
33
36
|
|
|
34
|
-
%macro mp_copyfolder(source,target);
|
|
37
|
+
%macro mp_copyfolder(source,target,copymax=MAX);
|
|
35
38
|
|
|
36
39
|
%mp_abort(iftrue=(%mf_isdir(&source)=0)
|
|
37
40
|
,mac=&sysmacroname
|
|
@@ -50,7 +53,7 @@
|
|
|
50
53
|
%let tempds=%mf_getuniquename();
|
|
51
54
|
|
|
52
55
|
/* recursive directory listing */
|
|
53
|
-
%mp_dirlist(path=&source,outds=work.&tempds,
|
|
56
|
+
%mp_dirlist(path=&source,outds=work.&tempds,maxdepth=©max)
|
|
54
57
|
|
|
55
58
|
/* create folders and copy content */
|
|
56
59
|
data _null_;
|
|
@@ -78,4 +81,4 @@
|
|
|
78
81
|
proc sql;
|
|
79
82
|
drop table work.&tempds;
|
|
80
83
|
|
|
81
|
-
%mend mp_copyfolder;
|
|
84
|
+
%mend mp_copyfolder;
|
package/base/mp_ds2md.sas
CHANGED
package/base/mp_hashdataset.sas
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
%if %mf_getattrn(&libds,NLOBS)=0 %then %do;
|
|
59
59
|
data &outds;
|
|
60
60
|
length hashkey $32;
|
|
61
|
-
|
|
61
|
+
hashkey=put(md5("&salt"),$hex32.);
|
|
62
62
|
output;
|
|
63
63
|
stop;
|
|
64
64
|
run;
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
%end;
|
|
76
76
|
;
|
|
77
77
|
length &prevkeyvar &keyvar $32;
|
|
78
|
-
retain &prevkeyvar
|
|
78
|
+
retain &prevkeyvar;
|
|
79
|
+
if _n_=1 then &prevkeyvar=put(md5("&salt"),$hex32.);
|
|
79
80
|
set &libds end=&lastvar;
|
|
80
81
|
/* hash should include previous row */
|
|
81
82
|
&keyvar=%mp_md5(
|
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;
|