@openfn/language-godata 3.4.0 → 3.5.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
@@ -849,27 +849,123 @@
849
849
  "exports": [],
850
850
  "common": [
851
851
  {
852
- "name": "sourceValue",
852
+ "name": "fn",
853
853
  "params": [
854
- "path"
854
+ "func"
855
855
  ],
856
856
  "docs": {
857
- "description": "Picks out a single value from source data.\nIf a JSONPath returns more than one value for the reference, the first\nitem will be returned.",
857
+ "description": "Creates a custom step (or operation) for more flexible job writing.",
858
858
  "tags": [
859
859
  {
860
860
  "title": "public",
861
861
  "description": null,
862
862
  "type": null
863
863
  },
864
+ {
865
+ "title": "function",
866
+ "description": null,
867
+ "name": null
868
+ },
864
869
  {
865
870
  "title": "example",
866
- "description": "sourceValue('$.key')"
871
+ "description": "fn(state => {\n // do some things to state\n return state;\n});"
872
+ },
873
+ {
874
+ "title": "param",
875
+ "description": "is the function",
876
+ "type": {
877
+ "type": "NameExpression",
878
+ "name": "Function"
879
+ },
880
+ "name": "func"
881
+ },
882
+ {
883
+ "title": "returns",
884
+ "description": null,
885
+ "type": {
886
+ "type": "NameExpression",
887
+ "name": "Operation"
888
+ }
889
+ }
890
+ ]
891
+ },
892
+ "valid": true
893
+ },
894
+ {
895
+ "name": "fnIf",
896
+ "params": [
897
+ "condition",
898
+ "operation"
899
+ ],
900
+ "docs": {
901
+ "description": "A custom operation that will only execute the function if the condition returns true",
902
+ "tags": [
903
+ {
904
+ "title": "public",
905
+ "description": null,
906
+ "type": null
907
+ },
908
+ {
909
+ "title": "function",
910
+ "description": null,
911
+ "name": null
912
+ },
913
+ {
914
+ "title": "example",
915
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
916
+ },
917
+ {
918
+ "title": "param",
919
+ "description": "The condition that returns true",
920
+ "type": {
921
+ "type": "NameExpression",
922
+ "name": "Boolean"
923
+ },
924
+ "name": "condition"
925
+ },
926
+ {
927
+ "title": "param",
928
+ "description": "The operation needed to be executed.",
929
+ "type": {
930
+ "type": "NameExpression",
931
+ "name": "Operation"
932
+ },
933
+ "name": "operation"
934
+ },
935
+ {
936
+ "title": "returns",
937
+ "description": null,
938
+ "type": {
939
+ "type": "NameExpression",
940
+ "name": "Operation"
941
+ }
942
+ }
943
+ ]
944
+ },
945
+ "valid": true
946
+ },
947
+ {
948
+ "name": "sourceValue",
949
+ "params": [
950
+ "path"
951
+ ],
952
+ "docs": {
953
+ "description": "Picks out a single value from source data.\nIf a JSONPath returns more than one value for the reference, the first\nitem will be returned.",
954
+ "tags": [
955
+ {
956
+ "title": "public",
957
+ "description": null,
958
+ "type": null
867
959
  },
868
960
  {
869
961
  "title": "function",
870
962
  "description": null,
871
963
  "name": null
872
964
  },
965
+ {
966
+ "title": "example",
967
+ "description": "sourceValue('$.key')"
968
+ },
873
969
  {
874
970
  "title": "param",
875
971
  "description": "JSONPath referencing a point in `state`.",
@@ -904,15 +1000,15 @@
904
1000
  "description": null,
905
1001
  "type": null
906
1002
  },
907
- {
908
- "title": "example",
909
- "description": "dataPath('key')"
910
- },
911
1003
  {
912
1004
  "title": "function",
913
1005
  "description": null,
914
1006
  "name": null
915
1007
  },
1008
+ {
1009
+ "title": "example",
1010
+ "description": "dataPath('key')"
1011
+ },
916
1012
  {
917
1013
  "title": "param",
918
1014
  "description": "JSONPath referencing a point in `data`.",
@@ -947,15 +1043,15 @@
947
1043
  "description": null,
948
1044
  "type": null
949
1045
  },
950
- {
951
- "title": "example",
952
- "description": "dataValue('key')"
953
- },
954
1046
  {
955
1047
  "title": "function",
956
1048
  "description": null,
957
1049
  "name": null
958
1050
  },
1051
+ {
1052
+ "title": "example",
1053
+ "description": "dataValue('key')"
1054
+ },
959
1055
  {
960
1056
  "title": "param",
961
1057
  "description": "JSONPath referencing a point in `data`.",
@@ -990,15 +1086,15 @@
990
1086
  "description": null,
991
1087
  "type": null
992
1088
  },
993
- {
994
- "title": "example",
995
- "description": "lastReferenceValue('key')"
996
- },
997
1089
  {
998
1090
  "title": "function",
999
1091
  "description": null,
1000
1092
  "name": null
1001
1093
  },
1094
+ {
1095
+ "title": "example",
1096
+ "description": "lastReferenceValue('key')"
1097
+ },
1002
1098
  {
1003
1099
  "title": "param",
1004
1100
  "description": "JSONPath referencing a point in `references`.",
@@ -1034,15 +1130,15 @@
1034
1130
  "description": null,
1035
1131
  "type": null
1036
1132
  },
1037
- {
1038
- "title": "example",
1039
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
1040
- },
1041
1133
  {
1042
1134
  "title": "function",
1043
1135
  "description": null,
1044
1136
  "name": null
1045
1137
  },
1138
+ {
1139
+ "title": "example",
1140
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
1141
+ },
1046
1142
  {
1047
1143
  "title": "param",
1048
1144
  "description": "JSONPath referencing a point in `state`.",
@@ -1087,15 +1183,15 @@
1087
1183
  "description": null,
1088
1184
  "type": null
1089
1185
  },
1090
- {
1091
- "title": "example",
1092
- "description": "field('destination_field_name__c', 'value')"
1093
- },
1094
1186
  {
1095
1187
  "title": "function",
1096
1188
  "description": null,
1097
1189
  "name": null
1098
1190
  },
1191
+ {
1192
+ "title": "example",
1193
+ "description": "field('destination_field_name__c', 'value')"
1194
+ },
1099
1195
  {
1100
1196
  "title": "param",
1101
1197
  "description": "Name of the field",
@@ -1139,15 +1235,15 @@
1139
1235
  "description": null,
1140
1236
  "type": null
1141
1237
  },
1142
- {
1143
- "title": "example",
1144
- "description": "fields(list_of_fields)"
1145
- },
1146
1238
  {
1147
1239
  "title": "function",
1148
1240
  "description": null,
1149
1241
  "name": null
1150
1242
  },
1243
+ {
1244
+ "title": "example",
1245
+ "description": "fields(list_of_fields)"
1246
+ },
1151
1247
  {
1152
1248
  "title": "param",
1153
1249
  "description": "a list of fields",
@@ -1192,6 +1288,11 @@
1192
1288
  "description": null,
1193
1289
  "name": null
1194
1290
  },
1291
+ {
1292
+ "title": "public",
1293
+ "description": null,
1294
+ "type": null
1295
+ },
1195
1296
  {
1196
1297
  "title": "param",
1197
1298
  "description": null,
package/dist/index.cjs CHANGED
@@ -34,6 +34,8 @@ __export(src_exports, {
34
34
  execute: () => execute,
35
35
  field: () => import_language_common2.field,
36
36
  fields: () => import_language_common2.fields,
37
+ fn: () => import_language_common2.fn,
38
+ fnIf: () => import_language_common2.fnIf,
37
39
  getCase: () => getCase,
38
40
  getContact: () => getContact,
39
41
  getLocation: () => getLocation,
@@ -66,6 +68,8 @@ __export(Adaptor_exports, {
66
68
  execute: () => execute,
67
69
  field: () => import_language_common2.field,
68
70
  fields: () => import_language_common2.fields,
71
+ fn: () => import_language_common2.fn,
72
+ fnIf: () => import_language_common2.fnIf,
69
73
  getCase: () => getCase,
70
74
  getContact: () => getContact,
71
75
  getLocation: () => getLocation,
@@ -657,6 +661,8 @@ var src_default = Adaptor_exports;
657
661
  execute,
658
662
  field,
659
663
  fields,
664
+ fn,
665
+ fnIf,
660
666
  getCase,
661
667
  getContact,
662
668
  getLocation,
package/dist/index.js CHANGED
@@ -15,6 +15,8 @@ __export(Adaptor_exports, {
15
15
  execute: () => execute,
16
16
  field: () => field,
17
17
  fields: () => fields,
18
+ fn: () => fn,
19
+ fnIf: () => fnIf,
18
20
  getCase: () => getCase,
19
21
  getContact: () => getContact,
20
22
  getLocation: () => getLocation,
@@ -41,6 +43,8 @@ import {
41
43
  } from "@openfn/language-common";
42
44
  import axios from "axios";
43
45
  import {
46
+ fn,
47
+ fnIf,
44
48
  alterState,
45
49
  dataPath,
46
50
  dataValue,
@@ -620,6 +624,8 @@ export {
620
624
  execute,
621
625
  field,
622
626
  fields,
627
+ fn,
628
+ fnIf,
623
629
  getCase,
624
630
  getContact,
625
631
  getLocation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-godata",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
4
4
  "description": "An OpenFn adaptor for use with the WHO's GoData API",
5
5
  "main": "dist/index.cjs",
6
6
  "author": "Open Function Group",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "dependencies": {
15
15
  "axios": "^0.21.2",
16
- "@openfn/language-common": "^1.8.1"
16
+ "@openfn/language-common": "^2.0.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "assertion-error": "^1.0.1",
@@ -23,7 +23,6 @@
23
23
  "nock": "^12.0.3",
24
24
  "sinon": "^1.17.2",
25
25
  "esno": "^0.16.3",
26
- "@openfn/buildtools": "^1.0.1",
27
26
  "@openfn/simple-ast": "0.4.1",
28
27
  "rimraf": "^3.0.2"
29
28
  },
@@ -235,4 +235,4 @@ export function getReferenceData(query: object, callback: Function): Operation;
235
235
  export function upsertReferenceData(externalId: string, goDataReferenceData: object, callback: Function): Operation;
236
236
  export { axios };
237
237
  import axios from "axios";
238
- export { alterState, dataPath, dataValue, each, field, fields, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
238
+ export { fn, fnIf, alterState, dataPath, dataValue, each, field, fields, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";