nucliadb 6.9.0.post5115__py3-none-any.whl → 6.9.0.post5126__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.
@@ -17,7 +17,7 @@
17
17
  # You should have received a copy of the GNU Affero General Public License
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
  #
20
- from fastapi import HTTPException
20
+ from fastapi import Header, HTTPException
21
21
  from fastapi_versioning import version
22
22
  from starlette.requests import Request
23
23
 
@@ -85,12 +85,18 @@ async def get_kb(request: Request, kbid: str) -> KnowledgeBoxObj:
85
85
  )
86
86
  @requires_one([NucliaDBRoles.MANAGER, NucliaDBRoles.READER])
87
87
  @version(1)
88
- async def get_kb_by_slug(request: Request, slug: str) -> KnowledgeBoxObj:
88
+ async def get_kb_by_slug(
89
+ request: Request, slug: str, x_nucliadb_account: str = Header(default="", include_in_schema=False)
90
+ ) -> KnowledgeBoxObj:
89
91
  driver = get_driver()
90
92
  async with driver.ro_transaction() as txn:
91
- kbid = await datamanagers.kb.get_kb_uuid(txn, slug=slug)
93
+ # For cloud, the account id is prepended in order to be able to reuse the same slug in different accounts.
94
+ kbid = await datamanagers.kb.get_kb_uuid(txn, slug=f"{x_nucliadb_account}:{slug}")
92
95
  if kbid is None:
93
- raise HTTPException(status_code=404, detail="Knowledge Box does not exist")
96
+ # For onprem, the slug is fully controlled by the user
97
+ kbid = await datamanagers.kb.get_kb_uuid(txn, slug=slug)
98
+ if kbid is None:
99
+ raise HTTPException(status_code=404, detail="Knowledge Box does not exist")
94
100
 
95
101
  kb_config = await datamanagers.kb.get_config(txn, kbid=kbid)
96
102
  if kb_config is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb
3
- Version: 6.9.0.post5115
3
+ Version: 6.9.0.post5126
4
4
  Summary: NucliaDB
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -19,11 +19,11 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Requires-Python: <4,>=3.9
21
21
  Description-Content-Type: text/markdown
22
- Requires-Dist: nucliadb-telemetry[all]>=6.9.0.post5115
23
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.9.0.post5115
24
- Requires-Dist: nucliadb-protos>=6.9.0.post5115
25
- Requires-Dist: nucliadb-models>=6.9.0.post5115
26
- Requires-Dist: nidx-protos>=6.9.0.post5115
22
+ Requires-Dist: nucliadb-telemetry[all]>=6.9.0.post5126
23
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.9.0.post5126
24
+ Requires-Dist: nucliadb-protos>=6.9.0.post5126
25
+ Requires-Dist: nucliadb-models>=6.9.0.post5126
26
+ Requires-Dist: nidx-protos>=6.9.0.post5126
27
27
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
28
28
  Requires-Dist: nuclia-models>=0.50.0
29
29
  Requires-Dist: uvicorn[standard]
@@ -205,7 +205,7 @@ nucliadb/reader/api/models.py,sha256=UHhOPmh8xcHhDjFm8_-8t66yEggXdxRBoY0xV-hI9to
205
205
  nucliadb/reader/api/v1/__init__.py,sha256=ieP8lsCCwG66Jupv8II5MSTj6nh3eCtLcF4utH9JOcU,1102
206
206
  nucliadb/reader/api/v1/download.py,sha256=F48YM3BPwuHwDgYk0jjRHHJHh732QUb4nCAS5xyNqzg,10819
207
207
  nucliadb/reader/api/v1/export_import.py,sha256=x4VBNDFjnlY1nIt5kdq0eZTB_DeRzGzT8T7uB7wUhNU,6448
208
- nucliadb/reader/api/v1/knowledgebox.py,sha256=e8q7v5JwGxsuPZLc_GkUOkWWSJMI2o483bK9ywhdkk8,3612
208
+ nucliadb/reader/api/v1/knowledgebox.py,sha256=POvDz6TE8PDE7HqmN0ty8LZfvhxoWrzRxlKXqHbJEHA,4007
209
209
  nucliadb/reader/api/v1/learning_config.py,sha256=wL4k9ZFK0BX17ocq1tUmbh-atLrw-Xag7Ly8wgD1xrQ,6812
210
210
  nucliadb/reader/api/v1/resource.py,sha256=WTBIEywfHfy4sIffnVm9s__3--JpHi9hprVpK0Ddd04,14164
211
211
  nucliadb/reader/api/v1/router.py,sha256=eyNmEGSP9zHkCIG5XlAXl6sukq950B7gFT3X2peMtIE,1011
@@ -384,8 +384,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
384
384
  nucliadb/writer/tus/s3.py,sha256=vu1BGg4VqJ_x2P1u2BxqPKlSfw5orT_a3R-Ln5oPUpU,8483
385
385
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
386
386
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
387
- nucliadb-6.9.0.post5115.dist-info/METADATA,sha256=Yld8oKbej6nDrfjtVK93zk0U0rBUwt-ukS6NnCmKtb0,4158
388
- nucliadb-6.9.0.post5115.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
389
- nucliadb-6.9.0.post5115.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
390
- nucliadb-6.9.0.post5115.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
391
- nucliadb-6.9.0.post5115.dist-info/RECORD,,
387
+ nucliadb-6.9.0.post5126.dist-info/METADATA,sha256=_PkOcKJ6T9WTuTb7bYw0N-_9ftkg4XhoTlbdN6O9M5M,4158
388
+ nucliadb-6.9.0.post5126.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
389
+ nucliadb-6.9.0.post5126.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
390
+ nucliadb-6.9.0.post5126.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
391
+ nucliadb-6.9.0.post5126.dist-info/RECORD,,