jaaql-middleware-python 4.29.0__tar.gz → 4.30.0__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.
- {jaaql-middleware-python-4.29.0/jaaql_middleware_python.egg-info → jaaql-middleware-python-4.30.0}/PKG-INFO +1 -1
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/constants.py +1 -1
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/db/db_utils_no_circ.py +15 -15
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/documentation/documentation_internal.py +10 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/documentation/documentation_shared.py +24 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/base_model.py +22 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/controller.py +16 -4
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/model.py +72 -2
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0/jaaql_middleware_python.egg-info}/PKG-INFO +1 -1
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/LICENSE.txt +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/README.md +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/config/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/config/config-docker.ini +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/config/config-test.ini +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/config/config.ini +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/config_constants.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/db/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/db/db_interface.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/db/db_pg_interface.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/db/db_utils.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/documentation/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/documentation/documentation_public.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/email/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/email/email_manager.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/email/email_manager_service.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/email/patch_ems.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/exceptions/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/exceptions/custom_http_status.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/exceptions/http_status_exception.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/exceptions/jaaql_interpretable_handled_errors.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/exceptions/not_yet_implement_exception.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/generated_constants.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/interpreter/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/interpreter/interpret_jaaql.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/jaaql.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/migrations/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/migrations/migrations.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/base_controller.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/controller_interface.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/exception_queries.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/generated_queries.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/handmade_queries.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/model_interface.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/response.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/openapi/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/openapi/swagger_documentation.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/patch.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/scripts/01.install_domains.generated.sql +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/scripts/02.install_super_user.exceptions.sql +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/scripts/03.install_super_user.handwritten.sql +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/scripts/04.install_jaaql_data_structures.generated.sql +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/scripts/05.install_static_data.generated.sql +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/scripts/06.install_jaaql.exceptions.sql +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/scripts/ZZZZ.generated_functions_views_and_permissions.sql +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/scripts/ZZZZ.reset_references.sql +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/scripts/swagger_template.html +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/services/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/services/cached_canned_query_service.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/services/migrations_manager_service.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/services/patch_mms.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/services/patch_shared_var_service.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/services/shared_var_service.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/utilities/__init__.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/utilities/crypt_utils.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/utilities/options.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/utilities/utils.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/utilities/utils_no_project_imports.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/utilities/vault.py +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql_middleware_python.egg-info/SOURCES.txt +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql_middleware_python.egg-info/dependency_links.txt +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql_middleware_python.egg-info/requires.txt +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql_middleware_python.egg-info/top_level.txt +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/setup.cfg +0 -0
- {jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jaaql-middleware-python
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.30.0
|
|
4
4
|
Summary: The jaaql package, allowing for rapid development and deployment of RESTful HTTP applications
|
|
5
5
|
Home-page: https://github.com/JAAQL/JAAQL-middleware-python
|
|
6
6
|
Author: Software Quality Measurement and Improvement bv
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/db/db_utils_no_circ.py
RENAMED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
1
|
from jaaql.mvc.exception_queries import QUERY__fetch_application_schemas, KG__application_schema__application, KG__application__is_live, \
|
|
4
2
|
KG__application_schema__name, KEY__is_default
|
|
5
3
|
from queue import Queue
|
|
@@ -17,22 +15,24 @@ def get_jaaql_connection_to_db(vault, config, database: str, jaaql_connection: D
|
|
|
17
15
|
return create_interface_for_db(vault, config, jaaql_connection.role, database)
|
|
18
16
|
|
|
19
17
|
|
|
20
|
-
def get_required_db(vault, config, jaaql_connection: DBInterface, inputs: dict, account_id: str, conn=None, interface: DBInterface = None):
|
|
18
|
+
def get_required_db(vault, config, jaaql_connection: DBInterface, inputs: dict, account_id: str, conn=None, interface: DBInterface = None, db_cache=None):
|
|
21
19
|
if not isinstance(inputs, dict):
|
|
22
20
|
raise HttpStatusException("Expected object or string input")
|
|
23
21
|
|
|
24
22
|
if conn is None:
|
|
25
23
|
if KEY__application in inputs:
|
|
26
|
-
schemas =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
schemas = db_cache
|
|
25
|
+
if schemas is None:
|
|
26
|
+
schemas = execute_supplied_statement(jaaql_connection, QUERY__fetch_application_schemas, {
|
|
27
|
+
KG__application_schema__application: inputs[KEY__application]
|
|
28
|
+
}, as_objects=True)
|
|
29
|
+
if len(schemas) == 0:
|
|
30
|
+
application__select(jaaql_connection, inputs[KEY__application],
|
|
31
|
+
singleton_message=f"Application '{inputs[KEY__application]}' does not exist. Are you sure you have installed it?")
|
|
32
|
+
raise HttpStatusException("Application has no schemas!")
|
|
33
|
+
if not schemas[0][KG__application__is_live]:
|
|
34
|
+
raise HttpStatusException("Application is currently being deployed. Please wait a few minutes until deployment is complete")
|
|
35
|
+
schemas = {itm[KG__application_schema__name]: itm for itm in schemas}
|
|
36
36
|
|
|
37
37
|
found_db = None
|
|
38
38
|
if KEY__schema in inputs and inputs[KEY__schema] is not None:
|
|
@@ -68,11 +68,11 @@ def get_required_db(vault, config, jaaql_connection: DBInterface, inputs: dict,
|
|
|
68
68
|
|
|
69
69
|
def submit(vault, config, db_crypt_key, jaaql_connection: DBInterface, inputs: dict, account_id: str, verification_hook: Queue = None,
|
|
70
70
|
cached_canned_query_service=None, as_objects: bool = False, singleton: bool = False, keep_alive_conn: bool = False,
|
|
71
|
-
conn=None, interface: DBInterface = None):
|
|
71
|
+
conn=None, interface: DBInterface = None, db_cache=None):
|
|
72
72
|
if not isinstance(inputs, dict):
|
|
73
73
|
raise HttpStatusException("Expected object or string input")
|
|
74
74
|
|
|
75
|
-
required_db = get_required_db(vault, config, jaaql_connection, inputs, account_id, conn, interface)
|
|
75
|
+
required_db = get_required_db(vault, config, jaaql_connection, inputs, account_id, conn, interface, db_cache=db_cache)
|
|
76
76
|
|
|
77
77
|
prevent_unused = inputs.pop(KEY__prevent_unused_parameters) if KEY__prevent_unused_parameters in inputs else True
|
|
78
78
|
|
|
@@ -260,6 +260,16 @@ DOCUMENTATION__last_successful_build_timestamp = SwaggerDocumentation(
|
|
|
260
260
|
]
|
|
261
261
|
)
|
|
262
262
|
|
|
263
|
+
DOCUMENTATION__flush_cache = SwaggerDocumentation(
|
|
264
|
+
tags="Cache",
|
|
265
|
+
security=False,
|
|
266
|
+
methods=SwaggerMethod(
|
|
267
|
+
name="Flush JAAQL Cache",
|
|
268
|
+
description="Triggers a cache flush",
|
|
269
|
+
method=REST__GET,
|
|
270
|
+
)
|
|
271
|
+
)
|
|
272
|
+
|
|
263
273
|
DOCUMENTATION__cron = SwaggerDocumentation(
|
|
264
274
|
tags="Cron",
|
|
265
275
|
methods=SwaggerMethod(
|
|
@@ -169,3 +169,27 @@ DOCUMENTATION__submit = SwaggerDocumentation(
|
|
|
169
169
|
parallel_verification=True
|
|
170
170
|
)
|
|
171
171
|
)
|
|
172
|
+
|
|
173
|
+
DOCUMENTATION__execute = SwaggerDocumentation(
|
|
174
|
+
tags="Queries",
|
|
175
|
+
methods=SwaggerMethod(
|
|
176
|
+
name="Execute JAAQL pre-prepared query",
|
|
177
|
+
description="Executes a query from a list of pre-prepared queries. Returns results",
|
|
178
|
+
method=REST__POST,
|
|
179
|
+
arguments=ARG_RESP__allow_all,
|
|
180
|
+
response=RES__allow_all,
|
|
181
|
+
parallel_verification=True
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
DOCUMENTATION__call_proc = SwaggerDocumentation(
|
|
186
|
+
tags="Queries",
|
|
187
|
+
methods=SwaggerMethod(
|
|
188
|
+
name="Execute JAAQL database procedure",
|
|
189
|
+
description="Executes a procedure, returns results",
|
|
190
|
+
method=REST__POST,
|
|
191
|
+
arguments=ARG_RESP__allow_all,
|
|
192
|
+
response=RES__allow_all,
|
|
193
|
+
parallel_verification=True
|
|
194
|
+
)
|
|
195
|
+
)
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
import base64
|
|
4
5
|
import requests
|
|
6
|
+
import traceback
|
|
5
7
|
|
|
6
8
|
from jwcrypto import jwk
|
|
7
9
|
from cryptography import x509
|
|
10
|
+
|
|
8
11
|
from jaaql.utilities.vault import Vault, DIR__vault
|
|
9
12
|
from jaaql.db.db_interface import DBInterface
|
|
10
13
|
import jaaql.utilities.crypt_utils as crypt_utils
|
|
@@ -181,6 +184,21 @@ class BaseJAAQLModel:
|
|
|
181
184
|
|
|
182
185
|
return ret
|
|
183
186
|
|
|
187
|
+
def reload_cache(self):
|
|
188
|
+
print("Received cache flush instruction")
|
|
189
|
+
if os.path.exists("/queries/queries.json"):
|
|
190
|
+
try:
|
|
191
|
+
self.query_caches = json.loads(open("/queries/queries.json", "r").read())
|
|
192
|
+
for key, encoded_list in self.query_caches["queries"].items():
|
|
193
|
+
# Replace each encoded string in the list with its decoded version.
|
|
194
|
+
self.query_caches["queries"][key] = [
|
|
195
|
+
base64.b64decode(encoded).decode('utf-8') for encoded in encoded_list
|
|
196
|
+
]
|
|
197
|
+
self.db_cache = 1
|
|
198
|
+
print("Loaded query cache")
|
|
199
|
+
except:
|
|
200
|
+
traceback.print_exc()
|
|
201
|
+
|
|
184
202
|
def set_jaaql_lookup_connection(self):
|
|
185
203
|
if self.vault.has_obj(VAULT_KEY__jaaql_lookup_connection):
|
|
186
204
|
jaaql_uri = self.vault.get_obj(VAULT_KEY__jaaql_lookup_connection)
|
|
@@ -196,6 +214,10 @@ class BaseJAAQLModel:
|
|
|
196
214
|
self.migration_folder = migration_folder
|
|
197
215
|
self.is_container = is_container
|
|
198
216
|
|
|
217
|
+
self.query_caches = {}
|
|
218
|
+
self.db_cache = None
|
|
219
|
+
|
|
220
|
+
self.prevent_arbitrary_queries = os.environ.get("PREVENT_ARBITRARY_QUERIES", "false") == "true"
|
|
199
221
|
self.is_https = os.environ.get("IS_HTTPS", "false").lower().strip() == "true"
|
|
200
222
|
self.vigilant_sessions = os.environ.get("VIGILANT_SESSIONS", "false").lower().strip() == "true"
|
|
201
223
|
|
|
@@ -94,8 +94,16 @@ class JAAQLController(BaseJAAQLController):
|
|
|
94
94
|
return self.model.add_my_account_password(account_id, username, ip_address, is_the_anonymous_user, **http_inputs)
|
|
95
95
|
|
|
96
96
|
@self.publish_route('/submit', DOCUMENTATION__submit)
|
|
97
|
-
def submit(http_inputs: dict, account_id: str, verification_hook: queue.Queue):
|
|
98
|
-
return self.model.submit(http_inputs, account_id, verification_hook=verification_hook)
|
|
97
|
+
def submit(http_inputs: dict, account_id: str, verification_hook: queue.Queue, ip_address: str):
|
|
98
|
+
return self.model.submit(http_inputs, account_id, verification_hook=verification_hook, ip_address=ip_address)
|
|
99
|
+
|
|
100
|
+
@self.publish_route('/execute', DOCUMENTATION__execute)
|
|
101
|
+
def execute(http_inputs: dict, account_id: str, verification_hook: queue.Queue):
|
|
102
|
+
return self.model.execute(http_inputs, account_id, verification_hook=verification_hook)
|
|
103
|
+
|
|
104
|
+
@self.publish_route('/call-proc', DOCUMENTATION__execute)
|
|
105
|
+
def call_proc(http_inputs: dict, account_id: str, verification_hook: queue.Queue):
|
|
106
|
+
return self.model.call_proc(http_inputs, account_id, verification_hook=verification_hook)
|
|
99
107
|
|
|
100
108
|
@self.publish_route('/internal/clean', DOCUMENTATION__clean)
|
|
101
109
|
def clean(connection: DBInterface):
|
|
@@ -137,12 +145,16 @@ class JAAQLController(BaseJAAQLController):
|
|
|
137
145
|
self.model.add_cron_job_to_application(connection, http_inputs)
|
|
138
146
|
|
|
139
147
|
@self.publish_route('/build-time', DOCUMENTATION__last_successful_build_timestamp)
|
|
140
|
-
def
|
|
148
|
+
def build_time(http_inputs: dict, ip_address: str):
|
|
141
149
|
if self.is_post():
|
|
142
|
-
self.model.set_last_successful_build_time(http_inputs)
|
|
150
|
+
self.model.set_last_successful_build_time(http_inputs, ip_address)
|
|
143
151
|
else:
|
|
144
152
|
return self.model.get_last_successful_build_time()
|
|
145
153
|
|
|
154
|
+
@self.publish_route('/flush-cache', DOCUMENTATION__flush_cache)
|
|
155
|
+
def flush_cache(ip_address: str):
|
|
156
|
+
self.model.flush_cache(ip_address)
|
|
157
|
+
|
|
146
158
|
@self.publish_route('/webhook/<application>/<name>', DOCUMENTATION__webhook)
|
|
147
159
|
def handle_webhook(application: str, name: str, body: bytes, headers: dict, args: dict, response: JAAQLResponse):
|
|
148
160
|
self.model.handle_webhook(application, name, body, headers, args, response)
|
|
@@ -5,6 +5,7 @@ import tempfile
|
|
|
5
5
|
import traceback
|
|
6
6
|
import urllib.parse
|
|
7
7
|
import uuid
|
|
8
|
+
import signal
|
|
8
9
|
import secrets
|
|
9
10
|
from cryptography.hazmat.primitives import hashes
|
|
10
11
|
|
|
@@ -1846,10 +1847,79 @@ WHERE
|
|
|
1846
1847
|
else:
|
|
1847
1848
|
return 0
|
|
1848
1849
|
|
|
1849
|
-
def set_last_successful_build_time(self, http_inputs: dict):
|
|
1850
|
+
def set_last_successful_build_time(self, http_inputs: dict, ip_address: str):
|
|
1851
|
+
if ip_address not in IPS__local:
|
|
1852
|
+
raise UserUnauthorized()
|
|
1853
|
+
|
|
1850
1854
|
if os.environ.get("JAAQL_DEBUGGING") == "TRUE":
|
|
1851
1855
|
jaaql__update(self.jaaql_lookup_connection, last_successful_build_time=http_inputs[KG__jaaql__last_successful_build_time])
|
|
1852
1856
|
|
|
1853
|
-
def
|
|
1857
|
+
def flush_cache(self, ip_address: str):
|
|
1858
|
+
if ip_address not in IPS__local:
|
|
1859
|
+
raise UserUnauthorized()
|
|
1860
|
+
|
|
1861
|
+
os.kill(int(open("app.pid", "r").read()), signal.SIGUSR1)
|
|
1862
|
+
|
|
1863
|
+
def execute(self, inputs: dict, account_id: str, verification_hook: Queue = None, as_objects: bool = False, singleton: bool = False):
|
|
1864
|
+
if self.db_cache == 1:
|
|
1865
|
+
schemas = execute_supplied_statement(self.jaaql_lookup_connection, QUERY__fetch_application_schemas, {
|
|
1866
|
+
KG__application_schema__application: self.query_caches["application"]
|
|
1867
|
+
}, as_objects=True)
|
|
1868
|
+
if len(schemas) == 0:
|
|
1869
|
+
print("Couldn't find application " + self.query_caches["application"])
|
|
1870
|
+
raise Exception()
|
|
1871
|
+
self.db_cache = {itm[KG__application_schema__name]: itm for itm in schemas}
|
|
1872
|
+
print("Loaded DB Cache")
|
|
1873
|
+
|
|
1874
|
+
for key, val in inputs["query"].items():
|
|
1875
|
+
if isinstance(val, dict):
|
|
1876
|
+
trimmed = val["query"].strip()
|
|
1877
|
+
val["query"] = self.query_caches["queries"][trimmed.split(":")[0]][int(trimmed.split(":")[1])]
|
|
1878
|
+
else:
|
|
1879
|
+
trimmed = val.strip()
|
|
1880
|
+
inputs["query"][key] = self.query_caches["queries"][trimmed.split(":")[0]][int(trimmed.split(":")[1])]
|
|
1881
|
+
|
|
1882
|
+
return submit(self.vault, self.config, self.get_db_crypt_key(), self.jaaql_lookup_connection, inputs, account_id, verification_hook,
|
|
1883
|
+
self.cached_canned_query_service, as_objects=as_objects, singleton=singleton, db_cache=self.db_cache)
|
|
1884
|
+
|
|
1885
|
+
def call_proc(self, inputs: dict, account_id: str, verification_hook: Queue = None, as_objects: bool = False, singleton: bool = False):
|
|
1886
|
+
parameters = inputs["parameters"]
|
|
1887
|
+
query = "SELECT * FROM \"" + inputs["query"] + "\"("
|
|
1888
|
+
|
|
1889
|
+
parameter_keys = list(parameters.keys())
|
|
1890
|
+
introduced = False
|
|
1891
|
+
explicit_types = inputs.get("explicit_types", {})
|
|
1892
|
+
|
|
1893
|
+
absent = ""
|
|
1894
|
+
|
|
1895
|
+
for parameter_key in parameter_keys:
|
|
1896
|
+
if re.match(REGEX__dmbs_object_name, parameter_key) is None:
|
|
1897
|
+
raise HttpStatusException("Unsafe parameter key " + parameter_key)
|
|
1898
|
+
explicit_type = explicit_types.get(parameter_key)
|
|
1899
|
+
parameter_value = parameters[parameter_key]
|
|
1900
|
+
|
|
1901
|
+
if introduced:
|
|
1902
|
+
query += ","
|
|
1903
|
+
|
|
1904
|
+
if explicit_type and parameter_value is not None and explicit_type[0] != "_":
|
|
1905
|
+
query += f"\n\t{parameter_key} => :{parameter_key}::{explicit_type}"
|
|
1906
|
+
else:
|
|
1907
|
+
query += f"\n\t{parameter_key} => :{parameter_key}{absent}"
|
|
1908
|
+
|
|
1909
|
+
introduced = True
|
|
1910
|
+
|
|
1911
|
+
query += " )"
|
|
1912
|
+
|
|
1913
|
+
inputs["query"] = {
|
|
1914
|
+
"_jaaql_procedure": query
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
return submit(self.vault, self.config, self.get_db_crypt_key(), self.jaaql_lookup_connection, inputs, account_id, verification_hook,
|
|
1918
|
+
self.cached_canned_query_service, as_objects=as_objects, singleton=singleton, db_cache=self.db_cache)
|
|
1919
|
+
|
|
1920
|
+
def submit(self, inputs: dict, account_id: str, verification_hook: Queue = None, as_objects: bool = False, singleton: bool = False, ip_address: str = None):
|
|
1921
|
+
if ip_address not in IPS__local and self.prevent_arbitrary_queries:
|
|
1922
|
+
raise UnhandledJaaqlServerError("Not allowed to send queries to server!")
|
|
1923
|
+
|
|
1854
1924
|
return submit(self.vault, self.config, self.get_db_crypt_key(), self.jaaql_lookup_connection, inputs, account_id, verification_hook,
|
|
1855
1925
|
self.cached_canned_query_service, as_objects=as_objects, singleton=singleton)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jaaql-middleware-python
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.30.0
|
|
4
4
|
Summary: The jaaql package, allowing for rapid development and deployment of RESTful HTTP applications
|
|
5
5
|
Home-page: https://github.com/JAAQL/JAAQL-middleware-python
|
|
6
6
|
Author: Software Quality Measurement and Improvement bv
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/config/config-docker.ini
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/config/config-test.ini
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/db/db_pg_interface.py
RENAMED
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/documentation/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/email/email_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/exceptions/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/generated_constants.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/interpreter/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/migrations/__init__.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/migrations/migrations.py
RENAMED
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/base_controller.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/controller_interface.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/exception_queries.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/generated_queries.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/handmade_queries.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/mvc/model_interface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/services/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/services/patch_mms.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/utilities/__init__.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/utilities/crypt_utils.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.29.0 → jaaql-middleware-python-4.30.0}/jaaql/utilities/options.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|