amsdal 0.4.10__cp311-cp311-macosx_10_9_universal2.whl → 0.5.29__cp311-cp311-macosx_10_9_universal2.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.
- amsdal/Third-Party Materials - AMSDAL Dependencies - License Notices.md +28 -0
- amsdal/__about__.py +1 -1
- amsdal/__migrations__/0000_initial.py +22 -203
- amsdal/__migrations__/0001_create_class_file.py +61 -0
- amsdal/__migrations__/0002_create_class_file.py +109 -0
- amsdal/__migrations__/0003_update_class_file.py +91 -0
- amsdal/__migrations__/0004_update_class_file.py +45 -0
- amsdal/cloud/__init__.cpython-311-darwin.so +0 -0
- amsdal/cloud/client.cpython-311-darwin.so +0 -0
- amsdal/cloud/constants.cpython-311-darwin.so +0 -0
- amsdal/cloud/enums.cpython-311-darwin.so +0 -0
- amsdal/cloud/models/__init__.cpython-311-darwin.so +0 -0
- amsdal/cloud/models/base.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/__init__.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/__init__.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/add_basic_auth.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/add_dependency.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/add_secret.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/base.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/create_deploy.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/create_env.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/create_session.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_basic_auth.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_dependency.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_env.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_secret.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/destroy_deploy.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/expose_db.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/get_monitoring_info.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/list_dependencies.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/list_deploys.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/list_envs.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/list_secrets.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/manager.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/signup_action.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/update_deploy.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/__init__.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/base.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/credentials.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/manager.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/signup_service.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/token.cpython-311-darwin.so +0 -0
- amsdal/configs/main.py +17 -1
- amsdal/configs/main.pyi +7 -3
- amsdal/contrib/__init__.cpython-311-darwin.so +0 -0
- amsdal/contrib/auth/errors.py +36 -0
- amsdal/contrib/auth/errors.pyi +12 -0
- amsdal/contrib/auth/lifecycle/consumer.py +3 -3
- amsdal/contrib/auth/lifecycle/consumer.pyi +3 -0
- amsdal/contrib/auth/migrations/0000_initial.py +55 -52
- amsdal/contrib/auth/migrations/0001_add_mfa_support.py +188 -0
- amsdal/contrib/auth/models/__init__.py +1 -0
- amsdal/contrib/auth/models/backup_code.py +85 -0
- amsdal/contrib/auth/models/email_mfa_device.py +108 -0
- amsdal/contrib/auth/models/login_session.py +117 -0
- amsdal/contrib/auth/models/mfa_device.py +86 -0
- amsdal/contrib/auth/models/sms_device.py +113 -0
- amsdal/contrib/auth/models/totp_device.py +58 -0
- amsdal/contrib/auth/models/user.py +50 -0
- amsdal/contrib/auth/services/__init__.py +1 -0
- amsdal/contrib/auth/services/mfa_device_service.py +544 -0
- amsdal/contrib/auth/services/mfa_device_service.pyi +216 -0
- amsdal/contrib/auth/services/totp_service.py +358 -0
- amsdal/contrib/auth/services/totp_service.pyi +158 -0
- amsdal/contrib/auth/settings.py +8 -0
- amsdal/contrib/auth/settings.pyi +8 -0
- amsdal/contrib/auth/transactions/__init__.py +1 -0
- amsdal/contrib/auth/transactions/mfa_device_transactions.py +463 -0
- amsdal/contrib/auth/transactions/mfa_device_transactions.pyi +226 -0
- amsdal/contrib/auth/transactions/totp_transactions.py +206 -0
- amsdal/contrib/auth/transactions/totp_transactions.pyi +113 -0
- amsdal/contrib/auth/utils/mfa.py +257 -0
- amsdal/contrib/auth/utils/mfa.pyi +119 -0
- amsdal/contrib/frontend_configs/conversion/convert.py +32 -5
- amsdal/contrib/frontend_configs/migrations/0000_initial.py +154 -183
- amsdal/contrib/frontend_configs/migrations/0001_update_frontend_control_config.py +245 -0
- amsdal/contrib/frontend_configs/migrations/0002_add_button_and_invoke_actions.py +352 -0
- amsdal/contrib/frontend_configs/migrations/0003_create_class_frontendconfigdashboardelement.py +145 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +57 -1
- amsdal/contrib/frontend_configs/models/frontend_config_dashboard.py +51 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.py +69 -46
- amsdal/fixtures/__init__.cpython-311-darwin.so +0 -0
- amsdal/fixtures/manager.cpython-311-darwin.so +0 -0
- amsdal/fixtures/utils.cpython-311-darwin.so +0 -0
- amsdal/manager.cpython-311-darwin.so +0 -0
- amsdal/manager.pyi +5 -0
- amsdal/mixins/__init__.cpython-311-darwin.so +0 -0
- amsdal/mixins/class_versions_mixin.cpython-311-darwin.so +0 -0
- amsdal/models/core/class_object.py +7 -6
- amsdal/models/core/class_property.py +7 -1
- amsdal/models/core/file.py +168 -81
- amsdal/models/core/storage_metadata.py +15 -0
- amsdal/models/mixins.py +31 -0
- amsdal/models/types/object.py +3 -3
- amsdal/schemas/core/class_object/model.json +20 -0
- amsdal/schemas/core/class_property/model.json +19 -0
- amsdal/schemas/core/file/properties/validate_data.py +2 -3
- amsdal/schemas/core/storage_metadata/model.json +52 -0
- amsdal/schemas/interfaces.pyi +1 -1
- amsdal/schemas/manager.cpython-311-darwin.so +0 -0
- amsdal/schemas/mixins/check_dependencies_mixin.py +23 -8
- amsdal/schemas/mixins/check_dependencies_mixin.pyi +5 -2
- amsdal/schemas/utils.pyi +2 -2
- amsdal/services/__init__.py +11 -0
- amsdal/services/__init__.pyi +4 -0
- amsdal/services/external_connections.py +262 -0
- amsdal/services/external_connections.pyi +190 -0
- amsdal/services/external_model_generator.py +350 -0
- amsdal/services/external_model_generator.pyi +134 -0
- amsdal/services/transaction_execution.cpython-311-darwin.so +0 -0
- amsdal/services/transaction_execution.pyi +1 -0
- amsdal/storages/__init__.py +20 -0
- amsdal/storages/__init__.pyi +8 -0
- amsdal/storages/file_system.py +214 -0
- amsdal/storages/file_system.pyi +36 -0
- amsdal/utils/rollback/__init__.pyi +6 -0
- amsdal/utils/tests/enums.py +0 -2
- amsdal/utils/tests/helpers.py +213 -381
- amsdal/utils/tests/migrations.py +157 -0
- {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/METADATA +13 -8
- {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/RECORD +131 -124
- {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/WHEEL +1 -1
- amsdal/__migrations__/0001_datetime_type.py +0 -18
- amsdal/__migrations__/0002_fixture_order.py +0 -44
- amsdal/__migrations__/0003_schema_type_in_class_meta.py +0 -44
- amsdal/contrib/auth/models/login_session.pyi +0 -37
- amsdal/contrib/auth/models/permission.pyi +0 -18
- amsdal/contrib/auth/models/user.pyi +0 -46
- amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +0 -12
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +0 -7
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +0 -32
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +0 -11
- amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +0 -8
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +0 -8
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +0 -9
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +0 -10
- amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +0 -15
- amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +0 -35
- amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +0 -9
- amsdal/models/__init__.pyi +0 -9
- amsdal/models/core/class_object.pyi +0 -24
- amsdal/models/core/class_object_meta.py +0 -26
- amsdal/models/core/class_object_meta.pyi +0 -15
- amsdal/models/core/class_property.pyi +0 -11
- amsdal/models/core/class_property_meta.py +0 -15
- amsdal/models/core/class_property_meta.pyi +0 -10
- amsdal/models/core/file.pyi +0 -104
- amsdal/models/core/fixture.pyi +0 -14
- amsdal/models/core/option.pyi +0 -8
- amsdal/models/core/validator.pyi +0 -8
- amsdal/models/types/object.pyi +0 -16
- amsdal/schemas/core/class_object_meta/model.json +0 -59
- amsdal/schemas/core/class_property_meta/model.json +0 -23
- amsdal/services/__init__.cpython-311-darwin.so +0 -0
- /amsdal/contrib/auth/{models → services}/__init__.pyi +0 -0
- /amsdal/contrib/{frontend_configs/models → auth/transactions}/__init__.pyi +0 -0
- /amsdal/{models/core/__init__.pyi → contrib/auth/utils/__init__.py} +0 -0
- /amsdal/{models/types → contrib/auth/utils}/__init__.pyi +0 -0
- {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/licenses/LICENSE.txt +0 -0
- {amsdal-0.4.10.dist-info → amsdal-0.5.29.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import os
|
|
3
|
+
from contextlib import suppress
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import IO
|
|
6
|
+
from typing import Any
|
|
7
|
+
from typing import BinaryIO
|
|
8
|
+
|
|
9
|
+
from amsdal_models.storage.base import Storage
|
|
10
|
+
from amsdal_models.storage.errors import StorageError
|
|
11
|
+
from amsdal_models.storage.helpers import build_storage_address
|
|
12
|
+
from amsdal_models.storage.types import FileProtocol
|
|
13
|
+
from amsdal_utils.config.manager import AmsdalConfigManager
|
|
14
|
+
|
|
15
|
+
CHUNK_SIZE = 8 * 1024
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class FileSystemStorage(Storage):
|
|
19
|
+
"""
|
|
20
|
+
Simple filesystem-based storage backend.
|
|
21
|
+
|
|
22
|
+
- base_dir: root directory for stored files
|
|
23
|
+
- base_url: URL prefix for building public URLs (optional)
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
keeps_local_copy = False
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
base_dir: str | os.PathLike[Any] | None = None,
|
|
31
|
+
base_url: str | None = None,
|
|
32
|
+
*,
|
|
33
|
+
serialize_base_dir: bool = True,
|
|
34
|
+
serialize_base_url: bool = True,
|
|
35
|
+
) -> None:
|
|
36
|
+
from amsdal.configs.main import settings
|
|
37
|
+
|
|
38
|
+
# If AMSDAL is configured to run in async mode, ensure aiofiles is installed.
|
|
39
|
+
if AmsdalConfigManager().get_config().async_mode:
|
|
40
|
+
try:
|
|
41
|
+
import aiofiles # noqa: F401
|
|
42
|
+
except ImportError as e:
|
|
43
|
+
msg = (
|
|
44
|
+
"AMSDAL is configured to run in async mode, but the 'aiofiles' package is not installed.\n"
|
|
45
|
+
'Please install it to enable async file operations.\n\n'
|
|
46
|
+
'Example:\n'
|
|
47
|
+
' pip install aiofiles\n\n'
|
|
48
|
+
f'Original error: {e}'
|
|
49
|
+
)
|
|
50
|
+
raise ImportError(msg) from e
|
|
51
|
+
|
|
52
|
+
_base_dir = base_dir or settings.MEDIA_ROOT
|
|
53
|
+
_base_url = base_url or settings.MEDIA_URL
|
|
54
|
+
|
|
55
|
+
self.base_dir = Path(_base_dir).resolve()
|
|
56
|
+
self.base_url = _base_url
|
|
57
|
+
self.base_dir.mkdir(parents=True, exist_ok=True)
|
|
58
|
+
self.serialize_base_dir = serialize_base_dir
|
|
59
|
+
self.serialize_base_url = serialize_base_url
|
|
60
|
+
|
|
61
|
+
def save(self, file: FileProtocol, content: BinaryIO) -> str:
|
|
62
|
+
suggested = file.filename
|
|
63
|
+
final_name = self._get_available_name(suggested)
|
|
64
|
+
full_path = self._full_path(final_name)
|
|
65
|
+
full_path.parent.mkdir(parents=True, exist_ok=True)
|
|
66
|
+
|
|
67
|
+
with full_path.open('wb') as f:
|
|
68
|
+
# Ensure reading from start
|
|
69
|
+
with suppress(Exception):
|
|
70
|
+
if hasattr(content, 'seek'):
|
|
71
|
+
content.seek(0)
|
|
72
|
+
|
|
73
|
+
chunk = content.read(CHUNK_SIZE)
|
|
74
|
+
|
|
75
|
+
while chunk:
|
|
76
|
+
f.write(chunk)
|
|
77
|
+
chunk = content.read(CHUNK_SIZE)
|
|
78
|
+
|
|
79
|
+
file.storage_address = build_storage_address(self, final_name)
|
|
80
|
+
return final_name
|
|
81
|
+
|
|
82
|
+
def open(self, file: FileProtocol, mode: str = 'rb') -> IO[Any]:
|
|
83
|
+
name = self._name_for(file)
|
|
84
|
+
full_path = self._full_path(name)
|
|
85
|
+
|
|
86
|
+
if not full_path.exists():
|
|
87
|
+
msg = f'File not found: {name}'
|
|
88
|
+
raise StorageError(msg)
|
|
89
|
+
return full_path.open(mode)
|
|
90
|
+
|
|
91
|
+
def delete(self, file: FileProtocol) -> None:
|
|
92
|
+
name = self._name_for(file)
|
|
93
|
+
try:
|
|
94
|
+
self._full_path(name).unlink(missing_ok=True)
|
|
95
|
+
except Exception as e:
|
|
96
|
+
msg = f"Failed to delete '{name}': {e}"
|
|
97
|
+
raise StorageError(msg) from e
|
|
98
|
+
|
|
99
|
+
def exists(self, file: FileProtocol) -> bool:
|
|
100
|
+
name = self._name_for(file)
|
|
101
|
+
return self._full_path(name).exists()
|
|
102
|
+
|
|
103
|
+
def url(self, file: FileProtocol) -> str:
|
|
104
|
+
name = self._name_for(file)
|
|
105
|
+
if not self.base_url:
|
|
106
|
+
# Return file path as fallback
|
|
107
|
+
return self._full_path(name).as_uri()
|
|
108
|
+
|
|
109
|
+
prefix = self.base_url.rstrip('/')
|
|
110
|
+
name_posix = Path(name).as_posix().lstrip('/')
|
|
111
|
+
|
|
112
|
+
return f'{prefix}/{name_posix}'
|
|
113
|
+
|
|
114
|
+
# ---- async counterparts ----
|
|
115
|
+
async def asave(self, file: FileProtocol, content: BinaryIO) -> str:
|
|
116
|
+
import aiofiles.os
|
|
117
|
+
|
|
118
|
+
suggested = file.filename
|
|
119
|
+
final_name = self._get_available_name(suggested)
|
|
120
|
+
full_path = self._full_path(final_name)
|
|
121
|
+
# Ensure directory exists
|
|
122
|
+
await aiofiles.os.makedirs(str(full_path.parent), exist_ok=True)
|
|
123
|
+
|
|
124
|
+
# Ensure reading from start
|
|
125
|
+
with suppress(Exception):
|
|
126
|
+
if hasattr(content, 'seek'):
|
|
127
|
+
with suppress(Exception):
|
|
128
|
+
await asyncio.to_thread(content.seek, 0)
|
|
129
|
+
|
|
130
|
+
async with aiofiles.open(str(full_path), 'wb') as f: # type: ignore[call-arg]
|
|
131
|
+
while True:
|
|
132
|
+
chunk = await asyncio.to_thread(content.read, CHUNK_SIZE)
|
|
133
|
+
if not chunk:
|
|
134
|
+
break
|
|
135
|
+
await f.write(chunk)
|
|
136
|
+
|
|
137
|
+
file.storage_address = build_storage_address(self, final_name)
|
|
138
|
+
|
|
139
|
+
return final_name
|
|
140
|
+
|
|
141
|
+
async def aopen(self, file: FileProtocol, mode: str = 'rb') -> Any:
|
|
142
|
+
import aiofiles.ospath
|
|
143
|
+
|
|
144
|
+
name = self._name_for(file)
|
|
145
|
+
full_path = self._full_path(name)
|
|
146
|
+
|
|
147
|
+
if not await aiofiles.ospath.exists(str(full_path)):
|
|
148
|
+
msg = f'File not found: {name}'
|
|
149
|
+
raise StorageError(msg)
|
|
150
|
+
|
|
151
|
+
return aiofiles.open(str(full_path), mode) # type: ignore[call-overload]
|
|
152
|
+
|
|
153
|
+
async def adelete(self, file: FileProtocol) -> None:
|
|
154
|
+
import aiofiles.os
|
|
155
|
+
import aiofiles.ospath
|
|
156
|
+
|
|
157
|
+
name = self._name_for(file)
|
|
158
|
+
full_path = self._full_path(name)
|
|
159
|
+
|
|
160
|
+
if await aiofiles.ospath.exists(str(full_path)):
|
|
161
|
+
try:
|
|
162
|
+
await aiofiles.os.remove(str(full_path))
|
|
163
|
+
except Exception as e: # pragma: no cover - error path
|
|
164
|
+
msg = f"Failed to delete '{name}': {e}"
|
|
165
|
+
raise StorageError(msg) from e
|
|
166
|
+
|
|
167
|
+
async def aexists(self, file: FileProtocol) -> bool:
|
|
168
|
+
import aiofiles.ospath
|
|
169
|
+
|
|
170
|
+
name = self._name_for(file)
|
|
171
|
+
return await aiofiles.ospath.exists(str(self._full_path(name)))
|
|
172
|
+
|
|
173
|
+
async def aurl(self, file: FileProtocol) -> str:
|
|
174
|
+
# Pure computation; no disk I/O.
|
|
175
|
+
return self.url(file)
|
|
176
|
+
|
|
177
|
+
def _full_path(self, name: str) -> Path:
|
|
178
|
+
# Sanitize name to avoid path traversal
|
|
179
|
+
norm = Path(name).as_posix().lstrip('/')
|
|
180
|
+
|
|
181
|
+
return (self.base_dir / norm).resolve()
|
|
182
|
+
|
|
183
|
+
def _get_available_name(self, name: str) -> str:
|
|
184
|
+
# If file exists, add suffixes to avoid collision
|
|
185
|
+
candidate = Path(name)
|
|
186
|
+
base = candidate.stem
|
|
187
|
+
suffix = candidate.suffix
|
|
188
|
+
parent = candidate.parent.as_posix()
|
|
189
|
+
i = 0
|
|
190
|
+
final = candidate.as_posix()
|
|
191
|
+
|
|
192
|
+
# Check filesystem directly to avoid relying on public exists signature
|
|
193
|
+
while self._full_path(final).exists():
|
|
194
|
+
i += 1
|
|
195
|
+
new_name = f'{base}_{i}{suffix}'
|
|
196
|
+
final = str(Path(parent) / new_name) if parent and parent != '.' else new_name
|
|
197
|
+
return final
|
|
198
|
+
|
|
199
|
+
def _name_for(self, file: FileProtocol) -> str:
|
|
200
|
+
if getattr(file, 'storage_address', None) and getattr(file.storage_address, 'ref', None) is not None:
|
|
201
|
+
if getattr(file.storage_address.ref, 'object_id', None) is not None: # type: ignore[union-attr]
|
|
202
|
+
return str(file.storage_address.ref.object_id) # type: ignore[union-attr]
|
|
203
|
+
return file.filename
|
|
204
|
+
|
|
205
|
+
def _export_kwargs(self) -> dict[str, Any]:
|
|
206
|
+
kwargs = {}
|
|
207
|
+
|
|
208
|
+
if self.serialize_base_dir:
|
|
209
|
+
kwargs['base_dir'] = str(self.base_dir)
|
|
210
|
+
|
|
211
|
+
if self.serialize_base_url:
|
|
212
|
+
kwargs['base_url'] = self.base_url
|
|
213
|
+
|
|
214
|
+
return kwargs
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from _typeshed import Incomplete
|
|
3
|
+
from amsdal_models.storage.base import Storage
|
|
4
|
+
from amsdal_models.storage.types import FileProtocol
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any, BinaryIO, IO
|
|
7
|
+
|
|
8
|
+
CHUNK_SIZE: Incomplete
|
|
9
|
+
|
|
10
|
+
class FileSystemStorage(Storage):
|
|
11
|
+
"""
|
|
12
|
+
Simple filesystem-based storage backend.
|
|
13
|
+
|
|
14
|
+
- base_dir: root directory for stored files
|
|
15
|
+
- base_url: URL prefix for building public URLs (optional)
|
|
16
|
+
"""
|
|
17
|
+
keeps_local_copy: bool
|
|
18
|
+
base_dir: Incomplete
|
|
19
|
+
base_url: Incomplete
|
|
20
|
+
serialize_base_dir: Incomplete
|
|
21
|
+
serialize_base_url: Incomplete
|
|
22
|
+
def __init__(self, base_dir: str | os.PathLike[Any] | None = None, base_url: str | None = None, *, serialize_base_dir: bool = True, serialize_base_url: bool = True) -> None: ...
|
|
23
|
+
def save(self, file: FileProtocol, content: BinaryIO) -> str: ...
|
|
24
|
+
def open(self, file: FileProtocol, mode: str = 'rb') -> IO[Any]: ...
|
|
25
|
+
def delete(self, file: FileProtocol) -> None: ...
|
|
26
|
+
def exists(self, file: FileProtocol) -> bool: ...
|
|
27
|
+
def url(self, file: FileProtocol) -> str: ...
|
|
28
|
+
async def asave(self, file: FileProtocol, content: BinaryIO) -> str: ...
|
|
29
|
+
async def aopen(self, file: FileProtocol, mode: str = 'rb') -> Any: ...
|
|
30
|
+
async def adelete(self, file: FileProtocol) -> None: ...
|
|
31
|
+
async def aexists(self, file: FileProtocol) -> bool: ...
|
|
32
|
+
async def aurl(self, file: FileProtocol) -> str: ...
|
|
33
|
+
def _full_path(self, name: str) -> Path: ...
|
|
34
|
+
def _get_available_name(self, name: str) -> str: ...
|
|
35
|
+
def _name_for(self, file: FileProtocol) -> str: ...
|
|
36
|
+
def _export_kwargs(self) -> dict[str, Any]: ...
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
from amsdal_data.transactions.decorators import async_transaction, transaction
|
|
2
|
+
|
|
3
|
+
@transaction
|
|
1
4
|
def rollback_to_timestamp(timestamp: float) -> None:
|
|
2
5
|
"""
|
|
3
6
|
Rollback the data to the given timestamp
|
|
@@ -6,6 +9,7 @@ def rollback_to_timestamp(timestamp: float) -> None:
|
|
|
6
9
|
Returns:
|
|
7
10
|
None
|
|
8
11
|
"""
|
|
12
|
+
@transaction
|
|
9
13
|
def rollback_transaction(transaction_id: str) -> None:
|
|
10
14
|
"""
|
|
11
15
|
Rollback the data to the point in time before the given transaction
|
|
@@ -14,6 +18,7 @@ def rollback_transaction(transaction_id: str) -> None:
|
|
|
14
18
|
Returns:
|
|
15
19
|
None
|
|
16
20
|
"""
|
|
21
|
+
@async_transaction
|
|
17
22
|
async def async_rollback_to_timestamp(timestamp: float) -> None:
|
|
18
23
|
"""
|
|
19
24
|
Rollback the data to the given timestamp
|
|
@@ -22,6 +27,7 @@ async def async_rollback_to_timestamp(timestamp: float) -> None:
|
|
|
22
27
|
Returns:
|
|
23
28
|
None
|
|
24
29
|
"""
|
|
30
|
+
@async_transaction
|
|
25
31
|
async def async_rollback_transaction(transaction_id: str) -> None:
|
|
26
32
|
"""
|
|
27
33
|
Rollback the data to the point in time before the given transaction
|