brainlessdb 1.1.0__tar.gz → 1.2.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.
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/CHANGELOG.md +11 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/PKG-INFO +1 -1
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/__init__.py +1 -1
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/client.py +8 -3
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/pyproject.toml +1 -1
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_client.py +22 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/uv.lock +1 -1
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/.gitignore +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/.python-version +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/README.md +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/bucket.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/collection.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/fields.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/ingest.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/registry.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/brainlessdb/struct.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/cliff.toml +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/code_style_guide.md +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/justfile +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/test_results.txt +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/__init__.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/conftest.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/mock_nats.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_bucket.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_collection.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_dead_letter.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_deserialization.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_duplicates.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_fields.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_flush_errors.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_ingest.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_load_errors.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_registry.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_sync.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_thread_safety.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_update_atomic.py +0 -0
- {brainlessdb-1.1.0 → brainlessdb-1.2.0}/tests/test_version.py +0 -0
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## [1.2.0] - 2026-11-15
|
|
7
|
+
|
|
8
|
+
### 🚀 Features
|
|
9
|
+
|
|
10
|
+
- Plain __allowed_apps__ list grants access to a collection
|
|
11
|
+
- A class without allows_app() but with __allowed_apps__ (a list of app
|
|
12
|
+
namespaces) is allowed when the namespace is in the list. ucs_data
|
|
13
|
+
buckets declare only __allowed_apps__ and were all rejected with
|
|
14
|
+
AppAccessError. allows_app() still takes precedence.
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.1.0] - 2026-11-03
|
|
7
18
|
|
|
8
19
|
### 🚀 Features
|
|
@@ -87,11 +87,16 @@ class BrainlessDB:
|
|
|
87
87
|
"""Validate __allowed_apps__. Errors are deferred to start() before
|
|
88
88
|
start, raised immediately after."""
|
|
89
89
|
allows_app = getattr(cls, "allows_app", None)
|
|
90
|
+
allowed_apps = getattr(cls, "__allowed_apps__", None)
|
|
90
91
|
error = None
|
|
91
|
-
if allows_app is None:
|
|
92
|
+
if allows_app is not None:
|
|
93
|
+
if not allows_app(self._namespace):
|
|
94
|
+
error = AppAccessError(cls.__name__, self._namespace)
|
|
95
|
+
elif allowed_apps is not None:
|
|
96
|
+
if self._namespace not in allowed_apps:
|
|
97
|
+
error = AppAccessError(cls.__name__, self._namespace)
|
|
98
|
+
else:
|
|
92
99
|
error = AppAccessError(cls.__name__)
|
|
93
|
-
elif not allows_app(self._namespace):
|
|
94
|
-
error = AppAccessError(cls.__name__, self._namespace)
|
|
95
100
|
|
|
96
101
|
if error is not None:
|
|
97
102
|
if self._started:
|
|
@@ -123,6 +123,28 @@ class TestAppAccess:
|
|
|
123
123
|
with pytest.raises(RuntimeError, match="must declare __allowed_apps__"):
|
|
124
124
|
await db.start()
|
|
125
125
|
|
|
126
|
+
def test_collection_allowed_apps_attribute(self):
|
|
127
|
+
"""__allowed_apps__ without allows_app - namespace in the list is allowed."""
|
|
128
|
+
from brainlessdb import BrainlessBucket
|
|
129
|
+
|
|
130
|
+
class ListedV1(BrainlessBucket):
|
|
131
|
+
__allowed_apps__ = ["test", "other"]
|
|
132
|
+
|
|
133
|
+
db = BrainlessDB(namespace="test")
|
|
134
|
+
db.collection(ListedV1)
|
|
135
|
+
assert db._app_errors == []
|
|
136
|
+
|
|
137
|
+
def test_collection_allowed_apps_attribute_wrong_app(self):
|
|
138
|
+
"""__allowed_apps__ without allows_app - namespace not in the list is an error."""
|
|
139
|
+
from brainlessdb import BrainlessBucket
|
|
140
|
+
|
|
141
|
+
class ListedV1(BrainlessBucket):
|
|
142
|
+
__allowed_apps__ = ["other"]
|
|
143
|
+
|
|
144
|
+
db = BrainlessDB(namespace="test")
|
|
145
|
+
db.collection(ListedV1)
|
|
146
|
+
assert len(db._app_errors) == 1
|
|
147
|
+
|
|
126
148
|
@pytest.mark.asyncio
|
|
127
149
|
async def test_collection_after_start_wrong_app_raises_immediately(self):
|
|
128
150
|
"""Wrong namespace after start — raises immediately."""
|
|
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
|