@openfn/language-openhim 0.2.1 → 0.3.1

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
@@ -15,23 +15,76 @@
15
15
  "description": null,
16
16
  "type": null
17
17
  },
18
+ {
19
+ "title": "function",
20
+ "description": null,
21
+ "name": null
22
+ },
18
23
  {
19
24
  "title": "example",
20
25
  "description": "fn(state => {\n // do some things to state\n return state;\n});"
21
26
  },
27
+ {
28
+ "title": "param",
29
+ "description": "is the function",
30
+ "type": {
31
+ "type": "NameExpression",
32
+ "name": "Function"
33
+ },
34
+ "name": "func"
35
+ },
36
+ {
37
+ "title": "returns",
38
+ "description": null,
39
+ "type": {
40
+ "type": "NameExpression",
41
+ "name": "Operation"
42
+ }
43
+ }
44
+ ]
45
+ },
46
+ "valid": true
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
+ },
22
62
  {
23
63
  "title": "function",
24
64
  "description": null,
25
65
  "name": null
26
66
  },
67
+ {
68
+ "title": "example",
69
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
70
+ },
27
71
  {
28
72
  "title": "param",
29
- "description": "is the function",
73
+ "description": "The condition that returns true",
30
74
  "type": {
31
75
  "type": "NameExpression",
32
- "name": "Function"
76
+ "name": "Boolean"
33
77
  },
34
- "name": "func"
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"
35
88
  },
36
89
  {
37
90
  "title": "returns",
@@ -58,15 +111,15 @@
58
111
  "description": null,
59
112
  "type": null
60
113
  },
61
- {
62
- "title": "example",
63
- "description": "sourceValue('$.key')"
64
- },
65
114
  {
66
115
  "title": "function",
67
116
  "description": null,
68
117
  "name": null
69
118
  },
119
+ {
120
+ "title": "example",
121
+ "description": "sourceValue('$.key')"
122
+ },
70
123
  {
71
124
  "title": "param",
72
125
  "description": "JSONPath referencing a point in `state`.",
@@ -101,15 +154,15 @@
101
154
  "description": null,
102
155
  "type": null
103
156
  },
104
- {
105
- "title": "example",
106
- "description": "dataPath('key')"
107
- },
108
157
  {
109
158
  "title": "function",
110
159
  "description": null,
111
160
  "name": null
112
161
  },
162
+ {
163
+ "title": "example",
164
+ "description": "dataPath('key')"
165
+ },
113
166
  {
114
167
  "title": "param",
115
168
  "description": "JSONPath referencing a point in `data`.",
@@ -144,15 +197,15 @@
144
197
  "description": null,
145
198
  "type": null
146
199
  },
147
- {
148
- "title": "example",
149
- "description": "dataValue('key')"
150
- },
151
200
  {
152
201
  "title": "function",
153
202
  "description": null,
154
203
  "name": null
155
204
  },
205
+ {
206
+ "title": "example",
207
+ "description": "dataValue('key')"
208
+ },
156
209
  {
157
210
  "title": "param",
158
211
  "description": "JSONPath referencing a point in `data`.",
@@ -187,15 +240,15 @@
187
240
  "description": null,
188
241
  "type": null
189
242
  },
190
- {
191
- "title": "example",
192
- "description": "lastReferenceValue('key')"
193
- },
194
243
  {
195
244
  "title": "function",
196
245
  "description": null,
197
246
  "name": null
198
247
  },
248
+ {
249
+ "title": "example",
250
+ "description": "lastReferenceValue('key')"
251
+ },
199
252
  {
200
253
  "title": "param",
201
254
  "description": "JSONPath referencing a point in `references`.",
@@ -231,15 +284,15 @@
231
284
  "description": null,
232
285
  "type": null
233
286
  },
234
- {
235
- "title": "example",
236
- "description": "field('destination_field_name__c', 'value')"
237
- },
238
287
  {
239
288
  "title": "function",
240
289
  "description": null,
241
290
  "name": null
242
291
  },
