amsdal 0.3.6__cp312-cp312-macosx_10_13_universal2.whl → 0.4.0__cp312-cp312-macosx_10_13_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.

Files changed (208) hide show
  1. amsdal/__about__.py +1 -1
  2. amsdal/__migrations__/0000_initial.py +34 -25
  3. amsdal/__migrations__/0001_datetime_type.py +4 -4
  4. amsdal/__migrations__/0002_fixture_order.py +7 -3
  5. amsdal/__migrations__/0003_schema_type_in_class_meta.py +3 -15
  6. amsdal/cloud/__init__.cpython-312-darwin.so +0 -0
  7. amsdal/cloud/client.cpython-312-darwin.so +0 -0
  8. amsdal/cloud/constants.cpython-312-darwin.so +0 -0
  9. amsdal/cloud/enums.cpython-312-darwin.so +0 -0
  10. amsdal/cloud/models/__init__.cpython-312-darwin.so +0 -0
  11. amsdal/cloud/models/base.cpython-312-darwin.so +0 -0
  12. amsdal/cloud/services/__init__.cpython-312-darwin.so +0 -0
  13. amsdal/cloud/services/actions/__init__.cpython-312-darwin.so +0 -0
  14. amsdal/cloud/services/actions/add_allowlist_ip.cpython-312-darwin.so +0 -0
  15. amsdal/cloud/services/actions/add_basic_auth.cpython-312-darwin.so +0 -0
  16. amsdal/cloud/services/actions/add_dependency.cpython-312-darwin.so +0 -0
  17. amsdal/cloud/services/actions/add_secret.cpython-312-darwin.so +0 -0
  18. amsdal/cloud/services/actions/base.cpython-312-darwin.so +0 -0
  19. amsdal/cloud/services/actions/create_deploy.cpython-312-darwin.so +0 -0
  20. amsdal/cloud/services/actions/create_env.cpython-312-darwin.so +0 -0
  21. amsdal/cloud/services/actions/create_session.cpython-312-darwin.so +0 -0
  22. amsdal/cloud/services/actions/delete_allowlist_ip.cpython-312-darwin.so +0 -0
  23. amsdal/cloud/services/actions/delete_basic_auth.cpython-312-darwin.so +0 -0
  24. amsdal/cloud/services/actions/delete_dependency.cpython-312-darwin.so +0 -0
  25. amsdal/cloud/services/actions/delete_env.cpython-312-darwin.so +0 -0
  26. amsdal/cloud/services/actions/delete_secret.cpython-312-darwin.so +0 -0
  27. amsdal/cloud/services/actions/destroy_deploy.cpython-312-darwin.so +0 -0
  28. amsdal/cloud/services/actions/expose_db.cpython-312-darwin.so +0 -0
  29. amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-312-darwin.so +0 -0
  30. amsdal/cloud/services/actions/get_monitoring_info.cpython-312-darwin.so +0 -0
  31. amsdal/cloud/services/actions/list_dependencies.cpython-312-darwin.so +0 -0
  32. amsdal/cloud/services/actions/list_deploys.cpython-312-darwin.so +0 -0
  33. amsdal/cloud/services/actions/list_envs.cpython-312-darwin.so +0 -0
  34. amsdal/cloud/services/actions/list_secrets.cpython-312-darwin.so +0 -0
  35. amsdal/cloud/services/actions/manager.cpython-312-darwin.so +0 -0
  36. amsdal/cloud/services/actions/signup_action.cpython-312-darwin.so +0 -0
  37. amsdal/cloud/services/actions/update_deploy.cpython-312-darwin.so +0 -0
  38. amsdal/cloud/services/auth/__init__.cpython-312-darwin.so +0 -0
  39. amsdal/cloud/services/auth/base.cpython-312-darwin.so +0 -0
  40. amsdal/cloud/services/auth/credentials.cpython-312-darwin.so +0 -0
  41. amsdal/cloud/services/auth/credentials.pyi +0 -1
  42. amsdal/cloud/services/auth/manager.cpython-312-darwin.so +0 -0
  43. amsdal/cloud/services/auth/signup_service.cpython-312-darwin.so +0 -0
  44. amsdal/cloud/services/auth/token.cpython-312-darwin.so +0 -0
  45. amsdal/cloud/services/auth/token.pyi +0 -1
  46. amsdal/configs/main.py +23 -19
  47. amsdal/configs/main.pyi +12 -15
  48. amsdal/contrib/__init__.cpython-312-darwin.so +0 -0
  49. amsdal/contrib/auth/lifecycle/consumer.py +10 -10
  50. amsdal/contrib/auth/migrations/0000_initial.py +41 -7
  51. amsdal/contrib/auth/models/login_session.py +66 -0
  52. amsdal/contrib/auth/models/login_session.pyi +33 -0
  53. amsdal/contrib/auth/models/permission.py +23 -0
  54. amsdal/contrib/auth/models/permission.pyi +18 -0
  55. amsdal/contrib/auth/models/user.py +106 -0
  56. amsdal/contrib/auth/models/user.pyi +46 -0
  57. amsdal/contrib/frontend_configs/conversion/convert.py +47 -15
  58. amsdal/contrib/frontend_configs/conversion/convert.pyi +0 -1
  59. amsdal/contrib/frontend_configs/lifecycle/consumer.py +32 -13
  60. amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +1 -1
  61. amsdal/contrib/frontend_configs/migrations/0000_initial.py +15 -14
  62. amsdal/contrib/frontend_configs/models/__init__.py +0 -0
  63. amsdal/contrib/frontend_configs/models/__init__.pyi +0 -0
  64. amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
  65. amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +12 -0
  66. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
  67. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +7 -0
  68. amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +54 -0
  69. amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +32 -0
  70. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
  71. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +11 -0
  72. amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
  73. amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +8 -0
  74. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
  75. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +8 -0
  76. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
  77. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +9 -0
  78. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
  79. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +10 -0
  80. amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
  81. amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +15 -0
  82. amsdal/contrib/frontend_configs/models/frontend_control_config.py +87 -0
  83. amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +35 -0
  84. amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
  85. amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +9 -0
  86. amsdal/errors.py +0 -3
  87. amsdal/errors.pyi +0 -1
  88. amsdal/fixtures/__init__.cpython-312-darwin.so +0 -0
  89. amsdal/fixtures/manager.cpython-312-darwin.so +0 -0
  90. amsdal/fixtures/manager.pyi +72 -123
  91. amsdal/fixtures/utils.cpython-312-darwin.so +0 -0
  92. amsdal/fixtures/utils.pyi +9 -0
  93. amsdal/manager.cpython-312-darwin.so +0 -0
  94. amsdal/manager.pyi +4 -96
  95. amsdal/mixins/__init__.cpython-312-darwin.so +0 -0
  96. amsdal/mixins/class_versions_mixin.cpython-312-darwin.so +0 -0
  97. amsdal/models/__init__.py +0 -0
  98. amsdal/models/__init__.pyi +0 -0
  99. amsdal/models/core/__init__.py +0 -0
  100. amsdal/models/core/__init__.pyi +0 -0
  101. amsdal/models/core/class_object.py +37 -0
  102. amsdal/models/core/class_object.pyi +24 -0
  103. amsdal/models/core/class_object_meta.py +26 -0
  104. amsdal/models/core/class_object_meta.pyi +15 -0
  105. amsdal/models/core/class_property.py +19 -0
  106. amsdal/models/core/class_property.pyi +10 -0
  107. amsdal/models/core/class_property_meta.py +15 -0
  108. amsdal/models/core/class_property_meta.pyi +10 -0
  109. amsdal/models/core/file.py +156 -0
  110. amsdal/models/core/file.pyi +104 -0
  111. amsdal/models/core/fixture.py +25 -0
  112. amsdal/models/core/fixture.pyi +14 -0
  113. amsdal/models/core/option.py +11 -0
  114. amsdal/models/core/option.pyi +8 -0
  115. amsdal/models/core/validator.py +12 -0
  116. amsdal/models/core/validator.pyi +8 -0
  117. amsdal/models/types/__init__.py +0 -0
  118. amsdal/models/types/__init__.pyi +0 -0
  119. amsdal/models/types/object.py +26 -0
  120. amsdal/models/types/object.pyi +16 -0
  121. amsdal/schemas/core/file/properties/validate_data.py +1 -1
  122. amsdal/schemas/interfaces.py +25 -0
  123. amsdal/schemas/interfaces.pyi +20 -0
  124. amsdal/schemas/manager.cpython-312-darwin.so +0 -0
  125. amsdal/schemas/manager.py +0 -116
  126. amsdal/schemas/manager.pyi +0 -65
  127. amsdal/schemas/mixins/__init__.py +0 -0
  128. amsdal/schemas/mixins/__init__.pyi +0 -0
  129. amsdal/schemas/mixins/check_dependencies_mixin.py +115 -0
  130. amsdal/schemas/mixins/check_dependencies_mixin.pyi +42 -0
  131. amsdal/schemas/mixins/verify_schemas_mixin.py +96 -0
  132. amsdal/schemas/mixins/verify_schemas_mixin.pyi +33 -0
  133. amsdal/schemas/repository.py +84 -0
  134. amsdal/schemas/repository.pyi +22 -0
  135. amsdal/schemas/utils.py +16 -0
  136. amsdal/schemas/utils.pyi +10 -0
  137. amsdal/services/__init__.cpython-312-darwin.so +0 -0
  138. amsdal/services/transaction_execution.cpython-312-darwin.so +0 -0
  139. amsdal/utils/rollback/__init__.py +99 -54
  140. amsdal/utils/tests/helpers.py +46 -37
  141. {amsdal-0.3.6.dist-info → amsdal-0.4.0.dist-info}/METADATA +8 -8
  142. {amsdal-0.3.6.dist-info → amsdal-0.4.0.dist-info}/RECORD +148 -140
  143. amsdal/contrib/auth/models/login_session/hooks/pre_init.py +0 -68
  144. amsdal/contrib/auth/models/login_session/model.json +0 -23
  145. amsdal/contrib/auth/models/login_session/modifiers/display_name.py +0 -11
  146. amsdal/contrib/auth/models/permission/fixtures/basic_permissions.json +0 -62
  147. amsdal/contrib/auth/models/permission/model.json +0 -18
  148. amsdal/contrib/auth/models/permission/modifiers/display_name.py +0 -11
  149. amsdal/contrib/auth/models/user/hooks/post_init.py +0 -76
  150. amsdal/contrib/auth/models/user/hooks/pre_create.py +0 -8
  151. amsdal/contrib/auth/models/user/model.json +0 -25
  152. amsdal/contrib/auth/models/user/modifiers/display_name.py +0 -19
  153. amsdal/contrib/frontend_configs/models/frontend_activator_config/model.json +0 -11
  154. amsdal/contrib/frontend_configs/models/frontend_config_async_validator/model.json +0 -11
  155. amsdal/contrib/frontend_configs/models/frontend_config_group_validator/model.json +0 -52
  156. amsdal/contrib/frontend_configs/models/frontend_config_option/model.json +0 -15
  157. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/model.json +0 -6
  158. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/properties/model_dump.py +0 -13
  159. amsdal/contrib/frontend_configs/models/frontend_config_slider_option/model.json +0 -19
  160. amsdal/contrib/frontend_configs/models/frontend_config_text_mask/model.json +0 -26
  161. amsdal/contrib/frontend_configs/models/frontend_config_validator/model.json +0 -41
  162. amsdal/contrib/frontend_configs/models/frontend_control_config/model.json +0 -250
  163. amsdal/contrib/frontend_configs/models/frontend_model_config/fixtures/permissions.json +0 -24
  164. amsdal/contrib/frontend_configs/models/frontend_model_config/model.json +0 -17
  165. amsdal/contrib/frontend_configs/models/frontent_config_control_action/model.json +0 -54
  166. amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +0 -33
  167. amsdal/migration/__init__.cpython-312-darwin.so +0 -0
  168. amsdal/migration/base_migration_schemas.cpython-312-darwin.so +0 -0
  169. amsdal/migration/base_migration_schemas.pyi +0 -119
  170. amsdal/migration/data_classes.cpython-312-darwin.so +0 -0
  171. amsdal/migration/data_classes.pyi +0 -165
  172. amsdal/migration/executors/__init__.cpython-312-darwin.so +0 -0
  173. amsdal/migration/executors/base.cpython-312-darwin.so +0 -0
  174. amsdal/migration/executors/base.pyi +0 -117
  175. amsdal/migration/executors/default_executor.cpython-312-darwin.so +0 -0
  176. amsdal/migration/executors/default_executor.pyi +0 -184
  177. amsdal/migration/executors/state_executor.cpython-312-darwin.so +0 -0
  178. amsdal/migration/executors/state_executor.pyi +0 -151
  179. amsdal/migration/file_migration_executor.cpython-312-darwin.so +0 -0
  180. amsdal/migration/file_migration_executor.pyi +0 -122
  181. amsdal/migration/file_migration_generator.cpython-312-darwin.so +0 -0
  182. amsdal/migration/file_migration_generator.pyi +0 -229
  183. amsdal/migration/file_migration_store.cpython-312-darwin.so +0 -0
  184. amsdal/migration/file_migration_store.pyi +0 -114
  185. amsdal/migration/file_migration_writer.cpython-312-darwin.so +0 -0
  186. amsdal/migration/file_migration_writer.pyi +0 -73
  187. amsdal/migration/migrations.cpython-312-darwin.so +0 -0
  188. amsdal/migration/migrations.pyi +0 -166
  189. amsdal/migration/migrations_loader.cpython-312-darwin.so +0 -0
  190. amsdal/migration/migrations_loader.pyi +0 -32
  191. amsdal/migration/schemas_loaders.cpython-312-darwin.so +0 -0
  192. amsdal/migration/schemas_loaders.pyi +0 -37
  193. amsdal/migration/templates/data_migration.tmpl +0 -18
  194. amsdal/migration/templates/dict_validator.tmpl +0 -4
  195. amsdal/migration/templates/migration.tmpl +0 -6
  196. amsdal/migration/templates/model_class.tmpl +0 -8
  197. amsdal/migration/templates/model_class_layout.tmpl +0 -24
  198. amsdal/migration/templates/options_validator.tmpl +0 -4
  199. amsdal/migration/utils.cpython-312-darwin.so +0 -0
  200. amsdal/migration/utils.pyi +0 -58
  201. amsdal/mixins/build_mixin.cpython-312-darwin.so +0 -0
  202. amsdal/mixins/build_mixin.pyi +0 -78
  203. /amsdal/{migration/__init__.pyi → contrib/auth/models/__init__.py} +0 -0
  204. /amsdal/{migration/executors → contrib/auth/models}/__init__.pyi +0 -0
  205. {amsdal-0.3.6.dist-info → amsdal-0.4.0.dist-info}/LICENSE.txt +0 -0
  206. {amsdal-0.3.6.dist-info → amsdal-0.4.0.dist-info}/WHEEL +0 -0
  207. {amsdal-0.3.6.dist-info → amsdal-0.4.0.dist-info}/licenses/LICENSE.txt +0 -0
  208. {amsdal-0.3.6.dist-info → amsdal-0.4.0.dist-info}/top_level.txt +0 -0
