hardpy 0.19.1__tar.gz → 0.20.1__tar.gz

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.
Files changed (92) hide show
  1. {hardpy-0.19.1 → hardpy-0.20.1}/.gitignore +1 -0
  2. {hardpy-0.19.1 → hardpy-0.20.1}/PKG-INFO +32 -15
  3. {hardpy-0.19.1 → hardpy-0.20.1}/README.md +30 -14
  4. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/__init__.py +9 -0
  5. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/cli/cli.py +29 -0
  6. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/config.py +19 -0
  7. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/api.py +62 -1
  8. hardpy-0.19.1/hardpy/hardpy_panel/frontend/dist/assets/allPaths-C_-7WXHD.js → hardpy-0.20.1/hardpy/hardpy_panel/frontend/dist/assets/allPaths-CLpOX_m7.js +1 -1
  9. hardpy-0.19.1/hardpy/hardpy_panel/frontend/dist/assets/allPathsLoader-DgH0Xily.js → hardpy-0.20.1/hardpy/hardpy_panel/frontend/dist/assets/allPathsLoader-BZScMaOY.js +2 -2
  10. hardpy-0.19.1/hardpy/hardpy_panel/frontend/dist/assets/browser-ponyfill-BbOvdqIF.js → hardpy-0.20.1/hardpy/hardpy_panel/frontend/dist/assets/browser-ponyfill-BTcpcLno.js +1 -1
  11. hardpy-0.19.1/hardpy/hardpy_panel/frontend/dist/assets/index-DEJb2W0B.js → hardpy-0.20.1/hardpy/hardpy_panel/frontend/dist/assets/index-1i9Rm0C7.js +189 -322
  12. hardpy-0.20.1/hardpy/hardpy_panel/frontend/dist/assets/index-DN3Ur-pw.css +1 -0
  13. hardpy-0.19.1/hardpy/hardpy_panel/frontend/dist/assets/splitPathsBySizeLoader-o5HCcdVL.js → hardpy-0.20.1/hardpy/hardpy_panel/frontend/dist/assets/splitPathsBySizeLoader-CfM4kXSA.js +1 -1
  14. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/index.html +2 -2
  15. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/db/__init__.py +0 -2
  16. hardpy-0.20.1/hardpy/pytest_hardpy/db/runstore.py +396 -0
  17. hardpy-0.20.1/hardpy/pytest_hardpy/db/statestore.py +402 -0
  18. hardpy-0.20.1/hardpy/pytest_hardpy/db/tempstore.py +256 -0
  19. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/plugin.py +2 -2
  20. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/__init__.py +2 -0
  21. hardpy-0.20.1/hardpy/pytest_hardpy/result/report_loader/json_loader.py +49 -0
  22. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/report_synchronizer/synchronizer.py +25 -9
  23. {hardpy-0.19.1 → hardpy-0.20.1}/pyproject.toml +2 -1
  24. hardpy-0.19.1/hardpy/hardpy_panel/frontend/dist/assets/index-B7T9xvaW.css +0 -1
  25. hardpy-0.19.1/hardpy/pytest_hardpy/db/base_store.py +0 -179
  26. hardpy-0.19.1/hardpy/pytest_hardpy/db/runstore.py +0 -28
  27. hardpy-0.19.1/hardpy/pytest_hardpy/db/statestore.py +0 -17
  28. hardpy-0.19.1/hardpy/pytest_hardpy/db/tempstore.py +0 -54
  29. {hardpy-0.19.1 → hardpy-0.20.1}/LICENSE +0 -0
  30. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/cli/__init__.py +0 -0
  31. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/cli/template.py +0 -0
  32. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/__init__.py +0 -0
  33. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/singleton.py +0 -0
  34. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/stand_cloud/__init__.py +0 -0
  35. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/stand_cloud/connector.py +0 -0
  36. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/stand_cloud/exception.py +0 -0
  37. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/stand_cloud/oauth2.py +0 -0
  38. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/stand_cloud/registration.py +0 -0
  39. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/stand_cloud/token_manager.py +0 -0
  40. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/common/stand_cloud/utils.py +0 -0
  41. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/__init__.py +0 -0
  42. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-B2twAPZE.ttf +0 -0
  43. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-C0Unyq1d.eot +0 -0
  44. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-CVy9qFng.svg +0 -0
  45. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-Ck1ifK4A.woff +0 -0
  46. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-16-DwWyHYRo.woff2 +0 -0
  47. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-9zitLjlL.woff2 +0 -0
  48. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-CjKGIKxE.woff +0 -0
  49. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-DQ09GSQq.svg +0 -0
  50. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-DmR755bS.ttf +0 -0
  51. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/blueprint-icons-20-p9MhBXD8.eot +0 -0
  52. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/index-B-fsa5Ru.js +0 -0
  53. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/index-DLOviMB1.js +0 -0
  54. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/assets/logo_smol-CK3jE85c.png +0 -0
  55. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/favicon.ico +0 -0
  56. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/locales/cs/translation.json +0 -0
  57. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/locales/de/translation.json +0 -0
  58. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/locales/en/translation.json +0 -0
  59. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/locales/es/translation.json +0 -0
  60. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/locales/fr/translation.json +0 -0
  61. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/locales/ja/translation.json +0 -0
  62. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/locales/ru/translation.json +0 -0
  63. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/locales/zh/translation.json +0 -0
  64. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/logo192.png +0 -0
  65. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/logo512.png +0 -0
  66. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/hardpy_panel/frontend/dist/manifest.json +0 -0
  67. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/__init__.py +0 -0
  68. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/db/const.py +0 -0
  69. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/db/schema/__init__.py +0 -0
  70. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/db/schema/v1.py +0 -0
  71. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/db/stand_type.py +0 -0
  72. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/pytest_call.py +0 -0
  73. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/pytest_wrapper.py +0 -0
  74. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/reporter/__init__.py +0 -0
  75. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/reporter/base.py +0 -0
  76. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/reporter/hook_reporter.py +0 -0
  77. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/reporter/runner_reporter.py +0 -0
  78. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/couchdb_config.py +0 -0
  79. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/report_loader/__init__.py +0 -0
  80. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/report_loader/couchdb_loader.py +0 -0
  81. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/report_loader/stand_cloud_loader.py +0 -0
  82. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/report_reader/__init__.py +0 -0
  83. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/report_reader/couchdb_reader.py +0 -0
  84. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/report_reader/stand_cloud_reader.py +0 -0
  85. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/result/report_synchronizer/__init__.py +0 -0
  86. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/utils/__init__.py +0 -0
  87. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/utils/const.py +0 -0
  88. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/utils/dialog_box.py +0 -0
  89. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/utils/exception.py +0 -0
  90. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/utils/machineid.py +0 -0
  91. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/utils/node_info.py +0 -0
  92. {hardpy-0.19.1 → hardpy-0.20.1}/hardpy/pytest_hardpy/utils/progress_calculator.py +0 -0
