@openfn/language-magpi 1.0.5 → 1.1.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/dist/index.cjs CHANGED
@@ -106,8 +106,8 @@ function fetchSurveyData(params) {
106
106
  url,
107
107
  form
108
108
  },
109
- (error, response, body) => {
110
- error = assembleError({ error, response });
109
+ (err, response, body) => {
110
+ const error = assembleError({ error: err, response });
111
111
  if (error) {
112
112
  console.log("Failed to fetch submission data.");
113
113
  console.log("Response body: " + response.body);
@@ -145,8 +145,8 @@ function fetchSurveyData(params) {
145
145
  url: postUrl,
146
146
  json: item
147
147
  },
148
- (error, response, postResponseBody) => {
149
- error = assembleError({ error, response });
148
+ (err, response, postResponseBody) => {
149
+ const error = assembleError({ error: err, response });
150
150
  if (error) {
151
151
  console.error("POST failed.");
152
152
  throw error;
@@ -170,7 +170,7 @@ function fetchSurveyData(params) {
170
170
  }
171
171
  function submitRecord(jsonData) {
172
172
  return (state) => {
173
- const jsonBody = (0, import_language_common.expandReferences)(data)(state);
173
+ const jsonBody = (0, import_language_common.expandReferences)(jsonData)(state);
174
174
  const body = (0, import_js2xmlparser.default)("form", jsonBody);
175
175
  const { username, password, apiUrl } = state.configuration;
176
176
  const url = (0, import_url.resolve)(apiUrl + "/", "mobileApi/uploadData");
package/dist/index.js CHANGED
@@ -82,8 +82,8 @@ function fetchSurveyData(params) {
82
82
  url,
83
83
  form
84
84
  },
85
- (error, response, body) => {
86
- error = assembleError({ error, response });
85
+ (err, response, body) => {
86
+ const error = assembleError({ error: err, response });
87
87
  if (error) {
88
88
  console.log("Failed to fetch submission data.");
89
89
  console.log("Response body: " + response.body);
@@ -121,8 +121,8 @@ function fetchSurveyData(params) {
121
121
  url: postUrl,
122
122
  json: item
123
123
  },
124
- (error, response, postResponseBody) => {
125
- error = assembleError({ error, response });
124
+ (err, response, postResponseBody) => {
125
+ const error = assembleError({ error: err, response });
126
126
  if (error) {
127
127
  console.error("POST failed.");
128
128
  throw error;
@@ -146,7 +146,7 @@ function fetchSurveyData(params) {
146
146
  }
147
147
  function submitRecord(jsonData) {
148
148
  return (state) => {
149
- const jsonBody = expandReferences(data)(state);
149
+ const jsonBody = expandReferences(jsonData)(state);
150
150
  const body = js2xmlparser("form", jsonBody);
151
151
  const { username, password, apiUrl } = state.configuration;
152
152
  const url = resolveUrl(apiUrl + "/", "mobileApi/uploadData");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-magpi",
3
- "version": "1.0.5",
3
+ "version": "1.1.2",
4
4
  "description": "A Magpi Language Pack for OpenFn",
5
5
  "main": "dist/index.cjs",
6
6
  "author": "Open Function Group",
@@ -12,7 +12,7 @@
12
12
  "configuration-schema.json"
13
13
  ],
14
14
  "dependencies": {
15
- "@openfn/language-common": "^1.7.7",
15
+ "@openfn/language-common": "^1.12.0",
16
16
  "JSONPath": "^0.10.0",
17
17
  "js2xmlparser": "^3.0.0",
18
18
  "lodash-fp": "^0.10.4",
@@ -49,6 +49,7 @@
49
49
  "test": "mocha --experimental-specifier-resolution=node --no-warnings",
50
50
  "test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
51
51
  "clean": "rimraf dist types docs",
52
- "pack": "pnpm pack --pack-destination ../../dist"
52
+ "pack": "pnpm pack --pack-destination ../../dist",
53
+ "lint": "eslint src"
53
54
  }
54
55
  }