amsdal 0.1.26__cp311-cp311-win_amd64.whl → 0.2.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 (163) 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/client.pyi +46 -2
  5. amsdal/cloud/constants.cp311-win_amd64.pyd +0 -0
  6. amsdal/cloud/enums.cp311-win_amd64.pyd +0 -0
  7. amsdal/cloud/enums.pyi +46 -0
  8. amsdal/cloud/models/__init__.cp311-win_amd64.pyd +0 -0
  9. amsdal/cloud/models/base.cp311-win_amd64.pyd +0 -0
  10. amsdal/cloud/models/base.pyi +156 -0
  11. amsdal/cloud/services/__init__.cp311-win_amd64.pyd +0 -0
  12. amsdal/cloud/services/actions/__init__.cp311-win_amd64.pyd +0 -0
  13. amsdal/cloud/services/actions/add_allowlist_ip.cp311-win_amd64.pyd +0 -0
  14. amsdal/cloud/services/actions/add_allowlist_ip.pyi +16 -1
  15. amsdal/cloud/services/actions/add_basic_auth.cp311-win_amd64.pyd +0 -0
  16. amsdal/cloud/services/actions/add_basic_auth.pyi +17 -1
  17. amsdal/cloud/services/actions/add_dependency.cp311-win_amd64.pyd +0 -0
  18. amsdal/cloud/services/actions/add_dependency.pyi +16 -1
  19. amsdal/cloud/services/actions/add_secret.cp311-win_amd64.pyd +0 -0
  20. amsdal/cloud/services/actions/add_secret.pyi +17 -1
  21. amsdal/cloud/services/actions/base.cp311-win_amd64.pyd +0 -0
  22. amsdal/cloud/services/actions/base.pyi +71 -3
  23. amsdal/cloud/services/actions/create_deploy.cp311-win_amd64.pyd +0 -0
  24. amsdal/cloud/services/actions/create_deploy.pyi +33 -3
  25. amsdal/cloud/services/actions/create_env.cp311-win_amd64.pyd +0 -0
  26. amsdal/cloud/services/actions/create_env.pyi +15 -1
  27. amsdal/cloud/services/actions/create_session.cp311-win_amd64.pyd +0 -0
  28. amsdal/cloud/services/actions/create_session.pyi +13 -1
  29. amsdal/cloud/services/actions/delete_allowlist_ip.cp311-win_amd64.pyd +0 -0
  30. amsdal/cloud/services/actions/delete_allowlist_ip.pyi +16 -1
  31. amsdal/cloud/services/actions/delete_basic_auth.cp311-win_amd64.pyd +0 -0
  32. amsdal/cloud/services/actions/delete_basic_auth.pyi +17 -1
  33. amsdal/cloud/services/actions/delete_dependency.cp311-win_amd64.pyd +0 -0
  34. amsdal/cloud/services/actions/delete_dependency.pyi +18 -1
  35. amsdal/cloud/services/actions/delete_env.cp311-win_amd64.pyd +0 -0
  36. amsdal/cloud/services/actions/delete_env.pyi +17 -1
  37. amsdal/cloud/services/actions/delete_secret.cp311-win_amd64.pyd +0 -0
  38. amsdal/cloud/services/actions/delete_secret.pyi +18 -1
  39. amsdal/cloud/services/actions/destroy_deploy.cp311-win_amd64.pyd +0 -0
  40. amsdal/cloud/services/actions/destroy_deploy.pyi +15 -1
  41. amsdal/cloud/services/actions/expose_db.cp311-win_amd64.pyd +0 -0
  42. amsdal/cloud/services/actions/expose_db.pyi +18 -1
  43. amsdal/cloud/services/actions/get_basic_auth_credentials.cp311-win_amd64.pyd +0 -0
  44. amsdal/cloud/services/actions/get_basic_auth_credentials.pyi +17 -1
  45. amsdal/cloud/services/actions/get_monitoring_info.cp311-win_amd64.pyd +0 -0
  46. amsdal/cloud/services/actions/get_monitoring_info.pyi +17 -1
  47. amsdal/cloud/services/actions/list_dependencies.cp311-win_amd64.pyd +0 -0
  48. amsdal/cloud/services/actions/list_dependencies.pyi +17 -1
  49. amsdal/cloud/services/actions/list_deploys.cp311-win_amd64.pyd +0 -0
  50. amsdal/cloud/services/actions/list_deploys.pyi +15 -1
  51. amsdal/cloud/services/actions/list_envs.cp311-win_amd64.pyd +0 -0
  52. amsdal/cloud/services/actions/list_envs.pyi +16 -1
  53. amsdal/cloud/services/actions/list_secrets.cp311-win_amd64.pyd +0 -0
  54. amsdal/cloud/services/actions/list_secrets.pyi +18 -1
  55. amsdal/cloud/services/actions/manager.cp311-win_amd64.pyd +0 -0
  56. amsdal/cloud/services/actions/manager.pyi +254 -20
  57. amsdal/cloud/services/actions/signup_action.cp311-win_amd64.pyd +0 -0
  58. amsdal/cloud/services/actions/signup_action.pyi +16 -1
  59. amsdal/cloud/services/actions/update_deploy.cp311-win_amd64.pyd +0 -0
  60. amsdal/cloud/services/actions/update_deploy.pyi +15 -1
  61. amsdal/cloud/services/auth/__init__.cp311-win_amd64.pyd +0 -0
  62. amsdal/cloud/services/auth/base.cp311-win_amd64.pyd +0 -0
  63. amsdal/cloud/services/auth/credentials.cp311-win_amd64.pyd +0 -0
  64. amsdal/cloud/services/auth/credentials.pyi +12 -1
  65. amsdal/cloud/services/auth/manager.cp311-win_amd64.pyd +0 -0
  66. amsdal/cloud/services/auth/manager.pyi +15 -1
  67. amsdal/cloud/services/auth/signup_service.cp311-win_amd64.pyd +0 -0
  68. amsdal/cloud/services/auth/signup_service.pyi +16 -1
  69. amsdal/cloud/services/auth/token.cp311-win_amd64.pyd +0 -0
  70. amsdal/cloud/services/auth/token.pyi +15 -1
  71. amsdal/configs/constants.py +10 -0
  72. amsdal/configs/constants.pyi +11 -1
  73. amsdal/configs/main.py +132 -19
  74. amsdal/configs/main.pyi +140 -10
  75. amsdal/context/manager.py +39 -0
  76. amsdal/context/manager.pyi +41 -3
  77. amsdal/contrib/__init__.cp311-win_amd64.pyd +0 -0
  78. amsdal/contrib/auth/app.py +12 -0
  79. amsdal/contrib/auth/app.pyi +12 -1
  80. amsdal/contrib/auth/lifecycle/consumer.py +53 -0
  81. amsdal/contrib/auth/lifecycle/consumer.pyi +53 -3
  82. amsdal/contrib/auth/models/login_session/hooks/pre_init.py +13 -0
  83. amsdal/contrib/auth/models/login_session/modifiers/display_name.py +8 -0
  84. amsdal/contrib/auth/models/permission/modifiers/display_name.py +8 -0
  85. amsdal/contrib/auth/models/user/hooks/post_init.py +13 -0
  86. amsdal/contrib/auth/models/user/hooks/pre_create.py +6 -0
  87. amsdal/contrib/auth/models/user/modifiers/display_name.py +8 -0
  88. amsdal/contrib/auth/settings.py +15 -0
  89. amsdal/contrib/auth/settings.pyi +14 -0
  90. amsdal/contrib/frontend_configs/app.py +14 -0
  91. amsdal/contrib/frontend_configs/app.pyi +14 -1
  92. amsdal/contrib/frontend_configs/conversion/convert.py +14 -0
  93. amsdal/contrib/frontend_configs/conversion/convert.pyi +15 -1
  94. amsdal/contrib/frontend_configs/lifecycle/consumer.py +75 -3
  95. amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +77 -6
  96. amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +16 -0
  97. amsdal/contrib/frontend_configs/utils.py +12 -1
  98. amsdal/contrib/frontend_configs/utils.pyi +12 -1
  99. amsdal/fixtures/__init__.cp311-win_amd64.pyd +0 -0
  100. amsdal/fixtures/manager.cp311-win_amd64.pyd +0 -0
  101. amsdal/fixtures/manager.pyi +90 -8
  102. amsdal/manager.cp311-win_amd64.pyd +0 -0
  103. amsdal/manager.pyi +113 -25
  104. amsdal/migration/__init__.cp311-win_amd64.pyd +0 -0
  105. amsdal/migration/base_migration_schemas.cp311-win_amd64.pyd +0 -0
  106. amsdal/migration/base_migration_schemas.pyi +84 -8
  107. amsdal/migration/data_classes.cp311-win_amd64.pyd +0 -0
  108. amsdal/migration/data_classes.pyi +104 -4
  109. amsdal/migration/executors/__init__.cp311-win_amd64.pyd +0 -0
  110. amsdal/migration/executors/base.cp311-win_amd64.pyd +0 -0
  111. amsdal/migration/executors/base.pyi +75 -5
  112. amsdal/migration/executors/default_executor.cp311-win_amd64.pyd +0 -0
  113. amsdal/migration/executors/default_executor.pyi +82 -10
  114. amsdal/migration/executors/state_executor.cp311-win_amd64.pyd +0 -0
  115. amsdal/migration/executors/state_executor.pyi +69 -5
  116. amsdal/migration/file_migration_executor.cp311-win_amd64.pyd +0 -0
  117. amsdal/migration/file_migration_executor.pyi +34 -2
  118. amsdal/migration/file_migration_generator.cp311-win_amd64.pyd +0 -0
  119. amsdal/migration/file_migration_generator.pyi +102 -10
  120. amsdal/migration/file_migration_store.cp311-win_amd64.pyd +0 -0
  121. amsdal/migration/file_migration_store.pyi +36 -8
  122. amsdal/migration/file_migration_writer.cp311-win_amd64.pyd +0 -0
  123. amsdal/migration/file_migration_writer.pyi +60 -5
  124. amsdal/migration/migrations.cp311-win_amd64.pyd +0 -0
  125. amsdal/migration/migrations.pyi +111 -6
  126. amsdal/migration/migrations_loader.cp311-win_amd64.pyd +0 -0
  127. amsdal/migration/migrations_loader.pyi +17 -2
  128. amsdal/migration/schemas_loaders.cp311-win_amd64.pyd +0 -0
  129. amsdal/migration/schemas_loaders.pyi +15 -2
  130. amsdal/migration/utils.cp311-win_amd64.pyd +0 -0
  131. amsdal/migration/utils.pyi +46 -6
  132. amsdal/mixins/__init__.cp311-win_amd64.pyd +0 -0
  133. amsdal/mixins/build_mixin.cp311-win_amd64.pyd +0 -0
  134. amsdal/mixins/build_mixin.pyi +60 -8
  135. amsdal/mixins/class_versions_mixin.cp311-win_amd64.pyd +0 -0
  136. amsdal/mixins/class_versions_mixin.pyi +3 -7
  137. amsdal/schemas/core/class_object/properties/display_name.py +6 -0
  138. amsdal/schemas/core/file/hooks/pre_create.py +9 -0
  139. amsdal/schemas/core/file/hooks/pre_update.py +9 -0
  140. amsdal/schemas/core/file/properties/from_file.py +12 -0
  141. amsdal/schemas/core/file/properties/mimetype.py +8 -0
  142. amsdal/schemas/core/file/properties/to_file.py +12 -0
  143. amsdal/schemas/core/file/properties/validate_data.py +13 -0
  144. amsdal/schemas/manager.cp311-win_amd64.pyd +0 -0
  145. amsdal/schemas/manager.py +53 -2
  146. amsdal/schemas/manager.pyi +55 -5
  147. amsdal/services/__init__.cp311-win_amd64.pyd +0 -0
  148. amsdal/services/transaction_execution.cp311-win_amd64.pyd +0 -0
  149. amsdal/services/transaction_execution.pyi +52 -3
  150. amsdal/utils/contrib_paths.py +10 -0
  151. amsdal/utils/contrib_paths.pyi +11 -1
  152. amsdal/utils/tests/helpers.py +5 -7
  153. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/METADATA +4 -6
  154. amsdal-0.2.0.dist-info/RECORD +254 -0
  155. amsdal/operations/__init__.cp311-win_amd64.pyd +0 -0
  156. amsdal/operations/__init__.pyi +0 -0
  157. amsdal/operations/manager.cp311-win_amd64.pyd +0 -0
  158. amsdal/operations/manager.pyi +0 -24
  159. amsdal-0.1.26.dist-info/RECORD +0 -258
  160. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/LICENSE.txt +0 -0
  161. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/WHEEL +0 -0
  162. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/license_check.py +0 -0
  163. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/top_level.txt +0 -0
