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
@@ -1,24 +0,0 @@
1
- {
2
- "Permission": [
3
- {
4
- "external_id": "frontend_model_config_read",
5
- "model": "FrontendModelConfig",
6
- "action": "read"
7
- },
8
- {
9
- "external_id": "frontend_model_config_update",
10
- "model": "FrontendModelConfig",
11
- "action": "update"
12
- },
13
- {
14
- "external_id": "frontend_model_config_delete",
15
- "model": "FrontendModelConfig",
16
- "action": "delete"
17
- },
18
- {
19
- "external_id": "frontend_model_config_create",
20
- "model": "FrontendModelConfig",
21
- "action": "create"
22
- }
23
- ]
24
- }
@@ -1,17 +0,0 @@
1
- {
2
- "title": "FrontendModelConfig",
3
- "type": "object",
4
- "properties": {
5
- "class_name": {
6
- "title": "Class Name",
7
- "type": "string"
8
- },
9
- "control": {
10
- "title": "Control",
11
- "type": "FrontendControlConfig"
12
- }
13
- },
14
- "required": [
15
- "class_name"
16
- ]
17
- }
@@ -1,54 +0,0 @@
1
- {
2
- "title": "FrontendConfigControlAction",
3
- "type": "FrontendConfigSkipNoneBase",
4
- "properties": {
5
- "action": {
6
- "title": "Action",
7
- "type": "string"
8
- },
9
- "text": {
10
- "title": "Text",
11
- "type": "string"
12
- },
13
- "type": {
14
- "title": "Type",
15
- "type": "string",
16
- "options": [
17
- {
18
- "key": "Arrow Next",
19
- "value": "arrow-next"
20
- },
21
- {
22
- "key": "Arrow Prev",
23
- "value": "arrow-prev"
24
- },
25
- {
26
- "key": "Action Button",
27
- "value": "action-button"
28
- },
29
- {
30
- "key": "Text Next",
31
- "value": "text-next"
32
- },
33
- {
34
- "key": "Text Prev",
35
- "value": "text-prev"
36
- }
37
- ]
38
- },
39
- "dataLayerEvent": {
40
- "title": "Data Layer Event",
41
- "type": "string"
42
- },
43
- "activator": {
44
- "title": "Activator",
45
- "type": "string"
46
- },
47
- "icon": {
48
- "title": "Icon",
49
- "type": "string"
50
- }
51
- },
52
- "required": ["action", "text", "type"],
53
- "meta_class": "TypeMeta"
54
- }
@@ -1,33 +0,0 @@
1
- from pydantic import field_validator
2
-
3
-
4
- @field_validator('action', mode='after') # type: ignore[misc]
5
- @classmethod
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
- """
23
- if not v.startswith('navigate::') and v not in [
24
- 'goPrev',
25
- 'goNext',
26
- 'goNextWithSubmit',
27
- 'submit',
28
- 'submitWithDataLayer',
29
- ]:
30
- msg = 'Action must be one of: goPrev, goNext, goNextWithSubmit, submit, submitWithDataLayer, navigate::{string}'
31
- raise ValueError(msg)
32
-
33
- return v
@@ -1,120 +0,0 @@
1
- import abc
2
- from _typeshed import Incomplete
3
- from abc import ABC, abstractmethod
4
- from amsdal.configs.constants import BASE_DIR as BASE_DIR
5
- from amsdal_models.classes.model import Model
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
- from amsdal_utils.models.enums import SchemaTypes as SchemaTypes, Versions
9
- from pathlib import Path
10
-
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
- """
19
- _classes: Incomplete
20
- _classes_versions: Incomplete
21
- _buffered_classes: Incomplete
22
- def __init__(self) -> None: ...
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
- """
33
- @abstractmethod
34
- def register_model(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes, class_version: str | Versions = ...) -> None: ...
35
- @abstractmethod
36
- def unregister_model(self, class_name: str) -> None: ...
37
- @abstractmethod
38
- def compile_buffered_classes(self) -> None: ...
39
- @staticmethod
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
- """
53
-
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
- """
67
- model_class_template_layout: Path
68
- model_class_template: Path
69
- dict_validator_template: Path
70
- options_validator_template: Path
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
- """
110
- def _compile_buffered_classes(self) -> list[tuple[str, type[Model]]]: ...
111
- def _build_class_source(self, class_name: str, schema: ObjectSchema, schema_type: SchemaTypes) -> tuple[str, str]: ...
112
- @staticmethod
113
- def _resolve_class_inheritance(schema: ObjectSchema) -> str: ...
114
- @staticmethod
115
- def _process_custom_code(custom_code: str | None) -> tuple[str, str]: ...
116
- def _render_property(self, name: str, property_schema: PropertyData, required: list[str]) -> str: ...
117
- def _render_type_annotation(self, type_: str, items: TypeData | DictSchema | LegacyDictSchema | None) -> str: ...
118
- def _render_validators(self, schema: ObjectSchema) -> list[str]: ...
119
- def _get_all_types(self, type_: str, items: TypeData | DictSchema | LegacyDictSchema | None) -> set[str]: ...
120
- def _is_reference(self, type_: str) -> bool: ...
@@ -1,172 +0,0 @@
1
- from amsdal_models.classes.model import Model
2
- from amsdal_utils.models.data_models.address import Address as Address
3
- from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema, PropertyData as PropertyData
4
- from amsdal_utils.models.enums import SchemaTypes as SchemaTypes
5
- from dataclasses import dataclass
6
- from enum import Enum
7
- from pathlib import Path
8
-
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
- """
18
- CREATE = 'CREATE'
19
- UPDATE = 'UPDATE'
20
- NO_ACTION = 'NO_ACTION'
21
-
22
- @dataclass
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
- """
31
- action: Action
32
- instance: Model
33
- def __init__(self, action, instance) -> None: ...
34
-
35
- @dataclass
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
- """
44
- is_updated: bool
45
- class_instance: Model
46
- def __init__(self, is_updated, class_instance) -> None: ...
47
-
48
- @dataclass
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
- """
58
- class_instance: Model
59
- is_table_created: bool
60
- is_data_migrated: bool
61
- def __init__(self, class_instance, is_table_created, is_data_migrated) -> None: ...
62
-
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
- """
72
- APP = 'APP'
73
- CORE = 'CORE'
74
- CONTRIB = 'CONTRIB'
75
-
76
- @dataclass
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
- """
89
- path: Path
90
- type: ModuleTypes
91
- number: int
92
- module: str | None = ...
93
- applied_at: float | None = ...
94
- stored_address: Address | None = ...
95
- @property
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
- """
103
- def __init__(self, path, type, number, module=..., applied_at=..., stored_address=...) -> None: ...
104
-
105
- @dataclass
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
- """
114
- object_schema: ObjectSchema
115
- type: ModuleTypes
116
- def __init__(self, object_schema, type) -> None: ...
117
-
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
- """
127
- CREATE_CLASS = 'CREATE_CLASS'
128
- UPDATE_CLASS = 'UPDATE_CLASS'
129
- DELETE_CLASS = 'DELETE_CLASS'
130
-
131
- @dataclass
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
- """
143
- type: OperationTypes
144
- class_name: str
145
- schema_type: SchemaTypes
146
- old_schema: ObjectSchema | PropertyData | None = ...
147
- new_schema: ObjectSchema | PropertyData | None = ...
148
- def __init__(self, type, class_name, schema_type, old_schema=..., new_schema=...) -> None: ...
149
-
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
- """
158
- FORWARD = 'forward'
159
- BACKWARD = 'backward'
160
-
161
- @dataclass
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
- """
170
- direction: MigrationDirection
171
- migration: MigrationFile
172
- def __init__(self, direction, migration) -> None: ...
@@ -1,118 +0,0 @@
1
- import abc
2
- from _typeshed import Incomplete
3
- from abc import ABC, abstractmethod
4
- from amsdal.migration.base_migration_schemas import BaseMigrationSchemas as BaseMigrationSchemas
5
- from amsdal_utils.models.data_models.schema import ObjectSchema as ObjectSchema
6
- from amsdal_utils.models.enums import SchemaTypes as SchemaTypes
7
- from pydantic import BaseModel
8
-
9
- class FieldDescription(BaseModel):
10
- """
11
- Represents a description of a field in a database schema.
12
-
13
- This class holds information about a field, including its name, ID, type,
14
- and whether it has been marked as deleted.
15
-
16
- Attributes:
17
- field_name (str): The name of the field.
18
- field_id (str): The unique identifier of the field.
19
- field_type (str): The type of the field.
20
- is_deleted (bool): Indicates whether the field is marked as deleted.
21
- """
22
- field_name: str
23
- field_id: str
24
- field_type: str
25
- is_deleted: bool
26
-
27
- def _schema_to_table_description(schema: ObjectSchema | None) -> dict[str, str]: ...
28
- def _compare_schemas(previous_scheme: dict[str, str], new_scheme: dict[str, str]) -> list[tuple[str, str, str]]: ...
29
- def _id_for_column(field_name: str, iteration: str | int) -> str: ...
30
- def _new_table_schemas(previous_scheme: ObjectSchema | None, new_scheme: ObjectSchema, iteration: int, existing_table_structure: list[FieldDescription]) -> None: ...
31
-
32
- class BaseMigrationExecutor(ABC, metaclass=abc.ABCMeta):
33
- """
34
- Abstract base class for executing migration operations on database schemas.
35
-
36
- This class provides methods for creating, updating, and deleting classes in the database schema.
37
- It also manages schema migration buffers and generates full object schemas based on the migration history.
38
- """
39
- schemas: BaseMigrationSchemas
40
- _buffer: Incomplete
41
- _non_flushable_buffer: Incomplete
42
- def __init__(self) -> None: ...
43
- def generate_full_object_schema(self, class_name: str, object_schema: ObjectSchema, buffer: list[tuple[str, ObjectSchema, SchemaTypes]]) -> list[FieldDescription]:
44
- """
45
- Generates the full object schema based on the migration history.
46
-
47
- This method constructs the full object schema for a given class by iterating through
48
- the migration history buffer and applying schema changes in sequence.
49
-
50
- Args:
51
- class_name (str): The name of the class for which the schema is being generated.
52
- object_schema (ObjectSchema): The current object schema.
53
- buffer (list[tuple[str, ObjectSchema, SchemaTypes]]): The migration history buffer.
54
-
55
- Returns:
56
- list[FieldDescription]: A list of field descriptions representing the full object schema.
57
- """
58
- @abstractmethod
59
- def create_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
60
- @abstractmethod
61
- def update_class(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None: ...
62
- @abstractmethod
63
- def delete_class(self, schemas: BaseMigrationSchemas, class_name: str, schema_type: SchemaTypes) -> None: ...
64
- def forward_schema(self, schemas: BaseMigrationSchemas, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
65
- """
66
- Forwards the schema to the non-flushable buffer.
67
-
68
- This method appends the given class name, object schema, and schema type to the
69
- non-flushable buffer for further processing.
70
-
71
- Args:
72
- schemas (BaseMigrationSchemas): The migration schemas used for the operations.
73
- class_name (str): The name of the class for which the schema is being forwarded.
74
- object_schema (ObjectSchema): The current object schema.
75
- schema_type (SchemaTypes): The type of the schema.
76
-
77
- Returns:
78
- None
79
- """
80
- @staticmethod
81
- def _resolve_base_class_name(class_name: str, meta_class: str) -> str: ...
82
- def buffer_class_migration(self, class_name: str, object_schema: ObjectSchema, schema_type: SchemaTypes) -> None:
83
- """
84
- Buffers the class migration operation.
85
-
86
- This method appends the given class name, object schema, and schema type to both
87
- the non-flushable buffer and the main buffer for further processing.
88
-
89
- Args:
90
- class_name (str): The name of the class for which the migration is being buffered.
91
- object_schema (ObjectSchema): The current object schema.
92
- schema_type (SchemaTypes): The type of the schema.
93
-
94
- Returns:
95
- None
96
- """
97
- def flush_buffer(self) -> None:
98
- """
99
- Flushes the migration buffer.
100
-
101
- This method clears all entries from the main migration buffer, effectively
102
- resetting it for future migration operations.
103
-
104
- Returns:
105
- None
106
- """
107
-
108
- class AsyncBaseMigrationExecutor(BaseMigrationExecutor, metaclass=abc.ABCMeta):
109
- async def flush_buffer(self) -> None:
110
- """
111
- Flushes the migration buffer.
112
-
113
- This method clears all entries from the main migration buffer, effectively
114
- resetting it for future migration operations.
115
-
116
- Returns:
117
- None
118
- """