@openfn/language-http 6.3.0 → 6.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 +286 -65
- package/dist/index.cjs +3 -0
- package/dist/index.js +3 -0
- package/package.json +2 -2
- package/types/Adaptor.d.ts +29 -30
package/ast.json
CHANGED
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
{
|
|
2
2
|
"operations": [
|
|
3
|
+
{
|
|
4
|
+
"name": "execute",
|
|
5
|
+
"params": [
|
|
6
|
+
"operations"
|
|
7
|
+
],
|
|
8
|
+
"docs": {
|
|
9
|
+
"description": "Options provided to the HTTP request",
|
|
10
|
+
"tags": [
|
|
11
|
+
{
|
|
12
|
+
"title": "typedef",
|
|
13
|
+
"description": null,
|
|
14
|
+
"type": {
|
|
15
|
+
"type": "NameExpression",
|
|
16
|
+
"name": "Object"
|
|
17
|
+
},
|
|
18
|
+
"name": "RequestOptions"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"title": "public",
|
|
22
|
+
"description": null,
|
|
23
|
+
"type": null
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"title": "property",
|
|
27
|
+
"description": "body data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request).",
|
|
28
|
+
"type": {
|
|
29
|
+
"type": "UnionType",
|
|
30
|
+
"elements": [
|
|
31
|
+
{
|
|
32
|
+
"type": "NameExpression",
|
|
33
|
+
"name": "object"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "NameExpression",
|
|
37
|
+
"name": "string"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"name": "body"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"title": "property",
|
|
45
|
+
"description": "Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Pass `false` to suppress errors for this code.",
|
|
46
|
+
"type": {
|
|
47
|
+
"type": "NameExpression",
|
|
48
|
+
"name": "object"
|
|
49
|
+
},
|
|
50
|
+
"name": "errors"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"title": "property",
|
|
54
|
+
"description": "Pass a JSON object to be serialised into a multipart HTML form (as FormData) in the body.",
|
|
55
|
+
"type": {
|
|
56
|
+
"type": "NameExpression",
|
|
57
|
+
"name": "object"
|
|
58
|
+
},
|
|
59
|
+
"name": "form"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"title": "property",
|
|
63
|
+
"description": "An object of query parameters to be encoded into the URL.",
|
|
64
|
+
"type": {
|
|
65
|
+
"type": "NameExpression",
|
|
66
|
+
"name": "object"
|
|
67
|
+
},
|
|
68
|
+
"name": "query"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"title": "property",
|
|
72
|
+
"description": "An object of headers to append to the request.",
|
|
73
|
+
"type": {
|
|
74
|
+
"type": "NameExpression",
|
|
75
|
+
"name": "object"
|
|
76
|
+
},
|
|
77
|
+
"name": "headers"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"title": "property",
|
|
81
|
+
"description": "Parse the response body as json, text or stream. By default will use the response headers.",
|
|
82
|
+
"type": {
|
|
83
|
+
"type": "NameExpression",
|
|
84
|
+
"name": "string"
|
|
85
|
+
},
|
|
86
|
+
"name": "parseAs"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"title": "property",
|
|
90
|
+
"description": "Request timeout in ms. Default: 300 seconds.",
|
|
91
|
+
"type": {
|
|
92
|
+
"type": "NameExpression",
|
|
93
|
+
"name": "number"
|
|
94
|
+
},
|
|
95
|
+
"name": "timeout"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"title": "property",
|
|
99
|
+
"description": "TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions",
|
|
100
|
+
"type": {
|
|
101
|
+
"type": "NameExpression",
|
|
102
|
+
"name": "object"
|
|
103
|
+
},
|
|
104
|
+
"name": "tls"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"valid": false
|
|
109
|
+
},
|
|
3
110
|
{
|
|
4
111
|
"name": "request",
|
|
5
112
|
"params": [
|
|
@@ -61,6 +168,10 @@
|
|
|
61
168
|
},
|
|
62
169
|
"name": "callback"
|
|
63
170
|
},
|
|
171
|
+
{
|
|
172
|
+
"title": "state",
|
|
173
|
+
"description": "{HttpState}"
|
|
174
|
+
},
|
|
64
175
|
{
|
|
65
176
|
"title": "returns",
|
|
66
177
|
"description": null,
|
|
@@ -124,6 +235,10 @@
|
|
|
124
235
|
},
|
|
125
236
|
"name": "callback"
|
|
126
237
|
},
|
|
238
|
+
{
|
|
239
|
+
"title": "state",
|
|
240
|
+
"description": "{HttpState}"
|
|
241
|
+
},
|
|
127
242
|
{
|
|
128
243
|
"title": "returns",
|
|
129
244
|
"description": null,
|
|
@@ -187,6 +302,10 @@
|
|
|
187
302
|
},
|
|
188
303
|
"name": "callback"
|
|
189
304
|
},
|
|
305
|
+
{
|
|
306
|
+
"title": "state",
|
|
307
|
+
"description": "{HttpState}"
|
|
308
|
+
},
|
|
190
309
|
{
|
|
191
310
|
"title": "returns",
|
|
192
311
|
"description": null,
|
|
@@ -250,6 +369,10 @@
|
|
|
250
369
|
},
|
|
251
370
|
"name": "callback"
|
|
252
371
|
},
|
|
372
|
+
{
|
|
373
|
+
"title": "state",
|
|
374
|
+
"description": "{HttpState}"
|
|
375
|
+
},
|
|
253
376
|
{
|
|
254
377
|
"title": "returns",
|
|
255
378
|
"description": null,
|
|
@@ -313,6 +436,10 @@
|
|
|
313
436
|
},
|
|
314
437
|
"name": "callback"
|
|
315
438
|
},
|
|
439
|
+
{
|
|
440
|
+
"title": "state",
|
|
441
|
+
"description": "{HttpState}"
|
|
442
|
+
},
|
|
316
443
|
{
|
|
317
444
|
"title": "returns",
|
|
318
445
|
"description": null,
|
|
@@ -376,6 +503,10 @@
|
|
|
376
503
|
},
|
|
377
504
|
"name": "callback"
|
|
378
505
|
},
|
|
506
|
+
{
|
|
507
|
+
"title": "state",
|
|
508
|
+
"description": "{HttpState}"
|
|
509
|
+
},
|
|
379
510
|
{
|
|
380
511
|
"title": "returns",
|
|
381
512
|
"description": null,
|
|
@@ -444,6 +575,14 @@
|
|
|
444
575
|
},
|
|
445
576
|
"name": "callback"
|
|
446
577
|
},
|
|
578
|
+
{
|
|
579
|
+
"title": "state",
|
|
580
|
+
"description": "data - the parsed XML as a JSON object"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"title": "state",
|
|
584
|
+
"description": "references - an array of all previous data objects used in the Job"
|
|
585
|
+
},
|
|
447
586
|
{
|
|
448
587
|
"title": "returns",
|
|
449
588
|
"description": null,
|
|
@@ -472,15 +611,15 @@
|
|
|
472
611
|
"description": null,
|
|
473
612
|
"type": null
|
|
474
613
|
},
|
|
475
|
-
{
|
|
476
|
-
"title": "example",
|
|
477
|
-
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
478
|
-
},
|
|
479
614
|
{
|
|
480
615
|
"title": "function",
|
|
481
616
|
"description": null,
|
|
482
617
|
"name": null
|
|
483
618
|
},
|
|
619
|
+
{
|
|
620
|
+
"title": "example",
|
|
621
|
+
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
622
|
+
},
|
|
484
623
|
{
|
|
485
624
|
"title": "param",
|
|
486
625
|
"description": "is the function",
|
|
@@ -516,15 +655,15 @@
|
|
|
516
655
|
"description": null,
|
|
517
656
|
"type": null
|
|
518
657
|
},
|
|
519
|
-
{
|
|
520
|
-
"title": "example",
|
|
521
|
-
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
522
|
-
},
|
|
523
658
|
{
|
|
524
659
|
"title": "function",
|
|
525
660
|
"description": null,
|
|
526
661
|
"name": null
|
|
527
662
|
},
|
|
663
|
+
{
|
|
664
|
+
"title": "example",
|
|
665
|
+
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
666
|
+
},
|
|
528
667
|
{
|
|
529
668
|
"title": "param",
|
|
530
669
|
"description": "The condition that returns true",
|
|
@@ -568,15 +707,15 @@
|
|
|
568
707
|
"description": null,
|
|
569
708
|
"type": null
|
|
570
709
|
},
|
|
571
|
-
{
|
|
572
|
-
"title": "example",
|
|
573
|
-
"description": "sourceValue('$.key')"
|
|
574
|
-
},
|
|
575
710
|
{
|
|
576
711
|
"title": "function",
|
|
577
712
|
"description": null,
|
|
578
713
|
"name": null
|
|
579
714
|
},
|
|
715
|
+
{
|
|
716
|
+
"title": "example",
|
|
717
|
+
"description": "sourceValue('$.key')"
|
|
718
|
+
},
|
|
580
719
|
{
|
|
581
720
|
"title": "param",
|
|
582
721
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -611,15 +750,15 @@
|
|
|
611
750
|
"description": null,
|
|
612
751
|
"type": null
|
|
613
752
|
},
|
|
614
|
-
{
|
|
615
|
-
"title": "example",
|
|
616
|
-
"description": "dataPath('key')"
|
|
617
|
-
},
|
|
618
753
|
{
|
|
619
754
|
"title": "function",
|
|
620
755
|
"description": null,
|
|
621
756
|
"name": null
|
|
622
757
|
},
|
|
758
|
+
{
|
|
759
|
+
"title": "example",
|
|
760
|
+
"description": "dataPath('key')"
|
|
761
|
+
},
|
|
623
762
|
{
|
|
624
763
|
"title": "param",
|
|
625
764
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -654,15 +793,15 @@
|
|
|
654
793
|
"description": null,
|
|
655
794
|
"type": null
|
|
656
795
|
},
|
|
657
|
-
{
|
|
658
|
-
"title": "example",
|
|
659
|
-
"description": "dataValue('key')"
|
|
660
|
-
},
|
|
661
796
|
{
|
|
662
797
|
"title": "function",
|
|
663
798
|
"description": null,
|
|
664
799
|
"name": null
|
|
665
800
|
},
|
|
801
|
+
{
|
|
802
|
+
"title": "example",
|
|
803
|
+
"description": "dataValue('key')"
|
|
804
|
+
},
|
|
666
805
|
{
|
|
667
806
|
"title": "param",
|
|
668
807
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -697,15 +836,15 @@
|
|
|
697
836
|
"description": null,
|
|
698
837
|
"type": null
|
|
699
838
|
},
|
|
700
|
-
{
|
|
701
|
-
"title": "example",
|
|
702
|
-
"description": "lastReferenceValue('key')"
|
|
703
|
-
},
|
|
704
839
|
{
|
|
705
840
|
"title": "function",
|
|
706
841
|
"description": null,
|
|
707
842
|
"name": null
|
|
708
843
|
},
|
|
844
|
+
{
|
|
845
|
+
"title": "example",
|
|
846
|
+
"description": "lastReferenceValue('key')"
|
|
847
|
+
},
|
|
709
848
|
{
|
|
710
849
|
"title": "param",
|
|
711
850
|
"description": "JSONPath referencing a point in `references`.",
|
|
@@ -741,15 +880,15 @@
|
|
|
741
880
|
"description": null,
|
|
742
881
|
"type": null
|
|
743
882
|
},
|
|
744
|
-
{
|
|
745
|
-
"title": "example",
|
|
746
|
-
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
747
|
-
},
|
|
748
883
|
{
|
|
749
884
|
"title": "function",
|
|
750
885
|
"description": null,
|
|
751
886
|
"name": null
|
|
752
887
|
},
|
|
888
|
+
{
|
|
889
|
+
"title": "example",
|
|
890
|
+
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
891
|
+
},
|
|
753
892
|
{
|
|
754
893
|
"title": "param",
|
|
755
894
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -793,15 +932,15 @@
|
|
|
793
932
|
"description": null,
|
|
794
933
|
"type": null
|
|
795
934
|
},
|
|
796
|
-
{
|
|
797
|
-
"title": "example",
|
|
798
|
-
"description": "combine(\n create('foo'),\n delete('bar')\n)"
|
|
799
|
-
},
|
|
800
935
|
{
|
|
801
936
|
"title": "function",
|
|
802
937
|
"description": null,
|
|
803
938
|
"name": null
|
|
804
939
|
},
|
|
940
|
+
{
|
|
941
|
+
"title": "example",
|
|
942
|
+
"description": "combine(\n create('foo'),\n delete('bar')\n)"
|
|
943
|
+
},
|
|
805
944
|
{
|
|
806
945
|
"title": "param",
|
|
807
946
|
"description": "Operations to be performed.",
|
|
@@ -837,15 +976,15 @@
|
|
|
837
976
|
"description": null,
|
|
838
977
|
"type": null
|
|
839
978
|
},
|
|
840
|
-
{
|
|
841
|
-
"title": "example",
|
|
842
|
-
"description": "field('destination_field_name__c', 'value')"
|
|
843
|
-
},
|
|
844
979
|
{
|
|
845
980
|
"title": "function",
|
|
846
981
|
"description": null,
|
|
847
982
|
"name": null
|
|
848
983
|
},
|
|
984
|
+
{
|
|
985
|
+
"title": "example",
|
|
986
|
+
"description": "field('destination_field_name__c', 'value')"
|
|
987
|
+
},
|
|
849
988
|
{
|
|
850
989
|
"title": "param",
|
|
851
990
|
"description": "Name of the field",
|
|
@@ -889,15 +1028,15 @@
|
|
|
889
1028
|
"description": null,
|
|
890
1029
|
"type": null
|
|
891
1030
|
},
|
|
892
|
-
{
|
|
893
|
-
"title": "example",
|
|
894
|
-
"description": "fields(list_of_fields)"
|
|
895
|
-
},
|
|
896
1031
|
{
|
|
897
1032
|
"title": "function",
|
|
898
1033
|
"description": null,
|
|
899
1034
|
"name": null
|
|
900
1035
|
},
|
|
1036
|
+
{
|
|
1037
|
+
"title": "example",
|
|
1038
|
+
"description": "fields(list_of_fields)"
|
|
1039
|
+
},
|
|
901
1040
|
{
|
|
902
1041
|
"title": "param",
|
|
903
1042
|
"description": "a list of fields",
|
|
@@ -942,6 +1081,11 @@
|
|
|
942
1081
|
"description": null,
|
|
943
1082
|
"name": null
|
|
944
1083
|
},
|
|
1084
|
+
{
|
|
1085
|
+
"title": "public",
|
|
1086
|
+
"description": null,
|
|
1087
|
+
"type": null
|
|
1088
|
+
},
|
|
945
1089
|
{
|
|
946
1090
|
"title": "param",
|
|
947
1091
|
"description": null,
|
|
@@ -972,6 +1116,83 @@
|
|
|
972
1116
|
},
|
|
973
1117
|
"valid": true
|
|
974
1118
|
},
|
|
1119
|
+
{
|
|
1120
|
+
"name": "group",
|
|
1121
|
+
"params": [
|
|
1122
|
+
"arrayOfObjects",
|
|
1123
|
+
"keyPath",
|
|
1124
|
+
"callback"
|
|
1125
|
+
],
|
|
1126
|
+
"docs": {
|
|
1127
|
+
"description": "Groups an array of objects by a specified key path.",
|
|
1128
|
+
"tags": [
|
|
1129
|
+
{
|
|
1130
|
+
"title": "public",
|
|
1131
|
+
"description": null,
|
|
1132
|
+
"type": null
|
|
1133
|
+
},
|
|
1134
|
+
{
|
|
1135
|
+
"title": "example",
|
|
1136
|
+
"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 / ] }"
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
"title": "function",
|
|
1140
|
+
"description": null,
|
|
1141
|
+
"name": null
|
|
1142
|
+
},
|
|
1143
|
+
{
|
|
1144
|
+
"title": "public",
|
|
1145
|
+
"description": null,
|
|
1146
|
+
"type": null
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
"title": "param",
|
|
1150
|
+
"description": "The array of objects to be grouped.",
|
|
1151
|
+
"type": {
|
|
1152
|
+
"type": "TypeApplication",
|
|
1153
|
+
"expression": {
|
|
1154
|
+
"type": "NameExpression",
|
|
1155
|
+
"name": "Array"
|
|
1156
|
+
},
|
|
1157
|
+
"applications": [
|
|
1158
|
+
{
|
|
1159
|
+
"type": "NameExpression",
|
|
1160
|
+
"name": "Object"
|
|
1161
|
+
}
|
|
1162
|
+
]
|
|
1163
|
+
},
|
|
1164
|
+
"name": "arrayOfObjects"
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
"title": "param",
|
|
1168
|
+
"description": "The key path to group by.",
|
|
1169
|
+
"type": {
|
|
1170
|
+
"type": "NameExpression",
|
|
1171
|
+
"name": "string"
|
|
1172
|
+
},
|
|
1173
|
+
"name": "keyPath"
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
"title": "param",
|
|
1177
|
+
"description": "(Optional) Callback function",
|
|
1178
|
+
"type": {
|
|
1179
|
+
"type": "NameExpression",
|
|
1180
|
+
"name": "function"
|
|
1181
|
+
},
|
|
1182
|
+
"name": "callback"
|
|
1183
|
+
},
|
|
1184
|
+
{
|
|
1185
|
+
"title": "returns",
|
|
1186
|
+
"description": null,
|
|
1187
|
+
"type": {
|
|
1188
|
+
"type": "NameExpression",
|
|
1189
|
+
"name": "Operation"
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
]
|
|
1193
|
+
},
|
|
1194
|
+
"valid": true
|
|
1195
|
+
},
|
|
975
1196
|
{
|
|
976
1197
|
"name": "arrayToString",
|
|
977
1198
|
"params": [
|
|
@@ -986,15 +1207,15 @@
|
|
|
986
1207
|
"description": null,
|
|
987
1208
|
"type": null
|
|
988
1209
|
},
|
|
989
|
-
{
|
|
990
|
-
"title": "example",
|
|
991
|
-
"description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
|
|
992
|
-
},
|
|
993
1210
|
{
|
|
994
1211
|
"title": "function",
|
|
995
1212
|
"description": null,
|
|
996
1213
|
"name": null
|
|
997
1214
|
},
|
|
1215
|
+
{
|
|
1216
|
+
"title": "example",
|
|
1217
|
+
"description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
|
|
1218
|
+
},
|
|
998
1219
|
{
|
|
999
1220
|
"title": "param",
|
|
1000
1221
|
"description": "Array of toString'able primatives.",
|
|
@@ -1038,15 +1259,15 @@
|
|
|
1038
1259
|
"description": null,
|
|
1039
1260
|
"type": null
|
|
1040
1261
|
},
|
|
1041
|
-
{
|
|
1042
|
-
"title": "example",
|
|
1043
|
-
"description": "each(function(state) {\n return toArray( dataValue(\"path_of_array\")(state) )\n}, ...)"
|
|
1044
|
-
},
|
|
1045
1262
|
{
|
|
1046
1263
|
"title": "function",
|
|
1047
1264
|
"description": null,
|
|
1048
1265
|
"name": null
|
|
1049
1266
|
},
|
|
1267
|
+
{
|
|
1268
|
+
"title": "example",
|
|
1269
|
+
"description": "each(function(state) {\n return toArray( dataValue(\"path_of_array\")(state) )\n}, ...)"
|
|
1270
|
+
},
|
|
1050
1271
|
{
|
|
1051
1272
|
"title": "param",
|
|
1052
1273
|
"description": "Data required to be in an array",
|
|
@@ -1081,15 +1302,15 @@
|
|
|
1081
1302
|
"description": null,
|
|
1082
1303
|
"type": null
|
|
1083
1304
|
},
|
|
1084
|
-
{
|
|
1085
|
-
"title": "example",
|
|
1086
|
-
"description": "field(\"destination_string__c\", humanProper(state.data.path_to_string))"
|
|
1087
|
-
},
|
|
1088
1305
|
{
|
|
1089
1306
|
"title": "function",
|
|
1090
1307
|
"description": null,
|
|
1091
1308
|
"name": null
|
|
1092
1309
|
},
|
|
1310
|
+
{
|
|
1311
|
+
"title": "example",
|
|
1312
|
+
"description": "field(\"destination_string__c\", humanProper(state.data.path_to_string))"
|
|
1313
|
+
},
|
|
1093
1314
|
{
|
|
1094
1315
|
"title": "param",
|
|
1095
1316
|
"description": "String that needs converting",
|
|
@@ -1192,15 +1413,15 @@
|
|
|
1192
1413
|
"description": null,
|
|
1193
1414
|
"type": null
|
|
1194
1415
|
},
|
|
1195
|
-
{
|
|
1196
|
-
"title": "example",
|
|
1197
|
-
"description": "scrubEmojis('Dove🕊️⭐ 29')"
|
|
1198
|
-
},
|
|
1199
1416
|
{
|
|
1200
1417
|
"title": "function",
|
|
1201
1418
|
"description": null,
|
|
1202
1419
|
"name": null
|
|
1203
1420
|
},
|
|
1421
|
+
{
|
|
1422
|
+
"title": "example",
|
|
1423
|
+
"description": "scrubEmojis('Dove🕊️⭐ 29')"
|
|
1424
|
+
},
|
|
1204
1425
|
{
|
|
1205
1426
|
"title": "param",
|
|
1206
1427
|
"description": "String that needs to be cleaned",
|
|
@@ -1245,15 +1466,15 @@
|
|
|
1245
1466
|
"description": null,
|
|
1246
1467
|
"type": null
|
|
1247
1468
|
},
|
|
1248
|
-
{
|
|
1249
|
-
"title": "example",
|
|
1250
|
-
"description": "chunk([1,2,3,4,5], 2)"
|
|
1251
|
-
},
|
|
1252
1469
|
{
|
|
1253
1470
|
"title": "function",
|
|
1254
1471
|
"description": null,
|
|
1255
1472
|
"name": null
|
|
1256
1473
|
},
|
|
1474
|
+
{
|
|
1475
|
+
"title": "example",
|
|
1476
|
+
"description": "chunk([1,2,3,4,5], 2)"
|
|
1477
|
+
},
|
|
1257
1478
|
{
|
|
1258
1479
|
"title": "param",
|
|
1259
1480
|
"description": "Array to be chunked",
|
|
@@ -1372,6 +1593,11 @@
|
|
|
1372
1593
|
"description": null,
|
|
1373
1594
|
"type": null
|
|
1374
1595
|
},
|
|
1596
|
+
{
|
|
1597
|
+
"title": "function",
|
|
1598
|
+
"description": null,
|
|
1599
|
+
"name": null
|
|
1600
|
+
},
|
|
1375
1601
|
{
|
|
1376
1602
|
"title": "example",
|
|
1377
1603
|
"description": "cursor($.cursor, { defaultValue: 'today' })",
|
|
@@ -1382,11 +1608,6 @@
|
|
|
1382
1608
|
"description": "cursor(22)",
|
|
1383
1609
|
"caption": "Use a pagination cursor"
|
|
1384
1610
|
},
|
|
1385
|
-
{
|
|
1386
|
-
"title": "function",
|
|
1387
|
-
"description": null,
|
|
1388
|
-
"name": null
|
|
1389
|
-
},
|
|
1390
1611
|
{
|
|
1391
1612
|
"title": "param",
|
|
1392
1613
|
"description": "the cursor value. Usually an ISO date, natural language date, or page number",
|
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(src_exports, {
|
|
|
42
42
|
fn: () => import_language_common3.fn,
|
|
43
43
|
fnIf: () => import_language_common3.fnIf,
|
|
44
44
|
get: () => get,
|
|
45
|
+
group: () => import_language_common3.group,
|
|
45
46
|
humanProper: () => import_language_common3.humanProper,
|
|
46
47
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
47
48
|
merge: () => import_language_common3.merge,
|
|
@@ -77,6 +78,7 @@ __export(Adaptor_exports, {
|
|
|
77
78
|
fn: () => import_language_common3.fn,
|
|
78
79
|
fnIf: () => import_language_common3.fnIf,
|
|
79
80
|
get: () => get,
|
|
81
|
+
group: () => import_language_common3.group,
|
|
80
82
|
humanProper: () => import_language_common3.humanProper,
|
|
81
83
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
82
84
|
merge: () => import_language_common3.merge,
|
|
@@ -235,6 +237,7 @@ var src_default = Adaptor_exports;
|
|
|
235
237
|
fn,
|
|
236
238
|
fnIf,
|
|
237
239
|
get,
|
|
240
|
+
group,
|
|
238
241
|
humanProper,
|
|
239
242
|
lastReferenceValue,
|
|
240
243
|
merge,
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(Adaptor_exports, {
|
|
|
23
23
|
fn: () => fn,
|
|
24
24
|
fnIf: () => fnIf,
|
|
25
25
|
get: () => get,
|
|
26
|
+
group: () => group,
|
|
26
27
|
humanProper: () => humanProper,
|
|
27
28
|
lastReferenceValue: () => lastReferenceValue,
|
|
28
29
|
merge: () => merge,
|
|
@@ -148,6 +149,7 @@ import {
|
|
|
148
149
|
fn,
|
|
149
150
|
fnIf,
|
|
150
151
|
chunk,
|
|
152
|
+
group,
|
|
151
153
|
humanProper,
|
|
152
154
|
lastReferenceValue,
|
|
153
155
|
merge,
|
|
@@ -208,6 +210,7 @@ export {
|
|
|
208
210
|
fn,
|
|
209
211
|
fnIf,
|
|
210
212
|
get,
|
|
213
|
+
group,
|
|
211
214
|
humanProper,
|
|
212
215
|
lastReferenceValue,
|
|
213
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.1",
|
|
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.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@openfn/simple-ast": "0.4.1",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Options provided to the HTTP request
|
|
3
3
|
* @typedef {Object} RequestOptions
|
|
4
|
+
* @public
|
|
4
5
|
* @property {object|string} body - body data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request).
|
|
5
6
|
* @property {object} errors - Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Pass `false` to suppress errors for this code.
|
|
6
7
|
* @property {object} form - Pass a JSON object to be serialised into a multipart HTML form (as FormData) in the body.
|
|
@@ -11,14 +12,20 @@
|
|
|
11
12
|
* @property {object} tls - TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions
|
|
12
13
|
*/
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* State object
|
|
16
|
+
* @typedef {Object} HttpState
|
|
17
|
+
* @property data - the parsed response body
|
|
18
|
+
* @property response - the response from the HTTP server, including headers, statusCode, body, etc
|
|
19
|
+
* @property references - an array of all previous data objects used in the Job
|
|
20
|
+
**/
|
|
21
|
+
/**
|
|
22
|
+
* Execute a sequence of operations
|
|
15
23
|
* Wraps `language-common/execute`, and prepends initial state for http.
|
|
16
24
|
* @example
|
|
17
25
|
* execute(
|
|
18
26
|
* create('foo'),
|
|
19
27
|
* delete('bar')
|
|
20
28
|
* )(state)
|
|
21
|
-
* @private
|
|
22
29
|
* @param {Operations} operations - Operations to be performed.
|
|
23
30
|
* @returns {Operation}
|
|
24
31
|
*/
|
|
@@ -40,6 +47,7 @@ export function execute(...operations: Operations): Operation;
|
|
|
40
47
|
* @param {string} path - Path to resource
|
|
41
48
|
* @param {RequestOptions} params - Query, Headers and Authentication parameters
|
|
42
49
|
* @param {function} callback - (Optional) Callback function
|
|
50
|
+
* @state {HttpState}
|
|
43
51
|
* @returns {Operation}
|
|
44
52
|
*/
|
|
45
53
|
export function request(method: string, path: string, params: RequestOptions, callback: Function): Operation;
|
|
@@ -55,6 +63,7 @@ export function request(method: string, path: string, params: RequestOptions, ca
|
|
|
55
63
|
* @param {string} path - Path to resource
|
|
56
64
|
* @param {RequestOptions} params - Query, Headers and Authentication parameters
|
|
57
65
|
* @param {function} callback - (Optional) Callback function
|
|
66
|
+
* @state {HttpState}
|
|
58
67
|
* @returns {Operation}
|
|
59
68
|
*/
|
|
60
69
|
export function get(path: string, params: RequestOptions, callback: Function): Operation;
|
|
@@ -70,6 +79,7 @@ export function get(path: string, params: RequestOptions, callback: Function): O
|
|
|
70
79
|
* @param {string} path - Path to resource
|
|
71
80
|
* @param {RequestOptions} params - Body, Query, Headers and Authentication parameters
|
|
72
81
|
* @param {function} callback - (Optional) Callback function
|
|
82
|
+
* @state {HttpState}
|
|
73
83
|
* @returns {operation}
|
|
74
84
|
*/
|
|
75
85
|
export function post(path: string, params: RequestOptions, callback: Function): operation;
|
|
@@ -85,6 +95,7 @@ export function post(path: string, params: RequestOptions, callback: Function):
|
|
|
85
95
|
* @param {string} path - Path to resource
|
|
86
96
|
* @param {RequestOptions} params - Body, Query, Headers and Auth parameters
|
|
87
97
|
* @param {function} callback - (Optional) Callback function
|
|
98
|
+
* @state {HttpState}
|
|
88
99
|
* @returns {Operation}
|
|
89
100
|
*/
|
|
90
101
|
export function put(path: string, params: RequestOptions, callback: Function): Operation;
|
|
@@ -100,6 +111,7 @@ export function put(path: string, params: RequestOptions, callback: Function): O
|
|
|
100
111
|
* @param {string} path - Path to resource
|
|
101
112
|
* @param {RequestOptions} params - Body, Query, Headers and Auth parameters
|
|
102
113
|
* @param {function} callback - (Optional) Callback function
|
|
114
|
+
* @state {HttpState}
|
|
103
115
|
* @returns {Operation}
|
|
104
116
|
*/
|
|
105
117
|
export function patch(path: string, params: RequestOptions, callback: Function): Operation;
|
|
@@ -114,6 +126,7 @@ export function patch(path: string, params: RequestOptions, callback: Function):
|
|
|
114
126
|
* @param {string} path - Path to resource
|
|
115
127
|
* @param {RequestOptions} params - Body, Query, Headers and Auth parameters
|
|
116
128
|
* @param {function} callback - (Optional) Callback function
|
|
129
|
+
* @state {HttpState}
|
|
117
130
|
* @returns {Operation}
|
|
118
131
|
*/
|
|
119
132
|
export function del(path: string, params: RequestOptions, callback: Function): Operation;
|
|
@@ -139,44 +152,30 @@ export function del(path: string, params: RequestOptions, callback: Function): O
|
|
|
139
152
|
* @param {String} body - data string to be parsed
|
|
140
153
|
* @param {function} script - script for extracting data
|
|
141
154
|
* @param {function} callback - (Optional) Callback function
|
|
155
|
+
* @state data - the parsed XML as a JSON object
|
|
156
|
+
* @state references - an array of all previous data objects used in the Job
|
|
142
157
|
* @returns {Operation}
|
|
143
158
|
*/
|
|
144
159
|
export function parseXML(body: string, script: Function, callback: Function): Operation;
|
|
145
160
|
/**
|
|
146
161
|
* Options provided to the HTTP request
|
|
147
162
|
*/
|
|
148
|
-
export type RequestOptions =
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* - Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Pass `false` to suppress errors for this code.
|
|
155
|
-
*/
|
|
156
|
-
errors: object;
|
|
157
|
-
/**
|
|
158
|
-
* - Pass a JSON object to be serialised into a multipart HTML form (as FormData) in the body.
|
|
159
|
-
*/
|
|
160
|
-
form: object;
|
|
161
|
-
/**
|
|
162
|
-
* - An object of query parameters to be encoded into the URL.
|
|
163
|
-
*/
|
|
164
|
-
query: object;
|
|
165
|
-
/**
|
|
166
|
-
* - An object of headers to append to the request.
|
|
167
|
-
*/
|
|
168
|
-
headers: object;
|
|
163
|
+
export type RequestOptions = any;
|
|
164
|
+
/**
|
|
165
|
+
* State object
|
|
166
|
+
*/
|
|
167
|
+
export type HttpState = {
|
|
169
168
|
/**
|
|
170
|
-
* -
|
|
169
|
+
* - the parsed response body
|
|
171
170
|
*/
|
|
172
|
-
|
|
171
|
+
data: any;
|
|
173
172
|
/**
|
|
174
|
-
* -
|
|
173
|
+
* - the response from the HTTP server, including headers, statusCode, body, etc
|
|
175
174
|
*/
|
|
176
|
-
|
|
175
|
+
response: any;
|
|
177
176
|
/**
|
|
178
|
-
* -
|
|
177
|
+
* - an array of all previous data objects used in the Job
|
|
179
178
|
*/
|
|
180
|
-
|
|
179
|
+
references: any;
|
|
181
180
|
};
|
|
182
|
-
export { alterState, arrayToString, combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, chunk, humanProper, lastReferenceValue, merge, scrubEmojis, sourceValue, splitKeys, toArray, parseCsv } from "@openfn/language-common";
|
|
181
|
+
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";
|