@@ -8,8 +8,8 @@ from amsdal.migration.file_migration_store import BaseMigrationStore as BaseMigr
8
8
  from amsdal.migration.file_migration_writer import FileMigrationWriter as FileMigrationWriter
9
9
  from amsdal.migration.migrations_loader import MigrationsLoader as MigrationsLoader
10
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
11
+ from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema
12
+ from amsdal_utils.models.enums import SchemaTypes, Versions
13
13
  from collections.abc import Callable as Callable
14
14
  from pathlib import Path
15
15
  from typing import ClassVar
@@ -20,28 +20,120 @@ class StateMigrationStore(BaseMigrationStore):
20
20
  def fetch_migrations(self) -> list[MigrationFile]: ...
21
21
 
22
22
  class StateMigrationSchemas(BaseMigrationSchemas):
23
+ """
24
+ Manages the state of migration schemas.
25
+
26
+ Attributes:
27
+ state (dict[str, tuple[SchemaTypes, ObjectSchema]]): A dictionary mapping class names to their schema types
28
+ and object schemas.
29
+ """
23
30
  state: Incomplete
24
31
  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: ...
32
+ def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes, class_version: str | Versions = ...) -> None:
33
+ """
34
+ Registers a model with the given class name, object schema, and schema type.
35
+
36
+ Args:
37
+ class_name (str): The name of the class to register.
38
+ object_schema (ObjectSchema): The object schema of the class.
39
+ schema_type (SchemaTypes): The type of schema.
40
+
41
+ Returns:
42
+ None
43
+ """
44
+ def unregister_model(self, class_name: str) -> None:
45
+ """
46
+ Unregisters a model with the given class name.
47
+
48
+ Args:
49
+ class_name (str): The name of the class to unregister.
50
+
51
+ Returns:
52
+ None
53
+ """
27
54
  def compile_buffered_classes(self) -> None: ...
