zrb 1.0.0a16__py3-none-any.whl → 1.0.0a20__py3-none-any.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.
Files changed (196) hide show
  1. zrb/__init__.py +5 -0
  2. zrb/__main__.py +3 -0
  3. zrb/builtin/__init__.py +2 -2
  4. zrb/builtin/git.py +10 -2
  5. zrb/builtin/git_subtree.py +4 -0
  6. zrb/builtin/llm/tool/rag.py +2 -2
  7. zrb/builtin/project/add/fastapp/fastapp_input.py +16 -0
  8. zrb/builtin/project/add/fastapp/fastapp_task.py +78 -0
  9. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/.flake8 +3 -0
  10. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/column/create_column_task.py +14 -0
  11. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_task.py +128 -0
  12. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +213 -0
  13. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/any_client_method.py +27 -0
  14. zrb/builtin/project/add/{fastapp_template/_zrb/entity/module_template → fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module}/service/my_entity/my_entity_usecase.py +9 -10
  15. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/repository/factory.py +13 -0
  16. zrb/builtin/project/add/{fastapp_template/_zrb/entity/module_template → fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module}/service/my_entity/repository/my_entity_db_repository.py +14 -9
  17. zrb/builtin/project/add/{fastapp_template/_zrb/entity/module_template → fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module}/service/my_entity/repository/my_entity_repository.py +6 -7
  18. zrb/builtin/project/add/{fastapp_template/_zrb/entity/schema.template.py → fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/schema/my_entity.py} +8 -0
  19. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/format_task.py +17 -0
  20. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/_zrb/input.py +1 -4
  21. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_task.py +85 -0
  22. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py +154 -0
  23. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/any_client.py +7 -0
  24. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/api_client.py +6 -0
  25. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/direct_client.py +6 -0
  26. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/factory.py +9 -0
  27. zrb/builtin/project/add/{fastapp_template/_zrb/module/module_template → fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module}/migration/env.py +2 -4
  28. zrb/builtin/project/add/{fastapp_template/module/auth → fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module}/migration/script.py.mako +1 -0
  29. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/route.py +33 -0
  30. zrb/builtin/project/add/{fastapp_template/_zrb/main.py → fastapp/fastapp_template/my_app_name/_zrb/task.py} +12 -14
  31. zrb/builtin/project/add/{fastapp_template/_zrb/helper.py → fastapp/fastapp_template/my_app_name/_zrb/util.py} +1 -1
  32. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/_zrb/venv_task.py +1 -1
  33. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/common/app.py +2 -2
  34. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/common/base_db_repository.py +1 -1
  35. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/common/base_usecase.py +19 -6
  36. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/common/db_engine.py +1 -1
  37. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/config.py +1 -0
  38. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/main.py +7 -0
  39. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/migrate.py +3 -0
  40. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/auth/client/any_client.py +10 -4
  41. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/api_client.py +7 -0
  42. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/direct_client.py +6 -0
  43. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/factory.py +9 -0
  44. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/auth/migration/env.py +2 -4
  45. zrb/builtin/project/add/{fastapp_template/module/gateway → fastapp/fastapp_template/my_app_name/module/auth}/migration/script.py.mako +1 -0
  46. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/auth/migration_metadata.py +1 -1
  47. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/route.py +37 -0
  48. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/auth/service/user/repository/user_db_repository.py +13 -7
  49. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_repository.py +42 -0
  50. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_repository_factory.py +13 -0
  51. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/auth/service/user/user_usecase.py +13 -12
  52. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/user_usecase_factory.py +6 -0
  53. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/gateway/migration/env.py +2 -4
  54. zrb/builtin/project/add/{fastapp_template/_zrb/module/module_template → fastapp/fastapp_template/my_app_name/module/gateway}/migration/script.py.mako +1 -0
  55. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/route.py +37 -0
  56. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/subroute/auth.py +44 -0
  57. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/requirements.txt +1 -1
  58. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/schema/permission.py +8 -0
  59. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/schema/role.py +8 -0
  60. zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/schema/user.py +8 -0
  61. zrb/builtin/project/add/fastapp/fastapp_util.py +46 -0
  62. zrb/builtin/project/create/{create.py → project_task.py} +1 -1
  63. zrb/builtin/python.py +4 -1
  64. zrb/builtin/setup/asdf/asdf_helper.py +4 -8
  65. zrb/builtin/setup/tmux/tmux.py +7 -12
  66. zrb/builtin/todo.py +42 -26
  67. zrb/callback/callback.py +0 -1
  68. zrb/cmd/cmd_val.py +2 -2
  69. zrb/config.py +18 -0
  70. zrb/content_transformer/content_transformer.py +8 -7
  71. zrb/context/any_context.py +6 -6
  72. zrb/group/group.py +0 -1
  73. zrb/input/any_input.py +4 -0
  74. zrb/input/base_input.py +17 -5
  75. zrb/input/bool_input.py +1 -1
  76. zrb/input/float_input.py +2 -2
  77. zrb/input/int_input.py +1 -1
  78. zrb/input/option_input.py +2 -2
  79. zrb/input/password_input.py +2 -2
  80. zrb/input/text_input.py +6 -6
  81. zrb/runner/cli.py +9 -35
  82. zrb/runner/common_util.py +31 -0
  83. zrb/runner/web_app.py +169 -46
  84. zrb/runner/web_config.py +288 -0
  85. zrb/runner/web_controller/error_page/controller.py +27 -0
  86. zrb/runner/web_controller/error_page/view.html +33 -0
  87. zrb/runner/web_controller/group_info_page/controller.py +40 -0
  88. zrb/runner/web_controller/group_info_page/view.html +36 -0
  89. zrb/runner/web_controller/home_page/controller.py +14 -57
  90. zrb/runner/web_controller/home_page/view.html +29 -20
  91. zrb/runner/web_controller/login_page/controller.py +25 -0
  92. zrb/runner/web_controller/login_page/view.html +50 -0
  93. zrb/runner/web_controller/logout_page/controller.py +26 -0
  94. zrb/runner/web_controller/logout_page/view.html +40 -0
  95. zrb/runner/web_controller/{task_ui → session_page}/controller.py +36 -34
  96. zrb/runner/web_controller/{task_ui → session_page}/partial/input.html +1 -1
  97. zrb/runner/web_controller/session_page/view.html +91 -0
  98. zrb/runner/web_controller/static/common.css +11 -0
  99. zrb/runner/web_controller/static/login/event.js +33 -0
  100. zrb/runner/web_controller/static/logout/event.js +20 -0
  101. zrb/runner/web_controller/static/pico.min.css +1 -1
  102. zrb/runner/web_controller/static/session/common-util.js +63 -0
  103. zrb/runner/web_controller/static/session/current-session.js +164 -0
  104. zrb/runner/web_controller/static/session/event.js +120 -0
  105. zrb/runner/web_controller/static/session/past-session.js +138 -0
  106. zrb/runner/web_util.py +53 -0
  107. zrb/session_state_logger/any_session_state_logger.py +0 -1
  108. zrb/session_state_logger/file_session_state_logger.py +4 -8
  109. zrb/task/base_trigger.py +0 -1
  110. zrb/task/cmd_task.py +1 -1
  111. zrb/task/llm_task.py +3 -6
  112. zrb/task/make_task.py +0 -1
  113. zrb/task/scaffolder.py +18 -4
  114. zrb/task/scheduler.py +0 -1
  115. zrb/util/cmd/command.py +0 -1
  116. zrb/util/codemod/{add_code_to_class.py → append_code_to_class.py} +4 -4
  117. zrb/util/codemod/{add_code_to_function.py → append_code_to_function.py} +5 -3
  118. zrb/util/codemod/{add_code_to_method.py → append_code_to_method.py} +3 -3
  119. zrb/util/codemod/{add_key_to_dict.py → append_key_to_dict.py} +1 -1
  120. zrb/util/codemod/{add_param_to_function_call.py → append_param_to_function_call.py} +1 -1
  121. zrb/util/codemod/{add_code_to_module.py → prepend_code_to_module.py} +2 -2
  122. zrb/util/codemod/{add_parent_to_class.py → prepend_parent_to_class.py} +1 -1
  123. zrb/util/codemod/{add_property_to_class.py → prepend_property_to_class.py} +1 -1
  124. zrb/util/file.py +18 -0
  125. zrb/util/git_subtree.py +3 -4
  126. zrb/util/todo.py +105 -24
  127. zrb/xcom/xcom.py +0 -1
  128. {zrb-1.0.0a16.dist-info → zrb-1.0.0a20.dist-info}/METADATA +3 -2
  129. zrb-1.0.0a20.dist-info/RECORD +243 -0
  130. zrb/builtin/project/add/fastapp.py +0 -87
  131. zrb/builtin/project/add/fastapp_template/_zrb/column/create_column_task.py +0 -11
  132. zrb/builtin/project/add/fastapp_template/_zrb/entity/create_entity_task.py +0 -196
  133. zrb/builtin/project/add/fastapp_template/_zrb/entity/module_template/service/my_entity/repository/factory.py +0 -13
  134. zrb/builtin/project/add/fastapp_template/_zrb/module/create_module_task.py +0 -136
  135. zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/client/any_client.py +0 -27
  136. zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/client/api_client.py +0 -6
  137. zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/client/direct_client.py +0 -6
  138. zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/client/factory.py +0 -9
  139. zrb/builtin/project/add/fastapp_template/_zrb/module/module_template/route.py +0 -19
  140. zrb/builtin/project/add/fastapp_template/main.py +0 -7
  141. zrb/builtin/project/add/fastapp_template/migrate.py +0 -3
  142. zrb/builtin/project/add/fastapp_template/module/auth/client/api_client.py +0 -7
  143. zrb/builtin/project/add/fastapp_template/module/auth/client/direct_client.py +0 -6
  144. zrb/builtin/project/add/fastapp_template/module/auth/client/factory.py +0 -9
  145. zrb/builtin/project/add/fastapp_template/module/auth/migration/versions/3093c7336477_add_user_table.py +0 -37
  146. zrb/builtin/project/add/fastapp_template/module/auth/route.py +0 -22
  147. zrb/builtin/project/add/fastapp_template/module/auth/service/user/repository/factory.py +0 -13
  148. zrb/builtin/project/add/fastapp_template/module/auth/service/user/repository/user_repository.py +0 -34
  149. zrb/builtin/project/add/fastapp_template/module/gateway/route.py +0 -27
  150. zrb/runner/web_controller/group_info_ui/controller.py +0 -91
  151. zrb/runner/web_controller/group_info_ui/partial/group_info.html +0 -2
  152. zrb/runner/web_controller/group_info_ui/partial/group_li.html +0 -1
  153. zrb/runner/web_controller/group_info_ui/partial/task_info.html +0 -2
  154. zrb/runner/web_controller/group_info_ui/partial/task_li.html +0 -1
  155. zrb/runner/web_controller/group_info_ui/view.html +0 -31
  156. zrb/runner/web_controller/home_page/partial/group_info.html +0 -2
  157. zrb/runner/web_controller/home_page/partial/group_li.html +0 -1
  158. zrb/runner/web_controller/home_page/partial/task_info.html +0 -2
  159. zrb/runner/web_controller/home_page/partial/task_li.html +0 -1
  160. zrb/runner/web_controller/task_ui/partial/common-util.js +0 -37
  161. zrb/runner/web_controller/task_ui/partial/main.js +0 -195
  162. zrb/runner/web_controller/task_ui/partial/show-existing-session.js +0 -97
  163. zrb/runner/web_controller/task_ui/partial/visualize-history.js +0 -104
  164. zrb/runner/web_controller/task_ui/view.html +0 -87
  165. zrb-1.0.0a16.dist-info/RECORD +0 -231
  166. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/.gitignore +0 -0
  167. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/README.md +0 -0
  168. /zrb/builtin/project/add/{__init__.py → fastapp/fastapp_template/my_app_name/__init__.py} +0 -0
  169. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/_zrb/config.py +0 -0
  170. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/_zrb/group.py +0 -0
  171. /zrb/builtin/project/add/{fastapp_template/__init__.py → fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/gateway/subroute/my_module.py} +0 -0
  172. /zrb/builtin/project/add/{fastapp_template/_zrb/module/module_template → fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module}/alembic.ini +0 -0
  173. /zrb/builtin/project/add/{fastapp_template/_zrb/module/module_template → fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module}/migration/README +0 -0
  174. /zrb/builtin/project/add/{fastapp_template/module/gateway → fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module}/migration/versions/.gitkeep +0 -0
  175. /zrb/builtin/project/add/{fastapp_template/_zrb/module/module_template → fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module}/migration_metadata.py +0 -0
  176. /zrb/builtin/project/add/{fastapp_template/_zrb/module/module_template → fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module}/service/__init__.py +0 -0
  177. /zrb/builtin/project/add/{fastapp_template/_zrb/module/run_module.template.py → fastapp/fastapp_template/my_app_name/_zrb/module/template/module_task_definition.py} +0 -0
  178. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/common/__init__.py +0 -0
  179. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/common/error.py +0 -0
  180. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/common/schema.py +0 -0
  181. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/__init__.py +0 -0
  182. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/auth/alembic.ini +0 -0
  183. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/auth/migration/README +0 -0
  184. /zrb/builtin/project/add/{fastapp_template/_zrb/module/module_template → fastapp/fastapp_template/my_app_name/module/auth}/migration/versions/3093c7336477_add_user_table.py +0 -0
  185. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/auth/service/__init__.py +0 -0
  186. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/auth/service/user/__init__.py +0 -0
  187. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/gateway/alembic.ini +0 -0
  188. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/gateway/migration/README +0 -0
  189. /zrb/builtin/project/add/{fastapp_template/module/auth/service/user/repository/__init__.py → fastapp/fastapp_template/my_app_name/module/gateway/migration/versions/.gitkeep} +0 -0
  190. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/module/gateway/migration_metadata.py +0 -0
  191. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/schema/__init__.py +0 -0
  192. /zrb/builtin/project/add/{fastapp_template → fastapp/fastapp_template/my_app_name}/template.env +0 -0
  193. /zrb/runner/web_controller/{group_info_ui → group_info_page}/__init__.py +0 -0
  194. /zrb/runner/web_controller/{task_ui → session_page}/__init__.py +0 -0
  195. {zrb-1.0.0a16.dist-info → zrb-1.0.0a20.dist-info}/WHEEL +0 -0
  196. {zrb-1.0.0a16.dist-info → zrb-1.0.0a20.dist-info}/entry_points.txt +0 -0
