amsdal 0.5.34__cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.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 +1362 -0
- amsdal/__about__.py +4 -0
- amsdal/__about__.pyi +1 -0
- amsdal/__init__.py +23 -0
- amsdal/__init__.pyi +9 -0
- amsdal/__migrations__/0000_initial.py +36 -0
- 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-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/__init__.pyi +0 -0
- amsdal/cloud/client.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/client.pyi +57 -0
- amsdal/cloud/constants.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/constants.pyi +13 -0
- amsdal/cloud/enums.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/enums.pyi +68 -0
- amsdal/cloud/models/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/__init__.pyi +0 -0
- amsdal/cloud/models/base.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/base.pyi +247 -0
- amsdal/cloud/services/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/__init__.pyi +0 -0
- amsdal/cloud/services/actions/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/__init__.pyi +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.pyi +19 -0
- amsdal/cloud/services/actions/add_basic_auth.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_basic_auth.pyi +21 -0
- amsdal/cloud/services/actions/add_dependency.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_dependency.pyi +19 -0
- amsdal/cloud/services/actions/add_secret.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_secret.pyi +20 -0
- amsdal/cloud/services/actions/base.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/base.pyi +122 -0
- amsdal/cloud/services/actions/create_deploy.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_deploy.pyi +41 -0
- amsdal/cloud/services/actions/create_env.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_env.pyi +19 -0
- amsdal/cloud/services/actions/create_session.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_session.pyi +17 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.pyi +19 -0
- amsdal/cloud/services/actions/delete_basic_auth.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_basic_auth.pyi +20 -0
- amsdal/cloud/services/actions/delete_dependency.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_dependency.pyi +21 -0
- amsdal/cloud/services/actions/delete_env.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_env.pyi +21 -0
- amsdal/cloud/services/actions/delete_secret.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_secret.pyi +21 -0
- amsdal/cloud/services/actions/destroy_deploy.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/destroy_deploy.pyi +18 -0
- amsdal/cloud/services/actions/expose_db.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/expose_db.pyi +22 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.pyi +21 -0
- amsdal/cloud/services/actions/get_monitoring_info.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/get_monitoring_info.pyi +21 -0
- amsdal/cloud/services/actions/list_dependencies.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_dependencies.pyi +21 -0
- amsdal/cloud/services/actions/list_deploys.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_deploys.pyi +19 -0
- amsdal/cloud/services/actions/list_envs.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_envs.pyi +20 -0
- amsdal/cloud/services/actions/list_secrets.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_secrets.pyi +22 -0
- amsdal/cloud/services/actions/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/manager.pyi +278 -0
- amsdal/cloud/services/actions/signup_action.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/signup_action.pyi +20 -0
- amsdal/cloud/services/actions/update_deploy.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/update_deploy.pyi +19 -0
- amsdal/cloud/services/auth/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/__init__.pyi +0 -0
- amsdal/cloud/services/auth/base.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/base.pyi +6 -0
- amsdal/cloud/services/auth/credentials.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/credentials.pyi +30 -0
- amsdal/cloud/services/auth/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/manager.pyi +26 -0
- amsdal/cloud/services/auth/signup_service.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/signup_service.pyi +32 -0
- amsdal/cloud/services/auth/token.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/token.pyi +27 -0
- amsdal/configs/__init__.py +0 -0
- amsdal/configs/__init__.pyi +0 -0
- amsdal/configs/constants.py +33 -0
- amsdal/configs/constants.pyi +22 -0
- amsdal/configs/main.py +274 -0
- amsdal/configs/main.pyi +178 -0
- amsdal/context/__init__.py +0 -0
- amsdal/context/__init__.pyi +0 -0
- amsdal/context/manager.py +69 -0
- amsdal/context/manager.pyi +50 -0
- amsdal/contrib/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/contrib/__init__.pyi +0 -0
- amsdal/contrib/app_config.py +7 -0
- amsdal/contrib/app_config.pyi +6 -0
- amsdal/contrib/auth/__init__.py +0 -0
- amsdal/contrib/auth/__init__.pyi +0 -0
- amsdal/contrib/auth/app.py +27 -0
- amsdal/contrib/auth/app.pyi +15 -0
- amsdal/contrib/auth/decorators/__init__.py +35 -0
- amsdal/contrib/auth/decorators/__init__.pyi +6 -0
- amsdal/contrib/auth/errors.py +43 -0
- amsdal/contrib/auth/errors.pyi +16 -0
- amsdal/contrib/auth/fixtures/basic_permissions.json +64 -0
- amsdal/contrib/auth/lifecycle/__init__.py +0 -0
- amsdal/contrib/auth/lifecycle/__init__.pyi +0 -0
- amsdal/contrib/auth/lifecycle/consumer.py +394 -0
- amsdal/contrib/auth/lifecycle/consumer.pyi +108 -0
- amsdal/contrib/auth/migrations/0000_initial.py +87 -0
- 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 +235 -0
- amsdal/contrib/auth/models/mfa_device.py +86 -0
- amsdal/contrib/auth/models/permission.py +23 -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 +156 -0
- amsdal/contrib/auth/services/__init__.py +1 -0
- amsdal/contrib/auth/services/__init__.pyi +0 -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 +44 -0
- amsdal/contrib/auth/settings.pyi +34 -0
- amsdal/contrib/auth/transactions/__init__.py +1 -0
- amsdal/contrib/auth/transactions/__init__.pyi +0 -0
- amsdal/contrib/auth/transactions/mfa_device_transactions.py +458 -0
- amsdal/contrib/auth/transactions/mfa_device_transactions.pyi +226 -0
- amsdal/contrib/auth/transactions/totp_transactions.py +203 -0
- amsdal/contrib/auth/transactions/totp_transactions.pyi +113 -0
- amsdal/contrib/auth/utils/__init__.py +0 -0
- amsdal/contrib/auth/utils/__init__.pyi +0 -0
- amsdal/contrib/auth/utils/mfa.py +257 -0
- amsdal/contrib/auth/utils/mfa.pyi +119 -0
- amsdal/contrib/frontend_configs/__init__.py +0 -0
- amsdal/contrib/frontend_configs/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/app.py +24 -0
- amsdal/contrib/frontend_configs/app.pyi +19 -0
- amsdal/contrib/frontend_configs/constants.py +1 -0
- amsdal/contrib/frontend_configs/constants.pyi +1 -0
- amsdal/contrib/frontend_configs/conversion/__init__.py +5 -0
- amsdal/contrib/frontend_configs/conversion/__init__.pyi +3 -0
- amsdal/contrib/frontend_configs/conversion/convert.py +310 -0
- amsdal/contrib/frontend_configs/conversion/convert.pyi +22 -0
- amsdal/contrib/frontend_configs/lifecycle/__init__.py +0 -0
- amsdal/contrib/frontend_configs/lifecycle/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.py +306 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +98 -0
- amsdal/contrib/frontend_configs/migrations/0000_initial.py +227 -0
- 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/__init__.py +0 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +110 -0
- amsdal/contrib/frontend_configs/models/frontend_config_dashboard.py +51 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.py +110 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
- amsdal/contrib/frontend_configs/utils.py +29 -0
- amsdal/contrib/frontend_configs/utils.pyi +17 -0
- amsdal/errors.py +31 -0
- amsdal/errors.pyi +12 -0
- amsdal/fixtures/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/__init__.pyi +0 -0
- amsdal/fixtures/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/manager.pyi +170 -0
- amsdal/fixtures/utils.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/utils.pyi +9 -0
- amsdal/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/manager.pyi +265 -0
- amsdal/mixins/__init__.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/__init__.pyi +0 -0
- amsdal/mixins/class_versions_mixin.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/class_versions_mixin.pyi +12 -0
- amsdal/models/__init__.py +19 -0
- amsdal/models/core/__init__.py +0 -0
- amsdal/models/core/class_object.py +38 -0
- amsdal/models/core/class_property.py +26 -0
- amsdal/models/core/file.py +243 -0
- amsdal/models/core/fixture.py +25 -0
- amsdal/models/core/option.py +11 -0
- amsdal/models/core/storage_metadata.py +15 -0
- amsdal/models/core/validator.py +12 -0
- amsdal/models/mixins.py +31 -0
- amsdal/models/types/__init__.py +0 -0
- amsdal/models/types/object.py +26 -0
- amsdal/py.typed +0 -0
- amsdal/queryset/__init__.py +21 -0
- amsdal/queryset/__init__.pyi +6 -0
- amsdal/schemas/__init__.py +0 -0
- amsdal/schemas/__init__.pyi +0 -0
- amsdal/schemas/core/class_object/model.json +51 -0
- amsdal/schemas/core/class_object/properties/display_name.py +9 -0
- amsdal/schemas/core/class_property/model.json +41 -0
- amsdal/schemas/core/file/hooks/pre_create.py +24 -0
- amsdal/schemas/core/file/hooks/pre_update.py +24 -0
- amsdal/schemas/core/file/model.json +23 -0
- amsdal/schemas/core/file/properties/from_file.py +34 -0
- amsdal/schemas/core/file/properties/mimetype.py +13 -0
- amsdal/schemas/core/file/properties/str.py +6 -0
- amsdal/schemas/core/file/properties/to_file.py +24 -0
- amsdal/schemas/core/file/properties/validate_data.py +31 -0
- amsdal/schemas/core/fixture/model.json +35 -0
- amsdal/schemas/core/option/model.json +19 -0
- amsdal/schemas/core/storage_metadata/model.json +52 -0
- amsdal/schemas/core/validator/model.json +19 -0
- amsdal/schemas/interfaces.py +25 -0
- amsdal/schemas/interfaces.pyi +20 -0
- amsdal/schemas/manager.cpython-313-x86_64-linux-gnu.so +0 -0
- amsdal/schemas/manager.py +0 -0
- amsdal/schemas/manager.pyi +0 -0
- amsdal/schemas/mixins/__init__.py +0 -0
- amsdal/schemas/mixins/__init__.pyi +0 -0
- amsdal/schemas/mixins/check_dependencies_mixin.py +130 -0
- amsdal/schemas/mixins/check_dependencies_mixin.pyi +45 -0
- amsdal/schemas/mixins/verify_schemas_mixin.py +96 -0
- amsdal/schemas/mixins/verify_schemas_mixin.pyi +33 -0
- amsdal/schemas/repository.py +84 -0
- amsdal/schemas/repository.pyi +22 -0
- amsdal/schemas/types/anything/model.json +7 -0
- amsdal/schemas/types/array/model.json +7 -0
- amsdal/schemas/types/binary/model.json +7 -0
- amsdal/schemas/types/boolean/model.json +17 -0
- amsdal/schemas/types/date/model.json +7 -0
- amsdal/schemas/types/datetime/model.json +7 -0
- amsdal/schemas/types/dictionary/model.json +8 -0
- amsdal/schemas/types/number/model.json +8 -0
- amsdal/schemas/types/object/model.json +53 -0
- amsdal/schemas/types/string/model.json +8 -0
- amsdal/schemas/utils.py +16 -0
- amsdal/schemas/utils.pyi +10 -0
- 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-313-x86_64-linux-gnu.so +0 -0
- amsdal/services/transaction_execution.pyi +93 -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/transactions/__init__.py +13 -0
- amsdal/transactions/__init__.pyi +4 -0
- amsdal/utils/__init__.py +0 -0
- amsdal/utils/__init__.pyi +0 -0
- amsdal/utils/contrib_paths.py +23 -0
- amsdal/utils/contrib_paths.pyi +14 -0
- amsdal/utils/rollback/__init__.py +440 -0
- amsdal/utils/rollback/__init__.pyi +38 -0
- amsdal/utils/tests/__init__.py +0 -0
- amsdal/utils/tests/enums.py +16 -0
- amsdal/utils/tests/factories.py +49 -0
- amsdal/utils/tests/helpers.py +331 -0
- amsdal/utils/tests/migrations.py +157 -0
- amsdal-0.5.34.dist-info/METADATA +375 -0
- amsdal-0.5.34.dist-info/RECORD +276 -0
- amsdal-0.5.34.dist-info/WHEEL +6 -0
- amsdal-0.5.34.dist-info/licenses/LICENSE.txt +107 -0
- amsdal-0.5.34.dist-info/top_level.txt +1 -0
amsdal/models/mixins.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import datetime as _dt
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TimestampMixin:
|
|
5
|
+
created_at: _dt.datetime | None = None
|
|
6
|
+
updated_at: _dt.datetime | None = None
|
|
7
|
+
|
|
8
|
+
def pre_create(self) -> None:
|
|
9
|
+
self.created_at = _dt.datetime.now(tz=_dt.UTC)
|
|
10
|
+
super().pre_create() # type: ignore[misc]
|
|
11
|
+
|
|
12
|
+
async def apre_create(self) -> None:
|
|
13
|
+
self.created_at = _dt.datetime.now(tz=_dt.UTC)
|
|
14
|
+
await super().apre_create() # type: ignore[misc]
|
|
15
|
+
|
|
16
|
+
def pre_update(self) -> None:
|
|
17
|
+
self.updated_at = _dt.datetime.now(tz=_dt.UTC)
|
|
18
|
+
|
|
19
|
+
if not self.created_at:
|
|
20
|
+
_metadata = self.get_metadata() # type: ignore[attr-defined]
|
|
21
|
+
self.created_at = _dt.datetime.fromtimestamp(_metadata.created_at / 1000, tz=_dt.UTC)
|
|
22
|
+
|
|
23
|
+
super().pre_update() # type: ignore[misc]
|
|
24
|
+
|
|
25
|
+
async def apre_update(self) -> None:
|
|
26
|
+
self.updated_at = _dt.datetime.now(tz=_dt.UTC)
|
|
27
|
+
if not self.created_at:
|
|
28
|
+
_metadata = await self.aget_metadata() # type: ignore[attr-defined]
|
|
29
|
+
self.created_at = _dt.datetime.fromtimestamp(_metadata.created_at / 1000, tz=_dt.UTC)
|
|
30
|
+
|
|
31
|
+
await super().apre_update() # type: ignore[misc]
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from typing import ClassVar
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from amsdal_models.builder.validators.dict_validators import validate_non_empty_keys
|
|
6
|
+
from amsdal_models.classes.model import Model
|
|
7
|
+
from amsdal_utils.models.enums import ModuleType
|
|
8
|
+
from pydantic.fields import Field
|
|
9
|
+
from pydantic.functional_validators import field_validator
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Object(Model):
|
|
13
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.TYPE
|
|
14
|
+
title: str = Field(title='Title', default='')
|
|
15
|
+
type: str = Field(title='Type', default='object')
|
|
16
|
+
module_type: str = Field(title='Module Type', default=ModuleType.CORE.value)
|
|
17
|
+
default: Optional[Any] = Field(None, title='Default') # noqa: UP007
|
|
18
|
+
properties: Optional[dict[str, Optional[Any]]] = Field(None, title='Properties') # noqa: UP007
|
|
19
|
+
required: Optional[list[str]] = Field(None, title='Required') # noqa: UP007
|
|
20
|
+
custom_code: Optional[str] = Field(None, title='Custom Code') # noqa: UP007
|
|
21
|
+
meta_class: Optional[str] = Field(None, title='Meta Class') # noqa: UP007
|
|
22
|
+
|
|
23
|
+
@field_validator('properties')
|
|
24
|
+
@classmethod
|
|
25
|
+
def _non_empty_keys_properties(cls: type, value: Any) -> Any: # type: ignore # noqa: A003
|
|
26
|
+
return validate_non_empty_keys(value)
|
amsdal/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from amsdal_models.querysets.base_queryset import QuerySet
|
|
2
|
+
from amsdal_models.querysets.base_queryset import QuerySetCount
|
|
3
|
+
from amsdal_models.querysets.base_queryset import QuerySetOne
|
|
4
|
+
from amsdal_models.querysets.base_queryset import QuerySetOneRequired
|
|
5
|
+
from amsdal_utils.query.data_models.filter import Filter
|
|
6
|
+
from amsdal_utils.query.enums import Lookup
|
|
7
|
+
from amsdal_utils.query.enums import OrderDirection
|
|
8
|
+
from amsdal_utils.query.utils import ConnectorEnum
|
|
9
|
+
from amsdal_utils.query.utils import Q
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
'ConnectorEnum',
|
|
13
|
+
'Filter',
|
|
14
|
+
'Lookup',
|
|
15
|
+
'OrderDirection',
|
|
16
|
+
'Q',
|
|
17
|
+
'QuerySet',
|
|
18
|
+
'QuerySetCount',
|
|
19
|
+
'QuerySetOne',
|
|
20
|
+
'QuerySetOneRequired',
|
|
21
|
+
]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
from amsdal_models.querysets.base_queryset import QuerySet as QuerySet, QuerySetCount as QuerySetCount, QuerySetOne as QuerySetOne, QuerySetOneRequired as QuerySetOneRequired
|
|
2
|
+
from amsdal_utils.query.data_models.filter import Filter as Filter
|
|
3
|
+
from amsdal_utils.query.enums import Lookup as Lookup, OrderDirection as OrderDirection
|
|
4
|
+
from amsdal_utils.query.utils import ConnectorEnum as ConnectorEnum, Q as Q
|
|
5
|
+
|
|
6
|
+
__all__ = ['ConnectorEnum', 'Filter', 'Lookup', 'OrderDirection', 'Q', 'QuerySet', 'QuerySetCount', 'QuerySetOne', 'QuerySetOneRequired']
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "ClassObject",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"title": {
|
|
6
|
+
"title": "Title",
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"type": {
|
|
10
|
+
"title": "Type",
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"module_type": {
|
|
14
|
+
"title": "Module Type",
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"properties": {
|
|
18
|
+
"title": "Properties",
|
|
19
|
+
"type": "dictionary",
|
|
20
|
+
"items": {
|
|
21
|
+
"key": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"value": {
|
|
25
|
+
"type": "ClassProperty"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"required": {
|
|
30
|
+
"title": "Required",
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"custom_code": {
|
|
37
|
+
"title": "Custom Code",
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"storage_metadata": {
|
|
41
|
+
"title": "Storage metadata",
|
|
42
|
+
"type": "StorageMetadata"
|
|
43
|
+
},
|
|
44
|
+
"meta_class": {
|
|
45
|
+
"title": "Meta Class",
|
|
46
|
+
"type": "string",
|
|
47
|
+
"default": "ClassObject"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"required": []
|
|
51
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "ClassProperty",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"title": {
|
|
6
|
+
"title": "Title",
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"type": {
|
|
10
|
+
"title": "Type",
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"default": {
|
|
14
|
+
"title": "Default",
|
|
15
|
+
"type": "anything"
|
|
16
|
+
},
|
|
17
|
+
"options": {
|
|
18
|
+
"title": "Options",
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "Option"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"items": {
|
|
25
|
+
"title": "Items",
|
|
26
|
+
"type": "dictionary",
|
|
27
|
+
"items": {
|
|
28
|
+
"key": {"type": "string"},
|
|
29
|
+
"value": {"type": "anything"}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"discriminator": {
|
|
33
|
+
"title": "Discriminator",
|
|
34
|
+
"type": "string"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"required": [
|
|
38
|
+
"type"
|
|
39
|
+
],
|
|
40
|
+
"meta_class": "TypeMeta"
|
|
41
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
def pre_create(self) -> None: # type: ignore[no-untyped-def]
|
|
2
|
+
"""
|
|
3
|
+
Prepares the object for creation by setting its size attribute.
|
|
4
|
+
|
|
5
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
|
6
|
+
If the data is None, it defaults to an empty byte string.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
None
|
|
10
|
+
"""
|
|
11
|
+
self.size = len(self.data or b'')
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
async def apre_create(self) -> None: # type: ignore[no-untyped-def]
|
|
15
|
+
"""
|
|
16
|
+
Prepares the object for creation by setting its size attribute.
|
|
17
|
+
|
|
18
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
|
19
|
+
If the data is None, it defaults to an empty byte string.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
None
|
|
23
|
+
"""
|
|
24
|
+
self.size = len(self.data or b'')
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
def pre_update(self): # type: ignore[no-untyped-def]
|
|
2
|
+
"""
|
|
3
|
+
Prepares the object for update by setting its size attribute.
|
|
4
|
+
|
|
5
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
|
6
|
+
If the data is None, it defaults to an empty byte string.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
None
|
|
10
|
+
"""
|
|
11
|
+
self.size = len(self.data or b'')
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
async def apre_update(self): # type: ignore[no-untyped-def]
|
|
15
|
+
"""
|
|
16
|
+
Prepares the object for update by setting its size attribute.
|
|
17
|
+
|
|
18
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
|
19
|
+
If the data is None, it defaults to an empty byte string.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
None
|
|
23
|
+
"""
|
|
24
|
+
self.size = len(self.data or b'')
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "File",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"default": null,
|
|
5
|
+
"properties": {
|
|
6
|
+
"filename": {
|
|
7
|
+
"title": "Filename",
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"data": {
|
|
11
|
+
"title": "Data",
|
|
12
|
+
"type": "binary"
|
|
13
|
+
},
|
|
14
|
+
"size": {
|
|
15
|
+
"title": "Size",
|
|
16
|
+
"type": "number"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": [
|
|
20
|
+
"filename",
|
|
21
|
+
"data"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import BinaryIO
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@classmethod # type: ignore[misc, no-untyped-def]
|
|
6
|
+
def from_file( # type: ignore[no-untyped-def]
|
|
7
|
+
cls,
|
|
8
|
+
file_or_path: Path | BinaryIO,
|
|
9
|
+
) -> 'File': # type: ignore[name-defined] # noqa: F821
|
|
10
|
+
"""
|
|
11
|
+
Creates a `File` object from a file path or a binary file object.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
file_or_path (Path | BinaryIO): The file path or binary file object.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
File: The created `File` object.
|
|
18
|
+
|
|
19
|
+
Raises:
|
|
20
|
+
ValueError: If the provided path is a directory.
|
|
21
|
+
"""
|
|
22
|
+
if isinstance(file_or_path, Path):
|
|
23
|
+
if file_or_path.is_dir():
|
|
24
|
+
msg = f'{file_or_path} is a directory'
|
|
25
|
+
raise ValueError(msg)
|
|
26
|
+
|
|
27
|
+
data = file_or_path.read_bytes()
|
|
28
|
+
filename = file_or_path.name
|
|
29
|
+
else:
|
|
30
|
+
file_or_path.seek(0)
|
|
31
|
+
data = file_or_path.read()
|
|
32
|
+
filename = Path(file_or_path.name).name
|
|
33
|
+
|
|
34
|
+
return cls(data=data, filename=filename)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@property # type: ignore[misc]
|
|
2
|
+
def mimetype(self) -> str | None: # type: ignore[no-untyped-def]
|
|
3
|
+
"""
|
|
4
|
+
Returns the MIME type of the file based on its filename.
|
|
5
|
+
|
|
6
|
+
This method uses the `mimetypes` module to guess the MIME type of the file.
|
|
7
|
+
|
|
8
|
+
Returns:
|
|
9
|
+
str | None: The guessed MIME type of the file, or None if it cannot be determined.
|
|
10
|
+
"""
|
|
11
|
+
import mimetypes
|
|
12
|
+
|
|
13
|
+
return mimetypes.guess_type(self.filename)[0]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import BinaryIO
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def to_file(self, file_or_path: Path | BinaryIO) -> None: # type: ignore[no-untyped-def]
|
|
6
|
+
"""
|
|
7
|
+
Writes the object's data to a file path or a binary file object.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
file_or_path (Path | BinaryIO): The file path or binary file object where the data will be written.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
None
|
|
14
|
+
|
|
15
|
+
Raises:
|
|
16
|
+
ValueError: If the provided path is a directory.
|
|
17
|
+
"""
|
|
18
|
+
if isinstance(file_or_path, Path):
|
|
19
|
+
if file_or_path.is_dir():
|
|
20
|
+
file_or_path = file_or_path / self.name
|
|
21
|
+
file_or_path.write_bytes(self.data) # type: ignore[union-attr]
|
|
22
|
+
else:
|
|
23
|
+
file_or_path.write(self.data)
|
|
24
|
+
file_or_path.seek(0)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import base64
|
|
2
|
+
from contextlib import suppress
|
|
3
|
+
|
|
4
|
+
from pydantic import field_validator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@field_validator('data') # type: ignore[misc]
|
|
8
|
+
@classmethod
|
|
9
|
+
def data_base64_decode(cls, v: bytes) -> bytes: # type: ignore[no-untyped-def]
|
|
10
|
+
"""
|
|
11
|
+
Decodes a base64-encoded byte string if it is base64-encoded.
|
|
12
|
+
|
|
13
|
+
This method checks if the provided byte string is base64-encoded and decodes it if true.
|
|
14
|
+
If the byte string is not base64-encoded, it returns the original byte string.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
cls: The class this method belongs to.
|
|
18
|
+
v (bytes): The byte string to be checked and potentially decoded.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
bytes: The decoded byte string if it was base64-encoded, otherwise the original byte string.
|
|
22
|
+
"""
|
|
23
|
+
is_base64: bool = False
|
|
24
|
+
|
|
25
|
+
with suppress(Exception):
|
|
26
|
+
is_base64 = base64.b64encode(base64.b64decode(v)) == v
|
|
27
|
+
|
|
28
|
+
if is_base64:
|
|
29
|
+
return base64.b64decode(v)
|
|
30
|
+
|
|
31
|
+
return v
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Fixture",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"class_name": {
|
|
6
|
+
"title": "Class Name",
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"order": {
|
|
10
|
+
"title": "Order",
|
|
11
|
+
"type": "number"
|
|
12
|
+
},
|
|
13
|
+
"external_id": {
|
|
14
|
+
"title": "External ID",
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"data": {
|
|
18
|
+
"title": "Data",
|
|
19
|
+
"type": "dictionary",
|
|
20
|
+
"items": {
|
|
21
|
+
"key": {"type": "string"},
|
|
22
|
+
"value": {"type": "anything"}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": [
|
|
27
|
+
"data",
|
|
28
|
+
"external_id"
|
|
29
|
+
],
|
|
30
|
+
"unique": [
|
|
31
|
+
[
|
|
32
|
+
"external_id"
|
|
33
|
+
]
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Option",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"key": {
|
|
6
|
+
"title": "Key",
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"value": {
|
|
10
|
+
"title": "Value Type",
|
|
11
|
+
"type": "string"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": [
|
|
15
|
+
"key",
|
|
16
|
+
"value"
|
|
17
|
+
],
|
|
18
|
+
"meta_class": "TypeMeta"
|
|
19
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "StorageMetadata",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"table_name": {
|
|
6
|
+
"title": "Table name",
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"db_fields": {
|
|
10
|
+
"title": "Database fields",
|
|
11
|
+
"type": "dictionary",
|
|
12
|
+
"items": {
|
|
13
|
+
"key": {"type": "string"},
|
|
14
|
+
"value": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"items": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"primary_key": {
|
|
23
|
+
"title": "Primary key fields",
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"indexed": {
|
|
30
|
+
"title": "Indexed",
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"items": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"unique": {
|
|
40
|
+
"title": "Unique Fields",
|
|
41
|
+
"type": "array",
|
|
42
|
+
"items": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "string"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"required": [],
|
|
51
|
+
"meta_class": "TypeMeta"
|
|
52
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Validator",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"name": {
|
|
6
|
+
"title": "Validator Name",
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"data": {
|
|
10
|
+
"title": "Validator Data",
|
|
11
|
+
"type": "anything"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": [
|
|
15
|
+
"name",
|
|
16
|
+
"data"
|
|
17
|
+
],
|
|
18
|
+
"meta_class": "TypeMeta"
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from abc import ABC
|
|
2
|
+
from abc import abstractmethod
|
|
3
|
+
from typing import TypeAlias
|
|
4
|
+
|
|
5
|
+
from amsdal_utils.schemas.schema import ObjectSchema
|
|
6
|
+
|
|
7
|
+
ModulePathType: TypeAlias = str
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BaseSchemaLoader(ABC):
|
|
11
|
+
@property
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def schemas_per_module(self) -> dict[ModulePathType, list[ObjectSchema]]: ...
|
|
14
|
+
|
|
15
|
+
@abstractmethod
|
|
16
|
+
def load(self) -> list[ObjectSchema]: ...
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class BaseDependsSchemaLoader(ABC):
|
|
20
|
+
@property
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def schemas_per_module(self) -> dict[ModulePathType, list[ObjectSchema]]: ...
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def load(self, type_schemas: list[ObjectSchema], *extra_schemas: list[ObjectSchema]) -> list[ObjectSchema]: ...
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from amsdal_utils.schemas.schema import ObjectSchema as ObjectSchema
|
|
4
|
+
from typing import TypeAlias
|
|
5
|
+
|
|
6
|
+
ModulePathType: TypeAlias = str
|
|
7
|
+
|
|
8
|
+
class BaseSchemaLoader(ABC, metaclass=abc.ABCMeta):
|
|
9
|
+
@property
|
|
10
|
+
@abstractmethod
|
|
11
|
+
def schemas_per_module(self) -> dict[ModulePathType, list[ObjectSchema]]: ...
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def load(self) -> list[ObjectSchema]: ...
|
|
14
|
+
|
|
15
|
+
class BaseDependsSchemaLoader(ABC, metaclass=abc.ABCMeta):
|
|
16
|
+
@property
|
|
17
|
+
@abstractmethod
|
|
18
|
+
def schemas_per_module(self) -> dict[ModulePathType, list[ObjectSchema]]: ...
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def load(self, type_schemas: list[ObjectSchema], *extra_schemas: list[ObjectSchema]) -> list[ObjectSchema]: ...
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|