nlbone 0.11.3__py3-none-any.whl → 0.11.4__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.
- nlbone/adapters/auth/auth_service.py +3 -1
- nlbone/adapters/http_clients/uploadchi/uploadchi.py +11 -0
- nlbone/adapters/http_clients/uploadchi/uploadchi_async.py +11 -0
- nlbone/core/ports/files.py +2 -0
- {nlbone-0.11.3.dist-info → nlbone-0.11.4.dist-info}/METADATA +1 -1
- {nlbone-0.11.3.dist-info → nlbone-0.11.4.dist-info}/RECORD +9 -9
- {nlbone-0.11.3.dist-info → nlbone-0.11.4.dist-info}/WHEEL +0 -0
- {nlbone-0.11.3.dist-info → nlbone-0.11.4.dist-info}/entry_points.txt +0 -0
- {nlbone-0.11.3.dist-info → nlbone-0.11.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -50,7 +50,9 @@ class AuthService(BaseAuthService):
|
|
|
50
50
|
|
|
51
51
|
def is_client_token(self, token: str, allowed_clients: set[str] | None = None) -> bool:
|
|
52
52
|
data = self.verify_token(token)
|
|
53
|
-
|
|
53
|
+
if data:
|
|
54
|
+
return data.get("preferred_username", "").startswith("service-account")
|
|
55
|
+
return False
|
|
54
56
|
|
|
55
57
|
def client_has_access(self, token: str, permissions: list[str], allowed_clients: set[str] | None = None) -> bool:
|
|
56
58
|
data = self.verify_token(token)
|
|
@@ -114,6 +114,17 @@ class UploadchiClient(FileServicePort):
|
|
|
114
114
|
media_type = r.headers.get("content-type", "application/octet-stream")
|
|
115
115
|
return r.content, filename, media_type
|
|
116
116
|
|
|
117
|
+
def get_file_presigned_url(self, file_id: str, ttl: int | None = None, token: str | None = None) -> dict:
|
|
118
|
+
tok = _resolve_token(token)
|
|
119
|
+
r = self._client.get(
|
|
120
|
+
f"{self._base_url}/files/{file_id}/purl",
|
|
121
|
+
params={"ttl": ttl} if ttl else None,
|
|
122
|
+
headers=auth_headers(tok),
|
|
123
|
+
)
|
|
124
|
+
if r.status_code >= 400:
|
|
125
|
+
raise UploadchiError(r.status_code, r.text)
|
|
126
|
+
return r.json()
|
|
127
|
+
|
|
117
128
|
def delete_file(self, file_id: str, token: str | None = None) -> None:
|
|
118
129
|
tok = _resolve_token(token)
|
|
119
130
|
r = self._client.delete(
|
|
@@ -116,6 +116,17 @@ class UploadchiAsyncClient(AsyncFileServicePort):
|
|
|
116
116
|
|
|
117
117
|
return _aiter(), filename, media_type
|
|
118
118
|
|
|
119
|
+
async def get_file_presigned_url(self, file_id: str, ttl: int | None = None, token: str | None = None) -> dict:
|
|
120
|
+
tok = _resolve_token(token)
|
|
121
|
+
r = await self._client.get(
|
|
122
|
+
f"/files/{file_id}/purl",
|
|
123
|
+
params={"ttl": ttl} if ttl else None,
|
|
124
|
+
headers=auth_headers(tok or await self._token_provider.get_access_token()),
|
|
125
|
+
)
|
|
126
|
+
if r.status_code >= 400:
|
|
127
|
+
raise UploadchiError(r.status_code, await r.aread())
|
|
128
|
+
return r.json()
|
|
129
|
+
|
|
119
130
|
async def delete_file(self, file_id: str, token: str | None = None) -> None:
|
|
120
131
|
tok = _resolve_token(token)
|
|
121
132
|
r = await self._client.delete(
|
nlbone/core/ports/files.py
CHANGED
|
@@ -20,6 +20,7 @@ class FileServicePort(Protocol):
|
|
|
20
20
|
) -> dict: ...
|
|
21
21
|
def get_file(self, file_id: str, token: str | None = None) -> dict: ...
|
|
22
22
|
def download_file(self, file_id: str, token: str | None = None) -> tuple[bytes, str, str]: ...
|
|
23
|
+
def get_file_presigned_url(self, file_id: str, ttl: int | None = None, token: str | None = None) -> dict: ...
|
|
23
24
|
def delete_file(self, file_id: str, token: str | None = None) -> None: ...
|
|
24
25
|
|
|
25
26
|
|
|
@@ -40,4 +41,5 @@ class AsyncFileServicePort(Protocol):
|
|
|
40
41
|
) -> dict: ...
|
|
41
42
|
async def get_file(self, file_id: str, token: str | None = None) -> dict: ...
|
|
42
43
|
async def download_file(self, file_id: str, token: str | None = None) -> tuple[AsyncIterator[bytes], str, str]: ...
|
|
44
|
+
async def get_file_presigned_url(self, file_id: str, ttl: int | None = None, token: str | None = None) -> dict: ...
|
|
43
45
|
async def delete_file(self, file_id: str, token: str | None = None) -> None: ...
|
|
@@ -6,7 +6,7 @@ nlbone/adapters/snowflake.py,sha256=eC5eXWgkTIJlO5J44VFbD1-MXj8HYs0lCNp37paSfXY,
|
|
|
6
6
|
nlbone/adapters/auth/__init__.py,sha256=v2yU52Eq0pQQgFLC9BedyyWbu9xp_JCbsmjLGNj8Tvs,171
|
|
7
7
|
nlbone/adapters/auth/async_auth_service.py,sha256=gnz7GqJvoHYJFoIs444jm7XWadQkMYS3S1UMOxoUgdE,3722
|
|
8
8
|
nlbone/adapters/auth/async_token_provider.py,sha256=HVAuInFG483IZzrQ-agqOhiRiu4ix8kynwvcOniYr2E,1567
|
|
9
|
-
nlbone/adapters/auth/auth_service.py,sha256=
|
|
9
|
+
nlbone/adapters/auth/auth_service.py,sha256=NhfD4sYajsyq0lAqtr06c97VKth_818oUoSSepOx6nw,2667
|
|
10
10
|
nlbone/adapters/auth/keycloak.py,sha256=IhEriaFl5mjIGT6ZUCU9qROd678ARchvWgd4UJ6zH7s,4925
|
|
11
11
|
nlbone/adapters/auth/token_provider.py,sha256=kzjFAaFY8SPnU0Tn6l-YVrhEOAiFV0QE3eit3D7u2VQ,1438
|
|
12
12
|
nlbone/adapters/cache/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -31,8 +31,8 @@ nlbone/adapters/http_clients/pricing/__init__.py,sha256=ElA9NFcAR9u4cqb_w3PPqKU3
|
|
|
31
31
|
nlbone/adapters/http_clients/pricing/async_pricing_service.py,sha256=6vwVQ8SGTxFMOKhqlri8CQzzL5RgmDHI4icBiUATdXA,2846
|
|
32
32
|
nlbone/adapters/http_clients/pricing/pricing_service.py,sha256=TPDoeryibAXZndXOoREGTQfRh4lm4K45Cv4ng4gpwD4,3710
|
|
33
33
|
nlbone/adapters/http_clients/uploadchi/__init__.py,sha256=uBzEOuVtY22teWW2b36Pitkdk5yVdSqa6xbg22JfTNg,105
|
|
34
|
-
nlbone/adapters/http_clients/uploadchi/uploadchi.py,sha256=
|
|
35
|
-
nlbone/adapters/http_clients/uploadchi/uploadchi_async.py,sha256=
|
|
34
|
+
nlbone/adapters/http_clients/uploadchi/uploadchi.py,sha256=7QVoTf6Y_dQ-G0qxN7uHaOexuCYtDnVIDCL1aLpqywA,5376
|
|
35
|
+
nlbone/adapters/http_clients/uploadchi/uploadchi_async.py,sha256=Yhvq9gXMWY5DnzlcO-JtBKn2SdSQfUzd5sJdweFNhl8,5860
|
|
36
36
|
nlbone/adapters/i18n/__init__.py,sha256=fS97TR7HEc7fiDC2ufQKoFOxXDNkGA4njAFIB3EmhLk,426
|
|
37
37
|
nlbone/adapters/i18n/engine.py,sha256=yH_b614oJQ2PgM8qpQ5_Prroi4Jjqb-xPguHCCJm0_0,1305
|
|
38
38
|
nlbone/adapters/i18n/loaders.py,sha256=7td0Cmn0ehjDO2S2qeH31zwl8UyWI7quzedP9PnPhWk,2381
|
|
@@ -66,7 +66,7 @@ nlbone/core/ports/__init__.py,sha256=syJg3fAjQALD5Rjfm9wi9bQpkIvNTWjE9AURBmy587o
|
|
|
66
66
|
nlbone/core/ports/auth.py,sha256=RhRKFcO5NFfvhKJkHb9anSxpai5w6D1N4Fhy-bGPWV0,1114
|
|
67
67
|
nlbone/core/ports/cache.py,sha256=8pP_z4ta7PNNG8UiSrEF4xMZRm2wLPxISZvdPt7QnxQ,2351
|
|
68
68
|
nlbone/core/ports/event_bus.py,sha256=7iC8WRBg-EmcKJx7AVPkP-r823SLKGuDxGp9WF4q-_U,824
|
|
69
|
-
nlbone/core/ports/files.py,sha256=
|
|
69
|
+
nlbone/core/ports/files.py,sha256=yKm6auIuN6pDVziyW3tMUEG_wrARXTiHyCfWm3VbzgE,2097
|
|
70
70
|
nlbone/core/ports/outbox.py,sha256=ZSgADjOpn2fgrUTDy-d-2WTc2Yuk4dRm5dzaGDsG6w4,2142
|
|
71
71
|
nlbone/core/ports/repository.py,sha256=Ee8iSt4WxUIt113zLd7hq0HwtHc8r8qRSFBMTiGuJq4,2822
|
|
72
72
|
nlbone/core/ports/translation.py,sha256=pnqbxhdRCR7eprm8UI8ZKKx7VDUPntvBtlytrnTGkrc,354
|
|
@@ -119,8 +119,8 @@ nlbone/utils/normalize_mobile.py,sha256=sGH4tV9gX-6eVKozviNWJhm1DN1J28Nj-ERldCYk
|
|
|
119
119
|
nlbone/utils/read_files.py,sha256=mx8dfvtaaARQFRp_U7OOiERg-GT62h09_lpTzIQsVhs,291
|
|
120
120
|
nlbone/utils/redactor.py,sha256=-V4HrHmHwPi3Kez587Ek1uJlgK35qGSrwBOvcbw8Jas,1279
|
|
121
121
|
nlbone/utils/time.py,sha256=DjjyQ9GLsfXoT6NK8RDW2rOlJg3e6sF04Jw6PBUrSvg,1268
|
|
122
|
-
nlbone-0.11.
|
|
123
|
-
nlbone-0.11.
|
|
124
|
-
nlbone-0.11.
|
|
125
|
-
nlbone-0.11.
|
|
126
|
-
nlbone-0.11.
|
|
122
|
+
nlbone-0.11.4.dist-info/METADATA,sha256=WKsI1Ji9Ch4cTYObm-keBN_a_Y27l6Vn4GpMayITJm0,2295
|
|
123
|
+
nlbone-0.11.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
124
|
+
nlbone-0.11.4.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
|
|
125
|
+
nlbone-0.11.4.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
126
|
+
nlbone-0.11.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|