zrb/__init__.py CHANGED
@@ -27,12 +27,14 @@ from zrb.group.group import Group
27
27
  from zrb.input.any_input import AnyInput
28
28
  from zrb.input.base_input import BaseInput
29
29
  from zrb.input.bool_input import BoolInput
30
+ from zrb.input.float_input import FloatInput
30
31
  from zrb.input.int_input import IntInput
31
32
  from zrb.input.option_input import OptionInput
32
33
  from zrb.input.password_input import PasswordInput
33
34
  from zrb.input.str_input import StrInput
34
35
  from zrb.input.text_input import TextInput
35
36
  from zrb.runner.cli import cli
37
+ from zrb.runner.web_config import User, web_config
36
38
  from zrb.session.session import Session
37
39
  from zrb.task.any_task import AnyTask
38
40
  from zrb.task.base_task import BaseTask
@@ -73,6 +75,7 @@ assert CmdResult
73
75
  assert CmdTask
74
76
  assert HttpCheck
75
77
  assert TcpCheck
78
+ assert FloatInput
76
79
  assert IntInput
77
80
  assert OptionInput
78
81
  assert PasswordInput
@@ -98,6 +101,8 @@ assert Scaffolder
98
101
  assert Scheduler
99
102
  assert cli
100
103
  assert Xcom
