tlnt-cli 1.8.0__tar.gz → 1.9.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.
Files changed (62) hide show
  1. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/PKG-INFO +4 -3
  2. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/README.md +3 -2
  3. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/pyproject.toml +1 -1
  4. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/pyproject.toml.orig +1 -1
  5. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/main.py +2 -1
  6. tlnt_cli-1.9.0/src/tlnt/core/mekari_status.py +62 -0
  7. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/play_store.py +4 -3
  8. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/LICENSE +0 -0
  9. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/__init__.py +0 -0
  10. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/__main__.py +0 -0
  11. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/browser/__init__.py +0 -0
  12. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/browser/login.py +0 -0
  13. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/browser/oauth.py +0 -0
  14. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/browser/scripted.py +0 -0
  15. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/__init__.py +0 -0
  16. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/approvals.py +0 -0
  17. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/avatars.py +0 -0
  18. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/__init__.py +0 -0
  19. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/api.py +0 -0
  20. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/attendance.py +0 -0
  21. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/calendar.py +0 -0
  22. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/login.py +0 -0
  23. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/logout.py +0 -0
  24. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/notifications.py +0 -0
  25. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/overtime.py +0 -0
  26. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/payslip.py +0 -0
  27. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/profile.py +0 -0
  28. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/reimbursement.py +0 -0
  29. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/setup.py +0 -0
  30. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/status.py +0 -0
  31. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/timeoff.py +0 -0
  32. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/update.py +0 -0
  33. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/commands/version.py +0 -0
  34. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/options.py +0 -0
  35. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/output.py +0 -0
  36. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/cli/prompts.py +0 -0
  37. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/__init__.py +0 -0
  38. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/api_endpoints.py +0 -0
  39. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/client.py +0 -0
  40. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/config.py +0 -0
  41. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/curl.py +0 -0
  42. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/device.py +0 -0
  43. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/http_client.py +0 -0
  44. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/logs.py +0 -0
  45. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/mekari.py +0 -0
  46. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/models.py +0 -0
  47. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/__init__.py +0 -0
  48. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/api.py +0 -0
  49. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/attendance.py +0 -0
  50. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/calendar.py +0 -0
  51. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/device.py +0 -0
  52. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/login.py +0 -0
  53. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/logout.py +0 -0
  54. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/notifications.py +0 -0
  55. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/overtime.py +0 -0
  56. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/payslip.py +0 -0
  57. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/profile.py +0 -0
  58. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/setup.py +0 -0
  59. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/status.py +0 -0
  60. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/services/timeoff.py +0 -0
  61. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/session.py +0 -0
  62. {tlnt_cli-1.8.0 → tlnt_cli-1.9.0}/src/tlnt/core/user_agent.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tlnt-cli
3
- Version: 1.8.0
3
+ Version: 1.9.0
4
4
  Summary: CLI wrapper for HRIS attendance and employment workflows.
5
5
  Author: Fathiraz Arthuro
6
6
  License-Expression: MIT
@@ -108,8 +108,9 @@ The full command map, global options and output modes are in
108
108
  that output out of chat, logs and tickets.
109
109
  - `TALENTA_READONLY=1` refuses every command that would change Talenta or
110
110
  local state.
111
- - The version checks only read public listings (PyPI and Google Play), never
112
- send your session or config, and never log out, log in, or update for you.
111
+ - The version and status checks only read public pages (PyPI, Google Play and
112
+ status.mekari.com), never send your session or config, and never log out, log
113
+ in, or update for you.
113
114
  - Never print passwords, bearer tokens, cookies, authorization codes, request
114
115
  bodies, selfie contents, or real employee data.
115
116
  - If `status` returns `session_missing`, `session_invalid`,
@@ -91,8 +91,9 @@ The full command map, global options and output modes are in
91
91
  that output out of chat, logs and tickets.
92
92
  - `TALENTA_READONLY=1` refuses every command that would change Talenta or
93
93
  local state.
94
- - The version checks only read public listings (PyPI and Google Play), never
95
- send your session or config, and never log out, log in, or update for you.
94
+ - The version and status checks only read public pages (PyPI, Google Play and
95
+ status.mekari.com), never send your session or config, and never log out, log
96
+ in, or update for you.
96
97
  - Never print passwords, bearer tokens, cookies, authorization codes, request
97
98
  bodies, selfie contents, or real employee data.
98
99
  - If `status` returns `session_missing`, `session_invalid`,
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "tlnt-cli"
7
- version = "1.8.0"
7
+ version = "1.9.0"
8
8
  description = "CLI wrapper for HRIS attendance and employment workflows."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "tlnt-cli"
7
- version = "1.8.0"
7
+ version = "1.9.0"
8
8
  description = "CLI wrapper for HRIS attendance and employment workflows."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -54,7 +54,7 @@ from tlnt.cli.commands import update as update_command
54
54
  from tlnt.cli.commands.update import update
