jaaql-middleware-python 5.3.23__py3-none-any.whl → 5.3.25__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.
- jaaql/constants.py +1 -1
- jaaql/documentation/documentation_internal.py +1 -1
- jaaql/email/email_manager_service.py +11 -1
- jaaql/exceptions/custom_http_status.py +16 -16
- jaaql/exceptions/not_yet_implement_exception.py +10 -10
- jaaql/mvc/controller_interface.py +11 -11
- jaaql/mvc/model.py +129 -53
- jaaql/mvc/model_interface.py +10 -10
- jaaql/patch.py +6 -6
- jaaql/scripts/swagger_template.html +93 -93
- jaaql/services/migrations_manager_service.py +65 -24
- jaaql/test/test_chrome_driver.py +62 -0
- jaaql/test/test_documentation.py +31 -0
- jaaql/test/test_monitor_psql.py +265 -0
- jaaql/test/test_web_config.py +672 -0
- jaaql/utilities/vault.py +83 -83
- {jaaql_middleware_python-5.3.23.dist-info → jaaql_middleware_python-5.3.25.dist-info}/METADATA +20 -23
- {jaaql_middleware_python-5.3.23.dist-info → jaaql_middleware_python-5.3.25.dist-info}/RECORD +21 -17
- {jaaql_middleware_python-5.3.23.dist-info → jaaql_middleware_python-5.3.25.dist-info}/licenses/LICENSE.txt +388 -388
- {jaaql_middleware_python-5.3.23.dist-info → jaaql_middleware_python-5.3.25.dist-info}/WHEEL +0 -0
- {jaaql_middleware_python-5.3.23.dist-info → jaaql_middleware_python-5.3.25.dist-info}/top_level.txt +0 -0
jaaql/constants.py
CHANGED
|
@@ -625,7 +625,7 @@ DOCUMENTATION__report_sentinel_error = SwaggerDocumentation(
|
|
|
625
625
|
name="Report error",
|
|
626
626
|
description="Logs an application error (user_agent + ip_address encrypted at rest) and triggers Sentinel "
|
|
627
627
|
"alert processing. Never returns 500 (would otherwise make JAAQL report itself recursively). "
|
|
628
|
-
"Any JSON object holding a report key is stored, whatever its Content-Type
|
|
628
|
+
"Any JSON object holding a report key is stored, whatever its Content-Type. A value that does not fit "
|
|
629
629
|
"Sentinel's error table is adapted (cut, NULL for a line or column out of range, defaults for missing keys, "
|
|
630
630
|
"unknown keys ignored), with each adaptation listed under 'Ingest adjustments:' in the stored stacktrace; a "
|
|
631
631
|
"body over 2 MB keeps the start and end of its stacktrace. Refused are only a body holding no JSON object "
|
|
@@ -65,6 +65,9 @@ TIMEOUT__attachment_render = 60000
|
|
|
65
65
|
TIMEOUT__page_load = 20
|
|
66
66
|
TIMEOUT__pdf_generation = 60
|
|
67
67
|
|
|
68
|
+
# The chromedriver the image installs for its Chrome (docker/Dockerfile)
|
|
69
|
+
PATH__image_chromedriver = "/usr/local/bin/chromedriver"
|
|
70
|
+
|
|
68
71
|
REGEX__html_tags = r'<(\/[a-zA-Z]+|(!?[a-zA-Z]+((\s)*((\"?[^(\">)]*\"?)|[a-zA-Z]*\s*=\s*\"[^\"]*\"))*))>'
|
|
69
72
|
|
|
70
73
|
HTTP_ARG__oauth_token = "oauth_token"
|
|
@@ -154,7 +157,14 @@ class DrivenChrome:
|
|
|
154
157
|
|
|
155
158
|
service_args = []
|
|
156
159
|
|
|
157
|
-
|
|
160
|
+
# Naming the image's driver skips Selenium Manager, which on every Chrome start would otherwise look the driver up, sending
|
|
161
|
+
# usage statistics to plausible.io and waiting on the network when there is none. Outside the image Selenium Manager finds it
|
|
162
|
+
if os.path.exists(PATH__image_chromedriver):
|
|
163
|
+
service = Service(executable_path=PATH__image_chromedriver, service_args=service_args)
|
|
164
|
+
else:
|
|
165
|
+
service = Service(service_args=service_args)
|
|
166
|
+
|
|
167
|
+
self.driver = webdriver.Chrome(options=options, service=service)
|
|
158
168
|
|
|
159
169
|
self.driver.set_page_load_timeout(self.page_load_timeout)
|
|
160
170
|
self.driver.set_script_timeout(self.render_timeout)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
from enum import IntEnum
|
|
2
|
-
|
|
3
|
-
__all__ = ['CustomHTTPStatus']
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class CustomHTTPStatus(IntEnum):
|
|
7
|
-
|
|
8
|
-
def __new__(cls, value, phrase, description=''):
|
|
9
|
-
obj = int.__new__(cls, value)
|
|
10
|
-
obj._value_ = value
|
|
11
|
-
|
|
12
|
-
obj.phrase = phrase
|
|
13
|
-
obj.description = description
|
|
14
|
-
return obj
|
|
15
|
-
|
|
16
|
-
DATABASE_NO_EXIST = 460, "Database doesn't exist", "The database doesn't exist on the given node"
|
|
1
|
+
from enum import IntEnum
|
|
2
|
+
|
|
3
|
+
__all__ = ['CustomHTTPStatus']
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CustomHTTPStatus(IntEnum):
|
|
7
|
+
|
|
8
|
+
def __new__(cls, value, phrase, description=''):
|
|
9
|
+
obj = int.__new__(cls, value)
|
|
10
|
+
obj._value_ = value
|
|
11
|
+
|
|
12
|
+
obj.phrase = phrase
|
|
13
|
+
obj.description = description
|
|
14
|
+
return obj
|
|
15
|
+
|
|
16
|
+
DATABASE_NO_EXIST = 460, "Database doesn't exist", "The database doesn't exist on the given node"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from jaaql.exceptions.http_status_exception import HttpStatusException
|
|
2
|
-
from http import HTTPStatus
|
|
3
|
-
|
|
4
|
-
ERR__not_yet_implemented = "Not yet implemented!"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class NotYetImplementedException(HttpStatusException):
|
|
8
|
-
|
|
9
|
-
def __init__(self):
|
|
10
|
-
super().__init__(ERR__not_yet_implemented, HTTPStatus.NOT_IMPLEMENTED)
|
|
1
|
+
from jaaql.exceptions.http_status_exception import HttpStatusException
|
|
2
|
+
from http import HTTPStatus
|
|
3
|
+
|
|
4
|
+
ERR__not_yet_implemented = "Not yet implemented!"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class NotYetImplementedException(HttpStatusException):
|
|
8
|
+
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__(ERR__not_yet_implemented, HTTPStatus.NOT_IMPLEMENTED)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
from jaaql.mvc.base_controller import BaseJAAQLController
|
|
2
|
-
from abc import abstractmethod, ABC
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class JAAQLControllerInterface(ABC):
|
|
6
|
-
def __init__(self):
|
|
7
|
-
pass
|
|
8
|
-
|
|
9
|
-
@abstractmethod
|
|
10
|
-
def route(self, base_controller: BaseJAAQLController):
|
|
11
|
-
pass
|
|
1
|
+
from jaaql.mvc.base_controller import BaseJAAQLController
|
|
2
|
+
from abc import abstractmethod, ABC
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class JAAQLControllerInterface(ABC):
|
|
6
|
+
def __init__(self):
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def route(self, base_controller: BaseJAAQLController):
|
|
11
|
+
pass
|
jaaql/mvc/model.py
CHANGED
|
@@ -85,6 +85,8 @@ ERR__reset_code_expired = "Reset code expired. Please use the link within the em
|
|
|
85
85
|
ERR__incorrect_reset_code = "Incorrect reset code"
|
|
86
86
|
ERR__as_attachment_unexpected = "Input 'as_attachment' unexpected as document is returned as a file link"
|
|
87
87
|
ERR__document_created_file = "Document is a file, cannot be downloaded in this way"
|
|
88
|
+
ERR__web_config_refused = "nginx -t refused the merged web config, so %s was put back as it was and nginx was not reloaded:\n%s"
|
|
89
|
+
ERR__web_config_not_reloaded = "nginx -t accepted the merged web config, now in %s, but nginx -s reload failed:\n%s"
|
|
88
90
|
|
|
89
91
|
PG__default_connection_string = "postgresql://postgres:%s@localhost:5432/jaaql"
|
|
90
92
|
DIR__scripts = "scripts"
|
|
@@ -194,6 +196,111 @@ def _explicit_type(explicit_types, parameter_key: str):
|
|
|
194
196
|
return explicit_type
|
|
195
197
|
|
|
196
198
|
|
|
199
|
+
# The HTTP/3 directives set_web_config puts before `listen 443 ssl`. It used to write them without line ends, glued onto the front of
|
|
200
|
+
# that line, so they are matched wherever they are on a line and only they are removed from it
|
|
201
|
+
WEB_CONFIG__http3_directive = re.compile(r"[ \t]*(?<![^\s;])(?:http3 on|quic_retry on|http3_max_concurrent_streams \d+"
|
|
202
|
+
r"|listen (?:\[::\]:)?443 quic[^;]*|add_header Alt-Svc 'h3=[^']*')[ \t]*;")
|
|
203
|
+
WEB_CONFIG__http3_lines = [
|
|
204
|
+
" http3 on;\n",
|
|
205
|
+
" quic_retry on;\n",
|
|
206
|
+
" http3_max_concurrent_streams 64;\n",
|
|
207
|
+
" listen 443 quic reuseport;\n",
|
|
208
|
+
" listen [::]:443 quic reuseport ipv6only=on;\n",
|
|
209
|
+
" add_header Alt-Svc 'h3=\":443\"; ma=86400';\n",
|
|
210
|
+
]
|
|
211
|
+
# HTTPS over IPv6 TCP. Certbot writes `listen [::]:443 ssl ipv6only=on;` next to `listen 443 ssl`, before it or after it, and earlier
|
|
212
|
+
# versions lost it whenever it came before, as part of the section they replaced, which left a box with an AAAA record answering HTTP/3
|
|
213
|
+
# over IPv6 but refusing HTTPS over IPv6 TCP
|
|
214
|
+
WEB_CONFIG__ipv6_tls_listen = re.compile(r"listen\s+\[::\]:443\s(?![^;]*\bquic\b)[^;]*\bssl\b[^;]*;")
|
|
215
|
+
# Written when a server has `listen 443 ssl` but no IPv6 TLS listen. nginx makes every [::] listen IPv6-only unless told otherwise, so
|
|
216
|
+
# it binds beside 0.0.0.0:443 and beside the UDP [::]:443 of QUIC, whose options are kept apart from TCP's; with no options of its own
|
|
217
|
+
# it cannot clash with another server's options for [::]:443 either
|
|
218
|
+
WEB_CONFIG__ipv6_tls_listen_line = " listen [::]:443 ssl;\n"
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def _place_ipv6_tls_listens(lines: list) -> list:
|
|
222
|
+
# Each server block with a `listen 443 ssl` gets exactly one IPv6 TLS listen, on the line after it: the one it had wherever it was
|
|
223
|
+
# (Certbot's, with its options and comment), else WEB_CONFIG__ipv6_tls_listen_line. Server blocks end with a `}` in the first column
|
|
224
|
+
servers = [[]]
|
|
225
|
+
for line in lines:
|
|
226
|
+
servers[-1].append(line)
|
|
227
|
+
if line.startswith("}"):
|
|
228
|
+
servers.append([])
|
|
229
|
+
|
|
230
|
+
placed_lines = []
|
|
231
|
+
for server in servers:
|
|
232
|
+
listen_ssl_at = next((at for at, line in enumerate(server) if line.strip().startswith("listen 443 ssl")), None)
|
|
233
|
+
if listen_ssl_at is not None:
|
|
234
|
+
ipv6_listens = [line for line in server if WEB_CONFIG__ipv6_tls_listen.match(line.strip())]
|
|
235
|
+
ipv6_listen = ipv6_listens[0].rstrip("\n") + "\n" if ipv6_listens else WEB_CONFIG__ipv6_tls_listen_line
|
|
236
|
+
listen_ssl = server[listen_ssl_at]
|
|
237
|
+
server = [line for line in server if not WEB_CONFIG__ipv6_tls_listen.match(line.strip())]
|
|
238
|
+
listen_ssl_at = server.index(listen_ssl) + 1
|
|
239
|
+
server[listen_ssl_at:listen_ssl_at] = [ipv6_listen]
|
|
240
|
+
placed_lines.extend(server)
|
|
241
|
+
return placed_lines
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def _merge_web_config(lines: list, new_data: str) -> list | None:
|
|
245
|
+
# The lines of /etc/nginx/conf.d/jaaql.conf with the application's nginx config in place of each section from `charset` to the end
|
|
246
|
+
# of its server block (or `listen 443 ssl`), HTTP/3 in front of `listen 443 ssl` unless JAAQL_HTTP3 is FALSE, one IPv6 TLS listen
|
|
247
|
+
# after it, and no limit_req in the localhost server; None when that would lose a TLS listen Certbot put in
|
|
248
|
+
http3 = os.environ.get("JAAQL_HTTP3", "TRUE").upper() != "FALSE"
|
|
249
|
+
|
|
250
|
+
# Strip our existing HTTP/3 directives so they can be cleanly re-added in the second pass, keeping whatever else their line holds
|
|
251
|
+
stripped_lines = []
|
|
252
|
+
for line in lines:
|
|
253
|
+
stripped = WEB_CONFIG__http3_directive.sub("", line)
|
|
254
|
+
if stripped != line and stripped.strip() == "":
|
|
255
|
+
continue
|
|
256
|
+
stripped_lines.append(stripped)
|
|
257
|
+
|
|
258
|
+
# Before the section is replaced, so that an IPv6 TLS listen inside it is moved out instead of being replaced with it
|
|
259
|
+
stripped_lines = _place_ipv6_tls_listens(stripped_lines)
|
|
260
|
+
|
|
261
|
+
# Initialize variables to track the current state and to store updated lines
|
|
262
|
+
in_section = False
|
|
263
|
+
updated_lines = []
|
|
264
|
+
|
|
265
|
+
for line in stripped_lines:
|
|
266
|
+
if line.strip().startswith('charset'):
|
|
267
|
+
in_section = True
|
|
268
|
+
continue # Skip to the next iteration
|
|
269
|
+
elif (line.startswith('}') or line.strip().startswith("listen 443 ssl") or line.strip().startswith("# listen 443 ssl")) and in_section:
|
|
270
|
+
# Append new data before the end marker when in a section
|
|
271
|
+
updated_lines.append(new_data + "\n")
|
|
272
|
+
in_section = False
|
|
273
|
+
|
|
274
|
+
if not in_section or line.startswith('}') or line.strip().startswith("listen 443 ssl") or line.strip().startswith("# listen 443 ssl"):
|
|
275
|
+
updated_lines.append(line)
|
|
276
|
+
|
|
277
|
+
second_iteration_updated_lines = []
|
|
278
|
+
in_localhost = False
|
|
279
|
+
for line in updated_lines:
|
|
280
|
+
if line.strip().startswith("server_name localhost;"):
|
|
281
|
+
in_localhost = True
|
|
282
|
+
|
|
283
|
+
if line.startswith("}"):
|
|
284
|
+
in_localhost = False
|
|
285
|
+
|
|
286
|
+
if http3 and line.strip().startswith("listen 443 ssl"):
|
|
287
|
+
second_iteration_updated_lines.extend(WEB_CONFIG__http3_lines)
|
|
288
|
+
|
|
289
|
+
if not in_localhost or not line.strip().startswith("limit_req"): # Ignore limit req for local requests
|
|
290
|
+
second_iteration_updated_lines.append(line)
|
|
291
|
+
|
|
292
|
+
# Defensive: if the input had `listen 443 ssl` or `listen [::]:443 ssl` (Certbot installed them) but our output dropped one, refuse to
|
|
293
|
+
# write. Better to leave Certbot's working config in place than overwrite with a broken one
|
|
294
|
+
input_had_ssl = any('listen 443 ssl' in line for line in lines)
|
|
295
|
+
output_has_ssl = any('listen 443 ssl' in line for line in second_iteration_updated_lines)
|
|
296
|
+
input_had_ipv6_ssl = any(WEB_CONFIG__ipv6_tls_listen.match(line.strip()) for line in lines)
|
|
297
|
+
output_has_ipv6_ssl = any(WEB_CONFIG__ipv6_tls_listen.match(line.strip()) for line in second_iteration_updated_lines)
|
|
298
|
+
if (input_had_ssl and not output_has_ssl) or (input_had_ipv6_ssl and not output_has_ipv6_ssl):
|
|
299
|
+
return None
|
|
300
|
+
|
|
301
|
+
return second_iteration_updated_lines
|
|
302
|
+
|
|
303
|
+
|
|
197
304
|
class JAAQLModel(BaseJAAQLModel):
|
|
198
305
|
VERIFICATION_QUEUE = None
|
|
199
306
|
|
|
@@ -1436,68 +1543,37 @@ WHERE
|
|
|
1436
1543
|
print("Could not find config file '" + config_path + "'")
|
|
1437
1544
|
return
|
|
1438
1545
|
|
|
1439
|
-
|
|
1546
|
+
with open(config_path, "r") as config_file:
|
|
1547
|
+
new_data = config_file.read()
|
|
1440
1548
|
new_data = new_data.replace("{{JAAQL_INSTALL_LOCATION}}", os.environ.get("INSTALL_PATH"))
|
|
1441
1549
|
|
|
1442
|
-
# Read the file content
|
|
1550
|
+
# Read the file content, and keep its bytes to put back should nginx refuse what replaces it
|
|
1551
|
+
with open(file_path, 'rb') as file:
|
|
1552
|
+
previous_content = file.read()
|
|
1443
1553
|
with open(file_path, 'r') as file:
|
|
1444
1554
|
lines = file.readlines()
|
|
1445
1555
|
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
and "listen [::]:443 quic" not in l
|
|
1450
|
-
and "http3 on;" not in l.strip()
|
|
1451
|
-
and not (l.strip().startswith("add_header Alt-Svc") and "h3=" in l)]
|
|
1452
|
-
|
|
1453
|
-
# Initialize variables to track the current state and to store updated lines
|
|
1454
|
-
in_section = False
|
|
1455
|
-
updated_lines = []
|
|
1456
|
-
|
|
1457
|
-
for line in lines:
|
|
1458
|
-
if line.strip().startswith('charset'):
|
|
1459
|
-
in_section = True
|
|
1460
|
-
continue # Skip to the next iteration
|
|
1461
|
-
elif (line.startswith('}') or line.strip().startswith("listen 443 ssl") or line.strip().startswith("# listen 443 ssl")) and in_section:
|
|
1462
|
-
# Append new data before the end marker when in a section
|
|
1463
|
-
updated_lines.append(new_data + "\n")
|
|
1464
|
-
in_section = False
|
|
1465
|
-
|
|
1466
|
-
if not in_section or line.startswith('}') or line.strip().startswith("listen 443 ssl") or line.strip().startswith("# listen 443 ssl"):
|
|
1467
|
-
updated_lines.append(line)
|
|
1468
|
-
|
|
1469
|
-
second_iteration_updated_lines = []
|
|
1470
|
-
in_localhost = False
|
|
1471
|
-
for line in updated_lines:
|
|
1472
|
-
if line.strip().startswith("server_name localhost;"):
|
|
1473
|
-
in_localhost = True
|
|
1474
|
-
|
|
1475
|
-
if line.startswith("}"):
|
|
1476
|
-
in_localhost = False
|
|
1477
|
-
|
|
1478
|
-
if line.strip().startswith("listen 443 ssl"):
|
|
1479
|
-
second_iteration_updated_lines.append(" http3 on;")
|
|
1480
|
-
second_iteration_updated_lines.append(" listen 443 quic reuseport;")
|
|
1481
|
-
second_iteration_updated_lines.append(" listen [::]:443 quic reuseport ipv6only=on;")
|
|
1482
|
-
second_iteration_updated_lines.append(" add_header Alt-Svc 'h3=\":443\"; ma=86400';")
|
|
1483
|
-
|
|
1484
|
-
if not in_localhost or not line.strip().startswith("limit_req"): # Ignore limit req for local requests
|
|
1485
|
-
second_iteration_updated_lines.append(line)
|
|
1486
|
-
|
|
1487
|
-
# Defensive: if the input had `listen 443 ssl` (Certbot installed it) but
|
|
1488
|
-
# our output dropped it, refuse to write. Better to leave Certbot's working
|
|
1489
|
-
# config in place than overwrite with a broken one.
|
|
1490
|
-
input_had_ssl = any('listen 443 ssl' in l for l in open(file_path).readlines())
|
|
1491
|
-
output_has_ssl = any('listen 443 ssl' in l for l in second_iteration_updated_lines)
|
|
1492
|
-
if input_had_ssl and not output_has_ssl:
|
|
1493
|
-
print('set_web_config aborting: would have lost listen 443 ssl', file=sys.stderr)
|
|
1556
|
+
merged_lines = _merge_web_config(lines, new_data)
|
|
1557
|
+
if merged_lines is None:
|
|
1558
|
+
print('set_web_config aborting: would have lost listen 443 ssl or listen [::]:443 ssl', file=sys.stderr)
|
|
1494
1559
|
return
|
|
1495
1560
|
|
|
1496
1561
|
# Write the updated content back to the file
|
|
1497
1562
|
with open(file_path, 'w') as file:
|
|
1498
|
-
file.writelines(
|
|
1499
|
-
|
|
1500
|
-
|
|
1563
|
+
file.writelines(merged_lines)
|
|
1564
|
+
|
|
1565
|
+
# nginx -t reads the whole configuration, this file included. One it refuses is never reloaded: the file is put back as it
|
|
1566
|
+
# was, so nginx goes on serving what it has and starts again with it
|
|
1567
|
+
nginx_test = subprocess.run(['nginx', '-t'], capture_output=True, text=True)
|
|
1568
|
+
if nginx_test.returncode != 0:
|
|
1569
|
+
with open(file_path, 'wb') as file:
|
|
1570
|
+
file.write(previous_content)
|
|
1571
|
+
raise HttpStatusException(ERR__web_config_refused % (file_path, nginx_test.stderr.strip()), HTTPStatus.INTERNAL_SERVER_ERROR)
|
|
1572
|
+
|
|
1573
|
+
nginx_reload = subprocess.run(['nginx', '-s', 'reload'], capture_output=True, text=True)
|
|
1574
|
+
if nginx_reload.returncode != 0:
|
|
1575
|
+
raise HttpStatusException(ERR__web_config_not_reloaded % (file_path, nginx_reload.stderr.strip()),
|
|
1576
|
+
HTTPStatus.INTERNAL_SERVER_ERROR)
|
|
1501
1577
|
else:
|
|
1502
1578
|
print("No headers set for local debugging server")
|
|
1503
1579
|
|
jaaql/mvc/model_interface.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from jaaql.mvc.model import JAAQLModel
|
|
2
|
-
from abc import ABC
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class JAAQLModelInterface(ABC):
|
|
6
|
-
def __init__(self):
|
|
7
|
-
self.base_model: JAAQLModel = None
|
|
8
|
-
|
|
9
|
-
def set_model(self, base_model: JAAQLModel):
|
|
10
|
-
self.base_model = base_model
|
|
1
|
+
from jaaql.mvc.model import JAAQLModel
|
|
2
|
+
from abc import ABC
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class JAAQLModelInterface(ABC):
|
|
6
|
+
def __init__(self):
|
|
7
|
+
self.base_model: JAAQLModel = None
|
|
8
|
+
|
|
9
|
+
def set_model(self, base_model: JAAQLModel):
|
|
10
|
+
self.base_model = base_model
|
jaaql/patch.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
def monkey_patch():
|
|
2
|
-
from gevent import monkey
|
|
3
|
-
monkey.patch_all()
|
|
4
|
-
|
|
5
|
-
import requests_unixsocket
|
|
6
|
-
requests_unixsocket.monkeypatch()
|
|
1
|
+
def monkey_patch():
|
|
2
|
+
from gevent import monkey
|
|
3
|
+
monkey.patch_all()
|
|
4
|
+
|
|
5
|
+
import requests_unixsocket
|
|
6
|
+
requests_unixsocket.monkeypatch()
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
<!--This file is based on
|
|
2
|
-
https://github.com/swagger-api/swagger-ui/blob/17093f2c7c0b77376d3cd7124dc35969c54ee0c6/dist/index.html
|
|
3
|
-
(Copyright 2020 SmartBear Software, Licensed under Apache 2.0)-->
|
|
4
|
-
|
|
5
|
-
<!-- HTML for static distribution bundle build -->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html lang="en">
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8">
|
|
10
|
-
<title>Swagger UI - %s</title>
|
|
11
|
-
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.51.2/swagger-ui.min.css" />
|
|
12
|
-
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3.51.2/favicon-32x32.png" sizes="32x32" />
|
|
13
|
-
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3.51.2/favicon-16x16.png" sizes="16x16" />
|
|
14
|
-
<style>
|
|
15
|
-
html
|
|
16
|
-
{
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
overflow: -moz-scrollbars-vertical;
|
|
19
|
-
overflow-y: scroll;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
*,
|
|
23
|
-
*:before,
|
|
24
|
-
*:after
|
|
25
|
-
{
|
|
26
|
-
box-sizing: inherit;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
body
|
|
30
|
-
{
|
|
31
|
-
margin:0;
|
|
32
|
-
background: #fafafa;
|
|
33
|
-
}
|
|
34
|
-
</style>
|
|
35
|
-
</head>
|
|
36
|
-
|
|
37
|
-
<body>
|
|
38
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
|
|
39
|
-
<defs>
|
|
40
|
-
<symbol viewBox="0 0 20 20" id="unlocked">
|
|
41
|
-
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
|
|
42
|
-
</symbol>
|
|
43
|
-
|
|
44
|
-
<symbol viewBox="0 0 20 20" id="locked">
|
|
45
|
-
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
|
|
46
|
-
</symbol>
|
|
47
|
-
|
|
48
|
-
<symbol viewBox="0 0 20 20" id="close">
|
|
49
|
-
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
|
|
50
|
-
</symbol>
|
|
51
|
-
|
|
52
|
-
<symbol viewBox="0 0 20 20" id="large-arrow">
|
|
53
|
-
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
|
|
54
|
-
</symbol>
|
|
55
|
-
|
|
56
|
-
<symbol viewBox="0 0 20 20" id="large-arrow-down">
|
|
57
|
-
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
|
|
58
|
-
</symbol>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<symbol viewBox="0 0 24 24" id="jump-to">
|
|
62
|
-
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
|
|
63
|
-
</symbol>
|
|
64
|
-
|
|
65
|
-
<symbol viewBox="0 0 24 24" id="expand">
|
|
66
|
-
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
67
|
-
</symbol>
|
|
68
|
-
|
|
69
|
-
</defs>
|
|
70
|
-
</svg>
|
|
71
|
-
|
|
72
|
-
<div id="swagger-ui"></div>
|
|
73
|
-
|
|
74
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.51.2/swagger-ui-bundle.min.js" charset="UTF-8"> </script>
|
|
75
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.51.2/swagger-ui-standalone-preset.min.js" charset="UTF-8"> </script>
|
|
76
|
-
<script>
|
|
77
|
-
window.onload = function() {
|
|
78
|
-
window.ui = SwaggerUIBundle({
|
|
79
|
-
%s,
|
|
80
|
-
dom_id: '#swagger-ui',
|
|
81
|
-
deepLinking: true,
|
|
82
|
-
presets: [
|
|
83
|
-
SwaggerUIBundle.presets.apis,
|
|
84
|
-
SwaggerUIStandalonePreset
|
|
85
|
-
],
|
|
86
|
-
plugins: [
|
|
87
|
-
SwaggerUIBundle.plugins.DownloadUrl
|
|
88
|
-
],
|
|
89
|
-
layout: "StandaloneLayout"
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
</script>
|
|
93
|
-
</body>
|
|
1
|
+
<!--This file is based on
|
|
2
|
+
https://github.com/swagger-api/swagger-ui/blob/17093f2c7c0b77376d3cd7124dc35969c54ee0c6/dist/index.html
|
|
3
|
+
(Copyright 2020 SmartBear Software, Licensed under Apache 2.0)-->
|
|
4
|
+
|
|
5
|
+
<!-- HTML for static distribution bundle build -->
|
|
6
|
+
<!DOCTYPE html>
|
|
7
|
+
<html lang="en">
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8">
|
|
10
|
+
<title>Swagger UI - %s</title>
|
|
11
|
+
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.51.2/swagger-ui.min.css" />
|
|
12
|
+
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3.51.2/favicon-32x32.png" sizes="32x32" />
|
|
13
|
+
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3.51.2/favicon-16x16.png" sizes="16x16" />
|
|
14
|
+
<style>
|
|
15
|
+
html
|
|
16
|
+
{
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
overflow: -moz-scrollbars-vertical;
|
|
19
|
+
overflow-y: scroll;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
*,
|
|
23
|
+
*:before,
|
|
24
|
+
*:after
|
|
25
|
+
{
|
|
26
|
+
box-sizing: inherit;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
body
|
|
30
|
+
{
|
|
31
|
+
margin:0;
|
|
32
|
+
background: #fafafa;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
|
|
37
|
+
<body>
|
|
38
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
|
|
39
|
+
<defs>
|
|
40
|
+
<symbol viewBox="0 0 20 20" id="unlocked">
|
|
41
|
+
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
|
|
42
|
+
</symbol>
|
|
43
|
+
|
|
44
|
+
<symbol viewBox="0 0 20 20" id="locked">
|
|
45
|
+
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
|
|
46
|
+
</symbol>
|
|
47
|
+
|
|
48
|
+
<symbol viewBox="0 0 20 20" id="close">
|
|
49
|
+
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
|
|
50
|
+
</symbol>
|
|
51
|
+
|
|
52
|
+
<symbol viewBox="0 0 20 20" id="large-arrow">
|
|
53
|
+
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
|
|
54
|
+
</symbol>
|
|
55
|
+
|
|
56
|
+
<symbol viewBox="0 0 20 20" id="large-arrow-down">
|
|
57
|
+
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
|
|
58
|
+
</symbol>
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<symbol viewBox="0 0 24 24" id="jump-to">
|
|
62
|
+
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
|
|
63
|
+
</symbol>
|
|
64
|
+
|
|
65
|
+
<symbol viewBox="0 0 24 24" id="expand">
|
|
66
|
+
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
67
|
+
</symbol>
|
|
68
|
+
|
|
69
|
+
</defs>
|
|
70
|
+
</svg>
|
|
71
|
+
|
|
72
|
+
<div id="swagger-ui"></div>
|
|
73
|
+
|
|
74
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.51.2/swagger-ui-bundle.min.js" charset="UTF-8"> </script>
|
|
75
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.51.2/swagger-ui-standalone-preset.min.js" charset="UTF-8"> </script>
|
|
76
|
+
<script>
|
|
77
|
+
window.onload = function() {
|
|
78
|
+
window.ui = SwaggerUIBundle({
|
|
79
|
+
%s,
|
|
80
|
+
dom_id: '#swagger-ui',
|
|
81
|
+
deepLinking: true,
|
|
82
|
+
presets: [
|
|
83
|
+
SwaggerUIBundle.presets.apis,
|
|
84
|
+
SwaggerUIStandalonePreset
|
|
85
|
+
],
|
|
86
|
+
plugins: [
|
|
87
|
+
SwaggerUIBundle.plugins.DownloadUrl
|
|
88
|
+
],
|
|
89
|
+
layout: "StandaloneLayout"
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
</script>
|
|
93
|
+
</body>
|
|
94
94
|
</html>
|