amsdal 0.3.6__cp311-cp311-macosx_10_9_universal2.whl → 0.4.1__cp311-cp311-macosx_10_9_universal2.whl

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

Potentially problematic release.


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

Files changed (209) 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-311-darwin.so +0 -0
  7. amsdal/cloud/client.cpython-311-darwin.so +0 -0
  8. amsdal/cloud/constants.cpython-311-darwin.so +0 -0
  9. amsdal/cloud/enums.cpython-311-darwin.so +0 -0
  10. amsdal/cloud/models/__init__.cpython-311-darwin.so +0 -0
  11. amsdal/cloud/models/base.cpython-311-darwin.so +0 -0
  12. amsdal/cloud/services/__init__.cpython-311-darwin.so +0 -0
  13. amsdal/cloud/services/actions/__init__.cpython-311-darwin.so +0 -0
  14. amsdal/cloud/services/actions/add_allowlist_ip.cpython-311-darwin.so +0 -0
  15. amsdal/cloud/services/actions/add_basic_auth.cpython-311-darwin.so +0 -0
  16. amsdal/cloud/services/actions/add_dependency.cpython-311-darwin.so +0 -0
  17. amsdal/cloud/services/actions/add_secret.cpython-311-darwin.so +0 -0
  18. amsdal/cloud/services/actions/base.cpython-311-darwin.so +0 -0
  19. amsdal/cloud/services/actions/create_deploy.cpython-311-darwin.so +0 -0
  20. amsdal/cloud/services/actions/create_env.cpython-311-darwin.so +0 -0
  21. amsdal/cloud/services/actions/create_session.cpython-311-darwin.so +0 -0
  22. amsdal/cloud/services/actions/delete_allowlist_ip.cpython-311-darwin.so +0 -0
  23. amsdal/cloud/services/actions/delete_basic_auth.cpython-311-darwin.so +0 -0
  24. amsdal/cloud/services/actions/delete_dependency.cpython-311-darwin.so +0 -0
  25. amsdal/cloud/services/actions/delete_env.cpython-311-darwin.so +0 -0
  26. amsdal/cloud/services/actions/delete_secret.cpython-311-darwin.so +0 -0
  27. amsdal/cloud/services/actions/destroy_deploy.cpython-311-darwin.so +0 -0
  28. amsdal/cloud/services/actions/expose_db.cpython-311-darwin.so +0 -0
  29. amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-311-darwin.so +0 -0
  30. amsdal/cloud/services/actions/get_monitoring_info.cpython-311-darwin.so +0 -0
  31. amsdal/cloud/services/actions/list_dependencies.cpython-311-darwin.so +0 -0
  32. amsdal/cloud/services/actions/list_deploys.cpython-311-darwin.so +0 -0
  33. amsdal/cloud/services/actions/list_envs.cpython-311-darwin.so +0 -0
  34. amsdal/cloud/services/actions/list_secrets.cpython-311-darwin.so +0 -0
  35. amsdal/cloud/services/actions/manager.cpython-311-darwin.so +0 -0
  36. amsdal/cloud/services/actions/signup_action.cpython-311-darwin.so +0 -0
  37. amsdal/cloud/services/actions/update_deploy.cpython-311-darwin.so +0 -0
  38. amsdal/cloud/services/auth/__init__.cpython-311-darwin.so +0 -0
  39. amsdal/cloud/services/auth/base.cpython-311-darwin.so +0 -0
  40. amsdal/cloud/services/auth/credentials.cpython-311-darwin.so +0 -0
  41. amsdal/cloud/services/auth/credentials.pyi +0 -1
  42. amsdal/cloud/services/auth/manager.cpython-311-darwin.so +0 -0
  43. amsdal/cloud/services/auth/signup_service.cpython-311-darwin.so +0 -0
  44. amsdal/cloud/services/auth/token.cpython-311-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-311-darwin.so +0 -0
  49. amsdal/contrib/auth/fixtures/basic_permissions.json +64 -0
  50. amsdal/contrib/auth/lifecycle/consumer.py +10 -10
  51. amsdal/contrib/auth/migrations/0000_initial.py +41 -7
  52. amsdal/contrib/auth/models/login_session.py +66 -0
  53. amsdal/contrib/auth/models/login_session.pyi +33 -0
  54. amsdal/contrib/auth/models/permission.py +23 -0
  55. amsdal/contrib/auth/models/permission.pyi +18 -0
  56. amsdal/contrib/auth/models/user.py +106 -0
  57. amsdal/contrib/auth/models/user.pyi +46 -0
  58. amsdal/contrib/frontend_configs/conversion/convert.py +47 -15
  59. amsdal/contrib/frontend_configs/conversion/convert.pyi +0 -1
  60. amsdal/contrib/frontend_configs/lifecycle/consumer.py +32 -13
  61. amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +1 -1
  62. amsdal/contrib/frontend_configs/migrations/0000_initial.py +15 -14
  63. amsdal/contrib/frontend_configs/models/__init__.py +0 -0
  64. amsdal/contrib/frontend_configs/models/__init__.pyi +0 -0
  65. amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
  66. amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +12 -0
  67. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
  68. amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +7 -0
  69. amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +54 -0
  70. amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +32 -0
  71. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
  72. amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +11 -0
  73. amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
  74. amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +8 -0
  75. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
  76. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +8 -0
  77. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
  78. amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +9 -0
  79. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
  80. amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +10 -0
  81. amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
  82. amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +15 -0
  83. amsdal/contrib/frontend_configs/models/frontend_control_config.py +87 -0
  84. amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +35 -0
  85. amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
  86. amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +9 -0
  87. amsdal/errors.py +0 -3
  88. amsdal/errors.pyi +0 -1
  89. amsdal/fixtures/__init__.cpython-311-darwin.so +0 -0
  90. amsdal/fixtures/manager.cpython-311-darwin.so +0 -0
  91. amsdal/fixtures/manager.pyi +72 -123
  92. amsdal/fixtures/utils.cpython-311-darwin.so +0 -0
  93. amsdal/fixtures/utils.pyi +9 -0
  94. amsdal/manager.cpython-311-darwin.so +0 -0
  95. amsdal/manager.pyi +4 -96
  96. amsdal/mixins/__init__.cpython-311-darwin.so +0 -0
  97. amsdal/mixins/class_versions_mixin.cpython-311-darwin.so +0 -0
  98. amsdal/models/__init__.py +0 -0
  99. amsdal/models/__init__.pyi +0 -0
  100. amsdal/models/core/__init__.py +0 -0
  101. amsdal/models/core/__init__.pyi +0 -0
  102. amsdal/models/core/class_object.py +37 -0
  103. amsdal/models/core/class_object.pyi +24 -0
  104. amsdal/models/core/class_object_meta.py +26 -0
  105. amsdal/models/core/class_object_meta.pyi +15 -0
  106. amsdal/models/core/class_property.py +19 -0
  107. amsdal/models/core/class_property.pyi +10 -0
  108. amsdal/models/core/class_property_meta.py +15 -0
  109. amsdal/models/core/class_property_meta.pyi +10 -0
  110. amsdal/models/core/file.py +156 -0
  111. amsdal/models/core/file.pyi +104 -0
  112. amsdal/models/core/fixture.py +25 -0
  113. amsdal/models/core/fixture.pyi +14 -0
  114. amsdal/models/core/option.py +11 -0
  115. amsdal/models/core/option.pyi +8 -0
  116. amsdal/models/core/validator.py +12 -0
  117. amsdal/models/core/validator.pyi +8 -0
  118. amsdal/models/types/__init__.py +0 -0
  119. amsdal/models/types/__init__.pyi +0 -0
  120. amsdal/models/types/object.py +26 -0
  121. amsdal/models/types/object.pyi +16 -0
  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-311-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-311-darwin.so +0 -0
  139. amsdal/services/transaction_execution.cpython-311-darwin.so +0 -0
  140. amsdal/utils/rollback/__init__.py +99 -54
  141. amsdal/utils/tests/helpers.py +46 -37
  142. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/METADATA +8 -8
  143. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/RECORD +149 -140
  144. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/WHEEL +1 -1
  145. amsdal/contrib/auth/models/login_session/hooks/pre_init.py +0 -68
  146. amsdal/contrib/auth/models/login_session/model.json +0 -23
  147. amsdal/contrib/auth/models/login_session/modifiers/display_name.py +0 -11
  148. amsdal/contrib/auth/models/permission/fixtures/basic_permissions.json +0 -62
  149. amsdal/contrib/auth/models/permission/model.json +0 -18
  150. amsdal/contrib/auth/models/permission/modifiers/display_name.py +0 -11
  151. amsdal/contrib/auth/models/user/hooks/post_init.py +0 -76
  152. amsdal/contrib/auth/models/user/hooks/pre_create.py +0 -8
  153. amsdal/contrib/auth/models/user/model.json +0 -25
  154. amsdal/contrib/auth/models/user/modifiers/display_name.py +0 -19
  155. amsdal/contrib/frontend_configs/models/frontend_activator_config/model.json +0 -11
  156. amsdal/contrib/frontend_configs/models/frontend_config_async_validator/model.json +0 -11
  157. amsdal/contrib/frontend_configs/models/frontend_config_group_validator/model.json +0 -52
  158. amsdal/contrib/frontend_configs/models/frontend_config_option/model.json +0 -15
  159. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/model.json +0 -6
  160. amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base/properties/model_dump.py +0 -13
  161. amsdal/contrib/frontend_configs/models/frontend_config_slider_option/model.json +0 -19
  162. amsdal/contrib/frontend_configs/models/frontend_config_text_mask/model.json +0 -26
  163. amsdal/contrib/frontend_configs/models/frontend_config_validator/model.json +0 -41
  164. amsdal/contrib/frontend_configs/models/frontend_control_config/model.json +0 -250
  165. amsdal/contrib/frontend_configs/models/frontend_model_config/fixtures/permissions.json +0 -24
  166. amsdal/contrib/frontend_configs/models/frontend_model_config/model.json +0 -17
  167. amsdal/contrib/frontend_configs/models/frontent_config_control_action/model.json +0 -54
  168. amsdal/contrib/frontend_configs/models/frontent_config_control_action/properties/action_validate.py +0 -33
  169. amsdal/migration/__init__.cpython-311-darwin.so +0 -0
  170. amsdal/migration/base_migration_schemas.cpython-311-darwin.so +0 -0
  171. amsdal/migration/base_migration_schemas.pyi +0 -119
  172. amsdal/migration/data_classes.cpython-311-darwin.so +0 -0
  173. amsdal/migration/data_classes.pyi +0 -165
  174. amsdal/migration/executors/__init__.cpython-311-darwin.so +0 -0
  175. amsdal/migration/executors/base.cpython-311-darwin.so +0 -0
  176. amsdal/migration/executors/base.pyi +0 -117
  177. amsdal/migration/executors/default_executor.cpython-311-darwin.so +0 -0
  178. amsdal/migration/executors/default_executor.pyi +0 -184
  179. amsdal/migration/executors/state_executor.cpython-311-darwin.so +0 -0
  180. amsdal/migration/executors/state_executor.pyi +0 -151
  181. amsdal/migration/file_migration_executor.cpython-311-darwin.so +0 -0
  182. amsdal/migration/file_migration_executor.pyi +0 -122
  183. amsdal/migration/file_migration_generator.cpython-311-darwin.so +0 -0
  184. amsdal/migration/file_migration_generator.pyi +0 -229
  185. amsdal/migration/file_migration_store.cpython-311-darwin.so +0 -0
  186. amsdal/migration/file_migration_store.pyi +0 -114
  187. amsdal/migration/file_migration_writer.cpython-311-darwin.so +0 -0
  188. amsdal/migration/file_migration_writer.pyi +0 -73
  189. amsdal/migration/migrations.cpython-311-darwin.so +0 -0
  190. amsdal/migration/migrations.pyi +0 -166
  191. amsdal/migration/migrations_loader.cpython-311-darwin.so +0 -0
  192. amsdal/migration/migrations_loader.pyi +0 -32
  193. amsdal/migration/schemas_loaders.cpython-311-darwin.so +0 -0
  194. amsdal/migration/schemas_loaders.pyi +0 -37
  195. amsdal/migration/templates/data_migration.tmpl +0 -18
  196. amsdal/migration/templates/dict_validator.tmpl +0 -4
  197. amsdal/migration/templates/migration.tmpl +0 -6
  198. amsdal/migration/templates/model_class.tmpl +0 -8
  199. amsdal/migration/templates/model_class_layout.tmpl +0 -24
  200. amsdal/migration/templates/options_validator.tmpl +0 -4
  201. amsdal/migration/utils.cpython-311-darwin.so +0 -0
  202. amsdal/migration/utils.pyi +0 -58
  203. amsdal/mixins/build_mixin.cpython-311-darwin.so +0 -0
  204. amsdal/mixins/build_mixin.pyi +0 -78
  205. /amsdal/{migration/__init__.pyi → contrib/auth/models/__init__.py} +0 -0
  206. /amsdal/{migration/executors → contrib/auth/models}/__init__.pyi +0 -0
  207. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/LICENSE.txt +0 -0
  208. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/licenses/LICENSE.txt +0 -0
  209. {amsdal-0.3.6.dist-info → amsdal-0.4.1.dist-info}/top_level.txt +0 -0