@@ -1,151 +0,0 @@
1
- from _typeshed import Incomplete
2
- from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas
3
- from amsdal.migration.executors.base import AsyncBaseMigrationExecutor as AsyncBaseMigrationExecutor, BaseMigrationExecutor as BaseMigrationExecutor
4
- from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema
5
- from amsdal_utils.models.enums import SchemaTypes
6
-
7
- class StateMigrationExecutor(BaseMigrationExecutor):
8
- """
9
- Executes state migrations for database schemas.
10
-
11
- This class handles the creation, updating, and deletion of classes in the database schema,
12
- as well as flushing buffered migration operations.
13
-
14
- Attributes:
15
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
16
- do_fetch_latest_version (bool): Flag indicating whether to fetch the latest version of the schema.
17
- """
18
- schemas: Incomplete
19
- do_fetch_latest_version: Incomplete
20
- def __init__(self, schemas: BaseMigrationSchemas, *, do_fetch_latest_version: bool = True) -> None: ...
21
- def create_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
22
- """
23
- Creates a class in the database schema.
24
-
25
- This method registers a new class in the database schema or buffers the class migration
26
- operation based on the schema type and class name.
27
-
28
- Args:
29
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
30
- class_name (str): The name of the class to be created.
31
- object_schema (ObjectSchema): The current object schema.
32
- schema_type (SchemaTypes): The type of the schema.
33
-
34
- Returns:
35
- None
36
- """
37
- def update_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
38
- """
39
- Buffers the class update operation.
40
-
41
- This method adds the class update operation to the migration buffer, which will be processed
42
- when the buffer is flushed.
43
-
44
- Args:
45
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
46
- class_name (str): The name of the class to be updated.
47
- object_schema (ObjectSchema): The current object schema.
48
- schema_type (SchemaTypes): The type of the schema.
49
-
50
- Returns:
51
- None
52
- """
53
- def delete_class(self, schemas: BaseMigrationSchemas, class_name: str, schema_type: SchemaTypes) -> None:
54
- """
55
- Deletes a class from the database schema.
56
-
57
- This method unregisters a class from the database schema based on the provided class name
58
- and schema type.
59
-
60
- Args:
61
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
62
- class_name (str): The name of the class to be deleted.
63
- schema_type (SchemaTypes): The type of the schema.
64
-
65
- Returns:
66
- None
67
- """
68
- def flush_buffer(self) -> None:
69
- """
70
- Flushes the migration buffer and processes the buffered classes.
71
-
72
- This method registers all classes in the migration buffer to the database schema and compiles
73
- the buffered classes. If the `do_fetch_latest_version` flag is set, it also fetches and registers
74
- the latest version of each class.
75
-
76
- Returns:
77
- None
78
- """
79
-
80
- class AsyncStateMigrationExecutor(AsyncBaseMigrationExecutor):
81
- """
82
- Executes state migrations for database schemas.
83
-
84
- This class handles the creation, updating, and deletion of classes in the database schema,
85
- as well as flushing buffered migration operations.
86
-
87
- Attributes:
88
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
89
- do_fetch_latest_version (bool): Flag indicating whether to fetch the latest version of the schema.
90
- """
91
- schemas: Incomplete
92
- do_fetch_latest_version: Incomplete
93
- def __init__(self, schemas: BaseMigrationSchemas, *, do_fetch_latest_version: bool = True) -> None: ...
94
- def create_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
95
- """
96
- Creates a class in the database schema.
97
-
98
- This method registers a new class in the database schema or buffers the class migration
99
- operation based on the schema type and class name.
100
-
101
- Args:
102
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
103
- class_name (str): The name of the class to be created.
104
- object_schema (ObjectSchema): The current object schema.
105
- schema_type (SchemaTypes): The type of the schema.
106
-
107
- Returns:
108
- None
109
- """
110
- def update_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
111
- """
112
- Buffers the class update operation.
113
-
114
- This method adds the class update operation to the migration buffer, which will be processed
115
- when the buffer is flushed.
116
-
117
- Args:
118
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
119
- class_name (str): The name of the class to be updated.
120
- object_schema (ObjectSchema): The current object schema.
121
- schema_type (SchemaTypes): The type of the schema.
122
-
123
- Returns:
124
- None
125
- """
126
- def delete_class(self, schemas: BaseMigrationSchemas, class_name: str, schema_type: SchemaTypes) -> None:
127
- """
128
- Deletes a class from the database schema.
129
-
130
- This method unregisters a class from the database schema based on the provided class name
131
- and schema type.
132
-
133
- Args:
134
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
135
- class_name (str): The name of the class to be deleted.
136
- schema_type (SchemaTypes): The type of the schema.
137
-
138
- Returns:
139
- None
140
- """
141
- async def flush_buffer(self) -> None:
142
- """
143
- Flushes the migration buffer and processes the buffered classes.
144
-
145
- This method registers all classes in the migration buffer to the database schema and compiles
146
- the buffered classes. If the `do_fetch_latest_version` flag is set, it also fetches and registers
147
- the latest version of each class.
148
-
149
- Returns:
150
- None
151
- """
@@ -1,122 +0,0 @@
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 AsyncBaseMigrationExecutor as AsyncBaseMigrationExecutor, BaseMigrationExecutor as BaseMigrationExecutor
6
- from amsdal.migration.executors.state_executor import AsyncStateMigrationExecutor as AsyncStateMigrationExecutor, StateMigrationExecutor as StateMigrationExecutor
7
- from amsdal.migration.file_migration_store import AsyncBaseMigrationStore as AsyncBaseMigrationStore, AsyncFileMigrationStore as AsyncFileMigrationStore, 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
- """
18
- Manager class for executing file migrations.
19
-
20
- Attributes:
21
- migration_address (Address): The address associated with the migration.
22
- core_loader (MigrationsLoader): Loader for core migrations.
23
- contrib_loaders (list[MigrationsLoader]): List of loaders for contributed migrations.
24
- app_loader (MigrationsLoader): Loader for application migrations.
25
- executor (BaseMigrationExecutor): The executor responsible for running migrations.
26
- store (BaseMigrationStore): The store for managing migration files.
27
- """
28
- migration_address: Address
29
- core_loader: Incomplete
30
- contrib_loaders: Incomplete
31
- app_loader: Incomplete
32
- executor: Incomplete
33
- _applied_migration_files: list[MigrationFile]
34
- store: Incomplete
35
- def __init__(self, app_migrations_loader: MigrationsLoader, executor: BaseMigrationExecutor, store: BaseMigrationStore | None = None) -> None: ...
36
- def execute(self, migration_number: int | None = None, module_type: ModuleTypes | None = None, *, fake: bool = False, skip_data_migrations: bool = False) -> list[MigrationResult]:
37
- """
38
- Executes the migrations.
39
-
40
- Args:
41
- migration_number (int | None): The migration number to execute up to. Defaults to None.
42
- module_type (ModuleTypes | None): The type of module to migrate. Defaults to None.
43
- fake (bool): If True, simulates the migration without applying changes. Defaults to False.
44
- skip_data_migrations (bool): If True, skips data migrations. Defaults to False.
45
-
46
- Returns:
47
- list[MigrationResult]: List of results from the migration execution.
48
- """
49
- @staticmethod
50
- def _get_contrib_loaders() -> list[MigrationsLoader]: ...
51
- def _apply(self, migration_number: int | None = None, module_type: ModuleTypes | None = None, *, fake: bool = False, skip_data_migrations: bool = False) -> list[MigrationResult]: ...
52
- def _apply_migrations(self, loader: MigrationsLoader, module_type: ModuleTypes, migration_number: int | None = None, *, fake: bool = False, skip_data_migrations: bool = False) -> list[MigrationResult]: ...
53
- def _register_schemas(self, executor: BaseMigrationExecutor) -> None: ...
54
- def _init_state_from_applied_migrations(self, migrations: list[MigrationFile], module_type: ModuleTypes) -> None: ...
55
- @staticmethod
56
- def get_migration_class(migration: MigrationFile) -> type['Migration']:
57
- """
58
- Retrieves the migration class from the migration file.
59
-
60
- Args:
61
- migration (MigrationFile): The migration file.
62
-
63
- Returns:
64
- type[Migration]: The migration class.
65
- """
66
- def _is_migration_applied(self, migration: MigrationFile, module_type: ModuleTypes) -> bool: ...
67
- @staticmethod
68
- def _map_module_type_to_schema_type(module_type: ModuleTypes) -> SchemaTypes: ...
69
-
70
- class AsyncFileMigrationExecutorManager:
71
- """
72
- Manager class for executing file migrations.
73
-
74
- Attributes:
75
- migration_address (Address): The address associated with the migration.
76
- core_loader (MigrationsLoader): Loader for core migrations.
77
- contrib_loaders (list[MigrationsLoader]): List of loaders for contributed migrations.
78
- app_loader (MigrationsLoader): Loader for application migrations.
79
- executor (BaseMigrationExecutor): The executor responsible for running migrations.
80
- store (BaseMigrationStore): The store for managing migration files.
81
- """
82
- migration_address: Address
83
- core_loader: Incomplete
84
- contrib_loaders: Incomplete
85
- app_loader: Incomplete
86
- executor: Incomplete
87
- _applied_migration_files: list[MigrationFile]
88
- store: Incomplete
89
- def __init__(self, app_migrations_loader: MigrationsLoader, executor: AsyncBaseMigrationExecutor, store: AsyncBaseMigrationStore | None = None) -> None: ...
90
- async def execute(self, migration_number: int | None = None, module_type: ModuleTypes | None = None, *, fake: bool = False, skip_data_migrations: bool = False) -> list[MigrationResult]:
91
- """
92
- Executes the migrations.
93
-
94
- Args:
95
- migration_number (int | None): The migration number to execute up to. Defaults to None.
96
- module_type (ModuleTypes | None): The type of module to migrate. Defaults to None.
97
- fake (bool): If True, simulates the migration without applying changes. Defaults to False.
98
- skip_data_migrations (bool): If True, skips data migrations. Defaults to False.
99
-
100
- Returns:
101
- list[MigrationResult]: List of results from the migration execution.
102
- """
103
- @staticmethod
104
- def _get_contrib_loaders() -> list[MigrationsLoader]: ...
105
- async def _apply(self, migration_number: int | None = None, module_type: ModuleTypes | None = None, *, fake: bool = False, skip_data_migrations: bool = False) -> list[MigrationResult]: ...
106
- async def _apply_migrations(self, loader: MigrationsLoader, module_type: ModuleTypes, migration_number: int | None = None, *, fake: bool = False, skip_data_migrations: bool = False) -> list[MigrationResult]: ...
107
- async def _register_schemas(self, executor: BaseMigrationExecutor) -> None: ...
108
- async def _init_state_from_applied_migrations(self, migrations: list[MigrationFile], module_type: ModuleTypes) -> None: ...
109
- @staticmethod
110
- def get_migration_class(migration: MigrationFile) -> type['Migration']:
111
- """
112
- Retrieves the migration class from the migration file.
113
-
114
- Args:
115
- migration (MigrationFile): The migration file.
116
-
117
- Returns:
118
- type[Migration]: The migration class.
119
- """
120
- def _is_migration_applied(self, migration: MigrationFile, module_type: ModuleTypes) -> bool: ...
121
- @staticmethod
122
- def _map_module_type_to_schema_type(module_type: ModuleTypes) -> SchemaTypes: ...
@@ -1,229 +0,0 @@
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 AsyncStateMigrationExecutor as AsyncStateMigrationExecutor, StateMigrationExecutor as StateMigrationExecutor
6
- from amsdal.migration.file_migration_executor import AsyncFileMigrationExecutorManager as AsyncFileMigrationExecutorManager, FileMigrationExecutorManager as FileMigrationExecutorManager
7
- from amsdal.migration.file_migration_store import AsyncBaseMigrationStore as AsyncBaseMigrationStore, 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_utils.models.data_models.schema import ObjectSchema as ObjectSchema
12
- from amsdal_utils.models.enums import SchemaTypes, Versions
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 AsyncStateMigrationStore(AsyncBaseMigrationStore):
23
- async def save_migration(self, migration: MigrationFile) -> None: ...
24
- async def delete_migration(self, migration: MigrationFile) -> None: ...
25
- async def fetch_migrations(self) -> list[MigrationFile]: ...
26
-
27
- class StateMigrationSchemas(BaseMigrationSchemas):
28
- """
29
- Manages the state of migration schemas.
30
-
31
- Attributes:
32
- state (dict[str, tuple[SchemaTypes, ObjectSchema]]): A dictionary mapping class names to their schema types
33
- and object schemas.
34
- """
35
- state: dict[str, tuple[SchemaTypes, ObjectSchema]]
36
- def __init__(self) -> None: ...
37
- def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes, class_version: str | Versions = ...) -> None:
38
- """
39
- Registers a model with the given class name, object schema, and schema type.
40
-
41
- Args:
42
- class_name (str): The name of the class to register.
43
- object_schema (ObjectSchema): The object schema of the class.
44
- schema_type (SchemaTypes): The type of schema.
45
-
46
- Returns:
47
- None
48
- """
49
- def unregister_model(self, class_name: str) -> None:
50
- """
51
- Unregisters a model with the given class name.
52
-
53
- Args:
54
- class_name (str): The name of the class to unregister.
55
-
56
- Returns:
57
- None
58
- """
59
- def compile_buffered_classes(self) -> None: ...
60
-
61
- class FileMigrationGenerator:
62
- """
63
- Generates migration files based on schema changes.
64
- """
65
- _operations: ClassVar[dict[OperationTypes, Callable[..., MigrateOperation]]]
66
- _app_migrations_path: Incomplete
67
- _app_migrations_loader: Incomplete
68
- _schema_loader: Incomplete
69
- _state: dict[str, tuple[SchemaTypes, ObjectSchema]]
70
- def __init__(self, schema_loader: BaseClassSchemaLoader, app_migrations_path: Path | None = None) -> None: ...
71
- def make_migrations(self, name: str | None = None, *, is_data: bool = False, schema_type: SchemaTypes = ...) -> MigrationFile:
72
- """
73
- Creates migration files based on schema changes.
74
-
75
- Args:
76
- name (str | None): The name of the migration. Defaults to None.
77
- is_data (bool): If True, creates a data migration. Defaults to False.
78
- schema_type (SchemaTypes): The type of schema. Defaults to SchemaTypes.USER.
79
-
80
- Returns:
81
- MigrationFile: The created migration file.
82
-
83
- Raises:
84
- UserWarning: If no changes are detected.
85
- """
86
- def generate_operations(self, schema_type: SchemaTypes) -> list[MigrateOperation]:
87
- """
88
- Generates migration operations based on schema changes.
89
-
90
- Args:
91
- schema_type (SchemaTypes): The type of schema.
92
-
93
- Returns:
94
- list[MigrateOperation]: List of migration operations.
95
- """
96
- def _make_data_migrations(self, name: str | None = None) -> MigrationFile: ...
97
- def _init_state(self) -> None: ...
98
- @classmethod
99
- def build_operations(cls, schema_type: SchemaTypes, class_schema: ObjectSchema, old_class_schema: ObjectSchema | None) -> list[MigrateOperation]:
100
- """
101
- Builds migration operations based on schema changes.
102
-
103
- Args:
104
- schema_type (SchemaTypes): The type of schema.
105
- class_schema (ObjectSchema): The new class schema.
106
- old_class_schema (ObjectSchema | None): The old class schema. Defaults to None.
107
-
108
- Returns:
109
- list[MigrateOperation]: List of migration operations.
110
- """
111
- def write_migration_file(self, operations: list[MigrateOperation], name: str | None = None) -> MigrationFile:
112
- """
113
- Writes migration operations to a file.
114
-
115
- Args:
116
- operations (list[MigrateOperation]): List of migration operations.
117
- name (str | None): The name of the migration. Defaults to None.
118
-
119
- Returns:
120
- MigrationFile: The created migration file.
121
- """
122
- def write_data_migration_file(self, name: str | None = None) -> MigrationFile:
123
- """
124
- Writes data migration operations to a file.
125
-
126
- Args:
127
- name (str | None): The name of the migration. Defaults to None.
128
-
129
- Returns:
130
- MigrationFile: The created data migration file.
131
- """
132
- @staticmethod
133
- def generate_name_from_operations(operations: list[MigrateOperation]) -> str:
134
- """
135
- Generates a name for the migration file based on operations.
136
-
137
- Args:
138
- operations (list[MigrateOperation]): List of migration operations.
139
-
140
- Returns:
141
- str: The generated name.
142
- """
143
- @staticmethod
144
- def _get_migration_file_name(number: int, name: str) -> str: ...
145
-
146
- class AsyncFileMigrationGenerator:
147
- """
148
- Generates migration files based on schema changes.
149
- """
150
- _operations: ClassVar[dict[OperationTypes, Callable[..., MigrateOperation]]]
151
- _app_migrations_path: Incomplete
152
- _app_migrations_loader: Incomplete
153
- _schema_loader: Incomplete
154
- _state: dict[str, tuple[SchemaTypes, ObjectSchema]]
155
- def __init__(self, schema_loader: BaseClassSchemaLoader, app_migrations_path: Path | None = None) -> None: ...
156
- async def make_migrations(self, name: str | None = None, *, is_data: bool = False, schema_type: SchemaTypes = ...) -> MigrationFile:
157
- """
158
- Creates migration files based on schema changes.
159
-
160
- Args:
161
- name (str | None): The name of the migration. Defaults to None.
162
- is_data (bool): If True, creates a data migration. Defaults to False.
163
- schema_type (SchemaTypes): The type of schema. Defaults to SchemaTypes.USER.
164
-
165
- Returns:
166
- MigrationFile: The created migration file.
167
-
168
- Raises:
169
- UserWarning: If no changes are detected.
170
- """
171
- async def generate_operations(self, schema_type: SchemaTypes) -> list[MigrateOperation]:
172
- """
173
- Generates migration operations based on schema changes.
174
-
175
- Args:
176
- schema_type (SchemaTypes): The type of schema.
177
-
178
- Returns:
179
- list[MigrateOperation]: List of migration operations.
180
- """
181
- def _make_data_migrations(self, name: str | None = None) -> MigrationFile: ...
182
- async def _init_state(self) -> None: ...
183
- @classmethod
184
- def build_operations(cls, schema_type: SchemaTypes, class_schema: ObjectSchema, old_class_schema: ObjectSchema | None) -> list[MigrateOperation]:
185
- """
186
- Builds migration operations based on schema changes.
187
-
188
- Args:
189
- schema_type (SchemaTypes): The type of schema.
190
- class_schema (ObjectSchema): The new class schema.
191
- old_class_schema (ObjectSchema | None): The old class schema. Defaults to None.
192
-
193
- Returns:
194
- list[MigrateOperation]: List of migration operations.
195
- """
196
- def write_migration_file(self, operations: list[MigrateOperation], name: str | None = None) -> MigrationFile:
197
- """
198
- Writes migration operations to a file.
199
-
200
- Args:
201
- operations (list[MigrateOperation]): List of migration operations.
202
- name (str | None): The name of the migration. Defaults to None.
203
-
204
- Returns:
205
- MigrationFile: The created migration file.
206
- """
207
- def write_data_migration_file(self, name: str | None = None) -> MigrationFile:
208
- """
209
- Writes data migration operations to a file.
210
-
211
- Args:
212
- name (str | None): The name of the migration. Defaults to None.
213
-
214
- Returns:
215
- MigrationFile: The created data migration file.
216
- """
217
- @staticmethod
218
- def generate_name_from_operations(operations: list[MigrateOperation]) -> str:
219
- """
220
- Generates a name for the migration file based on operations.
221
-
222
- Args:
223
- operations (list[MigrateOperation]): List of migration operations.
224
-
225
- Returns:
226
- str: The generated name.
227
- """
228
- @staticmethod
229
- def _get_migration_file_name(number: int, name: str) -> str: ...
@@ -1,114 +0,0 @@
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.models.data_models.address import Address
8
- from typing import Any, ClassVar
9
-
10
- class BaseMigrationStore(ABC, metaclass=abc.ABCMeta):
11
- @abstractmethod
12
- def fetch_migrations(self) -> list[MigrationFile]: ...
13
- @abstractmethod
14
- def save_migration(self, migration: MigrationFile) -> None: ...
15
- @abstractmethod
16
- def delete_migration(self, migration: MigrationFile) -> None: ...
17
-
18
- class AsyncBaseMigrationStore(ABC, metaclass=abc.ABCMeta):
19
- @abstractmethod
20
- async def fetch_migrations(self) -> list[MigrationFile]: ...
21
- @abstractmethod
22
- async def save_migration(self, migration: MigrationFile) -> None: ...
23
- @abstractmethod
24
- async def delete_migration(self, migration: MigrationFile) -> None: ...
25
-
26
- class FileMigrationStore(BaseMigrationStore):
27
- """
28
- Manages the storage and retrieval of migration files.
29
-
30
- Attributes:
31
- migration_address (Address): The address associated with the migration.
32
- """
33
- MIGRATION_TABLE: ClassVar[str]
34
- migration_address: Address
35
- _operation_manager: Incomplete
36
- def __init__(self) -> None: ...
37
- def fetch_migrations(self) -> list[MigrationFile]:
38
- """
39
- Fetches the list of applied migrations.
40
-
41
- Returns:
42
- list[MigrationFile]: List of applied migration files.
43
- """
44
- def save_migration(self, migration: MigrationFile) -> None:
45
- """
46
- Saves a migration file.
47
-
48
- Args:
49
- migration (MigrationFile): The migration file to save.
50
-
51
- Returns:
52
- None
53
- """
54
- def delete_migration(self, migration: MigrationFile) -> None:
55
- """
56
- Deletes a migration file.
57
-
58
- Args:
59
- migration (MigrationFile): The migration file to delete.
60
-
61
- Returns:
62
- None
63
- """
64
- def _save_historical_data(self, address: Address, data: dict[str, Any], metadata: dict[str, Any]) -> None: ...
65
- @staticmethod
66
- def _build_migration_data(migration: MigrationFile) -> dict[str, Any]: ...
67
- @classmethod
68
- def _build_migration_metadata(cls, migration: MigrationFile, object_id: str | None = None) -> tuple[Address, dict[str, Any]]: ...
69
- def _init_migration_table(self) -> None: ...
70
-
71
- class AsyncFileMigrationStore(AsyncBaseMigrationStore):
72
- """
73
- Manages the storage and retrieval of migration files.
74
-
75
- Attributes:
76
- migration_address (Address): The address associated with the migration.
77
- """
78
- MIGRATION_TABLE: ClassVar[str]
79
- migration_address: Address
80
- _operation_manager: Incomplete
81
- def __init__(self) -> None: ...
82
- async def fetch_migrations(self) -> list[MigrationFile]:
83
- """
84
- Fetches the list of applied migrations.
85
-
86
- Returns:
87
- list[MigrationFile]: List of applied migration files.
88
- """
89
- async def save_migration(self, migration: MigrationFile) -> None:
90
- """
91
- Saves a migration file.
92
-
93
- Args:
94
- migration (MigrationFile): The migration file to save.
95
-
96
- Returns:
97
- None
98
- """
99
- async def delete_migration(self, migration: MigrationFile) -> None:
100
- """
101
- Deletes a migration file.
102
-
103
- Args:
104
- migration (MigrationFile): The migration file to delete.
105
-
106
- Returns:
107
- None
108
- """
109
- async def _save_historical_data(self, address: Address, data: dict[str, Any], metadata: dict[str, Any]) -> None: ...
110
- @staticmethod
111
- def _build_migration_data(migration: MigrationFile) -> dict[str, Any]: ...
112
- @classmethod
113
- def _build_migration_metadata(cls, migration: MigrationFile, object_id: str | None = None) -> tuple[Address, dict[str, Any]]: ...
114
- async def _init_migration_table(self) -> None: ...