28
55
 
29
56
  class FileMigrationGenerator:
57
+ """
58
+ Generates migration files based on schema changes.
59
+ """
30
60
  _operations: ClassVar[dict[OperationTypes, Callable[..., MigrateOperation]]]
31
61
  _app_migrations_path: Incomplete
32
62
  _app_migrations_loader: Incomplete
33
63
  _schema_loader: Incomplete
34
64
  _state: Incomplete
35
65
  def __init__(self, schema_loader: BaseClassSchemaLoader, app_migrations_path: Path | None = None) -> None: ...
36
- def make_migrations(self, name: str | None = None, *, is_data: bool = False, schema_type: SchemaTypes = ...) -> MigrationFile: ...
37
- def generate_operations(self, schema_type: SchemaTypes) -> list[MigrateOperation]: ...
66
+ def make_migrations(self, name: str | None = None, *, is_data: bool = False, schema_type: SchemaTypes = ...) -> MigrationFile:
67
+ """
68
+ Creates migration files based on schema changes.
69
+
70
+ Args:
71
+ name (str | None): The name of the migration. Defaults to None.
72
+ is_data (bool): If True, creates a data migration. Defaults to False.
73
+ schema_type (SchemaTypes): The type of schema. Defaults to SchemaTypes.USER.
74
+
75
+ Returns:
76
+ MigrationFile: The created migration file.
77
+
78
+ Raises:
79
+ UserWarning: If no changes are detected.
80
+ """
81
+ def generate_operations(self, schema_type: SchemaTypes) -> list[MigrateOperation]:
82
+ """
83
+ Generates migration operations based on schema changes.
84
+
85
+ Args:
86
+ schema_type (SchemaTypes): The type of schema.
87
+
88
+ Returns:
89
+ list[MigrateOperation]: List of migration operations.
90
+ """
38
91
  def _make_data_migrations(self, name: str | None = None) -> MigrationFile: ...