amsdal/__about__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2023-present
2
2
  #
3
3
  # SPDX-License-Identifier: AMSDAL End User License Agreement
4
- __version__ = '0.3.6'
4
+ __version__ = '0.4.1'
@@ -1,12 +1,11 @@
1
- from amsdal_utils.models.enums import SchemaTypes
2
-
3
- from amsdal.migration import migrations
1
+ from amsdal_models.migration import migrations
2
+ from amsdal_utils.models.enums import ModuleType
4
3
 
5
4
 
6
5
  class Migration(migrations.Migration):
7
6
  operations: list[migrations.Operation] = [
8
7
  migrations.CreateClass(
9
- schema_type=SchemaTypes.TYPE,
8
+ module_type=ModuleType.TYPE,
10
9
  class_name='Object',
11
10
  new_schema={
12
11
  'title': 'Object',
@@ -31,37 +30,37 @@ class Migration(migrations.Migration):
31
30
  },
32
31
  ),
33
32
  migrations.CreateClass(
34
- schema_type=SchemaTypes.TYPE,
33
+ module_type=ModuleType.TYPE,
35
34
  class_name='Binary',
36
35
  new_schema={'title': 'Binary', 'properties': {}, 'meta_class': 'TypeMeta'},
37
36
  ),
38
37
  migrations.CreateClass(
39
- schema_type=SchemaTypes.TYPE,
38
+ module_type=ModuleType.TYPE,
40
39
  class_name='Dictionary',
41
40
  new_schema={'title': 'Dictionary', 'properties': {}, 'meta_class': 'TypeMeta'},
42
41
  ),
43
42
  migrations.CreateClass(
44
- schema_type=SchemaTypes.TYPE,
43
+ module_type=ModuleType.TYPE,
45
44
  class_name='Anything',
46
45
  new_schema={'title': 'Anything', 'properties': {}, 'meta_class': 'TypeMeta'},
47
46
  ),
48
47
  migrations.CreateClass(
49
- schema_type=SchemaTypes.TYPE,
48
+ module_type=ModuleType.TYPE,
50
49
  class_name='String',
51
50
  new_schema={'title': 'String', 'default': '', 'properties': {}, 'meta_class': 'TypeMeta'},
52
51
  ),
53
52
  migrations.CreateClass(
54
- schema_type=SchemaTypes.TYPE,
53
+ module_type=ModuleType.TYPE,
55
54
  class_name='Array',
56
55
  new_schema={'title': 'Array', 'properties': {}, 'meta_class': 'TypeMeta'},
57
56
  ),
58
57
  migrations.CreateClass(
59
- schema_type=SchemaTypes.TYPE,
58
+ module_type=ModuleType.TYPE,
60
59
  class_name='Number',
61
60
  new_schema={'title': 'Number', 'properties': {}, 'meta_class': 'TypeMeta'},
62
61
  ),
63
62
  migrations.CreateClass(
64
- schema_type=SchemaTypes.TYPE,
63
+ module_type=ModuleType.TYPE,
65
64
  class_name='Boolean',
66
65
  new_schema={
67
66
  'title': 'Boolean',
@@ -71,7 +70,7 @@ class Migration(migrations.Migration):
71
70
  },
72
71
  ),
73
72
  migrations.CreateClass(
74
- schema_type=SchemaTypes.CORE,
73
+ module_type=ModuleType.CORE,
75
74
  class_name='Option',
76
75
  new_schema={
77
76
  'title': 'Option',
@@ -84,7 +83,7 @@ class Migration(migrations.Migration):
84
83
  },
85
84
  ),
86
85
  migrations.CreateClass(
87
- schema_type=SchemaTypes.CORE,
86
+ module_type=ModuleType.CORE,
88
87
  class_name='Validator',
89
88
  new_schema={
90
89
  'title': 'Validator',
@@ -97,7 +96,7 @@ class Migration(migrations.Migration):
97
96
  },
98
97
  ),
99
98
  migrations.CreateClass(
100
- schema_type=SchemaTypes.CORE,
99
+ module_type=ModuleType.CORE,
101
100
  class_name='ClassPropertyMeta',
102
101
  new_schema={
103
102
  'title': 'ClassPropertyMeta',
@@ -110,7 +109,7 @@ class Migration(migrations.Migration):
110
109
  },
111
110
  ),
112
111
  migrations.CreateClass(
113
- schema_type=SchemaTypes.CORE,
112
+ module_type=ModuleType.CORE,
114
113
  class_name='ClassProperty',
115
114
  new_schema={
116
115
  'title': 'ClassProperty',
@@ -127,16 +126,28 @@ class Migration(migrations.Migration):
127
126
  },
128
127
  ),
129
128
  migrations.CreateClass(
130
- schema_type=SchemaTypes.CORE,
129
+ module_type=ModuleType.CORE,
131
130
  class_name='ClassObject',
132
131
  new_schema={
133
132
  'title': 'ClassObject',
134
133
  'properties': {
134
+ 'table_name': {'type': 'string', 'title': 'Table Name'},
135
135
  'properties': {
136
136
  'type': 'dictionary',
137
137
  'items': {'key': {'type': 'string'}, 'value': {'type': 'ClassProperty'}},
138
138
  'title': 'Properties',
139
139
  },
140
+ 'primary_key': {
141
+ 'type': 'dictionary',
142
+ 'items': {'key': {'type': 'string'}, 'value': {'type': 'array', 'items': {'type': 'string'}}},
143
+ 'title': 'Primary key fields',
144
+ },
145
+ 'indexed': {'type': 'array', 'items': {'type': 'string'}, 'title': 'Indexed'},
146
+ 'unique': {
147
+ 'type': 'array',
148
+ 'items': {'type': 'array', 'items': {'type': 'string'}},
149
+ 'title': 'Unique Fields',
150
+ },
140
151
  'required': {'type': 'array', 'items': {'type': 'string'}, 'title': 'Required'},
141
152
  'meta_class': {'type': 'string', 'default': 'ClassObject', 'title': 'Meta Class'},
142
153
  },
@@ -144,7 +155,7 @@ class Migration(migrations.Migration):
144
155
  },
145
156
  ),
146
157
  migrations.CreateClass(
147
- schema_type=SchemaTypes.CORE,
158
+ module_type=ModuleType.CORE,
148
159
  class_name='ClassObjectMeta',
149
160
  new_schema={
150
161
  'title': 'ClassObjectMeta',
@@ -158,18 +169,12 @@ class Migration(migrations.Migration):
158
169
  'items': {'key': {'type': 'string'}, 'value': {'type': 'ClassPropertyMeta'}},
159
170
  'title': 'Properties',
160
171
  },
161
- 'indexed': {'type': 'array', 'items': {'type': 'string'}, 'title': 'Indexed'},
162
- 'unique': {
163
- 'type': 'array',
164
- 'items': {'type': 'array', 'items': {'type': 'string'}},
165
- 'title': 'Unique Fields',
166
- },
167
172
  'custom_code': {'type': 'string', 'title': 'Custom Code'},
168
173
  },
169
174
  },
