amsdal 0.1.26__cp310-cp310-win_amd64.whl → 0.1.27__cp310-cp310-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.
- amsdal/__about__.py +1 -1
- amsdal/cloud/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/client.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/client.pyi +46 -2
- amsdal/cloud/constants.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/enums.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/enums.pyi +46 -0
- amsdal/cloud/models/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/models/base.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/models/base.pyi +156 -0
- amsdal/cloud/services/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.pyi +16 -1
- amsdal/cloud/services/actions/add_basic_auth.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/add_basic_auth.pyi +17 -1
- amsdal/cloud/services/actions/add_dependency.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/add_dependency.pyi +16 -1
- amsdal/cloud/services/actions/add_secret.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/add_secret.pyi +17 -1
- amsdal/cloud/services/actions/base.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/base.pyi +71 -3
- amsdal/cloud/services/actions/create_deploy.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/create_deploy.pyi +33 -3
- amsdal/cloud/services/actions/create_env.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/create_env.pyi +15 -1
- amsdal/cloud/services/actions/create_session.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/create_session.pyi +13 -1
- amsdal/cloud/services/actions/delete_allowlist_ip.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.pyi +16 -1
- amsdal/cloud/services/actions/delete_basic_auth.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/delete_basic_auth.pyi +17 -1
- amsdal/cloud/services/actions/delete_dependency.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/delete_dependency.pyi +18 -1
- amsdal/cloud/services/actions/delete_env.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/delete_env.pyi +17 -1
- amsdal/cloud/services/actions/delete_secret.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/delete_secret.pyi +18 -1
- amsdal/cloud/services/actions/destroy_deploy.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/destroy_deploy.pyi +15 -1
- amsdal/cloud/services/actions/expose_db.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/expose_db.pyi +18 -1
- amsdal/cloud/services/actions/get_basic_auth_credentials.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.pyi +17 -1
- amsdal/cloud/services/actions/get_monitoring_info.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/get_monitoring_info.pyi +17 -1
- amsdal/cloud/services/actions/list_dependencies.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/list_dependencies.pyi +17 -1
- amsdal/cloud/services/actions/list_deploys.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/list_deploys.pyi +15 -1
- amsdal/cloud/services/actions/list_envs.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/list_envs.pyi +16 -1
- amsdal/cloud/services/actions/list_secrets.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/list_secrets.pyi +18 -1
- amsdal/cloud/services/actions/manager.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/manager.pyi +254 -20
- amsdal/cloud/services/actions/signup_action.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/signup_action.pyi +16 -1
- amsdal/cloud/services/actions/update_deploy.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/actions/update_deploy.pyi +15 -1
- amsdal/cloud/services/auth/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/auth/base.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/auth/credentials.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/auth/credentials.pyi +12 -1
- amsdal/cloud/services/auth/manager.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/auth/manager.pyi +15 -1
- amsdal/cloud/services/auth/signup_service.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/auth/signup_service.pyi +16 -1
- amsdal/cloud/services/auth/token.cp310-win_amd64.pyd +0 -0
- amsdal/cloud/services/auth/token.pyi +15 -1
- amsdal/configs/constants.py +10 -0
- amsdal/configs/constants.pyi +11 -1
- amsdal/configs/main.py +132 -19
- amsdal/configs/main.pyi +140 -10
- amsdal/context/manager.py +39 -0
- amsdal/context/manager.pyi +41 -3
- amsdal/contrib/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/contrib/auth/app.py +12 -0
- amsdal/contrib/auth/app.pyi +12 -1
- amsdal/contrib/auth/lifecycle/consumer.py +53 -0
- amsdal/contrib/auth/lifecycle/consumer.pyi +53 -3
- amsdal/contrib/auth/models/login_session/hooks/pre_init.py +13 -0
- amsdal/contrib/auth/models/login_session/modifiers/display_name.py +8 -0
- amsdal/contrib/auth/models/permission/modifiers/display_name.py +8 -0
- amsdal/contrib/auth/models/user/hooks/post_init.py +13 -0
- amsdal/contrib/auth/models/user/hooks/pre_create.py +6 -0
- amsdal/contrib/auth/models/user/modifiers/display_name.py +8 -0
- amsdal/contrib/auth/settings.py +15 -0
- amsdal/contrib/auth/settings.pyi +14 -0
- amsdal/contrib/frontend_configs/app.py +14 -0
- amsdal/contrib/frontend_configs/app.pyi +14 -1
- amsdal/contrib/frontend_configs/conversion/convert.py +14 -0
- amsdal/contrib/frontend_configs/conversion/convert.pyi +15 -1
- amsdal/contrib/frontend_configs/lifecycle/consumer.py +72 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +76 -5
- amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +16 -0
- amsdal/contrib/frontend_configs/utils.py +12 -1
- amsdal/contrib/frontend_configs/utils.pyi +12 -1
- amsdal/fixtures/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/fixtures/manager.cp310-win_amd64.pyd +0 -0
- amsdal/fixtures/manager.pyi +88 -6
- amsdal/manager.cp310-win_amd64.pyd +0 -0
- amsdal/manager.pyi +113 -17
- amsdal/migration/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/migration/base_migration_schemas.cp310-win_amd64.pyd +0 -0
- amsdal/migration/base_migration_schemas.pyi +81 -5
- amsdal/migration/data_classes.cp310-win_amd64.pyd +0 -0
- amsdal/migration/data_classes.pyi +95 -1
- amsdal/migration/executors/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/migration/executors/base.cp310-win_amd64.pyd +0 -0
- amsdal/migration/executors/base.pyi +74 -4
- amsdal/migration/executors/default_executor.cp310-win_amd64.pyd +0 -0
- amsdal/migration/executors/default_executor.pyi +75 -5
- amsdal/migration/executors/state_executor.cp310-win_amd64.pyd +0 -0
- amsdal/migration/executors/state_executor.pyi +68 -4
- amsdal/migration/file_migration_executor.cp310-win_amd64.pyd +0 -0
- amsdal/migration/file_migration_executor.pyi +34 -2
- amsdal/migration/file_migration_generator.cp310-win_amd64.pyd +0 -0
- amsdal/migration/file_migration_generator.pyi +100 -8
- amsdal/migration/file_migration_store.cp310-win_amd64.pyd +0 -0
- amsdal/migration/file_migration_store.pyi +33 -3
- amsdal/migration/file_migration_writer.cp310-win_amd64.pyd +0 -0
- amsdal/migration/file_migration_writer.pyi +60 -5
- amsdal/migration/migrations.cp310-win_amd64.pyd +0 -0
- amsdal/migration/migrations.pyi +111 -6
- amsdal/migration/migrations_loader.cp310-win_amd64.pyd +0 -0
- amsdal/migration/migrations_loader.pyi +17 -2
- amsdal/migration/schemas_loaders.cp310-win_amd64.pyd +0 -0
- amsdal/migration/schemas_loaders.pyi +14 -1
- amsdal/migration/utils.cp310-win_amd64.pyd +0 -0
- amsdal/migration/utils.pyi +44 -4
- amsdal/mixins/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/mixins/build_mixin.cp310-win_amd64.pyd +0 -0
- amsdal/mixins/build_mixin.pyi +60 -8
- amsdal/mixins/class_versions_mixin.cp310-win_amd64.pyd +0 -0
- amsdal/mixins/class_versions_mixin.pyi +20 -2
- amsdal/operations/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/operations/manager.cp310-win_amd64.pyd +0 -0
- amsdal/operations/manager.pyi +31 -3
- amsdal/schemas/core/class_object/properties/display_name.py +6 -0
- amsdal/schemas/core/file/hooks/pre_create.py +9 -0
- amsdal/schemas/core/file/hooks/pre_update.py +9 -0
- amsdal/schemas/core/file/properties/from_file.py +12 -0
- amsdal/schemas/core/file/properties/mimetype.py +8 -0
- amsdal/schemas/core/file/properties/to_file.py +12 -0
- amsdal/schemas/core/file/properties/validate_data.py +13 -0
- amsdal/schemas/manager.cp310-win_amd64.pyd +0 -0
- amsdal/schemas/manager.py +51 -0
- amsdal/schemas/manager.pyi +54 -4
- amsdal/services/__init__.cp310-win_amd64.pyd +0 -0
- amsdal/services/transaction_execution.cp310-win_amd64.pyd +0 -0
- amsdal/services/transaction_execution.pyi +52 -3
- amsdal/utils/contrib_paths.py +10 -0
- amsdal/utils/contrib_paths.pyi +11 -1
- {amsdal-0.1.26.dist-info → amsdal-0.1.27.dist-info}/METADATA +1 -1
- amsdal-0.1.27.dist-info/RECORD +258 -0
- amsdal-0.1.26.dist-info/RECORD +0 -258
- {amsdal-0.1.26.dist-info → amsdal-0.1.27.dist-info}/LICENSE.txt +0 -0
- {amsdal-0.1.26.dist-info → amsdal-0.1.27.dist-info}/WHEEL +0 -0
- {amsdal-0.1.26.dist-info → amsdal-0.1.27.dist-info}/license_check.py +0 -0
- {amsdal-0.1.26.dist-info → amsdal-0.1.27.dist-info}/top_level.txt +0 -0
amsdal/migration/migrations.pyi
CHANGED
|
@@ -16,15 +16,60 @@ class Operation(ABC, metaclass=abc.ABCMeta):
|
|
|
16
16
|
def backward(self, executor: BaseMigrationExecutor) -> None: ...
|
|
17
17
|
|
|
18
18
|
class SchemaOperation(Operation):
|
|
19
|
+
"""
|
|
20
|
+
Base class for schema operations.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
forward_args (list[Any]): Arguments for the forward operation.
|
|
24
|
+
backward_args (list[Any]): Arguments for the backward operation.
|
|
25
|
+
forward_method_name (str): Name of the method to call for the forward operation.
|
|
26
|
+
backward_method_name (str): Name of the method to call for the backward operation.
|
|
27
|
+
"""
|
|
19
28
|
forward_args: list[Any]
|
|
20
29
|
backward_args: list[Any]
|
|
21
30
|
forward_method_name: str
|
|
22
31
|
backward_method_name: str
|
|
23
|
-
def forward(self, executor: BaseMigrationExecutor) -> None:
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
def forward(self, executor: BaseMigrationExecutor) -> None:
|
|
33
|
+
"""
|
|
34
|
+
Executes the forward operation.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
None
|
|
41
|
+
"""
|
|
42
|
+
def forward_schema(self, executor: BaseMigrationExecutor) -> None:
|
|
43
|
+
"""
|
|
44
|
+
Executes the forward schema operation.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
None
|
|
51
|
+
"""
|
|
52
|
+
def backward(self, executor: BaseMigrationExecutor) -> None:
|
|
53
|
+
"""
|
|
54
|
+
Executes the backward operation.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
None
|
|
61
|
+
"""
|
|
26
62
|
|
|
27
63
|
class CreateClass(SchemaOperation):
|
|
64
|
+
"""
|
|
65
|
+
Represents an operation to create a class schema.
|
|
66
|
+
|
|
67
|
+
Attributes:
|
|
68
|
+
forward_method_name (str): The name of the method to call for the forward operation.
|
|
69
|
+
backward_method_name (str): The name of the method to call for the backward operation.
|
|
70
|
+
forward_args (list[Any]): Arguments for the forward operation.
|
|
71
|
+
backward_args (list[Any]): Arguments for the backward operation.
|
|
72
|
+
"""
|
|
28
73
|
forward_method_name: str
|
|
29
74
|
backward_method_name: str
|
|
30
75
|
forward_args: Incomplete
|
|
@@ -32,6 +77,15 @@ class CreateClass(SchemaOperation):
|
|
|
32
77
|
def __init__(self, class_name: str, new_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
|
|
33
78
|
|
|
34
79
|
class UpdateClass(SchemaOperation):
|
|
80
|
+
"""
|
|
81
|
+
Represents an operation to update a class schema.
|
|
82
|
+
|
|
83
|
+
Attributes:
|
|
84
|
+
forward_method_name (str): The name of the method to call for the forward operation.
|
|
85
|
+
backward_method_name (str): The name of the method to call for the backward operation.
|
|
86
|
+
forward_args (list[Any]): Arguments for the forward operation.
|
|
87
|
+
backward_args (list[Any]): Arguments for the backward operation.
|
|
88
|
+
"""
|
|
35
89
|
forward_method_name: str
|
|
36
90
|
backward_method_name: str
|
|
37
91
|
forward_args: Incomplete
|
|
@@ -39,6 +93,15 @@ class UpdateClass(SchemaOperation):
|
|
|
39
93
|
def __init__(self, class_name: str, old_schema: dict[str, Any], new_schema: dict[str, Any], schema_type: SchemaTypes) -> None: ...
|
|
40
94
|
|
|
41
95
|
class DeleteClass(SchemaOperation):
|
|
96
|
+
"""
|
|
97
|
+
Represents an operation to delete a class schema.
|
|
98
|
+
|
|
99
|
+
Attributes:
|
|
100
|
+
forward_method_name (str): The name of the method to call for the forward operation.
|
|
101
|
+
backward_method_name (str): The name of the method to call for the backward operation.
|
|
102
|
+
forward_args (list[Any]): Arguments for the forward operation.
|
|
103
|
+
backward_args (list[Any]): Arguments for the backward operation.
|
|
104
|
+
"""
|
|
42
105
|
forward_method_name: str
|
|
43
106
|
backward_method_name: str
|
|
44
107
|
forward_args: Incomplete
|
|
@@ -48,14 +111,56 @@ class DeleteClass(SchemaOperation):
|
|
|
48
111
|
class MigrationSchemas(DefaultMigrationSchemas): ...
|
|
49
112
|
|
|
50
113
|
class MigrateData(Operation):
|
|
114
|
+
"""
|
|
115
|
+
Represents a data migration operation.
|
|
116
|
+
|
|
117
|
+
Attributes:
|
|
118
|
+
forward_migration (Callable[[MigrationSchemas \\| BaseMigrationSchemas], None]): The function to call for
|
|
119
|
+
the forward migration.
|
|
120
|
+
backward_migration (Callable[[MigrationSchemas \\| BaseMigrationSchemas], None]): The function to call for
|
|
121
|
+
the backward migration.
|
|
122
|
+
"""
|
|
51
123
|
@staticmethod
|
|
52
124
|
def noop(schemas: MigrationSchemas) -> None: ...
|
|
53
125
|
forward_migration: Incomplete
|
|
54
126
|
backward_migration: Incomplete
|
|
55
127
|
def __init__(self, forward_migration: Callable[[MigrationSchemas | BaseMigrationSchemas], None], backward_migration: Callable[[MigrationSchemas | BaseMigrationSchemas], None]) -> None: ...
|
|
56
|
-
def forward(self, executor: BaseMigrationExecutor) -> None:
|
|
57
|
-
|
|
58
|
-
|
|
128
|
+
def forward(self, executor: BaseMigrationExecutor) -> None:
|
|
129
|
+
"""
|
|
130
|
+
Executes the forward data migration.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
None
|
|
137
|
+
"""
|
|
138
|
+
def backward(self, executor: BaseMigrationExecutor) -> None:
|
|
139
|
+
"""
|
|
140
|
+
Executes the backward data migration.
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
None
|
|
147
|
+
"""
|
|
148
|
+
def forward_schema(self, executor: BaseMigrationExecutor) -> None:
|
|
149
|
+
"""
|
|
150
|
+
No-op for forward schema in data migration.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
executor (BaseMigrationExecutor): The executor responsible for running migrations.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
None
|
|
157
|
+
"""
|
|
59
158
|
|
|
60
159
|
class Migration:
|
|
160
|
+
"""
|
|
161
|
+
Represents a collection of migration operations.
|
|
162
|
+
|
|
163
|
+
Attributes:
|
|
164
|
+
operations (list[Operation]): The list of migration operations.
|
|
165
|
+
"""
|
|
61
166
|
operations: list[Operation]
|
|
Binary file
|
|
@@ -4,14 +4,29 @@ from collections.abc import Iterator
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
6
|
class MigrationsLoader:
|
|
7
|
+
"""
|
|
8
|
+
Loads and manages migration files from a specified directory.
|
|
9
|
+
"""
|
|
7
10
|
_migrations_path: Incomplete
|
|
8
11
|
_module_type: Incomplete
|
|
9
12
|
_module_name: Incomplete
|
|
10
13
|
_migrations_files: Incomplete
|
|
11
14
|
def __init__(self, migrations_dir: Path, module_type: ModuleTypes, module_name: str | None = None) -> None: ...
|
|
12
15
|
@property
|
|
13
|
-
def has_initial_migration(self) -> bool:
|
|
16
|
+
def has_initial_migration(self) -> bool:
|
|
17
|
+
"""
|
|
18
|
+
Checks if there is an initial migration file.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
bool: True if there is an initial migration file, False otherwise.
|
|
22
|
+
"""
|
|
14
23
|
@property
|
|
15
|
-
def last_migration_number(self) -> int:
|
|
24
|
+
def last_migration_number(self) -> int:
|
|
25
|
+
"""
|
|
26
|
+
Gets the number of the last migration file.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
int: The number of the last migration file, or -1 if there are no migration files.
|
|
30
|
+
"""
|
|
16
31
|
def __iter__(self) -> Iterator[MigrationFile]: ...
|
|
17
32
|
def _load_migration_files(self) -> None: ...
|
|
Binary file
|
|
@@ -14,10 +14,23 @@ class BaseClassSchemaLoader(ABC, metaclass=abc.ABCMeta):
|
|
|
14
14
|
def iter_app_schemas(self) -> Iterator[ClassSchema]: ...
|
|
15
15
|
|
|
16
16
|
class JsonClassSchemaLoader(EnrichSchemasMixin, BaseClassSchemaLoader):
|
|
17
|
+
"""
|
|
18
|
+
Loads and enriches JSON class schemas from a specified root path.
|
|
19
|
+
|
|
20
|
+
Attributes:
|
|
21
|
+
schemas_root_path (Path): The root path to the JSON schemas.
|
|
22
|
+
module_type (ModuleTypes): The type of the module for the schemas.
|
|
23
|
+
"""
|
|
17
24
|
schemas_root_path: Incomplete
|
|
18
25
|
module_type: Incomplete
|
|
19
26
|
def __init__(self, schemas_root_path: Path, module_type: ModuleTypes = ...) -> None: ...
|
|
20
|
-
def iter_app_schemas(self) -> Iterator[ClassSchema]:
|
|
27
|
+
def iter_app_schemas(self) -> Iterator[ClassSchema]:
|
|
28
|
+
"""
|
|
29
|
+
Iterates over the application schemas.
|
|
30
|
+
|
|
31
|
+
Yields:
|
|
32
|
+
ClassSchema: The next class schema in the iteration.
|
|
33
|
+
"""
|
|
21
34
|
def _enriched_user_schemas(self) -> list[ObjectSchema]: ...
|
|
22
35
|
@staticmethod
|
|
23
36
|
def _load_schemas(schemas_path: Path) -> list[ObjectSchema]: ...
|
|
Binary file
|
amsdal/migration/utils.pyi
CHANGED
|
@@ -10,9 +10,49 @@ from pathlib import Path
|
|
|
10
10
|
|
|
11
11
|
reference_schema: Incomplete
|
|
12
12
|
|
|
13
|
-
def object_schema_to_table_schema(object_schema: ObjectSchema) -> TableSchema:
|
|
13
|
+
def object_schema_to_table_schema(object_schema: ObjectSchema) -> TableSchema:
|
|
14
|
+
"""
|
|
15
|
+
Converts an ObjectSchema to a TableSchema.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
object_schema (ObjectSchema): The object schema to convert.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
TableSchema: The converted table schema.
|
|
22
|
+
"""
|
|
14
23
|
def _process_properties(properties: dict[str, PropertyData] | None, required: list[str]) -> list[TableColumnSchema]: ...
|
|
15
24
|
def _process_property_type(property_type: str, items: TypeData | DictSchema | LegacyDictSchema | None = None, context: dict[str, type | Model | NestedSchemaModel] | None = None) -> type | NestedSchemaModel | ArraySchemaModel | DictSchemaModel | type[JsonSchemaModel]: ...
|
|
16
|
-
def schema_to_nested_column_schema(schema: ObjectSchema, context: dict[str, type | Model | NestedSchemaModel]) -> NestedSchemaModel | type:
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
def schema_to_nested_column_schema(schema: ObjectSchema, context: dict[str, type | Model | NestedSchemaModel]) -> NestedSchemaModel | type:
|
|
26
|
+
"""
|
|
27
|
+
Converts an ObjectSchema to a NestedSchemaModel or type.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
schema (ObjectSchema): The schema to convert.
|
|
31
|
+
context (dict[str, type | Model | NestedSchemaModel]): The context for the conversion.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
NestedSchemaModel | type: The converted nested schema model or type.
|
|
35
|
+
"""
|
|
36
|
+
def contrib_to_module_root_path(contrib: str) -> Path:
|
|
37
|
+
"""
|
|
38
|
+
Converts a contrib string to the root path of the module.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
contrib (str): The contrib string to convert.
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
Path: The root path of the module.
|
|
45
|
+
"""
|
|
46
|
+
def map_module_type_to_schema_type(module_type: ModuleTypes) -> SchemaTypes:
|
|
47
|
+
"""
|
|
48
|
+
Maps a ModuleTypes value to a SchemaTypes value.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
module_type (ModuleTypes): The module type to map.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
SchemaTypes: The corresponding schema type.
|
|
55
|
+
|
|
56
|
+
Raises:
|
|
57
|
+
ValueError: If the module type is unknown.
|
|
58
|
+
"""
|
|
Binary file
|
|
Binary file
|
amsdal/mixins/build_mixin.pyi
CHANGED
|
@@ -5,22 +5,74 @@ from amsdal_models.schemas.loaders.cli_fixtures_loader import CliFixturesLoader
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
7
|
class CliMultiFixturesLoader(CliFixturesLoader):
|
|
8
|
+
"""
|
|
9
|
+
Loads multiple fixtures from specified schema directories.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
models_with_fixtures (list[tuple[Path, ObjectSchema]]): List of tuples containing the path and object schema
|
|
13
|
+
of models with fixtures.
|
|
14
|
+
"""
|
|
8
15
|
models_with_fixtures: Incomplete
|
|
9
16
|
def __init__(self, schema_dirs: list[Path]) -> None: ...
|
|
10
17
|
|
|
11
18
|
class BuildMixin:
|
|
19
|
+
"""
|
|
20
|
+
Provides methods to build models, transactions, static files, migrations, and fixtures for a CLI application.
|
|
21
|
+
"""
|
|
12
22
|
@classmethod
|
|
13
|
-
def build_models(cls, user_schemas_path: Path) -> None:
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
def build_models(cls, user_schemas_path: Path) -> None:
|
|
24
|
+
"""
|
|
25
|
+
Builds models from the specified user schemas path and predefined schema directories.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
user_schemas_path (Path): The path to the user schemas directory.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
None
|
|
32
|
+
"""
|
|
16
33
|
@staticmethod
|
|
17
|
-
def
|
|
34
|
+
def build_transactions(cli_app_path: Path) -> None:
|
|
35
|
+
"""
|
|
36
|
+
Builds transactions from the specified CLI application path.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
cli_app_path (Path): The path to the CLI application directory.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
None
|
|
43
|
+
"""
|
|
18
44
|
@staticmethod
|
|
19
|
-
def
|
|
45
|
+
def build_static_files(cli_app_path: Path) -> None:
|
|
46
|
+
"""
|
|
47
|
+
Builds static files from the specified CLI application path.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
cli_app_path (Path): The path to the CLI application directory.
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
None
|
|
54
|
+
"""
|
|
20
55
|
@staticmethod
|
|
21
|
-
def
|
|
56
|
+
def build_migrations(cli_app_path: Path) -> None:
|
|
57
|
+
"""
|
|
58
|
+
Builds migrations from the specified CLI application path.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
cli_app_path (Path): The path to the CLI application directory.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
None
|
|
65
|
+
"""
|
|
22
66
|
@staticmethod
|
|
23
|
-
def
|
|
67
|
+
def build_fixtures(cli_app_path: Path) -> None:
|
|
24
68
|
"""
|
|
25
|
-
|
|
69
|
+
Builds fixtures from the specified CLI application path.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
cli_app_path (Path): The path to the CLI application directory.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
None
|
|
26
76
|
"""
|
|
77
|
+
@staticmethod
|
|
78
|
+
def _reimport_models() -> None: ...
|
|
Binary file
|
|
@@ -2,9 +2,27 @@ from amsdal.migration.utils import object_schema_to_table_schema as object_schem
|
|
|
2
2
|
from amsdal_models.classes.model import Model
|
|
3
3
|
|
|
4
4
|
class ClassVersionsMixin:
|
|
5
|
+
"""
|
|
6
|
+
Mixin class to manage class versions and related table schemas.
|
|
7
|
+
"""
|
|
5
8
|
@classmethod
|
|
6
9
|
def _create_table(cls, class_object: Model, *, skip_class_meta: bool = False) -> None: ...
|
|
7
10
|
@classmethod
|
|
8
|
-
def init_class_versions(cls, *, create_tables: bool = False) -> None:
|
|
11
|
+
def init_class_versions(cls, *, create_tables: bool = False) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Initializes class versions and optionally creates tables.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
create_tables (bool, optional): Whether to create tables. Defaults to False.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
None
|
|
20
|
+
"""
|
|
9
21
|
@staticmethod
|
|
10
|
-
def register_internal_classes() -> None:
|
|
22
|
+
def register_internal_classes() -> None:
|
|
23
|
+
"""
|
|
24
|
+
Registers internal classes with the class version manager.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
None
|
|
28
|
+
"""
|
|
Binary file
|
|
Binary file
|
amsdal/operations/manager.pyi
CHANGED
|
@@ -10,15 +10,43 @@ from amsdal_utils.models.data_models.metadata import Metadata as Metadata
|
|
|
10
10
|
from typing import Any
|
|
11
11
|
|
|
12
12
|
class OperationsManager(OperationsManagerBase):
|
|
13
|
+
"""
|
|
14
|
+
Manages operations for models, including state and historical operations.
|
|
15
|
+
"""
|
|
13
16
|
def _get_connections(self, obj: Model, using: str | None) -> list[ConnectionBase]: ...
|
|
14
17
|
def _perform_state_operation(self, obj: Model, data_dump: dict[str, Any], operation: OperationType, connection: StateConnectionBase) -> None: ...
|
|
15
18
|
@classmethod
|
|
16
|
-
def clear_data(cls, _value: Any) -> Any:
|
|
19
|
+
def clear_data(cls, _value: Any) -> Any:
|
|
20
|
+
"""
|
|
21
|
+
Clears data by recursively processing dictionaries, lists, and enums.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
Any: The cleared value.
|
|
25
|
+
"""
|
|
17
26
|
def _is_reference(self, _value: Any) -> bool: ...
|
|
18
27
|
def _perform_historical_operation(self, obj: Model, data_dump: dict[str, Any], operation: OperationType, connection: HistoricalConnectionBase) -> None: ...
|
|
19
28
|
def _preprocess_object(self, obj: Model, operation: OperationType) -> None: ...
|
|
20
|
-
def perform_operation(self, obj: Model, operation: OperationType, using: str | None = None) -> None:
|
|
29
|
+
def perform_operation(self, obj: Model, operation: OperationType, using: str | None = None) -> None:
|
|
30
|
+
"""
|
|
31
|
+
Performs the specified operation on the given model object.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
obj (Model): The model object.
|
|
35
|
+
operation (OperationType): The type of operation to perform.
|
|
36
|
+
using (str | None, optional): The database alias to use. Defaults to None.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
None
|
|
40
|
+
"""
|
|
21
41
|
def _generate_references(self, address: Address, data: Any, reference_buffer: list[tuple[Address, dict[str, Any]]]) -> None: ...
|
|
22
42
|
def _perform_historical_bulk_operation(self, objects_data: list[tuple[Model, dict[str, Any]]], operation: OperationType, connection: HistoricalConnectionBase) -> None: ...
|
|
23
43
|
def _perform_state_bulk_operation(self, objects_data: list[tuple[Model, dict[str, Any]]], operation: OperationType, connection: StateConnectionBase) -> None: ...
|
|
24
|
-
def perform_bulk_operation(self, objs: list[Model], operation: OperationType, using: str | None = None) -> None:
|
|
44
|
+
def perform_bulk_operation(self, objs: list[Model], operation: OperationType, using: str | None = None) -> None:
|
|
45
|
+
"""
|
|
46
|
+
Performs the specified bulk operation on the given model objects.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
objs (list[Model]): The list of model objects.
|
|
50
|
+
operation (OperationType): The type of operation to perform.
|
|
51
|
+
using (str | None, optional): The database alias to use. Defaults to None.
|
|
52
|
+
"""
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
def pre_create(self) -> None: # type: ignore[no-untyped-def]
|
|
2
|
+
"""
|
|
3
|
+
Prepares the object for creation by setting its size attribute.
|
|
4
|
+
|
|
5
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
|
6
|
+
If the data is None, it defaults to an empty byte string.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
None
|
|
10
|
+
"""
|
|
2
11
|
self.size = len(self.data or b'')
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
def pre_update(self): # type: ignore[no-untyped-def]
|
|
2
|
+
"""
|
|
3
|
+
Prepares the object for update by setting its size attribute.
|
|
4
|
+
|
|
5
|
+
This method calculates the size of the object's data and assigns it to the size attribute.
|
|
6
|
+
If the data is None, it defaults to an empty byte string.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
None
|
|
10
|
+
"""
|
|
2
11
|
self.size = len(self.data or b'')
|
|
@@ -7,6 +7,18 @@ def from_file(
|
|
|
7
7
|
cls,
|
|
8
8
|
file_or_path: Path | BinaryIO,
|
|
9
9
|
) -> 'File': # type: ignore[name-defined] # noqa: F821
|
|
10
|
+
"""
|
|
11
|
+
Creates a `File` object from a file path or a binary file object.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
file_or_path (Path | BinaryIO): The file path or binary file object.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
File: The created `File` object.
|
|
18
|
+
|
|
19
|
+
Raises:
|
|
20
|
+
ValueError: If the provided path is a directory.
|
|
21
|
+
"""
|
|
10
22
|
if isinstance(file_or_path, Path):
|
|
11
23
|
if file_or_path.is_dir():
|
|
12
24
|
msg = f'{file_or_path} is a directory'
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
@property # type: ignore[misc]
|
|
2
2
|
def mimetype(self) -> str | None: # type: ignore[no-untyped-def]
|
|
3
|
+
"""
|
|
4
|
+
Returns the MIME type of the file based on its filename.
|
|
5
|
+
|
|
6
|
+
This method uses the `mimetypes` module to guess the MIME type of the file.
|
|
7
|
+
|
|
8
|
+
Returns:
|
|
9
|
+
str | None: The guessed MIME type of the file, or None if it cannot be determined.
|
|
10
|
+
"""
|
|
3
11
|
import mimetypes
|
|
4
12
|
|
|
5
13
|
return mimetypes.guess_type(self.filename)[0]
|
|
@@ -3,6 +3,18 @@ from typing import BinaryIO
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
def to_file(self, file_or_path: Path | BinaryIO) -> None: # type: ignore[no-untyped-def]
|
|
6
|
+
"""
|
|
7
|
+
Writes the object's data to a file path or a binary file object.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
file_or_path (Path | BinaryIO): The file path or binary file object where the data will be written.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
None
|
|
14
|
+
|
|
15
|
+
Raises:
|
|
16
|
+
ValueError: If the provided path is a directory.
|
|
17
|
+
"""
|
|
6
18
|
if isinstance(file_or_path, Path):
|
|
7
19
|
if file_or_path.is_dir():
|
|
8
20
|
file_or_path = file_or_path / self.name
|
|
@@ -6,6 +6,19 @@ from pydantic import field_validator
|
|
|
6
6
|
@field_validator('data') # type: ignore[misc]
|
|
7
7
|
@classmethod
|
|
8
8
|
def data_base64_decode(cls, v: bytes) -> bytes: # type: ignore[no-untyped-def] # noqa: ARG001
|
|
9
|
+
"""
|
|
10
|
+
Decodes a base64-encoded byte string if it is base64-encoded.
|
|
11
|
+
|
|
12
|
+
This method checks if the provided byte string is base64-encoded and decodes it if true.
|
|
13
|
+
If the byte string is not base64-encoded, it returns the original byte string.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
cls: The class this method belongs to.
|
|
17
|
+
v (bytes): The byte string to be checked and potentially decoded.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
bytes: The decoded byte string if it was base64-encoded, otherwise the original byte string.
|
|
21
|
+
"""
|
|
9
22
|
is_base64: bool = False
|
|
10
23
|
|
|
11
24
|
try:
|
|
Binary file
|
amsdal/schemas/manager.py
CHANGED
|
@@ -8,13 +8,39 @@ from amsdal.configs.main import settings
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class SchemaManager(metaclass=Singleton):
|
|
11
|
+
"""
|
|
12
|
+
Manages schema operations including retrieval, invalidation, and sorting.
|
|
13
|
+
|
|
14
|
+
This class handles various schema-related operations such as invalidating user schemas,
|
|
15
|
+
retrieving schemas by name or type, and sorting schemas based on predefined rules.
|
|
16
|
+
"""
|
|
17
|
+
|
|
11
18
|
def __init__(self) -> None:
|
|
12
19
|
self._schema_manager_handler = SchemaManagerHandler(settings.schemas_root_path)
|
|
13
20
|
|
|
14
21
|
def invalidate_user_schemas(self) -> None:
|
|
22
|
+
"""
|
|
23
|
+
Invalidates user schemas.
|
|
24
|
+
|
|
25
|
+
This method calls the handler to invalidate all user schemas, ensuring that any cached or outdated schemas
|
|
26
|
+
are refreshed.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
None
|
|
30
|
+
"""
|
|
15
31
|
self._schema_manager_handler.invalidate_user_schemas()
|
|
16
32
|
|
|
17
33
|
def class_schemas(self) -> list[tuple[ObjectSchema, SchemaTypes]]:
|
|
34
|
+
"""
|
|
35
|
+
Returns a list of tuples containing object schemas and their types.
|
|
36
|
+
|
|
37
|
+
This method retrieves and sorts various schemas managed by the schema manager handler.
|
|
38
|
+
The schemas are categorized into types, core, user, and contrib schemas.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
list[tuple[ObjectSchema, SchemaTypes]]: A list of tuples where each tuple contains an object schema
|
|
42
|
+
and its corresponding type.
|
|
43
|
+
"""
|
|
18
44
|
return (
|
|
19
45
|
[
|
|
20
46
|
(type_schema, SchemaTypes.TYPE)
|
|
@@ -41,6 +67,19 @@ class SchemaManager(metaclass=Singleton):
|
|
|
41
67
|
return 2
|
|
42
68
|
|
|
43
69
|
def get_schema_by_name(self, title: str, schema_type: SchemaTypes | None = None) -> ObjectSchema | None:
|
|
70
|
+
"""
|
|
71
|
+
Retrieves a schema by its title and optional type.
|
|
72
|
+
|
|
73
|
+
This method searches for a schema with the specified title and optional type
|
|
74
|
+
among the schemas managed by the schema manager handler.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
title (str): The title of the schema to be retrieved.
|
|
78
|
+
schema_type (SchemaTypes | None, optional): The type of the schema to be retrieved. Defaults to None.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
ObjectSchema | None: The schema with the specified title and type, or None if not found.
|
|
82
|
+
"""
|
|
44
83
|
_schemas = self.get_schemas(schema_type)
|
|
45
84
|
|
|
46
85
|
for schema in _schemas:
|
|
@@ -50,6 +89,18 @@ class SchemaManager(metaclass=Singleton):
|
|
|
50
89
|
return None
|
|
51
90
|
|
|
52
91
|
def get_schemas(self, schema_type: SchemaTypes | None = None) -> list[ObjectSchema]:
|
|
92
|
+
"""
|
|
93
|
+
Retrieves schemas based on the provided type.
|
|
94
|
+
|
|
95
|
+
This method returns a list of schemas filtered by the specified type. If no type is provided,
|
|
96
|
+
it returns all schemas managed by the schema manager handler.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
schema_type (SchemaTypes | None, optional): The type of schemas to retrieve. Defaults to None.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
list[ObjectSchema]: A list of schemas filtered by the specified type, or all schemas if no type is provided.
|
|
103
|
+
"""
|
|
53
104
|
if schema_type == SchemaTypes.CONTRIB:
|
|
54
105
|
return self._schema_manager_handler.contrib_schemas
|
|
55
106
|
|