@openfn/language-http 6.2.3 → 6.4.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 +126 -1
- package/dist/index.cjs +6 -0
- package/dist/index.js +6 -0
- package/package.json +2 -2
- package/types/Adaptor.d.ts +1 -1
package/ast.json
CHANGED
|
@@ -502,6 +502,59 @@
|
|
|
502
502
|
},
|
|
503
503
|
"valid": true
|
|
504
504
|
},
|
|
505
|
+
{
|
|
506
|
+
"name": "fnIf",
|
|
507
|
+
"params": [
|
|
508
|
+
"condition",
|
|
509
|
+
"operation"
|
|
510
|
+
],
|
|
511
|
+
"docs": {
|
|
512
|
+
"description": "A custom operation that will only execute the function if the condition returns true",
|
|
513
|
+
"tags": [
|
|
514
|
+
{
|
|
515
|
+
"title": "public",
|
|
516
|
+
"description": null,
|
|
517
|
+
"type": null
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"title": "example",
|
|
521
|
+
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"title": "function",
|
|
525
|
+
"description": null,
|
|
526
|
+
"name": null
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"title": "param",
|
|
530
|
+
"description": "The condition that returns true",
|
|
531
|
+
"type": {
|
|
532
|
+
"type": "NameExpression",
|
|
533
|
+
"name": "Boolean"
|
|
534
|
+
},
|
|
535
|
+
"name": "condition"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"title": "param",
|
|
539
|
+
"description": "The operation needed to be executed.",
|
|
540
|
+
"type": {
|
|
541
|
+
"type": "NameExpression",
|
|
542
|
+
"name": "Operation"
|
|
543
|
+
},
|
|
544
|
+
"name": "operation"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"title": "returns",
|
|
548
|
+
"description": null,
|
|
549
|
+
"type": {
|
|
550
|
+
"type": "NameExpression",
|
|
551
|
+
"name": "Operation"
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
]
|
|
555
|
+
},
|
|
556
|
+
"valid": true
|
|
557
|
+
},
|
|
505
558
|
{
|
|
506
559
|
"name": "sourceValue",
|
|
507
560
|
"params": [
|
|
@@ -919,6 +972,78 @@
|
|
|
919
972
|
},
|
|
920
973
|
"valid": true
|
|
921
974
|
},
|
|
975
|
+
{
|
|
976
|
+
"name": "group",
|
|
977
|
+
"params": [
|
|
978
|
+
"arrayOfObjects",
|
|
979
|
+
"keyPath",
|
|
980
|
+
"callback"
|
|
981
|
+
],
|
|
982
|
+
"docs": {
|
|
983
|
+
"description": "Groups an array of objects by a specified key path.",
|
|
984
|
+
"tags": [
|
|
985
|
+
{
|
|
986
|
+
"title": "public",
|
|
987
|
+
"description": null,
|
|
988
|
+
"type": null
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
"title": "example",
|
|
992
|
+
"description": "const users = [\n { name: 'Alice', age: 25, city: 'New York' },\n { name: 'Bob', age: 30, city: 'San Francisco' },\n { name: 'Charlie', age: 25, city: 'New York' },\n { name: 'David', age: 30, city: 'San Francisco' }\n];\ngroup(users, 'city');\n// state is { data: { 'New York': [/Alice, Charlie/], 'San Francisco': [ /Bob, David / ] }"
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
"title": "function",
|
|
996
|
+
"description": null,
|
|
997
|
+
"name": null
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
"title": "param",
|
|
1001
|
+
"description": "The array of objects to be grouped.",
|
|
1002
|
+
"type": {
|
|
1003
|
+
"type": "TypeApplication",
|
|
1004
|
+
"expression": {
|
|
1005
|
+
"type": "NameExpression",
|
|
1006
|
+
"name": "Array"
|
|
1007
|
+
},
|
|
1008
|
+
"applications": [
|
|
1009
|
+
{
|
|
1010
|
+
"type": "NameExpression",
|
|
1011
|
+
"name": "Object"
|
|
1012
|
+
}
|
|
1013
|
+
]
|
|
1014
|
+
},
|
|
1015
|
+
"name": "arrayOfObjects"
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
"title": "param",
|
|
1019
|
+
"description": "The key path to group by.",
|
|
1020
|
+
"type": {
|
|
1021
|
+
"type": "NameExpression",
|
|
1022
|
+
"name": "string"
|
|
1023
|
+
},
|
|
1024
|
+
"name": "keyPath"
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
"title": "param",
|
|
1028
|
+
"description": "(Optional) Callback function",
|
|
1029
|
+
"type": {
|
|
1030
|
+
"type": "NameExpression",
|
|
1031
|
+
"name": "function"
|
|
1032
|
+
},
|
|
1033
|
+
"name": "callback"
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
"title": "returns",
|
|
1037
|
+
"description": null,
|
|
1038
|
+
"type": {
|
|
1039
|
+
"type": "NameExpression",
|
|
1040
|
+
"name": "Operation"
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
]
|
|
1044
|
+
},
|
|
1045
|
+
"valid": true
|
|
1046
|
+
},
|
|
922
1047
|
{
|
|
923
1048
|
"name": "arrayToString",
|
|
924
1049
|
"params": [
|
|
@@ -1312,7 +1437,7 @@
|
|
|
1312
1437
|
"options"
|
|
1313
1438
|
],
|
|
1314
1439
|
"docs": {
|
|
1315
|
-
"description": "Sets a cursor property on state.\nSupports natural language dates like `now`, `today`, `yesterday`, `n hours ago`, `n days ago`, and `start`,\nwhich will be converted relative to the environment (ie, the Lightning or CLI locale). Custom timezones
|
|
1440
|
+
"description": "Sets a cursor property on state.\nSupports natural language dates like `now`, `today`, `yesterday`, `n hours ago`, `n days ago`, and `start`,\nwhich will be converted relative to the environment (ie, the Lightning or CLI locale). Custom timezones\nare not yet supported.\nYou can provide a formatter to customise the final cursor value, which is useful for normalising\ndifferent inputs. The custom formatter runs after natural language date conversion.\nSee the usage guide at {@link https://docs.openfn.org/documentation/jobs/job-writing-guide#using-cursors}",
|
|
1316
1441
|
"tags": [
|
|
1317
1442
|
{
|
|
1318
1443
|
"title": "public",
|
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,9 @@ __export(src_exports, {
|
|
|
40
40
|
field: () => import_language_common3.field,
|
|
41
41
|
fields: () => import_language_common3.fields,
|
|
42
42
|
fn: () => import_language_common3.fn,
|
|
43
|
+
fnIf: () => import_language_common3.fnIf,
|
|
43
44
|
get: () => get,
|
|
45
|
+
group: () => import_language_common3.group,
|
|
44
46
|
humanProper: () => import_language_common3.humanProper,
|
|
45
47
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
46
48
|
merge: () => import_language_common3.merge,
|
|
@@ -74,7 +76,9 @@ __export(Adaptor_exports, {
|
|
|
74
76
|
field: () => import_language_common3.field,
|
|
75
77
|
fields: () => import_language_common3.fields,
|
|
76
78
|
fn: () => import_language_common3.fn,
|
|
79
|
+
fnIf: () => import_language_common3.fnIf,
|
|
77
80
|
get: () => get,
|
|
81
|
+
group: () => import_language_common3.group,
|
|
78
82
|
humanProper: () => import_language_common3.humanProper,
|
|
79
83
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
80
84
|
merge: () => import_language_common3.merge,
|
|
@@ -231,7 +235,9 @@ var src_default = Adaptor_exports;
|
|
|
231
235
|
field,
|
|
232
236
|
fields,
|
|
233
237
|
fn,
|
|
238
|
+
fnIf,
|
|
234
239
|
get,
|
|
240
|
+
group,
|
|
235
241
|
humanProper,
|
|
236
242
|
lastReferenceValue,
|
|
237
243
|
merge,
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,9 @@ __export(Adaptor_exports, {
|
|
|
21
21
|
field: () => field,
|
|
22
22
|
fields: () => fields,
|
|
23
23
|
fn: () => fn,
|
|
24
|
+
fnIf: () => fnIf,
|
|
24
25
|
get: () => get,
|
|
26
|
+
group: () => group,
|
|
25
27
|
humanProper: () => humanProper,
|
|
26
28
|
lastReferenceValue: () => lastReferenceValue,
|
|
27
29
|
merge: () => merge,
|
|
@@ -145,7 +147,9 @@ import {
|
|
|
145
147
|
field,
|
|
146
148
|
fields,
|
|
147
149
|
fn,
|
|
150
|
+
fnIf,
|
|
148
151
|
chunk,
|
|
152
|
+
group,
|
|
149
153
|
humanProper,
|
|
150
154
|
lastReferenceValue,
|
|
151
155
|
merge,
|
|
@@ -204,7 +208,9 @@ export {
|
|
|
204
208
|
field,
|
|
205
209
|
fields,
|
|
206
210
|
fn,
|
|
211
|
+
fnIf,
|
|
207
212
|
get,
|
|
213
|
+
group,
|
|
208
214
|
humanProper,
|
|
209
215
|
lastReferenceValue,
|
|
210
216
|
merge,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-http",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "An HTTP request language package for use with Open Function",
|
|
5
5
|
"homepage": "https://docs.openfn.org",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"cheerio": "1.0.0-rc.12",
|
|
29
29
|
"cheerio-tableparser": "^1.0.1",
|
|
30
|
-
"@openfn/language-common": "1.
|
|
30
|
+
"@openfn/language-common": "1.15.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@openfn/simple-ast": "0.4.1",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -179,4 +179,4 @@ export type RequestOptions = {
|
|
|
179
179
|
*/
|
|
180
180
|
tls: object;
|
|
181
181
|
};
|
|
182
|
-
export { alterState, arrayToString, combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, chunk, humanProper, lastReferenceValue, merge, scrubEmojis, sourceValue, splitKeys, toArray, parseCsv } from "@openfn/language-common";
|
|
182
|
+
export { alterState, arrayToString, combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, chunk, group, humanProper, lastReferenceValue, merge, scrubEmojis, sourceValue, splitKeys, toArray, parseCsv } from "@openfn/language-common";
|