55
55
  from tlnt.cli.commands.version import print_version
56
56
  from tlnt.cli.options import VerboseOption
57
- from tlnt.core import config, play_store
57
+ from tlnt.core import config, mekari_status, play_store
58
58
  from tlnt.core import mekari as mekari_constants
59
59
  from tlnt.core.curl import CurlPreview
60
60
  from tlnt.core.logs import configure_logging
@@ -191,6 +191,7 @@ def main_callback(
191
191
  for warning in (
192
192
  update_command.update_warning(),
193
193
  play_store.app_version_warning(mekari_constants.app_version()),
194
+ mekari_status.mekari_status_warning(),
194
195
  ):
195
196
  if warning:
196
197
  typer.echo(warning, err=True)
@@ -0,0 +1,62 @@
1
+ """Down Talenta and SSO monitors on status.mekari.com, cached for one hour."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import httpx
8
+
9
+ from tlnt.core import play_store
10
+
11
+ STATUS_PAGE_URL = "https://status.mekari.com/"
12
+ # The page is UptimeRobot's; this is the JSON its own front end reads.
13
+ MONITOR_LIST_URL = "https://status.mekari.com/api/getMonitorList/6WAJXFo5EE"
14
+ # tlnt calls api.mekari.com/internal/talenta-mobile and signs in through
15
+ # account.mekari.com; no other monitor on the page maps to a host tlnt uses.
16
+ WATCHED_MONITORS = frozenset(
17
+ {
18
+ "Talenta - Core",
19
+ "Talenta - API Mobile",
20
+ "Talenta - API Mobile Internal",
21
+ "Platform - SSO",
22
+ }
23
+ )
24
+ _NOT_DOWN = frozenset({"success", "paused"})
25
+ _FETCH_TIMEOUT_SECONDS = 3
26
+ _CACHE_TTL_SECONDS = 60 * 60
27
+
28
+
29
+ def _describe(monitor: dict[str, Any]) -> str:
30
+ since = (monitor.get("lastDowntime") or {}).get("date")
31
+ # ponytail: WIB is hardcoded because the page reports psp.timezone +07:00;
32
+ # read it from the payload if the page ever changes zone.
33
+ return f"{monitor['name']} (since {since[:16]} WIB)" if since else monitor["name"]
34
+
35
+
36
+ def parse_down_services(payload: Any) -> str | None:
37
+ # ponytail: first page only (perPage 30, 10 monitors today); page through
38
+ # the list if the page ever grows past that.
39
+ items = [
40
+ _describe(monitor)
41
+ for monitor in payload["psp"]["monitors"]
42
+ if monitor["name"] in WATCHED_MONITORS and monitor["statusClass"] not in _NOT_DOWN
43
+ ]
44
+ return ", ".join(items) or None
45
+
46
+
47
+ def fetch_down_services() -> str | None:
48
+ try:
49
+ response = httpx.get(MONITOR_LIST_URL, timeout=_FETCH_TIMEOUT_SECONDS, follow_redirects=True)
50
+ response.raise_for_status()
51
+ return parse_down_services(response.json())
52
+ except (httpx.HTTPError, ValueError, LookupError, TypeError, AttributeError):
53
+ return None
54
+
55
+
56
+ def mekari_status_warning(now: float | None = None) -> str | None:
57
+ down = play_store.cached_version(
58
+ "mekari_status.json", fetch_down_services, now, ttl_seconds=_CACHE_TTL_SECONDS
59
+ )
60
+ if not down:
61
+ return None
62
+ return f"⚠️ status.mekari.com reports down: {down}. See {STATUS_PAGE_URL}"
@@ -40,11 +40,12 @@ def cached_version(
40
40
  cache_name: str,
41
41
  fetch: Callable[[], str | None],
42
42
  now: float | None = None,
43
+ ttl_seconds: float = _CACHE_TTL_SECONDS,
43
44
  ) -> str | None:
44
- """Return a version cached for 24 hours in the user cache dir, else fetch it.
45
+ """Return a value cached for ttl_seconds (default 24 hours) in the user cache dir, else fetch it.
45
46
 
46
47
  A failed lookup is cached too, so a blocked or slow site costs one
47
- timeout a day instead of one per command.
48
+ timeout per ttl instead of one per command.
48
49
  """
49
50
  now = time.time() if now is None else now
50
51
  path = _cache_path(cache_name)
@@ -52,7 +53,7 @@ def cached_version(
52
53
  cached = json.loads(path.read_text(encoding="utf-8"))
53
54
  version = cached["version"]
54
55
  if (version is None or isinstance(version, str)) and (
55
- now - float(cached["checked_at"]) < _CACHE_TTL_SECONDS
56
+ now - float(cached["checked_at"]) < ttl_seconds
56
57
  ):
57
58
  return version
58
59
  except (OSError, ValueError, KeyError, TypeError):
File without changes
File without changes
File without changes
File without changes
File without changes