@sasjs/core 7.1.2 → 7.1.4

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/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![npm package](https://img.shields.io/npm/v/@sasjs/core.svg)](http://npmjs.org/package/@sasjs/core)
4
4
  [![Github Workflow](https://github.com/sasjs/core/actions/workflows/main.yml/badge.svg)](https://github.com/sasjs/core/blob/main/.github/workflows/main.yml)
5
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sasjs/core/badge)](https://scorecard.dev/viewer/?uri=github.com/sasjs/core)
5
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/sasjs/core/blob/main/LICENSE)
6
7
  [![npms.io](https://img.shields.io/npms-io/final-score/@sasjs/core)](https://npms.io/search?q=%40sasjs%2Fcore)
7
8
  ![npm](https://img.shields.io/npm/dt/@sasjs/core)
@@ -132,9 +133,9 @@ filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
132
133
 
133
134
  ## Agent Skills
134
135
 
135
- This repo ships with agent skills (in `.agents/skills`) to help coding assistants write idiomatic SAS and follow the @sasjs/core standards. The canonical versions live in the [sasjs/skills](https://github.com/sasjs/skills) repo and cover SAS language, @sasjs/core, @sasjs/adapter, @sasjs/cli, the SASjs framework, and @sasjs/server.
136
+ Agent skills help coding assistants write idiomatic SAS and follow the @sasjs/core standards. They live in the [sasjs/skills](https://github.com/sasjs/skills) repo, which covers SAS language, @sasjs/core, @sasjs/adapter, @sasjs/cli, the SASjs framework, and @sasjs/server - they are not vendored here, so what your assistant reads is the current version rather than a copy of it.
136
137
 
137
- To install or update them in your own project, run:
138
+ Install or update them in your own project with:
138
139
 
139
140
  ```bash
140
141
  npx skills add sasjs/skills
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  "devDependencies": {
44
44
  "@nogoo9/gitleaks": "8.30.1-post.2"
45
45
  },
46
- "version": "7.1.2"
46
+ "version": "7.1.4"
47
47
  }
@@ -72,6 +72,11 @@
72
72
  engine. Example values:
73
73
  @li WEBOUT_JSON
74
74
  @li WEBOUT_TXT
75
+ A job whose webout is a binary file registers it under its own name -
76
+ `_webout.pdf`, `_webout.xlsx` and so on - and a dotted key cannot be
77
+ requested through this parameter. When the requested member is absent the
78
+ macro falls back to the first `_WEBOUT*` member of the results that holds a
79
+ files uri, so a binary webout is returned without the caller naming it.
75
80
 
76
81
  @param [out] outref= (0) The output fileref to which to write the results
77
82
  @param [out] outlib= (0) The output library to which to assign the results
@@ -99,12 +104,10 @@
99
104
  ,outref=0
100
105
  ,outlib=0
101
106
  );
102
- %local dbg;
103
107
  %if &mdebug=1 %then %do;
104
108
  %put &sysmacroname entry vars:;
105
109
  %put _local_;
106
110
  %end;
107
- %else %let dbg=*;
108
111
 
109
112
  %local oauth_bearer;
110
113
  %if &grant_type=detect %then %do;
@@ -180,15 +183,49 @@ run;
180
183
  %end;
181
184
 
182
185
  /* extract results link */
183
- %local lib1 resuri;
186
+ %local lib1 resuri resname resfall want;
187
+ %let resfall=0;
188
+ %let want=%upcase(_&result);
184
189
  %let lib1=%mf_getuniquelibref();
185
190
  libname &lib1 JSON fileref=&fname1;
191
+ /* The member is located by name rather than referenced by name: a results
192
+ * table with no such column cannot be addressed in a data step at all. A
193
+ * binary webout registers itself as _webout.pdf / .xlsx / .zip, which
194
+ * result= cannot express, so when the requested member is missing the first
195
+ * _WEBOUT* column holding a files uri is taken instead - a job that
196
+ * registered more than one binary member cannot steer this, so only one
197
+ * binary member per job is supported. */
186
198
  data _null_;
187
199
  set &lib1..results;
188
- call symputx('resuri',_&result,'l');
189
- &dbg putlog "&sysmacroname results: " (_all_)(=);
200
+ array _chars{*} _character_;
201
+ length _name $32 _val $512;
202
+ do _i=1 to dim(_chars);
203
+ _name=vname(_chars{_i});
204
+ if upcase(_name)=symget('want') then do;
205
+ _val=_chars{_i};
206
+ leave;
207
+ end;
208
+ end;
209
+ if _val eq '' then do _i=1 to dim(_chars);
210
+ _name=vname(_chars{_i});
211
+ if _chars{_i}=:'/files/' and upcase(_name)=:'_WEBOUT' then do;
212
+ _val=_chars{_i};
213
+ call symputx('resfall',1,'l');
214
+ leave;
215
+ end;
216
+ end;
217
+ if _val ne '' then do;
218
+ call symputx('resuri',_val,'l');
219
+ call symputx('resname',_name,'l');
220
+ end;
221
+ %if &mdebug=1 %then %do;
222
+ putlog "&sysmacroname results: " (_all_)(=);
223
+ %end;
190
224
  run;
191
- %if "&resuri"="." %then %do;
225
+ %if &mdebug=1 and &resfall=1 %then %do;
226
+ %put &sysmacroname: _&result was not registered, using &resname;
227
+ %end;
228
+ %if "%superq(resuri)" eq "" or "%superq(resuri)" eq "." %then %do;
192
229
  /* The requested result was not registered - typical for a canceled
193
230
  * job whose session ended before the result file was created (eg a
194
231
  * job aborted by design, or a job that failed on session creation).
@@ -218,10 +255,6 @@ run;
218
255
  %end;
219
256
  %return;
220
257
  %end;
221
- %mp_abort(iftrue=("&resuri"=".")
222
- ,mac=&sysmacroname
223
- ,msg=%str(Variable _&result did not exist in the response json)
224
- )
225
258
 
226
259
  /* extract results */
227
260
  %local fname2;