amsdal 0.0.41__cp311-cp311-win_amd64.whl → 0.1.0__cp311-cp311-win_amd64.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.

Files changed (119) hide show
  1. amsdal/__about__.py +1 -1
  2. amsdal/cloud/__init__.cp311-win_amd64.pyd +0 -0
  3. amsdal/cloud/client.cp311-win_amd64.pyd +0 -0
  4. amsdal/cloud/constants.cp311-win_amd64.pyd +0 -0
  5. amsdal/cloud/enums.cp311-win_amd64.pyd +0 -0
  6. amsdal/cloud/models/__init__.cp311-win_amd64.pyd +0 -0
  7. amsdal/cloud/models/base.cp311-win_amd64.pyd +0 -0
  8. amsdal/cloud/services/__init__.cp311-win_amd64.pyd +0 -0
  9. amsdal/cloud/services/actions/__init__.cp311-win_amd64.pyd +0 -0
  10. amsdal/cloud/services/actions/add_dependency.cp311-win_amd64.pyd +0 -0
  11. amsdal/cloud/services/actions/add_secret.cp311-win_amd64.pyd +0 -0
  12. amsdal/cloud/services/actions/base.cp311-win_amd64.pyd +0 -0
  13. amsdal/cloud/services/actions/create_deploy.cp311-win_amd64.pyd +0 -0
  14. amsdal/cloud/services/actions/create_session.cp311-win_amd64.pyd +0 -0
  15. amsdal/cloud/services/actions/delete_dependency.cp311-win_amd64.pyd +0 -0
  16. amsdal/cloud/services/actions/delete_secret.cp311-win_amd64.pyd +0 -0
  17. amsdal/cloud/services/actions/destroy_deploy.cp311-win_amd64.pyd +0 -0
  18. amsdal/cloud/services/actions/expose_db.cp311-win_amd64.pyd +0 -0
  19. amsdal/cloud/services/actions/list_dependencies.cp311-win_amd64.pyd +0 -0
  20. amsdal/cloud/services/actions/list_deploys.cp311-win_amd64.pyd +0 -0
  21. amsdal/cloud/services/actions/list_secrets.cp311-win_amd64.pyd +0 -0
  22. amsdal/cloud/services/actions/manager.cp311-win_amd64.pyd +0 -0
  23. amsdal/cloud/services/actions/signup_action.cp311-win_amd64.pyd +0 -0
  24. amsdal/cloud/services/actions/update_deploy.cp311-win_amd64.pyd +0 -0
  25. amsdal/cloud/services/auth/__init__.cp311-win_amd64.pyd +0 -0
  26. amsdal/cloud/services/auth/base.cp311-win_amd64.pyd +0 -0
  27. amsdal/cloud/services/auth/credentials.cp311-win_amd64.pyd +0 -0
  28. amsdal/cloud/services/auth/manager.cp311-win_amd64.pyd +0 -0
  29. amsdal/cloud/services/auth/signup_service.cp311-win_amd64.pyd +0 -0
  30. amsdal/cloud/services/auth/token.cp311-win_amd64.pyd +0 -0
  31. amsdal/configs/constants.py +2 -0
  32. amsdal/configs/constants.pyi +1 -0
  33. amsdal/configs/main.py +6 -0
  34. amsdal/configs/main.pyi +3 -0
  35. amsdal/contrib/__init__.cp311-win_amd64.pyd +0 -0
  36. amsdal/fixtures/__init__.cp311-win_amd64.pyd +0 -0
  37. amsdal/fixtures/manager.cp311-win_amd64.pyd +0 -0
  38. amsdal/manager.cp311-win_amd64.pyd +0 -0
  39. amsdal/manager.pyi +9 -3
  40. amsdal/migration/__init__.cp311-win_amd64.pyd +0 -0
  41. amsdal/migration/base_migration_schemas.cp311-win_amd64.pyd +0 -0
  42. amsdal/migration/base_migration_schemas.pyi +44 -0
  43. amsdal/migration/data_classes.cp311-win_amd64.pyd +0 -0
  44. amsdal/migration/data_classes.pyi +78 -0
  45. amsdal/migration/executors/__init__.cp311-win_amd64.pyd +0 -0
  46. amsdal/migration/executors/base.cp311-win_amd64.pyd +0 -0
  47. amsdal/migration/executors/base.pyi +21 -0
  48. amsdal/migration/executors/default_executor.cp311-win_amd64.pyd +0 -0
  49. amsdal/migration/executors/default_executor.pyi +20 -0
  50. amsdal/migration/executors/state_executor.cp311-win_amd64.pyd +0 -0
  51. amsdal/migration/executors/state_executor.pyi +14 -0
  52. amsdal/migration/file_migration_executor.cp311-win_amd64.pyd +0 -0
  53. amsdal/migration/file_migration_executor.pyi +35 -0
  54. amsdal/migration/file_migration_generator.cp311-win_amd64.pyd +0 -0
  55. amsdal/migration/file_migration_generator.pyi +49 -0
  56. amsdal/migration/file_migration_store.cp311-win_amd64.pyd +0 -0
  57. amsdal/migration/file_migration_store.pyi +33 -0
  58. amsdal/migration/file_migration_writer.cp311-win_amd64.pyd +0 -0
  59. amsdal/migration/file_migration_writer.pyi +18 -0
  60. amsdal/migration/migrations.cp311-win_amd64.pyd +0 -0
  61. amsdal/migration/migrations.pyi +57 -0
  62. amsdal/migration/migrations_loader.cp311-win_amd64.pyd +0 -0
  63. amsdal/migration/migrations_loader.pyi +17 -0
  64. amsdal/migration/schemas_loaders.cp311-win_amd64.pyd +0 -0
  65. amsdal/migration/schemas_loaders.pyi +24 -0
  66. amsdal/migration/utils.cp311-win_amd64.pyd +0 -0
  67. amsdal/migration/utils.pyi +5 -0
  68. amsdal/mixins/__init__.cp311-win_amd64.pyd +0 -0
  69. amsdal/mixins/build_mixin.cp311-win_amd64.pyd +0 -0
  70. amsdal/mixins/build_mixin.pyi +2 -0
  71. amsdal/mixins/class_versions_mixin.cp311-win_amd64.pyd +0 -0
  72. amsdal/mixins/class_versions_mixin.pyi +1 -1
  73. amsdal/operations/__init__.cp311-win_amd64.pyd +0 -0
  74. amsdal/operations/manager.cp311-win_amd64.pyd +0 -0
  75. amsdal/operations/manager.pyi +3 -1
  76. amsdal/schemas/core/class_object/model.json +5 -58
  77. amsdal/schemas/core/class_object_meta/model.json +55 -0
  78. amsdal/schemas/core/class_property/model.json +0 -19
  79. amsdal/schemas/core/class_property_meta/model.json +23 -0
  80. amsdal/schemas/manager.cp311-win_amd64.pyd +0 -0
  81. amsdal/schemas/manager.py +15 -4
  82. amsdal/schemas/manager.pyi +2 -0
  83. amsdal/schemas/types/object/model.json +12 -2
  84. amsdal/services/__init__.cp311-win_amd64.pyd +0 -0
  85. amsdal/services/transaction_execution.cp311-win_amd64.pyd +0 -0
  86. {amsdal-0.0.41.dist-info → amsdal-0.1.0.dist-info}/METADATA +14 -14
  87. {amsdal-0.0.41.dist-info → amsdal-0.1.0.dist-info}/RECORD +91 -92
  88. amsdal/contrib/auth/models/__init__.py +0 -0
  89. amsdal/contrib/auth/models/login_session/hooks/pre_init.py +0 -51
  90. amsdal/contrib/auth/models/login_session/model.json +0 -23
  91. amsdal/contrib/auth/models/login_session/modifiers/display_name.py +0 -3
  92. amsdal/contrib/auth/models/permission/fixtures/basic_permissions.json +0 -62
  93. amsdal/contrib/auth/models/permission/model.json +0 -18
  94. amsdal/contrib/auth/models/permission/modifiers/display_name.py +0 -3
  95. amsdal/contrib/auth/models/user/hooks/pre_create.py +0 -2
  96. amsdal/contrib/auth/models/user/hooks/pre_init.py +0 -25
  97. amsdal/contrib/auth/models/user/model.json +0 -25
  98. amsdal/contrib/auth/models/user/modifiers/display_name.py +0 -11
  99. amsdal/contrib/frontend_configs/models/__init__.py +0 -0
  100. amsdal/contrib/frontend_configs/models/__init__.pyi +0 -0
  101. amsdal/contrib/frontend_configs/models/frontend_activator_config/model.json +0 -11
  102. amsdal/contrib/frontend_configs/models/frontend_config_async_validator/model.json +0 -11
  103. amsdal/contrib/frontend_configs/models/frontend_config_group_validator/model.json +0 -52
  104. amsdal/contrib/frontend_configs/models/frontend_config_option/model.json +0 -15
  105. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/model.json +0 -6
  106. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/properties/model_dump.py +0 -13
  107. amsdal/contrib/frontend_configs/models/frontend_config_slider_option/model.json +0 -19
  108. amsdal/contrib/frontend_configs/models/frontend_config_text_mask/model.json +0 -26
  109. amsdal/contrib/frontend_configs/models/frontend_config_validator/model.json +0 -41
  110. amsdal/contrib/frontend_configs/models/frontend_control_config/model.json +0 -250
  111. amsdal/contrib/frontend_configs/models/frontend_model_config/model.json +0 -17
  112. amsdal/contrib/frontend_configs/models/frontent_config_control_action/model.json +0 -54
  113. amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +0 -17
  114. amsdal/migration/manager.cp311-win_amd64.pyd +0 -0
  115. amsdal/migration/manager.pyi +0 -20
  116. /amsdal/{contrib/auth/models → migration/executors}/__init__.pyi +0 -0
  117. {amsdal-0.0.41.dist-info → amsdal-0.1.0.dist-info}/LICENSE.txt +0 -0
  118. {amsdal-0.0.41.dist-info → amsdal-0.1.0.dist-info}/WHEEL +0 -0
  119. {amsdal-0.0.41.dist-info → amsdal-0.1.0.dist-info}/top_level.txt +0 -0
