vortex-cli 8.6.0__tar.gz → 8.7.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.
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/PKG-INFO +1 -1
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/pyproject.toml +1 -1
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/webdesign.py +79 -21
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex_cli.egg-info/PKG-INFO +1 -1
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/LICENSE +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/README.md +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/setup.cfg +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/__init__.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/__main__.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/cli.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/colour.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/__init__.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/agenda.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/app.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/clean.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/clone.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/code.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/compile.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/db.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/diff.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/docs.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/execute.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/fetch.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/file.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/info.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/keyword.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/libs.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/log.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/object_.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/pull.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/search.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/servers.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/stats.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/use.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/watch.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/commands/weblog.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/constants.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/docs/Blackbook v2.md +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/docs/Blackbook.pdf +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/docs/index.html +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/docs/marked.min.js +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/git.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/lib/puakma-6.0.40.jar +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/libs.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/logging.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/main.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/models.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/output.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/registry.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/schedule.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/server_options.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/session_store.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/soap.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/spinner.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/sync.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/util.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex/workspace.py +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex_cli.egg-info/SOURCES.txt +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex_cli.egg-info/dependency_links.txt +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex_cli.egg-info/entry_points.txt +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex_cli.egg-info/requires.txt +0 -0
- {vortex_cli-8.6.0 → vortex_cli-8.7.0}/vortex_cli.egg-info/top_level.txt +0 -0
|
@@ -13,7 +13,7 @@ the requests go, explicitly - there is no probe and no fallback:
|
|
|
13
13
|
guards.
|
|
14
14
|
|
|
15
15
|
The gateway is webdesign's vortex API at a different base URL: everything
|
|
16
|
-
after `api` - the path, method,
|
|
16
|
+
after `api` - the path, method, JSON body and reply - is
|
|
17
17
|
webdesign's own. It adds three things:
|
|
18
18
|
|
|
19
19
|
- Role checks. A route the gateway does not map, or a caller without the
|
|
@@ -45,11 +45,17 @@ Behaviour compensated for here:
|
|
|
45
45
|
- Design params, app params and a keyword's values are snapshots: each
|
|
46
46
|
PUT replaces the whole set.
|
|
47
47
|
- DELETE answers the plain string "Success", not JSON.
|
|
48
|
-
- webdesign's own errors
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
- webdesign's own errors come in two shapes. The original vortex action
|
|
49
|
+
(webdesign 4.1 and older) answers plain text: 404 "Api does not
|
|
50
|
+
exist: ..." means the route is missing; any other 404 is a not-found;
|
|
51
|
+
500 carries the server's error string. The JSONActionRunner action
|
|
52
|
+
(webdesign 4.2, Puakma 6.2) answers {"status", "error", "message"}
|
|
53
|
+
with a real status - 400 for a bad id or body, 405 for a wrong verb,
|
|
54
|
+
404 "No API endpoint matches ..." for a missing route. An identity
|
|
55
|
+
the server does not accept gets a login page with HTTP 200 - detected
|
|
56
|
+
by content.
|
|
57
|
+
- Bodies are raw application/json. The JSONActionRunner action cannot
|
|
58
|
+
read a form field; the original one reads either.
|
|
53
59
|
- Keywords have no upsert: find-by-name, create-or-update and the
|
|
54
60
|
consolidation of duplicate KEYWORD rows happen client-side
|
|
55
61
|
(upsert_keyword).
|
|
@@ -119,7 +125,14 @@ REQUEST_TIMEOUT_SECONDS = 30
|
|
|
119
125
|
# object run waits for the action to finish (prod's Cloudflare still cuts at ~100s)
|
|
120
126
|
RUN_TIMEOUT_SECONDS = 300
|
|
121
127
|
|
|
122
|
-
|
|
128
|
+
# What webdesign says for a route it does not serve: the plain-text 404 of
|
|
129
|
+
# the original vortex action, and the JSON 404 message of the
|
|
130
|
+
# JSONActionRunner one (Puakma 6.2 / webdesign 4.2)
|
|
131
|
+
_ROUTE_MISSING = ("Api does not exist", "No API endpoint matches")
|
|
132
|
+
# The JSONActionRunner action behind a gateway older than 0.5.2 / 0.3.1: the
|
|
133
|
+
# forwarded path keeps its "vortex" prefix, so every route is "missing"
|
|
134
|
+
_GATEWAY_PATH_MISREAD = re.compile(r"No API endpoint matches \w+ /vortex(/|$)")
|
|
135
|
+
_NOT_JSON = object()
|
|
123
136
|
|
|
124
137
|
|
|
125
138
|
class WebDesignError(Exception):
|
|
@@ -317,23 +330,44 @@ def _parse(
|
|
|
317
330
|
refused = _refusal(resp, url)
|
|
318
331
|
if refused is not None:
|
|
319
332
|
raise refused
|
|
320
|
-
|
|
333
|
+
status = resp.status_code
|
|
334
|
+
# parsed once: a whole-application reply is one large object
|
|
335
|
+
reply: Any = _NOT_JSON
|
|
336
|
+
if text[:64].lstrip().startswith("{"):
|
|
337
|
+
try:
|
|
338
|
+
reply = json.loads(text)
|
|
339
|
+
except (json.JSONDecodeError, ValueError):
|
|
340
|
+
pass
|
|
341
|
+
runner_error = _runner_error(reply)
|
|
342
|
+
if runner_error is not None:
|
|
343
|
+
# webdesign's own status wins: a gateway that predates the
|
|
344
|
+
# JSONActionRunner webdesign hands its error body back as a 200
|
|
345
|
+
status, text = runner_error
|
|
346
|
+
if status == 404:
|
|
347
|
+
if _GATEWAY_PATH_MISREAD.match(text):
|
|
348
|
+
raise WebDesignUnavailable(
|
|
349
|
+
f"HTTP 404 from {url}: webdesign read the gateway's forwarded "
|
|
350
|
+
"path as a route of its own - this webdesign (4.2, Puakma 6.2) "
|
|
351
|
+
"needs a newer vortex gateway (update the gateway app)"
|
|
352
|
+
)
|
|
321
353
|
if text.startswith(_ROUTE_MISSING):
|
|
322
354
|
raise WebDesignUnavailable(
|
|
323
355
|
f"HTTP 404 from {url}: webdesign does not serve this vortex "
|
|
324
356
|
"route (update system/webdesign)"
|
|
325
357
|
)
|
|
326
358
|
raise WebDesignError(text.strip() or f"HTTP 404 from {url}", "NOT_FOUND")
|
|
327
|
-
if 300 <=
|
|
359
|
+
if 300 <= status < 400:
|
|
328
360
|
redirect = _https_redirect(resp, url, server_name)
|
|
329
361
|
if redirect is not None:
|
|
330
362
|
raise WebDesignUnavailable(redirect, "UNAVAILABLE")
|
|
331
363
|
# Puakma redirects an unauthenticated request to its login page
|
|
332
364
|
raise WebDesignUnavailable(access_hint, "FORBIDDEN")
|
|
333
|
-
if
|
|
365
|
+
if status in (401, 403):
|
|
334
366
|
raise WebDesignUnavailable(access_hint, "FORBIDDEN")
|
|
335
|
-
if
|
|
336
|
-
raise WebDesignError(f"HTTP {
|
|
367
|
+
if status != 200:
|
|
368
|
+
raise WebDesignError(f"HTTP {status} from {url}: {text.strip()}")
|
|
369
|
+
if reply is not _NOT_JSON:
|
|
370
|
+
return reply
|
|
337
371
|
stripped = text.strip()
|
|
338
372
|
if stripped == "Success":
|
|
339
373
|
return stripped
|
|
@@ -347,6 +381,25 @@ def _parse(
|
|
|
347
381
|
) from None
|
|
348
382
|
|
|
349
383
|
|
|
384
|
+
def _runner_error(reply: Any) -> tuple[int, str] | None:
|
|
385
|
+
"""
|
|
386
|
+
(status, message) when reply is the error body of webdesign's
|
|
387
|
+
JSONActionRunner vortex action (Puakma 6.2 / webdesign 4.2):
|
|
388
|
+
{"status": 404, "error": "Not Found", "message": "..."} - exactly
|
|
389
|
+
those keys, so no successful reply can be mistaken for one. The
|
|
390
|
+
original action answered errors as plain text instead.
|
|
391
|
+
"""
|
|
392
|
+
if not isinstance(reply, dict) or not set(reply) <= {"status", "error", "message"}:
|
|
393
|
+
return None
|
|
394
|
+
status, reason = reply.get("status"), reply.get("error")
|
|
395
|
+
if isinstance(status, bool) or not isinstance(status, int) or status < 400:
|
|
396
|
+
return None
|
|
397
|
+
if not isinstance(reason, str):
|
|
398
|
+
return None
|
|
399
|
+
message = reply.get("message")
|
|
400
|
+
return status, message if isinstance(message, str) and message else reason
|
|
401
|
+
|
|
402
|
+
|
|
350
403
|
def to_int(value: Any) -> int:
|
|
351
404
|
"""An id/number from a reply - getJSON() sends numeric columns as doubles."""
|
|
352
405
|
return int(float(value))
|
|
@@ -410,7 +463,7 @@ class WebDesignClient:
|
|
|
410
463
|
logger.debug(f"{method} {url}")
|
|
411
464
|
try:
|
|
412
465
|
resp = self.server._client.request(
|
|
413
|
-
method, url,
|
|
466
|
+
method, url, params=params, timeout=timeout, **_json_body(body)
|
|
414
467
|
)
|
|
415
468
|
except httpx.HTTPError as e:
|
|
416
469
|
raise WebDesignUnavailable(f"request failed: {e} ({url})") from e
|
|
@@ -427,7 +480,7 @@ class WebDesignClient:
|
|
|
427
480
|
logger.debug(f"{method} {url}")
|
|
428
481
|
try:
|
|
429
482
|
resp = await self.server._aclient.request(
|
|
430
|
-
method, url,
|
|
483
|
+
method, url, timeout=timeout, **_json_body(body)
|
|
431
484
|
)
|
|
432
485
|
except httpx.HTTPError as e:
|
|
433
486
|
raise WebDesignUnavailable(f"request failed: {e} ({url})") from e
|
|
@@ -797,16 +850,21 @@ class WebDesignClient:
|
|
|
797
850
|
raise WebDesignError(f"delete of column {column_id}: {reply}")
|
|
798
851
|
|
|
799
852
|
|
|
800
|
-
def
|
|
853
|
+
def _json_body(body: Any) -> dict[str, Any]:
|
|
801
854
|
"""
|
|
802
|
-
The
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
855
|
+
The request arguments that carry body as a raw application/json
|
|
856
|
+
body - the one encoding every webdesign reads. The JSONActionRunner
|
|
857
|
+
vortex action (Puakma 6.2 / webdesign 4.2) rejects the 'Data' form
|
|
858
|
+
field 8.x used to send (400, "not a valid JSON object"); the original
|
|
859
|
+
action reads either. A raw body over ~512 KB once arrived empty, which
|
|
860
|
+
is why the form field was used - it no longer does (6.1.16, 6.2.0).
|
|
806
861
|
"""
|
|
807
862
|
if body is None:
|
|
808
|
-
return
|
|
809
|
-
return {
|
|
863
|
+
return {}
|
|
864
|
+
return {
|
|
865
|
+
"content": json.dumps(body).encode(),
|
|
866
|
+
"headers": {"Content-Type": "application/json"},
|
|
867
|
+
}
|
|
810
868
|
|
|
811
869
|
|
|
812
870
|
def _as_dict(value: Any) -> dict[str, Any]:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|