firefly-compiler 0.4.71 → 0.4.73
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/core/HttpClient.ff +12 -12
- package/output/js/ff/core/HttpClient.mjs +17 -17
- package/package.json +1 -1
- package/rpc/Rpc.ff +1 -1
- package/vscode/package.json +1 -1
package/core/HttpClient.ff
CHANGED
|
@@ -22,7 +22,7 @@ extend self: HttpClient {
|
|
|
22
22
|
headers: List[Pair[String, String]]
|
|
23
23
|
body: FetchResponse => T
|
|
24
24
|
): T {
|
|
25
|
-
self.fetch("GET", url, headers
|
|
25
|
+
self.fetch("GET", url, headers, None, FetchOptions(), body)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
post[T](
|
|
@@ -31,7 +31,7 @@ extend self: HttpClient {
|
|
|
31
31
|
payload: Buffer
|
|
32
32
|
body: FetchResponse => T
|
|
33
33
|
): T {
|
|
34
|
-
self.fetch("POST", url, headers
|
|
34
|
+
self.fetch("POST", url, headers, Some(payload), FetchOptions(), body)
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
put[T](
|
|
@@ -40,7 +40,7 @@ extend self: HttpClient {
|
|
|
40
40
|
payload: Buffer
|
|
41
41
|
body: FetchResponse => T
|
|
42
42
|
): T {
|
|
43
|
-
self.fetch("PUT", url, headers
|
|
43
|
+
self.fetch("PUT", url, headers, Some(payload), FetchOptions(), body)
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
delete[T](
|
|
@@ -48,13 +48,13 @@ extend self: HttpClient {
|
|
|
48
48
|
headers: List[Pair[String, String]]
|
|
49
49
|
body: FetchResponse => T
|
|
50
50
|
): T {
|
|
51
|
-
self.fetch("DELETE", url, headers
|
|
51
|
+
self.fetch("DELETE", url, headers, None, FetchOptions(), body)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
fetch[T](
|
|
55
55
|
method: String
|
|
56
56
|
url: String
|
|
57
|
-
headers:
|
|
57
|
+
headers: List[Pair[String, String]] = []
|
|
58
58
|
payload: Option[Buffer] = None
|
|
59
59
|
options: FetchOptions = FetchOptions()
|
|
60
60
|
body: FetchResponse => T
|
|
@@ -66,13 +66,13 @@ extend self: HttpClient {
|
|
|
66
66
|
options.method = method_;
|
|
67
67
|
headers_.forEach(pair => {options.headers[pair.first_] = pair.second_});
|
|
68
68
|
if(body_.value_) options.body = body_.value_;
|
|
69
|
-
if(redirect_.RedirectError) options.redirect = "error";
|
|
70
|
-
else if(redirect_.RedirectManual) options.redirect = "manual";
|
|
71
|
-
if(referrer_.value_) options.referrer = referrer_.value_;
|
|
72
|
-
if(integrity_.value_) options.integrity = integrity_.value_;
|
|
73
|
-
if(mode_.value_) options.mode = mode_.value_;
|
|
74
|
-
if(credentials_.value_) options.credentials = credentials_.value_;
|
|
75
|
-
if(cache_.value_) options.cache = cache_.value_;
|
|
69
|
+
if(options_.redirect_.RedirectError) options.redirect = "error";
|
|
70
|
+
else if(options_.redirect_.RedirectManual) options.redirect = "manual";
|
|
71
|
+
if(options_.referrer_.value_) options.referrer = options_.referrer_.value_;
|
|
72
|
+
if(options_.integrity_.value_) options.integrity = options_.integrity_.value_;
|
|
73
|
+
if(options_.mode_.value_) options.mode = options_.mode_.value_;
|
|
74
|
+
if(options_.credentials_.value_) options.credentials = options_.credentials_.value_;
|
|
75
|
+
if(options_.cache_.value_) options.cache = options_.cache_.value_;
|
|
76
76
|
fetchResponse.response = await self_.fetch(url_, options);
|
|
77
77
|
const result = await body_(fetchResponse, $task);
|
|
78
78
|
if(!statusChecked && !fetchResponse.response.ok) {
|
|
@@ -136,42 +136,42 @@ throw new Error('Function internalCheck is missing on this target in async conte
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
export function HttpClient_get(self_, url_, headers_, body_) {
|
|
139
|
-
return ff_core_HttpClient.HttpClient_fetch(self_, "GET", url_,
|
|
139
|
+
return ff_core_HttpClient.HttpClient_fetch(self_, "GET", url_, headers_, ff_core_Option.None(), ff_core_HttpClient.FetchOptions(ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None()), body_)
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
export function HttpClient_post(self_, url_, headers_, payload_, body_) {
|
|
143
|
-
return ff_core_HttpClient.HttpClient_fetch(self_, "POST", url_,
|
|
143
|
+
return ff_core_HttpClient.HttpClient_fetch(self_, "POST", url_, headers_, ff_core_Option.Some(payload_), ff_core_HttpClient.FetchOptions(ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None()), body_)
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
export function HttpClient_put(self_, url_, headers_, payload_, body_) {
|
|
147
|
-
return ff_core_HttpClient.HttpClient_fetch(self_, "PUT", url_,
|
|
147
|
+
return ff_core_HttpClient.HttpClient_fetch(self_, "PUT", url_, headers_, ff_core_Option.Some(payload_), ff_core_HttpClient.FetchOptions(ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None()), body_)
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
export function HttpClient_delete(self_, url_, headers_, body_) {
|
|
151
|
-
return ff_core_HttpClient.HttpClient_fetch(self_, "DELETE", url_,
|
|
151
|
+
return ff_core_HttpClient.HttpClient_fetch(self_, "DELETE", url_, headers_, ff_core_Option.None(), ff_core_HttpClient.FetchOptions(ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None()), body_)
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
export function HttpClient_fetch(self_, method_, url_, headers_ =
|
|
154
|
+
export function HttpClient_fetch(self_, method_, url_, headers_ = [], payload_ = ff_core_Option.None(), options_ = ff_core_HttpClient.FetchOptions(), body_) {
|
|
155
155
|
throw new Error('Function HttpClient_fetch is missing on this target in sync context.');
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
export async function HttpClient_get$(self_, url_, headers_, body_, $task) {
|
|
159
|
-
return (await ff_core_HttpClient.HttpClient_fetch$(self_, "GET", url_,
|
|
159
|
+
return (await ff_core_HttpClient.HttpClient_fetch$(self_, "GET", url_, headers_, ff_core_Option.None(), ff_core_HttpClient.FetchOptions(ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None()), body_, $task))
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
export async function HttpClient_post$(self_, url_, headers_, payload_, body_, $task) {
|
|
163
|
-
return (await ff_core_HttpClient.HttpClient_fetch$(self_, "POST", url_,
|
|
163
|
+
return (await ff_core_HttpClient.HttpClient_fetch$(self_, "POST", url_, headers_, ff_core_Option.Some(payload_), ff_core_HttpClient.FetchOptions(ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None()), body_, $task))
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
export async function HttpClient_put$(self_, url_, headers_, payload_, body_, $task) {
|
|
167
|
-
return (await ff_core_HttpClient.HttpClient_fetch$(self_, "PUT", url_,
|
|
167
|
+
return (await ff_core_HttpClient.HttpClient_fetch$(self_, "PUT", url_, headers_, ff_core_Option.Some(payload_), ff_core_HttpClient.FetchOptions(ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None()), body_, $task))
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
export async function HttpClient_delete$(self_, url_, headers_, body_, $task) {
|
|
171
|
-
return (await ff_core_HttpClient.HttpClient_fetch$(self_, "DELETE", url_,
|
|
171
|
+
return (await ff_core_HttpClient.HttpClient_fetch$(self_, "DELETE", url_, headers_, ff_core_Option.None(), ff_core_HttpClient.FetchOptions(ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None()), body_, $task))
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
export async function HttpClient_fetch$(self_, method_, url_, headers_ =
|
|
174
|
+
export async function HttpClient_fetch$(self_, method_, url_, headers_ = [], payload_ = ff_core_Option.None(), options_ = ff_core_HttpClient.FetchOptions(), body_, $task) {
|
|
175
175
|
|
|
176
176
|
const fetchResponse = {response: null, statusChecked: false};
|
|
177
177
|
try {
|
|
@@ -179,13 +179,13 @@ export async function HttpClient_fetch$(self_, method_, url_, headers_ = ff_core
|
|
|
179
179
|
options.method = method_;
|
|
180
180
|
headers_.forEach(pair => {options.headers[pair.first_] = pair.second_});
|
|
181
181
|
if(body_.value_) options.body = body_.value_;
|
|
182
|
-
if(redirect_.RedirectError) options.redirect = "error";
|
|
183
|
-
else if(redirect_.RedirectManual) options.redirect = "manual";
|
|
184
|
-
if(referrer_.value_) options.referrer = referrer_.value_;
|
|
185
|
-
if(integrity_.value_) options.integrity = integrity_.value_;
|
|
186
|
-
if(mode_.value_) options.mode = mode_.value_;
|
|
187
|
-
if(credentials_.value_) options.credentials = credentials_.value_;
|
|
188
|
-
if(cache_.value_) options.cache = cache_.value_;
|
|
182
|
+
if(options_.redirect_.RedirectError) options.redirect = "error";
|
|
183
|
+
else if(options_.redirect_.RedirectManual) options.redirect = "manual";
|
|
184
|
+
if(options_.referrer_.value_) options.referrer = options_.referrer_.value_;
|
|
185
|
+
if(options_.integrity_.value_) options.integrity = options_.integrity_.value_;
|
|
186
|
+
if(options_.mode_.value_) options.mode = options_.mode_.value_;
|
|
187
|
+
if(options_.credentials_.value_) options.credentials = options_.credentials_.value_;
|
|
188
|
+
if(options_.cache_.value_) options.cache = options_.cache_.value_;
|
|
189
189
|
fetchResponse.response = await self_.fetch(url_, options);
|
|
190
190
|
const result = await body_(fetchResponse, $task);
|
|
191
191
|
if(!statusChecked && !fetchResponse.response.ok) {
|
package/package.json
CHANGED
package/rpc/Rpc.ff
CHANGED