39
92
  def _init_state(self) -> None: ...
40
93
  @classmethod
41
- def build_operations(cls, schema_type: SchemaTypes, class_schema: ObjectSchema, old_class_schema: ObjectSchema | None) -> list[MigrateOperation]: ...
42
- def write_migration_file(self, operations: list[MigrateOperation], name: str | None = None) -> MigrationFile: ...
43
- def write_data_migration_file(self, name: str | None = None) -> MigrationFile: ...
94
+ def build_operations(cls, schema_type: SchemaTypes, class_schema: ObjectSchema, old_class_schema: ObjectSchema | None) -> list[MigrateOperation]:
95
+ """
96
+ Builds migration operations based on schema changes.
97
+
98
+ Args:
99
+ schema_type (SchemaTypes): The type of schema.
100
+ class_schema (ObjectSchema): The new class schema.
101
+ old_class_schema (ObjectSchema | None): The old class schema. Defaults to None.
102
+
103
+ Returns:
104
+ list[MigrateOperation]: List of migration operations.
105
+ """
106
+ def write_migration_file(self, operations: list[MigrateOperation], name: str | None = None) -> MigrationFile:
107
+ """
108
+ Writes migration operations to a file.
109
+
110
+ Args:
111
+ operations (list[MigrateOperation]): List of migration operations.
112
+ name (str | None): The name of the migration. Defaults to None.
113
+
114
+ Returns:
115
+ MigrationFile: The created migration file.
116
+ """
117
+ def write_data_migration_file(self, name: str | None = None) -> MigrationFile:
118
+ """
119
+ Writes data migration operations to a file.
120
+
121
+ Args:
122
+ name (str | None): The name of the migration. Defaults to None.
123
+
124
+ Returns:
125
+ MigrationFile: The created data migration file.
126
+ """
44
127
  @staticmethod
45
- def generate_name_from_operations(operations: list[MigrateOperation]) -> str: ...
128
+ def generate_name_from_operations(operations: list[MigrateOperation]) -> str:
129
+ """
130
+ Generates a name for the migration file based on operations.
131
+
132
+ Args:
133
+ operations (list[MigrateOperation]): List of migration operations.
134
+
135
+ Returns:
136
+ str: The generated name.
137
+ """
46
138
  @staticmethod
47
139
  def _get_migration_file_name(number: int, name: str) -> str: ...
@@ -4,9 +4,8 @@ from abc import ABC, abstractmethod
4
4
  from amsdal.configs.main import settings as settings
5
5
  from amsdal.migration.data_classes import MigrationFile as MigrationFile, ModuleTypes as ModuleTypes
6
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
7
  from amsdal_utils.models.data_models.address import Address
9
- from typing import Any
8
+ from typing import Any, ClassVar
10
9
 
11
10
  class BaseMigrationStore(ABC, metaclass=abc.ABCMeta):
12
11
  @abstractmethod
@@ -17,14 +16,43 @@ class BaseMigrationStore(ABC, metaclass=abc.ABCMeta):
17
16
  def delete_migration(self, migration: MigrationFile) -> None: ...
18
17
 
19
18
  class FileMigrationStore(BaseMigrationStore):
19
+ """
20
+ Manages the storage and retrieval of migration files.
21
+
22
+ Attributes:
23
+ migration_address (Address): The address associated with the migration.
24
+ """
25
+ MIGRATION_TABLE: ClassVar[str]
20
26
  migration_address: Address
