@openfn/language-facebook 0.3.3 → 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
@@ -59,23 +59,76 @@
59
59
  "description": null,
60
60
  "type": null
61
61
  },
62
+ {
63
+ "title": "function",
64
+ "description": null,
65
+ "name": null
66
+ },
62
67
  {
63
68
  "title": "example",
64
69
  "description": "fn(state => {\n // do some things to state\n return state;\n});"
65
70
  },
71
+ {
72
+ "title": "param",
73
+ "description": "is the function",
74
+ "type": {
75
+ "type": "NameExpression",
76
+ "name": "Function"
77
+ },
78
+ "name": "func"
79
+ },
80
+ {
81
+ "title": "returns",
82
+ "description": null,
83
+ "type": {
84
+ "type": "NameExpression",
85
+ "name": "Operation"
86
+ }
87
+ }
88
+ ]
89
+ },
90
+ "valid": true
91
+ },
92
+ {
93
+ "name": "fnIf",
94
+ "params": [
95
+ "condition",
96
+ "operation"
97
+ ],
98
+ "docs": {
99
+ "description": "A custom operation that will only execute the function if the condition returns true",
100
+ "tags": [
101
+ {
102
+ "title": "public",
103
+ "description": null,
104
+ "type": null
105
+ },
66
106
  {
67
107
  "title": "function",
68
108
  "description": null,
69
109
  "name": null
70
110
  },
111
+ {
112
+ "title": "example",
113
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
114
+ },
71
115
  {
72
116
  "title": "param",
73
- "description": "is the function",
117
+ "description": "The condition that returns true",
74
118
  "type": {
75
119
  "type": "NameExpression",
76
- "name": "Function"
120
+ "name": "Boolean"
77
121
  },
78
- "name": "func"
122
+ "name": "condition"
123
+ },
124
+ {
125
+ "title": "param",
126
+ "description": "The operation needed to be executed.",
127
+ "type": {
128
+ "type": "NameExpression",
129
+ "name": "Operation"
130
+ },
131
+ "name": "operation"
79
132
  },
80
133
  {
81
134
  "title": "returns",
@@ -102,15 +155,15 @@
102
155
  "description": null,
103
156
  "type": null
104
157
  },
105
- {
106
- "title": "example",
107
- "description": "sourceValue('$.key')"
108
- },
109
158
  {
110
159
  "title": "function",
111
160
  "description": null,
112
161
  "name": null
113
162
  },
163
+ {
164
+ "title": "example",
165
+ "description": "sourceValue('$.key')"
166
+ },
114
167
  {
115
168
  "title": "param",
116
169
  "description": "JSONPath referencing a point in `state`.",
@@ -145,15 +198,15 @@
145
198
  "description": null,
146
199
  "type": null
147
200
  },
148
- {
149
- "title": "example",
150
- "description": "dataPath('key')"
151
- },
152
201
  {
153
202
  "title": "function",
154
203
  "description": null,
155
204
  "name": null
156
205
  },
206
+ {
207
+ "title": "example",
208
+ "description": "dataPath('key')"
209
+ },
157
210
  {
158
211
  "title": "param",
159
212
  "description": "JSONPath referencing a point in `data`.",
@@ -188,15 +241,15 @@
188
241
  "description": null,
189
242
  "type": null
190
243
  },
191
- {
192
- "title": "example",
193
- "description": "dataValue('key')"
194
- },
195
244
  {
196
245
  "title": "function",
197
246
  "description": null,
198
247
  "name": null
199
248
  },
249
+ {
250
+ "title": "example",
251
+ "description": "dataValue('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": "lastReferenceValue('key')"
237
- },
238
287
  {
239
288
  "title": "function",
240
289
  "description": null,
241
290
  "name": null
242
291
  },
292
+ {
293
+ "title": "example",
294
+ "description": "lastReferenceValue('key')"
295
+ },
243
296
  {
244
297
  "title": "param",
245
298
  "description": "JSONPath referencing a point in `references`.",
@@ -275,15 +328,15 @@
275
328
  "description": null,
276
329
  "type": null
277
330
  },
278
- {
279
- "title": "example",
280
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
281
- },
282
331
  {
283
332
  "title": "function",
284
333
  "description": null,
285
334
  "name": null
286
335
  },
336
+ {
337
+ "title": "example",
338
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
339
+ },
287
340
  {
288
341
  "title": "param",
289
342
  "description": "JSONPath referencing a point in `state`.",
@@ -328,15 +381,15 @@
328
381
  "description": null,
329
382
  "type": null
330
383
  },
331
- {
332
- "title": "example",
333
- "description": "field('destination_field_name__c', 'value')"
334
- },
335
384
  {
336
385
  "title": "function",
337
386
  "description": null,
338
387
  "name": null
339
388
  },
389
+ {
390
+ "title": "example",
391
+ "description": "field('destination_field_name__c', 'value')"
392
+ },
340
393
  {
341
394
  "title": "param",
342
395
  "description": "Name of the field",
@@ -380,15 +433,15 @@
380
433
  "description": null,
381
434
  "type": null
382
435
  },
383
- {
384
- "title": "example",
385
- "description": "fields(list_of_fields)"
386
- },
387
436
  {
388
437
  "title": "function",
389
438
  "description": null,
390
439
  "name": null
391
440
  },
441
+ {
442
+ "title": "example",
443
+ "description": "fields(list_of_fields)"
444
+ },
392
445
  {
393
446
  "title": "param",
394
447
  "description": "a list of fields",
@@ -433,6 +486,11 @@
433
486
  "description": null,
434
487
  "name": null
435
488
  },
489
+ {
490
+ "title": "public",
491
+ "description": null,
492
+ "type": null
493
+ },
436
494
  {
437
495
  "title": "param",
438
496
  "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
  postMessage: () => postMessage,
@@ -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
  postMessage: () => postMessage,
@@ -132,6 +134,7 @@ var src_default = Adaptor_exports;
132
134
  field,
133
135
  fields,
134
136
  fn,
137
+ fnIf,
135
138
  lastReferenceValue,
136
139
  merge,
137
140
  postMessage,
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
  postMessage: () => postMessage,
@@ -32,6 +33,7 @@ import {
32
33
  fields,
33
34
  sourceValue,
34
35
  fn,
36
+ fnIf,
35
37
  alterState,
36
38
  each,
37
39
  merge,
@@ -110,6 +112,7 @@ export {
110
112
  field,
111
113
  fields,
112
114
  fn,
115
+ fnIf,
113
116
  lastReferenceValue,
114
117
  merge,
115
118
  postMessage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-facebook",
3
- "version": "0.3.3",
3
+ "version": "0.4.1",
4
4
  "description": "An Language Package for Facebook Messenger API",
5
5
  "main": "dist/index.cjs",
6
6
  "author": "Open Function Group",
@@ -12,8 +12,8 @@
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
19
  "@openfn/simple-ast": "0.4.1",
@@ -28,4 +28,4 @@ export function execute(...operations: Operations): Operation;
28
28
  * @returns {Operation}
29
29
  */
30
30
  export function postMessage(params: object): Operation;
31
- export { field, fields, sourceValue, fn, alterState, each, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
31
+ export { field, fields, sourceValue, fn, fnIf, alterState, each, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";