amsdal 0.0.40__cp311-cp311-macosx_10_9_universal2.whl → 0.1.0__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/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_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_session.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/delete_dependency.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/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_secrets.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/manager.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/signup_action.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/actions/update_deploy.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/__init__.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/base.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/credentials.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/manager.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/signup_service.cpython-311-darwin.so +0 -0
- amsdal/cloud/services/auth/token.cpython-311-darwin.so +0 -0
- amsdal/configs/constants.py +2 -0
- amsdal/configs/constants.pyi +1 -0
- amsdal/configs/main.py +6 -0
- amsdal/configs/main.pyi +3 -0
- amsdal/contrib/__init__.cpython-311-darwin.so +0 -0
- amsdal/contrib/frontend_configs/conversion/convert.py +19 -9
- amsdal/contrib/frontend_configs/conversion/convert.pyi +2 -2
- amsdal/fixtures/__init__.cpython-311-darwin.so +0 -0
- amsdal/fixtures/manager.cpython-311-darwin.so +0 -0
- amsdal/manager.cpython-311-darwin.so +0 -0
- amsdal/manager.pyi +9 -3
- 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 +44 -0
- amsdal/migration/data_classes.cpython-311-darwin.so +0 -0
- amsdal/migration/data_classes.pyi +78 -0
- 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 +21 -0
- amsdal/migration/executors/default_executor.cpython-311-darwin.so +0 -0
- amsdal/migration/executors/default_executor.pyi +20 -0
- amsdal/migration/executors/state_executor.cpython-311-darwin.so +0 -0
- amsdal/migration/executors/state_executor.pyi +14 -0
- amsdal/migration/file_migration_executor.cpython-311-darwin.so +0 -0
- amsdal/migration/file_migration_executor.pyi +35 -0
- amsdal/migration/file_migration_generator.cpython-311-darwin.so +0 -0
- amsdal/migration/file_migration_generator.pyi +49 -0
- amsdal/migration/file_migration_store.cpython-311-darwin.so +0 -0
- amsdal/migration/file_migration_store.pyi +33 -0
- amsdal/migration/file_migration_writer.cpython-311-darwin.so +0 -0
- amsdal/migration/file_migration_writer.pyi +18 -0
- amsdal/migration/migrations.cpython-311-darwin.so +0 -0
- amsdal/migration/migrations.pyi +57 -0
- amsdal/migration/migrations_loader.cpython-311-darwin.so +0 -0
- amsdal/migration/migrations_loader.pyi +17 -0
- amsdal/migration/schemas_loaders.cpython-311-darwin.so +0 -0
- amsdal/migration/schemas_loaders.pyi +24 -0
- amsdal/migration/utils.cpython-311-darwin.so +0 -0
- amsdal/migration/utils.pyi +5 -0
- amsdal/mixins/__init__.cpython-311-darwin.so +0 -0
- amsdal/mixins/build_mixin.cpython-311-darwin.so +0 -0
- amsdal/mixins/build_mixin.pyi +2 -0
- amsdal/mixins/class_versions_mixin.cpython-311-darwin.so +0 -0
- amsdal/mixins/class_versions_mixin.pyi +1 -1
- amsdal/operations/__init__.cpython-311-darwin.so +0 -0
- amsdal/operations/manager.cpython-311-darwin.so +0 -0
- amsdal/operations/manager.pyi +3 -1
- amsdal/schemas/core/class_object/model.json +5 -58
- amsdal/schemas/core/class_object_meta/model.json +55 -0
- amsdal/schemas/core/class_property/model.json +0 -19
- amsdal/schemas/core/class_property_meta/model.json +23 -0
- amsdal/schemas/manager.cpython-311-darwin.so +0 -0
- amsdal/schemas/manager.py +15 -4
- amsdal/schemas/manager.pyi +2 -0
- amsdal/schemas/types/object/model.json +12 -2
- amsdal/services/__init__.cpython-311-darwin.so +0 -0
- amsdal/services/transaction_execution.cpython-311-darwin.so +0 -0
- {amsdal-0.0.40.dist-info → amsdal-0.1.0.dist-info}/METADATA +14 -14
- {amsdal-0.0.40.dist-info → amsdal-0.1.0.dist-info}/RECORD +93 -94
- amsdal/contrib/auth/models/__init__.py +0 -0
- amsdal/contrib/auth/models/login_session/hooks/pre_init.py +0 -51
- amsdal/contrib/auth/models/login_session/model.json +0 -23
- amsdal/contrib/auth/models/login_session/modifiers/display_name.py +0 -3
- 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 -3
- amsdal/contrib/auth/models/user/hooks/pre_create.py +0 -2
- amsdal/contrib/auth/models/user/hooks/pre_init.py +0 -25
- amsdal/contrib/auth/models/user/model.json +0 -25
- amsdal/contrib/auth/models/user/modifiers/display_name.py +0 -3
- 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/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/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 -17
- amsdal/migration/manager.cpython-311-darwin.so +0 -0
- amsdal/migration/manager.pyi +0 -20
- /amsdal/{contrib/auth/models → migration/executors}/__init__.pyi +0 -0
- {amsdal-0.0.40.dist-info → amsdal-0.1.0.dist-info}/LICENSE.txt +0 -0
- {amsdal-0.0.40.dist-info → amsdal-0.1.0.dist-info}/WHEEL +0 -0
- {amsdal-0.0.40.dist-info → amsdal-0.1.0.dist-info}/top_level.txt +0 -0
amsdal/__about__.py
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
amsdal/configs/constants.py
CHANGED
|
@@ -6,6 +6,8 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
6
6
|
TYPE_SCHEMAS_PATH: Path = BASE_DIR / 'schemas' / 'types'
|
|
7
7
|
CORE_SCHEMAS_PATH: Path = BASE_DIR / 'schemas' / 'core'
|
|
8
8
|
|
|
9
|
+
CORE_MIGRATIONS_PATH: Path = BASE_DIR / '__migrations__'
|
|
10
|
+
|
|
9
11
|
# Environment
|
|
10
12
|
TESTING_ENVIRONMENT = 'testing'
|
|
11
13
|
DEVELOPMENT_ENVIRONMENT = 'development'
|
amsdal/configs/constants.pyi
CHANGED
amsdal/configs/main.py
CHANGED
|
@@ -35,6 +35,8 @@ class Settings(BaseSettings):
|
|
|
35
35
|
"""The static module name. The static files will be placed in this module."""
|
|
36
36
|
TRANSACTIONS_MODULE_NAME: str = 'transactions'
|
|
37
37
|
"""The transactions module name. The transactions will be placed in this module."""
|
|
38
|
+
MIGRATIONS_DIRECTORY_NAME: str = 'migrations'
|
|
39
|
+
"""The migrations directory name. The migration files will be placed in this folder."""
|
|
38
40
|
|
|
39
41
|
ACCESS_KEY_ID: str | None = None
|
|
40
42
|
"""The access key that you will get during registering process."""
|
|
@@ -85,6 +87,10 @@ class Settings(BaseSettings):
|
|
|
85
87
|
def transactions_root_path(self) -> Path:
|
|
86
88
|
return self.models_root_path / self.TRANSACTIONS_MODULE_NAME
|
|
87
89
|
|
|
90
|
+
@property
|
|
91
|
+
def migrations_root_path(self) -> Path:
|
|
92
|
+
return self.models_root_path / self.MIGRATIONS_DIRECTORY_NAME
|
|
93
|
+
|
|
88
94
|
@model_validator(mode='after')
|
|
89
95
|
def check_passwords_match(self) -> 'Settings':
|
|
90
96
|
config_path = self.CONFIG_PATH
|
amsdal/configs/main.pyi
CHANGED
|
@@ -12,6 +12,7 @@ class Settings(BaseSettings):
|
|
|
12
12
|
FIXTURES_MODULE_NAME: str
|
|
13
13
|
STATIC_MODULE_NAME: str
|
|
14
14
|
TRANSACTIONS_MODULE_NAME: str
|
|
15
|
+
MIGRATIONS_DIRECTORY_NAME: str
|
|
15
16
|
ACCESS_KEY_ID: str | None
|
|
16
17
|
SECRET_ACCESS_KEY: str | None
|
|
17
18
|
ACCESS_TOKEN: str | None
|
|
@@ -28,6 +29,8 @@ class Settings(BaseSettings):
|
|
|
28
29
|
def static_root_path(self) -> Path: ...
|
|
29
30
|
@property
|
|
30
31
|
def transactions_root_path(self) -> Path: ...
|
|
32
|
+
@property
|
|
33
|
+
def migrations_root_path(self) -> Path: ...
|
|
31
34
|
def check_passwords_match(self) -> Settings: ...
|
|
32
35
|
|
|
33
36
|
base: TypeAlias
|
|
Binary file
|
|
@@ -9,6 +9,7 @@ from typing import ForwardRef
|
|
|
9
9
|
from typing import Union
|
|
10
10
|
|
|
11
11
|
from amsdal_models.classes.model import LegacyModel
|
|
12
|
+
from amsdal_models.classes.model import Model
|
|
12
13
|
from amsdal_utils.models.data_models.reference import Reference
|
|
13
14
|
from pydantic import BaseModel
|
|
14
15
|
from pydantic_core import PydanticUndefined
|
|
@@ -24,21 +25,21 @@ default_types_map = {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
|
|
27
|
-
def _process_union(value: UnionType) -> dict[str, Any]:
|
|
28
|
+
def _process_union(value: UnionType, *, is_transaction: bool = False) -> dict[str, Any]:
|
|
28
29
|
arg_type = {'required': True}
|
|
29
30
|
for arg in value.__args__:
|
|
30
31
|
if arg == type(None):
|
|
31
32
|
arg_type['required'] = False
|
|
32
33
|
continue
|
|
33
34
|
|
|
34
|
-
control = convert_to_frontend_config(arg)
|
|
35
|
+
control = convert_to_frontend_config(arg, is_transaction=is_transaction)
|
|
35
36
|
if control:
|
|
36
37
|
arg_type.update(control)
|
|
37
38
|
|
|
38
39
|
return arg_type
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
def convert_to_frontend_config(value: Any) -> dict[str, Any]:
|
|
42
|
+
def convert_to_frontend_config(value: Any, *, is_transaction: bool = False) -> dict[str, Any]:
|
|
42
43
|
if hasattr(value, '__origin__'):
|
|
43
44
|
origin_class = value.__origin__
|
|
44
45
|
|
|
@@ -46,7 +47,7 @@ def convert_to_frontend_config(value: Any) -> dict[str, Any]:
|
|
|
46
47
|
return {}
|
|
47
48
|
|
|
48
49
|
if origin_class is Union:
|
|
49
|
-
return _process_union(value)
|
|
50
|
+
return _process_union(value, is_transaction=is_transaction)
|
|
50
51
|
|
|
51
52
|
if origin_class is list:
|
|
52
53
|
return {
|
|
@@ -56,7 +57,7 @@ def convert_to_frontend_config(value: Any) -> dict[str, Any]:
|
|
|
56
57
|
'control': {
|
|
57
58
|
'name': 'array_items_values',
|
|
58
59
|
'label': 'array_items_values',
|
|
59
|
-
**convert_to_frontend_config(value.__args__[0]),
|
|
60
|
+
**convert_to_frontend_config(value.__args__[0], is_transaction=is_transaction),
|
|
60
61
|
},
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -68,7 +69,7 @@ def convert_to_frontend_config(value: Any) -> dict[str, Any]:
|
|
|
68
69
|
'control': {
|
|
69
70
|
'name': 'dict_items_values',
|
|
70
71
|
'label': 'dict_items_values',
|
|
71
|
-
**convert_to_frontend_config(value.__args__[1]),
|
|
72
|
+
**convert_to_frontend_config(value.__args__[1], is_transaction=is_transaction),
|
|
72
73
|
},
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -78,7 +79,7 @@ def convert_to_frontend_config(value: Any) -> dict[str, Any]:
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
if isinstance(value, UnionType):
|
|
81
|
-
return _process_union(value)
|
|
82
|
+
return _process_union(value, is_transaction=is_transaction)
|
|
82
83
|
|
|
83
84
|
if value in default_types_map:
|
|
84
85
|
return {
|
|
@@ -102,7 +103,10 @@ def convert_to_frontend_config(value: Any) -> dict[str, Any]:
|
|
|
102
103
|
for arg_name in _parameters:
|
|
103
104
|
if arg_name in value.__annotations__:
|
|
104
105
|
arg_type = value.__annotations__[arg_name]
|
|
105
|
-
control = convert_to_frontend_config(
|
|
106
|
+
control = convert_to_frontend_config(
|
|
107
|
+
arg_type,
|
|
108
|
+
is_transaction=True,
|
|
109
|
+
)
|
|
106
110
|
|
|
107
111
|
if not control:
|
|
108
112
|
continue
|
|
@@ -136,6 +140,12 @@ def convert_to_frontend_config(value: Any) -> dict[str, Any]:
|
|
|
136
140
|
'type': 'object_latest',
|
|
137
141
|
}
|
|
138
142
|
|
|
143
|
+
if is_transaction and issubclass(value, Model):
|
|
144
|
+
return {
|
|
145
|
+
'type': 'object_latest',
|
|
146
|
+
'entityType': value.__name__,
|
|
147
|
+
}
|
|
148
|
+
|
|
139
149
|
if issubclass(value, LegacyModel):
|
|
140
150
|
return {}
|
|
141
151
|
|
|
@@ -148,7 +158,7 @@ def convert_to_frontend_config(value: Any) -> dict[str, Any]:
|
|
|
148
158
|
schema = None
|
|
149
159
|
|
|
150
160
|
for field_name, field in value.__annotations__.items():
|
|
151
|
-
control = convert_to_frontend_config(field)
|
|
161
|
+
control = convert_to_frontend_config(field, is_transaction=is_transaction)
|
|
152
162
|
|
|
153
163
|
if not control:
|
|
154
164
|
continue
|
|
@@ -5,5 +5,5 @@ from typing import Any
|
|
|
5
5
|
|
|
6
6
|
default_types_map: Incomplete
|
|
7
7
|
|
|
8
|
-
def _process_union(value: UnionType) -> dict[str, Any]: ...
|
|
9
|
-
def convert_to_frontend_config(value: Any) -> dict[str, Any]: ...
|
|
8
|
+
def _process_union(value: UnionType, *, is_transaction: bool = False) -> dict[str, Any]: ...
|
|
9
|
+
def convert_to_frontend_config(value: Any, *, is_transaction: bool = False) -> dict[str, Any]: ...
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
amsdal/manager.pyi
CHANGED
|
@@ -5,7 +5,6 @@ from amsdal.cloud.services.auth.signup_service import SignupService as SignupSer
|
|
|
5
5
|
from amsdal.configs.main import settings as settings
|
|
6
6
|
from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError, AmsdalMissingCredentialsError as AmsdalMissingCredentialsError, AmsdalRuntimeError as AmsdalRuntimeError, AmsdalSignupError as AmsdalSignupError
|
|
7
7
|
from amsdal.fixtures.manager import FixturesManager as FixturesManager
|
|
8
|
-
from amsdal.migration.manager import MigrationManager as MigrationManager
|
|
9
8
|
from amsdal.mixins.build_mixin import BuildMixin as BuildMixin
|
|
10
9
|
from amsdal.mixins.class_versions_mixin import ClassVersionsMixin as ClassVersionsMixin
|
|
11
10
|
from amsdal.operations.manager import OperationsManager as OperationsManager
|
|
@@ -31,6 +30,8 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
31
30
|
Initializes all sub managers. Reads the configuration.
|
|
32
31
|
"""
|
|
33
32
|
@property
|
|
33
|
+
def is_setup(self) -> bool: ...
|
|
34
|
+
@property
|
|
34
35
|
def is_authenticated(self) -> bool:
|
|
35
36
|
"""
|
|
36
37
|
Indicates if you have passed the AMSDAL license authentication process.
|
|
@@ -43,7 +44,7 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
43
44
|
"""
|
|
44
45
|
Initiates models root path and the connections
|
|
45
46
|
"""
|
|
46
|
-
def build(self, source_models_path: Path, source_transactions_path: Path, source_static_files_path: Path, source_fixtures_path: Path) -> None:
|
|
47
|
+
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:
|
|
47
48
|
"""
|
|
48
49
|
Build method
|
|
49
50
|
|
|
@@ -51,6 +52,7 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
51
52
|
:param source_transactions_path: Path to the directory where the source transactions are located.
|
|
52
53
|
:param source_static_files_path: Path to the directory where the source static files are located.
|
|
53
54
|
:param source_fixtures_path: Path to the directory where the source fixtures are located.
|
|
55
|
+
:param source_migrations_path: Path to the directory where the source migrations are located.
|
|
54
56
|
:return: None
|
|
55
57
|
|
|
56
58
|
This method is used to build the necessary components for the Amsdal framework.
|
|
@@ -67,9 +69,13 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
|
|
|
67
69
|
and `ClassVersionsMixin`. It is intended to be used in the Amsdal framework for managing
|
|
68
70
|
and building components.
|
|
69
71
|
"""
|
|
72
|
+
def post_setup(self) -> None:
|
|
73
|
+
"""
|
|
74
|
+
Registers internal classes and prepares connections (creates internal tables).
|
|
75
|
+
"""
|
|
70
76
|
def migrate(self) -> None:
|
|
71
77
|
"""
|
|
72
|
-
Check changes in the models and apply them to the database.
|
|
78
|
+
DEPRECATED: Check changes in the models and apply them to the database.
|
|
73
79
|
"""
|
|
74
80
|
def _check_auth(self) -> None: ...
|
|
75
81
|
@property
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
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_models.schemas.data_models.core import DictSchema, LegacyDictSchema, TypeData
|
|
7
|
+
from amsdal_models.schemas.data_models.schema import ObjectSchema, PropertyData
|
|
8
|
+
from amsdal_utils.models.enums import SchemaTypes as SchemaTypes
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
class BaseMigrationSchemas(ABC, metaclass=abc.ABCMeta):
|
|
12
|
+
_classes: Incomplete
|
|
13
|
+
_classes_versions: Incomplete
|
|
14
|
+
_buffered_classes: Incomplete
|
|
15
|
+
def __init__(self) -> None: ...
|
|
16
|
+
def get_model(self, name: str) -> type[Model]: ...
|
|
17
|
+
@abstractmethod
|
|
18
|
+
def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def unregister_model(self, class_name: str) -> None: ...
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def compile_buffered_classes(self) -> None: ...
|
|
23
|
+
@staticmethod
|
|
24
|
+
def register_model_version(class_name: str, class_version: str) -> None: ...
|
|
25
|
+
|
|
26
|
+
class DefaultMigrationSchemas(BaseMigrationSchemas):
|
|
27
|
+
model_class_template_layout: Path
|
|
28
|
+
model_class_template: Path
|
|
29
|
+
dict_validator_template: Path
|
|
30
|
+
options_validator_template: Path
|
|
31
|
+
def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
32
|
+
def compile_buffered_classes(self) -> None: ...
|
|
33
|
+
def unregister_model(self, class_name: str) -> None: ...
|
|
34
|
+
def _compile_buffered_classes(self) -> list[tuple[str, type[Model]]]: ...
|
|
35
|
+
def _build_class_source(self, class_name: str, schema: ObjectSchema, schema_type: SchemaTypes) -> tuple[str, str]: ...
|
|
36
|
+
@staticmethod
|
|
37
|
+
def _resolve_class_inheritance(schema: ObjectSchema) -> str: ...
|
|
38
|
+
@staticmethod
|
|
39
|
+
def _process_custom_code(custom_code: str | None) -> tuple[str, str]: ...
|
|
40
|
+
def _render_property(self, name: str, property_schema: PropertyData, required: list[str]) -> str: ...
|
|
41
|
+
def _render_type_annotation(self, type_: str, items: TypeData | DictSchema | LegacyDictSchema | None) -> str: ...
|
|
42
|
+
def _render_validators(self, schema: ObjectSchema) -> list[str]: ...
|
|
43
|
+
def _get_all_types(self, type_: str, items: TypeData | DictSchema | LegacyDictSchema | None) -> set[str]: ...
|
|
44
|
+
def _is_reference(self, type_: str) -> bool: ...
|
|
Binary file
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from amsdal_models.classes.model import Model
|
|
2
|
+
from amsdal_models.schemas.data_models.schema import ObjectSchema, PropertyData
|
|
3
|
+
from amsdal_utils.models.data_models.address import Address as Address
|
|
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
|
+
CREATED: str
|
|
11
|
+
UPDATED: str
|
|
12
|
+
NO_ACTION: str
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class ClassSaveResult:
|
|
16
|
+
action: Action
|
|
17
|
+
instance: Model
|
|
18
|
+
def __init__(self, action, instance) -> None: ...
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class ClassUpdateResult:
|
|
22
|
+
is_updated: bool
|
|
23
|
+
class_instance: Model
|
|
24
|
+
def __init__(self, is_updated, class_instance) -> None: ...
|
|
25
|
+
|
|
26
|
+
@dataclass
|
|
27
|
+
class MigrateResult:
|
|
28
|
+
class_instance: Model
|
|
29
|
+
is_table_created: bool
|
|
30
|
+
is_data_migrated: bool
|
|
31
|
+
def __init__(self, class_instance, is_table_created, is_data_migrated) -> None: ...
|
|
32
|
+
|
|
33
|
+
class ModuleTypes(str, Enum):
|
|
34
|
+
APP: str
|
|
35
|
+
CORE: str
|
|
36
|
+
CONTRIB: str
|
|
37
|
+
|
|
38
|
+
@dataclass
|
|
39
|
+
class MigrationFile:
|
|
40
|
+
path: Path
|
|
41
|
+
type: ModuleTypes
|
|
42
|
+
number: int
|
|
43
|
+
module: str | None = ...
|
|
44
|
+
applied_at: float | None = ...
|
|
45
|
+
stored_address: Address | None = ...
|
|
46
|
+
@property
|
|
47
|
+
def is_initial(self) -> bool: ...
|
|
48
|
+
def __init__(self, path, type, number, module, applied_at, stored_address) -> None: ...
|
|
49
|
+
|
|
50
|
+
@dataclass
|
|
51
|
+
class ClassSchema:
|
|
52
|
+
object_schema: ObjectSchema
|
|
53
|
+
type: ModuleTypes
|
|
54
|
+
def __init__(self, object_schema, type) -> None: ...
|
|
55
|
+
|
|
56
|
+
class OperationTypes(str, Enum):
|
|
57
|
+
CREATE_CLASS: str
|
|
58
|
+
UPDATE_CLASS: str
|
|
59
|
+
DELETE_CLASS: str
|
|
60
|
+
|
|
61
|
+
@dataclass
|
|
62
|
+
class MigrateOperation:
|
|
63
|
+
type: OperationTypes
|
|
64
|
+
class_name: str
|
|
65
|
+
schema_type: SchemaTypes
|
|
66
|
+
old_schema: ObjectSchema | PropertyData | None = ...
|
|
67
|
+
new_schema: ObjectSchema | PropertyData | None = ...
|
|
68
|
+
def __init__(self, type, class_name, schema_type, old_schema, new_schema) -> None: ...
|
|
69
|
+
|
|
70
|
+
class MigrationDirection(str, Enum):
|
|
71
|
+
FORWARD: str
|
|
72
|
+
BACKWARD: str
|
|
73
|
+
|
|
74
|
+
@dataclass
|
|
75
|
+
class MigrationResult:
|
|
76
|
+
direction: MigrationDirection
|
|
77
|
+
migration: MigrationFile
|
|
78
|
+
def __init__(self, direction, migration) -> None: ...
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
from _typeshed import Incomplete
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas
|
|
5
|
+
from amsdal_models.schemas.data_models.schema import ObjectSchema
|
|
6
|
+
from amsdal_utils.models.enums import SchemaTypes as SchemaTypes
|
|
7
|
+
|
|
8
|
+
class BaseMigrationExecutor(ABC, metaclass=abc.ABCMeta):
|
|
9
|
+
schemas: BaseMigrationSchemas
|
|
10
|
+
_buffer: Incomplete
|
|
11
|
+
def __init__(self) -> None: ...
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def create_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def update_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
16
|
+
@abstractmethod
|
|
17
|
+
def delete_class(self, schemas: BaseMigrationSchemas, class_name: str, schema_type: SchemaTypes) -> None: ...
|
|
18
|
+
@staticmethod
|
|
19
|
+
def _resolve_base_class_name(class_name: str, meta_class: str) -> str: ...
|
|
20
|
+
def buffer_class_migration(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
21
|
+
def flush_buffer(self) -> None: ...
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas
|
|
3
|
+
from amsdal.migration.data_classes import Action as Action, ClassSaveResult as ClassSaveResult
|
|
4
|
+
from amsdal.migration.executors.base import BaseMigrationExecutor as BaseMigrationExecutor
|
|
5
|
+
from amsdal.migration.utils import object_schema_to_table_schema as object_schema_to_table_schema
|
|
6
|
+
from amsdal_models.classes.model import Model
|
|
7
|
+
from amsdal_models.schemas.data_models.schema import ObjectSchema
|
|
8
|
+
from amsdal_utils.models.enums import SchemaTypes
|
|
9
|
+
|
|
10
|
+
class DefaultMigrationExecutor(BaseMigrationExecutor):
|
|
11
|
+
schemas: Incomplete
|
|
12
|
+
_table_schemas_manager: Incomplete
|
|
13
|
+
def __init__(self, schemas: BaseMigrationSchemas) -> None: ...
|
|
14
|
+
def create_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
15
|
+
def update_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
16
|
+
def delete_class(self, schemas: BaseMigrationSchemas, class_name: str, schema_type: SchemaTypes) -> None: ...
|
|
17
|
+
def flush_buffer(self) -> None: ...
|
|
18
|
+
def _save_class(self, base_class: type[Model], object_schema: ObjectSchema, schema_type: SchemaTypes) -> ClassSaveResult: ...
|
|
19
|
+
def _create_table(self, object_schema: ObjectSchema, class_version: str) -> None: ...
|
|
20
|
+
def _migrate_historical_data(self, schemas: BaseMigrationSchemas, class_name: str, prior_version: str, new_version: str) -> None: ...
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas
|
|
3
|
+
from amsdal.migration.executors.base import BaseMigrationExecutor as BaseMigrationExecutor
|
|
4
|
+
from amsdal_models.schemas.data_models.schema import ObjectSchema
|
|
5
|
+
from amsdal_utils.models.enums import SchemaTypes
|
|
6
|
+
|
|
7
|
+
class StateMigrationExecutor(BaseMigrationExecutor):
|
|
8
|
+
schemas: Incomplete
|
|
9
|
+
do_fetch_latest_version: Incomplete
|
|
10
|
+
def __init__(self, schemas: BaseMigrationSchemas, *, do_fetch_latest_version: bool = True) -> None: ...
|
|
11
|
+
def create_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
12
|
+
def update_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
13
|
+
def delete_class(self, schemas: BaseMigrationSchemas, class_name: str, schema_type: SchemaTypes) -> None: ...
|
|
14
|
+
def flush_buffer(self) -> None: ...
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from amsdal.configs.constants import CORE_MIGRATIONS_PATH as CORE_MIGRATIONS_PATH
|
|
3
|
+
from amsdal.configs.main import settings as settings
|
|
4
|
+
from amsdal.migration.data_classes import MigrationDirection as MigrationDirection, MigrationFile as MigrationFile, MigrationResult as MigrationResult, ModuleTypes as ModuleTypes
|
|
5
|
+
from amsdal.migration.executors.base import BaseMigrationExecutor as BaseMigrationExecutor
|
|
6
|
+
from amsdal.migration.executors.state_executor import StateMigrationExecutor as StateMigrationExecutor
|
|
7
|
+
from amsdal.migration.file_migration_store import BaseMigrationStore as BaseMigrationStore, FileMigrationStore as FileMigrationStore
|
|
8
|
+
from amsdal.migration.migrations import MigrateData as MigrateData, Migration as Migration
|
|
9
|
+
from amsdal.migration.migrations_loader import MigrationsLoader as MigrationsLoader
|
|
10
|
+
from amsdal.migration.utils import contrib_to_module_root_path as contrib_to_module_root_path
|
|
11
|
+
from amsdal_utils.models.data_models.address import Address
|
|
12
|
+
from amsdal_utils.models.enums import SchemaTypes
|
|
13
|
+
|
|
14
|
+
logger: Incomplete
|
|
15
|
+
|
|
16
|
+
class FileMigrationExecutorManager:
|
|
17
|
+
migration_address: Address
|
|
18
|
+
core_loader: Incomplete
|
|
19
|
+
contrib_loaders: Incomplete
|
|
20
|
+
app_loader: Incomplete
|
|
21
|
+
executor: Incomplete
|
|
22
|
+
_applied_migration_files: Incomplete
|
|
23
|
+
store: Incomplete
|
|
24
|
+
def __init__(self, app_migrations_loader: MigrationsLoader, executor: BaseMigrationExecutor, store: BaseMigrationStore | None = None) -> None: ...
|
|
25
|
+
def execute(self, migration_number: int | None = None, module_type: ModuleTypes | None = None, *, fake: bool = False, skip_data_migrations: bool = False) -> list[MigrationResult]: ...
|
|
26
|
+
@staticmethod
|
|
27
|
+
def _get_contrib_loaders() -> list[MigrationsLoader]: ...
|
|
28
|
+
def _apply(self, migration_number: int | None = None, module_type: ModuleTypes | None = None, *, fake: bool = False, skip_data_migrations: bool = False) -> list[MigrationResult]: ...
|
|
29
|
+
def _apply_migrations(self, loader: MigrationsLoader, module_type: ModuleTypes, migration_number: int | None = None, *, fake: bool = False, skip_data_migrations: bool = False) -> list[MigrationResult]: ...
|
|
30
|
+
def _init_state_from_applied_migrations(self, migrations: list[MigrationFile], module_type: ModuleTypes) -> None: ...
|
|
31
|
+
@staticmethod
|
|
32
|
+
def get_migration_class(migration: MigrationFile) -> type['Migration']: ...
|
|
33
|
+
def _is_migration_applied(self, migration: MigrationFile, module_type: ModuleTypes) -> bool: ...
|
|
34
|
+
@staticmethod
|
|
35
|
+
def _map_module_type_to_schema_type(module_type: ModuleTypes) -> SchemaTypes: ...
|
|
Binary file
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from amsdal.configs.main import settings as settings
|
|
3
|
+
from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas
|
|
4
|
+
from amsdal.migration.data_classes import MigrateOperation as MigrateOperation, MigrationFile as MigrationFile, ModuleTypes as ModuleTypes, OperationTypes as OperationTypes
|
|
5
|
+
from amsdal.migration.executors.state_executor import StateMigrationExecutor as StateMigrationExecutor
|
|
6
|
+
from amsdal.migration.file_migration_executor import FileMigrationExecutorManager as FileMigrationExecutorManager
|
|
7
|
+
from amsdal.migration.file_migration_store import BaseMigrationStore as BaseMigrationStore
|
|
8
|
+
from amsdal.migration.file_migration_writer import FileMigrationWriter as FileMigrationWriter
|
|
9
|
+
from amsdal.migration.migrations_loader import MigrationsLoader as MigrationsLoader
|
|
10
|
+
from amsdal.migration.schemas_loaders import BaseClassSchemaLoader as BaseClassSchemaLoader
|
|
11
|
+
from amsdal_models.schemas.data_models.schema import ObjectSchema
|
|
12
|
+
from amsdal_utils.models.enums import SchemaTypes
|
|
13
|
+
from collections.abc import Callable as Callable
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import ClassVar
|
|
16
|
+
|
|
17
|
+
class StateMigrationStore(BaseMigrationStore):
|
|
18
|
+
def save_migration(self, migration: MigrationFile) -> None: ...
|
|
19
|
+
def delete_migration(self, migration: MigrationFile) -> None: ...
|
|
20
|
+
def fetch_migrations(self) -> list[MigrationFile]: ...
|
|
21
|
+
|
|
22
|
+
class StateMigrationSchemas(BaseMigrationSchemas):
|
|
23
|
+
state: Incomplete
|
|
24
|
+
def __init__(self) -> None: ...
|
|
25
|
+
def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
|
|
26
|
+
def unregister_model(self, class_name: str) -> None: ...
|
|
27
|
+
def compile_buffered_classes(self) -> None: ...
|
|
28
|
+
|
|
29
|
+
class FileMigrationGenerator:
|
|
30
|
+
_operations: ClassVar[dict[OperationTypes, Callable[..., MigrateOperation]]]
|
|
31
|
+
_app_migrations_path: Incomplete
|
|
32
|
+
_app_migrations_loader: Incomplete
|
|
33
|
+
_schema_loader: Incomplete
|
|
34
|
+
_state: Incomplete
|
|
35
|
+
def __init__(self, schema_loader: BaseClassSchemaLoader, app_migrations_path: Path | None = None) -> None: ...
|
|
36
|
+
def init_migrations(self, schema_type: SchemaTypes = ...) -> None:
|
|
37
|
+
"""Reads class schemas and creates initial migration file"""
|
|
38
|
+
def make_migrations(self, name: str | None = None, *, is_data: bool = False, schema_type: SchemaTypes = ...) -> MigrationFile: ...
|
|
39
|
+
def generate_operations(self, schema_type: SchemaTypes) -> list[MigrateOperation]: ...
|
|
40
|
+
def _make_data_migrations(self, name: str | None = None) -> MigrationFile: ...
|
|
41
|
+
def _init_state(self) -> None: ...
|
|
42
|
+
@classmethod
|
|
43
|
+
def build_operations(cls, schema_type: SchemaTypes, class_schema: ObjectSchema, old_class_schema: ObjectSchema | None) -> list[MigrateOperation]: ...
|
|
44
|
+
def write_migration_file(self, operations: list[MigrateOperation], name: str | None = None) -> MigrationFile: ...
|
|
45
|
+
def write_data_migration_file(self, name: str | None = None) -> MigrationFile: ...
|
|
46
|
+
@staticmethod
|
|
47
|
+
def generate_name_from_operations(operations: list[MigrateOperation]) -> str: ...
|
|
48
|
+
@staticmethod
|
|
49
|
+
def _get_migration_file_name(number: int, name: str) -> str: ...
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
from _typeshed import Incomplete
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from amsdal.configs.main import settings as settings
|
|
5
|
+
from amsdal.migration.data_classes import MigrationFile as MigrationFile, ModuleTypes as ModuleTypes
|
|
6
|
+
from amsdal.migration.utils import contrib_to_module_root_path as contrib_to_module_root_path, map_module_type_to_schema_type as map_module_type_to_schema_type
|
|
7
|
+
from amsdal_utils.config.data_models.amsdal_config import AmsdalConfig as AmsdalConfig
|
|
8
|
+
from amsdal_utils.models.data_models.address import Address
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
class BaseMigrationStore(ABC, metaclass=abc.ABCMeta):
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def fetch_migrations(self) -> list[MigrationFile]: ...
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def save_migration(self, migration: MigrationFile) -> None: ...
|
|
16
|
+
@abstractmethod
|
|
17
|
+
def delete_migration(self, migration: MigrationFile) -> None: ...
|
|
18
|
+
|
|
19
|
+
class FileMigrationStore(BaseMigrationStore):
|
|
20
|
+
migration_address: Address
|
|
21
|
+
_config_manager: Incomplete
|
|
22
|
+
_amsdal_config: Incomplete
|
|
23
|
+
_connections_manager: Incomplete
|
|
24
|
+
def __init__(self) -> None: ...
|
|
25
|
+
def fetch_migrations(self) -> list[MigrationFile]: ...
|
|
26
|
+
def save_migration(self, migration: MigrationFile) -> None: ...
|
|
27
|
+
def delete_migration(self, migration: MigrationFile) -> None: ...
|
|
28
|
+
def _save_historical_data(self, address: Address, data: dict[str, Any], metadata: dict[str, Any]) -> None: ...
|
|
29
|
+
@staticmethod
|
|
30
|
+
def _build_migration_data(migration: MigrationFile) -> dict[str, Any]: ...
|
|
31
|
+
@classmethod
|
|
32
|
+
def _build_migration_metadata(cls, migration: MigrationFile, object_id: str | None = None) -> tuple[Address, dict[str, Any]]: ...
|
|
33
|
+
def _init_migration_table(self) -> None: ...
|
|
Binary file
|