@sap/hdi-deploy
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -0,1 +1,12 @@ | ||
## 4.2.0 | ||
Features: | ||
- allow wildcard paths in the undeploy.json file to enable the undeployment of a set of files without having to specify every single file | ||
- added, modified, deleted and "treated as modified" files are logged during deployment | ||
- use @sap/hdi@4.1.0 | ||
- use @sap/hana-client@2.9.28 | ||
- Node 16.x support | ||
Removed: | ||
- Node 8.x and 10.x support | ||
## 4.1.0 | ||
@@ -2,0 +13,0 @@ Features: |
@@ -6,2 +6,8 @@ 'use strict'; | ||
/** | ||
* Translates given key/option by replacing all the underscores '_' with dash '-' | ||
* | ||
* @param {string} key | ||
* @returns {any} Replaced key | ||
*/ | ||
function translateKey (key) { | ||
@@ -8,0 +14,0 @@ return key.replace(/_/g, '-'); |
@@ -7,2 +7,3 @@ 'use strict'; | ||
const { SchemaPrivilege } = require('@sap/hdi'); | ||
const PathFilter = require('./filters/PathFilter'); | ||
@@ -43,8 +44,11 @@ /** | ||
const filename = options.undeployFilename; | ||
let filter = []; | ||
const contentPathsFilter = new PathFilter(); | ||
let paths = []; | ||
let filteredUndeployfiles = []; | ||
if (fs.existsSync(filename)) { | ||
logger.log('Undeploy allowlist file "undeploy.json" found; deleted files will be filtered by the allowlist'); | ||
try { | ||
filter = fs.readJSONFile(filename); | ||
paths = fs.readJSONFile(filename); | ||
} catch (e) { | ||
@@ -55,6 +59,12 @@ logger.error(`Could not read the "undeploy.json": ${e.message ? e.message : e}`); | ||
} | ||
paths.forEach((path) => { | ||
if (path.indexOf('*')!==-1) { | ||
contentPathsFilter.addPath(path); | ||
} else if (undeployFiles.indexOf(path)!==-1) { | ||
filteredUndeployfiles.push(path); | ||
} | ||
}); | ||
filteredUndeployfiles = filteredUndeployfiles.concat(contentPathsFilter.filter_by_regex(undeployFiles)); | ||
return [...new Set(filteredUndeployfiles)]; | ||
return undeployFiles.filter(function (file) { | ||
return filter.indexOf(file) !== -1; | ||
}); | ||
} else { | ||
@@ -78,2 +88,19 @@ logger.log('Undeploy allowlist file "undeploy.json" not found; an empty allowlist is used and no files will be scheduled for undeploy'); | ||
let undeployFiles; | ||
const addedFiles = []; | ||
const modifiedFiles = []; | ||
let unmodifiedFiles; | ||
deployFiles = result.filter(function (item) { | ||
if (item.status === 'A' && !options.excludeFilter.matchesPath(item.path)) { | ||
addedFiles.push(item.path); | ||
return true; | ||
} else if (item.status === 'M' && !options.excludeFilter.matchesPath(item.path)) { | ||
modifiedFiles.push(item.path); | ||
return true; | ||
} | ||
}).map(function (item) { | ||
return item.path; | ||
}); | ||
if (options.treatUnmodifiedAsModified) { | ||
@@ -85,11 +112,7 @@ // schedule all locally collected files for deploy; this maps to Added, Modified, or Unmodified | ||
.filter((item) => !options.excludeFilter.matchesPath(item)); | ||
} else { | ||
// schedule the Added or Modified files for deploy | ||
deployFiles = result.filter(function (item) { | ||
return item.status === 'A' || item.status === 'M'; | ||
}) | ||
.map(function (item) { | ||
return item.path; | ||
}) | ||
.filter((item) => !options.excludeFilter.matchesPath(item)); | ||
unmodifiedFiles = deployFiles.filter(function (item) { | ||
return (modifiedFiles.indexOf(item) === -1) && (addedFiles.indexOf(item) === -1); | ||
}); | ||
} | ||
@@ -105,10 +128,14 @@ undeployFiles = result.filter(function (item) { | ||
logger.trace('status result:', result); | ||
logger.trace('deploy files:', deployFiles); | ||
logger.trace('undeploy files:', undeployFiles); | ||
logger.log('added files:', addedFiles); | ||
logger.log('modified files:', modifiedFiles); | ||
if (options.treatUnmodifiedAsModified) { | ||
logger.log('treated as modified files:', unmodifiedFiles); | ||
} | ||
// filter the undeploy set based on the undeploy.json file | ||
if (undeployFiles.length && !options.autoUndeploy) { | ||
undeployFiles = filterUndeploy(undeployFiles, options); | ||
logger.trace('filtered undeploy files:', undeployFiles); | ||
} | ||
logger.log('deleted files:', undeployFiles); | ||
@@ -215,2 +242,2 @@ // filter the undeploy set by the include-filter,EW because deleted files are not considered during the file walk | ||
module.exports = {prepareMake, getDefaultPermissionSet}; | ||
module.exports = {prepareMake, getDefaultPermissionSet}; |
@@ -26,3 +26,8 @@ /** | ||
// check that 'grantor' and 'schema' properties don't exist simultaneously | ||
/** | ||
* checks whether the field is either database or schema or remote | ||
* | ||
* @param {any} field refers to key | ||
* @returns {boolean} | ||
*/ | ||
function checkProperties (target) { | ||
@@ -29,0 +34,0 @@ if ('grantor' in target && ('schema' in target || 'schema.configure' in target || '*.configure' in target)) { |
{ | ||
"name": "@sap/hdi-deploy", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"lockfileVersion": 1, | ||
@@ -8,3 +8,3 @@ "requires": true, | ||
"@sap/hana-client": { | ||
"version": "2.8.20", | ||
"version": "2.9.28", | ||
"requires": { | ||
@@ -26,3 +26,3 @@ "debug": "3.1.0" | ||
"@sap/hdi": { | ||
"version": "4.0.2", | ||
"version": "4.1.0", | ||
"requires": { | ||
@@ -85,3 +85,3 @@ "async": "3.1.0" | ||
"uglify-js": { | ||
"version": "3.13.8", | ||
"version": "3.14.1", | ||
"optional": true | ||
@@ -88,0 +88,0 @@ }, |
{ | ||
"name": "@sap/hdi-deploy", | ||
"description": "HDI content deployment", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"license": "See LICENSE file", | ||
@@ -9,4 +9,4 @@ "repository": {}, | ||
"dependencies": { | ||
"@sap/hdi": "4.0.2", | ||
"@sap/hana-client": "2.8.20", | ||
"@sap/hdi": "4.1.0", | ||
"@sap/hana-client": "2.9.28", | ||
"@sap/xsenv": "3.1.0", | ||
@@ -18,3 +18,3 @@ "async": "3.1.0", | ||
"engines": { | ||
"node": "^8.0.0 || ^10.0.0 || ^12.0.0 || ^14.0.0" | ||
"node": ">=12 <=16" | ||
}, | ||
@@ -21,0 +21,0 @@ "files": [ |
@@ -104,3 +104,3 @@ @sap/hdi-deploy | ||
"dependencies": { | ||
"@sap/hdi-deploy": "4.1.0" | ||
"@sap/hdi-deploy": "4.2.0" | ||
}, | ||
@@ -349,3 +349,3 @@ "scripts": { | ||
In order to undeploy deleted files, an application needs to include an undeploy allowlist via an `undeploy.json` file in the root directory of the `db` module (right beside the `src/` and `cfg/` folders). The undeploy allowlist `undeploy.json` file is a JSON document with a top-level array of file names: | ||
In order to undeploy deleted files, an application needs to include an undeploy allowlist via an `undeploy.json` file in the root directory of the `db` module (right beside the `src/` and `cfg/` folders). The undeploy allowlist `undeploy.json` file is a JSON document with a top-level array of file names. Both "real" paths and path patterns are supported. | ||
@@ -356,3 +356,5 @@ `undeploy.json`: | ||
"src/Table.hdbcds", | ||
"src/Procedure.hdbprocedure" | ||
"src/Procedure.hdbprocedure", | ||
"src/*.hdbtable", | ||
"**/*.hdbtable" | ||
] | ||
@@ -543,3 +545,3 @@ | ||
"dependencies": { | ||
"@sap/hdi-deploy": "4.1.0", | ||
"@sap/hdi-deploy": "4.2.0", | ||
"module1": "1.3.1", | ||
@@ -1071,3 +1073,3 @@ "module2": "1.7.0" | ||
"name": "@sap/hdi-deploy", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"features": { | ||
@@ -1074,0 +1076,0 @@ "info": 2, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
468594
9860
1146
+ Added@sap/hana-client@2.9.28(transitive)
+ Added@sap/hdi@4.1.0(transitive)
- Removed@sap/hana-client@2.8.20(transitive)
- Removed@sap/hdi@4.0.2(transitive)
Updated@sap/hana-client@2.9.28
Updated@sap/hdi@4.1.0