@sasjs/core 4.4.1 → 4.4.2

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.
@@ -15,7 +15,10 @@
15
15
  @param [in] contenttype= (TEXTS) Either TEXT, ZIP, CSV, EXCEL
16
16
  @param [in] inloc= /path/to/file.ext to be sent
17
17
  @param [in] inref= fileref of file to be sent (if provided, overrides `inloc`)
18
+ @param [in] iftrue= (1=1) Provide a condition under which to execute.
18
19
  @param [out] outname= the name of the file, as downloaded by the browser
20
+ @param [out] outref= (_webout) The destination where the file should be
21
+ streamed.
19
22
 
20
23
  <h4> SAS Macros </h4>
21
24
  @li mf_getplatform.sas
@@ -29,13 +32,17 @@
29
32
  contenttype=TEXT
30
33
  ,inloc=
31
34
  ,inref=0
35
+ ,iftrue=%str(1=1)
32
36
  ,outname=
37
+ ,outref=_webout
33
38
  )/*/STORE SOURCE*/;
34
39
 
40
+ %if not(%eval(%unquote(&iftrue))) %then %return;
41
+
35
42
  %let contentype=%upcase(&contenttype);
43
+ %let outref=%upcase(&outref);
36
44
  %local platform; %let platform=%mf_getplatform();
37
45
 
38
-
39
46
  /**
40
47
  * check engine type to avoid the below err message:
41
48
  * > Function is only valid for filerefs using the CACHE access method.
@@ -43,7 +50,7 @@
43
50
  %local streamweb;
44
51
  %let streamweb=0;
45
52
  data _null_;
46
- set sashelp.vextfl(where=(upcase(fileref)="_WEBOUT"));
53
+ set sashelp.vextfl(where=(upcase(fileref)="&outref"));
47
54
  if xengine='STREAM' then call symputx('streamweb',1,'l');
48
55
  run;
49
56
 
@@ -55,7 +62,7 @@ run;
55
62
  run;
56
63
  %end;
57
64
  %else %if &platform=SASVIYA %then %do;
58
- filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.txt'
65
+ filename &outref filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.txt'
59
66
  contenttype='application/csv'
60
67
  contentdisp="attachment; filename=&outname";
61
68
  %end;
@@ -69,14 +76,14 @@ run;
69
76
  run;
70
77
  %end;
71
78
  %else %if &platform=SASVIYA %then %do;
72
- filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.xls'
79
+ filename &outref filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.xls'
73
80
  contenttype='application/vnd.ms-excel'
74
81
  contentdisp="attachment; filename=&outname";
75
82
  %end;
76
83
  %end;
77
84
  %else %if &contentype=HTML %then %do;
78
85
  %if &platform=SASVIYA %then %do;
79
- filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name="_webout.json"
86
+ filename &outref filesrvc parenturi="&SYS_JES_JOB_URI" name="_webout.json"
80
87
  contenttype="text/html";
81
88
  %end;
82
89
  %end;
@@ -88,15 +95,11 @@ run;
88
95
  run;
89
96
  %end;
90
97
  %else %if &platform=SASVIYA %then %do;
91
- filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.txt'
98
+ filename &outref filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.txt'
92
99
  contenttype='application/text'
93
100
  contentdisp="attachment; filename=&outname";
94
101
  %end;
95
102
  %end;
96
- %else %do;
97
- %put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
98
- %return;
99
- %end;
100
103
  %else %if &contentype=WOFF or &contentype=WOFF2 or &contentype=TTF %then %do;
101
104
  %if &platform=SASMETA and &streamweb=1 %then %do;
102
105
  data _null_;
@@ -104,7 +107,7 @@ run;
104
107
  run;
105
108
  %end;
106
109
  %else %if &platform=SASVIYA %then %do;
107
- filename _webout filesrvc parenturi="&SYS_JES_JOB_URI"
110
+ filename &outref filesrvc parenturi="&SYS_JES_JOB_URI"
108
111
  contenttype="font/%lowcase(&contenttype)";
109
112
  %end;
110
113
  %end;
@@ -117,7 +120,7 @@ run;
117
120
  run;
118
121
  %end;
119
122
  %else %if &platform=SASVIYA %then %do;
120
- filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.xls'
123
+ filename &outref filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.xls'
121
124
  contenttype=
122
125
  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
123
126
  contentdisp="attachment; filename=&outname";
@@ -131,17 +134,21 @@ run;
131
134
  run;
132
135
  %end;
133
136
  %else %if &platform=SASVIYA %then %do;
134
- filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.zip'
137
+ filename &outref filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.zip'
135
138
  contenttype='application/zip'
136
139
  contentdisp="attachment; filename=&outname";
137
140
  %end;
138
141
  %end;
142
+ %else %do;
143
+ %put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
144
+ %return;
145
+ %end;
139
146
 
140
147
  %if &inref ne 0 %then %do;
141
- %mp_binarycopy(inref=&inref,outref=_webout)
148
+ %mp_binarycopy(inref=&inref,outref=&outref)
142
149
  %end;
143
150
  %else %do;
144
- %mp_binarycopy(inloc="&inloc",outref=_webout)
151
+ %mp_binarycopy(inloc="&inloc",outref=&outref)
145
152
  %end;
146
153
 
147
154
  %mend mp_streamfile;
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@sasjs/cli": "3.6.0"
37
37
  },
38
- "version": "4.4.1"
38
+ "version": "4.4.2"
39
39
  }