amsdal/__about__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2023-present
2
2
  #
3
3
  # SPDX-License-Identifier: AMSDAL End User License Agreement
4
- __version__ = '0.0.41'
4
+ __version__ = '0.1.0'
Binary file
Binary file
Binary file
Binary file
@@ -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'
@@ -4,6 +4,7 @@ from pathlib import Path
4
4
  BASE_DIR: Incomplete
5
5
  TYPE_SCHEMAS_PATH: Path
6
6
  CORE_SCHEMAS_PATH: Path
7
+ CORE_MIGRATIONS_PATH: Path
7
8
  TESTING_ENVIRONMENT: str
8
9
  DEVELOPMENT_ENVIRONMENT: str
9
10
  PRODUCTION_ENVIRONMENT: str
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
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
@@ -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: ...
@@ -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: ...
@@ -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: ...
@@ -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: ...
@@ -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: ...
@@ -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: ...
@@ -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: ...
@@ -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: ...
@@ -0,0 +1,18 @@
1
+ from amsdal.migration.data_classes import MigrateOperation as MigrateOperation, OperationTypes as OperationTypes
2
+ from pathlib import Path
3
+ from typing import ClassVar
4
+
5
+ class FileMigrationWriter:
6
+ template_path: Path
7
+ data_template_path: Path
8
+ operation_name_map: ClassVar[dict[OperationTypes, str]]
9
+ @classmethod
10
+ def write(cls, file_path: Path, operations: list[MigrateOperation]) -> None: ...
11
+ @classmethod
12
+ def write_data_migration(cls, file_path: Path) -> None: ...
13
+ @classmethod
14
+ def render(cls, operations: list[MigrateOperation]) -> str: ...
15
+ @classmethod
16
+ def render_operation(cls, operation: MigrateOperation) -> str: ...
17
+ @classmethod
18
+ def reformat(cls, content: str) -> str: ...
@@ -0,0 +1,57 @@
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, DefaultMigrationSchemas as DefaultMigrationSchemas
5
+ from amsdal.migration.executors.base import BaseMigrationExecutor as BaseMigrationExecutor
6
+ from amsdal_utils.models.enums import SchemaTypes as SchemaTypes
7
+ from collections.abc import Callable as Callable
8
+ from typing import Any
9
+
10
+ class Operation(ABC, metaclass=abc.ABCMeta):
11
+ @abstractmethod
12
+ def forward(self, executor: BaseMigrationExecutor) -> None: ...
13
+ @abstractmethod
14
+ def backward(self, executor: BaseMigrationExecutor) -> None: ...
15
+
16
+ class SchemaOperation(Operation):
17
+ forward_args: list[Any]
18
+ backward_args: list[Any]
19
+ forward_method_name: str
20
+ backward_method_name: str
21
+ def forward(self, executor: BaseMigrationExecutor) -> None: ...
22
+ def backward(self, executor: BaseMigrationExecutor) -> None: ...
23
+
24
+ class CreateClass(SchemaOperation):
25
+ forward_method_name: str
26
+ backward_method_name: str
27
+ forward_args: Incomplete
28
+ backward_args: Incomplete
29
+ def __init__(self, class_name: str, new_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
30
+
31
+ class UpdateClass(SchemaOperation):
32
+ forward_method_name: str
33
+ backward_method_name: str
34
+ forward_args: Incomplete
35
+ backward_args: Incomplete
36
+ def __init__(self, class_name: str, old_schema: dict[str, Any], new_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
37
+
38
+ class DeleteClass(SchemaOperation):
39
+ forward_method_name: str
40
+ backward_method_name: str
41
+ forward_args: Incomplete
42
+ backward_args: Incomplete
43
+ def __init__(self, class_name: str, old_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
44
+
45
+ class MigrationSchemas(DefaultMigrationSchemas): ...
46
+
47
+ class MigrateData(Operation):
48
+ @staticmethod
49
+ def noop(schemas: MigrationSchemas) -> None: ...
50
+ forward_migration: Incomplete
51
+ backward_migration: Incomplete
52
+ def __init__(self, forward_migration: Callable[[MigrationSchemas | BaseMigrationSchemas], None], backward_migration: Callable[[MigrationSchemas | BaseMigrationSchemas], None]) -> None: ...
53
+ def forward(self, executor: BaseMigrationExecutor) -> None: ...
54
+ def backward(self, executor: BaseMigrationExecutor) -> None: ...
55
+
56
+ class Migration:
57
+ operations: list[Operation]
@@ -0,0 +1,17 @@
1
+ from _typeshed import Incomplete
2
+ from amsdal.migration.data_classes import MigrationFile as MigrationFile, ModuleTypes as ModuleTypes
3
+ from collections.abc import Iterator
4
+ from pathlib import Path
5
+
6
+ class MigrationsLoader:
7
+ _migrations_path: Incomplete
8
+ _module_type: Incomplete
9
+ _module_name: Incomplete
10
+ _migrations_files: Incomplete
11
+ def __init__(self, migrations_dir: Path, module_type: ModuleTypes, module_name: str | None = None) -> None: ...
12
+ @property
13
+ def has_initial_migration(self) -> bool: ...
14
+ @property
15
+ def last_migration_number(self) -> int: ...
16
+ def __iter__(self) -> Iterator[MigrationFile]: ...
17
+ def _load_migration_files(self) -> None: ...