@openfn/language-beyonic 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
@@ -1,5 +1,135 @@
1
1
  {
2
- "operations": [],
2
+ "operations": [
3
+ {
4
+ "name": "createPayment",
5
+ "params": [
6
+ "data"
7
+ ],
8
+ "docs": {
9
+ "description": "Create a payment",
10
+ "tags": [
11
+ {
12
+ "title": "example",
13
+ "description": "execute(\n createPayment(data)\n)(state)"
14
+ },
15
+ {
16
+ "title": "public",
17
+ "description": null,
18
+ "type": null
19
+ },
20
+ {
21
+ "title": "function",
22
+ "description": null,
23
+ "name": null
24
+ },
25
+ {
26
+ "title": "param",
27
+ "description": "Payload data for the payment",
28
+ "type": {
29
+ "type": "NameExpression",
30
+ "name": "object"
31
+ },
32
+ "name": "data"
33
+ },
34
+ {
35
+ "title": "returns",
36
+ "description": null,
37
+ "type": {
38
+ "type": "NameExpression",
39
+ "name": "Operation"
40
+ }
41
+ }
42
+ ]
43
+ },
44
+ "valid": true
45
+ },
46
+ {
47
+ "name": "createContact",
48
+ "params": [
49
+ "data"
50
+ ],
51
+ "docs": {
52
+ "description": "Create a contact",
53
+ "tags": [
54
+ {
55
+ "title": "example",
56
+ "description": "execute(\n createContact(data)\n)(state)"
57
+ },
58
+ {
59
+ "title": "public",
60
+ "description": null,
61
+ "type": null
62
+ },
63
+ {
64
+ "title": "function",
65
+ "description": null,
66
+ "name": null
67
+ },
68
+ {
69
+ "title": "param",
70
+ "description": "Payload data for the contact",
71
+ "type": {
72
+ "type": "NameExpression",
73
+ "name": "object"
74
+ },
75
+ "name": "data"
76
+ },
77
+ {
78
+ "title": "returns",
79
+ "description": null,
80
+ "type": {
81
+ "type": "NameExpression",
82
+ "name": "Operation"
83
+ }
84
+ }
85
+ ]
86
+ },
87
+ "valid": true
88
+ },
89
+ {
90
+ "name": "createCollectionRequest",
91
+ "params": [
92
+ "data"
93
+ ],
94
+ "docs": {
95
+ "description": "Create a collection request",
96
+ "tags": [
97
+ {
98
+ "title": "example",
99
+ "description": "execute(\n createCollectionRequest(data)\n)(state)"
100
+ },
101
+ {
102
+ "title": "public",
103
+ "description": null,
104
+ "type": null
105
+ },
106
+ {
107
+ "title": "function",
108
+ "description": null,
109
+ "name": null
110
+ },
111
+ {
112
+ "title": "param",
113
+ "description": "Payload data for the collection request",
114
+ "type": {
115
+ "type": "NameExpression",
116
+ "name": "object"
117
+ },
118
+ "name": "data"
119
+ },
120
+ {
121
+ "title": "returns",
122
+ "description": null,
123
+ "type": {
124
+ "type": "NameExpression",
125
+ "name": "Operation"
126
+ }
127
+ }
128
+ ]
129
+ },
130
+ "valid": true
131
+ }
132
+ ],
3
133
  "exports": [],
4
134
  "common": [
5
135
  {
@@ -15,23 +145,76 @@
15
145
  "description": null,
16
146
  "type": null
17
147
  },
148
+ {
149
+ "title": "function",
150
+ "description": null,
151
+ "name": null
152
+ },
18
153
  {
19
154
  "title": "example",
20
155
  "description": "fn(state => {\n // do some things to state\n return state;\n});"
21
156
  },
157
+ {
158
+ "title": "param",
159
+ "description": "is the function",
160
+ "type": {
161
+ "type": "NameExpression",
162
+ "name": "Function"
163
+ },
164
+ "name": "func"
165
+ },
166
+ {
167
+ "title": "returns",
168
+ "description": null,
169
+ "type": {
170
+ "type": "NameExpression",
171
+ "name": "Operation"
172
+ }
173
+ }
174
+ ]
175
+ },
176
+ "valid": true
177
+ },
178
+ {
179
+ "name": "fnIf",
180
+ "params": [
181
+ "condition",
182
+ "operation"
183
+ ],
184
+ "docs": {
185
+ "description": "A custom operation that will only execute the function if the condition returns true",
186
+ "tags": [
187
+ {
188
+ "title": "public",
189
+ "description": null,
190
+ "type": null
191
+ },
22
192
  {
23
193
  "title": "function",
24
194
  "description": null,
25
195
  "name": null
26
196
  },
197
+ {
198
+ "title": "example",
199
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
200
+ },
27
201
  {
28
202
  "title": "param",
29
- "description": "is the function",
203
+ "description": "The condition that returns true",
30
204
  "type": {
31
205
  "type": "NameExpression",
32
- "name": "Function"
206
+ "name": "Boolean"
33
207
  },
34
- "name": "func"
208
+ "name": "condition"
209
+ },
210
+ {
211
+ "title": "param",
212
+ "description": "The operation needed to be executed.",
213
+ "type": {
214
+ "type": "NameExpression",
215
+ "name": "Operation"
216
+ },
217
+ "name": "operation"
35
218
  },
36
219
  {
37
220
  "title": "returns",
@@ -58,15 +241,15 @@
58
241
  "description": null,
59
242
  "type": null
60
243
  },
61
- {
62
- "title": "example",
63
- "description": "sourceValue('$.key')"
64
- },
65
244
  {
66
245
  "title": "function",
67
246
  "description": null,
68
247
  "name": null
69
248
  },
249
+ {
250
+ "title": "example",
251
+ "description": "sourceValue('$.key')"
252
+ },
70
253
  {
71
254
  "title": "param",
72
255
  "description": "JSONPath referencing a point in `state`.",
@@ -101,15 +284,15 @@
101
284
  "description": null,
102
285
  "type": null
103
286
  },
104
- {
105
- "title": "example",
106
- "description": "dataPath('key')"
107
- },
108
287
  {
109
288
  "title": "function",
110
289
  "description": null,
111
290
  "name": null
112
291
  },
292
+ {
293
+ "title": "example",
294
+ "description": "dataPath('key')"
295
+ },
113
296
  {
114
297
  "title": "param",
115
298
  "description": "JSONPath referencing a point in `data`.",
@@ -144,15 +327,15 @@
144
327
  "description": null,
145
328
  "type": null
146
329
  },
147
- {
148
- "title": "example",
149
- "description": "dataValue('key')"
150
- },
151
330
  {
152
331
  "title": "function",
153
332
  "description": null,
154
333
  "name": null
155
334
  },
335
+ {
336
+ "title": "example",
337
+ "description": "dataValue('key')"
338
+ },
156
339
  {
157
340
  "title": "param",
158
341
  "description": "JSONPath referencing a point in `data`.",
@@ -187,15 +370,15 @@
187
370
  "description": null,
188
371
  "type": null
189
372
  },
190
- {
191
- "title": "example",
192
- "description": "lastReferenceValue('key')"
193
- },
194
373
  {
195
374
  "title": "function",
196
375
  "description": null,
197
376
  "name": null
198
377
  },
378
+ {
379
+ "title": "example",
380
+ "description": "lastReferenceValue('key')"
381
+ },
199
382
  {
200
383
  "title": "param",
201
384
  "description": "JSONPath referencing a point in `references`.",
@@ -231,15 +414,15 @@
231
414
  "description": null,
232
415
  "type": null
233
416
  },
234
- {
235
- "title": "example",
236
- "description": "field('destination_field_name__c', 'value')"
237
- },
238
417
  {
239
418
  "title": "function",
240
419
  "description": null,
241
420
  "name": null
242
421
  },
422
+ {
423
+ "title": "example",
424
+ "description": "field('destination_field_name__c', 'value')"
425
+ },
243
426
  {
244
427
  "title": "param",
245
428
  "description": "Name of the field",
@@ -283,15 +466,15 @@
283
466
  "description": null,
284
467
  "type": null
285
468
  },
286
- {
287
- "title": "example",
288
- "description": "fields(list_of_fields)"
289
- },
290
469
  {
291
470
  "title": "function",
292
471
  "description": null,
293
472
  "name": null
294
473
  },
474
+ {
475
+ "title": "example",
476
+ "description": "fields(list_of_fields)"
477
+ },
295
478
  {
296
479
  "title": "param",
297
480
  "description": "a list of fields",
@@ -336,6 +519,11 @@
336
519
  "description": null,
337
520
  "name": null
338
521
  },
522
+ {
523
+ "title": "public",
524
+ "description": null,
525
+ "type": null
526
+ },
339
527
  {
340
528
  "title": "param",
341
529
  "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
@@ -53,6 +54,7 @@ __export(Adaptor_exports, {
53
54
  field: () => import_language_common2.field,
54
55
  fields: () => import_language_common2.fields,
55
56
  fn: () => import_language_common2.fn,
57
+ fnIf: () => import_language_common2.fnIf,
56
58
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
57
59
  merge: () => import_language_common2.merge,
58
60
  sourceValue: () => import_language_common2.sourceValue
@@ -137,6 +139,7 @@ var src_default = Adaptor_exports;
137
139
  field,
138
140
  fields,
139
141
  fn,
142
+ fnIf,
140
143
  lastReferenceValue,
141
144
  merge,
142
145
  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
@@ -42,6 +43,7 @@ function post({ apiToken, body, url }) {
42
43
  import { resolve as resolveUrl } from "url";
43
44
  import {
44
45
  fn,
46
+ fnIf,
45
47
  field,
46
48
  fields,
47
49
  sourceValue,
@@ -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-beyonic",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "beyonic Language Pack for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -23,13 +23,12 @@
23
23
  "configuration-schema.json"
24
24
  ],
25
25
  "dependencies": {
26
- "@openfn/language-common": "^1.8.1",
26
+ "@openfn/language-common": "^1.15.1",
27
27
  "JSONPath": "^0.10.0",
28
28
  "lodash-fp": "^0.10.2",
29
29
  "superagent": "^8.0.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@openfn/buildtools": "^1.0.2",
33
32
  "@openfn/simple-ast": "0.4.1",
34
33
  "assertion-error": "2.0.0",
35
34
  "chai": "4.3.6",
@@ -17,6 +17,7 @@ export function execute(...operations: Operations): Operation;
17
17
  * execute(
18
18
  * createPayment(data)
19
19
  * )(state)
20
+ * @public
20
21
  * @function
21
22
  * @param {object} data - Payload data for the payment
22
23
  * @returns {Operation}
@@ -28,6 +29,7 @@ export function createPayment(data: object): Operation;
28
29
  * execute(
29
30
  * createContact(data)
30
31
  * )(state)
32
+ * @public
31
33
  * @function
32
34
  * @param {object} data - Payload data for the contact
33
35
  * @returns {Operation}
@@ -39,9 +41,10 @@ export function createContact(data: object): Operation;
39
41
  * execute(
40
42
  * createCollectionRequest(data)
41
43
  * )(state)
44
+ * @public
42
45
  * @function
43
46
  * @param {object} data - Payload data for the collection request
44
47
  * @returns {Operation}
45
48
  */
46
49
  export function createCollectionRequest(data: object): Operation;
47
- export { fn, field, fields, sourceValue, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
50
+ export { fn, fnIf, field, fields, sourceValue, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";