@openfn/language-resourcemap 0.3.2 → 0.4.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": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
237
- },
238
287
  {
239
288
  "title": "function",
240
289
  "description": null,
241
290
  "name": null
242
291
  },
292
+ {
293
+ "title": "example",
294
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
295
+ },
243
296
  {
244
297
  "title": "param",
245
298
  "description": "JSONPath referencing a point in `state`.",
@@ -284,15 +337,15 @@
284
337
  "description": null,
285
338
  "type": null
286
339
  },
287
- {
288
- "title": "example",
289
- "description": "field('destination_field_name__c', 'value')"
290
- },
291
340
  {
292
341
  "title": "function",
293
342
  "description": null,
294
343
  "name": null
295
344
  },
345
+ {
346
+ "title": "example",
347
+ "description": "field('destination_field_name__c', 'value')"
348
+ },
296
349
  {
297
350
  "title": "param",
298
351
  "description": "Name of the field",
@@ -336,15 +389,15 @@
336
389
  "description": null,
337
390
  "type": null
338
391
  },
339
- {
340
- "title": "example",
341
- "description": "fields(list_of_fields)"
342
- },
343
392
  {
344
393
  "title": "function",
345
394
  "description": null,
346
395
  "name": null
347
396
  },
397
+ {
398
+ "title": "example",
399
+ "description": "fields(list_of_fields)"
400
+ },
348
401
  {
349
402
  "title": "param",
350
403
  "description": "a list of fields",
@@ -389,6 +442,11 @@
389
442
  "description": null,
390
443
  "name": null
391
444
  },
445
+ {
446
+ "title": "public",
447
+ "description": null,
448
+ "type": null
449
+ },
392
450
  {
393
451
  "title": "param",
394
452
  "description": null,
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,
@@ -135,6 +137,7 @@ var src_default = Adaptor_exports;
135
137
  field,
136
138
  fields,
137
139
  fn,
140
+ fnIf,
138
141
  lastReferenceValue,
139
142
  merge,
140
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,
@@ -112,6 +114,7 @@ export {
112
114
  field,
113
115
  fields,
114
116
  fn,
117
+ fnIf,
115
118
  lastReferenceValue,
116
119
  merge,
117
120
  sourceValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-resourcemap",
3
- "version": "0.3.2",
3
+ "version": "0.4.1",
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.12.0",
16
- "request": "^2.88.2"
15
+ "request": "^2.88.2",
16
+ "@openfn/language-common": "2.0.0"
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",
@@ -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";