104
+ assert web_config
105
+ assert User
101
106
 
102
107
  if LOAD_BUILTIN:
103
108
  from zrb import builtin
zrb/__main__.py CHANGED
@@ -14,6 +14,9 @@ def serve_cli():
14
14
  for init_script in INIT_SCRIPTS:
15
15
  load_file(init_script, -1)
16
16
  cli.run(sys.argv[1:])
17
+ except RuntimeError as e:
18
+ if "Event loop is closed" not in f"{e}":
19
+ raise e
17
20
  except KeyboardInterrupt:
18
21
  print(stylize_warning("\nStopped"), file=sys.stderr)
19
22
  except NodeNotFoundError as e:
zrb/builtin/__init__.py CHANGED
@@ -9,8 +9,8 @@ from zrb.builtin.git import (
9
9
  from zrb.builtin.git_subtree import git_add_subtree, git_pull_subtree, git_push_subtree
10
10
  from zrb.builtin.llm.llm_chat import llm_chat
11
11
  from zrb.builtin.md5 import hash_md5, sum_md5
12
- from zrb.builtin.project.add.fastapp import add_fastapp_to_project
13
- from zrb.builtin.project.create.create import create_project
12
+ from zrb.builtin.project.add.fastapp.fastapp_task import add_fastapp_to_project
13
+ from zrb.builtin.project.create.project_task import create_project
14
14
  from zrb.builtin.python import format_python_code
15
15
  from zrb.builtin.setup.asdf.asdf import setup_asdf
16
16
  from zrb.builtin.setup.latex.ubuntu import setup_latex_on_ubuntu
zrb/builtin/git.py CHANGED
@@ -56,6 +56,7 @@ from zrb.util.git import (
56
56
  alias="diff",
57
57
  )
58
58
  async def get_git_diff(ctx: AnyContext):
59
+ ctx.print(stylize_faint("Get directory"))
59
60
  repo_dir = await get_repo_dir(log_method=ctx.print)
60
61
  diff = await get_diff(
61
62
  repo_dir, ctx.input.source, ctx.input.current, log_method=ctx.print
@@ -86,8 +87,11 @@ async def get_git_diff(ctx: AnyContext):
86
87
  alias="prune",
87
88
  )
88
89
  async def prune_local_branches(ctx: AnyContext):
90
+ ctx.print(stylize_faint("Get directory"))
89
91
  repo_dir = await get_repo_dir(log_method=ctx.print)
92
+ ctx.print(stylize_faint("Get existing branches"))
90
93
  branches = await get_branches(repo_dir, log_method=ctx.print)
94
+ ctx.print(stylize_faint("Get current branch"))
91
95
  current_branch = await get_current_branch(repo_dir, log_method=ctx.print)
92
96
  for branch in branches:
93
97
  if branch == current_branch or branch == "main" or branch == "master":
@@ -112,6 +116,7 @@ async def prune_local_branches(ctx: AnyContext):
112
116
  alias="commit",
113
117
  )
