amsdal 0.3.1__cp312-cp312-macosx_10_13_universal2.whl → 0.3.3__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 (87) hide show
  1. amsdal/__about__.py +1 -1
  2. amsdal/cloud/__init__.cpython-312-darwin.so +0 -0
  3. amsdal/cloud/client.cpython-312-darwin.so +0 -0
  4. amsdal/cloud/constants.cpython-312-darwin.so +0 -0
  5. amsdal/cloud/enums.cpython-312-darwin.so +0 -0
  6. amsdal/cloud/models/__init__.cpython-312-darwin.so +0 -0
  7. amsdal/cloud/models/base.cpython-312-darwin.so +0 -0
  8. amsdal/cloud/services/__init__.cpython-312-darwin.so +0 -0
  9. amsdal/cloud/services/actions/__init__.cpython-312-darwin.so +0 -0
  10. amsdal/cloud/services/actions/add_allowlist_ip.cpython-312-darwin.so +0 -0
  11. amsdal/cloud/services/actions/add_basic_auth.cpython-312-darwin.so +0 -0
  12. amsdal/cloud/services/actions/add_dependency.cpython-312-darwin.so +0 -0
  13. amsdal/cloud/services/actions/add_secret.cpython-312-darwin.so +0 -0
  14. amsdal/cloud/services/actions/base.cpython-312-darwin.so +0 -0
  15. amsdal/cloud/services/actions/create_deploy.cpython-312-darwin.so +0 -0
  16. amsdal/cloud/services/actions/create_env.cpython-312-darwin.so +0 -0
  17. amsdal/cloud/services/actions/create_session.cpython-312-darwin.so +0 -0
  18. amsdal/cloud/services/actions/delete_allowlist_ip.cpython-312-darwin.so +0 -0
  19. amsdal/cloud/services/actions/delete_basic_auth.cpython-312-darwin.so +0 -0
  20. amsdal/cloud/services/actions/delete_dependency.cpython-312-darwin.so +0 -0
  21. amsdal/cloud/services/actions/delete_env.cpython-312-darwin.so +0 -0
  22. amsdal/cloud/services/actions/delete_secret.cpython-312-darwin.so +0 -0
  23. amsdal/cloud/services/actions/destroy_deploy.cpython-312-darwin.so +0 -0
  24. amsdal/cloud/services/actions/expose_db.cpython-312-darwin.so +0 -0
  25. amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-312-darwin.so +0 -0
  26. amsdal/cloud/services/actions/get_monitoring_info.cpython-312-darwin.so +0 -0
  27. amsdal/cloud/services/actions/list_dependencies.cpython-312-darwin.so +0 -0
  28. amsdal/cloud/services/actions/list_deploys.cpython-312-darwin.so +0 -0
  29. amsdal/cloud/services/actions/list_envs.cpython-312-darwin.so +0 -0
  30. amsdal/cloud/services/actions/list_secrets.cpython-312-darwin.so +0 -0
  31. amsdal/cloud/services/actions/manager.cpython-312-darwin.so +0 -0
  32. amsdal/cloud/services/actions/signup_action.cpython-312-darwin.so +0 -0
  33. amsdal/cloud/services/actions/update_deploy.cpython-312-darwin.so +0 -0
  34. amsdal/cloud/services/auth/__init__.cpython-312-darwin.so +0 -0
  35. amsdal/cloud/services/auth/base.cpython-312-darwin.so +0 -0
  36. amsdal/cloud/services/auth/credentials.cpython-312-darwin.so +0 -0
  37. amsdal/cloud/services/auth/manager.cpython-312-darwin.so +0 -0
  38. amsdal/cloud/services/auth/signup_service.cpython-312-darwin.so +0 -0
  39. amsdal/cloud/services/auth/token.cpython-312-darwin.so +0 -0
  40. amsdal/contrib/__init__.cpython-312-darwin.so +0 -0
  41. amsdal/contrib/auth/decorators/__init__.py +22 -7
  42. amsdal/contrib/auth/lifecycle/consumer.py +172 -0
  43. amsdal/contrib/auth/lifecycle/consumer.pyi +36 -0
  44. amsdal/contrib/auth/models/login_session/hooks/pre_init.py +14 -10
  45. amsdal/contrib/auth/models/user/hooks/post_init.py +19 -0
  46. amsdal/contrib/frontend_configs/lifecycle/consumer.py +45 -0
  47. amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +12 -0
  48. amsdal/fixtures/__init__.cpython-312-darwin.so +0 -0
  49. amsdal/fixtures/manager.cpython-312-darwin.so +0 -0
  50. amsdal/fixtures/manager.pyi +102 -0
  51. amsdal/manager.cpython-312-darwin.so +0 -0
  52. amsdal/manager.pyi +170 -1
  53. amsdal/migration/__init__.cpython-312-darwin.so +0 -0
  54. amsdal/migration/base_migration_schemas.cpython-312-darwin.so +0 -0
  55. amsdal/migration/data_classes.cpython-312-darwin.so +0 -0
  56. amsdal/migration/executors/__init__.cpython-312-darwin.so +0 -0
  57. amsdal/migration/executors/base.cpython-312-darwin.so +0 -0
  58. amsdal/migration/executors/base.pyi +12 -0
  59. amsdal/migration/executors/default_executor.cpython-312-darwin.so +0 -0
  60. amsdal/migration/executors/default_executor.pyi +88 -1
  61. amsdal/migration/executors/state_executor.cpython-312-darwin.so +0 -0
  62. amsdal/migration/file_migration_executor.cpython-312-darwin.so +0 -0
  63. amsdal/migration/file_migration_generator.cpython-312-darwin.so +0 -0
  64. amsdal/migration/file_migration_store.cpython-312-darwin.so +0 -0
  65. amsdal/migration/file_migration_writer.cpython-312-darwin.so +0 -0
  66. amsdal/migration/migrations.cpython-312-darwin.so +0 -0
  67. amsdal/migration/migrations_loader.cpython-312-darwin.so +0 -0
  68. amsdal/migration/schemas_loaders.cpython-312-darwin.so +0 -0
  69. amsdal/migration/utils.cpython-312-darwin.so +0 -0
  70. amsdal/mixins/__init__.cpython-312-darwin.so +0 -0
  71. amsdal/mixins/build_mixin.cpython-312-darwin.so +0 -0
  72. amsdal/mixins/class_versions_mixin.cpython-312-darwin.so +0 -0
  73. amsdal/mixins/class_versions_mixin.pyi +7 -1
  74. amsdal/schemas/core/file/hooks/pre_create.py +13 -0
  75. amsdal/schemas/core/file/hooks/pre_update.py +13 -0
  76. amsdal/schemas/manager.cpython-312-darwin.so +0 -0
  77. amsdal/services/__init__.cpython-312-darwin.so +0 -0
  78. amsdal/services/transaction_execution.cpython-312-darwin.so +0 -0
  79. amsdal/services/transaction_execution.pyi +16 -0
  80. amsdal/utils/rollback/__init__.py +195 -0
  81. amsdal/utils/rollback/__init__.pyi +16 -0
  82. {amsdal-0.3.1.dist-info → amsdal-0.3.3.dist-info}/METADATA +3 -1
  83. {amsdal-0.3.1.dist-info → amsdal-0.3.3.dist-info}/RECORD +87 -87
  84. {amsdal-0.3.1.dist-info → amsdal-0.3.3.dist-info}/LICENSE.txt +0 -0
  85. {amsdal-0.3.1.dist-info → amsdal-0.3.3.dist-info}/WHEEL +0 -0
  86. {amsdal-0.3.1.dist-info → amsdal-0.3.3.dist-info}/licenses/LICENSE.txt +0 -0
  87. {amsdal-0.3.1.dist-info → amsdal-0.3.3.dist-info}/top_level.txt +0 -0
