@openfn/language-magpi 1.2.4 → 1.2.5
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/dist/index.cjs +4 -2
- package/dist/index.js +5 -6
- package/package.json +4 -5
package/dist/index.cjs
CHANGED
|
@@ -62,6 +62,7 @@ __export(Adaptor_exports, {
|
|
|
62
62
|
submitRecord: () => submitRecord
|
|
63
63
|
});
|
|
64
64
|
var import_language_common = require("@openfn/language-common");
|
|
65
|
+
var import_util = require("@openfn/language-common/util");
|
|
65
66
|
var import_url = require("url");
|
|
66
67
|
var import_js2xmlparser = __toESM(require("js2xmlparser"), 1);
|
|
67
68
|
var import_request = __toESM(require("request"), 1);
|
|
@@ -86,7 +87,8 @@ function fetchSurveyData(params) {
|
|
|
86
87
|
return new Error(`Server responded with ${response.statusCode}`);
|
|
87
88
|
}
|
|
88
89
|
console.log(params.surveyId);
|
|
89
|
-
const
|
|
90
|
+
const [resolvedParams] = (0, import_util.expandReferences)(state, params);
|
|
91
|
+
const { surveyId, afterDate, beforeDate, postUrl } = resolvedParams;
|
|
90
92
|
console.log(surveyId);
|
|
91
93
|
const { accessToken, username } = state.configuration;
|
|
92
94
|
const enddate = beforeDate;
|
|
@@ -172,7 +174,7 @@ function fetchSurveyData(params) {
|
|
|
172
174
|
}
|
|
173
175
|
function submitRecord(jsonData) {
|
|
174
176
|
return (state) => {
|
|
175
|
-
const jsonBody = (0,
|
|
177
|
+
const [jsonBody] = (0, import_util.expandReferences)(state, jsonData);
|
|
176
178
|
const body = (0, import_js2xmlparser.default)("form", jsonBody);
|
|
177
179
|
const { username, password, apiUrl } = state.configuration;
|
|
178
180
|
const url = (0, import_url.resolve)(apiUrl + "/", "mobileApi/uploadData");
|
package/dist/index.js
CHANGED
|
@@ -22,10 +22,8 @@ __export(Adaptor_exports, {
|
|
|
22
22
|
sourceValue: () => sourceValue,
|
|
23
23
|
submitRecord: () => submitRecord
|
|
24
24
|
});
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
expandReferences
|
|
28
|
-
} from "@openfn/language-common";
|
|
25
|
+
import { execute as commonExecute } from "@openfn/language-common";
|
|
26
|
+
import { expandReferences } from "@openfn/language-common/util";
|
|
29
27
|
import { resolve as resolveUrl } from "url";
|
|
30
28
|
import js2xmlparser from "js2xmlparser";
|
|
31
29
|
import request from "request";
|
|
@@ -62,7 +60,8 @@ function fetchSurveyData(params) {
|
|
|
62
60
|
return new Error(`Server responded with ${response.statusCode}`);
|
|
63
61
|
}
|
|
64
62
|
console.log(params.surveyId);
|
|
65
|
-
const
|
|
63
|
+
const [resolvedParams] = expandReferences(state, params);
|
|
64
|
+
const { surveyId, afterDate, beforeDate, postUrl } = resolvedParams;
|
|
66
65
|
console.log(surveyId);
|
|
67
66
|
const { accessToken, username } = state.configuration;
|
|
68
67
|
const enddate = beforeDate;
|
|
@@ -148,7 +147,7 @@ function fetchSurveyData(params) {
|
|
|
148
147
|
}
|
|
149
148
|
function submitRecord(jsonData) {
|
|
150
149
|
return (state) => {
|
|
151
|
-
const jsonBody = expandReferences(jsonData)
|
|
150
|
+
const [jsonBody] = expandReferences(state, jsonData);
|
|
152
151
|
const body = js2xmlparser("form", jsonBody);
|
|
153
152
|
const { username, password, apiUrl } = state.configuration;
|
|
154
153
|
const url = resolveUrl(apiUrl + "/", "mobileApi/uploadData");
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-magpi",
|
|
3
|
-
"
|
|
3
|
+
"label": "Magpi",
|
|
4
|
+
"version": "1.2.5",
|
|
4
5
|
"description": "A Magpi Language Pack for OpenFn",
|
|
5
6
|
"main": "dist/index.cjs",
|
|
6
7
|
"author": "Open Function Group",
|
|
@@ -12,20 +13,18 @@
|
|
|
12
13
|
"configuration-schema.json"
|
|
13
14
|
],
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@openfn/language-common": "^2.1.1",
|
|
16
16
|
"JSONPath": "^0.10.0",
|
|
17
17
|
"js2xmlparser": "^3.0.0",
|
|
18
18
|
"lodash-fp": "^0.10.4",
|
|
19
19
|
"request": "^2.88.2",
|
|
20
20
|
"superagent": "^8.0.9",
|
|
21
|
-
"xml2js": "0.5.0"
|
|
21
|
+
"xml2js": "0.5.0",
|
|
22
|
+
"@openfn/language-common": "3.0.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@openfn/simple-ast": "0.4.1",
|
|
25
25
|
"assertion-error": "^2.0.0",
|
|
26
26
|
"chai": "^4.3.7",
|
|
27
27
|
"deep-eql": "^4.1.3",
|
|
28
|
-
"esno": "^0.16.3",
|
|
29
28
|
"rimraf": "^3.0.2",
|
|
30
29
|
"superagent-mock": "^4.0.0"
|
|
31
30
|
},
|