amsdal 0.2.5__cp312-cp312-manylinux_2_17_x86_64.manylinux2014_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.
Potentially problematic release.
This version of amsdal might be problematic. Click here for more details.
- amsdal/Third-Party Materials - AMSDAL Dependencies - License Notices.md +1308 -0
- amsdal/__about__.py +4 -0
- amsdal/__about__.pyi +1 -0
- amsdal/__init__.py +3 -0
- amsdal/__init__.pyi +0 -0
- amsdal/__migrations__/0000_initial.py +203 -0
- amsdal/__migrations__/0001_datetime_type.py +18 -0
- amsdal/__migrations__/0002_fixture_order.py +40 -0
- amsdal/cloud/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/__init__.pyi +0 -0
- amsdal/cloud/client.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/client.pyi +57 -0
- amsdal/cloud/constants.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/constants.pyi +13 -0
- amsdal/cloud/enums.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/enums.pyi +68 -0
- amsdal/cloud/models/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/__init__.pyi +0 -0
- amsdal/cloud/models/base.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/base.pyi +247 -0
- amsdal/cloud/services/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/__init__.pyi +0 -0
- amsdal/cloud/services/actions/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/__init__.pyi +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.cpython-312-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-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_basic_auth.pyi +21 -0
- amsdal/cloud/services/actions/add_dependency.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_dependency.pyi +19 -0
- amsdal/cloud/services/actions/add_secret.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_secret.pyi +20 -0
- amsdal/cloud/services/actions/base.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/base.pyi +122 -0
- amsdal/cloud/services/actions/create_deploy.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_deploy.pyi +41 -0
- amsdal/cloud/services/actions/create_env.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_env.pyi +19 -0
- amsdal/cloud/services/actions/create_session.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_session.pyi +17 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.cpython-312-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-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_basic_auth.pyi +20 -0
- amsdal/cloud/services/actions/delete_dependency.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_dependency.pyi +21 -0
- amsdal/cloud/services/actions/delete_env.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_env.pyi +21 -0
- amsdal/cloud/services/actions/delete_secret.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_secret.pyi +21 -0
- amsdal/cloud/services/actions/destroy_deploy.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/destroy_deploy.pyi +18 -0
- amsdal/cloud/services/actions/expose_db.cpython-312-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-312-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-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/get_monitoring_info.pyi +21 -0
- amsdal/cloud/services/actions/list_dependencies.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_dependencies.pyi +21 -0
- amsdal/cloud/services/actions/list_deploys.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_deploys.pyi +19 -0
- amsdal/cloud/services/actions/list_envs.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_envs.pyi +20 -0
- amsdal/cloud/services/actions/list_secrets.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_secrets.pyi +22 -0
- amsdal/cloud/services/actions/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/manager.pyi +278 -0
- amsdal/cloud/services/actions/signup_action.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/signup_action.pyi +20 -0
- amsdal/cloud/services/actions/update_deploy.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/update_deploy.pyi +19 -0
- amsdal/cloud/services/auth/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/__init__.pyi +0 -0
- amsdal/cloud/services/auth/base.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/base.pyi +6 -0
- amsdal/cloud/services/auth/credentials.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/credentials.pyi +31 -0
- amsdal/cloud/services/auth/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/manager.pyi +26 -0
- amsdal/cloud/services/auth/signup_service.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/signup_service.pyi +32 -0
- amsdal/cloud/services/auth/token.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/token.pyi +28 -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 +254 -0
- amsdal/configs/main.pyi +177 -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-312-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 +20 -0
- amsdal/contrib/auth/decorators/__init__.pyi +6 -0
- amsdal/contrib/auth/errors.py +7 -0
- amsdal/contrib/auth/errors.pyi +4 -0
- amsdal/contrib/auth/lifecycle/__init__.py +0 -0
- amsdal/contrib/auth/lifecycle/__init__.pyi +0 -0
- amsdal/contrib/auth/lifecycle/consumer.py +222 -0
- amsdal/contrib/auth/lifecycle/consumer.pyi +69 -0
- amsdal/contrib/auth/migrations/0000_initial.py +49 -0
- amsdal/contrib/auth/models/login_session/hooks/pre_init.py +64 -0
- amsdal/contrib/auth/models/login_session/model.json +23 -0
- amsdal/contrib/auth/models/login_session/modifiers/display_name.py +11 -0
- amsdal/contrib/auth/models/permission/fixtures/basic_permissions.json +62 -0
- amsdal/contrib/auth/models/permission/model.json +18 -0
- amsdal/contrib/auth/models/permission/modifiers/display_name.py +11 -0
- amsdal/contrib/auth/models/user/hooks/post_init.py +58 -0
- amsdal/contrib/auth/models/user/hooks/pre_create.py +8 -0
- amsdal/contrib/auth/models/user/model.json +25 -0
- amsdal/contrib/auth/models/user/modifiers/display_name.py +19 -0
- amsdal/contrib/auth/settings.py +36 -0
- amsdal/contrib/auth/settings.pyi +26 -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 +250 -0
- amsdal/contrib/frontend_configs/conversion/convert.pyi +23 -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 +242 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +86 -0
- amsdal/contrib/frontend_configs/migrations/0000_initial.py +255 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config/model.json +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator/model.json +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator/model.json +52 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option/model.json +15 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/model.json +6 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/properties/model_dump.py +13 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option/model.json +19 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask/model.json +26 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator/model.json +41 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config/model.json +250 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config/fixtures/permissions.json +24 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config/model.json +17 -0
- amsdal/contrib/frontend_configs/models/frontent_config_control_action/model.json +54 -0
- amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +33 -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-312-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/__init__.pyi +0 -0
- amsdal/fixtures/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/manager.pyi +118 -0
- amsdal/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/manager.pyi +183 -0
- amsdal/migration/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/__init__.pyi +0 -0
- amsdal/migration/base_migration_schemas.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/base_migration_schemas.pyi +120 -0
- amsdal/migration/data_classes.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/data_classes.pyi +178 -0
- amsdal/migration/executors/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/executors/__init__.pyi +0 -0
- amsdal/migration/executors/base.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/executors/base.pyi +106 -0
- amsdal/migration/executors/default_executor.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/executors/default_executor.pyi +96 -0
- amsdal/migration/executors/state_executor.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/executors/state_executor.pyi +78 -0
- amsdal/migration/file_migration_executor.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/file_migration_executor.pyi +68 -0
- amsdal/migration/file_migration_generator.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/file_migration_generator.pyi +139 -0
- amsdal/migration/file_migration_store.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/file_migration_store.pyi +61 -0
- amsdal/migration/file_migration_writer.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/file_migration_writer.pyi +73 -0
- amsdal/migration/migrations.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/migrations.pyi +166 -0
- amsdal/migration/migrations_loader.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/migrations_loader.pyi +32 -0
- amsdal/migration/schemas_loaders.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/schemas_loaders.pyi +37 -0
- amsdal/migration/templates/data_migration.tmpl +18 -0
- amsdal/migration/templates/dict_validator.tmpl +4 -0
- amsdal/migration/templates/migration.tmpl +6 -0
- amsdal/migration/templates/model_class.tmpl +8 -0
- amsdal/migration/templates/model_class_layout.tmpl +24 -0
- amsdal/migration/templates/options_validator.tmpl +4 -0
- amsdal/migration/utils.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/migration/utils.pyi +58 -0
- amsdal/mixins/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/__init__.pyi +0 -0
- amsdal/mixins/build_mixin.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/build_mixin.pyi +78 -0
- amsdal/mixins/class_versions_mixin.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/class_versions_mixin.pyi +6 -0
- amsdal/py.typed +0 -0
- amsdal/schemas/__init__.py +0 -0
- amsdal/schemas/__init__.pyi +0 -0
- amsdal/schemas/core/class_object/model.json +31 -0
- amsdal/schemas/core/class_object/properties/display_name.py +9 -0
- amsdal/schemas/core/class_object_meta/model.json +55 -0
- amsdal/schemas/core/class_property/model.json +22 -0
- amsdal/schemas/core/class_property_meta/model.json +23 -0
- amsdal/schemas/core/file/hooks/pre_create.py +11 -0
- amsdal/schemas/core/file/hooks/pre_update.py +11 -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 +32 -0
- amsdal/schemas/core/fixture/model.json +35 -0
- amsdal/schemas/core/option/model.json +19 -0
- amsdal/schemas/core/validator/model.json +19 -0
- amsdal/schemas/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/schemas/manager.py +116 -0
- amsdal/schemas/manager.pyi +65 -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/services/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/services/__init__.pyi +0 -0
- amsdal/services/transaction_execution.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/services/transaction_execution.pyi +76 -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/tests/__init__.py +0 -0
- amsdal/utils/tests/enums.py +18 -0
- amsdal/utils/tests/factories.py +49 -0
- amsdal/utils/tests/helpers.py +309 -0
- amsdal-0.2.5.dist-info/LICENSE.txt +107 -0
- amsdal-0.2.5.dist-info/METADATA +365 -0
- amsdal-0.2.5.dist-info/RECORD +253 -0
- amsdal-0.2.5.dist-info/WHEEL +6 -0
- amsdal-0.2.5.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from amsdal.schemas.manager import SchemaManager as SchemaManager
|
|
3
|
+
from amsdal_models.classes.manager import ClassManager
|
|
4
|
+
from amsdal_utils.config.manager import AmsdalConfigManager as AmsdalConfigManager
|
|
5
|
+
from amsdal_utils.models.data_models.core import DictSchema, TypeData as TypeData
|
|
6
|
+
from amsdal_utils.models.data_models.schema import PropertyData as PropertyData
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from pydantic import BaseModel
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
logger: Incomplete
|
|
12
|
+
|
|
13
|
+
class FixtureData(BaseModel):
|
|
14
|
+
class_name: str
|
|
15
|
+
external_id: str
|
|
16
|
+
data: dict[str, Any]
|
|
17
|
+
|
|
18
|
+
class FixturesManager:
|
|
19
|
+
"""
|
|
20
|
+
Manager class for handling fixture data.
|
|
21
|
+
|
|
22
|
+
This class is responsible for loading, processing, and applying fixture data
|
|
23
|
+
to the database. It supports nested object construction, data processing,
|
|
24
|
+
and file fixture handling.
|
|
25
|
+
"""
|
|
26
|
+
fixtures_path: Incomplete
|
|
27
|
+
fixtures: Incomplete
|
|
28
|
+
_created_cache: Incomplete
|
|
29
|
+
data_to_process: Incomplete
|
|
30
|
+
_class_manager: Incomplete
|
|
31
|
+
_config_manager: Incomplete
|
|
32
|
+
_schema_manager: Incomplete
|
|
33
|
+
def __init__(self, fixtures_path: Path, class_manager: ClassManager, config_manager: AmsdalConfigManager, schema_manager: SchemaManager) -> None: ...
|
|
34
|
+
def load_fixtures(self) -> None:
|
|
35
|
+
"""
|
|
36
|
+
Loads fixture data from the specified path.
|
|
37
|
+
|
|
38
|
+
This method reads fixture data from a JSON file located at the `fixtures_path`.
|
|
39
|
+
It populates the `fixtures` dictionary with the loaded data, where each fixture
|
|
40
|
+
is indexed by its external ID.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
None
|
|
44
|
+
"""
|
|
45
|
+
def construct_nested_object(self, external_id: Any) -> Any:
|
|
46
|
+
"""
|
|
47
|
+
Constructs a nested object reference from the given external ID.
|
|
48
|
+
|
|
49
|
+
This method takes an external ID and constructs a nested object reference
|
|
50
|
+
dictionary. If the external ID is a dictionary containing an '_object_id' key,
|
|
51
|
+
it extracts the ID. If the external ID is not a string or integer, it returns
|
|
52
|
+
the external ID as is.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
external_id (Any): The external ID to construct the nested object reference from.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
Any: A dictionary representing the nested object reference or the original
|
|
59
|
+
external ID if it is not a string or integer.
|
|
60
|
+
"""
|
|
61
|
+
def _process_object_data(self, model_properties: dict[str, PropertyData], data: dict[str, Any]) -> dict[str, Any]: ...
|
|
62
|
+
def _process_object_value(self, field_configuration: PropertyData | DictSchema | TypeData, value: Any) -> Any: ...
|
|
63
|
+
def process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
|
|
64
|
+
"""
|
|
65
|
+
Processes and saves fixture object data to the database.
|
|
66
|
+
|
|
67
|
+
This method takes the class name, external ID, and data dictionary of a fixture object,
|
|
68
|
+
processes the data according to the class schema, and saves the object to the database.
|
|
69
|
+
If the object already exists, it updates the existing object with the new data.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
class_name (str): The name of the class to which the fixture object belongs.
|
|
73
|
+
external_id (str): The external ID of the fixture object.
|
|
74
|
+
data (dict[str, Any]): The data dictionary of the fixture object.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
None
|
|
78
|
+
"""
|
|
79
|
+
def process_fixture(self, fixture: dict[str, Any]) -> None:
|
|
80
|
+
"""
|
|
81
|
+
Processes a single fixture and adds it to the processing queue.
|
|
82
|
+
|
|
83
|
+
This method takes a fixture dictionary, checks if the fixture already exists in the database,
|
|
84
|
+
and either updates the existing fixture or creates a new one. It then adds the fixture data
|
|
85
|
+
to the processing queue for further processing.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
fixture (dict[str, Any]): The fixture dictionary containing the external ID, class name,
|
|
89
|
+
and data of the fixture.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
None
|
|
93
|
+
"""
|
|
94
|
+
def apply_fixtures(self) -> None:
|
|
95
|
+
"""
|
|
96
|
+
Applies all loaded fixtures to the database.
|
|
97
|
+
|
|
98
|
+
This method processes each fixture in the `fixtures` dictionary in the order
|
|
99
|
+
specified by their 'order' value. It calls the `process_fixture` method for
|
|
100
|
+
each fixture and then processes the data in the processing queue.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
None
|
|
104
|
+
"""
|
|
105
|
+
def _process_data(self) -> None: ...
|
|
106
|
+
def apply_file_fixtures(self) -> None:
|
|
107
|
+
"""
|
|
108
|
+
Applies file fixtures from the specified directory.
|
|
109
|
+
|
|
110
|
+
This method processes file fixtures located in the 'files' directory adjacent to the
|
|
111
|
+
`fixtures_path`. It iterates through each file, reads its content, and processes it
|
|
112
|
+
as a fixture. If the file fixture already exists in the database, it updates the
|
|
113
|
+
existing fixture; otherwise, it creates a new one.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
None
|
|
117
|
+
"""
|
|
118
|
+
def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
|
|
Binary file
|
amsdal/manager.pyi
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from amsdal.cloud.services.actions.manager import CloudActionsManager as CloudActionsManager
|
|
3
|
+
from amsdal.cloud.services.auth.manager import AuthManager as AuthManager
|
|
4
|
+
from amsdal.cloud.services.auth.signup_service import SignupService as SignupService
|
|
5
|
+
from amsdal.configs.main import settings as settings
|
|
6
|
+
from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError, AmsdalMissingCredentialsError as AmsdalMissingCredentialsError, AmsdalRuntimeError as AmsdalRuntimeError, AmsdalSignupError as AmsdalSignupError
|
|
7
|
+
from amsdal.fixtures.manager import FixturesManager as FixturesManager
|
|
8
|
+
from amsdal.mixins.build_mixin import BuildMixin as BuildMixin
|
|
9
|
+
from amsdal.mixins.class_versions_mixin import ClassVersionsMixin as ClassVersionsMixin
|
|
10
|
+
from amsdal.schemas.manager import SchemaManager as SchemaManager
|
|
11
|
+
from amsdal_models.classes.manager import ClassManager
|
|
12
|
+
from amsdal_utils.config.data_models.amsdal_config import AmsdalConfig as AmsdalConfig
|
|
13
|
+
from amsdal_utils.utils.singleton import Singleton
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
17
|
+
"""
|
|
18
|
+
Manages the AMSDAL framework components and operations.
|
|
19
|
+
|
|
20
|
+
This class is responsible for initializing, setting up, and managing various components
|
|
21
|
+
of the AMSDAL framework, including connections, data management, schema management,
|
|
22
|
+
and authentication. It also provides methods for building and tearing down the framework.
|
|
23
|
+
"""
|
|
24
|
+
_class_manager: ClassManager
|
|
25
|
+
_config_manager: Incomplete
|
|
26
|
+
_config: Incomplete
|
|
27
|
+
_data_application: Incomplete
|
|
28
|
+
_is_setup: bool
|
|
29
|
+
__is_authenticated: bool
|
|
30
|
+
_schema_manager: Incomplete
|
|
31
|
+
_metadata_manager: Incomplete
|
|
32
|
+
_auth_manager: Incomplete
|
|
33
|
+
def __init__(self, *, raise_on_new_signup: bool = False) -> None:
|
|
34
|
+
"""
|
|
35
|
+
Initializes all sub managers. Reads the configuration.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
None
|
|
39
|
+
"""
|
|
40
|
+
@property
|
|
41
|
+
def is_setup(self) -> bool: ...
|
|
42
|
+
@property
|
|
43
|
+
def is_authenticated(self) -> bool:
|
|
44
|
+
"""
|
|
45
|
+
Indicates if the AMSDAL license authentication process has been passed.
|
|
46
|
+
|
|
47
|
+
This property returns a boolean value indicating whether the AMSDAL license
|
|
48
|
+
authentication process has been successfully completed.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
bool: True if authenticated, False otherwise.
|
|
52
|
+
"""
|
|
53
|
+
def pre_setup(self) -> None:
|
|
54
|
+
"""
|
|
55
|
+
Initiates models root path and adds it into sys.path.
|
|
56
|
+
|
|
57
|
+
This method initializes the class manager and sets up the models root path
|
|
58
|
+
as specified in the settings. It ensures that the models root path is added
|
|
59
|
+
to the system path for proper module resolution.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
None
|
|
63
|
+
"""
|
|
64
|
+
def setup(self) -> None:
|
|
65
|
+
"""
|
|
66
|
+
Initiates models root path and the connections.
|
|
67
|
+
|
|
68
|
+
This method sets up the AMSDAL framework by initializing the models root path and
|
|
69
|
+
establishing connections. It ensures that the setup process is only performed once.
|
|
70
|
+
|
|
71
|
+
Raises:
|
|
72
|
+
AmsdalRuntimeError: If the AMSDAL manager is already set up.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
None
|
|
76
|
+
"""
|
|
77
|
+
def post_setup(self) -> None:
|
|
78
|
+
"""
|
|
79
|
+
Registers internal classes and prepares connections (creates internal tables).
|
|
80
|
+
"""
|
|
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
|
+
def _check_auth(self) -> None: ...
|
|
125
|
+
@property
|
|
126
|
+
def cloud_actions_manager(self) -> CloudActionsManager:
|
|
127
|
+
"""
|
|
128
|
+
Provides access to the CloudActionsManager.
|
|
129
|
+
|
|
130
|
+
This property checks if the AMSDAL manager is authenticated and then returns
|
|
131
|
+
an instance of the CloudActionsManager.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
CloudActionsManager: An instance of the CloudActionsManager.
|
|
135
|
+
|
|
136
|
+
Raises:
|
|
137
|
+
AmsdalAuthenticationError: If the AMSDAL manager is not authenticated.
|
|
138
|
+
"""
|
|
139
|
+
def authenticate(self) -> None:
|
|
140
|
+
"""
|
|
141
|
+
Run AMSDAL license authentication process.
|
|
142
|
+
|
|
143
|
+
This method runs the AMSDAL license authentication process and sets the
|
|
144
|
+
authentication status accordingly.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
None
|
|
148
|
+
"""
|
|
149
|
+
def apply_fixtures(self) -> None:
|
|
150
|
+
"""
|
|
151
|
+
Loads and applies fixtures defined in your application.
|
|
152
|
+
|
|
153
|
+
This method loads the fixtures from the specified path and applies them to the
|
|
154
|
+
AMSDAL framework. It uses the `FixturesManager` to manage the loading and application
|
|
155
|
+
of the fixtures.
|
|
156
|
+
|
|
157
|
+
Returns:
|
|
158
|
+
None
|
|
159
|
+
"""
|
|
160
|
+
def init_classes(self) -> None:
|
|
161
|
+
"""
|
|
162
|
+
Initializes and imports classes based on the schema manager's class schemas.
|
|
163
|
+
|
|
164
|
+
This method iterates over the class schemas provided by the schema manager and imports
|
|
165
|
+
the classes into the class manager, excluding those of type `SchemaTypes.TYPE`.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
None
|
|
169
|
+
"""
|
|
170
|
+
def teardown(self) -> None:
|
|
171
|
+
"""
|
|
172
|
+
Clean up everything on the application exit.
|
|
173
|
+
|
|
174
|
+
This method performs a cleanup of all components managed by the AMSDAL framework
|
|
175
|
+
when the application exits. It disconnects and invalidates connections, clears caches,
|
|
176
|
+
and resets the setup status.
|
|
177
|
+
|
|
178
|
+
Raises:
|
|
179
|
+
AmsdalRuntimeError: If the AMSDAL manager is not set up.
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
None
|
|
183
|
+
"""
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
from _typeshed import Incomplete
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from amsdal.configs.constants import BASE_DIR as BASE_DIR
|
|
5
|
+
from amsdal_models.classes.model import Model
|
|
6
|
+
from amsdal_utils.models.data_models.core import DictSchema, LegacyDictSchema, TypeData as TypeData
|
|
7
|
+
from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema, PropertyData as PropertyData
|
|
8
|
+
from amsdal_utils.models.enums import SchemaTypes as SchemaTypes, Versions
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
class BaseMigrationSchemas(ABC, metaclass=abc.ABCMeta):
|
|
12
|
+
"""
|
|
13
|
+
Abstract base class for migration schemas.
|
|
14
|
+
|
|
15
|
+
This class provides the interface for managing and compiling database schema migrations.
|
|
16
|
+
It includes methods for registering, unregistering, and compiling classes, as well as
|
|
17
|
+
managing class versions.
|
|
18
|
+
"""
|
|
19
|
+
_classes: Incomplete
|
|
20
|
+
_classes_versions: Incomplete
|
|
21
|
+
_buffered_classes: Incomplete
|
|
22
|
+
def __init__(self) -> None: ...
|
|
23
|
+
def get_model(self, name: str) -> type[Model]:
|
|
24
|
+
"""
|
|
25
|
+
Retrieves the model type for the given class name.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
name (str): The name of the class whose model type is to be retrieved.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
type[Model]: The model type associated with the given class name.
|
|
32
|
+
"""
|
|
33
|
+
@abstractmethod
|
|
34
|
+
def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes, class_version: str | Versions = ...) -> None: ...
|
|
35
|
+
@abstractmethod
|
|
36
|
+
def unregister_model(self, class_name: str) -> None: ...
|
|
37
|
+
@abstractmethod
|
|
38
|
+
def compile_buffered_classes(self) -> None: ...
|
|
39
|
+
@staticmethod
|
|
40
|
+
def register_model_version(class_name: str, class_version: str | Versions) -> None:
|
|
41
|
+
"""
|
|
42
|
+
Registers a specific version of a model class.
|
|
43
|
+
|
|
44
|
+
This method registers a specific version of a model class using the ClassVersionManager.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
class_name (str): The name of the class to register the version for.
|
|
48
|
+
class_version (str | Versions): The version of the class to be registered.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
None
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
class DefaultMigrationSchemas(BaseMigrationSchemas):
|
|
55
|
+
"""
|
|
56
|
+
Default implementation of the BaseMigrationSchemas.
|
|
57
|
+
|
|
58
|
+
This class provides the default implementation for managing and compiling database schema migrations.
|
|
59
|
+
It includes methods for registering, unregistering, and compiling classes, as well as managing class versions.
|
|
60
|
+
|
|
61
|
+
Attributes:
|
|
62
|
+
model_class_template_layout (Path): Path to the model class layout template.
|
|
63
|
+
model_class_template (Path): Path to the model class template.
|
|
64
|
+
dict_validator_template (Path): Path to the dictionary validator template.
|
|
65
|
+
options_validator_template (Path): Path to the options validator template.
|
|
66
|
+
"""
|
|
67
|
+
model_class_template_layout: Path
|
|
68
|
+
model_class_template: Path
|
|
69
|
+
dict_validator_template: Path
|
|
70
|
+
options_validator_template: Path
|
|
71
|
+
def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes, class_version: str | Versions = ...) -> None:
|
|
72
|
+
"""
|
|
73
|
+
Registers a model class for migration.
|
|
74
|
+
|
|
75
|
+
This method registers a model class for migration by adding it to the buffered classes
|
|
76
|
+
and registering its latest version.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
class_name (str): The name of the class to be registered.
|
|
80
|
+
object_schema (ObjectSchema): The schema of the object to be registered.
|
|
81
|
+
schema_type (SchemaTypes): The type of the schema.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
None
|
|
85
|
+
"""
|
|
86
|
+
def compile_buffered_classes(self) -> None:
|
|
87
|
+
"""
|
|
88
|
+
Compiles all buffered classes for migration.
|
|
89
|
+
|
|
90
|
+
This method compiles all classes that have been buffered for migration and updates the
|
|
91
|
+
internal class dictionary with the compiled class types. It clears the buffer after
|
|
92
|
+
compilation.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
None
|
|
96
|
+
"""
|
|
97
|
+
def unregister_model(self, class_name: str) -> None:
|
|
98
|
+
"""
|
|
99
|
+
Unregisters a model class from the migration schemas.
|
|
100
|
+
|
|
101
|
+
This method removes the specified model class from the internal class dictionary,
|
|
102
|
+
effectively unregistering it from the migration schemas.
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
class_name (str): The name of the class to be unregistered.
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
None
|
|
109
|
+
"""
|
|
110
|
+
def _compile_buffered_classes(self) -> list[tuple[str, type[Model]]]: ...
|
|
111
|
+
def _build_class_source(self, class_name: str, schema: ObjectSchema, schema_type: SchemaTypes) -> tuple[str, str]: ...
|
|
112
|
+
@staticmethod
|
|
113
|
+
def _resolve_class_inheritance(schema: ObjectSchema) -> str: ...
|
|
114
|
+
@staticmethod
|
|
115
|
+
def _process_custom_code(custom_code: str | None) -> tuple[str, str]: ...
|
|
116
|
+
def _render_property(self, name: str, property_schema: PropertyData, required: list[str]) -> str: ...
|
|
117
|
+
def _render_type_annotation(self, type_: str, items: TypeData | DictSchema | LegacyDictSchema | None) -> str: ...
|
|
118
|
+
def _render_validators(self, schema: ObjectSchema) -> list[str]: ...
|
|
119
|
+
def _get_all_types(self, type_: str, items: TypeData | DictSchema | LegacyDictSchema | None) -> set[str]: ...
|
|
120
|
+
def _is_reference(self, type_: str) -> bool: ...
|
|
Binary file
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
from amsdal_models.classes.model import Model
|
|
2
|
+
from amsdal_utils.models.data_models.address import Address as Address
|
|
3
|
+
from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema, PropertyData as PropertyData
|
|
4
|
+
from amsdal_utils.models.enums import SchemaTypes as SchemaTypes
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
class Action(str, Enum):
|
|
10
|
+
"""
|
|
11
|
+
Enumeration for different types of actions.
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
CREATED (str): Represents a created action.
|
|
15
|
+
UPDATED (str): Represents an updated action.
|
|
16
|
+
NO_ACTION (str): Represents no action.
|
|
17
|
+
"""
|
|
18
|
+
CREATE = 'CREATE'
|
|
19
|
+
UPDATE = 'UPDATE'
|
|
20
|
+
NO_ACTION = 'NO_ACTION'
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class ClassSaveResult:
|
|
24
|
+
"""
|
|
25
|
+
Data class representing the result of a class save operation.
|
|
26
|
+
|
|
27
|
+
Attributes:
|
|
28
|
+
action (Action): The action performed during the save operation.
|
|
29
|
+
instance (Model): The instance of the model that was saved.
|
|
30
|
+
"""
|
|
31
|
+
action: Action
|
|
32
|
+
instance: Model
|
|
33
|
+
def __init__(self, action, instance) -> None: ...
|
|
34
|
+
|
|
35
|
+
@dataclass
|
|
36
|
+
class CheckClassResult:
|
|
37
|
+
action: Action
|
|
38
|
+
instance: Model | None = ...
|
|
39
|
+
def __init__(self, action, instance=...) -> None: ...
|
|
40
|
+
|
|
41
|
+
@dataclass
|
|
42
|
+
class ClassUpdateResult:
|
|
43
|
+
"""
|
|
44
|
+
Data class representing the result of a class update operation.
|
|
45
|
+
|
|
46
|
+
Attributes:
|
|
47
|
+
is_updated (bool): Indicates whether the class was updated.
|
|
48
|
+
class_instance (Model): The instance of the model that was updated.
|
|
49
|
+
"""
|
|
50
|
+
is_updated: bool
|
|
51
|
+
class_instance: Model
|
|
52
|
+
def __init__(self, is_updated, class_instance) -> None: ...
|
|
53
|
+
|
|
54
|
+
@dataclass
|
|
55
|
+
class MigrateResult:
|
|
56
|
+
"""
|
|
57
|
+
Data class representing the result of a migration operation.
|
|
58
|
+
|
|
59
|
+
Attributes:
|
|
60
|
+
class_instance (Model): The instance of the model that was migrated.
|
|
61
|
+
is_table_created (bool): Indicates whether the table was created during the migration.
|
|
62
|
+
is_data_migrated (bool): Indicates whether the data was migrated.
|
|
63
|
+
"""
|
|
64
|
+
class_instance: Model
|
|
65
|
+
is_table_created: bool
|
|
66
|
+
is_data_migrated: bool
|
|
67
|
+
def __init__(self, class_instance, is_table_created, is_data_migrated) -> None: ...
|
|
68
|
+
|
|
69
|
+
class ModuleTypes(str, Enum):
|
|
70
|
+
"""
|
|
71
|
+
Enumeration for different types of modules.
|
|
72
|
+
|
|
73
|
+
Attributes:
|
|
74
|
+
APP (str): Represents an application module.
|
|
75
|
+
CORE (str): Represents a core module.
|
|
76
|
+
CONTRIB (str): Represents a contributed module.
|
|
77
|
+
"""
|
|
78
|
+
APP = 'APP'
|
|
79
|
+
CORE = 'CORE'
|
|
80
|
+
CONTRIB = 'CONTRIB'
|
|
81
|
+
|
|
82
|
+
@dataclass
|
|
83
|
+
class MigrationFile:
|
|
84
|
+
"""
|
|
85
|
+
Data class representing a migration file.
|
|
86
|
+
|
|
87
|
+
Attributes:
|
|
88
|
+
path (Path): The file path of the migration.
|
|
89
|
+
type (ModuleTypes): The type of module the migration belongs to.
|
|
90
|
+
number (int): The migration number.
|
|
91
|
+
module (str | None): The module name, if applicable.
|
|
92
|
+
applied_at (float | None): The timestamp when the migration was applied.
|
|
93
|
+
stored_address (Address | None): The stored address associated with the migration.
|
|
94
|
+
"""
|
|
95
|
+
path: Path
|
|
96
|
+
type: ModuleTypes
|
|
97
|
+
number: int
|
|
98
|
+
module: str | None = ...
|
|
99
|
+
applied_at: float | None = ...
|
|
100
|
+
stored_address: Address | None = ...
|
|
101
|
+
@property
|
|
102
|
+
def is_initial(self) -> bool:
|
|
103
|
+
"""
|
|
104
|
+
Indicates whether this migration is the initial migration.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
bool: True if this is the initial migration, False otherwise.
|
|
108
|
+
"""
|
|
109
|
+
def __init__(self, path, type, number, module=..., applied_at=..., stored_address=...) -> None: ...
|
|
110
|
+
|
|
111
|
+
@dataclass
|
|
112
|
+
class ClassSchema:
|
|
113
|
+
"""
|
|
114
|
+
Data class representing a class schema.
|
|
115
|
+
|
|
116
|
+
Attributes:
|
|
117
|
+
object_schema (ObjectSchema): The object schema associated with the class.
|
|
118
|
+
type (ModuleTypes): The type of module the class belongs to.
|
|
119
|
+
"""
|
|
120
|
+
object_schema: ObjectSchema
|
|
121
|
+
type: ModuleTypes
|
|
122
|
+
def __init__(self, object_schema, type) -> None: ...
|
|
123
|
+
|
|
124
|
+
class OperationTypes(str, Enum):
|
|
125
|
+
"""
|
|
126
|
+
Enumeration for different types of operations.
|
|
127
|
+
|
|
128
|
+
Attributes:
|
|
129
|
+
CREATE_CLASS (str): Represents the operation to create a class.
|
|
130
|
+
UPDATE_CLASS (str): Represents the operation to update a class.
|
|
131
|
+
DELETE_CLASS (str): Represents the operation to delete a class.
|
|
132
|
+
"""
|
|
133
|
+
CREATE_CLASS = 'CREATE_CLASS'
|
|
134
|
+
UPDATE_CLASS = 'UPDATE_CLASS'
|
|
135
|
+
DELETE_CLASS = 'DELETE_CLASS'
|
|
136
|
+
|
|
137
|
+
@dataclass
|
|
138
|
+
class MigrateOperation:
|
|
139
|
+
"""
|
|
140
|
+
Data class representing a migration operation.
|
|
141
|
+
|
|
142
|
+
Attributes:
|
|
143
|
+
type (OperationTypes): The type of operation being performed.
|
|
144
|
+
class_name (str): The name of the class involved in the migration.
|
|
145
|
+
schema_type (SchemaTypes): The type of schema associated with the migration.
|
|
146
|
+
old_schema (ObjectSchema | PropertyData | None): The old schema before the migration, if applicable.
|
|
147
|
+
new_schema (ObjectSchema | PropertyData | None): The new schema after the migration, if applicable.
|
|
148
|
+
"""
|
|
149
|
+
type: OperationTypes
|
|
150
|
+
class_name: str
|
|
151
|
+
schema_type: SchemaTypes
|
|
152
|
+
old_schema: ObjectSchema | PropertyData | None = ...
|
|
153
|
+
new_schema: ObjectSchema | PropertyData | None = ...
|
|
154
|
+
def __init__(self, type, class_name, schema_type, old_schema=..., new_schema=...) -> None: ...
|
|
155
|
+
|
|
156
|
+
class MigrationDirection(str, Enum):
|
|
157
|
+
"""
|
|
158
|
+
Enumeration for the direction of a migration.
|
|
159
|
+
|
|
160
|
+
Attributes:
|
|
161
|
+
FORWARD (str): Represents a forward migration.
|
|
162
|
+
BACKWARD (str): Represents a backward migration.
|
|
163
|
+
"""
|
|
164
|
+
FORWARD = 'forward'
|
|
165
|
+
BACKWARD = 'backward'
|
|
166
|
+
|
|
167
|
+
@dataclass
|
|
168
|
+
class MigrationResult:
|
|
169
|
+
"""
|
|
170
|
+
Data class representing the result of a migration.
|
|
171
|
+
|
|
172
|
+
Attributes:
|
|
173
|
+
direction (MigrationDirection): The direction of the migration.
|
|
174
|
+
migration (MigrationFile): The migration file associated with the migration.
|
|
175
|
+
"""
|
|
176
|
+
direction: MigrationDirection
|
|
177
|
+
migration: MigrationFile
|
|
178
|
+
def __init__(self, direction, migration) -> None: ...
|
|
Binary file
|
|
File without changes
|
|
Binary file
|