170
175
  ),
171
176
  migrations.CreateClass(
172
- schema_type=SchemaTypes.CORE,
177
+ module_type=ModuleType.CORE,
173
178
  class_name='Fixture',
174
179
  new_schema={
175
180
  'title': 'Fixture',
@@ -183,11 +188,13 @@ class Migration(migrations.Migration):
183
188
  'title': 'Data',
184
189
  },
185
190
  },
191
+ "primary_key": {"partition_key": ["partition_key"]},
192
+ "table_name": "Fixture",
186
193
  'unique': [['external_id']],
187
194
  },
188
195
  ),
189
196
  migrations.CreateClass(
190
- schema_type=SchemaTypes.CORE,
197
+ module_type=ModuleType.CORE,
191
198
  class_name='File',
192
199
  new_schema={
193
200
  'title': 'File',
@@ -197,6 +204,8 @@ class Migration(migrations.Migration):
197
204
  'data': {'type': 'binary', 'title': 'Data'},
198
205
  'size': {'type': 'number', 'title': 'Size'},
199
206
  },
207
+ "primary_key": {"partition_key": ["partition_key"]},
208
+ "table_name": "File",
200
209
  'custom_code': "def pre_update(self): # type: ignore[no-untyped-def]\n self.size = len(self.data or b'')\n\ndef pre_create(self) -> None: # type: ignore[no-untyped-def]\n self.size = len(self.data or b'')\n\nfrom pathlib import Path\nfrom typing import BinaryIO\n\n\ndef to_file(self, file_or_path: Path | BinaryIO) -> None: # type: ignore[no-untyped-def]\n if isinstance(file_or_path, Path):\n if file_or_path.is_dir():\n file_or_path = file_or_path / self.name\n file_or_path.write_bytes(self.data) # type: ignore[union-attr]\n else:\n file_or_path.write(self.data)\n file_or_path.seek(0)\n\nfrom pathlib import Path\nfrom typing import BinaryIO\n\n\n@classmethod # type: ignore[misc, no-untyped-def]\ndef from_file(\n cls,\n file_or_path: Path | BinaryIO,\n) -> 'File': # type: ignore[name-defined] # noqa: F821\n if isinstance(file_or_path, Path):\n if file_or_path.is_dir():\n msg = f'{file_or_path} is a directory'\n raise ValueError(msg)\n\n data = file_or_path.read_bytes()\n filename = file_or_path.name\n else:\n file_or_path.seek(0)\n data = file_or_path.read()\n filename = Path(file_or_path.name).name\n\n return cls(data=data, filename=filename)\n\nimport base64\n\nfrom pydantic import field_validator\n\n\n@field_validator('data') # type: ignore[misc]\n@classmethod\ndef data_base64_decode(cls, v: bytes) -> bytes: # type: ignore[no-untyped-def] # noqa: ARG001\n is_base64: bool = False\n\n try:\n is_base64 = base64.b64encode(base64.b64decode(v)) == v\n except Exception:\n ...\n\n if is_base64:\n return base64.b64decode(v)\n\n return v\n\n@property # type: ignore[misc]\ndef mimetype(self) -> str | None: # type: ignore[no-untyped-def]\n import mimetypes\n\n return mimetypes.guess_type(self.filename)[0]",
201
210
  },
