@openfn/language-commcare 2.1.0 → 2.2.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 CHANGED
@@ -353,6 +353,59 @@
353
353
  },
354
354
  "valid": true
355
355
  },
356
+ {
357
+ "name": "fnIf",
358
+ "params": [
359
+ "condition",
360
+ "operation"
361
+ ],
362
+ "docs": {
363
+ "description": "A custom operation that will only execute the function if the condition returns true",
364
+ "tags": [
365
+ {
366
+ "title": "public",
367
+ "description": null,
368
+ "type": null
369
+ },
370
+ {
371
+ "title": "example",
372
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
373
+ },
374
+ {
375
+ "title": "function",
376
+ "description": null,
377
+ "name": null
378
+ },
379
+ {
380
+ "title": "param",
381
+ "description": "The condition that returns true",
382
+ "type": {
383
+ "type": "NameExpression",
384
+ "name": "Boolean"
385
+ },
386
+ "name": "condition"
387
+ },
388
+ {
389
+ "title": "param",
390
+ "description": "The operation needed to be executed.",
391
+ "type": {
392
+ "type": "NameExpression",
393
+ "name": "Operation"
394
+ },
395
+ "name": "operation"
396
+ },
397
+ {
398
+ "title": "returns",
399
+ "description": null,
400
+ "type": {
401
+ "type": "NameExpression",
402
+ "name": "Operation"
403
+ }
404
+ }
405
+ ]
406
+ },
407
+ "valid": true
408
+ },
356
409
  {
357
410
  "name": "sourceValue",
358
411
  "params": [
package/dist/index.cjs CHANGED
@@ -37,6 +37,7 @@ __export(src_exports, {
37
37
  field: () => import_language_common3.field,
38
38
  fields: () => import_language_common3.fields,
39
39
  fn: () => import_language_common3.fn,
40
+ fnIf: () => import_language_common3.fnIf,
40
41
  get: () => get,
41
42
  http: () => import_language_common3.http,
42
43
  lastReferenceValue: () => import_language_common3.lastReferenceValue,
@@ -62,6 +63,7 @@ __export(Adaptor_exports, {
62
63
  field: () => import_language_common3.field,
63
64
  fields: () => import_language_common3.fields,
64
65
  fn: () => import_language_common3.fn,
66
+ fnIf: () => import_language_common3.fnIf,
65
67
  get: () => get,
66
68
  http: () => import_language_common3.http,
67
69
  lastReferenceValue: () => import_language_common3.lastReferenceValue,
@@ -270,6 +272,7 @@ var src_default = Adaptor_exports;
270
272
  field,
271
273
  fields,
272
274
  fn,
275
+ fnIf,
273
276
  get,
274
277
  http,
275
278
  lastReferenceValue,
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ __export(Adaptor_exports, {
18
18
  field: () => field,
19
19
  fields: () => fields,
20
20
  fn: () => fn,
21
+ fnIf: () => fnIf,
21
22
  get: () => get,
22
23
  http: () => http,
23
24
  lastReferenceValue: () => lastReferenceValue,
@@ -90,6 +91,7 @@ async function request(configuration, path, opts) {
90
91
  // src/Adaptor.js
91
92
  import {
92
93
  fn,
94
+ fnIf,
93
95
  alterState,
94
96
  arrayToString,
95
97
  combine,
@@ -244,6 +246,7 @@ export {
244
246
  field,
245
247
  fields,
246
248
  fn,
249
+ fnIf,
247
250
  get,
248
251
  http,
249
252
  lastReferenceValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-commcare",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Commcare Language Pack for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "lodash-fp": "^0.10.4",
23
23
  "sinon": "^18.0.0",
24
24
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz",
25
- "@openfn/language-common": "1.13.5"
25
+ "@openfn/language-common": "1.14.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@openfn/simple-ast": "^0.4.1",
@@ -185,4 +185,4 @@ export type RequestOptions = {
185
185
  */
186
186
  create_new_cases: string;
187
187
  };
188
- export { fn, alterState, arrayToString, combine, dataPath, dataValue, each, field, fields, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
188
+ export { fn, fnIf, alterState, arrayToString, combine, dataPath, dataValue, each, field, fields, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";