tba-storage-authority-graph 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.
- tba_storage_authority_graph/__init__.py +7 -0
- tba_storage_authority_graph/component.toml +29 -0
- tba_storage_authority_graph/manifest.py +9 -0
- tba_storage_authority_graph/migrations/__init__.py +0 -0
- tba_storage_authority_graph/migrations/versions/__init__.py +0 -0
- tba_storage_authority_graph/migrations/versions/d7c60dd1_6611_58b2_8f62_5ca0e066afbd_initial_schema.py +23 -0
- tba_storage_authority_graph/py.typed +0 -0
- tba_storage_authority_graph/tables/__init__.py +14 -0
- tba_storage_authority_graph/tables/_graph_base.py +53 -0
- tba_storage_authority_graph/tables/authority_derivation_graph/__init__.py +15 -0
- tba_storage_authority_graph/tables/authority_derivation_graph/_table.py +94 -0
- tba_storage_authority_graph-0.4.0.dev2.dist-info/METADATA +22 -0
- tba_storage_authority_graph-0.4.0.dev2.dist-info/RECORD +14 -0
- tba_storage_authority_graph-0.4.0.dev2.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""Standalone identity storage component."""
|
|
2
|
+
|
|
3
|
+
from .manifest import MANIFEST, load_manifest
|
|
4
|
+
from .tables import * # noqa: F401,F403
|
|
5
|
+
from .tables import TABLE_MODEL_BY_NAME, TABLE_MODEL_BY_TABLENAME, TABLE_MODELS
|
|
6
|
+
|
|
7
|
+
__all__ = ["MANIFEST", "load_manifest", "TABLE_MODELS", "TABLE_MODEL_BY_NAME", "TABLE_MODEL_BY_TABLENAME"] + [model.__name__ for model in TABLE_MODELS]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
manifest_version = "1.0.0"
|
|
2
|
+
|
|
3
|
+
[component]
|
|
4
|
+
id = "tigrbl.identity.storage.authority-graph"
|
|
5
|
+
distribution = "tba-storage-authority-graph"
|
|
6
|
+
import_root = "tba_storage_authority_graph"
|
|
7
|
+
|
|
8
|
+
[schema]
|
|
9
|
+
contract = "1.0.0"
|
|
10
|
+
migration_head = "d7c60dd1-6611-58b2-8f62-5ca0e066afbd"
|
|
11
|
+
migrations_package = "tba_storage_authority_graph.migrations.versions"
|
|
12
|
+
|
|
13
|
+
[[schema.objects]]
|
|
14
|
+
id = "tigrbl.identity.storage.authority-graph:table:authority_derivation_graphs"
|
|
15
|
+
kind = "table"
|
|
16
|
+
physical_name = "authn.authority_derivation_graphs"
|
|
17
|
+
model = "tba_storage_authority_graph.tables:AuthorityDerivationGraph"
|
|
18
|
+
|
|
19
|
+
[[schema.objects]]
|
|
20
|
+
id = "tigrbl.identity.storage.authority-graph:table:authority_derivation_graph_nodes"
|
|
21
|
+
kind = "table"
|
|
22
|
+
physical_name = "authn.authority_derivation_graph_nodes"
|
|
23
|
+
model = "tba_storage_authority_graph.tables:AuthorityDerivationGraphNode"
|
|
24
|
+
|
|
25
|
+
[[schema.objects]]
|
|
26
|
+
id = "tigrbl.identity.storage.authority-graph:table:authority_derivation_graph_edges"
|
|
27
|
+
kind = "table"
|
|
28
|
+
physical_name = "authn.authority_derivation_graph_edges"
|
|
29
|
+
model = "tba_storage_authority_graph.tables:AuthorityDerivationGraphEdge"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Installed component manifest access."""
|
|
2
|
+
from importlib.resources import as_file, files
|
|
3
|
+
from tigrbl_migrations import StorageManifest
|
|
4
|
+
|
|
5
|
+
def load_manifest() -> StorageManifest:
|
|
6
|
+
with as_file(files(__package__).joinpath("component.toml")) as path:
|
|
7
|
+
return StorageManifest.from_toml(path)
|
|
8
|
+
|
|
9
|
+
MANIFEST = load_manifest()
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Initial owned schema for tigrbl.identity.storage.authority-graph."""
|
|
2
|
+
from tigrbl_migrations import Migration
|
|
3
|
+
from tba_storage_authority_graph.tables import TABLE_MODELS
|
|
4
|
+
|
|
5
|
+
REVISION = "d7c60dd1-6611-58b2-8f62-5ca0e066afbd"
|
|
6
|
+
|
|
7
|
+
def upgrade(connection):
|
|
8
|
+
for model in TABLE_MODELS:
|
|
9
|
+
model.__table__.create(bind=connection, checkfirst=True)
|
|
10
|
+
|
|
11
|
+
def downgrade(connection):
|
|
12
|
+
for model in reversed(TABLE_MODELS):
|
|
13
|
+
model.__table__.drop(bind=connection, checkfirst=True)
|
|
14
|
+
|
|
15
|
+
MIGRATION = Migration(
|
|
16
|
+
component="tigrbl.identity.storage.authority-graph",
|
|
17
|
+
revision=REVISION,
|
|
18
|
+
parents=(),
|
|
19
|
+
kind="standard",
|
|
20
|
+
reversible=True,
|
|
21
|
+
upgrade=upgrade,
|
|
22
|
+
downgrade=downgrade,
|
|
23
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Owned mapped-table inventory."""
|
|
2
|
+
|
|
3
|
+
from .authority_derivation_graph import AuthorityDerivationGraph, AuthorityDerivationGraphNode, AuthorityDerivationGraphEdge
|
|
4
|
+
|
|
5
|
+
TABLE_MODELS = (
|
|
6
|
+
AuthorityDerivationGraph,
|
|
7
|
+
AuthorityDerivationGraphNode,
|
|
8
|
+
AuthorityDerivationGraphEdge,
|
|
9
|
+
)
|
|
10
|
+
TABLE_MODEL_BY_NAME = {model.__name__: model for model in TABLE_MODELS}
|
|
11
|
+
TABLE_MODEL_BY_TABLENAME = {model.__tablename__: model for model in TABLE_MODELS}
|
|
12
|
+
__all__ = [model.__name__ for model in TABLE_MODELS] + [
|
|
13
|
+
"TABLE_MODELS", "TABLE_MODEL_BY_NAME", "TABLE_MODEL_BY_TABLENAME",
|
|
14
|
+
]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Shared abstract columns for graph-backed storage tables."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from tba_primitives_identity.orm import (
|
|
8
|
+
Boolean,
|
|
9
|
+
JSON,
|
|
10
|
+
Mapped,
|
|
11
|
+
RestOltpTable,
|
|
12
|
+
S,
|
|
13
|
+
String,
|
|
14
|
+
Timestamped,
|
|
15
|
+
acol,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class GraphBase(RestOltpTable, Timestamped):
|
|
20
|
+
__abstract__ = True
|
|
21
|
+
|
|
22
|
+
graph_key: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
tenant_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
24
|
+
realm: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
25
|
+
status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
|
|
26
|
+
graph_metadata: Mapped[dict[str, Any] | None] = acol(storage=S(JSON, nullable=True))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class GraphNodeBase(RestOltpTable, Timestamped):
|
|
30
|
+
__abstract__ = True
|
|
31
|
+
|
|
32
|
+
node_key: Mapped[str] = acol(storage=S(String(1000), nullable=False, index=True))
|
|
33
|
+
kind: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
|
|
34
|
+
tenant_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
35
|
+
realm: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
36
|
+
ref_table: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
37
|
+
ref_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
38
|
+
node_metadata: Mapped[dict[str, Any] | None] = acol(storage=S(JSON, nullable=True))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class GraphEdgeBase(RestOltpTable, Timestamped):
|
|
42
|
+
__abstract__ = True
|
|
43
|
+
|
|
44
|
+
edge_key: Mapped[str] = acol(storage=S(String(1000), nullable=False, index=True))
|
|
45
|
+
kind: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
|
|
46
|
+
tenant_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
47
|
+
realm: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
48
|
+
active: Mapped[bool] = acol(storage=S(Boolean, nullable=False, default=True, index=True))
|
|
49
|
+
revoked: Mapped[bool] = acol(storage=S(Boolean, nullable=False, default=False, index=True))
|
|
50
|
+
edge_metadata: Mapped[dict[str, Any] | None] = acol(storage=S(JSON, nullable=True))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
__all__ = ["GraphBase", "GraphNodeBase", "GraphEdgeBase"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Authority derivation graph table exports."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from ._table import (
|
|
6
|
+
AuthorityDerivationGraph,
|
|
7
|
+
AuthorityDerivationGraphEdge,
|
|
8
|
+
AuthorityDerivationGraphNode,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"AuthorityDerivationGraph",
|
|
13
|
+
"AuthorityDerivationGraphNode",
|
|
14
|
+
"AuthorityDerivationGraphEdge",
|
|
15
|
+
]
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Durable authority derivation graph tables."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from sqlalchemy import Index, UniqueConstraint
|
|
6
|
+
|
|
7
|
+
from tba_primitives_identity.orm import (
|
|
8
|
+
ForeignKeySpec,
|
|
9
|
+
GUIDPk,
|
|
10
|
+
JSON,
|
|
11
|
+
Mapped,
|
|
12
|
+
PgUUID,
|
|
13
|
+
S,
|
|
14
|
+
String,
|
|
15
|
+
UUID,
|
|
16
|
+
acol,
|
|
17
|
+
)
|
|
18
|
+
from tba_storage_authority_graph.tables._graph_base import GraphBase, GraphEdgeBase, GraphNodeBase
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AuthorityDerivationGraph(GraphBase, GUIDPk):
|
|
22
|
+
__tablename__ = "authority_derivation_graphs"
|
|
23
|
+
__table_args__ = (
|
|
24
|
+
UniqueConstraint("graph_key", name="uq_authority_derivation_graph_key"),
|
|
25
|
+
{"extend_existing": True, "schema": "authn"},
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class AuthorityDerivationGraphNode(GraphNodeBase, GUIDPk):
|
|
30
|
+
__tablename__ = "authority_derivation_graph_nodes"
|
|
31
|
+
__table_args__ = (
|
|
32
|
+
UniqueConstraint("graph_id", "node_key", name="uq_authority_derivation_graph_node_key"),
|
|
33
|
+
Index("ix_authority_derivation_graph_node_graph_kind", "graph_id", "kind"),
|
|
34
|
+
Index("ix_authority_derivation_graph_node_tenant_kind", "tenant_id", "kind"),
|
|
35
|
+
{"extend_existing": True, "schema": "authn"},
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
graph_id: Mapped[UUID] = acol(
|
|
39
|
+
storage=S(
|
|
40
|
+
PgUUID(as_uuid=True),
|
|
41
|
+
fk=ForeignKeySpec(target="authn.authority_derivation_graphs.id"),
|
|
42
|
+
nullable=False,
|
|
43
|
+
index=True,
|
|
44
|
+
)
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class AuthorityDerivationGraphEdge(GraphEdgeBase, GUIDPk):
|
|
49
|
+
__tablename__ = "authority_derivation_graph_edges"
|
|
50
|
+
__table_args__ = (
|
|
51
|
+
UniqueConstraint("graph_id", "edge_key", name="uq_authority_derivation_graph_edge_key"),
|
|
52
|
+
Index("ix_authority_derivation_graph_edge_src_kind", "graph_id", "src_id", "kind"),
|
|
53
|
+
Index("ix_authority_derivation_graph_edge_dst_kind", "graph_id", "dst_id", "kind"),
|
|
54
|
+
Index("ix_authority_derivation_graph_edge_tenant_kind", "tenant_id", "kind"),
|
|
55
|
+
{"extend_existing": True, "schema": "authn"},
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
graph_id: Mapped[UUID] = acol(
|
|
59
|
+
storage=S(
|
|
60
|
+
PgUUID(as_uuid=True),
|
|
61
|
+
fk=ForeignKeySpec(target="authn.authority_derivation_graphs.id"),
|
|
62
|
+
nullable=False,
|
|
63
|
+
index=True,
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
src_id: Mapped[UUID] = acol(
|
|
67
|
+
storage=S(
|
|
68
|
+
PgUUID(as_uuid=True),
|
|
69
|
+
fk=ForeignKeySpec(target="authn.authority_derivation_graph_nodes.id"),
|
|
70
|
+
nullable=False,
|
|
71
|
+
index=True,
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
dst_id: Mapped[UUID] = acol(
|
|
75
|
+
storage=S(
|
|
76
|
+
PgUUID(as_uuid=True),
|
|
77
|
+
fk=ForeignKeySpec(target="authn.authority_derivation_graph_nodes.id"),
|
|
78
|
+
nullable=False,
|
|
79
|
+
index=True,
|
|
80
|
+
)
|
|
81
|
+
)
|
|
82
|
+
policy_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
83
|
+
policy_version_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
84
|
+
policy_version: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
85
|
+
provenance_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
86
|
+
scopes: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
|
|
87
|
+
constraints: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
__all__ = [
|
|
91
|
+
"AuthorityDerivationGraph",
|
|
92
|
+
"AuthorityDerivationGraphNode",
|
|
93
|
+
"AuthorityDerivationGraphEdge",
|
|
94
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-storage-authority-graph
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: Owned authority-graph identity database tables and migrations.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10,<3.15
|
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Requires-Dist: tba-primitives-identity[storage] (>=0.4.0.dev2)
|
|
15
|
+
Requires-Dist: tigrbl (>=0.4.4.dev1,<0.5)
|
|
16
|
+
Requires-Dist: tigrbl-migrations (>=0.4.5.dev4)
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# tba-storage-authority-graph
|
|
20
|
+
|
|
21
|
+
Owns the `tigrbl.identity.storage.authority-graph` schema component.
|
|
22
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
tba_storage_authority_graph/__init__.py,sha256=HoJ8HOyxQOG9vvo4LEJPfEUW3IDGqZF6ZIgJQ59tK6Q,366
|
|
2
|
+
tba_storage_authority_graph/component.toml,sha256=7fbnomz11qYqM379unlsBqe2xREDe016MVISefV5650,1074
|
|
3
|
+
tba_storage_authority_graph/manifest.py,sha256=bYZmb6ItB8bRxtuCspB1us5eTvB1RqlTedISJZbws_w,325
|
|
4
|
+
tba_storage_authority_graph/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
tba_storage_authority_graph/migrations/versions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
tba_storage_authority_graph/migrations/versions/d7c60dd1_6611_58b2_8f62_5ca0e066afbd_initial_schema.py,sha256=2Mw5Iu7SP3y28GPNfGh1vcBPD3yLSUi4FdVzm98we94,687
|
|
7
|
+
tba_storage_authority_graph/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
tba_storage_authority_graph/tables/__init__.py,sha256=iS8hCk2O4K_Qdtau1mUbwLVDUjXVIo2SxH3_hnLtrqQ,564
|
|
9
|
+
tba_storage_authority_graph/tables/_graph_base.py,sha256=nJGqsJ5zWRme402Wa7_SMhchuXuGPXNX0gn6ymPqArw,2246
|
|
10
|
+
tba_storage_authority_graph/tables/authority_derivation_graph/__init__.py,sha256=Lv2diqY9ZTJTl9XCLNsi33AR-Z_u5h24CAbD0cbbmT8,326
|
|
11
|
+
tba_storage_authority_graph/tables/authority_derivation_graph/_table.py,sha256=qWV6bxI37mmclWGli7Yi2Mo56zWbVTlCV8aZGHWKB_c,3277
|
|
12
|
+
tba_storage_authority_graph-0.4.0.dev2.dist-info/METADATA,sha256=1aWOsybsXoXkNkPWgatkmYT2QLb_SpRPurKrspdWMW4,859
|
|
13
|
+
tba_storage_authority_graph-0.4.0.dev2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
|
|
14
|
+
tba_storage_authority_graph-0.4.0.dev2.dist-info/RECORD,,
|