202
211
  ),
@@ -1,17 +1,17 @@
1
- from amsdal_utils.models.enums import SchemaTypes
1
+ from amsdal_utils.models.enums import ModuleType
2
2
 
3
- from amsdal.migration import migrations
3
+ from amsdal_models.migration import migrations
4
4
 
5
5
 
6
6
  class Migration(migrations.Migration):
7
7
  operations: list[migrations.Operation] = [
8
8
  migrations.CreateClass(
9
- schema_type=SchemaTypes.TYPE,
9
+ module_type=ModuleType.TYPE,
10
10
  class_name='Date',
11
11
  new_schema={'title': 'Date', 'properties': {}, 'meta_class': 'TypeMeta'},
12
12
  ),
13
13
  migrations.CreateClass(
14
- schema_type=SchemaTypes.TYPE,
14
+ module_type=ModuleType.TYPE,
15
15
  class_name='Datetime',
16
16
  new_schema={'title': 'Datetime', 'properties': {}, 'meta_class': 'TypeMeta'},
17
17
  ),
@@ -1,11 +1,11 @@
1
- from amsdal.migration import migrations
2
- from amsdal_utils.models.enums import SchemaTypes
1
+ from amsdal_models.migration import migrations
2
+ from amsdal_utils.models.enums import ModuleType
3
3
 
4
4
 
5
5
  class Migration(migrations.Migration):
6
6
  operations: list[migrations.Operation] = [
7
7
  migrations.UpdateClass(
8
- schema_type=SchemaTypes.CORE,
8
+ module_type=ModuleType.CORE,
9
9
  class_name='Fixture',
10
10
  old_schema={
11
11
  'title': 'Fixture',
@@ -19,6 +19,8 @@ class Migration(migrations.Migration):
19
19
  'title': 'Data',
20
20
  },
21
21
  },
22
+ "primary_key": {"partition_key": ["partition_key"]},
23
+ "table_name": "Fixture",
22
24
  'unique': [['external_id']],
23
25
  },
24
26
  new_schema={
@@ -34,6 +36,8 @@ class Migration(migrations.Migration):
34
36
  'title': 'Data',
35
37
  },
36
38
  },