114
118
  async def git_commit(ctx: AnyContext):
119
+ ctx.print(stylize_faint("Get directory"))
115
120
  repo_dir = await get_repo_dir(log_method=ctx.print)
116
121
  ctx.print(stylize_faint("Add changes to staging"))
117
122
  await add(repo_dir, log_method=ctx.print)
@@ -133,9 +138,11 @@ async def git_commit(ctx: AnyContext):
133
138
  alias="pull",
134
139
  )
135
140
  async def git_pull(ctx: AnyContext):
141
+ ctx.print(stylize_faint("Get directory"))
136
142
  repo_dir = await get_repo_dir(log_method=ctx.print)
137
- remote = ctx.input.remote
143
+ ctx.print(stylize_faint("Get current branch"))
138
144
  current_branch = await get_current_branch(repo_dir, log_method=ctx.print)
145
+ remote = ctx.input.remote
139
146
  ctx.print(stylize_faint(f"Pulling from {remote}/{current_branch}"))
140
147
  await pull(repo_dir, remote, current_branch, log_method=ctx.print)
141
148
 
@@ -155,7 +162,8 @@ async def git_pull(ctx: AnyContext):
155
162
  )
156
163
  async def git_push(ctx: AnyContext):
157
164
  repo_dir = await get_repo_dir(log_method=ctx.print)
158
- remote = ctx.input.remote
165
+ ctx.print(stylize_faint("Get current branch"))
159
166
  current_branch = await get_current_branch(repo_dir, log_method=ctx.print)
167
+ remote = ctx.input.remote
160
168
  ctx.print(stylize_faint(f"Pushing to {remote}/{current_branch}"))
161
169
  await push(repo_dir, remote, current_branch, log_method=ctx.print)
@@ -34,7 +34,9 @@ from zrb.util.git_subtree import add_subtree, load_config, pull_subtree, push_su
34
34
  alias="add",
35
35
  )
36
36
  async def git_add_subtree(ctx: AnyContext):
37
+ ctx.print(stylize_faint("Get directory"))
37
38
  repo_dir = await get_repo_dir(log_method=ctx.print)
39
+ ctx.print(stylize_faint("Add subtree"))
38
40
  await add_subtree(
39
41
  repo_dir=repo_dir,
40
42
  name=ctx.input.name,
@@ -53,6 +55,7 @@ async def git_add_subtree(ctx: AnyContext):
53
55
  alias="pull",
54
56
  )
55
57
  async def git_pull_subtree(ctx: AnyContext):
58
+ ctx.print(stylize_faint("Get directory"))
56
59
  repo_dir = await get_repo_dir(log_method=ctx.print)
57
60
  config = load_config(repo_dir)
58
61
  if not config.data:
@@ -84,6 +87,7 @@ async def git_pull_subtree(ctx: AnyContext):
84
87
  alias="push",
85
88
  )
86
89
  async def git_push_subtree(ctx: AnyContext):
90
+ ctx.print(stylize_faint("Get directory"))
87
91
  repo_dir = await get_repo_dir(log_method=ctx.print)
88
92
  config = load_config(repo_dir)
89
93
  if not config.data:
@@ -12,6 +12,7 @@ from zrb.config import (
12
12
  RAG_OVERLAP,
13
13
  )
14
14
  from zrb.util.cli.style import stylize_error, stylize_faint
15
+ from zrb.util.file import read_file
15
16
  from zrb.util.run import run_async
16
17
 
17
18
  Document = str | Callable[[], str]
