diff --git a/lib/Adaptor.js b/lib/Adaptor.js index bc34297..55e5c02 100644 --- a/lib/Adaptor.js +++ b/lib/Adaptor.js @@ -182,6 +182,7 @@ function submitXls(formData, params) { username, password } = state.configuration; + const json = (0, _languageCommon.expandReferences)(formData)(state); const { case_type, search_field, @@ -191,7 +192,7 @@ function submitXls(formData, params) { const workbook = _xlsx.default.utils.book_new(); - const worksheet = _xlsx.default.utils.json_to_sheet(formData); + const worksheet = _xlsx.default.utils.json_to_sheet(json); const ws_name = 'SheetJS'; @@ -325,4 +326,4 @@ function fetchReportData(reportId, params, postUrl) { }); } }); -} +} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index 0bf5a6d..d9114c5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -14,4 +14,4 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } var _default = Adaptor; -exports.default = _default; +exports.default = _default; \ No newline at end of file diff --git a/package.json b/package.json index 9726272..e7b33ec 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,12 @@ }, "main": "lib/index.js", "scripts": { - "build": "make", + "ast": "simple-ast --adaptor ./src/Adaptor.js --output ast.json", + "build": "node_modules/.bin/babel src -d lib && npm run ast", + "postversion": "git push && git push --tags", "test": "mocha --require @babel/register", "test:watch": "mocha -w --require @babel/register", - "prepack": "npx @openfn/simple-ast --adaptor ./lib/Adaptor.js --output ast.json" + "version": "npm run build && git add -A lib ast.json" }, "author": "Open Function Group", "license": "LGPLv3", @@ -21,7 +23,7 @@ "ast.json" ], "dependencies": { - "@openfn/language-common": "1.4.1", + "@openfn/language-common": "1.4.2", "form-data": "^4.0.0", "js2xmlparser": "^1.0.0", "JSONPath": "^0.10.0", diff --git a/src/Adaptor.js b/src/Adaptor.js index 73d842a..d09460c 100644 --- a/src/Adaptor.js +++ b/src/Adaptor.js @@ -89,6 +89,8 @@ export function submitXls(formData, params) { username, password, } = state.configuration; + + const json = expandReferences(formData)(state); const { case_type, search_field, create_new_cases } = params; const url = (hostUrl || 'https://www.commcarehq.org').concat( @@ -98,7 +100,7 @@ export function submitXls(formData, params) { ); const workbook = xlsx.utils.book_new(); - const worksheet = xlsx.utils.json_to_sheet(formData); + const worksheet = xlsx.utils.json_to_sheet(json); const ws_name = 'SheetJS'; xlsx.utils.book_append_sheet(workbook, worksheet, ws_name);