cht-conf 3.15.0 → 3.15.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.
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/lib/convert-forms.js +3 -2
- package/src/lib/forms-utils.js +8 -0
- package/src/lib/lineage-constraints.js +1 -1
- package/src/nools/target-emitter.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.15.2](https://github.com/medic/cht-conf/compare/v3.15.1...v3.15.2) (2022-12-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **#504:** escape whitespaces in path when converting forms ([#523](https://github.com/medic/cht-conf/issues/523)) ([90859ba](https://github.com/medic/cht-conf/commit/90859ba85a2bd4136b051749d826865fa6a76e0a)), closes [#504](https://github.com/medic/cht-conf/issues/504) [#504](https://github.com/medic/cht-conf/issues/504)
|
|
7
|
+
|
|
8
|
+
## [3.15.1](https://github.com/medic/cht-conf/compare/v3.15.0...v3.15.1) (2022-12-06)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **#123:** Target date default to Now ([#516](https://github.com/medic/cht-conf/issues/516)) ([312219e](https://github.com/medic/cht-conf/commit/312219e8f7d55340513cf0b2be9bdf276762a23a)), closes [#123](https://github.com/medic/cht-conf/issues/123)
|
|
14
|
+
|
|
1
15
|
# [3.15.0](https://github.com/medic/cht-conf/compare/v3.14.0...v3.15.0) (2022-08-19)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
package/package.json
CHANGED
package/src/lib/convert-forms.js
CHANGED
|
@@ -3,7 +3,7 @@ const { execSync } = require('child_process');
|
|
|
3
3
|
const argsFormFilter = require('./args-form-filter');
|
|
4
4
|
const exec = require('./exec-promise');
|
|
5
5
|
const fs = require('./sync-fs');
|
|
6
|
-
const { getFormDir } = require('./forms-utils');
|
|
6
|
+
const { getFormDir, escapeWhitespacesInPath } = require('./forms-utils');
|
|
7
7
|
const { info, trace, warn } = require('./log');
|
|
8
8
|
|
|
9
9
|
const XLS2XFORM = 'xls2xform-medic';
|
|
@@ -56,7 +56,8 @@ const execute = async (projectDir, subDirectory, options) => {
|
|
|
56
56
|
const targetPath = `${fs.withoutExtension(originalSourcePath)}.xml`;
|
|
57
57
|
|
|
58
58
|
info('Converting form', originalSourcePath, '…');
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
await xls2xform(escapeWhitespacesInPath(sourcePath), escapeWhitespacesInPath(targetPath));
|
|
60
61
|
const hiddenFields = await getHiddenFields(`${fs.withoutExtension(originalSourcePath)}.properties.json`);
|
|
61
62
|
await fixXml(targetPath, hiddenFields, options.transformer, options.enketo);
|
|
62
63
|
trace('Converted form', originalSourcePath);
|
package/src/lib/forms-utils.js
CHANGED
|
@@ -95,4 +95,12 @@ module.exports = {
|
|
|
95
95
|
xml.match(/<model>[^]*<\/model>/)[0]
|
|
96
96
|
.match(/<instance>[^]*<\/instance>/)[0]
|
|
97
97
|
.match(/id="([^"]*)"/)[1],
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Escape whitespaces in a path.
|
|
101
|
+
* @param {string} path the path string
|
|
102
|
+
* @returns {string}
|
|
103
|
+
*/
|
|
104
|
+
escapeWhitespacesInPath: path => path.replace(/(\s+)/g, '\\$1'),
|
|
105
|
+
|
|
98
106
|
};
|
|
@@ -38,7 +38,7 @@ const lineageConstraints = async (repository, parentDoc) => {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
/*
|
|
41
|
-
Enforce the
|
|
41
|
+
Enforce the list of allowed parents for each contact type
|
|
42
42
|
Ensure we are not creating a circular hierarchy
|
|
43
43
|
*/
|
|
44
44
|
const getHierarchyViolations = (mapTypeToAllowedParents, contactDoc, parentDoc) => {
|
|
@@ -23,10 +23,10 @@ function targetEmitter(targets, c, Utils, Target, emit) {
|
|
|
23
23
|
|
|
24
24
|
function determineDate(targetConfig, Utils, c, r) {
|
|
25
25
|
if (typeof targetConfig.date === 'function') {
|
|
26
|
-
return targetConfig.date(c, r);
|
|
26
|
+
return targetConfig.date(c, r) || Utils.now().getTime();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if (targetConfig.date === undefined || targetConfig.date === 'now') {
|
|
29
|
+
if (targetConfig.date === undefined || targetConfig.date === null || targetConfig.date === 'now') {
|
|
30
30
|
return Utils.now().getTime();
|
|
31
31
|
}
|
|
32
32
|
|