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 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
@@ -330,7 +330,7 @@ Builds brought to you courtesy of GitHub actions.
330
330
 
331
331
  # Copyright
332
332
 
333
- Copyright 2013-2019 Medic Mobile, Inc. <hello@medicmobile.org>
333
+ Copyright 2013-2022 Medic Mobile, Inc. <hello@medic.org>
334
334
 
335
335
  # License
336
336
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cht-conf",
3
- "version": "3.15.0",
3
+ "version": "3.15.2",
4
4
  "description": "Configure CHT deployments",
5
5
  "main": "./src/lib/main.js",
6
6
  "engines": {
@@ -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
- await xls2xform(sourcePath, targetPath);
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);
@@ -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 whitelist of allowed parents for each contact type
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