21
- _config_manager: Incomplete
22
- _amsdal_config: Incomplete
23
- _connections_manager: Incomplete
27
+ _operation_manager: Incomplete
24
28
  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: ...
29
+ def fetch_migrations(self) -> list[MigrationFile]:
30
+ """
31
+ Fetches the list of applied migrations.
32
+
33
+ Returns:
34
+ list[MigrationFile]: List of applied migration files.
35
+ """
36
+ def save_migration(self, migration: MigrationFile) -> None:
37
+ """
38
+ Saves a migration file.
39
+
40
+ Args:
41
+ migration (MigrationFile): The migration file to save.
42
+
43
+ Returns:
44
+ None
45
+ """
46
+ def delete_migration(self, migration: MigrationFile) -> None:
47
+ """
48
+ Deletes a migration file.
49
+
50
+ Args:
51
+ migration (MigrationFile): The migration file to delete.
52
+
53
+ Returns:
54
+ None
55
+ """
28
56
  def _save_historical_data(self, address: Address, data: dict[str, Any], metadata: dict[str, Any]) -> None: ...
29
57
  @staticmethod
30
58
  def _build_migration_data(migration: MigrationFile) -> dict[str, Any]: ...
@@ -3,16 +3,71 @@ from pathlib import Path
3
3
  from typing import ClassVar
4
4
 
5
5
  class FileMigrationWriter:
6
+ """
7
+ Handles the writing of migration files.
8
+
9
+ Attributes:
10
+ template_path (Path): The path to the migration template file.
11
+ data_template_path (Path): The path to the data migration template file.
12
+ operation_name_map (ClassVar[dict[OperationTypes, str]]): A mapping of operation types to their
13
+ string representations.
14
+ """
6
15
  template_path: Path
7
16
  data_template_path: Path
8
17
  operation_name_map: ClassVar[dict[OperationTypes, str]]
9
18
  @classmethod
10
- def write(cls, file_path: Path, operations: list[MigrateOperation]) -> None: ...
19
+ def write(cls, file_path: Path, operations: list[MigrateOperation]) -> None:
20
+ """
21
+ Writes the migration operations to a file.
22
+
23
+ Args:
24
+ file_path (Path): The path to the migration file.
25
+ operations (list[MigrateOperation]): The list of migration operations to write.
26
+
27
+ Returns:
28
+ None
29
+ """
11
30
  @classmethod
12
- def write_data_migration(cls, file_path: Path) -> None: ...
31
+ def write_data_migration(cls, file_path: Path) -> None:
32
+ """
33
+ Writes a data migration to a file.
34
+
35
+ Args:
36
+ file_path (Path): The path to the data migration file.
37
+
38
+ Returns:
39
+ None
40
+ """
13
41
  @classmethod
14
- def render(cls, operations: list[MigrateOperation]) -> str: ...
42
+ def render(cls, operations: list[MigrateOperation]) -> str:
43
+ """
44
+ Renders the migration operations into a string.
45
+
46
+ Args:
47
+ operations (list[MigrateOperation]): The list of migration operations to render.
48
+
49
+ Returns:
50
+ str: The rendered migration operations as a string.
51
+ """
15
52
  @classmethod
16
- def render_operation(cls, operation: MigrateOperation) -> str: ...
53
+ def render_operation(cls, operation: MigrateOperation) -> str:
54
+ """
55
+ Renders a single migration operation into a string.
56
+
57
+ Args:
58
+ operation (MigrateOperation): The migration operation to render.
59
+
60
+ Returns:
61
+ str: The rendered migration operation as a string.
62
+ """
17
63
  @classmethod
18
- def reformat(cls, content: str) -> str: ...
64
+ def reformat(cls, content: str) -> str:
65
+ """
66
+ Reformats the content using the Black formatter.
67
+
68
+ Args:
69
+ content (str): The content to reformat.
70
+
71
+ Returns:
72
+ str: The reformatted content.
73
+ """
@@ -16,15 +16,60 @@ class Operation(ABC, metaclass=abc.ABCMeta):
16
16
  def backward(self, executor: BaseMigrationExecutor) -> None: ...
17
17
 
18
18
  class SchemaOperation(Operation):
19
+ """
20
+ Base class for schema operations.
21
+
22
+ Attributes:
23
+ forward_args (list[Any]): Arguments for the forward operation.
24
+ backward_args (list[Any]): Arguments for the backward operation.
25
+ forward_method_name (str): Name of the method to call for the forward operation.
26
+ backward_method_name (str): Name of the method to call for the backward operation.
27
+ """
19
28
  forward_args: list[Any]
20
29
  backward_args: list[Any]
21
30
  forward_method_name: str
22
31
  backward_method_name: str