39
+ "primary_key": {"partition_key": ["partition_key"]},
40
+ "table_name": "Fixture",
37
41
  'unique': [['external_id']],
38
42
  },
39
43
  ),
@@ -1,11 +1,11 @@
1
- from amsdal.migration import migrations
2
- from amsdal_utils.models.enums import SchemaTypes
1
+ from amsdal_models.migration import migrations
2
+ from amsdal_utils.models.enums import ModuleType
3
3
 
4
4
 
5
5
  class Migration(migrations.Migration):
6
6
  operations: list[migrations.Operation] = [
7
7
  migrations.UpdateClass(
8
- schema_type=SchemaTypes.CORE,
8
+ module_type=ModuleType.CORE,
9
9
  class_name='ClassObjectMeta',
10
10
  old_schema={
11
11
  "title": "ClassObjectMeta",
@@ -19,12 +19,6 @@ class Migration(migrations.Migration):
19
19
  "type": "dictionary",
20
20
  "items": {"key": {"type": "string"}, "value": {"type": "ClassPropertyMeta"}},
21
21
  },
22
- "indexed": {"title": "Indexed", "type": "array", "items": {"type": "string"}},
23
- "unique": {
24
- "title": "Unique Fields",
25
- "type": "array",
26
- "items": {"type": "array", "items": {"type": "string"}},
27
- },
28
22
  "custom_code": {"title": "Custom Code", "type": "string"},
29
23
  },
30
24
  "required": ["title", "type"],
@@ -42,12 +36,6 @@ class Migration(migrations.Migration):
42
36
  "type": "dictionary",
43
37
  "items": {"key": {"type": "string"}, "value": {"type": "ClassPropertyMeta"}},
44
38
  },
