amsdal 0.3.6__cp311-cp311-macosx_10_9_universal2.whl → 0.4.1__cp311-cp311-macosx_10_9_universal2.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of amsdal might be problematic. Click here for more details.

Files changed (209) 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-311-darwin.so +0 -0
  7. amsdal/cloud/client.cpython-311-darwin.so +0 -0
  8. amsdal/cloud/constants.cpython-311-darwin.so +0 -0
  9. amsdal/cloud/enums.cpython-311-darwin.so +0 -0
  10. amsdal/cloud/models/__init__.cpython-311-darwin.so +0 -0
  11. amsdal/cloud/models/base.cpython-311-darwin.so +0 -0
  12. amsdal/cloud/services/__init__.cpython-311-darwin.so +0 -0
  13. amsdal/cloud/services/actions/__init__.cpython-311-darwin.so +0 -0
  14. amsdal/cloud/services/actions/add_allowlist_ip.cpython-311-darwin.so +0 -0
  15. amsdal/cloud/services/actions/add_basic_auth.cpython-311-darwin.so +0 -0
  16. amsdal/cloud/services/actions/add_dependency.cpython-311-darwin.so +0 -0
  17. amsdal/cloud/services/actions/add_secret.cpython-311-darwin.so +0 -0
  18. amsdal/cloud/services/actions/base.cpython-311-darwin.so +0 -0
  19. amsdal/cloud/services/actions/create_deploy.cpython-311-darwin.so +0 -0
  20. amsdal/cloud/services/actions/create_env.cpython-311-darwin.so +0 -0
  21. amsdal/cloud/services/actions/create_session.cpython-311-darwin.so +0 -0
  22. amsdal/cloud/services/actions/delete_allowlist_ip.cpython-311-darwin.so +0 -0
  23. amsdal/cloud/services/actions/delete_basic_auth.cpython-311-darwin.so +0 -0
  24. amsdal/cloud/services/actions/delete_dependency.cpython-311-darwin.so +0 -0
  25. amsdal/cloud/services/actions/delete_env.cpython-311-darwin.so +0 -0
  26. amsdal/cloud/services/actions/delete_secret.cpython-311-darwin.so +0 -0
  27. amsdal/cloud/services/actions/destroy_deploy.cpython-311-darwin.so +0 -0
  28. amsdal/cloud/services/actions/expose_db.cpython-311-darwin.so +0 -0
  29. amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-311-darwin.so +0 -0
  30. amsdal/cloud/services/actions/get_monitoring_info.cpython-311-darwin.so +0 -0
  31. amsdal/cloud/services/actions/list_dependencies.cpython-311-darwin.so +0 -0
  32. amsdal/cloud/services/actions/list_deploys.cpython-311-darwin.so +0 -0
  33. amsdal/cloud/services/actions/list_envs.cpython-311-darwin.so +0 -0
  34. amsdal/cloud/services/actions/list_secrets.cpython-311-darwin.so +0 -0
  35. amsdal/cloud/services/actions/manager.cpython-311-darwin.so +0 -0
  36. amsdal/cloud/services/actions/signup_action.cpython-311-darwin.so +0 -0
  37. amsdal/cloud/services/actions/update_deploy.cpython-311-darwin.so +0 -0
  38. amsdal/cloud/services/auth/__init__.cpython-311-darwin.so +0 -0
  39. amsdal/cloud/services/auth/base.cpython-311-darwin.so +0 -0
  40. amsdal/cloud/services/auth/credentials.cpython-311-darwin.so +0 -0
  41. amsdal/cloud/services/auth/credentials.pyi +0 -1
  42. amsdal/cloud/services/auth/manager.cpython-311-darwin.so +0 -0
  43. amsdal/cloud/services/auth/signup_service.cpython-311-darwin.so +0 -0
  44. amsdal/cloud/services/auth/token.cpython-311-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-311-darwin.so +0 -0
  49. amsdal/contrib/auth/fixtures/basic_permissions.json +64 -0
  50. amsdal/contrib/auth/lifecycle/consumer.py +10 -10
  51. amsdal/contrib/auth/migrations/0000_initial.py +41 -7
  52. amsdal/contrib/auth/models/login_session.py +66 -0
  53. amsdal/contrib/auth/models/login_session.pyi +33 -0
  54. amsdal/contrib/auth/models/permission.py +23 -0
  55. amsdal/contrib/auth/models/permission.pyi +18 -0
  56. amsdal/contrib/auth/models/user.py +106 -0
  57. amsdal/contrib/auth/models/user.pyi +46 -0
  58. amsdal/contrib/frontend_configs/conversion/convert.py +47 -15
  59. amsdal/contrib/frontend_configs/conversion/convert.pyi +0 -1
  60. amsdal/contrib/frontend_configs/lifecycle/consumer.py +32 -13
  61. amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +1 -1
  62. amsdal/contrib/frontend_configs/migrations/0000_initial.py +15 -14
  63. amsdal/contrib/frontend_configs/models/__init__.py +0 -0
  64. amsdal/contrib/frontend_configs/models/__init__.pyi +0 -0
  65. amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
  66. amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +12 -0
  67. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
  68. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +7 -0
  69. amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +54 -0
  70. amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +32 -0
  71. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
  72. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +11 -0
  73. amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
  74. amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +8 -0
  75. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
  76. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +8 -0
  77. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
  78. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +9 -0
  79. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
  80. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +10 -0
  81. amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
  82. amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +15 -0
  83. amsdal/contrib/frontend_configs/models/frontend_control_config.py +87 -0
  84. amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +35 -0
  85. amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
  86. amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +9 -0
  87. amsdal/errors.py +0 -3
  88. amsdal/errors.pyi +0 -1
  89. amsdal/fixtures/__init__.cpython-311-darwin.so +0 -0
  90. amsdal/fixtures/manager.cpython-311-darwin.so +0 -0
  91. amsdal/fixtures/manager.pyi +72 -123
  92. amsdal/fixtures/utils.cpython-311-darwin.so +0 -0
  93. amsdal/fixtures/utils.pyi +9 -0
  94. amsdal/manager.cpython-311-darwin.so +0 -0
  95. amsdal/manager.pyi +4 -96
  96. amsdal/mixins/__init__.cpython-311-darwin.so +0 -0
  97. amsdal/mixins/class_versions_mixin.cpython-311-darwin.so +0 -0
  98. amsdal/models/__init__.py +0 -0
  99. amsdal/models/__init__.pyi +0 -0
  100. amsdal/models/core/__init__.py +0 -0
  101. amsdal/models/core/__init__.pyi +0 -0
  102. amsdal/models/core/class_object.py +37 -0
  103. amsdal/models/core/class_object.pyi +24 -0
  104. amsdal/models/core/class_object_meta.py +26 -0
  105. amsdal/models/core/class_object_meta.pyi +15 -0
  106. amsdal/models/core/class_property.py +19 -0
  107. amsdal/models/core/class_property.pyi +10 -0
  108. amsdal/models/core/class_property_meta.py +15 -0
  109. amsdal/models/core/class_property_meta.pyi +10 -0
  110. amsdal/models/core/file.py +156 -0
  111. amsdal/models/core/file.pyi +104 -0
  112. amsdal/models/core/fixture.py +25 -0
  113. amsdal/models/core/fixture.pyi +14 -0
  114. amsdal/models/core/option.py +11 -0
  115. amsdal/models/core/option.pyi +8 -0
  116. amsdal/models/core/validator.py +12 -0
  117. amsdal/models/core/validator.pyi +8 -0
  118. amsdal/models/types/__init__.py +0 -0
  119. amsdal/models/types/__init__.pyi +0 -0
  120. amsdal/models/types/object.py +26 -0
  121. amsdal/models/types/object.pyi +16 -0
  122. amsdal/schemas/core/file/properties/validate_data.py +1 -1
  123. amsdal/schemas/interfaces.py +25 -0
  124. amsdal/schemas/interfaces.pyi +20 -0
  125. amsdal/schemas/manager.cpython-311-darwin.so +0 -0
  126. amsdal/schemas/manager.py +0 -116
  127. amsdal/schemas/manager.pyi +0 -65
  128. amsdal/schemas/mixins/__init__.py +0 -0
  129. amsdal/schemas/mixins/__init__.pyi +0 -0
  130. amsdal/schemas/mixins/check_dependencies_mixin.py +115 -0
  131. amsdal/schemas/mixins/check_dependencies_mixin.pyi +42 -0
  132. amsdal/schemas/mixins/verify_schemas_mixin.py +96 -0
  133. amsdal/schemas/mixins/verify_schemas_mixin.pyi +33 -0
  134. amsdal/schemas/repository.py +84 -0
  135. amsdal/schemas/repository.pyi +22 -0
  136. amsdal/schemas/utils.py +16 -0
  137. amsdal/schemas/utils.pyi +10 -0
  138. amsdal/services/__init__.cpython-311-darwin.so +0 -0
  139. amsdal/services/transaction_execution.cpython-311-darwin.so +0 -0
  140. amsdal/utils/rollback/__init__.py +99 -54
  141. amsdal/utils/tests/helpers.py +46 -37
  142. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/METADATA +8 -8
  143. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/RECORD +149 -140
  144. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/WHEEL +1 -1
  145. amsdal/contrib/auth/models/login_session/hooks/pre_init.py +0 -68
  146. amsdal/contrib/auth/models/login_session/model.json +0 -23
  147. amsdal/contrib/auth/models/login_session/modifiers/display_name.py +0 -11
  148. amsdal/contrib/auth/models/permission/fixtures/basic_permissions.json +0 -62
  149. amsdal/contrib/auth/models/permission/model.json +0 -18
  150. amsdal/contrib/auth/models/permission/modifiers/display_name.py +0 -11
  151. amsdal/contrib/auth/models/user/hooks/post_init.py +0 -76
  152. amsdal/contrib/auth/models/user/hooks/pre_create.py +0 -8
  153. amsdal/contrib/auth/models/user/model.json +0 -25
  154. amsdal/contrib/auth/models/user/modifiers/display_name.py +0 -19
  155. amsdal/contrib/frontend_configs/models/frontend_activator_config/model.json +0 -11
  156. amsdal/contrib/frontend_configs/models/frontend_config_async_validator/model.json +0 -11
  157. amsdal/contrib/frontend_configs/models/frontend_config_group_validator/model.json +0 -52
  158. amsdal/contrib/frontend_configs/models/frontend_config_option/model.json +0 -15
  159. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/model.json +0 -6
  160. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/properties/model_dump.py +0 -13
  161. amsdal/contrib/frontend_configs/models/frontend_config_slider_option/model.json +0 -19
  162. amsdal/contrib/frontend_configs/models/frontend_config_text_mask/model.json +0 -26
  163. amsdal/contrib/frontend_configs/models/frontend_config_validator/model.json +0 -41
  164. amsdal/contrib/frontend_configs/models/frontend_control_config/model.json +0 -250
  165. amsdal/contrib/frontend_configs/models/frontend_model_config/fixtures/permissions.json +0 -24
  166. amsdal/contrib/frontend_configs/models/frontend_model_config/model.json +0 -17
  167. amsdal/contrib/frontend_configs/models/frontent_config_control_action/model.json +0 -54
  168. amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +0 -33
  169. amsdal/migration/__init__.cpython-311-darwin.so +0 -0
  170. amsdal/migration/base_migration_schemas.cpython-311-darwin.so +0 -0
  171. amsdal/migration/base_migration_schemas.pyi +0 -119
  172. amsdal/migration/data_classes.cpython-311-darwin.so +0 -0
  173. amsdal/migration/data_classes.pyi +0 -165
  174. amsdal/migration/executors/__init__.cpython-311-darwin.so +0 -0
  175. amsdal/migration/executors/base.cpython-311-darwin.so +0 -0
  176. amsdal/migration/executors/base.pyi +0 -117
  177. amsdal/migration/executors/default_executor.cpython-311-darwin.so +0 -0
  178. amsdal/migration/executors/default_executor.pyi +0 -184
  179. amsdal/migration/executors/state_executor.cpython-311-darwin.so +0 -0
  180. amsdal/migration/executors/state_executor.pyi +0 -151
  181. amsdal/migration/file_migration_executor.cpython-311-darwin.so +0 -0
  182. amsdal/migration/file_migration_executor.pyi +0 -122
  183. amsdal/migration/file_migration_generator.cpython-311-darwin.so +0 -0
  184. amsdal/migration/file_migration_generator.pyi +0 -229
  185. amsdal/migration/file_migration_store.cpython-311-darwin.so +0 -0
  186. amsdal/migration/file_migration_store.pyi +0 -114
  187. amsdal/migration/file_migration_writer.cpython-311-darwin.so +0 -0
  188. amsdal/migration/file_migration_writer.pyi +0 -73
  189. amsdal/migration/migrations.cpython-311-darwin.so +0 -0
  190. amsdal/migration/migrations.pyi +0 -166
  191. amsdal/migration/migrations_loader.cpython-311-darwin.so +0 -0
  192. amsdal/migration/migrations_loader.pyi +0 -32
  193. amsdal/migration/schemas_loaders.cpython-311-darwin.so +0 -0
  194. amsdal/migration/schemas_loaders.pyi +0 -37
  195. amsdal/migration/templates/data_migration.tmpl +0 -18
  196. amsdal/migration/templates/dict_validator.tmpl +0 -4
  197. amsdal/migration/templates/migration.tmpl +0 -6
  198. amsdal/migration/templates/model_class.tmpl +0 -8
  199. amsdal/migration/templates/model_class_layout.tmpl +0 -24
  200. amsdal/migration/templates/options_validator.tmpl +0 -4
  201. amsdal/migration/utils.cpython-311-darwin.so +0 -0
  202. amsdal/migration/utils.pyi +0 -58
  203. amsdal/mixins/build_mixin.cpython-311-darwin.so +0 -0
  204. amsdal/mixins/build_mixin.pyi +0 -78
  205. /amsdal/{migration/__init__.pyi → contrib/auth/models/__init__.py} +0 -0
  206. /amsdal/{migration/executors → contrib/auth/models}/__init__.pyi +0 -0
  207. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/LICENSE.txt +0 -0
  208. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/licenses/LICENSE.txt +0 -0
  209. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/top_level.txt +0 -0
