tba-durability-audit 0.4.0.dev2__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.
@@ -0,0 +1,5 @@
1
+ from .operations import *
2
+ from .specifications import *
3
+ from .inventory import *
4
+
5
+ __all__ = [name for name in globals() if not name.startswith("_")]
@@ -0,0 +1,22 @@
1
+ """Immutable inventory of this durable family's table specifications."""
2
+
3
+ from . import specifications as _specifications
4
+
5
+ RUNTIME_TABLE_SPECS = tuple(
6
+ value
7
+ for name, value in vars(_specifications).items()
8
+ if name.endswith("RuntimeSpec") and getattr(value, "model", None) is not None
9
+ )
10
+ RUNTIME_TABLES = tuple(spec.model for spec in RUNTIME_TABLE_SPECS)
11
+ RUNTIME_OPERATION_BY_ALIAS = {
12
+ operation.alias: operation
13
+ for spec in RUNTIME_TABLE_SPECS
14
+ for operation in spec.ops
15
+ if operation.extra.get("owner_layer") == "30-storage-runtime"
16
+ }
17
+
18
+ __all__ = [
19
+ "RUNTIME_OPERATION_BY_ALIAS",
20
+ "RUNTIME_TABLE_SPECS",
21
+ "RUNTIME_TABLES",
22
+ ]
@@ -0,0 +1 @@
1
+ from .audit import *
@@ -0,0 +1,51 @@
1
+ """Durable audit-event operations and compatibility adapters."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Mapping
6
+ from typing import Any
7
+
8
+ from tigrbl import (
9
+ create_table_record,
10
+ database_from_context,
11
+ field_value,
12
+ list_table_records,
13
+ payload_from_context,
14
+ )
15
+
16
+
17
+ async def append_audit_event_record(ctx: Mapping[str, Any]) -> Any:
18
+ from tba_storage_audit.tables import AuditEvent
19
+ from tba_storage_tenancy.tables import Tenant
20
+
21
+ db = database_from_context(ctx)
22
+ payload = dict(payload_from_context(ctx))
23
+ if payload.get("tenant_id") is None:
24
+ tenants = await list_table_records(Tenant, db, {})
25
+ if tenants:
26
+ payload["tenant_id"] = field_value(tenants[0], "id")
27
+ return await create_table_record(AuditEvent, db, payload)
28
+
29
+
30
+ async def list_audit_event_records(ctx: Mapping[str, Any]) -> list[Any]:
31
+ from tba_storage_audit.tables import AuditEvent
32
+
33
+ filters = {
34
+ key: value
35
+ for key, value in dict(payload_from_context(ctx)).items()
36
+ if value is not None
37
+ }
38
+ return await list_table_records(AuditEvent, database_from_context(ctx), filters)
39
+
40
+
41
+ async def append_audit_event_async(*, db: Any, **payload: Any) -> Any:
42
+ """Append using an explicitly injected transaction/session."""
43
+
44
+ return await append_audit_event_record({"payload": payload, "db": db})
45
+
46
+
47
+ __all__ = [
48
+ "append_audit_event_async",
49
+ "append_audit_event_record",
50
+ "list_audit_event_records",
51
+ ]
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ from .audit import *
@@ -0,0 +1,39 @@
1
+ """Audit-event alias and executable runtime specification."""
2
+
3
+ from tba_storage_audit.tables import AuditEvent
4
+
5
+ from tigrbl import deriveTableSpec
6
+ from tigrbl import makeOp
7
+ from tba_durability_audit.operations.audit import (
8
+ append_audit_event_record,
9
+ list_audit_event_records,
10
+ )
11
+
12
+
13
+ AuditEventTable = AuditEvent
14
+ AuditEventRuntimeSpec = deriveTableSpec(
15
+ AuditEventTable,
16
+ ops=(
17
+ makeOp(
18
+ extra={"owner_layer": "30-storage-runtime"},
19
+ expose_routes=False,
20
+ expose_rpc=False,
21
+ expose_method=True,
22
+ tx_scope="read_write",
23
+ alias="append",
24
+ handler=append_audit_event_record,
25
+ ),
26
+ makeOp(
27
+ extra={"owner_layer": "30-storage-runtime"},
28
+ expose_routes=False,
29
+ expose_rpc=False,
30
+ expose_method=True,
31
+ alias="list_events",
32
+ handler=list_audit_event_records,
33
+ tx_scope="read_only",
34
+ ),
35
+ ),
36
+ )
37
+
38
+
39
+ __all__ = ["AuditEventRuntimeSpec", "AuditEventTable"]
@@ -0,0 +1,25 @@
1
+ Metadata-Version: 2.4
2
+ Name: tba-durability-audit
3
+ Version: 0.4.0.dev2
4
+ Summary: Carrier-neutral layer-30 durable table operations.
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.10,<3.15
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Programming Language :: Python :: 3.14
13
+ Requires-Dist: tba-bases-replay (==0.4.0.dev2)
14
+ Requires-Dist: tba-contracts-identity (==0.4.0.dev2)
15
+ Requires-Dist: tba-contracts-security-trust (==0.1.0)
16
+ Requires-Dist: tba-primitives-identity (==0.4.0.dev2)
17
+ Requires-Dist: tba-storage-audit (==0.4.0.dev2)
18
+ Requires-Dist: tba-storage-tenancy (==0.4.0.dev2)
19
+ Requires-Dist: tigrbl (==0.4.5.dev8)
20
+ Description-Content-Type: text/markdown
21
+
22
+ # tba-durability-audit
23
+
24
+ Carrier-neutral layer-30 durable operations and derived table specifications.
25
+
@@ -0,0 +1,10 @@
1
+ tba_durability_audit/__init__.py,sha256=ycwMJJe46UxfSsZ7n2bUegOVNrMbSOlGr8qD4brpViw,149
2
+ tba_durability_audit/inventory.py,sha256=3HIb41thV_dPsc4Arg-dJwSA0bMCDIYcCtjygUiLqRI,660
3
+ tba_durability_audit/operations/__init__.py,sha256=M5vf7f0-KxyUirepYGrW5m5DQA7LcSXME6vGLlHbeW8,21
4
+ tba_durability_audit/operations/audit.py,sha256=JfRw43K9P4UWdzBsAufMNZztfFUnQSQjJA2-f0z3aWk,1484
5
+ tba_durability_audit/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
6
+ tba_durability_audit/specifications/__init__.py,sha256=M5vf7f0-KxyUirepYGrW5m5DQA7LcSXME6vGLlHbeW8,21
7
+ tba_durability_audit/specifications/audit.py,sha256=9Vy74-pKmcwSwAfWRLdLet6PchJDrakjwOBRNSmyigo,1038
8
+ tba_durability_audit-0.4.0.dev2.dist-info/METADATA,sha256=bPTaxonkVuebu-ADdF9p52A14L487ydLeusskX3Zpdw,980
9
+ tba_durability_audit-0.4.0.dev2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
10
+ tba_durability_audit-0.4.0.dev2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.5.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any