45
- "indexed": {"title": "Indexed", "type": "array", "items": {"type": "string"}},
46
- "unique": {
47
- "title": "Unique Fields",
48
- "type": "array",
49
- "items": {"type": "array", "items": {"type": "string"}},
50
- },
51
39
  "custom_code": {"title": "Custom Code", "type": "string"},
52
40
  },
53
41
  "required": ["title", "type"],
Binary file
Binary file
Binary file
@@ -6,7 +6,6 @@ from amsdal.cloud.services.actions.create_session import CreateSessionAction as
6
6
  from amsdal.cloud.services.auth.base import AuthHandlerBase as AuthHandlerBase
7
7
  from amsdal.cloud.services.auth.token import TokenAuthHandler as TokenAuthHandler
8
8
  from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError
9
- from amsdal.schemas.manager import SchemaManager as SchemaManager
10
9
 
11
10
  class CredentialsAuthHandler(AuthHandlerBase):
12
11
  """
@@ -2,7 +2,6 @@ from _typeshed import Incomplete
2
2
  from amsdal.cloud.constants import JWT_PUBLIC_KEY as JWT_PUBLIC_KEY
3
3
  from amsdal.cloud.services.auth.base import AuthHandlerBase as AuthHandlerBase
4
4
  from amsdal.errors import AmsdalAuthenticationError as AmsdalAuthenticationError
5
- from amsdal.schemas.manager import SchemaManager as SchemaManager
6
5
 
7
6
  HMAC_KEY: bytes
8
7
 
amsdal/configs/main.py CHANGED
@@ -48,11 +48,17 @@ class Settings(BaseSettings):
48
48
 
49
49
  APP_PATH: Path = Path('.')
50
50
  CONFIG_PATH: Path | None = None
51
- MODELS_MODULE_NAME: str = 'models'
52
- SCHEMAS_MODULE_NAME: str = 'schemas'
51
+ TYPE_MODELS_MODULE: str = 'amsdal.models.types'
52
+ CORE_MODELS_MODULE: str = 'amsdal.models.core'
53
+ USER_MODELS_MODULE_PATH: Path | None = None
54
+ USER_MODELS_MODULE: str = 'models'
55
+ FIXTURES_MODULE_PATH: Path | None = None
53
56
  FIXTURES_MODULE_NAME: str = 'fixtures'
57
+ STATIC_MODULE_PATH: Path | None = None
54
58
  STATIC_MODULE_NAME: str = 'static'
59
+ TRANSACTIONS_MODULE_PATH: Path | None = None
55
60
  TRANSACTIONS_MODULE_NAME: str = 'transactions'
61
+ MIGRATIONS_MODULE_PATH: Path | None = None
56
62
  MIGRATIONS_DIRECTORY_NAME: str = 'migrations'
57
63
  ACCESS_KEY_ID: str | None = None
58
64
  SECRET_ACCESS_KEY: str | None = None
@@ -62,6 +68,8 @@ class Settings(BaseSettings):
62
68
  'amsdal.contrib.auth.app.AuthAppConfig',
63
69
  'amsdal.contrib.frontend_configs.app.FrontendConfigAppConfig',
64
70
  ]
71
+ CONTRIB_MODELS_PACKAGE_NAME: str = 'models'
72
+ CONTRIB_MIGRATIONS_DIRECTORY_NAME: str = 'migrations'
65
73
 
66
74
  @field_validator('CONTRIBS', mode='after')
67
75
  def load_contrib_modules(cls, value: list[str]) -> list[str]: # noqa: N805
@@ -88,7 +96,7 @@ class Settings(BaseSettings):
88
96
  return value
89
97
 
90
98
  @property
91
- def models_root_path(self) -> Path:
99
+ def user_models_path(self) -> Path:
92
100
  """
