@sasjs/core 4.64.0 → 4.65.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/package.json
CHANGED
package/viya/mv_createfile.sas
CHANGED
|
@@ -204,9 +204,10 @@ run;
|
|
|
204
204
|
|
|
205
205
|
/* Get Viya file-extension details into some macro variables */
|
|
206
206
|
%mv_getViyaFileExtParms(&ext
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
,propertiesVar=viyaProperties
|
|
208
|
+
,typeDefNameVar=viyaTypeDefName
|
|
209
|
+
,mdebug=&mdebug
|
|
210
|
+
)
|
|
210
211
|
|
|
211
212
|
/* fetch job info */
|
|
212
213
|
%local fname1;
|
|
@@ -274,9 +275,9 @@ run;
|
|
|
274
275
|
|
|
275
276
|
/* If properties were found then patch the file to include them */
|
|
276
277
|
%if not %mf_isBlank(%superq(viyaProperties)) %then %do;
|
|
277
|
-
/* Wrap the properties object in a root object also containing the
|
|
278
|
+
/* Wrap the properties object in a root object also containing the filename */
|
|
278
279
|
%local viyapatch;
|
|
279
|
-
%let viyapatch
|
|
280
|
+
%let viyapatch=%sysfunc(pathname(work))/%mf_getuniquename(prefix=patch_json_);
|
|
280
281
|
data _null_;
|
|
281
282
|
length line $32767;
|
|
282
283
|
file "&viyapatch" lrecl=32767;
|
|
@@ -296,7 +297,7 @@ run;
|
|
|
296
297
|
run;
|
|
297
298
|
%end;
|
|
298
299
|
|
|
299
|
-
/*
|
|
300
|
+
/* Apply the properties to the newly created file, using the PATCH method */
|
|
300
301
|
%let fref=%mf_getuniquefileref();
|
|
301
302
|
filename &fref "&viyapatch";
|
|
302
303
|
%let url=&base_uri&fileuri;
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
@li mf_existds.sas
|
|
24
24
|
@li mf_getplatform.sas
|
|
25
25
|
@li mf_getuniquefileref.sas
|
|
26
|
+
@li mf_getuniquelibref.sas
|
|
26
27
|
@li mf_getuniquename.sas
|
|
27
28
|
@li mf_getvalue.sas
|
|
28
29
|
@li mf_getvarlist.sas
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
iftrue=(%mf_isBlank(&ext))
|
|
49
50
|
,msg=%str(No file extension provided.)
|
|
50
51
|
,mac=MV_GETVIYAFILEEXTPARMS
|
|
51
|
-
)
|
|
52
|
+
)
|
|
52
53
|
|
|
53
54
|
%mp_abort(
|
|
54
55
|
iftrue=(%mf_isBlank(&typeDefNameVar) and
|
|
@@ -56,13 +57,13 @@
|
|
|
56
57
|
%mf_isBlank(&mediaTypeVar))
|
|
57
58
|
,msg=%str(MV_GETVIYAFILEEXTPARMS - No parameter was requested.)
|
|
58
59
|
,mac=MV_GETVIYAFILEEXTPARMS
|
|
59
|
-
)
|
|
60
|
+
)
|
|
60
61
|
|
|
61
62
|
%mp_abort(
|
|
62
63
|
iftrue=(%mf_isBlank(&viyaFileExtRespLibDs))
|
|
63
64
|
,msg=%str(No <libname.>dataset name provided to cache inital response.)
|
|
64
65
|
,mac=MV_GETVIYAFILEEXTPARMS
|
|
65
|
-
)
|
|
66
|
+
)
|
|
66
67
|
|
|
67
68
|
/* Declare requested parameters as global macro vars and initialize blank */
|
|
68
69
|
%if not %mf_isBlank(&typeDefNameVar) %then %do;
|
|
@@ -79,9 +80,7 @@
|
|
|
79
80
|
%end;
|
|
80
81
|
|
|
81
82
|
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
|
82
|
-
%if &mdebug=1 %then %
|
|
83
|
-
%put DEBUG: &=base_uri;
|
|
84
|
-
%end;
|
|
83
|
+
%if &mdebug=1 %then %put DEBUG: &=base_uri;
|
|
85
84
|
|
|
86
85
|
%let ext=%lowcase(&ext);
|
|
87
86
|
|
|
@@ -105,7 +104,7 @@
|
|
|
105
104
|
|
|
106
105
|
%if (&SYS_PROCHTTP_STATUS_CODE ne 200) %then %do;
|
|
107
106
|
/* To avoid a breaking change, exit early if the request failed.
|
|
108
|
-
|
|
107
|
+
The calling process will proceed with empty macro variables. */
|
|
109
108
|
%put INFO: &sysmacroname File extension details were not retrieved.;
|
|
110
109
|
filename &viyatypedefs clear;
|
|
111
110
|
%return;
|
|
@@ -126,11 +125,12 @@
|
|
|
126
125
|
/* Convert the content of that JSON into SAS datasets */
|
|
127
126
|
/* First prepare a new WORK-based folder to receive the datasets */
|
|
128
127
|
%local jsonworkfolder jsonlib opt_dlcreatedir;
|
|
129
|
-
%let jsonworkfolder=%sysfunc(pathname(work))/%mf_getuniquename(prefix=
|
|
128
|
+
%let jsonworkfolder=%sysfunc(pathname(work))/%mf_getuniquename(prefix=jsn_);
|
|
130
129
|
%let jsonlib=%mf_getuniquelibref(prefix=json);
|
|
131
|
-
|
|
130
|
+
/* And point a libname at it */
|
|
132
131
|
%let opt_dlcreatedir = %sysfunc(getoption(dlcreatedir));
|
|
133
|
-
options dlcreatedir; libname &jsonlib "&jsonworkfolder";
|
|
132
|
+
options dlcreatedir; libname &jsonlib "&jsonworkfolder";
|
|
133
|
+
options &opt_dlcreatedir;
|
|
134
134
|
|
|
135
135
|
/* Read the json output once and copy datasets to its work folder */
|
|
136
136
|
%local libref1;
|
|
@@ -159,20 +159,22 @@
|
|
|
159
159
|
|
|
160
160
|
%end; /* If initial filetype query response didn't exist */
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
%if &mdebug %then %put DEBUG: Find the row-group for extension &ext;
|
|
163
163
|
%local itemRowGroup;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
);
|
|
164
|
+
data _null_;
|
|
165
|
+
set &viyaFileExtRespLibDs;
|
|
166
|
+
where p1='items' and p2='extensions' and value="&ext";
|
|
167
|
+
call symputx('itemRowGroup',_viyaItemIdx,'l');
|
|
168
|
+
%if &mdebug %then %do;
|
|
169
|
+
putlog (_all_)(=);
|
|
170
|
+
%end;
|
|
171
|
+
run;
|
|
170
172
|
|
|
171
173
|
%if &mdebug %then %put DEBUG: &=itemRowGroup;
|
|
172
174
|
|
|
173
175
|
%if %mf_isBlank(&itemRowGroup) %then %do;
|
|
174
176
|
/* extension was not found */
|
|
175
|
-
%if
|
|
177
|
+
%if &mdebug %then %put DEBUG: No type details found for extension "&ext";
|
|
176
178
|
%return;
|
|
177
179
|
%end;
|
|
178
180
|
|
|
@@ -186,14 +188,17 @@
|
|
|
186
188
|
|
|
187
189
|
/* Populate typeDefName, if requested */
|
|
188
190
|
%if (not %mf_isBlank(&typeDefNameVar)) %then %do;
|
|
189
|
-
%let &typeDefNameVar = %mf_getvalue(
|
|
190
|
-
|
|
191
|
+
%let &typeDefNameVar = %mf_getvalue(
|
|
192
|
+
&dsItems,value,filter=%quote(p1="items" and p2="name"));
|
|
193
|
+
%if &mdebug %then
|
|
194
|
+
%put DEBUG: &=typeDefNameVar &typeDefNameVar=&&&typeDefNameVar;
|
|
191
195
|
%end;
|
|
192
196
|
|
|
193
197
|
/* Populate mediaType, if requested */
|
|
194
198
|
%if (not %mf_isBlank(&mediaTypeVar)) %then %do;
|
|
195
|
-
%let &mediaTypeVar = %mf_getvalue(
|
|
196
|
-
|
|
199
|
+
%let &mediaTypeVar = %mf_getvalue(
|
|
200
|
+
&dsItems,value,filter=%quote(p1="items" and p2="mediaType"));
|
|
201
|
+
%if &mdebug %then %put DEBUG: &=mediaTypeVar &mediaTypeVar=&&&mediaTypeVar;
|
|
197
202
|
%end;
|
|
198
203
|
|
|
199
204
|
/* Populate properties macro variable, if requested */
|
|
@@ -210,7 +215,8 @@
|
|
|
210
215
|
/* Check for 1+ properties */
|
|
211
216
|
%if ( %mf_nobs(&dsProperties) = 0 ) %then %do;
|
|
212
217
|
%let &propertiesVar = %str();
|
|
213
|
-
%if &mdebug
|
|
218
|
+
%if &mdebug %then %put DEBUG: &SYSMACRONAME - No Viya properties %trim(
|
|
219
|
+
)found for file suffix %str(%')&ext%str(%');
|
|
214
220
|
%end;
|
|
215
221
|
%else %do;
|
|
216
222
|
/* Properties potentially span multiple rows in the input table */
|
|
@@ -240,7 +246,8 @@
|
|
|
240
246
|
end;
|
|
241
247
|
run;
|
|
242
248
|
|
|
243
|
-
%if &mdebug
|
|
249
|
+
%if &mdebug %then
|
|
250
|
+
%put DEBUG: &=propertiesVar &propertiesVar=&&&propertiesVar;
|
|
244
251
|
%end;
|
|
245
252
|
|
|
246
253
|
%end;
|