292
+ {
293
+ "title": "example",
294
+ "description": "field('destination_field_name__c', 'value')"
295
+ },
243
296
  {
244
297
  "title": "param",
245
298
  "description": "Name of the field",
@@ -283,15 +336,15 @@
283
336
  "description": null,
284
337
  "type": null
285
338
  },
286
- {
287
- "title": "example",
288
- "description": "fields(list_of_fields)"
289
- },
290
339
  {
291
340
  "title": "function",
292
341
  "description": null,
293
342
  "name": null
294
343
  },
344
+ {
345
+ "title": "example",
346
+ "description": "fields(list_of_fields)"
347
+ },
295
348
  {
296
349
  "title": "param",
297
350
  "description": "a list of fields",
@@ -336,6 +389,11 @@
336
389
  "description": null,
337
390
  "name": null
338
391
  },
392
+ {
393
+ "title": "public",
394
+ "description": null,
395
+ "type": null
396
+ },
339
397
  {
340
398
  "title": "param",
341
399
  "description": null,
package/dist/index.cjs CHANGED
@@ -33,6 +33,7 @@ __export(src_exports, {
33
33
  field: () => import_language_common2.field,
34
34
  fields: () => import_language_common2.fields,
35
35
  fn: () => import_language_common2.fn,
36
+ fnIf: () => import_language_common2.fnIf,
36
37
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
37
38
  merge: () => import_language_common2.merge,
38
39
  sourceValue: () => import_language_common2.sourceValue
@@ -49,6 +50,7 @@ __export(Adaptor_exports, {
49
50
  field: () => import_language_common2.field,
50
51
  fields: () => import_language_common2.fields,
51
52
  fn: () => import_language_common2.fn,
53
+ fnIf: () => import_language_common2.fnIf,
52
54
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
53
55
  merge: () => import_language_common2.merge,
54
56
  sourceValue: () => import_language_common2.sourceValue
@@ -105,6 +107,7 @@ var src_default = Adaptor_exports;
105
107
  field,
106
108
  fields,
107
109
  fn,
110
+ fnIf,
108
111
  lastReferenceValue,
109
112
  merge,
110
113
  sourceValue
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ __export(Adaptor_exports, {
14
14
  field: () => field,
15
15
  fields: () => fields,
16
16
  fn: () => fn,
17
+ fnIf: () => fnIf,
17
18
  lastReferenceValue: () => lastReferenceValue,
18
19
  merge: () => merge,
19
20
  sourceValue: () => sourceValue
@@ -40,6 +41,7 @@ function post({ username, password, body, url }) {
40
41
  import { resolve as resolveUrl } from "url";
41
42
  import {
42
43
  fn,
44
+ fnIf,
43
45
  field,
44
46
  fields,
45
47
  sourceValue,
@@ -82,6 +84,7 @@ export {
82
84
  field,
83
85
  fields,
84
86
  fn,
87
+ fnIf,
85
88
  lastReferenceValue,
86
89
  merge,
87
90
  sourceValue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-openhim",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "openhim Language Pack for OpenFn",
5
5
  "main": "dist/index.cjs",
6
6
  "author": "Open Function Group",
@@ -13,9 +13,9 @@
13
13
  ],
14
14
  "dependencies": {
15
15
  "JSONPath": "^0.10.0",
16
- "@openfn/language-common": "^1.8.1",
17
16
  "lodash-fp": "^0.10.2",
18
- "superagent": "^3.7.0"
17
+ "superagent": "^3.7.0",
18
+ "@openfn/language-common": "2.0.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "assertion-error": "^1.0.1",
@@ -29,7 +29,6 @@
29
29
  "sinon": "^1.17.2",
30
30
  "superagent-mock": "^1.10.0",
31
31
  "esno": "^0.16.3",
32
- "@openfn/buildtools": "^1.0.1",
33
32
  "@openfn/simple-ast": "0.4.1",
34
33
  "rimraf": "^3.0.2"
35
34
  },
@@ -22,4 +22,4 @@ export function execute(...operations: Operations): Operation;
22
22
  * @returns {Operation}
23
23
  */
24
24
  export function encounter(encounterData: object): Operation;
25
- export { fn, field, fields, sourceValue, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
25
+ export { fn, fnIf, field, fields, sourceValue, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";