@@ -116,3 +116,105 @@ class FixturesManager:
116
116
  None
117
117
  """
118
118
  def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
119
+
120
+ class AsyncFixturesManager:
121
+ """
122
+ Manager class for handling fixture data.
123
+
124
+ This class is responsible for loading, processing, and applying fixture data
125
+ to the database. It supports nested object construction, data processing,
126
+ and file fixture handling.
127
+ """
128
+ fixtures_path: Incomplete
129
+ fixtures: Incomplete
130
+ _created_cache: Incomplete
131
+ data_to_process: Incomplete
132
+ _class_manager: Incomplete
133
+ _config_manager: Incomplete
134
+ _schema_manager: Incomplete
135
+ def __init__(self, fixtures_path: Path, class_manager: ClassManager, config_manager: AmsdalConfigManager, schema_manager: SchemaManager) -> None: ...
136
+ def load_fixtures(self) -> None:
137
+ """
138
+ Loads fixture data from the specified path.
139
+
140
+ This method reads fixture data from a JSON file located at the `fixtures_path`.
141
+ It populates the `fixtures` dictionary with the loaded data, where each fixture
142
+ is indexed by its external ID.
143
+
144
+ Returns:
145
+ None
146
+ """
147
+ def construct_nested_object(self, external_id: Any) -> Any:
148
+ """
149
+ Constructs a nested object reference from the given external ID.
150
+
151
+ This method takes an external ID and constructs a nested object reference
152
+ dictionary. If the external ID is a dictionary containing an '_object_id' key,
153
+ it extracts the ID. If the external ID is not a string or integer, it returns
154
+ the external ID as is.
155
+
156
+ Args:
157
+ external_id (Any): The external ID to construct the nested object reference from.
158
+
159
+ Returns:
160
+ Any: A dictionary representing the nested object reference or the original
161
+ external ID if it is not a string or integer.
162
+ """
163
+ def _process_object_data(self, model_properties: dict[str, PropertyData], data: dict[str, Any]) -> dict[str, Any]: ...
164
+ def _process_object_value(self, field_configuration: PropertyData | DictSchema | TypeData, value: Any) -> Any: ...
165
+ async def process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
166
+ """
167
+ Processes and saves fixture object data to the database.
168
+
169
+ This method takes the class name, external ID, and data dictionary of a fixture object,
170
+ processes the data according to the class schema, and saves the object to the database.
171
+ If the object already exists, it updates the existing object with the new data.
172
+
173
+ Args:
174
+ class_name (str): The name of the class to which the fixture object belongs.
175
+ external_id (str): The external ID of the fixture object.
176
+ data (dict[str, Any]): The data dictionary of the fixture object.
177
+
178
+ Returns:
179
+ None
180
+ """
181
+ async def process_fixture(self, fixture: dict[str, Any]) -> None:
182
+ """
183
+ Processes a single fixture and adds it to the processing queue.
184
+
185
+ This method takes a fixture dictionary, checks if the fixture already exists in the database,
186
+ and either updates the existing fixture or creates a new one. It then adds the fixture data
187
+ to the processing queue for further processing.
188
+
189
+ Args:
190
+ fixture (dict[str, Any]): The fixture dictionary containing the external ID, class name,
191
+ and data of the fixture.
192
+
193
+ Returns:
194
+ None
195
+ """
196
+ async def apply_fixtures(self) -> None:
197
+ """
198
+ Applies all loaded fixtures to the database.
199
+
200
+ This method processes each fixture in the `fixtures` dictionary in the order
201
+ specified by their 'order' value. It calls the `process_fixture` method for
202
+ each fixture and then processes the data in the processing queue.
203
+
204
+ Returns:
205
+ None
206
+ """
207
+ async def _process_data(self) -> None: ...
208
+ async def apply_file_fixtures(self) -> None:
209
+ """
210
+ Applies file fixtures from the specified directory.
211
+
212
+ This method processes file fixtures located in the 'files' directory adjacent to the
213
+ `fixtures_path`. It iterates through each file, reads its content, and processes it
214
+ as a fixture. If the file fixture already exists in the database, it updates the
215
+ existing fixture; otherwise, it creates a new one.
216
+
217
+ Returns:
218
+ None
219
+ """
220
+ async def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
Binary file
amsdal/manager.pyi CHANGED
@@ -4,7 +4,7 @@ from amsdal.cloud.services.auth.manager import AuthManager as AuthManager
4
4
  from amsdal.cloud.services.auth.signup_service import SignupService as SignupService
5
5
  from amsdal.configs.main import settings as settings
6
6
  from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError, AmsdalMissingCredentialsError as AmsdalMissingCredentialsError, AmsdalRuntimeError as AmsdalRuntimeError, AmsdalSignupError as AmsdalSignupError
7
- from amsdal.fixtures.manager import FixturesManager as FixturesManager
7
+ from amsdal.fixtures.manager import AsyncFixturesManager as AsyncFixturesManager, FixturesManager as FixturesManager
8
8
  from amsdal.mixins.build_mixin import BuildMixin as BuildMixin
9
9
  from amsdal.mixins.class_versions_mixin import ClassVersionsMixin as ClassVersionsMixin
10
10
  from amsdal.schemas.manager import SchemaManager as SchemaManager
@@ -181,3 +181,172 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
181
181
  Returns:
182
182
  None
183
183
  """
