@openfn/language-maximo 0.3.5 → 0.5.0

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/ast.json CHANGED
@@ -45,6 +45,59 @@
45
45
  },
46
46
  "valid": true
47
47
  },
48
+ {
49
+ "name": "fnIf",
50
+ "params": [
51
+ "condition",
52
+ "operation"
53
+ ],
54
+ "docs": {
55
+ "description": "A custom operation that will only execute the function if the condition returns true",
56
+ "tags": [
57
+ {
58
+ "title": "public",
59
+ "description": null,
60
+ "type": null
61
+ },
62
+ {
63
+ "title": "example",
64
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
65
+ },
66
+ {
67
+ "title": "function",
68
+ "description": null,
69
+ "name": null
70
+ },
71
+ {
72
+ "title": "param",
73
+ "description": "The condition that returns true",
74
+ "type": {
75
+ "type": "NameExpression",
76
+ "name": "Boolean"
77
+ },
78
+ "name": "condition"
79
+ },
80
+ {
81
+ "title": "param",
82
+ "description": "The operation needed to be executed.",
83
+ "type": {
84
+ "type": "NameExpression",
85
+ "name": "Operation"
86
+ },
87
+ "name": "operation"
88
+ },
89
+ {
90
+ "title": "returns",
91
+ "description": null,
92
+ "type": {
93
+ "type": "NameExpression",
94
+ "name": "Operation"
95
+ }
96
+ }
97
+ ]
98
+ },
99
+ "valid": true
100
+ },
48
101
  {
49
102
  "name": "sourceValue",
50
103
  "params": [
package/dist/index.cjs CHANGED
@@ -36,6 +36,7 @@ __export(src_exports, {
36
36
  field: () => import_language_common2.field,
37
37
  fields: () => import_language_common2.fields,
38
38
  fn: () => import_language_common2.fn,
39
+ fnIf: () => import_language_common2.fnIf,
39
40
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
40
41
  merge: () => import_language_common2.merge,
41
42
  sourceValue: () => import_language_common2.sourceValue,
@@ -57,6 +58,7 @@ __export(Adaptor_exports, {
57
58
  field: () => import_language_common2.field,
58
59
  fields: () => import_language_common2.fields,
59
60
  fn: () => import_language_common2.fn,
61
+ fnIf: () => import_language_common2.fnIf,
60
62
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
61
63
  merge: () => import_language_common2.merge,
62
64
  sourceValue: () => import_language_common2.sourceValue,
@@ -104,8 +106,8 @@ function fetch(params) {
104
106
  maxauth: encoded
105
107
  }
106
108
  },
107
- function(error, response, getResponseBody) {
108
- error = assembleError({ error, response });
109
+ function(err, response, getResponseBody) {
110
+ const error = assembleError({ error: err, response });
109
111
  if (error) {
110
112
  console.error("GET failed.");
111
113
  console.log(response);
@@ -118,8 +120,8 @@ function fetch(params) {
118
120
  url: postUrl,
119
121
  json: JSON.parse(getResponseBody)
120
122
  },
121
- function(error2, response2, postResponseBody) {
122
- error2 = assembleError({ error: error2, response: response2 });
123
+ function(err2, response2, postResponseBody) {
124
+ const error2 = assembleError({ error: err2, response: response2 });
123
125
  if (error2) {
124
126
  console.error("POST failed.");
125
127
  reject(error2);
@@ -169,8 +171,8 @@ function create(params) {
169
171
  maxauth: encoded
170
172
  }
171
173
  },
172
- function(error, response, body2) {
173
- error = assembleError({ error, response });
174
+ function(err, response, body2) {
175
+ const error = assembleError({ error: err, response });
174
176
  if (error) {
175
177
  reject(error);
176
178
  console.log(body2);
@@ -218,8 +220,8 @@ function update(params) {
218
220
  patchtype: "MERGE"
219
221
  }
220
222
  },
221
- function(error, response, body2) {
222
- error = assembleError({ error, response });
223
+ function(err, response, body2) {
224
+ const error = assembleError({ error: err, response });
223
225
  if (error) {
224
226
  reject(error);
225
227
  console.log(body2);
@@ -266,8 +268,8 @@ function update75(params) {
266
268
  patchtype: "MERGE"
267
269
  }
268
270
  },
269
- function(error, response, body2) {
270
- error = assembleError({ error, response });
271
+ function(err, response, body2) {
272
+ const error = assembleError({ error: err, response });
271
273
  if (error) {
272
274
  reject(error);
273
275
  console.log(body2);
@@ -300,6 +302,7 @@ var src_default = Adaptor_exports;
300
302
  field,
301
303
  fields,
302
304
  fn,
305
+ fnIf,
303
306
  lastReferenceValue,
304
307
  merge,
305
308
  sourceValue,
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ __export(Adaptor_exports, {
17
17
  field: () => field,
18
18
  fields: () => fields,
19
19
  fn: () => fn,
20
+ fnIf: () => fnIf,
20
21
  lastReferenceValue: () => lastReferenceValue,
21
22
  merge: () => merge,
22
23
  sourceValue: () => sourceValue,
@@ -36,6 +37,7 @@ import {
36
37
  fields,
37
38
  sourceValue,
38
39
  fn,
40
+ fnIf,
39
41
  alterState,
40
42
  each,
41
43
  merge,
@@ -78,8 +80,8 @@ function fetch(params) {
78
80
  maxauth: encoded
79
81
  }
80
82
  },
81
- function(error, response, getResponseBody) {
82
- error = assembleError({ error, response });
83
+ function(err, response, getResponseBody) {
84
+ const error = assembleError({ error: err, response });
83
85
  if (error) {
84
86
  console.error("GET failed.");
85
87
  console.log(response);
@@ -92,8 +94,8 @@ function fetch(params) {
92
94
  url: postUrl,
93
95
  json: JSON.parse(getResponseBody)
94
96
  },
95
- function(error2, response2, postResponseBody) {
96
- error2 = assembleError({ error: error2, response: response2 });
97
+ function(err2, response2, postResponseBody) {
98
+ const error2 = assembleError({ error: err2, response: response2 });
97
99
  if (error2) {
98
100
  console.error("POST failed.");
99
101
  reject(error2);
@@ -143,8 +145,8 @@ function create(params) {
143
145
  maxauth: encoded
144
146
  }
145
147
  },
146
- function(error, response, body2) {
147
- error = assembleError({ error, response });
148
+ function(err, response, body2) {
149
+ const error = assembleError({ error: err, response });
148
150
  if (error) {
149
151
  reject(error);
150
152
  console.log(body2);
@@ -192,8 +194,8 @@ function update(params) {
192
194
  patchtype: "MERGE"
193
195
  }
194
196
  },
195
- function(error, response, body2) {
196
- error = assembleError({ error, response });
197
+ function(err, response, body2) {
198
+ const error = assembleError({ error: err, response });
197
199
  if (error) {
198
200
  reject(error);
199
201
  console.log(body2);
@@ -240,8 +242,8 @@ function update75(params) {
240
242
  patchtype: "MERGE"
241
243
  }
242
244
  },
243
- function(error, response, body2) {
244
- error = assembleError({ error, response });
245
+ function(err, response, body2) {
246
+ const error = assembleError({ error: err, response });
245
247
  if (error) {
246
248
  reject(error);
247
249
  console.log(body2);
@@ -274,6 +276,7 @@ export {
274
276
  field,
275
277
  fields,
276
278
  fn,
279
+ fnIf,
277
280
  lastReferenceValue,
278
281
  merge,
279
282
  sourceValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-maximo",
3
- "version": "0.3.5",
3
+ "version": "0.5.0",
4
4
  "description": "An IBM Maximo EAM Language Pack for OpenFn",
5
5
  "main": "dist/index.cjs",
6
6
  "author": "Open Function Group",
@@ -12,13 +12,12 @@
12
12
  "configuration-schema.json"
13
13
  ],
14
14
  "dependencies": {
15
- "@openfn/language-common": "^1.7.6",
15
+ "@openfn/language-common": "^1.14.0",
16
16
  "base-64": "^0.1.0",
17
17
  "request": "^2.88.2",
18
18
  "utf8": "^2.1.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@openfn/buildtools": "^1.0.2",
22
21
  "@openfn/simple-ast": "0.4.1",
23
22
  "assertion-error": "^2.0.0",
24
23
  "babel-cli": "^6.26.0",
@@ -50,6 +49,7 @@
50
49
  "test": "mocha --experimental-specifier-resolution=node --no-warnings",
51
50
  "test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
52
51
  "clean": "rimraf dist types docs",
53
- "pack": "pnpm pack --pack-destination ../../dist"
52
+ "pack": "pnpm pack --pack-destination ../../dist",
53
+ "lint": "eslint src"
54
54
  }
55
55
  }
@@ -50,4 +50,4 @@ export function update(params: object): Operation;
50
50
  * @returns {Operation}
51
51
  */
52
52
  export function update75(params: object): Operation;
53
- export { field, fields, sourceValue, fn, alterState, each, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
53
+ export { field, fields, sourceValue, fn, fnIf, alterState, each, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";