hardpy 0.19.0__py3-none-any.whl → 0.20.0__py3-none-any.whl
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.
- hardpy/__init__.py +2 -0
- hardpy/cli/cli.py +6 -0
- hardpy/common/config.py +19 -0
- hardpy/hardpy_panel/api.py +62 -1
- hardpy/hardpy_panel/frontend/dist/assets/{allPaths-C_-7WXHD.js → allPaths-BXbcAtew.js} +1 -1
- hardpy/hardpy_panel/frontend/dist/assets/{allPathsLoader-DgH0Xily.js → allPathsLoader-lJLHMNNZ.js} +2 -2
- hardpy/hardpy_panel/frontend/dist/assets/{browser-ponyfill-BbOvdqIF.js → browser-ponyfill-DzwgrUwX.js} +1 -1
- hardpy/hardpy_panel/frontend/dist/assets/{index-DEJb2W0B.js → index-CVhA7vmQ.js} +158 -158
- hardpy/hardpy_panel/frontend/dist/assets/{splitPathsBySizeLoader-o5HCcdVL.js → splitPathsBySizeLoader-BdwEQHyO.js} +1 -1
- hardpy/hardpy_panel/frontend/dist/index.html +1 -1
- hardpy/hardpy_panel/frontend/dist/locales/cs/translation.json +85 -0
- hardpy/pytest_hardpy/db/__init__.py +0 -2
- hardpy/pytest_hardpy/db/runstore.py +378 -10
- hardpy/pytest_hardpy/db/statestore.py +390 -5
- hardpy/pytest_hardpy/db/tempstore.py +219 -17
- hardpy/pytest_hardpy/plugin.py +24 -0
- hardpy/pytest_hardpy/pytest_wrapper.py +6 -1
- hardpy/pytest_hardpy/reporter/hook_reporter.py +18 -0
- hardpy/pytest_hardpy/result/__init__.py +2 -0
- hardpy/pytest_hardpy/result/report_loader/json_loader.py +49 -0
- hardpy/pytest_hardpy/result/report_synchronizer/synchronizer.py +25 -9
- {hardpy-0.19.0.dist-info → hardpy-0.20.0.dist-info}/METADATA +18 -2
- {hardpy-0.19.0.dist-info → hardpy-0.20.0.dist-info}/RECORD +26 -25
- hardpy/pytest_hardpy/db/base_store.py +0 -179
- {hardpy-0.19.0.dist-info → hardpy-0.20.0.dist-info}/WHEEL +0 -0
- {hardpy-0.19.0.dist-info → hardpy-0.20.0.dist-info}/entry_points.txt +0 -0
- {hardpy-0.19.0.dist-info → hardpy-0.20.0.dist-info}/licenses/LICENSE +0 -0
hardpy/__init__.py
CHANGED
|
@@ -45,6 +45,7 @@ from hardpy.pytest_hardpy.pytest_call import (
|
|
|
45
45
|
)
|
|
46
46
|
from hardpy.pytest_hardpy.result import (
|
|
47
47
|
CouchdbLoader,
|
|
48
|
+
JsonLoader,
|
|
48
49
|
StandCloudLoader,
|
|
49
50
|
StandCloudReader,
|
|
50
51
|
)
|
|
@@ -82,6 +83,7 @@ __all__ = [
|
|
|
82
83
|
"HTMLComponent",
|
|
83
84
|
"ImageComponent",
|
|
84
85
|
"Instrument",
|
|
86
|
+
"JsonLoader",
|
|
85
87
|
"MultistepWidget",
|
|
86
88
|
"NumericInputWidget",
|
|
87
89
|
"NumericMeasurement",
|
hardpy/cli/cli.py
CHANGED
|
@@ -82,6 +82,10 @@ def init( # noqa: PLR0913
|
|
|
82
82
|
default=default_config.stand_cloud.api_key,
|
|
83
83
|
help="Specify a StandCloud API key.",
|
|
84
84
|
),
|
|
85
|
+
storage_type: str = typer.Option(
|
|
86
|
+
default=default_config.database.storage_type.value,
|
|
87
|
+
help="Specify a storage type.",
|
|
88
|
+
),
|
|
85
89
|
) -> None:
|
|
86
90
|
"""Initialize HardPy tests directory.
|
|
87
91
|
|
|
@@ -100,6 +104,7 @@ def init( # noqa: PLR0913
|
|
|
100
104
|
sc_connection_only (bool): Flag to check StandCloud service availability
|
|
101
105
|
sc_autosync (bool): Flag to enable StandCloud auto syncronization
|
|
102
106
|
sc_api_key (str | None): StandCloud API key
|
|
107
|
+
storage_type (str): Storage type, "json" or "couchdb", "couchdb" by default
|
|
103
108
|
"""
|
|
104
109
|
dir_path = Path(Path.cwd() / tests_dir if tests_dir else "tests")
|
|
105
110
|
config_manager = ConfigManager()
|
|
@@ -116,6 +121,7 @@ def init( # noqa: PLR0913
|
|
|
116
121
|
sc_connection_only=sc_connection_only,
|
|
117
122
|
sc_autosync=sc_autosync,
|
|
118
123
|
sc_api_key=sc_api_key,
|
|
124
|
+
storage_type=storage_type,
|
|
119
125
|
)
|
|
120
126
|
# create tests directory
|
|
121
127
|
Path.mkdir(dir_path, exist_ok=True, parents=True)
|
hardpy/common/config.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# GNU General Public License v3.0 (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from enum import Enum
|
|
5
6
|
from logging import getLogger
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
|
|
@@ -14,17 +15,32 @@ from hardpy.common.singleton import SingletonMeta
|
|
|
14
15
|
logger = getLogger(__name__)
|
|
15
16
|
|
|
16
17
|
|
|
18
|
+
class StorageType(str, Enum):
|
|
19
|
+
"""Storage backend types for HardPy data persistence.
|
|
20
|
+
|
|
21
|
+
Attributes:
|
|
22
|
+
JSON: JSON file-based storage on local filesystem
|
|
23
|
+
COUCHDB: CouchDB database storage
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
JSON = "json"
|
|
27
|
+
COUCHDB = "couchdb"
|
|
28
|
+
|
|
29
|
+
|
|
17
30
|
class DatabaseConfig(BaseModel):
|
|
18
31
|
"""Database configuration."""
|
|
19
32
|
|
|
20
33
|
model_config = ConfigDict(extra="forbid")
|
|
21
34
|
|
|
35
|
+
storage_type: StorageType = StorageType.COUCHDB
|
|
22
36
|
user: str = "dev"
|
|
23
37
|
password: str = "dev"
|
|
24
38
|
host: str = "localhost"
|
|
25
39
|
port: int = 5984
|
|
26
40
|
doc_id: str = Field(exclude=True, default="")
|
|
27
41
|
url: str = Field(exclude=True, default="")
|
|
42
|
+
# This field is relevant only when storage_type is "json"
|
|
43
|
+
storage_path: str = Field(exclude=True, default=".hardpy")
|
|
28
44
|
|
|
29
45
|
def model_post_init(self, __context) -> None: # noqa: ANN001,PYI063
|
|
30
46
|
"""Get database connection url."""
|
|
@@ -157,6 +173,7 @@ class ConfigManager(metaclass=SingletonMeta):
|
|
|
157
173
|
sc_connection_only: bool,
|
|
158
174
|
sc_autosync: bool,
|
|
159
175
|
sc_api_key: str,
|
|
176
|
+
storage_type: str,
|
|
160
177
|
) -> None:
|
|
161
178
|
"""Initialize the HardPy configuration.
|
|
162
179
|
|
|
@@ -175,12 +192,14 @@ class ConfigManager(metaclass=SingletonMeta):
|
|
|
175
192
|
sc_connection_only (bool): StandCloud check availability.
|
|
176
193
|
sc_autosync (bool): StandCloud auto syncronization.
|
|
177
194
|
sc_api_key (str): StandCloud API key.
|
|
195
|
+
storage_type (str): Database storage type.
|
|
178
196
|
"""
|
|
179
197
|
self._config.tests_name = tests_name
|
|
180
198
|
self._config.frontend.host = frontend_host
|
|
181
199
|
self._config.frontend.port = frontend_port
|
|
182
200
|
self._config.frontend.language = frontend_language
|
|
183
201
|
self._config.database.user = database_user
|
|
202
|
+
self._config.database.storage_type = StorageType(storage_type)
|
|
184
203
|
self._config.database.password = database_password
|
|
185
204
|
self._config.database.host = database_host
|
|
186
205
|
self._config.database.port = database_port
|
hardpy/hardpy_panel/api.py
CHANGED
|
@@ -17,7 +17,7 @@ from urllib.parse import unquote
|
|
|
17
17
|
from fastapi import FastAPI, Query, Request
|
|
18
18
|
from fastapi.staticfiles import StaticFiles
|
|
19
19
|
|
|
20
|
-
from hardpy.common.config import ConfigManager
|
|
20
|
+
from hardpy.common.config import ConfigManager, StorageType
|
|
21
21
|
from hardpy.pytest_hardpy.pytest_wrapper import PyTestWrapper
|
|
22
22
|
from hardpy.pytest_hardpy.result.report_synchronizer import StandCloudSynchronizer
|
|
23
23
|
|
|
@@ -361,6 +361,67 @@ def set_manual_collect_mode(mode_data: dict) -> dict:
|
|
|
361
361
|
return {"status": "success", "manual_collect_mode": enabled}
|
|
362
362
|
|
|
363
363
|
|
|
364
|
+
@app.get("/api/storage_type")
|
|
365
|
+
def get_storage_type() -> dict:
|
|
366
|
+
"""Get the configured storage type.
|
|
367
|
+
|
|
368
|
+
Returns:
|
|
369
|
+
dict[str, str]: storage type ("json" or "couchdb")
|
|
370
|
+
"""
|
|
371
|
+
config_manager = ConfigManager()
|
|
372
|
+
return {"storage_type": config_manager.config.database.storage_type}
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
@app.get("/api/json_data")
|
|
376
|
+
def get_json_data() -> dict:
|
|
377
|
+
"""Get test run data from JSON storage.
|
|
378
|
+
|
|
379
|
+
Returns:
|
|
380
|
+
dict: Test run data from JSON files
|
|
381
|
+
"""
|
|
382
|
+
config_manager = ConfigManager()
|
|
383
|
+
storage_type = config_manager.config.database.storage_type
|
|
384
|
+
|
|
385
|
+
if storage_type != StorageType.JSON:
|
|
386
|
+
return {"error": "JSON storage not configured"}
|
|
387
|
+
|
|
388
|
+
try:
|
|
389
|
+
config_storage_path = Path(config_manager.config.database.storage_path)
|
|
390
|
+
if config_storage_path.is_absolute():
|
|
391
|
+
storage_dir = config_storage_path / "storage" / "statestore"
|
|
392
|
+
else:
|
|
393
|
+
storage_dir = Path(
|
|
394
|
+
config_manager.tests_path
|
|
395
|
+
/ config_manager.config.database.storage_path
|
|
396
|
+
/ "storage"
|
|
397
|
+
/ "statestore",
|
|
398
|
+
)
|
|
399
|
+
_doc_id = config_manager.config.database.doc_id
|
|
400
|
+
statestore_file = storage_dir / f"{_doc_id}.json"
|
|
401
|
+
|
|
402
|
+
if not statestore_file.exists():
|
|
403
|
+
return {"rows": [], "total_rows": 0}
|
|
404
|
+
|
|
405
|
+
with statestore_file.open("r") as f:
|
|
406
|
+
data = json.load(f)
|
|
407
|
+
|
|
408
|
+
# Format data to match CouchDB's _all_docs format
|
|
409
|
+
return {
|
|
410
|
+
"rows": [
|
|
411
|
+
{
|
|
412
|
+
"id": data.get("_id", ""),
|
|
413
|
+
"key": data.get("_id", ""),
|
|
414
|
+
"value": {"rev": data.get("_rev", "1-0")},
|
|
415
|
+
"doc": data,
|
|
416
|
+
},
|
|
417
|
+
],
|
|
418
|
+
"total_rows": 1,
|
|
419
|
+
}
|
|
420
|
+
except Exception as exc:
|
|
421
|
+
logger.exception("Error reading JSON storage")
|
|
422
|
+
return {"error": str(exc), "rows": [], "total_rows": 0}
|
|
423
|
+
|
|
424
|
+
|
|
364
425
|
if "DEBUG_FRONTEND" not in os.environ:
|
|
365
426
|
app.mount(
|
|
366
427
|
"/",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as n}from"./index-DLOviMB1.js";import{I as e}from"./index-B-fsa5Ru.js";import{p as r,I as s}from"./index-
|
|
1
|
+
import{I as n}from"./index-DLOviMB1.js";import{I as e}from"./index-B-fsa5Ru.js";import{p as r,I as s}from"./index-CVhA7vmQ.js";function I(o,t){var a=r(o);return t===s.STANDARD?n[a]:e[a]}function p(o){return r(o)}export{n as IconSvgPaths16,e as IconSvgPaths20,I as getIconPaths,p as iconNameToPathsRecordKey};
|
hardpy/hardpy_panel/frontend/dist/assets/{allPathsLoader-DgH0Xily.js → allPathsLoader-lJLHMNNZ.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-
|
|
2
|
-
import{_ as o,a as n,b as i}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-BXbcAtew.js","assets/index-DLOviMB1.js","assets/index-B-fsa5Ru.js","assets/index-CVhA7vmQ.js","assets/index-B7T9xvaW.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as o,a as n,b as i}from"./index-CVhA7vmQ.js";var _=function(e,a){return o(void 0,void 0,void 0,function(){var t;return n(this,function(r){switch(r.label){case 0:return[4,i(()=>import("./allPaths-BXbcAtew.js"),__vite__mapDeps([0,1,2,3,4]))];case 1:return t=r.sent().getIconPaths,[2,t(e,a)]}})})};export{_ as allPathsLoader};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as G}from"./index-
|
|
1
|
+
import{g as G}from"./index-CVhA7vmQ.js";function $(w,c){for(var m=0;m<c.length;m++){const d=c[m];if(typeof d!="string"&&!Array.isArray(d)){for(const y in d)if(y!=="default"&&!(y in w)){const p=Object.getOwnPropertyDescriptor(d,y);p&&Object.defineProperty(w,y,p.get?p:{enumerable:!0,get:()=>d[y]})}}}return Object.freeze(Object.defineProperty(w,Symbol.toStringTag,{value:"Module"}))}var E={exports:{}},U;function X(){return U||(U=1,(function(w,c){var m={},d=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof m<"u"&&m,y=(function(){function v(){this.fetch=!1,this.DOMException=d.DOMException}return v.prototype=d,new v})();(function(v){(function(u){var a=typeof v<"u"&&v||typeof self<"u"&&self||typeof a<"u"&&a,f={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function S(e){return e&&DataView.prototype.isPrototypeOf(e)}if(f.arrayBuffer)var F=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],I=ArrayBuffer.isView||function(e){return e&&F.indexOf(Object.prototype.toString.call(e))>-1};function _(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function T(e){return typeof e!="string"&&(e=String(e)),e}function B(e){var t={next:function(){var r=e.shift();return{done:r===void 0,value:r}}};return f.iterable&&(t[Symbol.iterator]=function(){return t}),t}function s(e){this.map={},e instanceof s?e.forEach(function(t,r){this.append(r,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}s.prototype.append=function(e,t){e=_(e),t=T(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},s.prototype.delete=function(e){delete this.map[_(e)]},s.prototype.get=function(e){return e=_(e),this.has(e)?this.map[e]:null},s.prototype.has=function(e){return this.map.hasOwnProperty(_(e))},s.prototype.set=function(e,t){this.map[_(e)]=T(t)},s.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},s.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),B(e)},s.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),B(e)},s.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),B(e)},f.iterable&&(s.prototype[Symbol.iterator]=s.prototype.entries);function O(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function D(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function M(e){var t=new FileReader,r=D(t);return t.readAsArrayBuffer(e),r}function q(e){var t=new FileReader,r=D(t);return t.readAsText(e),r}function H(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}function x(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:f.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:f.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():f.arrayBuffer&&f.blob&&S(e)?(this._bodyArrayBuffer=x(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||I(e))?this._bodyArrayBuffer=x(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var e=O(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=O(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(M)}),this.text=function(){var e=O(this);if(e)return e;if(this._bodyBlob)return q(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(H(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(k)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function C(e){var t=e.toUpperCase();return L.indexOf(t)>-1?t:e}function b(e,t){if(!(this instanceof b))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var r=t.body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new s(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new s(t.headers)),this.method=C(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var i=/\?/;this.url+=(i.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})};function k(e){var t=new FormData;return e.trim().split("&").forEach(function(r){if(r){var n=r.split("="),i=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(o))}}),t}function N(e){var t=new s,r=e.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
|
|
2
2
|
`)===0?n.substr(1,n.length):n}).forEach(function(n){var i=n.split(":"),o=i.shift().trim();if(o){var g=i.join(":").trim();t.append(o,g)}}),t}R.call(b.prototype);function l(e,t){if(!(this instanceof l))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new s(t.headers),this.url=t.url||"",this._initBody(e)}R.call(l.prototype),l.prototype.clone=function(){return new l(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},l.error=function(){var e=new l(null,{status:0,statusText:""});return e.type="error",e};var V=[301,302,303,307,308];l.redirect=function(e,t){if(V.indexOf(t)===-1)throw new RangeError("Invalid status code");return new l(null,{status:t,headers:{location:e}})},u.DOMException=a.DOMException;try{new u.DOMException}catch{u.DOMException=function(t,r){this.message=t,this.name=r;var n=Error(t);this.stack=n.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function P(e,t){return new Promise(function(r,n){var i=new b(e,t);if(i.signal&&i.signal.aborted)return n(new u.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function g(){o.abort()}o.onload=function(){var h={status:o.status,statusText:o.statusText,headers:N(o.getAllResponseHeaders()||"")};h.url="responseURL"in o?o.responseURL:h.headers.get("X-Request-URL");var A="response"in o?o.response:o.responseText;setTimeout(function(){r(new l(A,h))},0)},o.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},o.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},o.onabort=function(){setTimeout(function(){n(new u.DOMException("Aborted","AbortError"))},0)};function z(h){try{return h===""&&a.location.href?a.location.href:h}catch{return h}}o.open(i.method,z(i.url),!0),i.credentials==="include"?o.withCredentials=!0:i.credentials==="omit"&&(o.withCredentials=!1),"responseType"in o&&(f.blob?o.responseType="blob":f.arrayBuffer&&i.headers.get("Content-Type")&&i.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(o.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof s)?Object.getOwnPropertyNames(t.headers).forEach(function(h){o.setRequestHeader(h,T(t.headers[h]))}):i.headers.forEach(function(h,A){o.setRequestHeader(A,h)}),i.signal&&(i.signal.addEventListener("abort",g),o.onreadystatechange=function(){o.readyState===4&&i.signal.removeEventListener("abort",g)}),o.send(typeof i._bodyInit>"u"?null:i._bodyInit)})}return P.polyfill=!0,a.fetch||(a.fetch=P,a.Headers=s,a.Request=b,a.Response=l),u.Headers=s,u.Request=b,u.Response=l,u.fetch=P,u})({})})(y),y.fetch.ponyfill=!0,delete y.fetch.polyfill;var p=d.fetch?d:y;c=p.fetch,c.default=p.fetch,c.fetch=p.fetch,c.Headers=p.Headers,c.Request=p.Request,c.Response=p.Response,w.exports=c})(E,E.exports)),E.exports}var j=X();const J=G(j),Q=$({__proto__:null,default:J},[j]);export{Q as b};
|