23
- def forward(self, executor: BaseMigrationExecutor) -> None: ...
24
- def forward_schema(self, executor: BaseMigrationExecutor) -> None: ...
25
- def backward(self, executor: BaseMigrationExecutor) -> None: ...
32
+ def forward(self, executor: BaseMigrationExecutor) -> None:
33
+ """
34
+ Executes the forward operation.
35
+
36
+ Args:
37
+ executor (BaseMigrationExecutor): The executor responsible for running migrations.
38
+
39
+ Returns:
40
+ None
41
+ """
42
+ def forward_schema(self, executor: BaseMigrationExecutor) -> None:
43
+ """
44
+ Executes the forward schema operation.
45
+
46
+ Args:
47
+ executor (BaseMigrationExecutor): The executor responsible for running migrations.
48
+
49
+ Returns:
50
+ None
51
+ """
52
+ def backward(self, executor: BaseMigrationExecutor) -> None:
53
+ """
54
+ Executes the backward operation.
55
+
56
+ Args:
57
+ executor (BaseMigrationExecutor): The executor responsible for running migrations.
58
+
59
+ Returns:
60
+ None
61
+ """
26
62
 
27
63
  class CreateClass(SchemaOperation):
64
+ """
65
+ Represents an operation to create a class schema.
66
+
67
+ Attributes:
68
+ forward_method_name (str): The name of the method to call for the forward operation.
69
+ backward_method_name (str): The name of the method to call for the backward operation.
70
+ forward_args (list[Any]): Arguments for the forward operation.
71
+ backward_args (list[Any]): Arguments for the backward operation.
72
+ """
28
73
  forward_method_name: str
29
74
  backward_method_name: str
30
75
  forward_args: Incomplete
