amsdal 0.1.26__cp311-cp311-win_amd64.whl → 0.2.0__cp311-cp311-win_amd64.whl

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

Potentially problematic release.


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

Files changed (163) hide show
  1. amsdal/__about__.py +1 -1
  2. amsdal/cloud/__init__.cp311-win_amd64.pyd +0 -0
  3. amsdal/cloud/client.cp311-win_amd64.pyd +0 -0
  4. amsdal/cloud/client.pyi +46 -2
  5. amsdal/cloud/constants.cp311-win_amd64.pyd +0 -0
  6. amsdal/cloud/enums.cp311-win_amd64.pyd +0 -0
  7. amsdal/cloud/enums.pyi +46 -0
  8. amsdal/cloud/models/__init__.cp311-win_amd64.pyd +0 -0
  9. amsdal/cloud/models/base.cp311-win_amd64.pyd +0 -0
  10. amsdal/cloud/models/base.pyi +156 -0
  11. amsdal/cloud/services/__init__.cp311-win_amd64.pyd +0 -0
  12. amsdal/cloud/services/actions/__init__.cp311-win_amd64.pyd +0 -0
  13. amsdal/cloud/services/actions/add_allowlist_ip.cp311-win_amd64.pyd +0 -0
  14. amsdal/cloud/services/actions/add_allowlist_ip.pyi +16 -1
  15. amsdal/cloud/services/actions/add_basic_auth.cp311-win_amd64.pyd +0 -0
  16. amsdal/cloud/services/actions/add_basic_auth.pyi +17 -1
  17. amsdal/cloud/services/actions/add_dependency.cp311-win_amd64.pyd +0 -0
  18. amsdal/cloud/services/actions/add_dependency.pyi +16 -1
  19. amsdal/cloud/services/actions/add_secret.cp311-win_amd64.pyd +0 -0
  20. amsdal/cloud/services/actions/add_secret.pyi +17 -1
  21. amsdal/cloud/services/actions/base.cp311-win_amd64.pyd +0 -0
  22. amsdal/cloud/services/actions/base.pyi +71 -3
  23. amsdal/cloud/services/actions/create_deploy.cp311-win_amd64.pyd +0 -0
  24. amsdal/cloud/services/actions/create_deploy.pyi +33 -3
  25. amsdal/cloud/services/actions/create_env.cp311-win_amd64.pyd +0 -0
  26. amsdal/cloud/services/actions/create_env.pyi +15 -1
  27. amsdal/cloud/services/actions/create_session.cp311-win_amd64.pyd +0 -0
  28. amsdal/cloud/services/actions/create_session.pyi +13 -1
  29. amsdal/cloud/services/actions/delete_allowlist_ip.cp311-win_amd64.pyd +0 -0
  30. amsdal/cloud/services/actions/delete_allowlist_ip.pyi +16 -1
  31. amsdal/cloud/services/actions/delete_basic_auth.cp311-win_amd64.pyd +0 -0
  32. amsdal/cloud/services/actions/delete_basic_auth.pyi +17 -1
  33. amsdal/cloud/services/actions/delete_dependency.cp311-win_amd64.pyd +0 -0
  34. amsdal/cloud/services/actions/delete_dependency.pyi +18 -1
  35. amsdal/cloud/services/actions/delete_env.cp311-win_amd64.pyd +0 -0
  36. amsdal/cloud/services/actions/delete_env.pyi +17 -1
  37. amsdal/cloud/services/actions/delete_secret.cp311-win_amd64.pyd +0 -0
  38. amsdal/cloud/services/actions/delete_secret.pyi +18 -1
  39. amsdal/cloud/services/actions/destroy_deploy.cp311-win_amd64.pyd +0 -0
  40. amsdal/cloud/services/actions/destroy_deploy.pyi +15 -1
  41. amsdal/cloud/services/actions/expose_db.cp311-win_amd64.pyd +0 -0
  42. amsdal/cloud/services/actions/expose_db.pyi +18 -1
  43. amsdal/cloud/services/actions/get_basic_auth_credentials.cp311-win_amd64.pyd +0 -0
  44. amsdal/cloud/services/actions/get_basic_auth_credentials.pyi +17 -1
  45. amsdal/cloud/services/actions/get_monitoring_info.cp311-win_amd64.pyd +0 -0
  46. amsdal/cloud/services/actions/get_monitoring_info.pyi +17 -1
  47. amsdal/cloud/services/actions/list_dependencies.cp311-win_amd64.pyd +0 -0
  48. amsdal/cloud/services/actions/list_dependencies.pyi +17 -1
  49. amsdal/cloud/services/actions/list_deploys.cp311-win_amd64.pyd +0 -0
  50. amsdal/cloud/services/actions/list_deploys.pyi +15 -1
  51. amsdal/cloud/services/actions/list_envs.cp311-win_amd64.pyd +0 -0
  52. amsdal/cloud/services/actions/list_envs.pyi +16 -1
  53. amsdal/cloud/services/actions/list_secrets.cp311-win_amd64.pyd +0 -0
  54. amsdal/cloud/services/actions/list_secrets.pyi +18 -1
  55. amsdal/cloud/services/actions/manager.cp311-win_amd64.pyd +0 -0
  56. amsdal/cloud/services/actions/manager.pyi +254 -20
  57. amsdal/cloud/services/actions/signup_action.cp311-win_amd64.pyd +0 -0
  58. amsdal/cloud/services/actions/signup_action.pyi +16 -1
  59. amsdal/cloud/services/actions/update_deploy.cp311-win_amd64.pyd +0 -0
  60. amsdal/cloud/services/actions/update_deploy.pyi +15 -1
  61. amsdal/cloud/services/auth/__init__.cp311-win_amd64.pyd +0 -0
  62. amsdal/cloud/services/auth/base.cp311-win_amd64.pyd +0 -0
  63. amsdal/cloud/services/auth/credentials.cp311-win_amd64.pyd +0 -0
  64. amsdal/cloud/services/auth/credentials.pyi +12 -1
  65. amsdal/cloud/services/auth/manager.cp311-win_amd64.pyd +0 -0
  66. amsdal/cloud/services/auth/manager.pyi +15 -1
  67. amsdal/cloud/services/auth/signup_service.cp311-win_amd64.pyd +0 -0
  68. amsdal/cloud/services/auth/signup_service.pyi +16 -1
  69. amsdal/cloud/services/auth/token.cp311-win_amd64.pyd +0 -0
  70. amsdal/cloud/services/auth/token.pyi +15 -1
  71. amsdal/configs/constants.py +10 -0
  72. amsdal/configs/constants.pyi +11 -1
  73. amsdal/configs/main.py +132 -19
  74. amsdal/configs/main.pyi +140 -10
  75. amsdal/context/manager.py +39 -0
  76. amsdal/context/manager.pyi +41 -3
  77. amsdal/contrib/__init__.cp311-win_amd64.pyd +0 -0
  78. amsdal/contrib/auth/app.py +12 -0
  79. amsdal/contrib/auth/app.pyi +12 -1
  80. amsdal/contrib/auth/lifecycle/consumer.py +53 -0
  81. amsdal/contrib/auth/lifecycle/consumer.pyi +53 -3
  82. amsdal/contrib/auth/models/login_session/hooks/pre_init.py +13 -0
  83. amsdal/contrib/auth/models/login_session/modifiers/display_name.py +8 -0
  84. amsdal/contrib/auth/models/permission/modifiers/display_name.py +8 -0
  85. amsdal/contrib/auth/models/user/hooks/post_init.py +13 -0
  86. amsdal/contrib/auth/models/user/hooks/pre_create.py +6 -0
  87. amsdal/contrib/auth/models/user/modifiers/display_name.py +8 -0
  88. amsdal/contrib/auth/settings.py +15 -0
  89. amsdal/contrib/auth/settings.pyi +14 -0
  90. amsdal/contrib/frontend_configs/app.py +14 -0
  91. amsdal/contrib/frontend_configs/app.pyi +14 -1
  92. amsdal/contrib/frontend_configs/conversion/convert.py +14 -0
  93. amsdal/contrib/frontend_configs/conversion/convert.pyi +15 -1
  94. amsdal/contrib/frontend_configs/lifecycle/consumer.py +75 -3
  95. amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +77 -6
  96. amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +16 -0
  97. amsdal/contrib/frontend_configs/utils.py +12 -1
  98. amsdal/contrib/frontend_configs/utils.pyi +12 -1
  99. amsdal/fixtures/__init__.cp311-win_amd64.pyd +0 -0
  100. amsdal/fixtures/manager.cp311-win_amd64.pyd +0 -0
  101. amsdal/fixtures/manager.pyi +90 -8
  102. amsdal/manager.cp311-win_amd64.pyd +0 -0
  103. amsdal/manager.pyi +113 -25
  104. amsdal/migration/__init__.cp311-win_amd64.pyd +0 -0
  105. amsdal/migration/base_migration_schemas.cp311-win_amd64.pyd +0 -0
  106. amsdal/migration/base_migration_schemas.pyi +84 -8
  107. amsdal/migration/data_classes.cp311-win_amd64.pyd +0 -0
  108. amsdal/migration/data_classes.pyi +104 -4
  109. amsdal/migration/executors/__init__.cp311-win_amd64.pyd +0 -0
  110. amsdal/migration/executors/base.cp311-win_amd64.pyd +0 -0
  111. amsdal/migration/executors/base.pyi +75 -5
  112. amsdal/migration/executors/default_executor.cp311-win_amd64.pyd +0 -0
  113. amsdal/migration/executors/default_executor.pyi +82 -10
  114. amsdal/migration/executors/state_executor.cp311-win_amd64.pyd +0 -0
  115. amsdal/migration/executors/state_executor.pyi +69 -5
  116. amsdal/migration/file_migration_executor.cp311-win_amd64.pyd +0 -0
  117. amsdal/migration/file_migration_executor.pyi +34 -2
  118. amsdal/migration/file_migration_generator.cp311-win_amd64.pyd +0 -0
  119. amsdal/migration/file_migration_generator.pyi +102 -10
  120. amsdal/migration/file_migration_store.cp311-win_amd64.pyd +0 -0
  121. amsdal/migration/file_migration_store.pyi +36 -8
  122. amsdal/migration/file_migration_writer.cp311-win_amd64.pyd +0 -0
  123. amsdal/migration/file_migration_writer.pyi +60 -5
  124. amsdal/migration/migrations.cp311-win_amd64.pyd +0 -0
  125. amsdal/migration/migrations.pyi +111 -6
  126. amsdal/migration/migrations_loader.cp311-win_amd64.pyd +0 -0
  127. amsdal/migration/migrations_loader.pyi +17 -2
  128. amsdal/migration/schemas_loaders.cp311-win_amd64.pyd +0 -0
  129. amsdal/migration/schemas_loaders.pyi +15 -2
  130. amsdal/migration/utils.cp311-win_amd64.pyd +0 -0
  131. amsdal/migration/utils.pyi +46 -6
  132. amsdal/mixins/__init__.cp311-win_amd64.pyd +0 -0
  133. amsdal/mixins/build_mixin.cp311-win_amd64.pyd +0 -0
  134. amsdal/mixins/build_mixin.pyi +60 -8
  135. amsdal/mixins/class_versions_mixin.cp311-win_amd64.pyd +0 -0
  136. amsdal/mixins/class_versions_mixin.pyi +3 -7
  137. amsdal/schemas/core/class_object/properties/display_name.py +6 -0
  138. amsdal/schemas/core/file/hooks/pre_create.py +9 -0
  139. amsdal/schemas/core/file/hooks/pre_update.py +9 -0
  140. amsdal/schemas/core/file/properties/from_file.py +12 -0
  141. amsdal/schemas/core/file/properties/mimetype.py +8 -0
  142. amsdal/schemas/core/file/properties/to_file.py +12 -0
  143. amsdal/schemas/core/file/properties/validate_data.py +13 -0
  144. amsdal/schemas/manager.cp311-win_amd64.pyd +0 -0
  145. amsdal/schemas/manager.py +53 -2
  146. amsdal/schemas/manager.pyi +55 -5
  147. amsdal/services/__init__.cp311-win_amd64.pyd +0 -0
  148. amsdal/services/transaction_execution.cp311-win_amd64.pyd +0 -0
  149. amsdal/services/transaction_execution.pyi +52 -3
  150. amsdal/utils/contrib_paths.py +10 -0
  151. amsdal/utils/contrib_paths.pyi +11 -1
  152. amsdal/utils/tests/helpers.py +5 -7
  153. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/METADATA +4 -6
  154. amsdal-0.2.0.dist-info/RECORD +254 -0
  155. amsdal/operations/__init__.cp311-win_amd64.pyd +0 -0
  156. amsdal/operations/__init__.pyi +0 -0
  157. amsdal/operations/manager.cp311-win_amd64.pyd +0 -0
  158. amsdal/operations/manager.pyi +0 -24
  159. amsdal-0.1.26.dist-info/RECORD +0 -258
  160. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/LICENSE.txt +0 -0
  161. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/WHEEL +0 -0
  162. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/license_check.py +0 -0
  163. {amsdal-0.1.26.dist-info → amsdal-0.2.0.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,86 @@
1
1
  from _typeshed import Incomplete
2
- from amsdal_models.schemas.data_models.schema import PropertyData
3
2
  from amsdal_utils.lifecycle.consumer import LifecycleConsumer
3
+ from amsdal_utils.models.data_models.schema import PropertyData
4
4
  from typing import Any
5
5
 
6
6
  logger: Incomplete
7
7
  core_to_frontend_types: Incomplete
8
8
 
9
- def process_property(field_name: str, property_data: PropertyData) -> dict[str, Any]: ...
10
- def populate_frontend_config_with_values(config: dict[str, Any], values: dict[str, Any]) -> dict[str, Any]: ...
11
- def get_values_from_response(response: dict[str, Any] | list[dict[str, Any]]) -> dict[str, Any]: ...
12
- def get_default_control(class_name: str) -> dict[str, Any]: ...
9
+ def process_property(field_name: str, property_data: PropertyData) -> dict[str, Any]:
10
+ """
11
+ Processes a property and converts it to a frontend configuration dictionary.
12
+
13
+ This function takes a field name and property data, and converts them into a dictionary
14
+ that represents the configuration for a frontend form control. It handles various types
15
+ such as core types, arrays, dictionaries, and files.
16
+
17
+ Args:
18
+ field_name (str): The name of the field to be processed.
19
+ property_data (PropertyData): The property data to be processed.
20
+
21
+ Returns:
22
+ dict[str, Any]: A dictionary representing the frontend configuration for the given property.
23
+ """
24
+ def populate_frontend_config_with_values(config: dict[str, Any], values: dict[str, Any]) -> dict[str, Any]:
25
+ """
26
+ Populates a frontend configuration dictionary with values.
27
+
28
+ This function takes a frontend configuration dictionary and a dictionary of values,
29
+ and populates the configuration with the corresponding values. It recursively processes
30
+ nested controls to ensure all values are populated.
31
+
32
+ Args:
33
+ config (dict[str, Any]): The frontend configuration dictionary to be populated.
34
+ values (dict[str, Any]): The dictionary of values to populate the configuration with.
35
+
36
+ Returns:
37
+ dict[str, Any]: The populated frontend configuration dictionary.
38
+ """
39
+ def get_values_from_response(response: dict[str, Any] | list[dict[str, Any]]) -> dict[str, Any]:
40
+ """
41
+ Extracts values from a response dictionary or list of dictionaries.
42
+
43
+ This function processes a response to extract the relevant values. It checks if the response
44
+ is a dictionary containing a 'rows' key and processes the rows to find the appropriate values.
45
+ If the response is not in the expected format, it returns an empty dictionary.
46
+
47
+ Args:
48
+ response (dict[str, Any] | list[dict[str, Any]]): The response to extract values from.
49
+
50
+ Returns:
51
+ dict[str, Any]: A dictionary containing the extracted values.
52
+ """
53
+ def get_default_control(class_name: str) -> dict[str, Any]:
54
+ """
55
+ Retrieves the default frontend control configuration for a given class name.
56
+
57
+ This function attempts to import a class by its name from various schema types.
58
+ If the class is found, it converts it to a frontend configuration dictionary
59
+ and returns it. If the class is not found, it returns an empty dictionary.
60
+
61
+ Args:
62
+ class_name (str): The name of the class to retrieve the default control for.
63
+
64
+ Returns:
65
+ dict[str, Any]: A dictionary representing the frontend control configuration for the given class.
66
+ """
13
67
 
14
68
  class ProcessResponseConsumer(LifecycleConsumer):
15
- def on_event(self, request: Any, response: dict[str, Any]) -> None: ...
69
+ """
70
+ Consumer class for processing responses and populating frontend configurations.
71
+
72
+ This class extends the LifecycleConsumer and processes responses to populate
73
+ frontend configurations based on the class name and values extracted from the response.
74
+ """
75
+ def on_event(self, request: Any, response: dict[str, Any]) -> None:
76
+ """
77
+ Handles the event by extracting the class name and values from the request and response,
78
+ and populates the frontend configuration accordingly.
79
+
80
+ Args:
81
+ request (Any): The request object containing query and path parameters.
82
+ response (dict[str, Any]): The response dictionary to be processed.
83
+
84
+ Returns:
85
+ None
86
+ """
@@ -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
  """
Binary file
@@ -1,9 +1,9 @@
1
1
  from _typeshed import Incomplete
2
2
  from amsdal.schemas.manager import SchemaManager as SchemaManager
3
3
  from amsdal_models.classes.manager import ClassManager
4
- from amsdal_models.schemas.data_models.core import DictSchema, TypeData
5
- from amsdal_models.schemas.data_models.schema import PropertyData
6
4
  from amsdal_utils.config.manager import AmsdalConfigManager as AmsdalConfigManager
5
+ from amsdal_utils.models.data_models.core import DictSchema, TypeData as TypeData
6
+ from amsdal_utils.models.data_models.schema import PropertyData as PropertyData
7
7
  from pathlib import Path
8
8
  from pydantic import BaseModel
9
9
  from typing import Any
@@ -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
@@ -7,7 +7,6 @@ from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError
7
7
  from amsdal.fixtures.manager import 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
- from amsdal.operations.manager import OperationsManager as OperationsManager
11
10
  from amsdal.schemas.manager import SchemaManager as SchemaManager
12
11
  from amsdal_models.classes.manager import ClassManager
13
12
  from amsdal_utils.config.data_models.amsdal_config import AmsdalConfig as AmsdalConfig
@@ -15,11 +14,17 @@ from amsdal_utils.utils.singleton import Singleton
15
14
  from pathlib import Path
16
15
 
17
16
  class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
17
+ """
18
+ Manages the AMSDAL framework components and operations.
19
+
20
+ This class is responsible for initializing, setting up, and managing various components
21
+ of the AMSDAL framework, including connections, data management, schema management,
22
+ and authentication. It also provides methods for building and tearing down the framework.
23
+ """
18
24
  _class_manager: ClassManager
19
25
  _config_manager: Incomplete
20
- _connections_manager: Incomplete
21
- _data_manager: Incomplete
22
- _table_schemas_manager: Incomplete
26
+ _config: Incomplete
27
+ _data_application: Incomplete
23
28
  _is_setup: bool
24
29
  __is_authenticated: bool
25
30
  _schema_manager: Incomplete
@@ -28,68 +33,151 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
28
33
  def __init__(self, *, raise_on_new_signup: bool = False) -> None:
29
34
  """
30
35
  Initializes all sub managers. Reads the configuration.
36
+
37
+ Returns:
38
+ None
31
39
  """
32
40
  @property
33
41
  def is_setup(self) -> bool: ...
34
42
  @property
35
43
  def is_authenticated(self) -> bool:
36
44
  """
37
- Indicates if you have passed the AMSDAL license authentication process.
45
+ Indicates if the AMSDAL license authentication process has been passed.
46
+
47
+ This property returns a boolean value indicating whether the AMSDAL license
48
+ authentication process has been successfully completed.
49
+
50
+ Returns:
51
+ bool: True if authenticated, False otherwise.
38
52
  """
39
53
  def pre_setup(self) -> None:
40
54
  """
41
- Initiates models root path and adds it into sys.path
55
+ Initiates models root path and adds it into sys.path.
56
+
57
+ This method initializes the class manager and sets up the models root path
58
+ as specified in the settings. It ensures that the models root path is added
59
+ to the system path for proper module resolution.
60
+
61
+ Returns:
62
+ None
42
63
  """
43
64
  def setup(self) -> None:
44
65
  """
45
- Initiates models root path and the connections
66
+ Initiates models root path and the connections.
67
+
68
+ This method sets up the AMSDAL framework by initializing the models root path and
69
+ establishing connections. It ensures that the setup process is only performed once.
70
+
71
+ Raises:
72
+ AmsdalRuntimeError: If the AMSDAL manager is already set up.
73
+
74
+ Returns:
75
+ None
76
+ """
77
+ def post_setup(self) -> None:
78
+ """
79
+ Registers internal classes and prepares connections (creates internal tables).
46
80
  """
47
81
  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
82
  """
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
83
+ Builds the necessary components for the Amsdal framework.
57
84
 
58
85
  This method is used to build the necessary components for the Amsdal framework.
59
- It takes four parameters which are all of type `Path`.
86
+ It takes five parameters which are all of type `Path`.
60
87
  These parameters represent the paths to the directories where the corresponding components are located.
61
88
 
89
+ Args:
90
+ source_models_path (Path): Path to the directory where the source models are located.
91
+ source_transactions_path (Path): Path to the directory where the source transactions are located.
92
+ source_static_files_path (Path): Path to the directory where the source static files are located.
93
+ source_fixtures_path (Path): Path to the directory where the source fixtures are located.
94
+ source_migrations_path (Path): Path to the directory where the source migrations are located.
95
+
96
+ Returns:
97
+ None
98
+
62
99
  The method performs the following build steps in order:
63
100
  - Builds the models from the `source_models_path` by calling the `build_models` method.
64
101
  - Builds the transactions from the `source_transactions_path` by calling the `build_transactions` method.
65
102
  - Builds the static files from the `source_static_files_path` by calling the `build_static_files` method.
66
103
  - Builds the fixtures from the `source_fixtures_path` by calling the `build_fixtures` method.
67
104
 
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.
71
- """
72
- def post_setup(self) -> None:
73
- """
74
- Registers internal classes and prepares connections (creates internal tables).
105
+ Note:
106
+ This method is part of the `AmsdalManager` class which includes mixins for `BuildMixin`
107
+ and `ClassVersionsMixin`. It is intended to be used in the Amsdal framework for managing
108
+ and building components.
75
109
  """
76
110
  def migrate(self) -> None:
77
111
  """
78
112
  DEPRECATED: Check changes in the models and apply them to the database.
113
+
114
+ This method is deprecated and should not be used. It checks for changes in the models
115
+ and applies them to the database. Use `amsdal.migration.file_migration_generator.FileMigrationGenerator`
116
+ instead.
117
+
118
+ Raises:
119
+ DeprecationWarning: Always raised to indicate that this method is deprecated.
120
+
121
+ Returns:
122
+ None
79
123
  """
80
124
  def _check_auth(self) -> None: ...
81
125
  @property
82
- def cloud_actions_manager(self) -> CloudActionsManager: ...
126
+ def cloud_actions_manager(self) -> CloudActionsManager:
127
+ """
128
+ Provides access to the CloudActionsManager.
129
+
130
+ This property checks if the AMSDAL manager is authenticated and then returns
131
+ an instance of the CloudActionsManager.
132
+
133
+ Returns:
134
+ CloudActionsManager: An instance of the CloudActionsManager.
135
+
136
+ Raises:
137
+ AmsdalAuthenticationError: If the AMSDAL manager is not authenticated.
138
+ """
83
139
  def authenticate(self) -> None:
84
140
  """
85
141
  Run AMSDAL license authentication process.
142
+
143
+ This method runs the AMSDAL license authentication process and sets the
144
+ authentication status accordingly.
145
+
146
+ Returns:
147
+ None
86
148
  """
87
149
  def apply_fixtures(self) -> None:
88
150
  """
89
151
  Loads and applies fixtures defined in your application.
152
+
153
+ This method loads the fixtures from the specified path and applies them to the
154
+ AMSDAL framework. It uses the `FixturesManager` to manage the loading and application
155
+ of the fixtures.
156
+
157
+ Returns:
158
+ None
159
+ """
160
+ def init_classes(self) -> None:
161
+ """
162
+ Initializes and imports classes based on the schema manager's class schemas.
163
+
164
+ This method iterates over the class schemas provided by the schema manager and imports
165
+ the classes into the class manager, excluding those of type `SchemaTypes.TYPE`.
166
+
167
+ Returns:
168
+ None
90
169
  """
91
- def init_classes(self) -> None: ...
92
170
  def teardown(self) -> None:
93
171
  """
94
172
  Clean up everything on the application exit.
173
+
174
+ This method performs a cleanup of all components managed by the AMSDAL framework
175
+ when the application exits. It disconnects and invalidates connections, clears caches,
176
+ and resets the setup status.
177
+
178
+ Raises:
179
+ AmsdalRuntimeError: If the AMSDAL manager is not set up.
180
+
181
+ Returns:
182
+ None
95
183
  """
@@ -3,34 +3,110 @@ from _typeshed import Incomplete
3
3
  from abc import ABC, abstractmethod
4
4
  from amsdal.configs.constants import BASE_DIR as BASE_DIR
5
5
  from amsdal_models.classes.model import Model
6
- from amsdal_models.schemas.data_models.core import DictSchema, LegacyDictSchema, TypeData
7
- from amsdal_models.schemas.data_models.schema import ObjectSchema, PropertyData
6
+ from amsdal_utils.models.data_models.core import DictSchema, LegacyDictSchema, TypeData as TypeData
7
+ from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema, PropertyData as PropertyData
8
8
  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
- def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
34
+ def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes, class_version: str | Versions = ...) -> None: ...
19
35
  @abstractmethod
20
36
  def unregister_model(self, class_name: str) -> None: ...
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, class_version: str | Versions = ...) -> 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