184
+
185
+ class AsyncAmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
186
+ """
187
+ Manages the AMSDAL framework components and operations.
188
+
189
+ This class is responsible for initializing, setting up, and managing various components
190
+ of the AMSDAL framework, including connections, data management, schema management,
191
+ and authentication. It also provides methods for building and tearing down the framework.
192
+ """
193
+ _class_manager: ClassManager
194
+ _config_manager: Incomplete
195
+ _config: Incomplete
196
+ _data_application: Incomplete
197
+ _is_setup: bool
198
+ __is_authenticated: bool
199
+ _schema_manager: Incomplete
200
+ _metadata_manager: Incomplete
201
+ _auth_manager: Incomplete
202
+ def __init__(self, *, raise_on_new_signup: bool = False) -> None:
203
+ """
204
+ Initializes all sub managers. Reads the configuration.
205
+
206
+ Returns:
207
+ None
208
+ """
209
+ @property
210
+ def is_setup(self) -> bool: ...
211
+ @property
212
+ def is_authenticated(self) -> bool:
213
+ """
214
+ Indicates if the AMSDAL license authentication process has been passed.
215
+
216
+ This property returns a boolean value indicating whether the AMSDAL license
217
+ authentication process has been successfully completed.
218
+
219
+ Returns:
220
+ bool: True if authenticated, False otherwise.
221
+ """
222
+ def pre_setup(self) -> None:
223
+ """
224
+ Initiates models root path and adds it into sys.path.
225
+
226
+ This method initializes the class manager and sets up the models root path
227
+ as specified in the settings. It ensures that the models root path is added
228
+ to the system path for proper module resolution.
229
+
230
+ Returns:
231
+ None
232
+ """
233
+ async def setup(self) -> None:
234
+ """
235
+ Initiates models root path and the connections.
236
+
237
+ This method sets up the AMSDAL framework by initializing the models root path and
238
+ establishing connections. It ensures that the setup process is only performed once.
239
+
240
+ Raises:
241
+ AmsdalRuntimeError: If the AMSDAL manager is already set up.
242
+
243
+ Returns:
244
+ None
245
+ """
246
+ async def post_setup(self) -> None:
247
+ """
248
+ Registers internal classes and prepares connections (creates internal tables).
249
+ """
250
+ def build(self, source_models_path: Path, source_transactions_path: Path, source_static_files_path: Path, source_fixtures_path: Path, source_migrations_path: Path) -> None:
251
+ """
252
+ Builds the necessary components for the Amsdal framework.
253
+
254
+ This method is used to build the necessary components for the Amsdal framework.
255
+ It takes five parameters which are all of type `Path`.
256
+ These parameters represent the paths to the directories where the corresponding components are located.
257
+
258
+ Args:
259
+ source_models_path (Path): Path to the directory where the source models are located.
260
+ source_transactions_path (Path): Path to the directory where the source transactions are located.
261
+ source_static_files_path (Path): Path to the directory where the source static files are located.
262
+ source_fixtures_path (Path): Path to the directory where the source fixtures are located.
263
+ source_migrations_path (Path): Path to the directory where the source migrations are located.
264
+
265
+ Returns:
266
+ None
267
+
268
+ The method performs the following build steps in order:
269
+ - Builds the models from the `source_models_path` by calling the `build_models` method.
270
+ - Builds the transactions from the `source_transactions_path` by calling the `build_transactions` method.
271
+ - Builds the static files from the `source_static_files_path` by calling the `build_static_files` method.
272
+ - Builds the fixtures from the `source_fixtures_path` by calling the `build_fixtures` method.
273
+
274
+ Note:
275
+ This method is part of the `AmsdalManager` class which includes mixins for `BuildMixin`
276
+ and `ClassVersionsMixin`. It is intended to be used in the Amsdal framework for managing
277
+ and building components.
278
+ """
279
+ def migrate(self) -> None:
280
+ """
281
+ DEPRECATED: Check changes in the models and apply them to the database.
282
+
283
+ This method is deprecated and should not be used. It checks for changes in the models
284
+ and applies them to the database. Use `amsdal.migration.file_migration_generator.FileMigrationGenerator`
285
+ instead.
286
+
287
+ Raises:
288
+ DeprecationWarning: Always raised to indicate that this method is deprecated.
289
+
290
+ Returns:
291
+ None
292
+ """
293
+ def _check_auth(self) -> None: ...
294
+ @property
295
+ def cloud_actions_manager(self) -> CloudActionsManager:
296
+ """
297
+ Provides access to the CloudActionsManager.
298
+
299
+ This property checks if the AMSDAL manager is authenticated and then returns
300
+ an instance of the CloudActionsManager.
301
+
302
+ Returns:
303
+ CloudActionsManager: An instance of the CloudActionsManager.
304
+
305
+ Raises:
306
+ AmsdalAuthenticationError: If the AMSDAL manager is not authenticated.
307
+ """
308
+ def authenticate(self) -> None:
309
+ """
310
+ Run AMSDAL license authentication process.
311
+
312
+ This method runs the AMSDAL license authentication process and sets the
313
+ authentication status accordingly.
314
+
315
+ Returns:
316
+ None
317
+ """
318
+ async def apply_fixtures(self) -> None:
319
+ """
320
+ Loads and applies fixtures defined in your application.
321
+
322
+ This method loads the fixtures from the specified path and applies them to the
323
+ AMSDAL framework. It uses the `FixturesManager` to manage the loading and application
324
+ of the fixtures.
325
+
326
+ Returns:
327
+ None
328
+ """
329
+ def init_classes(self) -> None:
330
+ """
331
+ Initializes and imports classes based on the schema manager's class schemas.
332
+
333
+ This method iterates over the class schemas provided by the schema manager and imports
334
+ the classes into the class manager, excluding those of type `SchemaTypes.TYPE`.
335
+
336
+ Returns:
337
+ None
338
+ """
339
+ async def teardown(self) -> None:
340
+ """
341
+ Clean up everything on the application exit.
342
+
343
+ This method performs a cleanup of all components managed by the AMSDAL framework
344
+ when the application exits. It disconnects and invalidates connections, clears caches,
345
+ and resets the setup status.
346
+
347
+ Raises:
348
+ AmsdalRuntimeError: If the AMSDAL manager is not set up.
349
+
350
+ Returns:
351
+ None
352
+ """
@@ -104,3 +104,15 @@ class BaseMigrationExecutor(ABC, metaclass=abc.ABCMeta):
104
104
  Returns:
