amsdal 0.1.26__cp310-cp310-macosx_10_9_universal2.whl → 0.1.27__cp310-cp310-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 (160) hide show
  1. amsdal/__about__.py +1 -1
  2. amsdal/cloud/__init__.cpython-310-darwin.so +0 -0
  3. amsdal/cloud/client.cpython-310-darwin.so +0 -0
  4. amsdal/cloud/client.pyi +46 -2
  5. amsdal/cloud/constants.cpython-310-darwin.so +0 -0
  6. amsdal/cloud/enums.cpython-310-darwin.so +0 -0
  7. amsdal/cloud/enums.pyi +46 -0
  8. amsdal/cloud/models/__init__.cpython-310-darwin.so +0 -0
  9. amsdal/cloud/models/base.cpython-310-darwin.so +0 -0
  10. amsdal/cloud/models/base.pyi +156 -0
  11. amsdal/cloud/services/__init__.cpython-310-darwin.so +0 -0
  12. amsdal/cloud/services/actions/__init__.cpython-310-darwin.so +0 -0
  13. amsdal/cloud/services/actions/add_allowlist_ip.cpython-310-darwin.so +0 -0
  14. amsdal/cloud/services/actions/add_allowlist_ip.pyi +16 -1
  15. amsdal/cloud/services/actions/add_basic_auth.cpython-310-darwin.so +0 -0
  16. amsdal/cloud/services/actions/add_basic_auth.pyi +17 -1
  17. amsdal/cloud/services/actions/add_dependency.cpython-310-darwin.so +0 -0
  18. amsdal/cloud/services/actions/add_dependency.pyi +16 -1
  19. amsdal/cloud/services/actions/add_secret.cpython-310-darwin.so +0 -0
  20. amsdal/cloud/services/actions/add_secret.pyi +17 -1
  21. amsdal/cloud/services/actions/base.cpython-310-darwin.so +0 -0
  22. amsdal/cloud/services/actions/base.pyi +71 -3
  23. amsdal/cloud/services/actions/create_deploy.cpython-310-darwin.so +0 -0
  24. amsdal/cloud/services/actions/create_deploy.pyi +33 -3
  25. amsdal/cloud/services/actions/create_env.cpython-310-darwin.so +0 -0
  26. amsdal/cloud/services/actions/create_env.pyi +15 -1
  27. amsdal/cloud/services/actions/create_session.cpython-310-darwin.so +0 -0
  28. amsdal/cloud/services/actions/create_session.pyi +13 -1
  29. amsdal/cloud/services/actions/delete_allowlist_ip.cpython-310-darwin.so +0 -0
  30. amsdal/cloud/services/actions/delete_allowlist_ip.pyi +16 -1
  31. amsdal/cloud/services/actions/delete_basic_auth.cpython-310-darwin.so +0 -0
  32. amsdal/cloud/services/actions/delete_basic_auth.pyi +17 -1
  33. amsdal/cloud/services/actions/delete_dependency.cpython-310-darwin.so +0 -0
  34. amsdal/cloud/services/actions/delete_dependency.pyi +18 -1
  35. amsdal/cloud/services/actions/delete_env.cpython-310-darwin.so +0 -0
  36. amsdal/cloud/services/actions/delete_env.pyi +17 -1
  37. amsdal/cloud/services/actions/delete_secret.cpython-310-darwin.so +0 -0
  38. amsdal/cloud/services/actions/delete_secret.pyi +18 -1
  39. amsdal/cloud/services/actions/destroy_deploy.cpython-310-darwin.so +0 -0
  40. amsdal/cloud/services/actions/destroy_deploy.pyi +15 -1
  41. amsdal/cloud/services/actions/expose_db.cpython-310-darwin.so +0 -0
  42. amsdal/cloud/services/actions/expose_db.pyi +18 -1
  43. amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-310-darwin.so +0 -0
  44. amsdal/cloud/services/actions/get_basic_auth_credentials.pyi +17 -1
  45. amsdal/cloud/services/actions/get_monitoring_info.cpython-310-darwin.so +0 -0
  46. amsdal/cloud/services/actions/get_monitoring_info.pyi +17 -1
  47. amsdal/cloud/services/actions/list_dependencies.cpython-310-darwin.so +0 -0
  48. amsdal/cloud/services/actions/list_dependencies.pyi +17 -1
  49. amsdal/cloud/services/actions/list_deploys.cpython-310-darwin.so +0 -0
  50. amsdal/cloud/services/actions/list_deploys.pyi +15 -1
  51. amsdal/cloud/services/actions/list_envs.cpython-310-darwin.so +0 -0
  52. amsdal/cloud/services/actions/list_envs.pyi +16 -1
  53. amsdal/cloud/services/actions/list_secrets.cpython-310-darwin.so +0 -0
  54. amsdal/cloud/services/actions/list_secrets.pyi +18 -1
  55. amsdal/cloud/services/actions/manager.cpython-310-darwin.so +0 -0
  56. amsdal/cloud/services/actions/manager.pyi +254 -20
  57. amsdal/cloud/services/actions/signup_action.cpython-310-darwin.so +0 -0
  58. amsdal/cloud/services/actions/signup_action.pyi +16 -1
  59. amsdal/cloud/services/actions/update_deploy.cpython-310-darwin.so +0 -0
  60. amsdal/cloud/services/actions/update_deploy.pyi +15 -1
  61. amsdal/cloud/services/auth/__init__.cpython-310-darwin.so +0 -0
  62. amsdal/cloud/services/auth/base.cpython-310-darwin.so +0 -0
  63. amsdal/cloud/services/auth/credentials.cpython-310-darwin.so +0 -0
  64. amsdal/cloud/services/auth/credentials.pyi +12 -1
  65. amsdal/cloud/services/auth/manager.cpython-310-darwin.so +0 -0
  66. amsdal/cloud/services/auth/manager.pyi +15 -1
  67. amsdal/cloud/services/auth/signup_service.cpython-310-darwin.so +0 -0
  68. amsdal/cloud/services/auth/signup_service.pyi +16 -1
  69. amsdal/cloud/services/auth/token.cpython-310-darwin.so +0 -0
  70. amsdal/cloud/services/auth/token.pyi +15 -1
  71. amsdal/configs/constants.py +10 -0
  72. amsdal/configs/constants.pyi +11 -1
  73. amsdal/configs/main.py +132 -19
  74. amsdal/configs/main.pyi +140 -10
  75. amsdal/context/manager.py +39 -0
  76. amsdal/context/manager.pyi +41 -3
  77. amsdal/contrib/__init__.cpython-310-darwin.so +0 -0
  78. amsdal/contrib/auth/app.py +12 -0
  79. amsdal/contrib/auth/app.pyi +12 -1
  80. amsdal/contrib/auth/lifecycle/consumer.py +53 -0
  81. amsdal/contrib/auth/lifecycle/consumer.pyi +53 -3
  82. amsdal/contrib/auth/models/login_session/hooks/pre_init.py +13 -0
  83. amsdal/contrib/auth/models/login_session/modifiers/display_name.py +8 -0
  84. amsdal/contrib/auth/models/permission/modifiers/display_name.py +8 -0
  85. amsdal/contrib/auth/models/user/hooks/post_init.py +13 -0
  86. amsdal/contrib/auth/models/user/hooks/pre_create.py +6 -0
  87. amsdal/contrib/auth/models/user/modifiers/display_name.py +8 -0
  88. amsdal/contrib/auth/settings.py +15 -0
  89. amsdal/contrib/auth/settings.pyi +14 -0
  90. amsdal/contrib/frontend_configs/app.py +14 -0
  91. amsdal/contrib/frontend_configs/app.pyi +14 -1
  92. amsdal/contrib/frontend_configs/conversion/convert.py +14 -0
  93. amsdal/contrib/frontend_configs/conversion/convert.pyi +15 -1
  94. amsdal/contrib/frontend_configs/lifecycle/consumer.py +72 -0
  95. amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +76 -5
  96. amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +16 -0
  97. amsdal/contrib/frontend_configs/utils.py +12 -1
  98. amsdal/contrib/frontend_configs/utils.pyi +12 -1
  99. amsdal/fixtures/__init__.cpython-310-darwin.so +0 -0
  100. amsdal/fixtures/manager.cpython-310-darwin.so +0 -0
  101. amsdal/fixtures/manager.pyi +88 -6
  102. amsdal/manager.cpython-310-darwin.so +0 -0
  103. amsdal/manager.pyi +113 -17
  104. amsdal/migration/__init__.cpython-310-darwin.so +0 -0
  105. amsdal/migration/base_migration_schemas.cpython-310-darwin.so +0 -0
  106. amsdal/migration/base_migration_schemas.pyi +81 -5
  107. amsdal/migration/data_classes.cpython-310-darwin.so +0 -0
  108. amsdal/migration/data_classes.pyi +95 -1
  109. amsdal/migration/executors/__init__.cpython-310-darwin.so +0 -0
  110. amsdal/migration/executors/base.cpython-310-darwin.so +0 -0
  111. amsdal/migration/executors/base.pyi +74 -4
  112. amsdal/migration/executors/default_executor.cpython-310-darwin.so +0 -0
  113. amsdal/migration/executors/default_executor.pyi +75 -5
  114. amsdal/migration/executors/state_executor.cpython-310-darwin.so +0 -0
  115. amsdal/migration/executors/state_executor.pyi +68 -4
  116. amsdal/migration/file_migration_executor.cpython-310-darwin.so +0 -0
  117. amsdal/migration/file_migration_executor.pyi +34 -2
  118. amsdal/migration/file_migration_generator.cpython-310-darwin.so +0 -0
  119. amsdal/migration/file_migration_generator.pyi +100 -8
  120. amsdal/migration/file_migration_store.cpython-310-darwin.so +0 -0
  121. amsdal/migration/file_migration_store.pyi +33 -3
  122. amsdal/migration/file_migration_writer.cpython-310-darwin.so +0 -0
  123. amsdal/migration/file_migration_writer.pyi +60 -5
  124. amsdal/migration/migrations.cpython-310-darwin.so +0 -0
  125. amsdal/migration/migrations.pyi +111 -6
  126. amsdal/migration/migrations_loader.cpython-310-darwin.so +0 -0
  127. amsdal/migration/migrations_loader.pyi +17 -2
  128. amsdal/migration/schemas_loaders.cpython-310-darwin.so +0 -0
  129. amsdal/migration/schemas_loaders.pyi +14 -1
  130. amsdal/migration/utils.cpython-310-darwin.so +0 -0
  131. amsdal/migration/utils.pyi +44 -4
  132. amsdal/mixins/__init__.cpython-310-darwin.so +0 -0
  133. amsdal/mixins/build_mixin.cpython-310-darwin.so +0 -0
  134. amsdal/mixins/build_mixin.pyi +60 -8
  135. amsdal/mixins/class_versions_mixin.cpython-310-darwin.so +0 -0
  136. amsdal/mixins/class_versions_mixin.pyi +20 -2
  137. amsdal/operations/__init__.cpython-310-darwin.so +0 -0
  138. amsdal/operations/manager.cpython-310-darwin.so +0 -0
  139. amsdal/operations/manager.pyi +31 -3
  140. amsdal/schemas/core/class_object/properties/display_name.py +6 -0
  141. amsdal/schemas/core/file/hooks/pre_create.py +9 -0
  142. amsdal/schemas/core/file/hooks/pre_update.py +9 -0
  143. amsdal/schemas/core/file/properties/from_file.py +12 -0
  144. amsdal/schemas/core/file/properties/mimetype.py +8 -0
  145. amsdal/schemas/core/file/properties/to_file.py +12 -0
  146. amsdal/schemas/core/file/properties/validate_data.py +13 -0
  147. amsdal/schemas/manager.cpython-310-darwin.so +0 -0
  148. amsdal/schemas/manager.py +51 -0
  149. amsdal/schemas/manager.pyi +54 -4
  150. amsdal/services/__init__.cpython-310-darwin.so +0 -0
  151. amsdal/services/transaction_execution.cpython-310-darwin.so +0 -0
  152. amsdal/services/transaction_execution.pyi +52 -3
  153. amsdal/utils/contrib_paths.py +10 -0
  154. amsdal/utils/contrib_paths.pyi +11 -1
  155. {amsdal-0.1.26.dist-info → amsdal-0.1.27.dist-info}/METADATA +1 -1
  156. amsdal-0.1.27.dist-info/RECORD +257 -0
  157. amsdal-0.1.26.dist-info/RECORD +0 -257
  158. {amsdal-0.1.26.dist-info → amsdal-0.1.27.dist-info}/LICENSE.txt +0 -0
  159. {amsdal-0.1.26.dist-info → amsdal-0.1.27.dist-info}/WHEEL +0 -0
  160. {amsdal-0.1.26.dist-info → amsdal-0.1.27.dist-info}/top_level.txt +0 -0
