amsdal 0.3.6__cp311-cp311-macosx_10_9_universal2.whl → 0.4.1__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.
Potentially problematic release.
This version of amsdal might be problematic. Click here for more details.
- amsdal/__about__.py +1 -1
- amsdal/__migrations__/0000_initial.py +34 -25
- amsdal/__migrations__/0001_datetime_type.py +4 -4
- amsdal/__migrations__/0002_fixture_order.py +7 -3
- amsdal/__migrations__/0003_schema_type_in_class_meta.py +3 -15
- 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/credentials.pyi +0 -1
- 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/cloud/services/auth/token.pyi +0 -1
- amsdal/configs/main.py +23 -19
- amsdal/configs/main.pyi +12 -15
- amsdal/contrib/__init__.cpython-311-darwin.so +0 -0
- amsdal/contrib/auth/fixtures/basic_permissions.json +64 -0
- amsdal/contrib/auth/lifecycle/consumer.py +10 -10
- amsdal/contrib/auth/migrations/0000_initial.py +41 -7
- amsdal/contrib/auth/models/login_session.py +66 -0
- amsdal/contrib/auth/models/login_session.pyi +33 -0
- amsdal/contrib/auth/models/permission.py +23 -0
- amsdal/contrib/auth/models/permission.pyi +18 -0
- amsdal/contrib/auth/models/user.py +106 -0
- amsdal/contrib/auth/models/user.pyi +46 -0
- amsdal/contrib/frontend_configs/conversion/convert.py +47 -15
- amsdal/contrib/frontend_configs/conversion/convert.pyi +0 -1
- amsdal/contrib/frontend_configs/lifecycle/consumer.py +32 -13
- amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +1 -1
- amsdal/contrib/frontend_configs/migrations/0000_initial.py +15 -14
- amsdal/contrib/frontend_configs/models/__init__.py +0 -0
- amsdal/contrib/frontend_configs/models/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +7 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +54 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +32 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +8 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +8 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +9 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +10 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +15 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.py +87 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +35 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +9 -0
- amsdal/errors.py +0 -3
- amsdal/errors.pyi +0 -1
- amsdal/fixtures/__init__.cpython-311-darwin.so +0 -0
- amsdal/fixtures/manager.cpython-311-darwin.so +0 -0
- amsdal/fixtures/manager.pyi +72 -123
- amsdal/fixtures/utils.cpython-311-darwin.so +0 -0
- amsdal/fixtures/utils.pyi +9 -0
- amsdal/manager.cpython-311-darwin.so +0 -0
- amsdal/manager.pyi +4 -96
- amsdal/mixins/__init__.cpython-311-darwin.so +0 -0
- amsdal/mixins/class_versions_mixin.cpython-311-darwin.so +0 -0
- amsdal/models/__init__.py +0 -0
- amsdal/models/__init__.pyi +0 -0
- amsdal/models/core/__init__.py +0 -0
- amsdal/models/core/__init__.pyi +0 -0
- amsdal/models/core/class_object.py +37 -0
- amsdal/models/core/class_object.pyi +24 -0
- amsdal/models/core/class_object_meta.py +26 -0
- amsdal/models/core/class_object_meta.pyi +15 -0
- amsdal/models/core/class_property.py +19 -0
- amsdal/models/core/class_property.pyi +10 -0
- amsdal/models/core/class_property_meta.py +15 -0
- amsdal/models/core/class_property_meta.pyi +10 -0
- amsdal/models/core/file.py +156 -0
- amsdal/models/core/file.pyi +104 -0
- amsdal/models/core/fixture.py +25 -0
- amsdal/models/core/fixture.pyi +14 -0
- amsdal/models/core/option.py +11 -0
- amsdal/models/core/option.pyi +8 -0
- amsdal/models/core/validator.py +12 -0
- amsdal/models/core/validator.pyi +8 -0
- amsdal/models/types/__init__.py +0 -0
- amsdal/models/types/__init__.pyi +0 -0
- amsdal/models/types/object.py +26 -0
- amsdal/models/types/object.pyi +16 -0
- amsdal/schemas/core/file/properties/validate_data.py +1 -1
- amsdal/schemas/interfaces.py +25 -0
- amsdal/schemas/interfaces.pyi +20 -0
- amsdal/schemas/manager.cpython-311-darwin.so +0 -0
- amsdal/schemas/manager.py +0 -116
- amsdal/schemas/manager.pyi +0 -65
- amsdal/schemas/mixins/__init__.py +0 -0
- amsdal/schemas/mixins/__init__.pyi +0 -0
- amsdal/schemas/mixins/check_dependencies_mixin.py +115 -0
- amsdal/schemas/mixins/check_dependencies_mixin.pyi +42 -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/utils.py +16 -0
- amsdal/schemas/utils.pyi +10 -0
- amsdal/services/__init__.cpython-311-darwin.so +0 -0
- amsdal/services/transaction_execution.cpython-311-darwin.so +0 -0
- amsdal/utils/rollback/__init__.py +99 -54
- amsdal/utils/tests/helpers.py +46 -37
- {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/METADATA +8 -8
- {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/RECORD +149 -140
- {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/WHEEL +1 -1
- amsdal/contrib/auth/models/login_session/hooks/pre_init.py +0 -68
- amsdal/contrib/auth/models/login_session/model.json +0 -23
- amsdal/contrib/auth/models/login_session/modifiers/display_name.py +0 -11
- amsdal/contrib/auth/models/permission/fixtures/basic_permissions.json +0 -62
- amsdal/contrib/auth/models/permission/model.json +0 -18
- amsdal/contrib/auth/models/permission/modifiers/display_name.py +0 -11
- amsdal/contrib/auth/models/user/hooks/post_init.py +0 -76
- amsdal/contrib/auth/models/user/hooks/pre_create.py +0 -8
- amsdal/contrib/auth/models/user/model.json +0 -25
- amsdal/contrib/auth/models/user/modifiers/display_name.py +0 -19
- amsdal/contrib/frontend_configs/models/frontend_activator_config/model.json +0 -11
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator/model.json +0 -11
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator/model.json +0 -52
- amsdal/contrib/frontend_configs/models/frontend_config_option/model.json +0 -15
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/model.json +0 -6
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/properties/model_dump.py +0 -13
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option/model.json +0 -19
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask/model.json +0 -26
- amsdal/contrib/frontend_configs/models/frontend_config_validator/model.json +0 -41
- amsdal/contrib/frontend_configs/models/frontend_control_config/model.json +0 -250
- amsdal/contrib/frontend_configs/models/frontend_model_config/fixtures/permissions.json +0 -24
- amsdal/contrib/frontend_configs/models/frontend_model_config/model.json +0 -17
- amsdal/contrib/frontend_configs/models/frontent_config_control_action/model.json +0 -54
- amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +0 -33
- amsdal/migration/__init__.cpython-311-darwin.so +0 -0
- amsdal/migration/base_migration_schemas.cpython-311-darwin.so +0 -0
- amsdal/migration/base_migration_schemas.pyi +0 -119
- amsdal/migration/data_classes.cpython-311-darwin.so +0 -0
- amsdal/migration/data_classes.pyi +0 -165
- amsdal/migration/executors/__init__.cpython-311-darwin.so +0 -0
- amsdal/migration/executors/base.cpython-311-darwin.so +0 -0
- amsdal/migration/executors/base.pyi +0 -117
- amsdal/migration/executors/default_executor.cpython-311-darwin.so +0 -0
- amsdal/migration/executors/default_executor.pyi +0 -184
- amsdal/migration/executors/state_executor.cpython-311-darwin.so +0 -0
- amsdal/migration/executors/state_executor.pyi +0 -151
- amsdal/migration/file_migration_executor.cpython-311-darwin.so +0 -0
- amsdal/migration/file_migration_executor.pyi +0 -122
- amsdal/migration/file_migration_generator.cpython-311-darwin.so +0 -0
- amsdal/migration/file_migration_generator.pyi +0 -229
- amsdal/migration/file_migration_store.cpython-311-darwin.so +0 -0
- amsdal/migration/file_migration_store.pyi +0 -114
- amsdal/migration/file_migration_writer.cpython-311-darwin.so +0 -0
- amsdal/migration/file_migration_writer.pyi +0 -73
- amsdal/migration/migrations.cpython-311-darwin.so +0 -0
- amsdal/migration/migrations.pyi +0 -166
- amsdal/migration/migrations_loader.cpython-311-darwin.so +0 -0
- amsdal/migration/migrations_loader.pyi +0 -32
- amsdal/migration/schemas_loaders.cpython-311-darwin.so +0 -0
- amsdal/migration/schemas_loaders.pyi +0 -37
- amsdal/migration/templates/data_migration.tmpl +0 -18
- amsdal/migration/templates/dict_validator.tmpl +0 -4
- amsdal/migration/templates/migration.tmpl +0 -6
- amsdal/migration/templates/model_class.tmpl +0 -8
- amsdal/migration/templates/model_class_layout.tmpl +0 -24
- amsdal/migration/templates/options_validator.tmpl +0 -4
- amsdal/migration/utils.cpython-311-darwin.so +0 -0
- amsdal/migration/utils.pyi +0 -58
- amsdal/mixins/build_mixin.cpython-311-darwin.so +0 -0
- amsdal/mixins/build_mixin.pyi +0 -78
- /amsdal/{migration/__init__.pyi → contrib/auth/models/__init__.py} +0 -0
- /amsdal/{migration/executors → contrib/auth/models}/__init__.pyi +0 -0
- {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/LICENSE.txt +0 -0
- {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/licenses/LICENSE.txt +0 -0
- {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from amsdal.contrib.frontend_configs.models.frontend_activator_config import *
|
|
2
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_async_validator import *
|
|
3
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_control_action import *
|
|
4
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_option import *
|
|
5
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import *
|
|
6
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_slider_option import *
|
|
7
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_text_mask import *
|
|
8
|
+
from amsdal.contrib.frontend_configs.models.frontend_config_validator import *
|
|
9
|
+
from amsdal_utils.models.enums import ModuleType
|
|
10
|
+
from typing import Any, ClassVar
|
|
11
|
+
|
|
12
|
+
class FrontendControlConfig(FrontendConfigSkipNoneBase):
|
|
13
|
+
__module_type__: ClassVar[ModuleType]
|
|
14
|
+
type: str
|
|
15
|
+
name: str
|
|
16
|
+
label: str | None
|
|
17
|
+
required: bool | None
|
|
18
|
+
hideLabel: bool | None
|
|
19
|
+
actions: list['FrontendConfigControlAction'] | None
|
|
20
|
+
validators: list['FrontendConfigValidator'] | None
|
|
21
|
+
asyncValidators: list['FrontendConfigAsyncValidator'] | None
|
|
22
|
+
activators: list['FrontendActivatorConfig'] | None
|
|
23
|
+
additionalText: str | None
|
|
24
|
+
value: Any | None
|
|
25
|
+
placeholder: str | None
|
|
26
|
+
options: list['FrontendConfigOption'] | None
|
|
27
|
+
mask: FrontendConfigTextMask | None
|
|
28
|
+
controls: list['FrontendControlConfig'] | None
|
|
29
|
+
showSearch: bool | None
|
|
30
|
+
sliderOptions: FrontendConfigSliderOption | None
|
|
31
|
+
customLabel: list[str] | None
|
|
32
|
+
control: FrontendControlConfig | None
|
|
33
|
+
entityType: str | None
|
|
34
|
+
@classmethod
|
|
35
|
+
def validate_value_in_options_type(cls, value: Any) -> Any: ...
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
from amsdal_models.classes.model import Model
|
|
5
|
+
from amsdal_utils.models.enums import ModuleType
|
|
6
|
+
from pydantic.fields import Field
|
|
7
|
+
|
|
8
|
+
from amsdal.contrib.frontend_configs.models.frontend_control_config import * # noqa: F403
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FrontendModelConfig(Model):
|
|
12
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
|
|
13
|
+
class_name: str = Field(title='Class Name')
|
|
14
|
+
control: Optional['FrontendControlConfig'] = Field(None, title='Control') # noqa: F405
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from amsdal.contrib.frontend_configs.models.frontend_control_config import *
|
|
2
|
+
from amsdal_models.classes.model import Model
|
|
3
|
+
from amsdal_utils.models.enums import ModuleType
|
|
4
|
+
from typing import ClassVar
|
|
5
|
+
|
|
6
|
+
class FrontendModelConfig(Model):
|
|
7
|
+
__module_type__: ClassVar[ModuleType] = ...
|
|
8
|
+
class_name: str = ...
|
|
9
|
+
control: FrontendControlConfig | None = ...
|
amsdal/errors.py
CHANGED
amsdal/errors.pyi
CHANGED
|
@@ -2,7 +2,6 @@ from amsdal_utils.errors import AmsdalError
|
|
|
2
2
|
|
|
3
3
|
class AmsdalRuntimeError(AmsdalError): ...
|
|
4
4
|
class TransactionNotFoundError(AmsdalError): ...
|
|
5
|
-
class MigrationsError(AmsdalError): ...
|
|
6
5
|
class AmsdalAuthenticationError(AmsdalRuntimeError): ...
|
|
7
6
|
class AmsdalDeployError(AmsdalRuntimeError): ...
|
|
8
7
|
class AmsdalCloudError(AmsdalRuntimeError): ...
|
|
Binary file
|
|
Binary file
|
amsdal/fixtures/manager.pyi
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
from _typeshed import Incomplete
|
|
2
|
-
from amsdal.
|
|
3
|
-
from amsdal_models.classes.manager import ClassManager
|
|
2
|
+
from amsdal.fixtures.utils import process_fixture_value as process_fixture_value
|
|
4
3
|
from amsdal_models.classes.model import Model
|
|
5
|
-
from
|
|
6
|
-
from amsdal_utils.models.data_models.core import DictSchema, TypeData as TypeData
|
|
7
|
-
from amsdal_utils.models.data_models.schema import PropertyData as PropertyData
|
|
4
|
+
from collections.abc import Generator
|
|
8
5
|
from pathlib import Path
|
|
9
6
|
from pydantic import BaseModel
|
|
7
|
+
from pydantic.fields import FieldInfo as FieldInfo
|
|
10
8
|
from typing import Any
|
|
11
9
|
|
|
12
10
|
logger: Incomplete
|
|
@@ -14,24 +12,16 @@ logger: Incomplete
|
|
|
14
12
|
class FixtureData(BaseModel):
|
|
15
13
|
class_name: str
|
|
16
14
|
external_id: str
|
|
15
|
+
order: float
|
|
17
16
|
data: dict[str, Any]
|
|
18
17
|
|
|
19
|
-
class
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
This class is responsible for loading, processing, and applying fixture data
|
|
24
|
-
to the database. It supports nested object construction, data processing,
|
|
25
|
-
and file fixture handling.
|
|
26
|
-
"""
|
|
27
|
-
fixtures_path: Incomplete
|
|
28
|
-
fixtures: dict[str | int, tuple[float | int, dict[str, Any]]]
|
|
29
|
-
_created_cache: dict[str | int, dict[str, Any] | Model]
|
|
30
|
-
data_to_process: list[FixtureData]
|
|
18
|
+
class BaseFixturesManager:
|
|
19
|
+
ORDER_MULTIPLIER: int
|
|
20
|
+
fixtures_paths: Incomplete
|
|
21
|
+
fixtures: dict[str | int, list[tuple[float, FixtureData]]]
|
|
31
22
|
_class_manager: Incomplete
|
|
32
23
|
_config_manager: Incomplete
|
|
33
|
-
|
|
34
|
-
def __init__(self, fixtures_path: Path, class_manager: ClassManager, config_manager: AmsdalConfigManager, schema_manager: SchemaManager) -> None: ...
|
|
24
|
+
def __init__(self, fixtures_paths: list[Path]) -> None: ...
|
|
35
25
|
def load_fixtures(self) -> None:
|
|
36
26
|
"""
|
|
37
27
|
Loads fixture data from the specified path.
|
|
@@ -43,41 +33,45 @@ class FixturesManager:
|
|
|
43
33
|
Returns:
|
|
44
34
|
None
|
|
45
35
|
"""
|
|
46
|
-
def
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
def _load_fixtures(self, fixtures_path: Path, order_shift: int = 0) -> None: ...
|
|
37
|
+
def iter_fixtures(self) -> Generator[FixtureData, None, None]: ...
|
|
38
|
+
def _process_object_data(self, data: dict[str, Any], model_fields: dict[str, FieldInfo], m2m_fields: dict[str, type[Model]]) -> dict[str, Any]: ...
|
|
49
39
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
the external ID as is.
|
|
40
|
+
class FixturesManager(BaseFixturesManager):
|
|
41
|
+
"""
|
|
42
|
+
Manager class for handling fixture data.
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
This class is responsible for loading, processing, and applying fixture data
|
|
45
|
+
to the database. It supports nested object construction, data processing,
|
|
46
|
+
and file fixture handling.
|
|
47
|
+
"""
|
|
48
|
+
def apply_file_fixtures(self) -> None:
|
|
49
|
+
"""
|
|
50
|
+
Applies file fixtures from the specified directory.
|
|
51
|
+
|
|
52
|
+
This method processes file fixtures located in the 'files' directory adjacent to the
|
|
53
|
+
`fixtures_path`. It iterates through each file, reads its content, and processes it
|
|
54
|
+
as a fixture. If the file fixture already exists in the database, it updates the
|
|
55
|
+
existing fixture; otherwise, it creates a new one.
|
|
57
56
|
|
|
58
57
|
Returns:
|
|
59
|
-
|
|
60
|
-
external ID if it is not a string or integer.
|
|
58
|
+
None
|
|
61
59
|
"""
|
|
62
|
-
def
|
|
63
|
-
def
|
|
64
|
-
def
|
|
60
|
+
def _apply_file_fixtures(self, file_dir: Path) -> None: ...
|
|
61
|
+
def _apply_file_fixtures_rec(self, nested_dir: Path, base_dir: Path) -> None: ...
|
|
62
|
+
def apply_fixtures(self) -> None:
|
|
65
63
|
"""
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
This method takes the class name, external ID, and data dictionary of a fixture object,
|
|
69
|
-
processes the data according to the class schema, and saves the object to the database.
|
|
70
|
-
If the object already exists, it updates the existing object with the new data.
|
|
64
|
+
Applies all loaded fixtures to the database.
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
data (dict[str, Any]): The data dictionary of the fixture object.
|
|
66
|
+
This method processes each fixture in the `fixtures` dictionary in the order
|
|
67
|
+
specified by their 'order' value. It calls the `process_fixture` method for
|
|
68
|
+
each fixture and then processes the data in the processing queue.
|
|
76
69
|
|
|
77
70
|
Returns:
|
|
78
71
|
None
|
|
79
72
|
"""
|
|
80
|
-
def
|
|
73
|
+
def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
|
|
74
|
+
def _process_fixture(self, fixture: FixtureData) -> FixtureData | None:
|
|
81
75
|
"""
|
|
82
76
|
Processes a single fixture and adds it to the processing queue.
|
|
83
77
|
|
|
@@ -92,94 +86,58 @@ class FixturesManager:
|
|
|
92
86
|
Returns:
|
|
93
87
|
None
|
|
94
88
|
"""
|
|
95
|
-
def
|
|
89
|
+
def _process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
|
|
96
90
|
"""
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
This method processes each fixture in the `fixtures` dictionary in the order
|
|
100
|
-
specified by their 'order' value. It calls the `process_fixture` method for
|
|
101
|
-
each fixture and then processes the data in the processing queue.
|
|
91
|
+
Processes and saves fixture object data to the database.
|
|
102
92
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def _process_data(self) -> None: ...
|
|
107
|
-
def apply_file_fixtures(self) -> None:
|
|
108
|
-
"""
|
|
109
|
-
Applies file fixtures from the specified directory.
|
|
93
|
+
This method takes the class name, external ID, and data dictionary of a fixture object,
|
|
94
|
+
processes the data according to the class schema, and saves the object to the database.
|
|
95
|
+
If the object already exists, it updates the existing object with the new data.
|
|
110
96
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
97
|
+
Args:
|
|
98
|
+
class_name (str): The name of the class to which the fixture object belongs.
|
|
99
|
+
external_id (str): The external ID of the fixture object.
|
|
100
|
+
data (dict[str, Any]): The data dictionary of the fixture object.
|
|
115
101
|
|
|
116
102
|
Returns:
|
|
117
103
|
None
|
|
118
104
|
"""
|
|
119
|
-
def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
|
|
120
105
|
|
|
121
|
-
class AsyncFixturesManager:
|
|
106
|
+
class AsyncFixturesManager(BaseFixturesManager):
|
|
122
107
|
"""
|
|
123
|
-
Manager class for handling fixture data.
|
|
108
|
+
Manager class for handling fixture data asynchronously.
|
|
124
109
|
|
|
125
110
|
This class is responsible for loading, processing, and applying fixture data
|
|
126
111
|
to the database. It supports nested object construction, data processing,
|
|
127
112
|
and file fixture handling.
|
|
128
113
|
"""
|
|
129
|
-
|
|
130
|
-
fixtures: dict[str | int, tuple[float | int, dict[str, Any]]]
|
|
131
|
-
_created_cache: dict[str | int, dict[str, Any] | Model]
|
|
132
|
-
data_to_process: list[FixtureData]
|
|
133
|
-
_class_manager: Incomplete
|
|
134
|
-
_config_manager: Incomplete
|
|
135
|
-
_schema_manager: Incomplete
|
|
136
|
-
def __init__(self, fixtures_path: Path, class_manager: ClassManager, config_manager: AmsdalConfigManager, schema_manager: SchemaManager) -> None: ...
|
|
137
|
-
def load_fixtures(self) -> None:
|
|
114
|
+
async def apply_file_fixtures(self) -> None:
|
|
138
115
|
"""
|
|
139
|
-
|
|
116
|
+
Applies file fixtures from the specified directory.
|
|
140
117
|
|
|
141
|
-
This method
|
|
142
|
-
It
|
|
143
|
-
|
|
118
|
+
This method processes file fixtures located in the 'files' directory adjacent to the
|
|
119
|
+
`fixtures_path`. It iterates through each file, reads its content, and processes it
|
|
120
|
+
as a fixture. If the file fixture already exists in the database, it updates the
|
|
121
|
+
existing fixture; otherwise, it creates a new one.
|
|
144
122
|
|
|
145
123
|
Returns:
|
|
146
124
|
None
|
|
147
125
|
"""
|
|
148
|
-
def
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
This method takes an external ID and constructs a nested object reference
|
|
153
|
-
dictionary. If the external ID is a dictionary containing an '_object_id' key,
|
|
154
|
-
it extracts the ID. If the external ID is not a string or integer, it returns
|
|
155
|
-
the external ID as is.
|
|
156
|
-
|
|
157
|
-
Args:
|
|
158
|
-
external_id (Any): The external ID to construct the nested object reference from.
|
|
159
|
-
|
|
160
|
-
Returns:
|
|
161
|
-
Any: A dictionary representing the nested object reference or the original
|
|
162
|
-
external ID if it is not a string or integer.
|
|
163
|
-
"""
|
|
164
|
-
def _process_object_data(self, model_properties: dict[str, PropertyData], data: dict[str, Any]) -> dict[str, Any]: ...
|
|
165
|
-
def _process_object_value(self, field_configuration: PropertyData | DictSchema | TypeData, value: Any) -> Any: ...
|
|
166
|
-
async def process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
|
|
126
|
+
async def _apply_file_fixtures(self, file_dir: Path) -> None: ...
|
|
127
|
+
async def _apply_file_fixtures_rec(self, nested_dir: Path, base_dir: Path) -> None: ...
|
|
128
|
+
async def apply_fixtures(self) -> None:
|
|
167
129
|
"""
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
This method takes the class name, external ID, and data dictionary of a fixture object,
|
|
171
|
-
processes the data according to the class schema, and saves the object to the database.
|
|
172
|
-
If the object already exists, it updates the existing object with the new data.
|
|
130
|
+
Applies all loaded fixtures to the database.
|
|
173
131
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
data (dict[str, Any]): The data dictionary of the fixture object.
|
|
132
|
+
This method processes each fixture in the `fixtures` dictionary in the order
|
|
133
|
+
specified by their 'order' value. It calls the `process_fixture` method for
|
|
134
|
+
each fixture and then processes the data in the processing queue.
|
|
178
135
|
|
|
179
136
|
Returns:
|
|
180
137
|
None
|
|
181
138
|
"""
|
|
182
|
-
async def
|
|
139
|
+
async def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
|
|
140
|
+
async def _process_fixture(self, fixture: FixtureData) -> FixtureData | None:
|
|
183
141
|
"""
|
|
184
142
|
Processes a single fixture and adds it to the processing queue.
|
|
185
143
|
|
|
@@ -194,28 +152,19 @@ class AsyncFixturesManager:
|
|
|
194
152
|
Returns:
|
|
195
153
|
None
|
|
196
154
|
"""
|
|
197
|
-
async def
|
|
155
|
+
async def _process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
|
|
198
156
|
"""
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
This method processes each fixture in the `fixtures` dictionary in the order
|
|
202
|
-
specified by their 'order' value. It calls the `process_fixture` method for
|
|
203
|
-
each fixture and then processes the data in the processing queue.
|
|
157
|
+
Processes and saves fixture object data to the database.
|
|
204
158
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
async def _process_data(self) -> None: ...
|
|
209
|
-
async def apply_file_fixtures(self) -> None:
|
|
210
|
-
"""
|
|
211
|
-
Applies file fixtures from the specified directory.
|
|
159
|
+
This method takes the class name, external ID, and data dictionary of a fixture object,
|
|
160
|
+
processes the data according to the class schema, and saves the object to the database.
|
|
161
|
+
If the object already exists, it updates the existing object with the new data.
|
|
212
162
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
163
|
+
Args:
|
|
164
|
+
class_name (str): The name of the class to which the fixture object belongs.
|
|
165
|
+
external_id (str): The external ID of the fixture object.
|
|
166
|
+
data (dict[str, Any]): The data dictionary of the fixture object.
|
|
217
167
|
|
|
218
168
|
Returns:
|
|
219
169
|
None
|
|
220
170
|
"""
|
|
221
|
-
async def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from amsdal_utils.models.data_models.reference import Reference
|
|
2
|
+
from types import GenericAlias
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
def process_fixture_value(annotation: Any, value: Any) -> Any: ...
|
|
6
|
+
def _cast_value_to_type(value_type: type | GenericAlias, value: Any) -> Any: ...
|
|
7
|
+
def _is_optional(annotation: Any) -> bool: ...
|
|
8
|
+
def _resolve_type_from_optional(annotation: Any) -> Any: ...
|
|
9
|
+
def _construct_reference_value(class_name: str, object_id: Any) -> Reference: ...
|
|
Binary file
|
amsdal/manager.pyi
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
from _typeshed import Incomplete
|
|
2
2
|
from amsdal.cloud.services.actions.manager import CloudActionsManager as CloudActionsManager
|
|
3
|
-
from amsdal.cloud.services.auth.manager import AuthManager as AuthManager
|
|
4
3
|
from amsdal.cloud.services.auth.signup_service import SignupService as SignupService
|
|
5
4
|
from amsdal.configs.main import settings as settings
|
|
6
5
|
from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError, AmsdalMissingCredentialsError as AmsdalMissingCredentialsError, AmsdalRuntimeError as AmsdalRuntimeError, AmsdalSignupError as AmsdalSignupError
|
|
7
6
|
from amsdal.fixtures.manager import AsyncFixturesManager as AsyncFixturesManager, FixturesManager as FixturesManager
|
|
8
|
-
from amsdal.mixins.build_mixin import BuildMixin as BuildMixin
|
|
9
7
|
from amsdal.mixins.class_versions_mixin import ClassVersionsMixin as ClassVersionsMixin
|
|
10
|
-
from
|
|
11
|
-
from amsdal_models.classes.manager import ClassManager
|
|
8
|
+
from amsdal_models.classes.class_manager import ClassManager
|
|
12
9
|
from amsdal_utils.config.data_models.amsdal_config import AmsdalConfig as AmsdalConfig
|
|
13
10
|
from amsdal_utils.utils.singleton import Singleton
|
|
14
|
-
from pathlib import Path
|
|
15
11
|
|
|
16
|
-
class AmsdalManager(
|
|
12
|
+
class AmsdalManager(ClassVersionsMixin, metaclass=Singleton):
|
|
17
13
|
"""
|
|
18
14
|
Manages the AMSDAL framework components and operations.
|
|
19
15
|
|
|
@@ -27,7 +23,6 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
27
23
|
_data_application: Incomplete
|
|
28
24
|
_is_setup: bool
|
|
29
25
|
__is_authenticated: bool
|
|
30
|
-
_schema_manager: Incomplete
|
|
31
26
|
_metadata_manager: Incomplete
|
|
32
27
|
_auth_manager: Incomplete
|
|
33
28
|
def __init__(self, *, raise_on_new_signup: bool = False) -> None:
|
|
@@ -54,7 +49,7 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
54
49
|
"""
|
|
55
50
|
Initiates models root path and adds it into sys.path.
|
|
56
51
|
|
|
57
|
-
This method initializes the class manager and sets up the models root path
|
|
52
|
+
This method initializes the class manager models modules and sets up the models root path
|
|
58
53
|
as specified in the settings. It ensures that the models root path is added
|
|
59
54
|
to the system path for proper module resolution.
|
|
60
55
|
|
|
@@ -78,49 +73,6 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
78
73
|
"""
|
|
79
74
|
Registers internal classes and prepares connections (creates internal tables).
|
|
80
75
|
"""
|
|
81
|
-
def build(self, source_models_path: Path, source_transactions_path: Path, source_static_files_path: Path, source_fixtures_path: Path, source_migrations_path: Path) -> None:
|
|
82
|
-
"""
|
|
83
|
-
Builds the necessary components for the Amsdal framework.
|
|
84
|
-
|
|
85
|
-
This method is used to build the necessary components for the Amsdal framework.
|
|
86
|
-
It takes five parameters which are all of type `Path`.
|
|
87
|
-
These parameters represent the paths to the directories where the corresponding components are located.
|
|
88
|
-
|
|
89
|
-
Args:
|
|
90
|
-
source_models_path (Path): Path to the directory where the source models are located.
|
|
91
|
-
source_transactions_path (Path): Path to the directory where the source transactions are located.
|
|
92
|
-
source_static_files_path (Path): Path to the directory where the source static files are located.
|
|
93
|
-
source_fixtures_path (Path): Path to the directory where the source fixtures are located.
|
|
94
|
-
source_migrations_path (Path): Path to the directory where the source migrations are located.
|
|
95
|
-
|
|
96
|
-
Returns:
|
|
97
|
-
None
|
|
98
|
-
|
|
99
|
-
The method performs the following build steps in order:
|
|
100
|
-
- Builds the models from the `source_models_path` by calling the `build_models` method.
|
|
101
|
-
- Builds the transactions from the `source_transactions_path` by calling the `build_transactions` method.
|
|
102
|
-
- Builds the static files from the `source_static_files_path` by calling the `build_static_files` method.
|
|
103
|
-
- Builds the fixtures from the `source_fixtures_path` by calling the `build_fixtures` method.
|
|
104
|
-
|
|
105
|
-
Note:
|
|
106
|
-
This method is part of the `AmsdalManager` class which includes mixins for `BuildMixin`
|
|
107
|
-
and `ClassVersionsMixin`. It is intended to be used in the Amsdal framework for managing
|
|
108
|
-
and building components.
|
|
109
|
-
"""
|
|
110
|
-
def migrate(self) -> None:
|
|
111
|
-
"""
|
|
112
|
-
DEPRECATED: Check changes in the models and apply them to the database.
|
|
113
|
-
|
|
114
|
-
This method is deprecated and should not be used. It checks for changes in the models
|
|
115
|
-
and applies them to the database. Use `amsdal.migration.file_migration_generator.FileMigrationGenerator`
|
|
116
|
-
instead.
|
|
117
|
-
|
|
118
|
-
Raises:
|
|
119
|
-
DeprecationWarning: Always raised to indicate that this method is deprecated.
|
|
120
|
-
|
|
121
|
-
Returns:
|
|
122
|
-
None
|
|
123
|
-
"""
|
|
124
76
|
def _check_auth(self) -> None: ...
|
|
125
77
|
@property
|
|
126
78
|
def cloud_actions_manager(self) -> CloudActionsManager:
|
|
@@ -182,7 +134,7 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
182
134
|
None
|
|
183
135
|
"""
|
|
184
136
|
|
|
185
|
-
class AsyncAmsdalManager(
|
|
137
|
+
class AsyncAmsdalManager(ClassVersionsMixin, metaclass=Singleton):
|
|
186
138
|
"""
|
|
187
139
|
Manages the AMSDAL framework components and operations.
|
|
188
140
|
|
|
@@ -196,7 +148,6 @@ class AsyncAmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
196
148
|
_data_application: Incomplete
|
|
197
149
|
_is_setup: bool
|
|
198
150
|
__is_authenticated: bool
|
|
199
|
-
_schema_manager: Incomplete
|
|
200
151
|
_metadata_manager: Incomplete
|
|
201
152
|
_auth_manager: Incomplete
|
|
202
153
|
def __init__(self, *, raise_on_new_signup: bool = False) -> None:
|
|
@@ -247,49 +198,6 @@ class AsyncAmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
247
198
|
"""
|
|
248
199
|
Registers internal classes and prepares connections (creates internal tables).
|
|
249
200
|
"""
|
|
250
|
-
def build(self, source_models_path: Path, source_transactions_path: Path, source_static_files_path: Path, source_fixtures_path: Path, source_migrations_path: Path) -> None:
|
|
251
|
-
"""
|
|
252
|
-
Builds the necessary components for the Amsdal framework.
|
|
253
|
-
|
|
254
|
-
This method is used to build the necessary components for the Amsdal framework.
|
|
255
|
-
It takes five parameters which are all of type `Path`.
|
|
256
|
-
These parameters represent the paths to the directories where the corresponding components are located.
|
|
257
|
-
|
|
258
|
-
Args:
|
|
259
|
-
source_models_path (Path): Path to the directory where the source models are located.
|
|
260
|
-
source_transactions_path (Path): Path to the directory where the source transactions are located.
|
|
261
|
-
source_static_files_path (Path): Path to the directory where the source static files are located.
|
|
262
|
-
source_fixtures_path (Path): Path to the directory where the source fixtures are located.
|
|
263
|
-
source_migrations_path (Path): Path to the directory where the source migrations are located.
|
|
264
|
-
|
|
265
|
-
Returns:
|
|
266
|
-
None
|
|
267
|
-
|
|
268
|
-
The method performs the following build steps in order:
|
|
269
|
-
- Builds the models from the `source_models_path` by calling the `build_models` method.
|
|
270
|
-
- Builds the transactions from the `source_transactions_path` by calling the `build_transactions` method.
|
|
271
|
-
- Builds the static files from the `source_static_files_path` by calling the `build_static_files` method.
|
|
272
|
-
- Builds the fixtures from the `source_fixtures_path` by calling the `build_fixtures` method.
|
|
273
|
-
|
|
274
|
-
Note:
|
|
275
|
-
This method is part of the `AmsdalManager` class which includes mixins for `BuildMixin`
|
|
276
|
-
and `ClassVersionsMixin`. It is intended to be used in the Amsdal framework for managing
|
|
277
|
-
and building components.
|
|
278
|
-
"""
|
|
279
|
-
def migrate(self) -> None:
|
|
280
|
-
"""
|
|
281
|
-
DEPRECATED: Check changes in the models and apply them to the database.
|
|
282
|
-
|
|
283
|
-
This method is deprecated and should not be used. It checks for changes in the models
|
|
284
|
-
and applies them to the database. Use `amsdal.migration.file_migration_generator.FileMigrationGenerator`
|
|
285
|
-
instead.
|
|
286
|
-
|
|
287
|
-
Raises:
|
|
288
|
-
DeprecationWarning: Always raised to indicate that this method is deprecated.
|
|
289
|
-
|
|
290
|
-
Returns:
|
|
291
|
-
None
|
|
292
|
-
"""
|
|
293
201
|
def _check_auth(self) -> None: ...
|
|
294
202
|
@property
|
|
295
203
|
def cloud_actions_manager(self) -> CloudActionsManager:
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
from amsdal.models.core.class_property import * # noqa: F403
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ClassObject(Model):
|
|
15
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CORE
|
|
16
|
+
properties: Optional[dict[str, Optional['ClassProperty']]] = Field(None, title='Properties') # noqa: F405, UP007
|
|
17
|
+
table_name: Optional[str] = Field(None, title='Table name') # noqa: UP007
|
|
18
|
+
primary_key: Optional[dict[str, list[str]]] = Field(None, title='Primary key fields') # noqa: UP007
|
|
19
|
+
indexed: Optional[list[str]] = Field(None, title='Indexed') # noqa: UP007
|
|
20
|
+
unique: Optional[list[list[str]]] = Field(None, title='Unique Fields') # noqa: UP007
|
|
21
|
+
required: Optional[list[str]] = Field(None, title='Required') # noqa: UP007
|
|
22
|
+
meta_class: Optional[str] = Field('ClassObject', title='Meta Class') # noqa: UP007
|
|
23
|
+
|
|
24
|
+
@field_validator('properties')
|
|
25
|
+
@classmethod
|
|
26
|
+
def _non_empty_keys_properties(cls: type, value: Any) -> Any:
|
|
27
|
+
return validate_non_empty_keys(value)
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def display_name(self) -> str:
|
|
31
|
+
"""
|
|
32
|
+
Returns the display name of the object.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
str: The display name, which is the title of the object.
|
|
36
|
+
"""
|
|
37
|
+
return self.title
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from amsdal.models.core.class_property import *
|
|
2
|
+
from amsdal_models.classes.model import Model
|
|
3
|
+
from amsdal_utils.models.enums import ModuleType
|
|
4
|
+
from typing import Any, ClassVar
|
|
5
|
+
|
|
6
|
+
class ClassObject(Model):
|
|
7
|
+
__module_type__: ClassVar[ModuleType] = ...
|
|
8
|
+
properties: dict[str, ClassProperty | None] | None = ...
|
|
9
|
+
table_name: str | None = ...
|
|
10
|
+
primary_key: dict[str, list[str]] | None = ...
|
|
11
|
+
indexed: list[str] | None = ...
|
|
12
|
+
unique: list[list[str]] | None = ...
|
|
13
|
+
required: list[str] | None = ...
|
|
14
|
+
meta_class: str | None = ...
|
|
15
|
+
@classmethod
|
|
16
|
+
def _non_empty_keys_properties(cls, value: Any) -> Any: ...
|
|
17
|
+
@property
|
|
18
|
+
def display_name(self) -> str:
|
|
19
|
+
"""
|
|
20
|
+
Returns the display name of the object.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
str: The display name, which is the title of the object.
|
|
24
|
+
"""
|
|
@@ -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
|
+
from amsdal.models.core.class_property_meta import * # noqa: F403
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ClassObjectMeta(Model):
|
|
15
|
+
__module_type__: ClassVar[ModuleType] = ModuleType.CORE
|
|
16
|
+
title: str = Field(title='Title')
|
|
17
|
+
type: str = Field(title='Type')
|
|
18
|
+
default: Any | None = Field(None, title='Default')
|
|
19
|
+
class_schema_type: str | None = Field(None, title='Schema Type')
|
|
20
|
+
properties: dict[str, Optional['ClassPropertyMeta']] | None = Field(None, title='Properties') # noqa: F405
|
|
21
|
+
custom_code: str | None = Field(None, title='Custom Code')
|
|
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)
|