105
105
  None
106
106
  """
107
+
108
+ class AsyncBaseMigrationExecutor(BaseMigrationExecutor, metaclass=abc.ABCMeta):
109
+ async def flush_buffer(self) -> None:
110
+ """
111
+ Flushes the migration buffer.
112
+
113
+ This method clears all entries from the main migration buffer, effectively
114
+ resetting it for future migration operations.
115
+
116
+ Returns:
117
+ None
118
+ """
@@ -3,7 +3,7 @@ from _typeshed import Incomplete
3
3
  from amsdal.errors import MigrationsError as MigrationsError
4
4
  from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas
5
5
  from amsdal.migration.data_classes import Action as Action
6
- from amsdal.migration.executors.base import BaseMigrationExecutor as BaseMigrationExecutor
6
+ from amsdal.migration.executors.base import AsyncBaseMigrationExecutor as AsyncBaseMigrationExecutor, BaseMigrationExecutor as BaseMigrationExecutor
7
7
  from amsdal_models.classes.model import Model
8
8
  from amsdal_utils.models.data_models.schema import ObjectSchema
9
9
  from amsdal_utils.models.enums import SchemaTypes, Versions
@@ -95,3 +95,90 @@ class DefaultMigrationExecutor(BaseMigrationExecutor):
95
95
  Returns:
96
96
  None
97
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,6 +1,12 @@
1
+ from amsdal_data.connections.historical.schema_version_manager import AsyncHistoricalSchemaVersionManager, HistoricalSchemaVersionManager
2
+
1
3
  class ClassVersionsMixin:
2
4
  """