93
101
  Returns the root path for models.
94
102
 
@@ -98,20 +106,16 @@ class Settings(BaseSettings):
98
106
  Returns:
99
107
  Path: The root path for the models directory.
100
108
  """
101
- return self.APP_PATH / self.MODELS_MODULE_NAME
109
+ if self.USER_MODELS_MODULE_PATH:
110
+ return self.USER_MODELS_MODULE_PATH
102
111
 
103
- @property
104
- def schemas_root_path(self) -> Path:
105
- """
106
- Returns the root path for schemas.
112
+ if '.' in self.USER_MODELS_MODULE:
113
+ _package, _ = self.USER_MODELS_MODULE.split('.', 1)
114
+ _module = importlib.import_module(_package)
107
115
 
108
- This property constructs and returns the path to the schemas directory
109
- based on the `APP_PATH` and `SCHEMAS_MODULE_NAME` attributes.
116
+ return Path(_module.__path__[0])
110
117
 
111
- Returns:
112
- Path: The root path for the schemas directory.
113
- """
114
- return self.APP_PATH / self.SCHEMAS_MODULE_NAME
118
+ return self.APP_PATH / self.USER_MODELS_MODULE
115
119
 
116
120
  @property
117
121
  def fixtures_root_path(self) -> Path:
@@ -124,7 +128,7 @@ class Settings(BaseSettings):
124
128
  Returns:
125
129
  Path: The root path for the fixtures directory.
126
130
  """
127
- return self.APP_PATH / self.FIXTURES_MODULE_NAME
131
+ return self.FIXTURES_MODULE_PATH or self.APP_PATH / self.FIXTURES_MODULE_NAME
128
132
 
129
133
  @property
130
134
  def static_root_path(self) -> Path:
@@ -137,7 +141,7 @@ class Settings(BaseSettings):
137
141
  Returns:
138
142
  Path: The root path for the static files directory.
139
143
  """
140
- return self.APP_PATH / self.STATIC_MODULE_NAME
144
+ return self.STATIC_MODULE_PATH or self.APP_PATH / self.STATIC_MODULE_NAME
141
145
 
142
146
  @property
143
147
  def transactions_root_path(self) -> Path:
@@ -150,7 +154,7 @@ class Settings(BaseSettings):
150
154
  Returns:
151
155
  Path: The root path for the transactions directory.
152
156
  """
153
- return self.models_root_path / self.TRANSACTIONS_MODULE_NAME
157
+ return self.TRANSACTIONS_MODULE_PATH or self.APP_PATH / self.TRANSACTIONS_MODULE_NAME
154
158
 
155
159
  @property
156
160
  def migrations_root_path(self) -> Path:
@@ -163,10 +167,10 @@ class Settings(BaseSettings):
163
167
  Returns:
164
168
  Path: The root path for the migrations directory.
165
169
  """
166
- return self.models_root_path / self.MIGRATIONS_DIRECTORY_NAME
170
+ return self.MIGRATIONS_MODULE_PATH or self.APP_PATH / self.MIGRATIONS_DIRECTORY_NAME
167
171
 
168
172
  @model_validator(mode='after')
169
- def check_passwords_match(self) -> 'Settings':
173
+ def check_config_path_set(self) -> 'Settings':
170
174
  """
