@openfn/language-magpi 1.1.2 → 1.2.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 +89 -31
- package/dist/index.cjs +3 -0
- package/dist/index.js +3 -0
- package/package.json +2 -3
- package/types/Adaptor.d.ts +1 -1
package/ast.json
CHANGED
|
@@ -102,23 +102,76 @@
|
|
|
102
102
|
"description": null,
|
|
103
103
|
"type": null
|
|
104
104
|
},
|
|
105
|
+
{
|
|
106
|
+
"title": "function",
|
|
107
|
+
"description": null,
|
|
108
|
+
"name": null
|
|
109
|
+
},
|
|
105
110
|
{
|
|
106
111
|
"title": "example",
|
|
107
112
|
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
108
113
|
},
|
|
114
|
+
{
|
|
115
|
+
"title": "param",
|
|
116
|
+
"description": "is the function",
|
|
117
|
+
"type": {
|
|
118
|
+
"type": "NameExpression",
|
|
119
|
+
"name": "Function"
|
|
120
|
+
},
|
|
121
|
+
"name": "func"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"title": "returns",
|
|
125
|
+
"description": null,
|
|
126
|
+
"type": {
|
|
127
|
+
"type": "NameExpression",
|
|
128
|
+
"name": "Operation"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"valid": true
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "fnIf",
|
|
137
|
+
"params": [
|
|
138
|
+
"condition",
|
|
139
|
+
"operation"
|
|
140
|
+
],
|
|
141
|
+
"docs": {
|
|
142
|
+
"description": "A custom operation that will only execute the function if the condition returns true",
|
|
143
|
+
"tags": [
|
|
144
|
+
{
|
|
145
|
+
"title": "public",
|
|
146
|
+
"description": null,
|
|
147
|
+
"type": null
|
|
148
|
+
},
|
|
109
149
|
{
|
|
110
150
|
"title": "function",
|
|
111
151
|
"description": null,
|
|
112
152
|
"name": null
|
|
113
153
|
},
|
|
154
|
+
{
|
|
155
|
+
"title": "example",
|
|
156
|
+
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
157
|
+
},
|
|
114
158
|
{
|
|
115
159
|
"title": "param",
|
|
116
|
-
"description": "
|
|
160
|
+
"description": "The condition that returns true",
|
|
117
161
|
"type": {
|
|
118
162
|
"type": "NameExpression",
|
|
119
|
-
"name": "
|
|
163
|
+
"name": "Boolean"
|
|
120
164
|
},
|
|
121
|
-
"name": "
|
|
165
|
+
"name": "condition"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"title": "param",
|
|
169
|
+
"description": "The operation needed to be executed.",
|
|
170
|
+
"type": {
|
|
171
|
+
"type": "NameExpression",
|
|
172
|
+
"name": "Operation"
|
|
173
|
+
},
|
|
174
|
+
"name": "operation"
|
|
122
175
|
},
|
|
123
176
|
{
|
|
124
177
|
"title": "returns",
|
|
@@ -145,15 +198,15 @@
|
|
|
145
198
|
"description": null,
|
|
146
199
|
"type": null
|
|
147
200
|
},
|
|
148
|
-
{
|
|
149
|
-
"title": "example",
|
|
150
|
-
"description": "sourceValue('$.key')"
|
|
151
|
-
},
|
|
152
201
|
{
|
|
153
202
|
"title": "function",
|
|
154
203
|
"description": null,
|
|
155
204
|
"name": null
|
|
156
205
|
},
|
|
206
|
+
{
|
|
207
|
+
"title": "example",
|
|
208
|
+
"description": "sourceValue('$.key')"
|
|
209
|
+
},
|
|
157
210
|
{
|
|
158
211
|
"title": "param",
|
|
159
212
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -188,15 +241,15 @@
|
|
|
188
241
|
"description": null,
|
|
189
242
|
"type": null
|
|
190
243
|
},
|
|
191
|
-
{
|
|
192
|
-
"title": "example",
|
|
193
|
-
"description": "dataPath('key')"
|
|
194
|
-
},
|
|
195
244
|
{
|
|
196
245
|
"title": "function",
|
|
197
246
|
"description": null,
|
|
198
247
|
"name": null
|
|
199
248
|
},
|
|
249
|
+
{
|
|
250
|
+
"title": "example",
|
|
251
|
+
"description": "dataPath('key')"
|
|
252
|
+
},
|
|
200
253
|
{
|
|
201
254
|
"title": "param",
|
|
202
255
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -231,15 +284,15 @@
|
|
|
231
284
|
"description": null,
|
|
232
285
|
"type": null
|
|
233
286
|
},
|
|
234
|
-
{
|
|
235
|
-
"title": "example",
|
|
236
|
-
"description": "dataValue('key')"
|
|
237
|
-
},
|
|
238
287
|
{
|
|
239
288
|
"title": "function",
|
|
240
289
|
"description": null,
|
|
241
290
|
"name": null
|
|
242
291
|
},
|
|
292
|
+
{
|
|
293
|
+
"title": "example",
|
|
294
|
+
"description": "dataValue('key')"
|
|
295
|
+
},
|
|
243
296
|
{
|
|
244
297
|
"title": "param",
|
|
245
298
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -274,15 +327,15 @@
|
|
|
274
327
|
"description": null,
|
|
275
328
|
"type": null
|
|
276
329
|
},
|
|
277
|
-
{
|
|
278
|
-
"title": "example",
|
|
279
|
-
"description": "lastReferenceValue('key')"
|
|
280
|
-
},
|
|
281
330
|
{
|
|
282
331
|
"title": "function",
|
|
283
332
|
"description": null,
|
|
284
333
|
"name": null
|
|
285
334
|
},
|
|
335
|
+
{
|
|
336
|
+
"title": "example",
|
|
337
|
+
"description": "lastReferenceValue('key')"
|
|
338
|
+
},
|
|
286
339
|
{
|
|
287
340
|
"title": "param",
|
|
288
341
|
"description": "JSONPath referencing a point in `references`.",
|
|
@@ -318,15 +371,15 @@
|
|
|
318
371
|
"description": null,
|
|
319
372
|
"type": null
|
|
320
373
|
},
|
|
321
|
-
{
|
|
322
|
-
"title": "example",
|
|
323
|
-
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
324
|
-
},
|
|
325
374
|
{
|
|
326
375
|
"title": "function",
|
|
327
376
|
"description": null,
|
|
328
377
|
"name": null
|
|
329
378
|
},
|
|
379
|
+
{
|
|
380
|
+
"title": "example",
|
|
381
|
+
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
382
|
+
},
|
|
330
383
|
{
|
|
331
384
|
"title": "param",
|
|
332
385
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -371,15 +424,15 @@
|
|
|
371
424
|
"description": null,
|
|
372
425
|
"type": null
|
|
373
426
|
},
|
|
374
|
-
{
|
|
375
|
-
"title": "example",
|
|
376
|
-
"description": "field('destination_field_name__c', 'value')"
|
|
377
|
-
},
|
|
378
427
|
{
|
|
379
428
|
"title": "function",
|
|
380
429
|
"description": null,
|
|
381
430
|
"name": null
|
|
382
431
|
},
|
|
432
|
+
{
|
|
433
|
+
"title": "example",
|
|
434
|
+
"description": "field('destination_field_name__c', 'value')"
|
|
435
|
+
},
|
|
383
436
|
{
|
|
384
437
|
"title": "param",
|
|
385
438
|
"description": "Name of the field",
|
|
@@ -423,15 +476,15 @@
|
|
|
423
476
|
"description": null,
|
|
424
477
|
"type": null
|
|
425
478
|
},
|
|
426
|
-
{
|
|
427
|
-
"title": "example",
|
|
428
|
-
"description": "fields(list_of_fields)"
|
|
429
|
-
},
|
|
430
479
|
{
|
|
431
480
|
"title": "function",
|
|
432
481
|
"description": null,
|
|
433
482
|
"name": null
|
|
434
483
|
},
|
|
484
|
+
{
|
|
485
|
+
"title": "example",
|
|
486
|
+
"description": "fields(list_of_fields)"
|
|
487
|
+
},
|
|
435
488
|
{
|
|
436
489
|
"title": "param",
|
|
437
490
|
"description": "a list of fields",
|
|
@@ -476,6 +529,11 @@
|
|
|
476
529
|
"description": null,
|
|
477
530
|
"name": null
|
|
478
531
|
},
|
|
532
|
+
{
|
|
533
|
+
"title": "public",
|
|
534
|
+
"description": null,
|
|
535
|
+
"type": null
|
|
536
|
+
},
|
|
479
537
|
{
|
|
480
538
|
"title": "param",
|
|
481
539
|
"description": null,
|
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(src_exports, {
|
|
|
35
35
|
field: () => import_language_common2.field,
|
|
36
36
|
fields: () => import_language_common2.fields,
|
|
37
37
|
fn: () => import_language_common2.fn,
|
|
38
|
+
fnIf: () => import_language_common2.fnIf,
|
|
38
39
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
39
40
|
merge: () => import_language_common2.merge,
|
|
40
41
|
sourceValue: () => import_language_common2.sourceValue,
|
|
@@ -54,6 +55,7 @@ __export(Adaptor_exports, {
|
|
|
54
55
|
field: () => import_language_common2.field,
|
|
55
56
|
fields: () => import_language_common2.fields,
|
|
56
57
|
fn: () => import_language_common2.fn,
|
|
58
|
+
fnIf: () => import_language_common2.fnIf,
|
|
57
59
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
58
60
|
merge: () => import_language_common2.merge,
|
|
59
61
|
sourceValue: () => import_language_common2.sourceValue,
|
|
@@ -193,6 +195,7 @@ var src_default = Adaptor_exports;
|
|
|
193
195
|
field,
|
|
194
196
|
fields,
|
|
195
197
|
fn,
|
|
198
|
+
fnIf,
|
|
196
199
|
lastReferenceValue,
|
|
197
200
|
merge,
|
|
198
201
|
sourceValue,
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ __export(Adaptor_exports, {
|
|
|
16
16
|
field: () => field,
|
|
17
17
|
fields: () => fields,
|
|
18
18
|
fn: () => fn,
|
|
19
|
+
fnIf: () => fnIf,
|
|
19
20
|
lastReferenceValue: () => lastReferenceValue,
|
|
20
21
|
merge: () => merge,
|
|
21
22
|
sourceValue: () => sourceValue,
|
|
@@ -31,6 +32,7 @@ import request from "request";
|
|
|
31
32
|
import xml2js from "xml2js";
|
|
32
33
|
import {
|
|
33
34
|
fn,
|
|
35
|
+
fnIf,
|
|
34
36
|
alterState,
|
|
35
37
|
field,
|
|
36
38
|
fields,
|
|
@@ -169,6 +171,7 @@ export {
|
|
|
169
171
|
field,
|
|
170
172
|
fields,
|
|
171
173
|
fn,
|
|
174
|
+
fnIf,
|
|
172
175
|
lastReferenceValue,
|
|
173
176
|
merge,
|
|
174
177
|
sourceValue,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-magpi",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
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": "^
|
|
15
|
+
"@openfn/language-common": "^2.0.0",
|
|
16
16
|
"JSONPath": "^0.10.0",
|
|
17
17
|
"js2xmlparser": "^3.0.0",
|
|
18
18
|
"lodash-fp": "^0.10.4",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"xml2js": "0.5.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@openfn/buildtools": "^1.0.2",
|
|
25
24
|
"@openfn/simple-ast": "0.4.1",
|
|
26
25
|
"assertion-error": "^2.0.0",
|
|
27
26
|
"chai": "^4.3.7",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -35,4 +35,4 @@ export function fetchSurveyData(params: object): Operation;
|
|
|
35
35
|
* @returns {Operation}
|
|
36
36
|
*/
|
|
37
37
|
export function submitRecord(jsonData: object): Operation;
|
|
38
|
-
export { fn, alterState, field, fields, sourceValue, each, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
|
|
38
|
+
export { fn, fnIf, alterState, field, fields, sourceValue, each, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
|