@openfn/language-openhim 0.1.4 → 0.3.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 +53 -0
- package/dist/index.cjs +3 -0
- package/dist/index.js +3 -0
- package/package.json +4 -4
- package/types/Adaptor.d.ts +1 -1
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
|
@@ -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.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "openhim Language Pack for OpenFn",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"author": "Open Function Group",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"JSONPath": "^0.10.0",
|
|
16
|
-
"@openfn/language-common": "^1.
|
|
16
|
+
"@openfn/language-common": "^1.14.0",
|
|
17
17
|
"lodash-fp": "^0.10.2",
|
|
18
18
|
"superagent": "^3.7.0"
|
|
19
19
|
},
|
|
@@ -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
|
},
|
|
@@ -51,6 +50,7 @@
|
|
|
51
50
|
"test": "mocha --experimental-specifier-resolution=node --no-warnings",
|
|
52
51
|
"test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
|
|
53
52
|
"clean": "rimraf dist types docs",
|
|
54
|
-
"pack": "pnpm pack --pack-destination ../../dist"
|
|
53
|
+
"pack": "pnpm pack --pack-destination ../../dist",
|
|
54
|
+
"lint": "eslint src"
|
|
55
55
|
}
|
|
56
56
|
}
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -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";
|