3
5
  Mixin class to manage class versions and related table schemas.
4
6
  """
5
7
  @staticmethod
6
- def register_internal_classes() -> None: ...
8
+ def _register_internal_classes(schema_version_manager: HistoricalSchemaVersionManager | AsyncHistoricalSchemaVersionManager) -> None: ...
9
+ @classmethod
10
+ def register_internal_classes(cls) -> None: ...
11
+ @classmethod
12
+ def aregister_internal_classes(cls) -> None: ...
@@ -9,3 +9,16 @@ def pre_create(self) -> None: # type: ignore[no-untyped-def]
9
9
  None
10
10
  """
11
11
  self.size = len(self.data or b'')
12
+
13
+
14
+ async def apre_create(self) -> None: # type: ignore[no-untyped-def]
15
+ """
16
+ Prepares the object for creation by setting its size attribute.
17
+
18
+ This method calculates the size of the object's data and assigns it to the size attribute.
19
+ If the data is None, it defaults to an empty byte string.
20
+
21
+ Args:
22
+ None
23
+ """
24
+ self.size = len(self.data or b'')
@@ -9,3 +9,16 @@ def pre_update(self): # type: ignore[no-untyped-def]
9
9
  None
10
10
  """
11
11
  self.size = len(self.data or b'')
12
+
13
+
14
+ async def apre_update(self): # type: ignore[no-untyped-def]
15
+ """
16
+ Prepares the object for update by setting its size attribute.
17
+
18
+ This method calculates the size of the object's data and assigns it to the size attribute.
19
+ If the data is None, it defaults to an empty byte string.
20
+
21
+ Args:
22
+ None
23
+ """
24
+ self.size = len(self.data or b'')
@@ -41,6 +41,22 @@ class TransactionExecutionService(metaclass=Singleton):
41
41
  and executes the transaction. It handles both synchronous and asynchronous transactions
42
42
  and performs necessary preprocessing of arguments, such as loading references.
43
43
 
44
+ Args:
45
+ transaction_name (str): The name of the transaction to execute.
46
+ args (dict[str, Any]): The arguments to pass to the transaction function.
47
+ load_references (bool, optional): Whether to load references in the arguments. Defaults to True.
48
+
49
+ Returns:
50
+ Any: The result of the transaction execution.
51
+ """
52
+ async def async_execute_transaction(self, transaction_name: str, args: dict[str, Any], *, load_references: bool = True) -> Any:
53
+ """
54
+ Executes a transaction with the given name and arguments.
55
+
56
+ This method retrieves the transaction function by its name, processes the arguments,
57
+ and executes the transaction. It handles both synchronous and asynchronous transactions
58
+ and performs necessary preprocessing of arguments, such as loading references.
59
+
44
60
  Args:
45
61
  transaction_name (str): The name of the transaction to execute.
46
62
  args (dict[str, Any]): The arguments to pass to the transaction function.