amsdal 0.3.5__cp312-cp312-macosx_10_13_universal2.whl → 0.4.0__cp312-cp312-macosx_10_13_universal2.whl

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

Potentially problematic release.


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

Files changed (210) hide show
  1. amsdal/__about__.py +1 -1
  2. amsdal/__migrations__/0000_initial.py +34 -25
  3. amsdal/__migrations__/0001_datetime_type.py +4 -4
  4. amsdal/__migrations__/0002_fixture_order.py +7 -3
  5. amsdal/__migrations__/0003_schema_type_in_class_meta.py +3 -15
  6. amsdal/cloud/__init__.cpython-312-darwin.so +0 -0
  7. amsdal/cloud/client.cpython-312-darwin.so +0 -0
  8. amsdal/cloud/constants.cpython-312-darwin.so +0 -0
  9. amsdal/cloud/enums.cpython-312-darwin.so +0 -0
  10. amsdal/cloud/models/__init__.cpython-312-darwin.so +0 -0
  11. amsdal/cloud/models/base.cpython-312-darwin.so +0 -0
  12. amsdal/cloud/services/__init__.cpython-312-darwin.so +0 -0
  13. amsdal/cloud/services/actions/__init__.cpython-312-darwin.so +0 -0
  14. amsdal/cloud/services/actions/add_allowlist_ip.cpython-312-darwin.so +0 -0
  15. amsdal/cloud/services/actions/add_basic_auth.cpython-312-darwin.so +0 -0
  16. amsdal/cloud/services/actions/add_dependency.cpython-312-darwin.so +0 -0
  17. amsdal/cloud/services/actions/add_secret.cpython-312-darwin.so +0 -0
  18. amsdal/cloud/services/actions/base.cpython-312-darwin.so +0 -0
  19. amsdal/cloud/services/actions/create_deploy.cpython-312-darwin.so +0 -0
  20. amsdal/cloud/services/actions/create_env.cpython-312-darwin.so +0 -0
  21. amsdal/cloud/services/actions/create_session.cpython-312-darwin.so +0 -0
  22. amsdal/cloud/services/actions/delete_allowlist_ip.cpython-312-darwin.so +0 -0
  23. amsdal/cloud/services/actions/delete_basic_auth.cpython-312-darwin.so +0 -0
  24. amsdal/cloud/services/actions/delete_dependency.cpython-312-darwin.so +0 -0
  25. amsdal/cloud/services/actions/delete_env.cpython-312-darwin.so +0 -0
  26. amsdal/cloud/services/actions/delete_secret.cpython-312-darwin.so +0 -0
  27. amsdal/cloud/services/actions/destroy_deploy.cpython-312-darwin.so +0 -0
  28. amsdal/cloud/services/actions/expose_db.cpython-312-darwin.so +0 -0
  29. amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-312-darwin.so +0 -0
  30. amsdal/cloud/services/actions/get_monitoring_info.cpython-312-darwin.so +0 -0
  31. amsdal/cloud/services/actions/list_dependencies.cpython-312-darwin.so +0 -0
  32. amsdal/cloud/services/actions/list_deploys.cpython-312-darwin.so +0 -0
  33. amsdal/cloud/services/actions/list_envs.cpython-312-darwin.so +0 -0
  34. amsdal/cloud/services/actions/list_secrets.cpython-312-darwin.so +0 -0
  35. amsdal/cloud/services/actions/manager.cpython-312-darwin.so +0 -0
  36. amsdal/cloud/services/actions/signup_action.cpython-312-darwin.so +0 -0
  37. amsdal/cloud/services/actions/update_deploy.cpython-312-darwin.so +0 -0
  38. amsdal/cloud/services/auth/__init__.cpython-312-darwin.so +0 -0
  39. amsdal/cloud/services/auth/base.cpython-312-darwin.so +0 -0
  40. amsdal/cloud/services/auth/credentials.cpython-312-darwin.so +0 -0
  41. amsdal/cloud/services/auth/credentials.pyi +0 -1
  42. amsdal/cloud/services/auth/manager.cpython-312-darwin.so +0 -0
  43. amsdal/cloud/services/auth/signup_service.cpython-312-darwin.so +0 -0
  44. amsdal/cloud/services/auth/token.cpython-312-darwin.so +0 -0
  45. amsdal/cloud/services/auth/token.pyi +0 -1
  46. amsdal/configs/main.py +23 -19
  47. amsdal/configs/main.pyi +12 -15
  48. amsdal/contrib/__init__.cpython-312-darwin.so +0 -0
  49. amsdal/contrib/auth/lifecycle/consumer.py +10 -10
  50. amsdal/contrib/auth/migrations/0000_initial.py +41 -7
  51. amsdal/contrib/auth/models/login_session.py +66 -0
  52. amsdal/contrib/auth/models/login_session.pyi +33 -0
  53. amsdal/contrib/auth/models/permission.py +23 -0
  54. amsdal/contrib/auth/models/permission.pyi +18 -0
  55. amsdal/contrib/auth/models/user.py +106 -0
  56. amsdal/contrib/auth/models/user.pyi +46 -0
  57. amsdal/contrib/frontend_configs/conversion/convert.py +47 -15
  58. amsdal/contrib/frontend_configs/conversion/convert.pyi +0 -1
  59. amsdal/contrib/frontend_configs/lifecycle/consumer.py +32 -13
  60. amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +1 -1
  61. amsdal/contrib/frontend_configs/migrations/0000_initial.py +15 -14
  62. amsdal/contrib/frontend_configs/models/__init__.py +0 -0
  63. amsdal/contrib/frontend_configs/models/__init__.pyi +0 -0
  64. amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
  65. amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +12 -0
  66. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
  67. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +7 -0
  68. amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +54 -0
  69. amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +32 -0
  70. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
  71. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +11 -0
  72. amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
  73. amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +8 -0
  74. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
  75. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +8 -0
  76. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
  77. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +9 -0
  78. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
  79. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +10 -0
  80. amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
  81. amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +15 -0
  82. amsdal/contrib/frontend_configs/models/frontend_control_config.py +87 -0
  83. amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +35 -0
  84. amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
  85. amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +9 -0
  86. amsdal/errors.py +0 -3
  87. amsdal/errors.pyi +0 -1
  88. amsdal/fixtures/__init__.cpython-312-darwin.so +0 -0
  89. amsdal/fixtures/manager.cpython-312-darwin.so +0 -0
  90. amsdal/fixtures/manager.pyi +73 -123
  91. amsdal/fixtures/utils.cpython-312-darwin.so +0 -0
  92. amsdal/fixtures/utils.pyi +9 -0
  93. amsdal/manager.cpython-312-darwin.so +0 -0
  94. amsdal/manager.pyi +4 -96
  95. amsdal/mixins/__init__.cpython-312-darwin.so +0 -0
  96. amsdal/mixins/class_versions_mixin.cpython-312-darwin.so +0 -0
  97. amsdal/models/__init__.py +0 -0
  98. amsdal/models/__init__.pyi +0 -0
  99. amsdal/models/core/__init__.py +0 -0
  100. amsdal/models/core/__init__.pyi +0 -0
  101. amsdal/models/core/class_object.py +37 -0
  102. amsdal/models/core/class_object.pyi +24 -0
  103. amsdal/models/core/class_object_meta.py +26 -0
  104. amsdal/models/core/class_object_meta.pyi +15 -0
  105. amsdal/models/core/class_property.py +19 -0
  106. amsdal/models/core/class_property.pyi +10 -0
  107. amsdal/models/core/class_property_meta.py +15 -0
  108. amsdal/models/core/class_property_meta.pyi +10 -0
  109. amsdal/models/core/file.py +156 -0
  110. amsdal/models/core/file.pyi +104 -0
  111. amsdal/models/core/fixture.py +25 -0
  112. amsdal/models/core/fixture.pyi +14 -0
  113. amsdal/models/core/option.py +11 -0
  114. amsdal/models/core/option.pyi +8 -0
  115. amsdal/models/core/validator.py +12 -0
  116. amsdal/models/core/validator.pyi +8 -0
  117. amsdal/models/types/__init__.py +0 -0
  118. amsdal/models/types/__init__.pyi +0 -0
  119. amsdal/models/types/object.py +26 -0
  120. amsdal/models/types/object.pyi +16 -0
  121. amsdal/schemas/core/file/properties/from_file.py +1 -1
  122. amsdal/schemas/core/file/properties/validate_data.py +1 -1
  123. amsdal/schemas/interfaces.py +25 -0
  124. amsdal/schemas/interfaces.pyi +20 -0
  125. amsdal/schemas/manager.cpython-312-darwin.so +0 -0
  126. amsdal/schemas/manager.py +0 -116
  127. amsdal/schemas/manager.pyi +0 -65
  128. amsdal/schemas/mixins/__init__.py +0 -0
  129. amsdal/schemas/mixins/__init__.pyi +0 -0
  130. amsdal/schemas/mixins/check_dependencies_mixin.py +115 -0
  131. amsdal/schemas/mixins/check_dependencies_mixin.pyi +42 -0
  132. amsdal/schemas/mixins/verify_schemas_mixin.py +96 -0
  133. amsdal/schemas/mixins/verify_schemas_mixin.pyi +33 -0
  134. amsdal/schemas/repository.py +84 -0
  135. amsdal/schemas/repository.pyi +22 -0
  136. amsdal/schemas/utils.py +16 -0
  137. amsdal/schemas/utils.pyi +10 -0
  138. amsdal/services/__init__.cpython-312-darwin.so +0 -0
  139. amsdal/services/transaction_execution.cpython-312-darwin.so +0 -0
  140. amsdal/services/transaction_execution.pyi +1 -1
  141. amsdal/utils/rollback/__init__.py +99 -54
  142. amsdal/utils/tests/helpers.py +185 -36
  143. {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/METADATA +8 -8
  144. {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/RECORD +150 -142
  145. {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/WHEEL +1 -1
  146. amsdal/contrib/auth/models/login_session/hooks/pre_init.py +0 -68
  147. amsdal/contrib/auth/models/login_session/model.json +0 -23
  148. amsdal/contrib/auth/models/login_session/modifiers/display_name.py +0 -11
  149. amsdal/contrib/auth/models/permission/fixtures/basic_permissions.json +0 -62
  150. amsdal/contrib/auth/models/permission/model.json +0 -18
  151. amsdal/contrib/auth/models/permission/modifiers/display_name.py +0 -11
  152. amsdal/contrib/auth/models/user/hooks/post_init.py +0 -76
  153. amsdal/contrib/auth/models/user/hooks/pre_create.py +0 -8
  154. amsdal/contrib/auth/models/user/model.json +0 -25
  155. amsdal/contrib/auth/models/user/modifiers/display_name.py +0 -19
  156. amsdal/contrib/frontend_configs/models/frontend_activator_config/model.json +0 -11
  157. amsdal/contrib/frontend_configs/models/frontend_config_async_validator/model.json +0 -11
  158. amsdal/contrib/frontend_configs/models/frontend_config_group_validator/model.json +0 -52
  159. amsdal/contrib/frontend_configs/models/frontend_config_option/model.json +0 -15
  160. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/model.json +0 -6
  161. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/properties/model_dump.py +0 -13
  162. amsdal/contrib/frontend_configs/models/frontend_config_slider_option/model.json +0 -19
  163. amsdal/contrib/frontend_configs/models/frontend_config_text_mask/model.json +0 -26
  164. amsdal/contrib/frontend_configs/models/frontend_config_validator/model.json +0 -41
  165. amsdal/contrib/frontend_configs/models/frontend_control_config/model.json +0 -250
  166. amsdal/contrib/frontend_configs/models/frontend_model_config/fixtures/permissions.json +0 -24
  167. amsdal/contrib/frontend_configs/models/frontend_model_config/model.json +0 -17
  168. amsdal/contrib/frontend_configs/models/frontent_config_control_action/model.json +0 -54
  169. amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +0 -33
  170. amsdal/migration/__init__.cpython-312-darwin.so +0 -0
  171. amsdal/migration/base_migration_schemas.cpython-312-darwin.so +0 -0
  172. amsdal/migration/base_migration_schemas.pyi +0 -120
  173. amsdal/migration/data_classes.cpython-312-darwin.so +0 -0
  174. amsdal/migration/data_classes.pyi +0 -172
  175. amsdal/migration/executors/__init__.cpython-312-darwin.so +0 -0
  176. amsdal/migration/executors/base.cpython-312-darwin.so +0 -0
  177. amsdal/migration/executors/base.pyi +0 -118
  178. amsdal/migration/executors/default_executor.cpython-312-darwin.so +0 -0
  179. amsdal/migration/executors/default_executor.pyi +0 -184
  180. amsdal/migration/executors/state_executor.cpython-312-darwin.so +0 -0
  181. amsdal/migration/executors/state_executor.pyi +0 -151
  182. amsdal/migration/file_migration_executor.cpython-312-darwin.so +0 -0
  183. amsdal/migration/file_migration_executor.pyi +0 -122
  184. amsdal/migration/file_migration_generator.cpython-312-darwin.so +0 -0
  185. amsdal/migration/file_migration_generator.pyi +0 -229
  186. amsdal/migration/file_migration_store.cpython-312-darwin.so +0 -0
  187. amsdal/migration/file_migration_store.pyi +0 -114
  188. amsdal/migration/file_migration_writer.cpython-312-darwin.so +0 -0
  189. amsdal/migration/file_migration_writer.pyi +0 -73
  190. amsdal/migration/migrations.cpython-312-darwin.so +0 -0
  191. amsdal/migration/migrations.pyi +0 -166
  192. amsdal/migration/migrations_loader.cpython-312-darwin.so +0 -0
  193. amsdal/migration/migrations_loader.pyi +0 -32
  194. amsdal/migration/schemas_loaders.cpython-312-darwin.so +0 -0
  195. amsdal/migration/schemas_loaders.pyi +0 -37
  196. amsdal/migration/templates/data_migration.tmpl +0 -18
  197. amsdal/migration/templates/dict_validator.tmpl +0 -4
  198. amsdal/migration/templates/migration.tmpl +0 -6
  199. amsdal/migration/templates/model_class.tmpl +0 -8
  200. amsdal/migration/templates/model_class_layout.tmpl +0 -24
  201. amsdal/migration/templates/options_validator.tmpl +0 -4
  202. amsdal/migration/utils.cpython-312-darwin.so +0 -0
  203. amsdal/migration/utils.pyi +0 -58
  204. amsdal/mixins/build_mixin.cpython-312-darwin.so +0 -0
  205. amsdal/mixins/build_mixin.pyi +0 -78
  206. /amsdal/{migration/__init__.pyi → contrib/auth/models/__init__.py} +0 -0
  207. /amsdal/{migration/executors → contrib/auth/models}/__init__.pyi +0 -0
  208. {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/LICENSE.txt +0 -0
  209. {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/licenses/LICENSE.txt +0 -0
  210. {amsdal-0.3.5.dist-info → amsdal-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,35 @@
1
+ from amsdal.contrib.frontend_configs.models.frontend_activator_config import *
2
+ from amsdal.contrib.frontend_configs.models.frontend_config_async_validator import *
3
+ from amsdal.contrib.frontend_configs.models.frontend_config_control_action import *
4
+ from amsdal.contrib.frontend_configs.models.frontend_config_option import *
5
+ from amsdal.contrib.frontend_configs.models.frontend_config_skip_none_base import *
6
+ from amsdal.contrib.frontend_configs.models.frontend_config_slider_option import *
7
+ from amsdal.contrib.frontend_configs.models.frontend_config_text_mask import *
8
+ from amsdal.contrib.frontend_configs.models.frontend_config_validator import *
9
+ from amsdal_utils.models.enums import ModuleType
10
+ from typing import Any, ClassVar
11
+
12
+ class FrontendControlConfig(FrontendConfigSkipNoneBase):
13
+ __module_type__: ClassVar[ModuleType]
14
+ type: str
15
+ name: str
16
+ label: str | None
17
+ required: bool | None
18
+ hideLabel: bool | None
19
+ actions: list['FrontendConfigControlAction'] | None
20
+ validators: list['FrontendConfigValidator'] | None
21
+ asyncValidators: list['FrontendConfigAsyncValidator'] | None
22
+ activators: list['FrontendActivatorConfig'] | None
23
+ additionalText: str | None
24
+ value: Any | None
25
+ placeholder: str | None
26
+ options: list['FrontendConfigOption'] | None
27
+ mask: FrontendConfigTextMask | None
28
+ controls: list['FrontendControlConfig'] | None
29
+ showSearch: bool | None
30
+ sliderOptions: FrontendConfigSliderOption | None
31
+ customLabel: list[str] | None
32
+ control: FrontendControlConfig | None
33
+ entityType: str | None
34
+ @classmethod
35
+ def validate_value_in_options_type(cls, value: Any) -> Any: ...
@@ -0,0 +1,14 @@
1
+ from typing import ClassVar
2
+ from typing import Optional
3
+
4
+ from amsdal_models.classes.model import Model
5
+ from amsdal_utils.models.enums import ModuleType
6
+ from pydantic.fields import Field
7
+
8
+ from amsdal.contrib.frontend_configs.models.frontend_control_config import * # noqa: F403
9
+
10
+
11
+ class FrontendModelConfig(Model):
12
+ __module_type__: ClassVar[ModuleType] = ModuleType.CONTRIB
13
+ class_name: str = Field(title='Class Name')
14
+ control: Optional['FrontendControlConfig'] = Field(None, title='Control') # noqa: F405
@@ -0,0 +1,9 @@
1
+ from amsdal.contrib.frontend_configs.models.frontend_control_config import *
2
+ from amsdal_models.classes.model import Model
3
+ from amsdal_utils.models.enums import ModuleType
4
+ from typing import ClassVar
5
+
6
+ class FrontendModelConfig(Model):
7
+ __module_type__: ClassVar[ModuleType] = ...
8
+ class_name: str = ...
9
+ control: FrontendControlConfig | None = ...
amsdal/errors.py CHANGED
@@ -7,9 +7,6 @@ class AmsdalRuntimeError(AmsdalError): ...
7
7
  class TransactionNotFoundError(AmsdalError): ...
8
8
 
9
9
 
10
- class MigrationsError(AmsdalError): ...
11
-
12
-
13
10
  class AmsdalAuthenticationError(AmsdalRuntimeError): ...
14
11
 
15
12
 
amsdal/errors.pyi CHANGED
@@ -2,7 +2,6 @@ from amsdal_utils.errors import AmsdalError
2
2
 
3
3
  class AmsdalRuntimeError(AmsdalError): ...
4
4
  class TransactionNotFoundError(AmsdalError): ...
5
- class MigrationsError(AmsdalError): ...
6
5
  class AmsdalAuthenticationError(AmsdalRuntimeError): ...
7
6
  class AmsdalDeployError(AmsdalRuntimeError): ...
8
7
  class AmsdalCloudError(AmsdalRuntimeError): ...
@@ -1,11 +1,10 @@
1
1
  from _typeshed import Incomplete
2
- from amsdal.schemas.manager import SchemaManager as SchemaManager
3
- from amsdal_models.classes.manager import ClassManager
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
2
+ from amsdal.fixtures.utils import process_fixture_value as process_fixture_value
3
+ from amsdal_models.classes.model import Model
4
+ from collections.abc import Generator
7
5
  from pathlib import Path
8
6
  from pydantic import BaseModel
7
+ from pydantic.fields import FieldInfo as FieldInfo
9
8
  from typing import Any
10
9
 
11
10
  logger: Incomplete
@@ -13,24 +12,16 @@ logger: Incomplete
13
12
  class FixtureData(BaseModel):
14
13
  class_name: str
15
14
  external_id: str
15
+ order: float
16
16
  data: dict[str, Any]
17
17
 
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
- """
26
- fixtures_path: Incomplete
27
- fixtures: Incomplete
28
- _created_cache: Incomplete
29
- data_to_process: Incomplete
18
+ class BaseFixturesManager:
19
+ ORDER_MULTIPLIER: int
20
+ fixtures_paths: Incomplete
21
+ fixtures: dict[str | int, list[tuple[float, FixtureData]]]
30
22
  _class_manager: Incomplete
31
23
  _config_manager: Incomplete
32
- _schema_manager: Incomplete
33
- def __init__(self, fixtures_path: Path, class_manager: ClassManager, config_manager: AmsdalConfigManager, schema_manager: SchemaManager) -> None: ...
24
+ def __init__(self, fixtures_paths: list[Path]) -> None: ...
34
25
  def load_fixtures(self) -> None:
35
26
  """
36
27
  Loads fixture data from the specified path.
@@ -42,41 +33,45 @@ class FixturesManager:
42
33
  Returns:
43
34
  None
44
35
  """
45
- def construct_nested_object(self, external_id: Any) -> Any:
46
- """
47
- Constructs a nested object reference from the given external ID.
36
+ def _load_fixtures(self, fixtures_path: Path, order_shift: int = 0) -> None: ...
37
+ def iter_fixtures(self) -> Generator[FixtureData, None, None]: ...
38
+ def _process_object_data(self, data: dict[str, Any], model_fields: dict[str, FieldInfo], m2m_fields: dict[str, type[Model]]) -> dict[str, Any]: ...
48
39
 
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.
40
+ class FixturesManager(BaseFixturesManager):
41
+ """
42
+ Manager class for handling fixture data.
53
43
 
54
- Args:
55
- external_id (Any): The external ID to construct the nested object reference from.
44
+ This class is responsible for loading, processing, and applying fixture data
45
+ to the database. It supports nested object construction, data processing,
46
+ and file fixture handling.
47
+ """
48
+ def apply_file_fixtures(self) -> None:
49
+ """
50
+ Applies file fixtures from the specified directory.
51
+
52
+ This method processes file fixtures located in the 'files' directory adjacent to the
53
+ `fixtures_path`. It iterates through each file, reads its content, and processes it
54
+ as a fixture. If the file fixture already exists in the database, it updates the
55
+ existing fixture; otherwise, it creates a new one.
56
56
 
57
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.
58
+ None
60
59
  """
61
- def _process_object_data(self, model_properties: dict[str, PropertyData], data: dict[str, Any]) -> dict[str, Any]: ...
62
- def _process_object_value(self, field_configuration: PropertyData | DictSchema | TypeData, value: Any) -> Any: ...
63
- def process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
60
+ def _apply_file_fixtures(self, file_dir: Path) -> None: ...
61
+ def _apply_file_fixtures_rec(self, nested_dir: Path, base_dir: Path) -> None: ...
62
+ def apply_fixtures(self) -> None:
64
63
  """
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.
64
+ Applies all loaded fixtures to the database.
70
65
 
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.
66
+ This method processes each fixture in the `fixtures` dictionary in the order
67
+ specified by their 'order' value. It calls the `process_fixture` method for
68
+ each fixture and then processes the data in the processing queue.
75
69
 
76
70
  Returns:
77
71
  None
78
72
  """
79
- def process_fixture(self, fixture: dict[str, Any]) -> None:
73
+ def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
74
+ def _process_fixture(self, fixture: FixtureData) -> FixtureData | None:
80
75
  """
81
76
  Processes a single fixture and adds it to the processing queue.
82
77
 
@@ -91,94 +86,58 @@ class FixturesManager:
91
86
  Returns:
92
87
  None
93
88
  """
94
- def apply_fixtures(self) -> None:
89
+ def _process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
95
90
  """
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.
91
+ Processes and saves fixture object data to the database.
101
92
 
102
- Returns:
103
- None
104
- """
105
- def _process_data(self) -> None: ...
106
- def apply_file_fixtures(self) -> None:
107
- """
108
- Applies file fixtures from the specified directory.
93
+ This method takes the class name, external ID, and data dictionary of a fixture object,
94
+ processes the data according to the class schema, and saves the object to the database.
95
+ If the object already exists, it updates the existing object with the new data.
109
96
 
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.
97
+ Args:
98
+ class_name (str): The name of the class to which the fixture object belongs.
99
+ external_id (str): The external ID of the fixture object.
100
+ data (dict[str, Any]): The data dictionary of the fixture object.
114
101
 
115
102
  Returns:
116
103
  None
117
104
  """
118
- def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
119
105
 
120
- class AsyncFixturesManager:
106
+ class AsyncFixturesManager(BaseFixturesManager):
121
107
  """
122
- Manager class for handling fixture data.
108
+ Manager class for handling fixture data asynchronously.
123
109
 
124
110
  This class is responsible for loading, processing, and applying fixture data
125
111
  to the database. It supports nested object construction, data processing,
126
112
  and file fixture handling.
127
113
  """
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:
114
+ async def apply_file_fixtures(self) -> None:
137
115
  """
138
- Loads fixture data from the specified path.
116
+ Applies file fixtures from the specified directory.
139
117
 
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.
118
+ This method processes file fixtures located in the 'files' directory adjacent to the
119
+ `fixtures_path`. It iterates through each file, reads its content, and processes it
120
+ as a fixture. If the file fixture already exists in the database, it updates the
121
+ existing fixture; otherwise, it creates a new one.
143
122
 
144
123
  Returns:
145
124
  None
146
125
  """
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:
126
+ async def _apply_file_fixtures(self, file_dir: Path) -> None: ...
127
+ async def _apply_file_fixtures_rec(self, nested_dir: Path, base_dir: Path) -> None: ...
128
+ async def apply_fixtures(self) -> None:
166
129
  """
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.
130
+ Applies all loaded fixtures to the database.
172
131
 
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.
132
+ This method processes each fixture in the `fixtures` dictionary in the order
133
+ specified by their 'order' value. It calls the `process_fixture` method for
134
+ each fixture and then processes the data in the processing queue.
177
135
 
178
136
  Returns:
179
137
  None
180
138
  """
181
- async def process_fixture(self, fixture: dict[str, Any]) -> None:
139
+ async def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
140
+ async def _process_fixture(self, fixture: FixtureData) -> FixtureData | None:
182
141
  """
183
142
  Processes a single fixture and adds it to the processing queue.
184
143
 
@@ -193,28 +152,19 @@ class AsyncFixturesManager:
193
152
  Returns:
194
153
  None
195
154
  """
196
- async def apply_fixtures(self) -> None:
155
+ async def _process_fixture_object_data(self, class_name: str, external_id: str, data: dict[str, Any]) -> None:
197
156
  """
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.
157
+ Processes and saves fixture object data to the database.
203
158
 
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.
159
+ This method takes the class name, external ID, and data dictionary of a fixture object,
160
+ processes the data according to the class schema, and saves the object to the database.
161
+ If the object already exists, it updates the existing object with the new data.
211
162
 
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.
163
+ Args:
164
+ class_name (str): The name of the class to which the fixture object belongs.
165
+ external_id (str): The external ID of the fixture object.
166
+ data (dict[str, Any]): The data dictionary of the fixture object.
216
167
 
217
168
  Returns:
218
169
  None
219
170
  """
220
- async def _process_file_fixture(self, file_path: Path, file_key: str) -> None: ...
@@ -0,0 +1,9 @@
1
+ from amsdal_utils.models.data_models.reference import Reference
2
+ from types import GenericAlias
3
+ from typing import Any
4
+
5
+ def process_fixture_value(annotation: Any, value: Any) -> Any: ...
6
+ def _cast_value_to_type(value_type: type | GenericAlias, value: Any) -> Any: ...
7
+ def _is_optional(annotation: Any) -> bool: ...
8
+ def _resolve_type_from_optional(annotation: Any) -> Any: ...
9
+ def _construct_reference_value(class_name: str, object_id: Any) -> Reference: ...
Binary file
amsdal/manager.pyi CHANGED
@@ -1,19 +1,15 @@
1
1
  from _typeshed import Incomplete
2
2
  from amsdal.cloud.services.actions.manager import CloudActionsManager as CloudActionsManager
3
- from amsdal.cloud.services.auth.manager import AuthManager as AuthManager
4
3
  from amsdal.cloud.services.auth.signup_service import SignupService as SignupService
5
4
  from amsdal.configs.main import settings as settings
6
5
  from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError, AmsdalMissingCredentialsError as AmsdalMissingCredentialsError, AmsdalRuntimeError as AmsdalRuntimeError, AmsdalSignupError as AmsdalSignupError
7
6
  from amsdal.fixtures.manager import AsyncFixturesManager as AsyncFixturesManager, FixturesManager as FixturesManager
8
- from amsdal.mixins.build_mixin import BuildMixin as BuildMixin
9
7
  from amsdal.mixins.class_versions_mixin import ClassVersionsMixin as ClassVersionsMixin
10
- from amsdal.schemas.manager import SchemaManager as SchemaManager
11
- from amsdal_models.classes.manager import ClassManager
8
+ from amsdal_models.classes.class_manager import ClassManager
12
9
  from amsdal_utils.config.data_models.amsdal_config import AmsdalConfig as AmsdalConfig
13
10
  from amsdal_utils.utils.singleton import Singleton
14
- from pathlib import Path
15
11
 
16
- class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
12
+ class AmsdalManager(ClassVersionsMixin, metaclass=Singleton):
17
13
  """
18
14
  Manages the AMSDAL framework components and operations.
19
15
 
@@ -27,7 +23,6 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
27
23
  _data_application: Incomplete
28
24
  _is_setup: bool
29
25
  __is_authenticated: bool
30
- _schema_manager: Incomplete
31
26
  _metadata_manager: Incomplete
32
27
  _auth_manager: Incomplete
33
28
  def __init__(self, *, raise_on_new_signup: bool = False) -> None:
@@ -54,7 +49,7 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
54
49
  """
55
50
  Initiates models root path and adds it into sys.path.
56
51
 
57
- This method initializes the class manager and sets up the models root path
52
+ This method initializes the class manager models modules and sets up the models root path
58
53
  as specified in the settings. It ensures that the models root path is added
59
54
  to the system path for proper module resolution.
60
55
 
@@ -78,49 +73,6 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
78
73
  """
79
74
  Registers internal classes and prepares connections (creates internal tables).
80
75
  """
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:
82
- """
83
- Builds the necessary components for the Amsdal framework.
84
-
85
- This method is used to build the necessary components for the Amsdal framework.
86
- It takes five parameters which are all of type `Path`.
87
- These parameters represent the paths to the directories where the corresponding components are located.
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
-
99
- The method performs the following build steps in order:
100
- - Builds the models from the `source_models_path` by calling the `build_models` method.
101
- - Builds the transactions from the `source_transactions_path` by calling the `build_transactions` method.
102
- - Builds the static files from the `source_static_files_path` by calling the `build_static_files` method.
103
- - Builds the fixtures from the `source_fixtures_path` by calling the `build_fixtures` method.
104
-
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.
109
- """
110
- def migrate(self) -> None:
111
- """
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
123
- """
124
76
  def _check_auth(self) -> None: ...
125
77
  @property
126
78
  def cloud_actions_manager(self) -> CloudActionsManager:
@@ -182,7 +134,7 @@ class AmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
182
134
  None
183
135
  """
184
136
 
185
- class AsyncAmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
137
+ class AsyncAmsdalManager(ClassVersionsMixin, metaclass=Singleton):
186
138
  """
187
139
  Manages the AMSDAL framework components and operations.
188
140
 
@@ -196,7 +148,6 @@ class AsyncAmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
196
148
  _data_application: Incomplete
197
149
  _is_setup: bool
198
150
  __is_authenticated: bool
199
- _schema_manager: Incomplete
200
151
  _metadata_manager: Incomplete
201
152
  _auth_manager: Incomplete
202
153
  def __init__(self, *, raise_on_new_signup: bool = False) -> None:
@@ -247,49 +198,6 @@ class AsyncAmsdalManager(BuildMixin, ClassVersionsMixin, metaclass=Singleton):
247
198
  """
248
199
  Registers internal classes and prepares connections (creates internal tables).
249
200
  """
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
201
  def _check_auth(self) -> None: ...
294
202
  @property
295
203
  def cloud_actions_manager(self) -> CloudActionsManager:
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,37 @@
1
+ from typing import Any
2
+ from typing import ClassVar
3
+ from typing import Optional
4
+
5
+ from amsdal_models.builder.validators.dict_validators import validate_non_empty_keys
6
+ from amsdal_models.classes.model import Model
7
+ from amsdal_utils.models.enums import ModuleType
8
+ from pydantic.fields import Field
9
+ from pydantic.functional_validators import field_validator
10
+
11
+ from amsdal.models.core.class_property import * # noqa: F403
12
+
13
+
14
+ class ClassObject(Model):
15
+ __module_type__: ClassVar[ModuleType] = ModuleType.CORE
16
+ properties: Optional[dict[str, Optional['ClassProperty']]] = Field(None, title='Properties') # noqa: F405, UP007
17
+ table_name: Optional[str] = Field(None, title='Table name') # noqa: UP007
18
+ primary_key: Optional[dict[str, list[str]]] = Field(None, title='Primary key fields') # noqa: UP007
19
+ indexed: Optional[list[str]] = Field(None, title='Indexed') # noqa: UP007
20
+ unique: Optional[list[list[str]]] = Field(None, title='Unique Fields') # noqa: UP007
21
+ required: Optional[list[str]] = Field(None, title='Required') # noqa: UP007
22
+ meta_class: Optional[str] = Field('ClassObject', title='Meta Class') # noqa: UP007
23
+
24
+ @field_validator('properties')
25
+ @classmethod
26
+ def _non_empty_keys_properties(cls: type, value: Any) -> Any:
27
+ return validate_non_empty_keys(value)
28
+
29
+ @property
30
+ def display_name(self) -> str:
31
+ """
32
+ Returns the display name of the object.
33
+
34
+ Returns:
35
+ str: The display name, which is the title of the object.
36
+ """
37
+ return self.title
@@ -0,0 +1,24 @@
1
+ from amsdal.models.core.class_property import *
2
+ from amsdal_models.classes.model import Model
3
+ from amsdal_utils.models.enums import ModuleType
4
+ from typing import Any, ClassVar
5
+
6
+ class ClassObject(Model):
7
+ __module_type__: ClassVar[ModuleType] = ...
8
+ properties: dict[str, ClassProperty | None] | None = ...
9
+ table_name: str | None = ...
10
+ primary_key: dict[str, list[str]] | None = ...
11
+ indexed: list[str] | None = ...
12
+ unique: list[list[str]] | None = ...
13
+ required: list[str] | None = ...
14
+ meta_class: str | None = ...
15
+ @classmethod
16
+ def _non_empty_keys_properties(cls, value: Any) -> Any: ...
17
+ @property
18
+ def display_name(self) -> str:
19
+ """
20
+ Returns the display name of the object.
21
+
22
+ Returns:
23
+ str: The display name, which is the title of the object.
24
+ """
@@ -0,0 +1,26 @@
1
+ from typing import Any
2
+ from typing import ClassVar
3
+ from typing import Optional
4
+
5
+ from amsdal_models.builder.validators.dict_validators import validate_non_empty_keys
6
+ from amsdal_models.classes.model import Model
7
+ from amsdal_utils.models.enums import ModuleType
8
+ from pydantic.fields import Field
9
+ from pydantic.functional_validators import field_validator
10
+
11
+ from amsdal.models.core.class_property_meta import * # noqa: F403
12
+
13
+
14
+ class ClassObjectMeta(Model):
15
+ __module_type__: ClassVar[ModuleType] = ModuleType.CORE
16
+ title: str = Field(title='Title')
17
+ type: str = Field(title='Type')
18
+ default: Any | None = Field(None, title='Default')
19
+ class_schema_type: str | None = Field(None, title='Schema Type')
20
+ properties: dict[str, Optional['ClassPropertyMeta']] | None = Field(None, title='Properties') # noqa: F405
21
+ custom_code: str | None = Field(None, title='Custom Code')
22
+
23
+ @field_validator('properties')
24
+ @classmethod
25
+ def _non_empty_keys_properties(cls: type, value: Any) -> Any: # type: ignore # noqa: A003
26
+ return validate_non_empty_keys(value)