@openfn/language-resourcemap 0.3.1 → 0.4.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 +4 -4
- package/dist/index.js +4 -4
- package/package.json +2 -3
- 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
|
@@ -34,6 +34,7 @@ __export(src_exports, {
|
|
|
34
34
|
field: () => import_language_common2.field,
|
|
35
35
|
fields: () => import_language_common2.fields,
|
|
36
36
|
fn: () => import_language_common2.fn,
|
|
37
|
+
fnIf: () => import_language_common2.fnIf,
|
|
37
38
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
38
39
|
merge: () => import_language_common2.merge,
|
|
39
40
|
sourceValue: () => import_language_common2.sourceValue,
|
|
@@ -52,6 +53,7 @@ __export(Adaptor_exports, {
|
|
|
52
53
|
field: () => import_language_common2.field,
|
|
53
54
|
fields: () => import_language_common2.fields,
|
|
54
55
|
fn: () => import_language_common2.fn,
|
|
56
|
+
fnIf: () => import_language_common2.fnIf,
|
|
55
57
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
56
58
|
merge: () => import_language_common2.merge,
|
|
57
59
|
sourceValue: () => import_language_common2.sourceValue,
|
|
@@ -86,10 +88,7 @@ function submitSite(collection_id, submissionData) {
|
|
|
86
88
|
"Submitting site to collection " + collection_id + ":\n" + JSON.stringify(body, null, 4) + "\n"
|
|
87
89
|
);
|
|
88
90
|
const { username, password, baseUrl } = state.configuration;
|
|
89
|
-
const url =
|
|
90
|
-
baseUrl + "/",
|
|
91
|
-
"api/collections/" + collection_id + "/sites.json"
|
|
92
|
-
);
|
|
91
|
+
const url = baseUrl + "/api/collections/" + collection_id + "/sites.json";
|
|
93
92
|
return new Promise((resolve, reject) => {
|
|
94
93
|
import_request.default.post(
|
|
95
94
|
{
|
|
@@ -138,6 +137,7 @@ var src_default = Adaptor_exports;
|
|
|
138
137
|
field,
|
|
139
138
|
fields,
|
|
140
139
|
fn,
|
|
140
|
+
fnIf,
|
|
141
141
|
lastReferenceValue,
|
|
142
142
|
merge,
|
|
143
143
|
sourceValue,
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ __export(Adaptor_exports, {
|
|
|
15
15
|
field: () => field,
|
|
16
16
|
fields: () => fields,
|
|
17
17
|
fn: () => fn,
|
|
18
|
+
fnIf: () => fnIf,
|
|
18
19
|
lastReferenceValue: () => lastReferenceValue,
|
|
19
20
|
merge: () => merge,
|
|
20
21
|
sourceValue: () => sourceValue,
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
import request from "request";
|
|
28
29
|
import {
|
|
29
30
|
fn,
|
|
31
|
+
fnIf,
|
|
30
32
|
alterState,
|
|
31
33
|
field,
|
|
32
34
|
fields,
|
|
@@ -63,10 +65,7 @@ function submitSite(collection_id, submissionData) {
|
|
|
63
65
|
"Submitting site to collection " + collection_id + ":\n" + JSON.stringify(body, null, 4) + "\n"
|
|
64
66
|
);
|
|
65
67
|
const { username, password, baseUrl } = state.configuration;
|
|
66
|
-
const url =
|
|
67
|
-
baseUrl + "/",
|
|
68
|
-
"api/collections/" + collection_id + "/sites.json"
|
|
69
|
-
);
|
|
68
|
+
const url = baseUrl + "/api/collections/" + collection_id + "/sites.json";
|
|
70
69
|
return new Promise((resolve, reject) => {
|
|
71
70
|
request.post(
|
|
72
71
|
{
|
|
@@ -115,6 +114,7 @@ export {
|
|
|
115
114
|
field,
|
|
116
115
|
fields,
|
|
117
116
|
fn,
|
|
117
|
+
fnIf,
|
|
118
118
|
lastReferenceValue,
|
|
119
119
|
merge,
|
|
120
120
|
sourceValue,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-resourcemap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Resourcemap Language Pack for OpenFn",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"author": "Open Function Group",
|
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
"configuration-schema.json"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@openfn/language-common": "^1.
|
|
15
|
+
"@openfn/language-common": "^1.14.0",
|
|
16
16
|
"request": "^2.88.2"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@openfn/buildtools": "^1.0.2",
|
|
20
19
|
"@openfn/simple-ast": "0.4.1",
|
|
21
20
|
"assertion-error": "^2.0.0",
|
|
22
21
|
"chai": "^4.3.7",
|
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 submitSite(collection_id: any, submissionData: any): Operation;
|
|
25
|
-
export { fn, alterState, field, fields, sourceValue, merge, each, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
|
|
25
|
+
export { fn, fnIf, alterState, field, fields, sourceValue, merge, each, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
|