mol_dump_lib 0.0.875 → 0.0.877
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/package.json +1 -1
- package/web.d.ts +11 -4
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +36 -45
- package/web.js.map +1 -1
- package/web.mjs +36 -45
- package/web.test.js +14 -0
- package/web.test.js.map +1 -1
package/web.mjs
CHANGED
|
@@ -5976,12 +5976,9 @@ var $;
|
|
|
5976
5976
|
"use strict";
|
|
5977
5977
|
var $;
|
|
5978
5978
|
(function ($) {
|
|
5979
|
-
class $mol_fetch_response extends $
|
|
5979
|
+
class $mol_fetch_response extends $mol_object {
|
|
5980
5980
|
native;
|
|
5981
|
-
|
|
5982
|
-
super();
|
|
5983
|
-
this.native = native;
|
|
5984
|
-
}
|
|
5981
|
+
request;
|
|
5985
5982
|
status() {
|
|
5986
5983
|
const types = ['unknown', 'inform', 'success', 'redirect', 'wrong', 'failed'];
|
|
5987
5984
|
return types[Math.floor(this.native.status / 100)];
|
|
@@ -5989,6 +5986,9 @@ var $;
|
|
|
5989
5986
|
code() {
|
|
5990
5987
|
return this.native.status;
|
|
5991
5988
|
}
|
|
5989
|
+
ok() {
|
|
5990
|
+
return this.native.ok;
|
|
5991
|
+
}
|
|
5992
5992
|
message() {
|
|
5993
5993
|
return this.native.statusText || `HTTP Error ${this.code()}`;
|
|
5994
5994
|
}
|
|
@@ -6003,8 +6003,7 @@ var $;
|
|
|
6003
6003
|
}
|
|
6004
6004
|
text() {
|
|
6005
6005
|
const buffer = this.buffer();
|
|
6006
|
-
const
|
|
6007
|
-
const mime = native.headers.get('content-type') || '';
|
|
6006
|
+
const mime = this.mime() || '';
|
|
6008
6007
|
const [, charset] = /charset=(.*)/.exec(mime) || [, 'utf-8'];
|
|
6009
6008
|
const decoder = new TextDecoder(charset);
|
|
6010
6009
|
return decoder.decode(buffer);
|
|
@@ -6044,14 +6043,13 @@ var $;
|
|
|
6044
6043
|
$mol_action
|
|
6045
6044
|
], $mol_fetch_response.prototype, "html", null);
|
|
6046
6045
|
$.$mol_fetch_response = $mol_fetch_response;
|
|
6047
|
-
class $
|
|
6048
|
-
|
|
6046
|
+
class $mol_fetch_request extends $mol_object {
|
|
6047
|
+
native;
|
|
6048
|
+
response_async() {
|
|
6049
6049
|
const controller = new AbortController();
|
|
6050
6050
|
let done = false;
|
|
6051
|
-
const
|
|
6052
|
-
|
|
6053
|
-
signal: controller.signal,
|
|
6054
|
-
}).finally(() => {
|
|
6051
|
+
const request = new Request(this.native, { signal: controller.signal });
|
|
6052
|
+
const promise = fetch(request).finally(() => {
|
|
6055
6053
|
done = true;
|
|
6056
6054
|
});
|
|
6057
6055
|
return Object.assign(promise, {
|
|
@@ -6061,15 +6059,35 @@ var $;
|
|
|
6061
6059
|
},
|
|
6062
6060
|
});
|
|
6063
6061
|
}
|
|
6064
|
-
|
|
6065
|
-
return
|
|
6062
|
+
response() {
|
|
6063
|
+
return this.$.$mol_fetch_response.make({
|
|
6064
|
+
native: $mol_wire_sync(this).response_async(),
|
|
6065
|
+
request: this
|
|
6066
|
+
});
|
|
6066
6067
|
}
|
|
6067
|
-
|
|
6068
|
-
const response = this.response(
|
|
6068
|
+
success() {
|
|
6069
|
+
const response = this.response();
|
|
6069
6070
|
if (response.status() === 'success')
|
|
6070
6071
|
return response;
|
|
6071
6072
|
throw new Error(response.message(), { cause: response });
|
|
6072
6073
|
}
|
|
6074
|
+
}
|
|
6075
|
+
__decorate([
|
|
6076
|
+
$mol_action
|
|
6077
|
+
], $mol_fetch_request.prototype, "response", null);
|
|
6078
|
+
$.$mol_fetch_request = $mol_fetch_request;
|
|
6079
|
+
class $mol_fetch extends $mol_object {
|
|
6080
|
+
static request(input, init) {
|
|
6081
|
+
return this.$.$mol_fetch_request.make({
|
|
6082
|
+
native: new Request(input, init)
|
|
6083
|
+
});
|
|
6084
|
+
}
|
|
6085
|
+
static response(input, init) {
|
|
6086
|
+
return this.request(input, init).response();
|
|
6087
|
+
}
|
|
6088
|
+
static success(input, init) {
|
|
6089
|
+
return this.request(input, init).success();
|
|
6090
|
+
}
|
|
6073
6091
|
static stream(input, init) {
|
|
6074
6092
|
return this.success(input, init).stream();
|
|
6075
6093
|
}
|
|
@@ -6097,34 +6115,7 @@ var $;
|
|
|
6097
6115
|
}
|
|
6098
6116
|
__decorate([
|
|
6099
6117
|
$mol_action
|
|
6100
|
-
], $mol_fetch, "
|
|
6101
|
-
__decorate([
|
|
6102
|
-
$mol_action
|
|
6103
|
-
], $mol_fetch, "success", null);
|
|
6104
|
-
__decorate([
|
|
6105
|
-
$mol_action
|
|
6106
|
-
], $mol_fetch, "stream", null);
|
|
6107
|
-
__decorate([
|
|
6108
|
-
$mol_action
|
|
6109
|
-
], $mol_fetch, "text", null);
|
|
6110
|
-
__decorate([
|
|
6111
|
-
$mol_action
|
|
6112
|
-
], $mol_fetch, "json", null);
|
|
6113
|
-
__decorate([
|
|
6114
|
-
$mol_action
|
|
6115
|
-
], $mol_fetch, "blob", null);
|
|
6116
|
-
__decorate([
|
|
6117
|
-
$mol_action
|
|
6118
|
-
], $mol_fetch, "buffer", null);
|
|
6119
|
-
__decorate([
|
|
6120
|
-
$mol_action
|
|
6121
|
-
], $mol_fetch, "xml", null);
|
|
6122
|
-
__decorate([
|
|
6123
|
-
$mol_action
|
|
6124
|
-
], $mol_fetch, "xhtml", null);
|
|
6125
|
-
__decorate([
|
|
6126
|
-
$mol_action
|
|
6127
|
-
], $mol_fetch, "html", null);
|
|
6118
|
+
], $mol_fetch, "request", null);
|
|
6128
6119
|
$.$mol_fetch = $mol_fetch;
|
|
6129
6120
|
})($ || ($ = {}));
|
|
6130
6121
|
|
package/web.test.js
CHANGED
|
@@ -3169,6 +3169,20 @@ var $;
|
|
|
3169
3169
|
});
|
|
3170
3170
|
})($ || ($ = {}));
|
|
3171
3171
|
|
|
3172
|
+
;
|
|
3173
|
+
"use strict";
|
|
3174
|
+
var $;
|
|
3175
|
+
(function ($_1) {
|
|
3176
|
+
var $$;
|
|
3177
|
+
(function ($$) {
|
|
3178
|
+
$mol_test({
|
|
3179
|
+
async "Get and parse"($) {
|
|
3180
|
+
$mol_assert_equal(await $mol_wire_async($mol_fetch).text('data:text/plain,foo'), 'foo');
|
|
3181
|
+
},
|
|
3182
|
+
});
|
|
3183
|
+
})($$ = $_1.$$ || ($_1.$$ = {}));
|
|
3184
|
+
})($ || ($ = {}));
|
|
3185
|
+
|
|
3172
3186
|
;
|
|
3173
3187
|
"use strict";
|
|
3174
3188
|
var $;
|