@@ -32,6 +77,15 @@ class CreateClass(SchemaOperation):
32
77
  def __init__(self, class_name: str, new_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
33
78
 
34
79
  class UpdateClass(SchemaOperation):
80
+ """
81
+ Represents an operation to update a class schema.
82
+
83
+ Attributes:
84
+ forward_method_name (str): The name of the method to call for the forward operation.
85
+ backward_method_name (str): The name of the method to call for the backward operation.
86
+ forward_args (list[Any]): Arguments for the forward operation.
87
+ backward_args (list[Any]): Arguments for the backward operation.
88
+ """
35
89
  forward_method_name: str
36
90
  backward_method_name: str
37
91
  forward_args: Incomplete
@@ -39,6 +93,15 @@ class UpdateClass(SchemaOperation):
39
93
  def __init__(self, class_name: str, old_schema: dict[str, Any], new_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
40
94
 
41
95
  class DeleteClass(SchemaOperation):
96
+ """
97
+ Represents an operation to delete a class schema.
98
+
99
+ Attributes:
100
+ forward_method_name (str): The name of the method to call for the forward operation.
101
+ backward_method_name (str): The name of the method to call for the backward operation.
102
+ forward_args (list[Any]): Arguments for the forward operation.
103
+ backward_args (list[Any]): Arguments for the backward operation.
104
+ """
42
105
  forward_method_name: str
43
106
  backward_method_name: str
44
107
  forward_args: Incomplete
@@ -48,14 +111,56 @@ class DeleteClass(SchemaOperation):
48
111
  class MigrationSchemas(DefaultMigrationSchemas): ...
49
112
 
50
113
  class MigrateData(Operation):
114
+ """
115
+ Represents a data migration operation.
116
+
117
+ Attributes:
118
+ forward_migration (Callable[[MigrationSchemas \\| BaseMigrationSchemas], None]): The function to call for
119
+ the forward migration.
120
+ backward_migration (Callable[[MigrationSchemas \\| BaseMigrationSchemas], None]): The function to call for
121
+ the backward migration.
122
+ """
51
123
  @staticmethod
52
124
  def noop(schemas: MigrationSchemas) -> None: ...
53
125
  forward_migration: Incomplete
54
126
  backward_migration: Incomplete
55
127
  def __init__(self, forward_migration: Callable[[MigrationSchemas | BaseMigrationSchemas], None], backward_migration: Callable[[MigrationSchemas | BaseMigrationSchemas], None]) -> None: ...
56
- def forward(self, executor: BaseMigrationExecutor) -> None: ...
57
- def backward(self, executor: BaseMigrationExecutor) -> None: ...
58
- def forward_schema(self, executor: BaseMigrationExecutor) -> None: ...
128
+ def forward(self, executor: BaseMigrationExecutor) -> None:
129
+ """
130
+ Executes the forward data migration.
131
+
132
+ Args:
133
+ executor (BaseMigrationExecutor): The executor responsible for running migrations.
134
+
135
+ Returns:
136
+ None
137
+ """
138
+ def backward(self, executor: BaseMigrationExecutor) -> None:
139
+ """
140
+ Executes the backward data migration.
141
+
142
+ Args:
143
+ executor (BaseMigrationExecutor): The executor responsible for running migrations.
144
+
145
+ Returns:
146
+ None
147
+ """
148
+ def forward_schema(self, executor: BaseMigrationExecutor) -> None:
149
+ """
150
+ No-op for forward schema in data migration.
151
+
152
+ Args:
153
+ executor (BaseMigrationExecutor): The executor responsible for running migrations.
154
+
155
+ Returns:
156
+ None
157
+ """
59
158
 
60
159
  class Migration:
160
+ """
161
+ Represents a collection of migration operations.
162
+
163
+ Attributes:
164
+ operations (list[Operation]): The list of migration operations.
165
+ """
61
166
  operations: list[Operation]
@@ -4,14 +4,29 @@ from collections.abc import Iterator
4
4
  from pathlib import Path
5
5
 
6
6
  class MigrationsLoader:
7
+ """
8
+ Loads and manages migration files from a specified directory.
9
+ """
7
10
  _migrations_path: Incomplete
8
11
  _module_type: Incomplete
9
12
  _module_name: Incomplete
10
13
  _migrations_files: Incomplete
11
14
  def __init__(self, migrations_dir: Path, module_type: ModuleTypes, module_name: str | None = None) -> None: ...
12
15
  @property
13
- def has_initial_migration(self) -> bool: ...
16
+ def has_initial_migration(self) -> bool:
17
+ """
18
+ Checks if there is an initial migration file.
19
+
20
+ Returns:
21
+ bool: True if there is an initial migration file, False otherwise.
22
+ """
14
23
  @property
15
- def last_migration_number(self) -> int: ...
24
+ def last_migration_number(self) -> int:
25
+ """
26
+ Gets the number of the last migration file.
27
+
28
+ Returns:
29
+ int: The number of the last migration file, or -1 if there are no migration files.
30
+ """
16
31
  def __iter__(self) -> Iterator[MigrationFile]: ...
17
32
  def _load_migration_files(self) -> None: ...
@@ -4,8 +4,8 @@ from abc import ABC, abstractmethod
4
4
  from amsdal.configs.constants import CORE_SCHEMAS_PATH as CORE_SCHEMAS_PATH, TYPE_SCHEMAS_PATH as TYPE_SCHEMAS_PATH
5
5
  from amsdal.configs.main import settings as settings
6
6
  from amsdal.migration.data_classes import ClassSchema as ClassSchema, ModuleTypes as ModuleTypes
7
- from amsdal_models.schemas.data_models.schema import ObjectSchema
8
7
  from amsdal_models.schemas.mixins.enrich_schemas_mixin import EnrichSchemasMixin
8
+ from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema
9
9
  from collections.abc import Iterator
10
10
  from pathlib import Path
11
11
 
@@ -14,10 +14,23 @@ class BaseClassSchemaLoader(ABC, metaclass=abc.ABCMeta):
14
14
  def iter_app_schemas(self) -> Iterator[ClassSchema]: ...
15
15
 
16
16
  class JsonClassSchemaLoader(EnrichSchemasMixin, BaseClassSchemaLoader):
17
+ """
18
+ Loads and enriches JSON class schemas from a specified root path.
19
+
20
+ Attributes:
21
+ schemas_root_path (Path): The root path to the JSON schemas.
22
+ module_type (ModuleTypes): The type of the module for the schemas.
23
+ """
17
24
  schemas_root_path: Incomplete
18
25
  module_type: Incomplete
19
26
  def __init__(self, schemas_root_path: Path, module_type: ModuleTypes = ...) -> None: ...
20
- def iter_app_schemas(self) -> Iterator[ClassSchema]: ...
27
+ def iter_app_schemas(self) -> Iterator[ClassSchema]:
28
+ """
29
+ Iterates over the application schemas.
30
+
31
+ Yields:
32
+ ClassSchema: The next class schema in the iteration.
33
+ """
21
34
  def _enriched_user_schemas(self) -> list[ObjectSchema]: ...
22
35
  @staticmethod
23
36
  def _load_schemas(schemas_path: Path) -> list[ObjectSchema]: ...
Binary file
@@ -2,17 +2,57 @@ from _typeshed import Incomplete
2
2
  from amsdal.migration.data_classes import ModuleTypes as ModuleTypes
3
3
  from amsdal.schemas.manager import SchemaManager as SchemaManager
4
4
  from amsdal_models.classes.model import Model
5
- from amsdal_models.schemas.data_models.core import DictSchema, LegacyDictSchema, TypeData
6
- from amsdal_models.schemas.data_models.schema import ObjectSchema, PropertyData
5
+ from amsdal_utils.models.data_models.core import DictSchema, LegacyDictSchema, TypeData as TypeData
6
+ from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema, PropertyData as PropertyData
7
7
  from amsdal_utils.models.data_models.table_schema import ArraySchemaModel, DictSchemaModel, JsonSchemaModel, NestedSchemaModel, TableColumnSchema, TableSchema
8
8
  from amsdal_utils.models.enums import SchemaTypes
9
9
  from pathlib import Path
10
10
 
11
11
  reference_schema: Incomplete
12
12
 
13
- def object_schema_to_table_schema(object_schema: ObjectSchema) -> TableSchema: ...
13
+ def object_schema_to_table_schema(object_schema: ObjectSchema) -> TableSchema:
14
+ """
15
+ Converts an ObjectSchema to a TableSchema.
16
+
17
+ Args:
18
+ object_schema (ObjectSchema): The object schema to convert.
19
+
20
+ Returns:
21
+ TableSchema: The converted table schema.
22
+ """
14
23
  def _process_properties(properties: dict[str, PropertyData] | None, required: list[str]) -> list[TableColumnSchema]: ...
15
24
  def _process_property_type(property_type: str, items: TypeData | DictSchema | LegacyDictSchema | None = None, context: dict[str, type | Model | NestedSchemaModel] | None = None) -> type | NestedSchemaModel | ArraySchemaModel | DictSchemaModel | type[JsonSchemaModel]: ...
16
- def schema_to_nested_column_schema(schema: ObjectSchema, context: dict[str, type | Model | NestedSchemaModel]) -> NestedSchemaModel | type: ...
17
- def contrib_to_module_root_path(contrib: str) -> Path: ...
18
- def map_module_type_to_schema_type(module_type: ModuleTypes) -> SchemaTypes: ...
25
+ def schema_to_nested_column_schema(schema: ObjectSchema, context: dict[str, type | Model | NestedSchemaModel]) -> NestedSchemaModel | type:
26
+ """
27
+ Converts an ObjectSchema to a NestedSchemaModel or type.
28
+
29
+ Args:
30
+ schema (ObjectSchema): The schema to convert.
31
+ context (dict[str, type | Model | NestedSchemaModel]): The context for the conversion.
32
+
33
+ Returns:
34
+ NestedSchemaModel | type: The converted nested schema model or type.
35
+ """
36
+ def contrib_to_module_root_path(contrib: str) -> Path:
37
+ """
38
+ Converts a contrib string to the root path of the module.
39
+
40
+ Args:
41
+ contrib (str): The contrib string to convert.
42
+
43
+ Returns:
44
+ Path: The root path of the module.
45
+ """
46
+ def map_module_type_to_schema_type(module_type: ModuleTypes) -> SchemaTypes:
47
+ """
48
+ Maps a ModuleTypes value to a SchemaTypes value.
49
+
50
+ Args:
51
+ module_type (ModuleTypes): The module type to map.
52
+
53
+ Returns:
54
+ SchemaTypes: The corresponding schema type.
55
+
56
+ Raises:
57
+ ValueError: If the module type is unknown.
58
+ """
Binary file
@@ -5,22 +5,74 @@ from amsdal_models.schemas.loaders.cli_fixtures_loader import CliFixturesLoader
5
5
  from pathlib import Path
6
6
 
7
7
  class CliMultiFixturesLoader(CliFixturesLoader):
8
+ """
9
+ Loads multiple fixtures from specified schema directories.
10
+
11
+ Attributes:
12
+ models_with_fixtures (list[tuple[Path, ObjectSchema]]): List of tuples containing the path and object schema
13
+ of models with fixtures.
14
+ """
8
15
  models_with_fixtures: Incomplete
9
16
  def __init__(self, schema_dirs: list[Path]) -> None: ...
10
17
 
11
18
  class BuildMixin:
19
+ """
20
+ Provides methods to build models, transactions, static files, migrations, and fixtures for a CLI application.
21
+ """
12
22
  @classmethod
13
- def build_models(cls, user_schemas_path: Path) -> None: ...
14
- @staticmethod
15
- def build_transactions(cli_app_path: Path) -> None: ...
23
+ def build_models(cls, user_schemas_path: Path) -> None:
24
+ """
25
+ Builds models from the specified user schemas path and predefined schema directories.
26
+
27
+ Args:
28
+ user_schemas_path (Path): The path to the user schemas directory.
29
+
30
+ Returns:
31
+ None
32
+ """
16
33
  @staticmethod
17
- def build_static_files(cli_app_path: Path) -> None: ...
34
+ def build_transactions(cli_app_path: Path) -> None:
35
+ """
36
+ Builds transactions from the specified CLI application path.
37
+
38
+ Args:
39
+ cli_app_path (Path): The path to the CLI application directory.
40
+
41
+ Returns:
42
+ None
43
+ """
18
44
  @staticmethod
19
- def build_migrations(cli_app_path: Path) -> None: ...
45
+ def build_static_files(cli_app_path: Path) -> None:
46
+ """
47
+ Builds static files from the specified CLI application path.
48
+
49
+ Args:
50
+ cli_app_path (Path): The path to the CLI application directory.
51
+
52
+ Returns:
53
+ None
54
+ """
20
55
  @staticmethod
21
- def build_fixtures(cli_app_path: Path) -> None: ...
56
+ def build_migrations(cli_app_path: Path) -> None:
57
+ """
58
+ Builds migrations from the specified CLI application path.
59
+
60
+ Args:
61
+ cli_app_path (Path): The path to the CLI application directory.
62
+
63
+ Returns:
64
+ None
65
+ """
22
66
  @staticmethod
23
- def _reimport_models() -> None:
67
+ def build_fixtures(cli_app_path: Path) -> None:
24
68
  """
25
- Imports all generated models. Important for cases when models are generated already
69
+ Builds fixtures from the specified CLI application path.
70
+
71
+ Args:
72
+ cli_app_path (Path): The path to the CLI application directory.
73
+
74
+ Returns:
75
+ None
26
76
  """
77
+ @staticmethod
78
+ def _reimport_models() -> None: ...