171
175
  Ensures the configuration path is set.
172
176
 
amsdal/configs/main.pyi CHANGED
@@ -33,17 +33,25 @@ class Settings(BaseSettings):
33
33
  model_config: Incomplete
34
34
  APP_PATH: Path
35
35
  CONFIG_PATH: Path | None
36
- MODELS_MODULE_NAME: str
37
- SCHEMAS_MODULE_NAME: str
36
+ TYPE_MODELS_MODULE: str
37
+ CORE_MODELS_MODULE: str
38
+ USER_MODELS_MODULE_PATH: Path | None
39
+ USER_MODELS_MODULE: str
40
+ FIXTURES_MODULE_PATH: Path | None
38
41
  FIXTURES_MODULE_NAME: str
42
+ STATIC_MODULE_PATH: Path | None
39
43
  STATIC_MODULE_NAME: str
44
+ TRANSACTIONS_MODULE_PATH: Path | None
40
45
  TRANSACTIONS_MODULE_NAME: str
46
+ MIGRATIONS_MODULE_PATH: Path | None
41
47
  MIGRATIONS_DIRECTORY_NAME: str
42
48
  ACCESS_KEY_ID: str | None
43
49
  SECRET_ACCESS_KEY: str | None
44
50
  ACCESS_TOKEN: str | None
45
51
  SANDBOX_ENVIRONMENT: bool | None
46
52
  CONTRIBS: list[str]
53
+ CONTRIB_MODELS_PACKAGE_NAME: str
54
+ CONTRIB_MIGRATIONS_DIRECTORY_NAME: str
47
55
  def load_contrib_modules(cls, value: list[str]) -> list[str]:
48
56
  """
49
57
  Loads and initializes contrib modules.
@@ -58,7 +66,7 @@ class Settings(BaseSettings):
58
66
  list[str]: The same list of contrib module paths after loading and initializing the modules.
59
67
  """
60
68
  @property
61
- def models_root_path(self) -> Path:
69
+ def user_models_path(self) -> Path:
62
70
  """
63
71
  Returns the root path for models.
64
72
 
@@ -69,17 +77,6 @@ class Settings(BaseSettings):
69
77
  Path: The root path for the models directory.
70
78
  """
71
79
  @property
72
- def schemas_root_path(self) -> Path:
73
- """
74
- Returns the root path for schemas.
75
-
76
- This property constructs and returns the path to the schemas directory
77
- based on the `APP_PATH` and `SCHEMAS_MODULE_NAME` attributes.
78
-
79
- Returns:
80
- Path: The root path for the schemas directory.
81
- """
82
- @property
83
80
  def fixtures_root_path(self) -> Path:
84
81
  """
85
82
  Returns the root path for fixtures.
@@ -123,7 +120,7 @@ class Settings(BaseSettings):
123
120
  Returns:
124
121
  Path: The root path for the migrations directory.
125
122
  """
126
- def check_passwords_match(self) -> Settings:
123
+ def check_config_path_set(self) -> Settings:
127
124
  """
128
125
  Ensures the configuration path is set.
129
126
 
@@ -0,0 +1,64 @@
1
+ {
2
+ "Permission": [
3
+ {
4
+ "_external_id": "user_delete",
5
+ "model": "User",
6
+ "action": "delete"
7
+ },
8
+ {
9
+ "_external_id": "user_read",
10
+ "model": "User",
11
+ "action": "read"
12
+ },
13
+ {
14
+ "_external_id": "user_update",
15
+ "model": "User",
16
+ "action": "update"
17
+ },
18
+ {
19
+ "_external_id": "user_all_actions",
20
+ "model": "User",
21
+ "action": "*"
22
+ },
23
+ {
24
+ "_external_id": "all_models_all_actions",
25
+ "model": "*",
26
+ "action": "*"
27
+ },
28
+ {
29
+ "_external_id": "login_session_delete",
30
+ "model": "LoginSession",
31
+ "action": "delete"
32
+ },
33
+ {
34
+ "_external_id": "login_session_read",
35
+ "model": "LoginSession",
36
+ "action": "read"
37
+ },
38
+ {
39
+ "_external_id": "login_session_update",
40
+ "model": "LoginSession",
41
+ "action": "update"
42
+ },
43
+ {
44
+ "_external_id": "permission_delete",
45
+ "model": "Permission",
46
+ "action": "delete"
47
+ },
48
+ {
49
+ "_external_id": "permission_read",
50
+ "model": "Permission",
51
+ "action": "read"
52
+ },
53
+ {
54
+ "_external_id": "permission_update",
55
+ "model": "Permission",
56
+ "action": "update"
57
+ },
58
+ {
59
+ "_external_id": "permission_create",
60
+ "model": "Permission",
61
+ "action": "create"
62
+ }
63
+ ]
64
+ }