Compare commits

...

2 Commits

Author SHA1 Message Date
allan 80039f4876 fix: bumping cli and pinning versions in .npmrc
Build / Build-and-ng-test (pull_request) Successful in 3m51s
Build / Build-and-test-development (pull_request) Successful in 10m9s
Lighthouse Checks / lighthouse (24.5.0) (pull_request) Successful in 19m11s
2026-04-03 02:02:05 +01:00
allan 326c26fddf feat: export config service to allow dclib swapping. Closes #212 2026-04-03 02:01:44 +01:00
5 changed files with 60 additions and 21 deletions
+2
View File
@@ -1 +1,3 @@
legacy-peer-deps=true
ignore-scripts=true
save-exact=true
+2
View File
@@ -0,0 +1,2 @@
ignore-scripts=true
save-exact=true
+9 -9
View File
@@ -6,8 +6,8 @@
"": {
"name": "dc-sas",
"dependencies": {
"@sasjs/cli": "^4.15.0",
"@sasjs/core": "^4.62.0"
"@sasjs/cli": "4.15.2",
"@sasjs/core": "4.63.0"
}
},
"node_modules/@asamuzakjp/css-color": {
@@ -251,13 +251,13 @@
}
},
"node_modules/@sasjs/cli": {
"version": "4.15.0",
"resolved": "https://registry.npmjs.org/@sasjs/cli/-/cli-4.15.0.tgz",
"integrity": "sha512-lVKzm8+4b9VSqbchfLnzyNm53cKDZfqSM8KU7izD/JDBsuATSZtjLo61iNenZaPg9d3WXglb1jf2ASbVKbXxUQ==",
"version": "4.15.2",
"resolved": "https://registry.npmjs.org/@sasjs/cli/-/cli-4.15.2.tgz",
"integrity": "sha512-lY9H+HIquLAPXuhk6ov/xyBooERvefT6oiwNRaQ6DHMMFE4cgPvrUH5s3RRkLI2+lET0M0hPPbuaZ4w9yFIDuA==",
"license": "ISC",
"dependencies": {
"@sasjs/adapter": "4.16.3",
"@sasjs/core": "4.62.0",
"@sasjs/core": "4.63.0",
"@sasjs/lint": "2.4.3",
"@sasjs/utils": "3.5.6",
"adm-zip": "0.5.10",
@@ -317,9 +317,9 @@
}
},
"node_modules/@sasjs/core": {
"version": "4.62.0",
"resolved": "https://registry.npmjs.org/@sasjs/core/-/core-4.62.0.tgz",
"integrity": "sha512-xMWeZbxlvuCP0B9fnSTgSFbSiA0hiKDpTua8wb0ghMUOl+dnh/XF+BYgrHhWhPL9j0+k5d8mJejLmf/l/txpzg==",
"version": "4.63.0",
"resolved": "https://registry.npmjs.org/@sasjs/core/-/core-4.63.0.tgz",
"integrity": "sha512-NlIihA4BbP+mveAbb7A/hgnrZEpJKKIkq0v4SSDdYXg8YYdKAdyTK8K+6FNPwp+U6hixQCKVX8oCA1DIUppLqA==",
"license": "MIT"
},
"node_modules/@sasjs/lint": {
+2 -2
View File
@@ -28,7 +28,7 @@
},
"private": true,
"dependencies": {
"@sasjs/cli": "^4.15.0",
"@sasjs/core": "^4.62.0"
"@sasjs/cli": "4.15.2",
"@sasjs/core": "4.63.0"
}
}
+45 -10
View File
@@ -9,10 +9,12 @@
<h4> SAS Macros </h4>
@li mf_getuser.sas
@li mf_nobs.sas
@li mp_ds2cards.sas
@li mp_abort.sas
@li mp_binarycopy.sas
@li mp_ds2cards.sas
@li mp_ds2csv.sas
@li mp_streamfile.sas
@li mp_validatecol.sas
@author 4GL Apps Ltd
@copyright 4GL Apps Ltd. This code may only be used within Data Controller
@@ -21,23 +23,33 @@
**/
%global dclib islib newlib;
%mpeinit()
data _null_;
newlib=coalescec(symget('dclib'),"&mpelib");
%mp_validatecol(newlib,ISLIB,islib)
call symputx('islib',islib);
call symputx('newlib',upcase(newlib));
putlog (_all_)(=);
run;
%mp_abort(iftrue= (&islib ne 1)
,mac=&_program
,msg=%nrstr(&newlib is not a valid libref)
)
%let work=%sysfunc(pathname(work));
/* excel does not work in all envs */
%let mime=application/vnd.ms-excel;
%let dbms=EXCEL;
%let mime=application/csv;
%let dbms=CSV;
%let ext=csv;
%macro conditional_export(ds);
%if %mf_nobs(&ds)>0 %then %do;
PROC EXPORT DATA= &ds OUTFILE= "&work/&ds..&ext"
DBMS=&dbms REPLACE;
RUN;
ods package(ProdOutput) add file="&work/&ds..&ext" mimetype="&mime";
/* cannot use PROC EXPORT as we need to wrap all csv char values in quotes */
/* cannot use excel as it does not work consistently in all SAS envs */
%mp_ds2csv(&ds,outfile="&work/&newlib..&ds..csv",headerformat=NAME)
ods package(ProdOutput) add file="&work/&newlib..&ds..&ext" mimetype="&mime";
%end;
%mp_abort(iftrue= (&syscc ne 0)
,mac=&_program
@@ -52,6 +64,7 @@ data MPE_ALERTS;
set &mpelib..MPE_ALERTS;
where &dc_dttmtfmt. le tx_to;
drop tx_: ;
if alert_lib="&mpelib" then alert_lib="&newlib";
run;
%conditional_export(MPE_ALERTS)
@@ -61,6 +74,7 @@ data MPE_COLUMN_LEVEL_SECURITY;
where &dc_dttmtfmt. le tx_to;
where also CLS_LIBREF ne "&mpelib";
drop tx_: ;
CLS_LIBREF="&newlib";
run;
%conditional_export(MPE_COLUMN_LEVEL_SECURITY)
@@ -68,6 +82,7 @@ data MPE_CONFIG;
set &mpelib..MPE_CONFIG;
where &dc_dttmtfmt. le tx_to;
drop tx_: ;
if var_name='DC_MACROS' then var_value=tranwrd(var_value,"&mpelib","&newlib");
run;
%conditional_export(MPE_CONFIG)
@@ -93,6 +108,7 @@ data MPE_EXCEL_CONFIG;
set &mpelib..MPE_EXCEL_CONFIG;
where &dc_dttmtfmt. le tx_to;
drop tx_: ;
if xl_libref="&mpelib" then xl_libref="&newlib";
run;
%conditional_export(MPE_EXCEL_CONFIG)
@@ -107,6 +123,7 @@ data MPE_ROW_LEVEL_SECURITY;
set &mpelib..MPE_ROW_LEVEL_SECURITY;
where &dc_dttmtfmt. le tx_to;
drop tx_: ;
if rls_libref="&mpelib" then rls_libref="&newlib";
run;
%conditional_export(MPE_ROW_LEVEL_SECURITY)
@@ -115,6 +132,7 @@ data MPE_SECURITY;
set &mpelib..MPE_SECURITY;
where &dc_dttmtfmt. le TX_TO;
drop tx_: ;
if libref="&mpelib" then libref="&newlib";
run;
%conditional_export(MPE_SECURITY)
@@ -142,6 +160,23 @@ data MPE_VALIDATIONS;
run;
%conditional_export(MPE_VALIDATIONS)
data MPE_XLMAP_INFO;
set &mpelib..MPE_XLMAP_INFO;
where &dc_dttmtfmt. le TX_TO;
drop tx_: ;
if XLMAP_TARGETLIBDS=:"&mpelib.." then
XLMAP_TARGETLIBDS=tranwrd(XLMAP_TARGETLIBDS,"&mpelib..","&newlib..");
run;
%conditional_export(MPE_XLMAP_INFO)
data MPE_XLMAP_RULES;
set &mpelib..MPE_XLMAP_RULES;
where &dc_dttmtfmt. le TX_TO;
drop tx_: ;
run;
%conditional_export(MPE_XLMAP_RULES)
/* finish up zip file */
ods package(ProdOutput) publish archive properties
(archive_name="DCBACKUP.zip" archive_path="&work");