@@ -137,8 +138,7 @@ def get_rag_documents(document_dir_path: str) -> Callable[[], list[Callable[[],
137
138
  def _get_text_reader(file_path: str):
138
139
  def read():
139
140
  print(stylize_faint(f"Start reading {file_path}"), file=sys.stderr)
140
- with open(file_path, "r", encoding="utf-8") as f:
141
- content = f.read()
141
+ content = read_file(file_path)
142
142
  print(stylize_faint(f"Complete reading {file_path}"), file=sys.stderr)
143
143
  return content
144
144
 
@@ -0,0 +1,16 @@
1
+ import os
2
+
3
+ from zrb.input.str_input import StrInput
4
+
5
+ project_dir_input = StrInput(
6
+ name="project-dir",
7
+ description="Project directory",
8
+ prompt="Project directory",
9
+ default_str=lambda _: os.getcwd(),
10
+ )
11
+
12
+ app_name_input = StrInput(
13
+ name="app",
14
+ description="App name",
15
+ prompt="App name",
16
+ )
@@ -0,0 +1,78 @@
1
+ import os
2
+
3
+ from zrb.builtin.group import add_to_project_group
4
+ from zrb.builtin.project.add.fastapp.fastapp_input import (
5
+ app_name_input,
6
+ project_dir_input,
7
+ )
8
+ from zrb.builtin.project.add.fastapp.fastapp_util import (
9
+ is_in_project_app_dir,
10
+ is_project_zrb_init_file,
11
+ update_project_zrb_init_file,
12
+ )
13
+ from zrb.content_transformer.content_transformer import ContentTransformer
14
+ from zrb.context.any_context import AnyContext
15
+ from zrb.task.make_task import make_task
16
+ from zrb.task.scaffolder import Scaffolder
17
+ from zrb.task.task import Task
18
+ from zrb.util.string.conversion import to_snake_case
19
+ from zrb.util.string.name import get_random_name
20
+
21
+
22
+ @make_task(
23
+ name="validate-create-fastapp",
24
+ input=[project_dir_input, app_name_input],
25
+ retries=0,
26
+ )
27
+ async def validate_create_fastapp(ctx: AnyContext):
28
+ project_dir = ctx.input.project_dir
29
+ if not os.path.isdir(project_dir):
30
+ raise ValueError(f"Project directory not exists: {project_dir}")
31
+ app_dir = os.path.join(project_dir, to_snake_case(ctx.input.app))
32
+ if os.path.exists(app_dir):
33
+ raise ValueError(f"Application directory already exists: {app_dir}")
34
+
35
+
36
+ scaffold_fastapp = Scaffolder(
37
+ name="scaffold-fastapp",
38
+ input=[
39
+ project_dir_input,
40
+ app_name_input,
41
+ ],
42
+ upstream=validate_create_fastapp,
43
+ source_path=os.path.join(os.path.dirname(__file__), "fastapp_template"),
44
+ render_source_path=False,
45
+ destination_path="{ctx.input.project_dir}",
46
+ transform_path={
47
+ "my_app_name": "{to_snake_case(ctx.input.app)}",
48
+ },
49
+ transform_content=[
50
+ # Common transformation (project_dir/app_dir/**/*)
51
+ ContentTransformer(
52
+ match=is_in_project_app_dir,
53
+ transform={
54
+ "My App Name": "{ctx.input.app.title()}",
55
+ "my-app-name": "{to_kebab_case(ctx.input.app)}",
56
+ "my_app_name": "{to_snake_case(ctx.input.app)}",
57
+ "MY_APP_NAME": "{to_snake_case(ctx.input.app).upper()}",
58
+ "my-secure-password": lambda _: get_random_name(),
59
+ },
60
+ ),
61
+ # Register fastapp's tasks to project's zrb_init (project_dir/zrb_init.py)
62
+ ContentTransformer(
63
+ match=is_project_zrb_init_file,
64
+ transform=update_project_zrb_init_file,
65
+ ),
66
+ ],
67
+ retries=0,
68
+ )
69
+
70
+ add_fastapp_to_project = add_to_project_group.add_task(
71
+ Task(
72
+ name="add-fastapp",
73
+ description="🚀 Add FastApp to project",
74
+ upstream=scaffold_fastapp,
75
+ retries=0,
76
+ ),
77
+ alias="fastapp",
78
+ )
@@ -0,0 +1,3 @@
1
+ [flake8]
2
+ max-line-length = 95
3
+ extend-ignore = E203, E704
@@ -0,0 +1,14 @@
1
+ from my_app_name._zrb.format_task import format_my_app_name_code
2
+ from my_app_name._zrb.group import app_create_group
3
+
4
+ from zrb import Task
5
+
6
+ add_my_app_name_column = app_create_group.add_task(
7
+ Task(
8
+ name="add-my-app-name-column",
9
+ description="📊 Create new column on an entity",
10
+ successor=format_my_app_name_code,
11
+ retries=0,
12
+ ),
13
+ alias="column",
14
+ )
@@ -0,0 +1,128 @@
1
+ import os
2
+
3
+ from my_app_name._zrb.config import APP_DIR
4
+ from my_app_name._zrb.entity.add_entity_util import (
5
+ is_in_app_schema_dir,
6
+ is_in_module_entity_dir,
7
+ is_module_any_client_file,
8
+ is_module_api_client_file,
9
+ is_module_direct_client_file,
10
+ is_module_migration_metadata_file,
11
+ is_module_route_file,
12
+ update_any_client,
13
+ update_api_client,
14
+ update_direct_client,
15
+ update_migration_metadata,
16
+ update_route,
17
+ )
18
+ from my_app_name._zrb.format_task import format_my_app_name_code
19
+ from my_app_name._zrb.group import app_create_group
20
+ from my_app_name._zrb.input import (
21
+ existing_module_input,
22
+ new_entity_column_input,
23
+ new_entity_input,
24
+ plural_entity_input,
25
+ )
26
+ from my_app_name._zrb.util import get_existing_module_names, get_existing_schema_names
27
+
28
+ from zrb import AnyContext, ContentTransformer, Scaffolder, Task, make_task
29
+ from zrb.util.string.conversion import to_snake_case
30
+
31
+
32
+ @make_task(
33
+ name="validate-create-my-app-name-entity",
34
+ input=[
35
+ existing_module_input,
36
+ new_entity_input,
37
+ plural_entity_input,
38
+ new_entity_column_input,
39
+ ],
40
+ retries=0,
41
+ )
42
+ async def validate_create_my_app_name_entity(ctx: AnyContext):
43
+ module_name = to_snake_case(ctx.input.module)
44
+ if module_name not in get_existing_module_names():
45
+ raise ValueError(f"Module not exist: {module_name}")
46
+ schema_name = to_snake_case(ctx.input.entity)
47
+ if schema_name in get_existing_schema_names():
48
+ raise ValueError(f"Schema already exists: {schema_name}")
49
+
50
+
51
+ scaffold_my_app_name_entity = Scaffolder(
52
+ name="scaffold-my-app-name-entity",
53
+ input=[
54
+ existing_module_input,
55
+ new_entity_input,
56
+ plural_entity_input,
57
+ new_entity_column_input,
58
+ ],
59
+ source_path=os.path.join(os.path.dirname(__file__), "template", "app_template"),
60
+ render_source_path=False,
61
+ destination_path=APP_DIR,
62
+ transform_path={
63
+ "my_module": "{to_snake_case(ctx.input.module)}",
64
+ "my_entity": "{to_snake_case(ctx.input.entity)}",
65
+ },
66
+ transform_content=[
67
+ # Schema tranformation (my_app_name/schema/snake_entity_name)
68
+ ContentTransformer(
69
+ match=is_in_app_schema_dir,
70
+ transform={
71
+ "MyEntity": "{to_pascal_case(ctx.input.entity)}",
72
+ "my_column": "{to_snake_case(ctx.input.column)}",
73
+ },
74
+ ),
75
+ # Common module's entity transformation
76
+ # (my_app_name/module/snake_module_name/service/snake_entity_name)
77
+ ContentTransformer(
78
+ match=is_in_module_entity_dir,
79
+ transform={
80
+ "my_module": "{to_snake_case(ctx.input.module)}",
81
+ "MyEntity": "{to_pascal_case(ctx.input.entity)}",
82
+ "my_entity": "{to_snake_case(ctx.input.entity)}",
83
+ "my_entities": "{to_snake_case(ctx.input.plural)}",
84
+ "my-entities": "{to_kebab_case(ctx.input.plural)}",
85
+ },
86
+ ),
87
+ # Add entity to migration metadata
88
+ # (my_app_name/module/snake_module_name/migration_metadata.py)
89
+ ContentTransformer(
90
+ match=is_module_migration_metadata_file,
91
+ transform=update_migration_metadata,
92
+ ),
93
+ # Update API Client (my_app_name/module/snake_module_name/client/api_client.py)
94
+ ContentTransformer(
95
+ match=is_module_api_client_file,
96
+ transform=update_api_client,
97
+ ),
98
+ # Update Direct Client (my_app_name/module/snake_module_name/client/direct_client.py)
99
+ ContentTransformer(
100
+ match=is_module_direct_client_file,
101
+ transform=update_direct_client,
102
+ ),
103
+ # Update Any Client (my_app_name/module/snake_module_name/client/any_client.py)
104
+ ContentTransformer(
105
+ match=is_module_any_client_file,
106
+ transform=update_any_client,
107
+ ),
108
+ # Update module route (my_app_name/module/route.py)
109
+ ContentTransformer(
110
+ match=is_module_route_file,
111
+ transform=update_route,
112
+ ),
113
+ # TODO: Register gateway route
114
+ ],
115
+ retries=0,
116
+ upstream=validate_create_my_app_name_entity,
117
+ )
118
+
119
+ add_my_app_name_entity = app_create_group.add_task(
120
+ Task(
121
+ name="add-my-app-name-entity",
122
+ description="🏗️ Create new entity on a module",
123
+ upstream=scaffold_my_app_name_entity,
124
+ successor=format_my_app_name_code,
125
+ retries=0,
126
+ ),
127
+ alias="entity",
128
+ )
@@ -0,0 +1,213 @@
1
+ import os
2
+
3
+ from my_app_name._zrb.config import APP_DIR
4
+
5
+ from zrb.context.any_context import AnyContext
6
+ from zrb.util.codemod.append_code_to_class import append_code_to_class
7
+ from zrb.util.codemod.append_code_to_function import append_code_to_function
8
+ from zrb.util.codemod.prepend_code_to_module import prepend_code_to_module
9
+ from zrb.util.codemod.prepend_parent_to_class import prepend_parent_class
10
+ from zrb.util.file import read_file, write_file
11
+ from zrb.util.string.conversion import to_pascal_case, to_snake_case
12
+
13
+
14
+ def is_in_app_schema_dir(ctx: AnyContext, file_path: str) -> bool:
15
+ return file_path.startswith(
16
+ os.path.join(APP_DIR, "schema", to_snake_case(ctx.input.entity))
17
+ )
18
+
19
+
20
+ def is_in_module_entity_dir(ctx: AnyContext, file_path: str) -> bool:
21
+ return file_path.startswith(
22
+ os.path.join(
23
+ APP_DIR,
24
+ "module",
25
+ to_snake_case(ctx.input.module),
26
+ "service",
27
+ to_snake_case(ctx.input.entity),
28
+ )
29
+ )
30
+
31
+
32
+ def is_module_route_file(ctx: AnyContext, file_path: str) -> bool:
33
+ module_route_file = os.path.join(
34
+ APP_DIR,
35
+ "module",
36
+ to_snake_case(ctx.input.module),
37
+ "route.py",
38
+ )
39
+ return file_path == module_route_file
40
+
41
+
42
+ def is_module_migration_metadata_file(ctx: AnyContext, file_path: str) -> bool:
43
+ module_migration_metadata_file = os.path.join(
44
+ APP_DIR,
45
+ "module",
46
+ to_snake_case(ctx.input.module),
47
+ "migration_metadata.py",
48
+ )
49
+ return file_path == module_migration_metadata_file
50
+
51
+
52
+ def is_module_any_client_file(ctx: AnyContext, file_path: str) -> bool:
53
+ module_any_client_file = os.path.join(
54
+ APP_DIR,
55
+ "module",
56
+ to_snake_case(ctx.input.module),
57
+ "client",
58
+ "any_client.py",
59
+ )
60
+ return file_path == module_any_client_file
61
+
62
+
63
+ def is_module_api_client_file(ctx: AnyContext, file_path: str) -> bool:
64
+ module_api_client_file = os.path.join(
65
+ APP_DIR,
66
+ "module",
67
+ to_snake_case(ctx.input.module),
68
+ "client",
69
+ "api_client.py",
70
+ )
71
+ return file_path == module_api_client_file
72
+
73
+
74
+ def is_module_direct_client_file(ctx: AnyContext, file_path: str) -> bool:
75
+ module_direct_client_file = os.path.join(
76
+ APP_DIR,
77
+ "module",
78
+ to_snake_case(ctx.input.module),
79
+ "client",
80
+ "direct_client.py",
81
+ )
82
+ return file_path == module_direct_client_file
83
+
84
+
85
+ def update_migration_metadata(ctx: AnyContext, migration_metadata_file_path: str):
86
+ app_name = os.path.basename(APP_DIR)
87
+ existing_migration_metadata_code = read_file(migration_metadata_file_path)
88
+ write_file(
89
+ file_path=migration_metadata_file_path,
90
+ content=[
91
+ _get_import_schema_code(
92
+ existing_migration_metadata_code, app_name, ctx.input.entity
93
+ ),
94
+ existing_migration_metadata_code.strip(),
95
+ _get_entity_metadata_assignment_code(
96
+ existing_migration_metadata_code, ctx.input.entity
97
+ ),
98
+ ],
99
+ )
100
+
101
+
102
+ def _get_import_schema_code(
103
+ existing_code: str, app_name: str, entity_name: str
104
+ ) -> str | None:
105
+ snake_entity_name = to_snake_case(entity_name)
106
+ pascal_entity_name = to_pascal_case(entity_name)
107
+ import_module_path = f"{app_name}.schema.{snake_entity_name}"
108
+ import_schema_code = f"from {import_module_path} import {pascal_entity_name}"
109
+ if import_schema_code in existing_code:
110
+ return None
111
+ return import_schema_code
112
+
113
+
114
+ def _get_entity_metadata_assignment_code(
115
+ existing_code: str, entity_name: str
116
+ ) -> str | None:
117
+ pascal_entity_name = to_pascal_case(entity_name)
118
+ entity_metadata_assignment_code = "\n".join(
119
+ [
120
+ f"{pascal_entity_name}.metadata = metadata",
121
+ f"{pascal_entity_name}.__table__.tometadata(metadata)",
122
+ ]
123
+ )
124
+ if entity_metadata_assignment_code in existing_code:
125
+ return None
126
+ return entity_metadata_assignment_code
127
+
128
+
129
+ def update_any_client(ctx: AnyContext, any_client_file_path: str):
130
+ existing_any_client_code = read_file(any_client_file_path)
131
+ app_name = os.path.basename(APP_DIR)
132
+ snake_entity_name = to_snake_case(ctx.input.entity)
133
+ snake_plural_entity_name = to_snake_case(ctx.input.plural)
134
+ pascal_entity_name = to_pascal_case(ctx.input.entity)
135
+ any_client_method = read_file(
136
+ file_path=os.path.join(
137
+ os.path.dirname(__file__), "template", "any_client_method.py"
138
+ ),
139
+ replace_map={
140
+ "my_entity": snake_entity_name,
141
+ "my_entities": snake_plural_entity_name,
142
+ "MyEntity": pascal_entity_name,
143
+ },
144
+ )
145
+ new_code = append_code_to_class(
146
+ existing_any_client_code, "AnyClient", any_client_method
147
+ )
148
+ write_file(
149
+ file_path=any_client_file_path,
150
+ content=[
151
+ f"from {app_name}.schema.{snake_entity_name}.{snake_entity_name} import (",
152
+ f" {pascal_entity_name}CreateWithAudit, {pascal_entity_name}Response, {pascal_entity_name}UpdateWithAudit", # noqa
153
+ ")",
154
+ new_code.strip(),
155
+ ],
156
+ )
157
+
158
+
159
+ def update_api_client(ctx: AnyContext, api_client_file_path: str):
160
+ existing_api_client_code = read_file(api_client_file_path)
161
+ upper_snake_module_name = to_snake_case(ctx.input.module).upper()
162
+ app_name = os.path.basename(APP_DIR)
163
+ snake_entity_name = to_snake_case(ctx.input.entity)
164
+ snake_module_name = to_snake_case(ctx.input.module)
165
+ write_file(
166
+ file_path=api_client_file_path,
167
+ content=[
168
+ f"from {app_name}.module.{snake_module_name}.service.{snake_entity_name}.{snake_entity_name}_usecase import {snake_entity_name}_usecase", # noqa
169
+ prepend_code_to_module(
170
+ prepend_parent_class(
171
+ existing_api_client_code, "APIClient", "user_api_client"
172
+ ),
173
+ f"user_api_client = user_usecase.as_api_client(base_url=APP_{upper_snake_module_name}_BASE_URL)", # noqa
174
+ ),
175
+ ],
176
+ )
177
+
178
+
179
+ def update_direct_client(ctx: AnyContext, direct_client_file_path: str):
180
+ existing_direct_client_code = read_file(direct_client_file_path)
181
+ app_name = os.path.basename(APP_DIR)
182
+ snake_entity_name = to_snake_case(ctx.input.entity)
183
+ snake_module_name = to_snake_case(ctx.input.module)
184
+ write_file(
185
+ file_path=direct_client_file_path,
186
+ content=[
187
+ f"from {app_name}.module.{snake_module_name}.service.{snake_entity_name}.{snake_entity_name}_usecase import {snake_entity_name}_usecase", # noqa
188
+ prepend_code_to_module(
189
+ prepend_parent_class(
190
+ existing_direct_client_code, "DirectClient", "user_direct_client"
191
+ ),
192
+ "user_direct_client = user_usecase.as_direct_client()",
193
+ ).strip(),
194
+ ],
195
+ )
196
+
197
+
198
+ def update_route(ctx: AnyContext, route_file_path: str):
199
+ existing_route_code = read_file(route_file_path)
200
+ entity_name = to_snake_case(ctx.input.entity)
201
+ app_name = os.path.basename(APP_DIR)
202
+ module_name = to_snake_case(ctx.input.module)
203
+ write_file(
204
+ file_path=route_file_path,
205
+ content=[
206
+ f"from {app_name}.module.{module_name}.service.{entity_name}.{entity_name}_usecase import {entity_name}_usecase", # noqa
207
+ append_code_to_function(
208
+ existing_route_code,
209
+ "serve_route",
210
+ f"{entity_name}_usecase.serve_route(app)",
211
+ ),
212
+ ],
213
+ )
@@ -0,0 +1,27 @@
1
+ @abstractmethod
2
+ async def get_my_entity_by_id(self, my_entity_id: str) -> MyEntityResponse:
3
+ pass
4
+
5
+
6
+ @abstractmethod
7
+ async def get_all_my_entities(self) -> list[MyEntityResponse]:
8
+ pass
9
+
10
+
11
+ @abstractmethod
12
+ async def create_my_entity(
13
+ self, data: MyEntityCreateWithAudit | list[MyEntityCreateWithAudit]
14
+ ) -> MyEntityResponse | list[MyEntityResponse]:
15
+ pass
16
+
17
+
18
+ @abstractmethod
19
+ async def update_my_entity(
20
+ self, my_entity_id: str, data: MyEntityUpdateWithAudit
21
+ ) -> MyEntityResponse:
22
+ pass
23
+
24
+
25
+ @abstractmethod
26
+ async def delete_my_entity(self, my_entity_id: str) -> MyEntityResponse:
27
+ pass
@@ -1,19 +1,18 @@
1
- from fastapp_template.common.base_usecase import BaseUsecase
2
- from fastapp_template.module.my_module.service.my_entity.repository.factory import (
1
+ from my_app_name.common.base_usecase import BaseUsecase
2
+ from my_app_name.module.my_module.service.my_entity.repository.factory import (
3
3
  my_entity_repository,
4
4
  )
5
- from fastapp_template.module.my_module.service.my_entity.repository.repository import (
5
+ from my_app_name.module.my_module.service.my_entity.repository.my_entity_repository import (
6
6
  MyEntityRepository,
7
7
  )
8
- from fastapp_template.schema.my_entity import (
9
- MyEntityCreate,
8
+ from my_app_name.schema.my_entity import (
9
+ MyEntityCreateWithAudit,
10
10
  MyEntityResponse,
11
- MyEntityUpdate,
11
+ MyEntityUpdateWithAudit,
12
12
  )
13
13
 
14
14
 
15
15
  class MyEntityUsecase(BaseUsecase):
16
-
17
16
  def __init__(self, my_entity_repository: MyEntityRepository):
18
17
  super().__init__()
19
18
  self.my_entity_repository = my_entity_repository
@@ -38,9 +37,9 @@ class MyEntityUsecase(BaseUsecase):
38
37
  response_model=MyEntityResponse | list[MyEntityResponse],
39
38
  )
40
39
  async def create_my_entity(
41
- self, data: MyEntityCreate | list[MyEntityCreate]
40
+ self, data: MyEntityCreateWithAudit | list[MyEntityCreateWithAudit]
42
41
  ) -> MyEntityResponse | list[MyEntityResponse]:
43
- if isinstance(data, MyEntityCreate):
42
+ if isinstance(data, MyEntityCreateWithAudit):
44
43
  return await self.my_entity_repository.create(data)
45
44
  return await self.my_entity_repository.create_bulk(data)
46
45
 
@@ -50,7 +49,7 @@ class MyEntityUsecase(BaseUsecase):
50
49
  response_model=MyEntityResponse,
51
50
  )
52
51
  async def update_my_entity(
53
- self, my_entity_id: str, data: MyEntityUpdate
52
+ self, my_entity_id: str, data: MyEntityUpdateWithAudit
54
53
  ) -> MyEntityResponse:
55
54
  return await self.my_entity_repository.update(my_entity_id, data)
56
55