@sasjs/core 4.59.3 → 4.59.5

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.
@@ -148,6 +148,6 @@ data _null_;
148
148
  run;
149
149
 
150
150
  /* END */
151
- %put &sysmacroname took %sysevalf(%sysfunc(datetime())-&dttm) seconds to run;
151
+ /* %put &sysmacroname took %sysevalf(%sysfunc(datetime())-&dttm) secs to run; */
152
152
 
153
153
  %mend mp_replace;
package/package.json CHANGED
@@ -32,5 +32,5 @@
32
32
  "lint": "npx @sasjs/cli lint",
33
33
  "prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true"
34
34
  },
35
- "version": "4.59.3"
35
+ "version": "4.59.5"
36
36
  }
@@ -33,12 +33,14 @@
33
33
  msg=Cannot enter mfv_existfolder.sas with syscc=&syscc
34
34
  )
35
35
 
36
- %local fref rc;
36
+ %local fref rc var;
37
37
  %let fref=%mf_getuniquefileref();
38
38
 
39
39
  %if %sysfunc(filename(fref,,filesrvc,folderPath="&path"))=0 %then %do;
40
40
  1
41
+ %let var=_FILESRVC_&fref._URI;
41
42
  %let rc=%sysfunc(filename(fref));
43
+ %symdel &var;
42
44
  %end;
43
45
  %else %do;
44
46
  0
@@ -177,6 +177,11 @@ run;
177
177
  ,mac=MV_CREATEFILE
178
178
  ,msg=%str(File &path/&name already exists and force=&force)
179
179
  )
180
+ %mp_abort(
181
+ iftrue=(&syscc ne 0),
182
+ mac=MV_CREATEFILE182
183
+ msg=syscc=&syscc after mfv_getpathuri
184
+ )
180
185
 
181
186
  %if %mf_isblank(&fileuri)=0 and &force=YES %then %do;
182
187
  proc http method="DELETE" url="&base_uri&fileuri" &oauth_bearer;
@@ -246,8 +251,8 @@ data &outds;
246
251
  end;
247
252
  run;
248
253
 
249
- %put &sysmacroname: &name created at %mfv_getpathuri(&path/&name);%put;
250
- %put &base_uri/SASJobExecution?_file=&path/&name;%put;
254
+ %put &sysmacroname: %trim(&base_uri)%mfv_getpathuri(&path/&name);
255
+ %put /SASJobExecution?_file=&path/&name;%put;
251
256
 
252
257
  %if &mdebug=0 %then %do;
253
258
  /* clear refs */
@@ -114,6 +114,17 @@ options noquotelenmax;
114
114
  headers "Authorization"="Bearer &&&access_token_var";
115
115
  %end;
116
116
  run;
117
+ %if &SYS_PROCHTTP_STATUS_CODE=401 %then %do;
118
+ /* relates to: https://github.com/sasjs/core/issues/400 */
119
+ %put 401 thrown in &sysmacroname;
120
+ %put sleeping: %sysfunc(sleep(12,1)) secs - will try again;
121
+ proc http method='GET' out=&fname1 &oauth_bearer
122
+ url="&base_uri/folders/folders/@item?path=&newpath";
123
+ %if &grant_type=authorization_code %then %do;
124
+ headers "Authorization"="Bearer &&&access_token_var";
125
+ %end;
126
+ run;
127
+ %end;
117
128
  %local libref1;
118
129
  %let libref1=%mf_getuniquelibref();
119
130
  libname &libref1 JSON fileref=&fname1;
@@ -121,7 +132,7 @@ options noquotelenmax;
121
132
  iftrue=(
122
133
  &SYS_PROCHTTP_STATUS_CODE ne 200 and &SYS_PROCHTTP_STATUS_CODE ne 404
123
134
  )
124
- ,mac=&sysmacroname
135
+ ,mac=mv_createfolder124
125
136
  ,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
126
137
  )
127
138
  %if &mdebug=1 %then %do;
@@ -170,7 +181,7 @@ options noquotelenmax;
170
181
  'Content-Type'='application/vnd.sas.content.folder+json'
171
182
  'Accept'='application/vnd.sas.content.folder+json';
172
183
  run;
173
- %if &SYS_PROCHTTP_STATUS_CODE ne 200 %then %do;
184
+ %if &SYS_PROCHTTP_STATUS_CODE ne 201 %then %do;
174
185
  %put &=SYS_PROCHTTP_STATUS_CODE &=SYS_PROCHTTP_STATUS_PHRASE;
175
186
  %end;
176
187
  %mp_abort(iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 201)