@@ -9,3 +9,4 @@ dist
9
9
  .mypy_cache
10
10
  __pycache__/
11
11
  node_modules/
12
+ .hardpy
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hardpy
3
- Version: 0.19.1
3
+ Version: 0.20.1
4
4
  Summary: HardPy library for device testing
5
5
  Project-URL: Homepage, https://github.com/everypinio/hardpy/
6
6
  Project-URL: Documentation, https://everypinio.github.io/hardpy/
@@ -42,6 +42,7 @@ Requires-Dist: tomli-w<2,>=1.1.0
42
42
  Requires-Dist: tomli<3,>=2.0.1
43
43
  Requires-Dist: typer<1,>=0.12
44
44
  Requires-Dist: tzlocal~=5.2
45
+ Requires-Dist: uuid6
45
46
  Requires-Dist: uvicorn>=0.23.2
46
47
  Provides-Extra: build
47
48
  Requires-Dist: build==1.0.3; extra == 'build'
@@ -69,7 +70,7 @@ HardPy is a python library for creating a test bench for devices.
69
70
  [![pytest versions](https://img.shields.io/badge/pytest-%3E%3D7.0-blue)](https://docs.pytest.org/en/latest/)
70
71
  [![Documentation](https://img.shields.io/badge/Documentation%20-Overview%20-%20%23007ec6)](https://everypinio.github.io/hardpy/)
71
72
  [![Reddit](https://img.shields.io/badge/-Reddit-FF4500?style=flat&logo=reddit&logoColor=white)](https://www.reddit.com/r/HardPy)
72
- [![Discord](https://img.shields.io/discord/1304494076799877172?color=7389D8&label&logo=discord&logoColor=ffffff)]()
73
+ [![Discord](https://img.shields.io/discord/1304494076799877172?color=7389D8&label&logo=discord&logoColor=ffffff)](https://discord.gg/98bWadmG8J)
73
74
  [![Telegram](https://img.shields.io/badge/-Telegram-2CA5E0?style=flat&logo=telegram&logoColor=white)](https://t.me/everypin)
74
75
 
75
76
  </div>
@@ -82,7 +83,7 @@ HardPy allows you to:
82
83
 
83
84
  * Create test benches for devices using [pytest](https://docs.pytest.org/);
84
85
  * Use a browser to view, start, stop, and interact with tests;
85
- * Store test results in the [CouchDB](https://couchdb.apache.org/) database;
86
+ * Store test results in the [CouchDB](https://couchdb.apache.org/) database or to simple JSON files;
86
87
  * Store test results on the [StandCloud](https://standcloud.io/) analytics platform.
87
88
 
88
89
  <h1 align="center">
@@ -97,24 +98,39 @@ pip install hardpy
97
98
 
98
99
  ## Getting Started
99
100
 
101
+ ### With CouchDB
102
+
100
103
  1. Create your first test bench.
101
- ```bash
102
- hardpy init
103
- ```
104
- 2. Launch [CouchDB](https://couchdb.apache.org/) database via [docker compose](https://docs.docker.com/compose/) in the background.
105
- ```bash
106
- cd tests
107
- docker compose up -d
108
- ```
104
+ ```bash
105
+ hardpy init
106
+ ```
107
+ 2. Launch [CouchDB](https://couchdb.apache.org/) database via [docker compose](https://docs.docker.com/compose/)
108
+ in the background.
109
+ ```bash
110
+ cd tests
111
+ docker compose up -d
112
+ ```
109
113
  3. Launch HardPy operator panel.
110
- ```bash
111
- hardpy run
112
- ```
114
+ ```bash
115
+ hardpy run
116
+ ```
113
117
  4. View operator panel in browser: http://localhost:8000/
114
118
  5. View the latest test report: http://localhost:5984/_utils
115
119
 
116
120
  Login and password: **dev**, database - **runstore**.
117
121
 
122
+ ### Without a database
123
+
124
+ 1. Create your first test bench.
125
+ ```bash
126
+ hardpy init --no-create-database --storage-type json
127
+ ```
128
+ 2. Launch HardPy operator panel.
129
+ ```bash
130
+ hardpy run
131
+ ```
132
+ 3. View operator panel in browser: http://localhost:8000/
133
+
118
134
  ## Examples
119
135
 
120
136
  For more examples of using **HardPy**, see the [examples](https://github.com/everypinio/hardpy/tree/main/examples) folder and the [documentation](https://everypinio.github.io/hardpy/examples/).
@@ -130,4 +146,5 @@ open libraries to interact with measuring equipment.
130
146
  * [PyMeasure](https://github.com/pymeasure/pymeasure)
131
147
  * [PyTango](https://gitlab.com/tango-controls/pytango)
132
148
  * [QCoDeS](https://github.com/microsoft/Qcodes)
133
- * [QCoDeS contrib drivers](https://github.com/QCoDeS/Qcodes_contrib_drivers)
149
+ * [QCoDeS contrib drivers](https://github.com/QCoDeS/Qcodes_contrib_drivers)
150
+ * [Labgrid](https://github.com/labgrid-project/labgrid)
@@ -13,7 +13,7 @@ HardPy is a python library for creating a test bench for devices.
13
13
  [![pytest versions](https://img.shields.io/badge/pytest-%3E%3D7.0-blue)](https://docs.pytest.org/en/latest/)
14
14
  [![Documentation](https://img.shields.io/badge/Documentation%20-Overview%20-%20%23007ec6)](https://everypinio.github.io/hardpy/)
15
15
  [![Reddit](https://img.shields.io/badge/-Reddit-FF4500?style=flat&logo=reddit&logoColor=white)](https://www.reddit.com/r/HardPy)
16
- [![Discord](https://img.shields.io/discord/1304494076799877172?color=7389D8&label&logo=discord&logoColor=ffffff)]()
16
+ [![Discord](https://img.shields.io/discord/1304494076799877172?color=7389D8&label&logo=discord&logoColor=ffffff)](https://discord.gg/98bWadmG8J)
17
17
  [![Telegram](https://img.shields.io/badge/-Telegram-2CA5E0?style=flat&logo=telegram&logoColor=white)](https://t.me/everypin)
18
18
 
19
19
  </div>
@@ -26,7 +26,7 @@ HardPy allows you to:
26
26
 
27
27
  * Create test benches for devices using [pytest](https://docs.pytest.org/);
28
28
  * Use a browser to view, start, stop, and interact with tests;
29
- * Store test results in the [CouchDB](https://couchdb.apache.org/) database;
29
+ * Store test results in the [CouchDB](https://couchdb.apache.org/) database or to simple JSON files;
30
30
  * Store test results on the [StandCloud](https://standcloud.io/) analytics platform.
31
31
 
32
32
  <h1 align="center">
@@ -41,24 +41,39 @@ pip install hardpy
41
41
 
42
42
  ## Getting Started
43
43
 
44
+ ### With CouchDB
45
+
44
46
  1. Create your first test bench.
45
- ```bash
46
- hardpy init
47
- ```
48
- 2. Launch [CouchDB](https://couchdb.apache.org/) database via [docker compose](https://docs.docker.com/compose/) in the background.
49
- ```bash
50
- cd tests
51
- docker compose up -d
52
- ```
47
+ ```bash
48
+ hardpy init
49
+ ```
50
+ 2. Launch [CouchDB](https://couchdb.apache.org/) database via [docker compose](https://docs.docker.com/compose/)
51
+ in the background.
52
+ ```bash
53
+ cd tests
54
+ docker compose up -d
55
+ ```
53
56
  3. Launch HardPy operator panel.
54
- ```bash
55
- hardpy run
56
- ```
57
+ ```bash
58
+ hardpy run
59
+ ```
57
60
  4. View operator panel in browser: http://localhost:8000/
58
61
  5. View the latest test report: http://localhost:5984/_utils
59
62
 
60
63
  Login and password: **dev**, database - **runstore**.
61
64
 
65
+ ### Without a database
66
+
67
+ 1. Create your first test bench.
68
+ ```bash
69
+ hardpy init --no-create-database --storage-type json
70
+ ```
71
+ 2. Launch HardPy operator panel.
72
+ ```bash
73
+ hardpy run
74
+ ```
75
+ 3. View operator panel in browser: http://localhost:8000/
76
+
62
77
  ## Examples
63
78
 
64
79
  For more examples of using **HardPy**, see the [examples](https://github.com/everypinio/hardpy/tree/main/examples) folder and the [documentation](https://everypinio.github.io/hardpy/examples/).
@@ -74,4 +89,5 @@ open libraries to interact with measuring equipment.
74
89
  * [PyMeasure](https://github.com/pymeasure/pymeasure)
75
90
  * [PyTango](https://gitlab.com/tango-controls/pytango)
76
91
  * [QCoDeS](https://github.com/microsoft/Qcodes)
77
- * [QCoDeS contrib drivers](https://github.com/QCoDeS/Qcodes_contrib_drivers)
92
+ * [QCoDeS contrib drivers](https://github.com/QCoDeS/Qcodes_contrib_drivers)
93
+ * [Labgrid](https://github.com/labgrid-project/labgrid)
@@ -1,6 +1,8 @@
1
1
  # Copyright (c) 2024 Everypin
2
2
  # GNU General Public License v3.0 (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
 
4
+ from importlib.metadata import PackageNotFoundError, version
5
+
4
6
  from hardpy.common.stand_cloud import StandCloudConnector, StandCloudError
5
7
  from hardpy.pytest_hardpy.db import (
6
8
  Chart,
@@ -45,6 +47,7 @@ from hardpy.pytest_hardpy.pytest_call import (
45
47
  )
46
48
  from hardpy.pytest_hardpy.result import (
47
49
  CouchdbLoader,
50
+ JsonLoader,
48
51
  StandCloudLoader,
49
52
  StandCloudReader,
50
53
  )
@@ -67,6 +70,11 @@ from hardpy.pytest_hardpy.utils import (
67
70
  TextInputWidget,
68
71
  )
69
72
 
73
+ try:
74
+ __version__ = version("hardpy")
75
+ except PackageNotFoundError:
76
+ __version__ = "unknown"
77
+
70
78
  __all__ = [
71
79
  "BaseWidget",
72
80
  "Chart",
@@ -82,6 +90,7 @@ __all__ = [
82
90
  "HTMLComponent",
83
91
  "ImageComponent",
84
92
  "Instrument",
93
+ "JsonLoader",
85
94
  "MultistepWidget",
86
95
  "NumericInputWidget",
87
96
  "NumericMeasurement",
@@ -12,6 +12,7 @@ import requests
12
12
  import typer
13
13
  from uvicorn import run as uvicorn_run
14
14
 
15
+ from hardpy import __version__ as hardpy_version
15
16
  from hardpy.cli.template import TemplateGenerator
16
17
  from hardpy.common.config import ConfigManager, HardpyConfig
17
18
  from hardpy.common.stand_cloud import (
@@ -31,6 +32,27 @@ cli = typer.Typer(add_completion=False)
31
32
  default_config = HardpyConfig()
32
33
 
33
34
 
35
+ def version_callback(value: bool) -> None:
36
+ """Show the HardPy version and exit."""
37
+ if value:
38
+ print(hardpy_version)
39
+ raise typer.Exit(0)
40
+
41
+
42
+ @cli.callback()
43
+ def main( # noqa: D103
44
+ version_flag: Optional[bool] = typer.Option(
45
+ None,
46
+ "--version",
47
+ "-v",
48
+ callback=version_callback,
49
+ is_eager=True,
50
+ help="Show the HardPy version and exit.",
51
+ ),
52
+ ) -> None:
53
+ pass
54
+
55
+
34
56
  @cli.command()
35
57
  def init( # noqa: PLR0913
36
58
  tests_dir: Annotated[Optional[str], typer.Argument()] = None,
@@ -82,6 +104,10 @@ def init( # noqa: PLR0913
82
104
  default=default_config.stand_cloud.api_key,
83
105
  help="Specify a StandCloud API key.",
84
106
  ),
107
+ storage_type: str = typer.Option(
108
+ default=default_config.database.storage_type.value,
109
+ help="Specify a storage type.",
110
+ ),
85
111
  ) -> None:
86
112
  """Initialize HardPy tests directory.
87
113
 
@@ -100,6 +126,7 @@ def init( # noqa: PLR0913
100
126
  sc_connection_only (bool): Flag to check StandCloud service availability
101
127
  sc_autosync (bool): Flag to enable StandCloud auto syncronization
102
128
  sc_api_key (str | None): StandCloud API key
129
+ storage_type (str): Storage type, "json" or "couchdb", "couchdb" by default
103
130
  """
104
131
  dir_path = Path(Path.cwd() / tests_dir if tests_dir else "tests")
105
132
  config_manager = ConfigManager()
@@ -116,6 +143,7 @@ def init( # noqa: PLR0913
116
143
  sc_connection_only=sc_connection_only,
117
144
  sc_autosync=sc_autosync,
118
145
  sc_api_key=sc_api_key,
146
+ storage_type=storage_type,
119
147
  )
120
148
  # create tests directory
121
149
  Path.mkdir(dir_path, exist_ok=True, parents=True)
@@ -329,6 +357,7 @@ def _validate_running_config(config: HardpyConfig, tests_dir: str) -> None:
329
357
  print(error_msg)
330
358
  sys.exit()
331
359
 
360
+
332
361
  def _validate_config(config: HardpyConfig) -> None:
333
362
  if config.stand_cloud.autosync:
334
363
  if config.stand_cloud.autosync_timeout < 1:
@@ -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
@@ -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-DEJb2W0B.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};
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-1i9Rm0C7.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};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-C_-7WXHD.js","assets/index-DLOviMB1.js","assets/index-B-fsa5Ru.js","assets/index-DEJb2W0B.js","assets/index-B7T9xvaW.css"])))=>i.map(i=>d[i]);
2
- import{_ as o,a as n,b as i}from"./index-DEJb2W0B.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-C_-7WXHD.js"),__vite__mapDeps([0,1,2,3,4]))];case 1:return t=r.sent().getIconPaths,[2,t(e,a)]}})})};export{_ as allPathsLoader};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-CLpOX_m7.js","assets/index-DLOviMB1.js","assets/index-B-fsa5Ru.js","assets/index-1i9Rm0C7.js","assets/index-DN3Ur-pw.css"])))=>i.map(i=>d[i]);
2
+ import{_ as o,a as n,b as i}from"./index-1i9Rm0C7.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-CLpOX_m7.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-DEJb2W0B.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(`
1
+ import{g as G}from"./index-1i9Rm0C7.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};