@@ -1,184 +0,0 @@
1
- import amsdal_glue as glue
2
- from _typeshed import Incomplete
3
- from amsdal.errors import MigrationsError as MigrationsError
4
- from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas
5
- from amsdal.migration.data_classes import Action as Action
6
- from amsdal.migration.executors.base import AsyncBaseMigrationExecutor as AsyncBaseMigrationExecutor, BaseMigrationExecutor as BaseMigrationExecutor
7
- from amsdal_models.classes.model import Model
8
- from amsdal_utils.models.data_models.schema import ObjectSchema
9
- from amsdal_utils.models.enums import SchemaTypes, Versions
10
- from typing import Any
11
-
12
- class DefaultMigrationExecutor(BaseMigrationExecutor):
13
- """
14
- Default implementation of the BaseMigrationExecutor for handling database schema migrations.
15
-
16
- This class provides concrete implementations for creating, updating, and deleting classes
17
- in the database schema. It also manages schema migration buffers and processes object schemas.
18
- """
19
- schemas: Incomplete
20
- _table_schemas_manager: Incomplete
21
- def __init__(self, schemas: BaseMigrationSchemas) -> None: ...
22
- def create_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
23
- """
24
- Creates a class in the database schema.
25
-
26
- This method registers a new class version if the schema type is `TYPE` and the class name
27
- is not `BaseClasses.OBJECT`.
28
- Otherwise, it buffers the class migration operation for further processing.
29
-
30
- Args:
31
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
32
- class_name (str): The name of the class to be created.
33
- object_schema (ObjectSchema): The schema of the object to be created.
34
- schema_type (SchemaTypes): The type of the schema.
35
-
36
- Returns:
37
- None
38
- """
39
- def update_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
40
- """
41
- Buffers the class update operation.
42
-
43
- This method appends the given class name, object schema, and schema type to both
44
- the non-flushable buffer and the main buffer for further processing.
45
-
46
- Args:
47
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
48
- class_name (str): The name of the class to be updated.
49
- object_schema (ObjectSchema): The current object schema.
50
- schema_type (SchemaTypes): The type of the schema.
51
-
52
- Returns:
53
- None
54
- """
55
- def delete_class(self, schemas: BaseMigrationSchemas, class_name: str, schema_type: SchemaTypes) -> None:
56
- """
57
- Deletes a class from the database schema.
58
-
59
- This method removes the specified class from the database schema and unregisters it from the migration schemas.
60
-
61
- Args:
62
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
63
- class_name (str): The name of the class to be deleted.
64
- schema_type (SchemaTypes): The type of the schema.
65
-
66
- Returns:
67
- None
68
- """
69
- def flush_buffer(self) -> None:
70
- """
71
- Flushes the migration buffer and processes the buffered classes.
72
-
73
- This method registers the buffered classes in the migration schemas, compiles the buffered classes,
74
- and processes each class in the buffer to create tables, save class objects, and migrate historical data.
75
- Finally, it clears the main migration buffer.
76
-
77
- Returns:
78
- None
79
- """
80
- def _check_class(self, schema_reference: glue.SchemaReference, object_schema: ObjectSchema, base_class: type[Model]) -> Action: ...
81
- def _save_class(self, schema_reference: glue.SchemaReference, base_class: type[Model], object_schema: ObjectSchema, action: Action) -> dict[str, Any]: ...
82
- def _save_object_class_meta(self, base_class: type[Model], object_schema: ObjectSchema, schema_type: str) -> None: ...
83
- def _create_table(self, object_schema: ObjectSchema, class_version: str | Versions, using: str | None = None) -> None: ...
84
- def _migrate_historical_data(self, schemas: BaseMigrationSchemas, class_name: str, prior_version: str, new_version: str) -> None: ...
85
- def _clean_data(self, model_class: type[Model], data: dict[str, Any]) -> dict[str, Any]: ...
86
- def _process_object_schema(self, object_schema: ObjectSchema, class_name: str, buffer: list[tuple[str, ObjectSchema, SchemaTypes]]) -> ObjectSchema: ...
87
- def register_schemas(self) -> None:
88
- """
89
- Registers the schemas in the table schemas manager.
90
-
91
- This method retrieves the object schemas from the database, processes them, and registers
92
- them in the table schemas manager. It handles both `ClassObject` and `ClassObjectMeta` schemas,
93
- and ensures that all necessary references are loaded and processed.
94
-
95
- Returns:
96
- None
97
- """
98
-
99
- class DefaultAsyncMigrationExecutor(AsyncBaseMigrationExecutor):
100
- """
101
- Default implementation of the BaseMigrationExecutor for handling database schema migrations.
102
-
103
- This class provides concrete implementations for creating, updating, and deleting classes
104
- in the database schema. It also manages schema migration buffers and processes object schemas.
105
- """
106
- schemas: Incomplete
107
- _table_schemas_manager: Incomplete
108
- def __init__(self, schemas: BaseMigrationSchemas) -> None: ...
109
- def create_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
110
- """
111
- Creates a class in the database schema.
112
-
113
- This method registers a new class version if the schema type is `TYPE` and the class name
114
- is not `BaseClasses.OBJECT`.
115
- Otherwise, it buffers the class migration operation for further processing.
116
-
117
- Args:
118
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
119
- class_name (str): The name of the class to be created.
120
- object_schema (ObjectSchema): The schema of the object to be created.
121
- schema_type (SchemaTypes): The type of the schema.
122
-
123
- Returns:
124
- None
125
- """
126
- def update_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
127
- """
128
- Buffers the class update operation.
129
-
130
- This method appends the given class name, object schema, and schema type to both
131
- the non-flushable buffer and the main buffer for further processing.
132
-
133
- Args:
134
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
135
- class_name (str): The name of the class to be updated.
136
- object_schema (ObjectSchema): The current object schema.
137
- schema_type (SchemaTypes): The type of the schema.
138
-
139
- Returns:
140
- None
141
- """
142
- async def delete_class(self, schemas: BaseMigrationSchemas, class_name: str, schema_type: SchemaTypes) -> None:
143
- """
144
- Deletes a class from the database schema.
145
-
146
- This method removes the specified class from the database schema and unregisters it from the migration schemas.
147
-
148
- Args:
149
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
150
- class_name (str): The name of the class to be deleted.
151
- schema_type (SchemaTypes): The type of the schema.
152
-
153
- Returns:
154
- None
155
- """
156
- async def flush_buffer(self) -> None:
157
- """
158
- Flushes the migration buffer and processes the buffered classes.
159
-
160
- This method registers the buffered classes in the migration schemas, compiles the buffered classes,
161
- and processes each class in the buffer to create tables, save class objects, and migrate historical data.
162
- Finally, it clears the main migration buffer.
163
-
164
- Returns:
165
- None
166
- """
167
- async def _check_class(self, schema_reference: glue.SchemaReference, object_schema: ObjectSchema, base_class: type[Model]) -> Action: ...
168
- async def _save_class(self, schema_reference: glue.SchemaReference, base_class: type[Model], object_schema: ObjectSchema, action: Action) -> dict[str, Any]: ...
169
- async def _save_object_class_meta(self, base_class: type[Model], object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
170
- async def _create_table(self, object_schema: ObjectSchema, class_version: str | Versions, using: str | None = None) -> None: ...
171
- async def _migrate_historical_data(self, schemas: BaseMigrationSchemas, class_name: str, prior_version: str, new_version: str) -> None: ...
172
- def _clean_data(self, model_class: type[Model], data: dict[str, Any]) -> dict[str, Any]: ...
173
- def _process_object_schema(self, object_schema: ObjectSchema, class_name: str, buffer: list[tuple[str, ObjectSchema, SchemaTypes]]) -> ObjectSchema: ...
174
- async def register_schemas(self) -> None:
175
- """
176
- Registers the schemas in the table schemas manager.
177
-
178
- This method retrieves the object schemas from the database, processes them, and registers
179
- them in the table schemas manager. It handles both `ClassObject` and `ClassObjectMeta` schemas,
180
- and ensures that all necessary references are loaded and processed.
181
-
182
- Returns:
183
- None
184
- """
@@ -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: ...