@@ -4,6 +4,22 @@ from pydantic import field_validator
4
4
  @field_validator('action', mode='after') # type: ignore[misc]
5
5
  @classmethod
6
6
  def validate_action(cls, v: str) -> str: # type: ignore[no-untyped-def] # noqa: ARG001
7
+ """
8
+ Validates the action string to ensure it is one of the allowed values.
9
+
10
+ This method checks if the action string starts with 'navigate::' or is one of the predefined
11
+ actions. If the action string is invalid, it raises a ValueError.
12
+
13
+ Args:
14
+ cls: The class this method is attached to.
15
+ v (str): The action string to validate.
16
+
17
+ Returns:
18
+ str: The validated action string.
19
+
20
+ Raises:
21
+ ValueError: If the action string is not valid.
22
+ """
7
23
  if not v.startswith('navigate::') and v not in [
8
24
  'goPrev',
9
25
  'goNext',
@@ -3,7 +3,18 @@ from typing import Any
3
3
 
4
4
  def merge_ui_configs(base: dict[str, Any], override: dict[str, Any]) -> dict[str, Any]:
5
5
  """
6
- Merge two UI configs together. The override config will take precedence over the base config.
6
+ Merges two UI configs together. The override config will take precedence over the base config.
7
+
8
+ This function recursively merges two dictionaries representing UI configurations.
9
+ If a key exists in both dictionaries, the value from the override dictionary will be used.
10
+ If the value is a dictionary or a list, the function will merge them recursively.
11
+
12
+ Args:
13
+ base (dict[str, Any]): The base UI configuration dictionary.
14
+ override (dict[str, Any]): The override UI configuration dictionary.
15
+
16
+ Returns:
17
+ dict[str, Any]: The merged UI configuration dictionary.
7
18
  """
8
19
  for key, value in override.items():
9
20
  if key not in base:
@@ -2,5 +2,16 @@ from typing import Any
2
2
 
3
3
  def merge_ui_configs(base: dict[str, Any], override: dict[str, Any]) -> dict[str, Any]:
4
4
  """
5
- Merge two UI configs together. The override config will take precedence over the base config.
5
+ Merges two UI configs together. The override config will take precedence over the base config.
6
+
7
+ This function recursively merges two dictionaries representing UI configurations.
8
+ If a key exists in both dictionaries, the value from the override dictionary will be used.
9
+ If the value is a dictionary or a list, the function will merge them recursively.
10
+
11
+ Args:
12
+ base (dict[str, Any]): The base UI configuration dictionary.
13
+ override (dict[str, Any]): The override UI configuration dictionary.
14
+
15
+ Returns:
16
+ dict[str, Any]: The merged UI configuration dictionary.
6
17
  """
@@ -16,6 +16,13 @@ class FixtureData(BaseModel):
16
16
  data: dict[str, Any]
17
17
 
18
18
  class FixturesManager:
19
+ """
20
+ Manager class for handling fixture data.
21
+
22
+ This class is responsible for loading, processing, and applying fixture data
23
+ to the database. It supports nested object construction, data processing,
24
+ and file fixture handling.
25
+ """
19
26
  fixtures_path: Incomplete
20
27
  fixtures: Incomplete
21
28
  _created_cache: Incomplete
@@ -24,13 +31,88 @@ class FixturesManager:
24
31
  _config_manager: Incomplete
25
32
  _schema_manager: Incomplete
26
33
  def __init__(self, fixtures_path: Path, class_manager: ClassManager, config_manager: AmsdalConfigManager, schema_manager: SchemaManager) -> None: ...
27
- def load_fixtures(self) -> None: ...
28
- def construct_nested_object(self, external_id: Any) -> Any: ...
34
+ def load_fixtures(self) -> None:
35
+ """
36
+ Loads fixture data from the specified path.
37
+
38
+ This method reads fixture data from a JSON file located at the `fixtures_path`.
39
+ It populates the `fixtures` dictionary with the loaded data, where each fixture
40
+ is indexed by its external ID.
41
+
42
+ Returns:
43
+ None
44
+ """
45
+ def construct_nested_object(self, external_id: Any) -> Any:
46
+ """
47
+ Constructs a nested object reference from the given external ID.
48
+
49
+ This method takes an external ID and constructs a nested object reference
50
+ dictionary. If the external ID is a dictionary containing an '_object_id' key,
51
+ it extracts the ID. If the external ID is not a string or integer, it returns
52
+ the external ID as is.
53
+
54
+ Args:
55
+ external_id (Any): The external ID to construct the nested object reference from.
56
+
57
+ Returns:
58
+ Any: A dictionary representing the nested object reference or the original
59
+ external ID if it is not a string or integer.
60
+ """
29
61
  def _process_object_data(self, model_properties: dict[str, PropertyData], data: dict[str, Any]) -> dict[str, Any]: ...
30
62
  def _process_object_value(self, field_configuration: PropertyData | DictSchema | TypeData, value: Any) -> Any: ...
31
- def process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None: ...
32
- def process_fixture(self, fixture: dict[str, Any]) -> None: ...
33
- def apply_fixtures(self) -> None: ...
63
+ def process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
64
+ """
65
+ Processes and saves fixture object data to the database.
66
+
67
+ This method takes the class name, external ID, and data dictionary of a fixture object,
68
+ processes the data according to the class schema, and saves the object to the database.
69
+ If the object already exists, it updates the existing object with the new data.
70
+
71
+ Args:
72
+ class_name (str): The name of the class to which the fixture object belongs.
73
+ external_id (str): The external ID of the fixture object.
74
+ data (dict[str, Any]): The data dictionary of the fixture object.
75
+
76
+ Returns:
77
+ None
78
+ """
79
+ def process_fixture(self, fixture: dict[str, Any]) -> None:
80
+ """
81
+ Processes a single fixture and adds it to the processing queue.
82
+
83
+ This method takes a fixture dictionary, checks if the fixture already exists in the database,
84
+ and either updates the existing fixture or creates a new one. It then adds the fixture data
85
+ to the processing queue for further processing.
86
+
87
+ Args:
88
+ fixture (dict[str, Any]): The fixture dictionary containing the external ID, class name,
89
+ and data of the fixture.
90
+
91
+ Returns:
92
+ None
93
+ """
94
+ def apply_fixtures(self) -> None:
95
+ """
96
+ Applies all loaded fixtures to the database.
97
+
98
+ This method processes each fixture in the `fixtures` dictionary in the order
99
+ specified by their 'order' value. It calls the `process_fixture` method for
100
+ each fixture and then processes the data in the processing queue.
101
+
102
+ Returns:
103
+ None
104
+ """
34
105
  def _process_data(self) -> None: ...
35
- def apply_file_fixtures(self) -> None: ...
106
+ def apply_file_fixtures(self) -> None:
107
+ """
108
+ Applies file fixtures from the specified directory.
109
+
110
+ This method processes file fixtures located in the 'files' directory adjacent to the
111
+ `fixtures_path`. It iterates through each file, reads its content, and processes it
112
+ as a fixture. If the file fixture already exists in the database, it updates the
113
+ existing fixture; otherwise, it creates a new one.
114
+
115
+ Returns:
116
+ None
117
+ """
36
118
  def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
Binary file
amsdal/manager.pyi CHANGED
@@ -15,6 +15,13 @@ from amsdal_utils.utils.singleton import Singleton
15
15
  from pathlib import Path
16
16
 
17
17
  class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
18
+ """
19
+ Manages the AMSDAL framework components and operations.
20
+
21
+ This class is responsible for initializing, setting up, and managing various components
22
+ of the AMSDAL framework, including connections, data management, schema management,
23
+ and authentication. It also provides methods for building and tearing down the framework.
24
+ """
18
25
  _class_manager: ClassManager
19
26
  _config_manager: Incomplete
20
27
  _connections_manager: Incomplete
@@ -28,68 +35,157 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
28
35
  def __init__(self, *, raise_on_new_signup: bool = False) -> None:
29
36
  """
30
37
  Initializes all sub managers. Reads the configuration.
38
+
39
+ Returns:
40
+ None
31
41
  """
32
42
  @property
33
43
  def is_setup(self) -> bool: ...
34
44
  @property
35
45
  def is_authenticated(self) -> bool:
36
46
  """
37
- Indicates if you have passed the AMSDAL license authentication process.
47
+ Indicates if the AMSDAL license authentication process has been passed.
48
+
49
+ This property returns a boolean value indicating whether the AMSDAL license
50
+ authentication process has been successfully completed.
51
+
52
+ Returns:
53
+ bool: True if authenticated, False otherwise.
38
54
  """
39
55
  def pre_setup(self) -> None:
40
56
  """
41
- Initiates models root path and adds it into sys.path
57
+ Initiates models root path and adds it into sys.path.
58
+
59
+ This method initializes the class manager and sets up the models root path
60
+ as specified in the settings. It ensures that the models root path is added
61
+ to the system path for proper module resolution.
62
+
63
+ Returns:
64
+ None
42
65
  """
43
66
  def setup(self) -> None:
44
67
  """
45
- Initiates models root path and the connections
68
+ Initiates models root path and the connections.
69
+
70
+ This method sets up the AMSDAL framework by initializing the models root path and
71
+ establishing connections. It ensures that the setup process is only performed once.
72
+
73
+ Raises:
74
+ AmsdalRuntimeError: If the AMSDAL manager is already set up.
75
+
76
+ Returns:
77
+ None
46
78
  """
47
79
  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:
48
80
  """
49
- Build method
50
-
51
- :param source_models_path: Path to the directory where the source models are located.
52
- :param source_transactions_path: Path to the directory where the source transactions are located.
53
- :param source_static_files_path: Path to the directory where the source static files are located.
54
- :param source_fixtures_path: Path to the directory where the source fixtures are located.
55
- :param source_migrations_path: Path to the directory where the source migrations are located.
56
- :return: None
81
+ Builds the necessary components for the Amsdal framework.
57
82
 
58
83
  This method is used to build the necessary components for the Amsdal framework.
59
- It takes four parameters which are all of type `Path`.
84
+ It takes five parameters which are all of type `Path`.
60
85
  These parameters represent the paths to the directories where the corresponding components are located.
61
86
 
87
+ Args:
88
+ source_models_path (Path): Path to the directory where the source models are located.
89
+ source_transactions_path (Path): Path to the directory where the source transactions are located.
90
+ source_static_files_path (Path): Path to the directory where the source static files are located.
91
+ source_fixtures_path (Path): Path to the directory where the source fixtures are located.
92
+ source_migrations_path (Path): Path to the directory where the source migrations are located.
93
+
94
+ Returns:
95
+ None
96
+
62
97
  The method performs the following build steps in order:
63
98
  - Builds the models from the `source_models_path` by calling the `build_models` method.
64
99
  - Builds the transactions from the `source_transactions_path` by calling the `build_transactions` method.
65
100
  - Builds the static files from the `source_static_files_path` by calling the `build_static_files` method.
66
101
  - Builds the fixtures from the `source_fixtures_path` by calling the `build_fixtures` method.
67
102
 
68
- Note: This method is part of the `AmsdalManager` class which includes mixins for `BuildMixin`
69
- and `ClassVersionsMixin`. It is intended to be used in the Amsdal framework for managing
70
- and building components.
103
+ Note:
104
+ This method is part of the `AmsdalManager` class which includes mixins for `BuildMixin`
105
+ and `ClassVersionsMixin`. It is intended to be used in the Amsdal framework for managing
106
+ and building components.
71
107
  """
72
108
  def post_setup(self) -> None:
73
109
  """
74
110
  Registers internal classes and prepares connections (creates internal tables).
111
+
112
+ This method registers the internal classes required by the AMSDAL framework and
113
+ prepares the connections by creating the necessary internal tables.
114
+
115
+ Returns:
116
+ None
75
117
  """
76
118
  def migrate(self) -> None:
77
119
  """
78
120
  DEPRECATED: Check changes in the models and apply them to the database.
121
+
122
+ This method is deprecated and should not be used. It checks for changes in the models
123
+ and applies them to the database. Use `amsdal.migration.file_migration_generator.FileMigrationGenerator`
124
+ instead.
125
+
126
+ Raises:
127
+ DeprecationWarning: Always raised to indicate that this method is deprecated.
128
+
129
+ Returns:
130
+ None
79
131
  """
80
132
  def _check_auth(self) -> None: ...
81
133
  @property
82
- def cloud_actions_manager(self) -> CloudActionsManager: ...
134
+ def cloud_actions_manager(self) -> CloudActionsManager:
135
+ """
136
+ Provides access to the CloudActionsManager.
137
+
138
+ This property checks if the AMSDAL manager is authenticated and then returns
139
+ an instance of the CloudActionsManager.
140
+
141
+ Returns:
142
+ CloudActionsManager: An instance of the CloudActionsManager.
143
+
144
+ Raises:
145
+ AmsdalAuthenticationError: If the AMSDAL manager is not authenticated.
146
+ """
83
147
  def authenticate(self) -> None:
84
148
  """
85
149
  Run AMSDAL license authentication process.
150
+
151
+ This method runs the AMSDAL license authentication process and sets the
152
+ authentication status accordingly.
153
+
154
+ Returns:
155
+ None
86
156
  """
87
157
  def apply_fixtures(self) -> None:
88
158
  """
89
159
  Loads and applies fixtures defined in your application.
160
+
161
+ This method loads the fixtures from the specified path and applies them to the
162
+ AMSDAL framework. It uses the `FixturesManager` to manage the loading and application
163
+ of the fixtures.
164
+
165
+ Returns:
166
+ None
167
+ """
168
+ def init_classes(self) -> None:
169
+ """
170
+ Initializes and imports classes based on the schema manager's class schemas.
171
+
172
+ This method iterates over the class schemas provided by the schema manager and imports
173
+ the classes into the class manager, excluding those of type `SchemaTypes.TYPE`.
174
+
175
+ Returns:
176
+ None
90
177
  """
91
- def init_classes(self) -> None: ...
92
178
  def teardown(self) -> None:
93
179
  """
94
180
  Clean up everything on the application exit.
181
+
182
+ This method performs a cleanup of all components managed by the AMSDAL framework
183
+ when the application exits. It disconnects and invalidates connections, clears caches,
184
+ and resets the setup status.
185
+
186
+ Raises:
187
+ AmsdalRuntimeError: If the AMSDAL manager is not set up.
188
+
189
+ Returns:
190
+ None
95
191
  """
@@ -9,11 +9,27 @@ from amsdal_utils.models.enums import SchemaTypes as SchemaTypes, Versions
9
9
  from pathlib import Path
10
10
 
11
11
  class BaseMigrationSchemas(ABC, metaclass=abc.ABCMeta):
12
+ """
13
+ Abstract base class for migration schemas.
14
+
15
+ This class provides the interface for managing and compiling database schema migrations.
16
+ It includes methods for registering, unregistering, and compiling classes, as well as
17
+ managing class versions.
18
+ """
12
19
  _classes: Incomplete
13
20
  _classes_versions: Incomplete
14
21
  _buffered_classes: Incomplete
15
22
  def __init__(self) -> None: ...
16
- def get_model(self, name: str) -> type[Model]: ...
23
+ def get_model(self, name: str) -> type[Model]:
24
+ """
25
+ Retrieves the model type for the given class name.
26
+
27
+ Args:
28
+ name (str): The name of the class whose model type is to be retrieved.
29
+
30
+ Returns:
31
+ type[Model]: The model type associated with the given class name.
32
+ """
17
33
  @abstractmethod
18
34
  def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
19
35
  @abstractmethod
@@ -21,16 +37,76 @@ class BaseMigrationSchemas(ABC, metaclass=abc.ABCMeta):
21
37
  @abstractmethod
22
38
  def compile_buffered_classes(self) -> None: ...
23
39
  @staticmethod
24
- def register_model_version(class_name: str, class_version: str | Versions) -> None: ...
40
+ def register_model_version(class_name: str, class_version: str | Versions) -> None:
41
+ """
42
+ Registers a specific version of a model class.
43
+
44
+ This method registers a specific version of a model class using the ClassVersionManager.
45
+
46
+ Args:
47
+ class_name (str): The name of the class to register the version for.
48
+ class_version (str | Versions): The version of the class to be registered.
49
+
50
+ Returns:
51
+ None
52
+ """
25
53
 
26
54
  class DefaultMigrationSchemas(BaseMigrationSchemas):
55
+ """
56
+ Default implementation of the BaseMigrationSchemas.
57
+
58
+ This class provides the default implementation for managing and compiling database schema migrations.
59
+ It includes methods for registering, unregistering, and compiling classes, as well as managing class versions.
60
+
61
+ Attributes:
62
+ model_class_template_layout (Path): Path to the model class layout template.
63
+ model_class_template (Path): Path to the model class template.
64
+ dict_validator_template (Path): Path to the dictionary validator template.
65
+ options_validator_template (Path): Path to the options validator template.
66
+ """
27
67
  model_class_template_layout: Path
28
68
  model_class_template: Path
29
69
  dict_validator_template: Path
30
70
  options_validator_template: Path
31
- def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
32
- def compile_buffered_classes(self) -> None: ...
33
- def unregister_model(self, class_name: str) -> None: ...
71
+ def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
72
+ """
73
+ Registers a model class for migration.
74
+
75
+ This method registers a model class for migration by adding it to the buffered classes
76
+ and registering its latest version.
77
+
78
+ Args:
79
+ class_name (str): The name of the class to be registered.
80
+ object_schema (ObjectSchema): The schema of the object to be registered.
81
+ schema_type (SchemaTypes): The type of the schema.
82
+
83
+ Returns:
84
+ None
85
+ """
86
+ def compile_buffered_classes(self) -> None:
87
+ """
88
+ Compiles all buffered classes for migration.
89
+
90
+ This method compiles all classes that have been buffered for migration and updates the
91
+ internal class dictionary with the compiled class types. It clears the buffer after
92
+ compilation.
93
+
94
+ Returns:
95
+ None
96
+ """
97
+ def unregister_model(self, class_name: str) -> None:
98
+ """
99
+ Unregisters a model class from the migration schemas.
100
+
101
+ This method removes the specified model class from the internal class dictionary,
102
+ effectively unregistering it from the migration schemas.
103
+
104
+ Args:
105
+ class_name (str): The name of the class to be unregistered.
106
+
107
+ Returns:
108
+ None
109
+ """
34
110
  def _compile_buffered_classes(self) -> list[tuple[str, type[Model]]]: ...
35
111
  def _build_class_source(self, class_name: str, schema: ObjectSchema, schema_type: SchemaTypes) -> tuple[str, str]: ...
36
112
  @staticmethod
@@ -7,36 +7,85 @@ from enum import Enum
7
7
  from pathlib import Path
8
8
 
9
9
  class Action(str, Enum):
10
+ """
11
+ Enumeration for different types of actions.
12
+
13
+ Attributes:
14
+ CREATED (str): Represents a created action.
15
+ UPDATED (str): Represents an updated action.
16
+ NO_ACTION (str): Represents no action.
17
+ """
10
18
  CREATED = 'CREATED'
11
19
  UPDATED = 'UPDATED'
12
20
  NO_ACTION = 'NO_ACTION'
13
21
 
14
22
  @dataclass
15
23
  class ClassSaveResult:
24
+ """
25
+ Data class representing the result of a class save operation.
26
+
27
+ Attributes:
28
+ action (Action): The action performed during the save operation.
29
+ instance (Model): The instance of the model that was saved.
30
+ """
16
31
  action: Action
17
32
  instance: Model
18
33
  def __init__(self, action, instance) -> None: ...
19
34
 
20
35
  @dataclass
21
36
  class ClassUpdateResult:
37
+ """
38
+ Data class representing the result of a class update operation.
39
+
40
+ Attributes:
41
+ is_updated (bool): Indicates whether the class was updated.
42
+ class_instance (Model): The instance of the model that was updated.
43
+ """
22
44
  is_updated: bool
23
45
  class_instance: Model
24
46
  def __init__(self, is_updated, class_instance) -> None: ...
25
47
 
26
48
  @dataclass
27
49
  class MigrateResult:
50
+ """
51
+ Data class representing the result of a migration operation.
52
+
53
+ Attributes:
54
+ class_instance (Model): The instance of the model that was migrated.
55
+ is_table_created (bool): Indicates whether the table was created during the migration.
56
+ is_data_migrated (bool): Indicates whether the data was migrated.
57
+ """
28
58
  class_instance: Model
29
59
  is_table_created: bool
30
60
  is_data_migrated: bool
31
61
  def __init__(self, class_instance, is_table_created, is_data_migrated) -> None: ...
32
62
 
33
63
  class ModuleTypes(str, Enum):
64
+ """
65
+ Enumeration for different types of modules.
66
+
67
+ Attributes:
68
+ APP (str): Represents an application module.
69
+ CORE (str): Represents a core module.
70
+ CONTRIB (str): Represents a contributed module.
71
+ """
34
72
  APP = 'APP'
35
73
  CORE = 'CORE'
36
74
  CONTRIB = 'CONTRIB'
37
75
 
38
76
  @dataclass
39
77
  class MigrationFile:
78
+ """
79
+ Data class representing a migration file.
80
+
81
+ Attributes:
82
+ path (Path): The file path of the migration.
83
+ type (ModuleTypes): The type of module the migration belongs to.
84
+ number (int): The migration number.
85
+ module (str | None): The module name, if applicable.
86
+ applied_at (float | None): The timestamp when the migration was applied.
87
+ stored_address (Address | None): The stored address associated with the migration.
88
+ """
40
89
  path: Path
41
90
  type: ModuleTypes
42
91
  number: int
@@ -44,22 +93,53 @@ class MigrationFile:
44
93
  applied_at: float | None = ...
45
94
  stored_address: Address | None = ...
46
95
  @property
47
- def is_initial(self) -> bool: ...
96
+ def is_initial(self) -> bool:
97
+ """
98
+ Indicates whether this migration is the initial migration.
99
+
100
+ Returns:
101
+ bool: True if this is the initial migration, False otherwise.
102
+ """
48
103
  def __init__(self, path, type, number, module=..., applied_at=..., stored_address=...) -> None: ...
49
104
 
50
105
  @dataclass
51
106
  class ClassSchema:
107
+ """
108
+ Data class representing a class schema.
109
+
110
+ Attributes:
111
+ object_schema (ObjectSchema): The object schema associated with the class.
112
+ type (ModuleTypes): The type of module the class belongs to.
113
+ """
52
114
  object_schema: ObjectSchema
53
115
  type: ModuleTypes
54
116
  def __init__(self, object_schema, type) -> None: ...
55
117
 
56
118
  class OperationTypes(str, Enum):
119
+ """
120
+ Enumeration for different types of operations.
121
+
122
+ Attributes:
123
+ CREATE_CLASS (str): Represents the operation to create a class.
124
+ UPDATE_CLASS (str): Represents the operation to update a class.
125
+ DELETE_CLASS (str): Represents the operation to delete a class.
126
+ """
57
127
  CREATE_CLASS = 'CREATE_CLASS'
58
128
  UPDATE_CLASS = 'UPDATE_CLASS'
59
129
  DELETE_CLASS = 'DELETE_CLASS'
60
130
 
61
131
  @dataclass
62
132
  class MigrateOperation:
133
+ """
134
+ Data class representing a migration operation.
135
+
136
+ Attributes:
137
+ type (OperationTypes): The type of operation being performed.
138
+ class_name (str): The name of the class involved in the migration.
139
+ schema_type (SchemaTypes): The type of schema associated with the migration.
140
+ old_schema (ObjectSchema | PropertyData | None): The old schema before the migration, if applicable.
141
+ new_schema (ObjectSchema | PropertyData | None): The new schema after the migration, if applicable.
142
+ """
63
143
  type: OperationTypes
64
144
  class_name: str
65
145
  schema_type: SchemaTypes
@@ -68,11 +148,25 @@ class MigrateOperation:
68
148
  def __init__(self, type, class_name, schema_type, old_schema=..., new_schema=...) -> None: ...
69
149
 
70
150
  class MigrationDirection(str, Enum):
151
+ """
152
+ Enumeration for the direction of a migration.
153
+
154
+ Attributes:
155
+ FORWARD (str): Represents a forward migration.
156
+ BACKWARD (str): Represents a backward migration.
157
+ """
71
158
  FORWARD = 'forward'
72
159
  BACKWARD = 'backward'
73
160
 
74
161
  @dataclass
75
162
  class MigrationResult:
163
+ """
164
+ Data class representing the result of a migration.
165
+
166
+ Attributes:
167
+ direction (MigrationDirection): The direction of the migration.
168
+ migration (MigrationFile): The migration file associated with the migration.
169
+ """
76
170
  direction: MigrationDirection
77
171
  migration: MigrationFile
78
172
  def __init__(self, direction, migration) -> None: ...