ApiLogicServer 15.0.52__py3-none-any.whl → 15.0.55__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 (34) hide show
  1. api_logic_server_cli/api_logic_server.py +6 -3
  2. api_logic_server_cli/api_logic_server_info.yaml +3 -3
  3. api_logic_server_cli/create_from_model/api_logic_server_utils.py +9 -0
  4. api_logic_server_cli/prototypes/base/.github/.copilot-instructions.md +49 -21
  5. api_logic_server_cli/prototypes/base/database/alembic/alembic_run.py +98 -0
  6. api_logic_server_cli/prototypes/base/database/alembic/readme_alembic.md +36 -0
  7. api_logic_server_cli/prototypes/base/docs/training/admin_app_1_context.prompt.md +40 -0
  8. api_logic_server_cli/prototypes/base/integration/mcp/mcp_client_executor.py +4 -4
  9. api_logic_server_cli/prototypes/base/readme.md +11 -13
  10. api_logic_server_cli/prototypes/base/security/readme_security.md +0 -1
  11. api_logic_server_cli/prototypes/basic_demo/README.md +267 -272
  12. api_logic_server_cli/prototypes/basic_demo/_config.yml +8 -0
  13. api_logic_server_cli/prototypes/basic_demo/_layouts/redirect.html +15 -0
  14. api_logic_server_cli/prototypes/basic_demo/docs/system-creation-vibe.md +158 -0
  15. api_logic_server_cli/prototypes/basic_demo/logic/declarative-vs-procedural-comparison.html +110 -0
  16. api_logic_server_cli/prototypes/basic_demo/logic/procedural/declarative-vs-procedural-comparison.md +295 -0
  17. api_logic_server_cli/prototypes/manager/samples/prompts/add_email.prompt +8 -0
  18. api_logic_server_cli/prototypes/manager/samples/prompts/elections.prompt +3 -0
  19. api_logic_server_cli/prototypes/manager/samples/prompts/emp_dept.prompt +4 -0
  20. api_logic_server_cli/prototypes/manager/samples/prompts/genai_demo.prompt +13 -0
  21. api_logic_server_cli/prototypes/manager/samples/readme_samples.md +3 -1
  22. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md +1 -1
  23. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package.json +1 -0
  24. api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen_wrapper.py +5 -2
  25. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/METADATA +1 -1
  26. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/RECORD +30 -23
  27. api_logic_server_cli/prototypes/base/.devcontainer-option/.copilot-instructions.md +0 -178
  28. api_logic_server_cli/prototypes/base/database/alembic/readme.md +0 -18
  29. api_logic_server_cli/prototypes/base/database/system/SAFRSBaseX.pyZ +0 -73
  30. api_logic_server_cli/prototypes/basic_demo/customizations/database/system/SAFRSBaseX.py +0 -139
  31. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/WHEEL +0 -0
  32. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/entry_points.txt +0 -0
  33. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/licenses/LICENSE +0 -0
  34. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  api_logic_server_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- api_logic_server_cli/api_logic_server.py,sha256=DkV0lF4pCGdzo44FqWQgmZtdqDLfYVWi0eT-YgUNxi8,103160
3
- api_logic_server_cli/api_logic_server_info.yaml,sha256=Go3ZAGnYcvMBPWknZnL7exUZ8ovThTd7AwQvz0NbagI,125
2
+ api_logic_server_cli/api_logic_server.py,sha256=bvJalrJd3kvbg2Wo5mGyaE9XI2ZuePaAZ3YNDULo3P8,103516
3
+ api_logic_server_cli/api_logic_server_info.yaml,sha256=5VlTp5Iv_b3mQxAzTHdNWGpGeeI8Q37-wRRN5y20rrw,128
4
4
  api_logic_server_cli/cli.py,sha256=gd_uHrUanp705EryYAdkY5D9LJJvvSEHUwoylm-G6sw,87355
5
5
  api_logic_server_cli/cli_args_base.py,sha256=7cVM6BeizwttYAwUu1FUyuLuvWufvgt0TFeA8FI6tu0,3304
6
6
  api_logic_server_cli/cli_args_project.py,sha256=I5no_fGRV_ZsK3SuttVDAaQYI4Q5zCjx6LojGkM024w,4645
@@ -11,7 +11,7 @@ api_logic_server_cli/add_cust/add_cust.py,sha256=yi_6qoiBm19K1u5VNhDW-KaTVcnsU-u
11
11
  api_logic_server_cli/create_from_model/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
12
12
  api_logic_server_cli/create_from_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  api_logic_server_cli/create_from_model/api_expose_api_models_creator.py,sha256=V-u3Hm404doztw66YuD2A043RCFmtw5QF5tMioC_1b0,7900
14
- api_logic_server_cli/create_from_model/api_logic_server_utils.py,sha256=gk2Zp4w2FvHV-ETvyu7QIkqNa19VNI9sroHY_w1qAJs,28051
14
+ api_logic_server_cli/create_from_model/api_logic_server_utils.py,sha256=H0t_hpN6TGzhe9CAzkonX3dUvZ2k9qeemKHexoXtIQI,28624
15
15
  api_logic_server_cli/create_from_model/create_db_from_model.py,sha256=2H7slGnk39XOSnvL7vxrg6Ewx4bxeBJBgLo8fcXHTB4,4382
16
16
  api_logic_server_cli/create_from_model/dbml.py,sha256=m1yRnes5DXPMQrFBFJM2CuDhIfVFywSM6nDX7k19BLU,11573
17
17
  api_logic_server_cli/create_from_model/meta_model.py,sha256=ERf7tSgnSJSeRMVyggkdg-lvORQZSbfK0KMpL63qSEY,5837
@@ -508,16 +508,15 @@ api_logic_server_cli/prototypes/base/.DS_Store,sha256=wKX7g_yII-CHA_BuKAVYXwglzg
508
508
  api_logic_server_cli/prototypes/base/.gitignore,sha256=PAO98cVvjgAL_mvXCMS_Vfk7bT2Vd1-j9a8_nB2qxqs,190
509
509
  api_logic_server_cli/prototypes/base/README_PROJECT.md,sha256=sGJuNF_Qt5ripZBXfTi0OmoV4fUxe7ySxrqcKs7DwOk,1186
510
510
  api_logic_server_cli/prototypes/base/api_logic_server_run.py,sha256=j4a0jwPn-USqkFrCiFI34TcCTHxNOnPAW-IwMtFGWcw,7074
511
- api_logic_server_cli/prototypes/base/readme.md,sha256=4s79kGFav2k8VniRlHN0rQ7gJt2zCpDim-c6jTm5kHE,13037
511
+ api_logic_server_cli/prototypes/base/readme.md,sha256=sh6S1RQbTNDssRK_EsLt_KRWRMTBJ7QxsCTMoLaAmzY,12672
512
512
  api_logic_server_cli/prototypes/base/requirements.txt,sha256=we6X5fRBJVqN8SacwV7oPDtGk5IAiNbUDbUwCGHkCrc,107
513
513
  api_logic_server_cli/prototypes/base/run.ps1,sha256=lrZgw8SEntPam3ZYKVzsRo7rOKSGWqgO7qUNJ3CbP44,801
514
514
  api_logic_server_cli/prototypes/base/run.sh,sha256=7kJc-FpK9iqtt9BDXR1XogWXfVDnmPS8kS5fXk2Q5Dk,1442
515
- api_logic_server_cli/prototypes/base/.devcontainer-option/.copilot-instructions.md,sha256=-FIIWe5PkSubaGzDtCCg0N7M1J-g7Bk6D5ct_jaY_iM,5264
516
515
  api_logic_server_cli/prototypes/base/.devcontainer-option/For_VSCode.dockerfile,sha256=_RObRZ3EBDNj1_Sx26r_CysBboMvill83f8tQN1T0Do,438
517
516
  api_logic_server_cli/prototypes/base/.devcontainer-option/devcontainer.json,sha256=tk-mGd4XdmbpKUqUeGmcPMzX3RDc6am9-de8c-rFmSo,2361
518
517
  api_logic_server_cli/prototypes/base/.devcontainer-option/readme.md,sha256=-sSneMDne1fqEoox2hXUGmoO8ewgi34y7lJwGTidSpY,104
519
518
  api_logic_server_cli/prototypes/base/.devcontainer-option/setup.sh,sha256=pOvGjZ7jgRQzFkD93mNICmcC2y66Dexrq4bCnSSVwtU,310
520
- api_logic_server_cli/prototypes/base/.github/.copilot-instructions.md,sha256=ee0kajWWr0uQl4-YeHvs2D3zwDR-c4ZTCTqlGjN7h6k,8653
519
+ api_logic_server_cli/prototypes/base/.github/.copilot-instructions.md,sha256=JUmoR882ev41blkiooshu__iFWgeT6DX6KCf62B69KU,10280
521
520
  api_logic_server_cli/prototypes/base/.idea/runConfigurations/ApiLogicServer.xml,sha256=eFzhe9NH-VNjcPWbPsRQy5o-MugJR9IWklA1Fo8wtYg,1127
522
521
  api_logic_server_cli/prototypes/base/.idea/runConfigurations/Report_Behave_Logic.xml,sha256=I3jlEf-TPzc-1NY843v6AcQIQ8QJD3z9KvxTYSZWMtY,1306
523
522
  api_logic_server_cli/prototypes/base/.idea/runConfigurations/Run_Behave.xml,sha256=CTzF0P4w7o4FzOi-eSpru0HczSEGtJsKqkQ7VWRyxPc,1196
@@ -557,15 +556,15 @@ api_logic_server_cli/prototypes/base/database/alembic.ini,sha256=N-xPrNv1gfMB8yl
557
556
  api_logic_server_cli/prototypes/base/database/authentication_db.sqlite,sha256=hA71uBnrh2PVQw9YLc-YbsXjpxr2VyvfE-OhF_ssE6w,45056
558
557
  api_logic_server_cli/prototypes/base/database/bind_dbs.py,sha256=az3hFwWaphhCdU3siPQQa77pBdXgUJR6juMDiYLrC1Y,757
559
558
  api_logic_server_cli/prototypes/base/database/customize_models.py,sha256=U5cTWtLS0UlR7_js6D7O2JVgeMtG7IqlkSL9Ok6g_kU,580
559
+ api_logic_server_cli/prototypes/base/database/alembic/alembic_run.py,sha256=DuR80K7Y_uWAE60QyP3msfMRT5bPbvP0sBVyFG66H-s,3610
560
560
  api_logic_server_cli/prototypes/base/database/alembic/env.py,sha256=YIrFy7lQYTdTU0-4g7mbtK6kKZp0uKQED_ScpE7lzzc,2101
561
- api_logic_server_cli/prototypes/base/database/alembic/readme.md,sha256=Quaj63-4i2qHRD0MXTb-exeE7zWIb9bHICQE_Nth0v0,775
561
+ api_logic_server_cli/prototypes/base/database/alembic/readme_alembic.md,sha256=KDo2W4v_h8VevyEBEhKXHzYTtKSUFrPOJPbPRHsXTJw,1066
562
562
  api_logic_server_cli/prototypes/base/database/alembic/script.py.mako,sha256=8_xgA-gm_OhehnO7CiIijWgnm00ZlszEHtIHrAYFJl0,494
563
563
  api_logic_server_cli/prototypes/base/database/alembic/versions/readme.md,sha256=KPGsjRrwctUldo7i4P7qIZyPDPWeV9hiBPLgc5bLizo,60
564
564
  api_logic_server_cli/prototypes/base/database/database_discovery/authentication_models.py,sha256=8IGpWyNzr3BavktFP85gtsWcorTznR2DFeQb-9yCLZ4,6772
565
565
  api_logic_server_cli/prototypes/base/database/database_discovery/auto_discovery.py,sha256=m-LFznTdM581n7xkisamzHIQZ3fEiY9RPKd4wzB6wYo,978
566
566
  api_logic_server_cli/prototypes/base/database/db_debug/db_debug.py,sha256=ctcwksnM89597LUAme5Sn044r-xgRh47wSSe3MioPH4,3259
567
567
  api_logic_server_cli/prototypes/base/database/system/SAFRSBaseX.py,sha256=VeiUgXr9pkgvxchCf89lhRKNBlfj4_FYwAweu3NWj-M,5394
568
- api_logic_server_cli/prototypes/base/database/system/SAFRSBaseX.pyZ,sha256=p8C7AF9r9a_oeO1GcltUqR6YSTbcevbWVm3vhfTT1h0,2540
569
568
  api_logic_server_cli/prototypes/base/database/test_data/alp_init.py,sha256=C7yqHB7KoOgwvzRsI3DVk9O_QHPu4SYioChv0Jz5xXY,1203
570
569
  api_logic_server_cli/prototypes/base/database/test_data/readme.md,sha256=IDKVMagnjobf5IigYCkQkUMM_iLvBdhK9grMNImSOKg,694
571
570
  api_logic_server_cli/prototypes/base/database/test_data/response2code.py,sha256=PTeAXHU-r6r0EBknSGXnbkdySAAzch_3gOuRlyUyVF8,4414
@@ -620,7 +619,7 @@ api_logic_server_cli/prototypes/base/devops/python-anywhere/python_anywhere_wsgi
620
619
  api_logic_server_cli/prototypes/base/docs/graphics/readme.md,sha256=GaNOkrzT_nlcrIpmmwLQtoGC6aPZnM8bSGgmc5fM8yk,402
621
620
  api_logic_server_cli/prototypes/base/docs/logic/readme.md,sha256=fIQypEQ7Ny7q385AhpwndYRBFquG6P6xpM41-zrIseE,871
622
621
  api_logic_server_cli/prototypes/base/docs/logic_suggestions/readme_logic_suggestions.md,sha256=44ibQYGOy84J4zGFaChLCOf-GU9pOBrbgBbprujMtIs,184
623
- api_logic_server_cli/prototypes/base/docs/training/admin_app_1_context.prompt.md,sha256=Vbo9pidg0FFkVEx64Ri8tjTCvg3noLopcDj3mgPVeSY,239
622
+ api_logic_server_cli/prototypes/base/docs/training/admin_app_1_context.prompt.md,sha256=IpBkTI7BLdF7885Q0k5CTu_8Gunl5FdqH_t6fHVjAq0,1740
624
623
  api_logic_server_cli/prototypes/base/docs/training/admin_app_2_functionality.prompt.md,sha256=iWMoAkETeQjWWPrNj1AcI4HFGLlgS0-HP9oBYXhdTNI,1705
625
624
  api_logic_server_cli/prototypes/base/docs/training/admin_app_3_architecture.prompt.md,sha256=5KtRBihPbxTQEvLJ51w104Z0HfDGFEmQc3ysek6EsXA,925
626
625
  api_logic_server_cli/prototypes/base/docs/training/logic_bank_api.prompt,sha256=3zZu_AQLPskFzs_UL49-lk8Z6ck7YhQnj8wlz30Ib1k,14606
@@ -631,7 +630,7 @@ api_logic_server_cli/prototypes/base/integration/kafka/kafka_consumer.py,sha256=
631
630
  api_logic_server_cli/prototypes/base/integration/kafka/kafka_producer.py,sha256=g0nMAVfz1Y0iKJbbXfvRpdf-QUmyB4uUGZ6lyaVoXag,4470
632
631
  api_logic_server_cli/prototypes/base/integration/kafka/kafka_readme.md,sha256=MlwykHWM2w41KzWh4vPuTnIodR8f-BQzrWpV4P1hrsI,161
633
632
  api_logic_server_cli/prototypes/base/integration/mcp/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
634
- api_logic_server_cli/prototypes/base/integration/mcp/mcp_client_executor.py,sha256=AGl6PVq2ss5_HtPzuetNzM2MbBvnjdftJ-mMCLcwxQM,25480
633
+ api_logic_server_cli/prototypes/base/integration/mcp/mcp_client_executor.py,sha256=CzDkR6teyhIHT6UqCrWvbgyRna_rodtitj6k7uOwtv4,25505
635
634
  api_logic_server_cli/prototypes/base/integration/mcp/mcp_server_discovery.json,sha256=TUyInb67AWoGw7XFE9iDZxmM8UEID-ahQmdmzpF9AmQ,188
636
635
  api_logic_server_cli/prototypes/base/integration/mcp/readme-mcp.md,sha256=TuqDgTM7nHVQINmSxO8QO6rBzo_PJ-QxIxhZM3YeLB8,370
637
636
  api_logic_server_cli/prototypes/base/integration/mcp/examples/mcp_context_results.txt,sha256=27a8-MpBoE3i8UnCoMZINgeseFUxGhhwurgoV5EeP1k,8105
@@ -654,7 +653,7 @@ api_logic_server_cli/prototypes/base/logic/logic_discovery/readme_logic_discover
654
653
  api_logic_server_cli/prototypes/base/logic/logic_discovery/use_case.py,sha256=9qp9e_PwTvIg5mfYLtFxfwFhfivBhk3O6uHeh_lUd5c,822
655
654
  api_logic_server_cli/prototypes/base/security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
656
655
  api_logic_server_cli/prototypes/base/security/declare_security.py,sha256=sWi-M7E-dIhvC0hmdCXnTRjHAR5eWVKCYIDCoblISm4,2281
657
- api_logic_server_cli/prototypes/base/security/readme_security.md,sha256=ZzRl9Nj59rilFWnIfmma2SKbzsQOIkEwIrUeW-nadgo,511
656
+ api_logic_server_cli/prototypes/base/security/readme_security.md,sha256=G8krW3KHl_N-ksbEr3WFV3U2ODYhlFYOij73t-KV9jk,507
658
657
  api_logic_server_cli/prototypes/base/security/authentication_provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
659
658
  api_logic_server_cli/prototypes/base/security/authentication_provider/abstract_authentication_provider.py,sha256=RPPA48kdYiXx5zQ6epbfAEB1se8E10Ra9NxYRjIBShk,895
660
659
  api_logic_server_cli/prototypes/base/security/authentication_provider/keycloak/auth_provider.py,sha256=gnk8CqhlEobRPEBTwimG6OkZhc5gP-Yba1VFlTydt2Q,10437
@@ -706,14 +705,15 @@ api_logic_server_cli/prototypes/base/venv_setup/venv-linux.sh,sha256=FDIxVyZ50Cg
706
705
  api_logic_server_cli/prototypes/base/venv_setup/venv.ps1,sha256=_-LfKkLw5HOkZsF59BGCqM9Zsk3n1oDIyDb4emy0O08,698
707
706
  api_logic_server_cli/prototypes/base/venv_setup/venv.sh,sha256=aWX9fa8fe6aO9ifBIZEgGY5UGh4I0arOoCwBzDsxgU8,893
708
707
  api_logic_server_cli/prototypes/basic_demo/.DS_Store,sha256=sij8zwzUCUY-cTmB_AJNRd5JqPXoK-aLIhIo495iLIA,6148
709
- api_logic_server_cli/prototypes/basic_demo/README.md,sha256=YK44ad55C5aM1QMtwrQ3R-p_R0l9p8aClBmzEJqU_dk,18682
708
+ api_logic_server_cli/prototypes/basic_demo/README.md,sha256=lPqI91XAoZfkisGAICK_l2OCn7QYU6BFFfS05BCCHk8,18338
709
+ api_logic_server_cli/prototypes/basic_demo/_config.yml,sha256=KIUQQpjgj7hP_Z2Fksq90E52UnbKnyom-v9L_eIfqZo,170
710
+ api_logic_server_cli/prototypes/basic_demo/_layouts/redirect.html,sha256=-0kMPGYI88fb787IzYmdi7ySZUhgpUlP0vodrg8-NRM,457
710
711
  api_logic_server_cli/prototypes/basic_demo/customizations/.DS_Store,sha256=9TTUzzmsI5vYa6wg5TIBWMNRsKivi_IDbgb05zReWN4,6148
711
712
  api_logic_server_cli/prototypes/basic_demo/customizations/api/.DS_Store,sha256=6F7pphfwiMhILhl_J6yVhDZFYXmar5V92iLCzSkfnyA,6148
712
713
  api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/openapi.py,sha256=kLQ7Fn1J7tzuNJHBXF2AiwtzvQ-0JxJ6z-MfFryAtLk,3887
713
714
  api_logic_server_cli/prototypes/basic_demo/customizations/config/default.env,sha256=-rjXJrjR4vjMr9YCVYVchaJw7qMBlbvQ3KfR_wri_XM,412
714
715
  api_logic_server_cli/prototypes/basic_demo/customizations/database/db.sqlite,sha256=wF8C-AP1xzL5gNqYB_C48OnMB9coUA20zY5IU3f3-Hc,24576
715
716
  api_logic_server_cli/prototypes/basic_demo/customizations/database/models.py,sha256=bmM2TNXZXYlb4HpGjlPO_QJW_Ps0MvNlqJQPXB9TWdU,4545
716
- api_logic_server_cli/prototypes/basic_demo/customizations/database/system/SAFRSBaseX.py,sha256=VeiUgXr9pkgvxchCf89lhRKNBlfj4_FYwAweu3NWj-M,5394
717
717
  api_logic_server_cli/prototypes/basic_demo/customizations/docs/mcp_learning/mcp_discovery.json,sha256=juCiWJ_BEBgj-8JMXw-ewW6i8vL9ZkLQCd7Dkf_xWmc,3249
718
718
  api_logic_server_cli/prototypes/basic_demo/customizations/logic/cocktail-napkin.jpg,sha256=5rNSy6wvcWSHPJQZqkf2DHs19QLWiyqMBNwxGqjstZU,133075
719
719
  api_logic_server_cli/prototypes/basic_demo/customizations/logic/declare_logic.py,sha256=Yk-X017gZM1egx4MXSx_FGURj4KDqJfpq1NWVFrwfEY,4612
@@ -766,6 +766,7 @@ api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app
766
766
  api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.js,sha256=nV_j3KpDeUpD8sPsGJeOqi6lUvcPbheJtLdqU5nENPs,4366
767
767
  api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/resourceLookup.ts,sha256=FlsEiPVX_U-22glUGoscj3qcYdnfMJ_9Wa2Vi4CV2xs,4471
768
768
  api_logic_server_cli/prototypes/basic_demo/customizations/ui/reference_react_app/src/rav4-jsonapi-client/styles.module.css,sha256=AuGbjqBQu2by4z5APJvQAWk44ocrdQ9lCopqYCJXCy0,154
769
+ api_logic_server_cli/prototypes/basic_demo/docs/system-creation-vibe.md,sha256=7ECJTc-BM6TwgBc3NM67a6LPXqBVY7RtRFepvhPjBko,4001
769
770
  api_logic_server_cli/prototypes/basic_demo/iteration/api/api_discovery/order_b2b.py,sha256=hg9Bsz0_t-RjO9rFcW-YH3y26kq4IY5dd9FfVoYxB4w,3176
770
771
  api_logic_server_cli/prototypes/basic_demo/iteration/database/db.sqlite,sha256=SvpzWZxWnwIqd25UhzL5crhtjEfF53MLj3lOB2cPK8M,24576
771
772
  api_logic_server_cli/prototypes/basic_demo/iteration/docs/er_diagram.png,sha256=-3aSv9ay7XeFqGU-cygRz5T5eYhY627BYmA6GXdUYH0,161072
@@ -773,6 +774,8 @@ api_logic_server_cli/prototypes/basic_demo/iteration/integration/row_dict_maps/O
773
774
  api_logic_server_cli/prototypes/basic_demo/iteration/integration/row_dict_maps/OrderShipping.py,sha256=pzrK57C1ppUUcSBVNICXGujsf9p1ZTRq0bpKacgcrV0,1213
774
775
  api_logic_server_cli/prototypes/basic_demo/iteration/logic/declare_logic.py,sha256=Jnqt0j2Yu8ev1Pi9T3rogumuGn2sR4Q4QyWeUIunG28,6501
775
776
  api_logic_server_cli/prototypes/basic_demo/iteration/ui/admin/admin.yaml,sha256=uqxqYNMbKm4aCaTOy5CnlAtYccYM32-oQLVi5K6tfNI,3554
777
+ api_logic_server_cli/prototypes/basic_demo/logic/declarative-vs-procedural-comparison.html,sha256=GUzgmnWdT709M5mPJGyfF1ARzzz3y5guASDBWeG43PU,3915
778
+ api_logic_server_cli/prototypes/basic_demo/logic/procedural/declarative-vs-procedural-comparison.md,sha256=lBUyilpqRPrL-d4yp55gRyRLaeYNzbArktMOaTD5IUw,12193
776
779
  api_logic_server_cli/prototypes/classicmodels/devops/docker-compose-dev-azure/docker-compose-dev-azure.yml,sha256=5qrlCzViJcYZ9uhWGBCJmnexi7bwQaYzQKMqGCnRzS0,1389
777
780
  api_logic_server_cli/prototypes/classicmodels/devops/docker-compose-dev-local/docker-compose-dev-local.yml,sha256=WJu3CKusT1wju6CubOKi6T1pW3pbE8JrZraGTpC6HTY,1439
778
781
  api_logic_server_cli/prototypes/classicmodels/devops/docker-compose-dev-local-nginx/docker-compose-dev-local-nginx.yml,sha256=QgsdxPfRYNUco0DcXZWo5_9FgDzrCmnWFoDjkrws5XU,2456
@@ -815,10 +818,14 @@ api_logic_server_cli/prototypes/manager/.vscode/.copilot-instructions.md,sha256=
815
818
  api_logic_server_cli/prototypes/manager/.vscode/ApiLogicServer.code-workspace,sha256=yC_pOIZN5o5Qiw3t2kBPsiO01Mgp3VEbAizYx1T3aPI,282
816
819
  api_logic_server_cli/prototypes/manager/.vscode/launch.json,sha256=alh_fiuqMjY-uIk4ghfwyMs3y-U2dYr1W6rS9ncpNEY,33491
817
820
  api_logic_server_cli/prototypes/manager/.vscode/settings.json,sha256=Zj9oPObeI-KVh1l4b3uuF1vkezKomVqnhP241h6ZB-M,619
818
- api_logic_server_cli/prototypes/manager/samples/readme_samples.md,sha256=e0CwYxF-LKnbYduWdmmlO4gZw2iD8jH1osWdE6aF08Y,3050
821
+ api_logic_server_cli/prototypes/manager/samples/readme_samples.md,sha256=DnrKgO4byYk1zu2PxCuHfu--0lMAjPD_0LeMW7estLA,3153
819
822
  api_logic_server_cli/prototypes/manager/samples/dbs/readme_dbs.md,sha256=FvxzBqR00Kgc5Z76JOslHju6HYmsYOwkoARe_U-dnY0,570
820
823
  api_logic_server_cli/prototypes/manager/samples/docker_samples/run_sample_docker.sh,sha256=P_p_w4qu6Uw_JxTNCmej7XV8cdwCMUnq2HMrN5bFuZs,860
821
824
  api_logic_server_cli/prototypes/manager/samples/docker_samples/run_web_genai.sh,sha256=vA8dxmnau59OQ1NPvDP0O65fmSVQLcfk4TjFM3kLE-o,127
825
+ api_logic_server_cli/prototypes/manager/samples/prompts/add_email.prompt,sha256=wEPE_ZioEetFU11PDHpdaeFgruASNNFJMSgivcaJi7w,403
826
+ api_logic_server_cli/prototypes/manager/samples/prompts/elections.prompt,sha256=R7B0KFuuWTuH6YOTr_AEHHgnHE4spR_BUrlOl0TX-cE,80
827
+ api_logic_server_cli/prototypes/manager/samples/prompts/emp_dept.prompt,sha256=xbyhCyY7TUk7hoBKAkzRsZVBj1lP4hfXdSR4TQagXqM,109
828
+ api_logic_server_cli/prototypes/manager/samples/prompts/genai_demo.prompt,sha256=mhxJ5d4rALI45DNFkmBCH14YCl0FVuSyy1FgVTSBRrU,570
822
829
  api_logic_server_cli/prototypes/manager/system/Manager_workspace.code-workspace,sha256=ieWHaqLQ8uXoSzNSklVdDKoIjD-H3d6H4aUP1d_Jy1s,305
823
830
  api_logic_server_cli/prototypes/manager/system/readme_ssystem.md,sha256=52zXRh5KJ4GSRWyNLwzbXqKMDJmR7M6PhS71-DIUoBI,106
824
831
  api_logic_server_cli/prototypes/manager/system/style-guide.yaml,sha256=JaP3NDE29k4_e9ELeLTZfnWf2L8VgS1X7hO8J_BNqJU,673
@@ -1260,7 +1267,7 @@ api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv-
1260
1267
  api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv.ps1,sha256=_-LfKkLw5HOkZsF59BGCqM9Zsk3n1oDIyDb4emy0O08,698
1261
1268
  api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv.sh,sha256=aWX9fa8fe6aO9ifBIZEgGY5UGh4I0arOoCwBzDsxgU8,893
1262
1269
  api_logic_server_cli/prototypes/manager/system/genai/.DS_Store,sha256=ndrcwHjeXXcVbvjdiQNuyCtmI6m-kvDLoEnr0fFJsuY,6148
1263
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md,sha256=NaoanZbP9-lc7gqO5BUKbwp7gkQWhh9u8NRWhftoCxw,8094
1270
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md,sha256=nemov3onAVNZotkxuZBoRqHSW5wbePRIUsxmRrNU5S0,8108
1264
1271
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-js-Learning-Prompt.md,sha256=LafKtiWNGIjdv6eJpKPFbN4fiNnQq9pCIAKZyyeoCyE,2018
1265
1272
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-config-prompt.md,sha256=fyP8X1q9tM3i6bTVioa7ieM_aTUfk4GPo08aOWZ60-0,932
1266
1273
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-json-api-model-prompt.md,sha256=5Zp9q_lpY225qceQ3UhF4Fyd-85hDKkD-r3BWYmcs6Y,2890
@@ -1268,7 +1275,7 @@ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-t
1268
1275
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/README.md,sha256=h7ePuwOqn3jv7YkjM4ruaP5rpYBmr_4Q3NChhb8pVJ4,452
1269
1276
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/README_create_react_app.md,sha256=cOr7x6X9RmqjITtafhsqQTg8vl1Ob8X0WC78WL21CdE,3359
1270
1277
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package-lock.json,sha256=dG1s4WtUFp0ZhVWGwp_Ocv-Ii2c92Xb4FWqHFc0m7KU,698058
1271
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package.json,sha256=6_nHZ8UzSaDWUPv6DyGJ3QAO392tc2rc8JPOp7V7gz4,1114
1278
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package.json,sha256=83SmDclqP-LkO8Isn87qA2DDfCmCYpBoXAkWEKN8lNM,1139
1272
1279
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/favicon.ico,sha256=PRD32mxgMXg0AIFmjErFs66XQ8qaJiqw_NMS-7n0i90,3870
1273
1280
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/index.html,sha256=IK_Be2NYv99ddFEyJc1Kc0Q_oL0VuUSvceFD9pSlz3w,1721
1274
1281
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/logo192.png,sha256=w4Y5bscNs2CAdbX7-qxKscyqhroFpoqzk-xVHrZsPgA,5347
@@ -2246,7 +2253,7 @@ api_logic_server_cli/sqlacodegen_wrapper/Readme.md,sha256=pcBng3xB7DHqcLSY9NgVlt
2246
2253
  api_logic_server_cli/sqlacodegen_wrapper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2247
2254
  api_logic_server_cli/sqlacodegen_wrapper/console_log.txt,sha256=RvaA45ZgMc5won9JzwK9BMK0LKfkiARNS0EW31vjTeM,53944
2248
2255
  api_logic_server_cli/sqlacodegen_wrapper/requirements.txt,sha256=13u62njPM4Emzdxow4V8xxYVjBQoO3aSAtNt0Z_V3aE,54
2249
- api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen_wrapper.py,sha256=u1DdlyrzCAiA85YXYQA7p1Z2_56H6lKZBjEOW4FmWnQ,22347
2256
+ api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen_wrapper.py,sha256=bJ4UXu4Qpf9Yo8Qa3K-V78cdcOQNUZKl38jkSkrEopU,22460
2250
2257
  api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen/.travis.yml,sha256=mz8WDjTN-Rj9quyH-OZfTRcrACRZ98Dk0V_Z1v8udGY,1850
2251
2258
  api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen/CHANGES.rst,sha256=lpwnI9rMfFx-TbbTa83B0qmracfKFSKnJMDVBR150fk,2593
2252
2259
  api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen/README.rst,sha256=i5RCj2RqmvoDWv4tczRiJ3a5ONugmW69-kjbTzGc7JA,3865
@@ -2291,9 +2298,9 @@ api_logic_server_cli/tools/mini_skel/database/system/SAFRSBaseX.py,sha256=p8C7AF
2291
2298
  api_logic_server_cli/tools/mini_skel/database/system/TestDataBase.py,sha256=U02SYqThsbY5g3DX7XGaiMxjZBuOpzvtPS6RfI1WQFg,371
2292
2299
  api_logic_server_cli/tools/mini_skel/logic/declare_logic.py,sha256=fTrlHyqMeZsw_TyEXFa1VlYBL7fzjZab5ONSXO7aApo,175
2293
2300
  api_logic_server_cli/tools/mini_skel/logic/load_verify_rules.py,sha256=Rr5bySJpYCZmNPF2h-phcPJ53nAOPcT_ohZpCD93-a0,7530
2294
- apilogicserver-15.0.52.dist-info/licenses/LICENSE,sha256=67BS7VC-Z8GpaR3wijngQJkHWV04qJrwQArVgn9ldoI,1485
2295
- apilogicserver-15.0.52.dist-info/METADATA,sha256=b4bmqLnQ8hYSI0KJ1Z23KmSbUqbHz-inmxLgHla_eLc,6653
2296
- apilogicserver-15.0.52.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2297
- apilogicserver-15.0.52.dist-info/entry_points.txt,sha256=W9EVNvf09h8n6rJChmVj2gzxVQ6BXXZa2x3wri0lFGc,259
2298
- apilogicserver-15.0.52.dist-info/top_level.txt,sha256=-r0AT_GEApleihg-jIh0OMvzzc0BO1RuhhOpE91H5qI,21
2299
- apilogicserver-15.0.52.dist-info/RECORD,,
2301
+ apilogicserver-15.0.55.dist-info/licenses/LICENSE,sha256=67BS7VC-Z8GpaR3wijngQJkHWV04qJrwQArVgn9ldoI,1485
2302
+ apilogicserver-15.0.55.dist-info/METADATA,sha256=lZEo3VL3d_dteRSrGPTMsGvUGWHWN_v0tlAE8iZ27Tc,6653
2303
+ apilogicserver-15.0.55.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2304
+ apilogicserver-15.0.55.dist-info/entry_points.txt,sha256=W9EVNvf09h8n6rJChmVj2gzxVQ6BXXZa2x3wri0lFGc,259
2305
+ apilogicserver-15.0.55.dist-info/top_level.txt,sha256=-r0AT_GEApleihg-jIh0OMvzzc0BO1RuhhOpE91H5qI,21
2306
+ apilogicserver-15.0.55.dist-info/RECORD,,
@@ -1,178 +0,0 @@
1
- # GitHub Copilot Instructions for GenAI-Logic (aka API Logic Server) Projects
2
-
3
- ## Project Type: Auto-Generated Microservice
4
-
5
- This is a **GenAI-Logic (aka API Logic Server) project** - a complete, working microservice - auto-generated from a database schema.
6
-
7
- ## ⚠️ IMPORTANT: What's Already Built
8
-
9
- **DO NOT recreate these - they're already working:**
10
-
11
- 1. **Admin Web Application** - Live at `http://localhost:5656`
12
- 2. **REST API Endpoints** - All database tables exposed at `/api/*`
13
- 3. **Database Models** - Complete SQLAlchemy ORM in `database/models.py`
14
- 4. **Authentication System** - JWT-based auth framework
15
- 5. **Business Logic Engine** - Declarative rules system
16
-
17
- ## 🎯 Common Tasks
18
-
19
- If the user asks "what do I do now?", these subsections are good suggestions.
20
-
21
- List these as choices, do not just do all of them at once - that would be overwhelming.
22
-
23
- ### 🚀 To Run This Project
24
-
25
- Use F5 (pre-configured run configuration - supports debugger for server logic), or (when focused on client apps):
26
-
27
- ```bash
28
- python api_logic_server_run.py
29
- # Then open: http://localhost:5656
30
- ```
31
-
32
- ### Adding Business Logic
33
- Use `docs/training` to accept Natural Language logic, and translate it into rules like:
34
-
35
- ```python
36
- # Edit: logic/declare_logic.py
37
- Rule.sum(derive=Customer.Balance, as_sum_of=Order.AmountTotal)
38
- Rule.constraint(validate=Customer, as_condition=lambda row: row.Balance <= row.CreditLimit)
39
- ```
40
-
41
- Generally CoPilot solicits Natural Language logic for translation (see logic/logic_discovery/readme_logic_discovery.md),
42
- but you can also offer to suggest rules.
43
-
44
- ### Adding MCP
45
-
46
- The API is automatically MCP-enabled.
47
-
48
- To add MCP Client (requires OpenAI key):
49
-
50
- ```bash
51
- # Add MCP Client
52
- genai-logic genai-add-mcp-client
53
- ```
54
-
55
- ### Configuring Admin UI
56
-
57
- This is built when project is created - no need to add it.
58
- Customize by editing the underlying yaml.
59
-
60
- ```yaml
61
- # Edit: ui/admin/admin.yaml
62
- resources:
63
- Customer:
64
- attributes:
65
- - name: CompanyName
66
- search: true
67
- sort: true
68
- ```
69
-
70
- ### Create and Customize React Apps
71
-
72
- Complete customization is provided by generating a React Application (requires OpenAI key, Node):
73
-
74
- ```bash
75
- # Create: ui/admin/my-app-name
76
- genai-logic genai-add-app --app-name=my-app-name --vibe
77
- ```
78
-
79
- Then, `npm install` and `npm start`
80
-
81
- Temporary restriction: security must be disabled.
82
-
83
- Customize using CoPilot chat, with `docs/training`.
84
-
85
- ### Security - Role-Based Access Control
86
-
87
- Configure:
88
- ```
89
- als add-auth --provider-type=sql --db-url=
90
- als add-auth --provider-type=sql --db_url=postgresql://postgres:p@localhost/authdb
91
-
92
- als add-auth --provider-type=keycloak --db-url=localhost
93
- als add-auth --provider-type=keycloak --db-url=hardened
94
-
95
- als add-auth --provider-type=None # to disable
96
- ```
97
-
98
- Keycloak quick start [(more information here:)](https://apilogicserver.github.io/Docs/Security-Keycloak/)
99
- ```bash
100
- cd devops/keycloak
101
- docker compose up
102
- als add-auth --provider-type=keycloak --db-url=localhost
103
- ```
104
-
105
- For more on KeyCloak: https://apilogicserver.github.io/Docs/Security-Keycloak/
106
-
107
- Declaration:
108
- ```python
109
- # Edit: security/declare_security.py
110
- Grant(on_entity=Customer, to_role=sales, filter=lambda: Customer.SalesRep == current_user())
111
- ```
112
-
113
- ### Adding Custom API Endpoints
114
- ```python
115
- # Edit: api/customize_api.py
116
- @app.route('/api/custom-endpoint')
117
- def my_endpoint():
118
- return {"message": "Custom endpoint"}
119
- ```
120
-
121
- ### Customize Models - Add Derived attributes
122
-
123
- Here is a sample derived attribute, `proper_salary`:
124
-
125
- ```python
126
-
127
- # add derived attribute: https://github.com/thomaxxl/safrs/blob/master/examples/demo_pythonanywhere_com.py
128
- @add_method(models.Employee)
129
- @jsonapi_attr
130
- def __proper_salary__(self): # type: ignore [no-redef]
131
- import database.models as models
132
- import decimal
133
- if isinstance(self, models.Employee):
134
- rtn_value = self.Salary
135
- if rtn_value is None:
136
- rtn_value = decimal.Decimal('0')
137
- rtn_value = decimal.Decimal('1.25') * rtn_value
138
- self._proper_salary = int(rtn_value)
139
- return self._proper_salary
140
- else:
141
- rtn_value = decimal.Decimal('0')
142
- self._proper_salary = int(rtn_value)
143
- return self._proper_salary
144
-
145
- @add_method(models.Employee)
146
- @__proper_salary__.setter
147
- def _proper_salary(self, value): # type: ignore [no-redef]
148
- self._proper_salary = value
149
- print(f'_proper_salary={self._proper_salary}')
150
- pass
151
-
152
- models.Employee.ProperSalary = __proper_salary__
153
-
154
- ```
155
-
156
- When customizing SQLAlchemy models:
157
-
158
- Don't use direct comparisons with database fields in computed properties
159
- Convert to Python values first using float(), int(), str()
160
- Use property() function instead of @jsonapi_attr for computed properties
161
- Always add error handling for type conversions
162
-
163
- ## 📁 Key Directories
164
-
165
- - `logic/` - Business rules (declarative)
166
- - `api/` - REST API customization
167
- - `security/` - Authentication/authorization
168
- - `database/` - Data models and schemas
169
- - `ui/admin/` - Admin interface configuration
170
- - `ui/app/` - Alternative Angular admin app
171
-
172
- ## 💡 Helpful Context
173
-
174
- - This uses Flask + SQLAlchemy + SAFRS for JSON:API
175
- - Admin UI is React-based with automatic CRUD generation
176
- - Business logic uses LogicBank (declarative rule engine)
177
- - Everything is auto-generated from database introspection
178
- - Focus on CUSTOMIZATION, not re-creation
@@ -1,18 +0,0 @@
1
- The diagram below illustrates a simple path for enacting changes to the data model, and using [Alembic](https://alembic.sqlalchemy.org/en/latest/index.html) to automate the database changes:
2
-
3
- 1. Update `database/models.py` (e.g., add columns, tables)
4
- 2. Use alembic to compute the revisions
5
- ```bash
6
- cd database
7
- alembic revision --autogenerate -m "Added Tables and Columns"
8
- ```
9
- 3. Edit the revision file to signify your understanding (see below)
10
- 4. Activate the change
11
- ```bash
12
- alembic upgrade head
13
- ```
14
-
15
- ![alembic example](https://github.com/ApiLogicServer/Docs/blob/main/docs/images/database/alembic/alembic-overview.png?raw=true)
16
-
17
-
18
- Then, run `rebuild-from-model`. For more information, see [Database Design Changes](https://apilogicserver.github.io/Docs/Database-Changes/).
@@ -1,73 +0,0 @@
1
- from sqlalchemy.ext.declarative import declarative_base
2
- from sqlalchemy import Column, DECIMAL, Date, ForeignKey, Integer, String
3
- from safrs import SAFRSBase
4
- from flask_login import UserMixin
5
- import safrs, flask_sqlalchemy
6
- from safrs import jsonapi_attr
7
- from flask_sqlalchemy import SQLAlchemy
8
- from datetime import datetime
9
-
10
- Base = declarative_base() # type: flask_sqlalchemy.model.DefaultMeta
11
- #vh new x
12
- @classmethod
13
- def jsonapi_filter(cls):
14
- """
15
- Use this to override SAFRS JSON:API filtering
16
-
17
- Returns:
18
- _type_: SQLAlchemy query filter
19
- """
20
- from sqlalchemy import text, or_, and_
21
- from flask import request
22
- expressions = []
23
- sqlWhere = ""
24
- query = cls._s_query
25
- if args := request.args:
26
- from api.system.expression_parser import advancedFilter
27
- expressions, sqlWhere = advancedFilter(cls, args)
28
- if sqlWhere != "":
29
- return query.filter(text(sqlWhere))
30
- else:
31
- return query.filter(or_(*expressions))
32
-
33
- class SAFRSBaseX(SAFRSBase, safrs.DB.Model):
34
- __abstract__ = True
35
- if do_enable_ont_advanced_filters := False:
36
- jsonapi_filter = jsonapi_filter
37
-
38
- def _s_parse_attr_value(self, attr_name: str, attr_val: any):
39
- """
40
- Parse the given jsonapi attribute value so it can be stored in the db
41
- :param attr_name: attribute name
42
- :param attr_val: attribute value
43
- :return: parsed value
44
- """
45
- attr = self.__class__._s_jsonapi_attrs.get(attr_name, None)
46
- if hasattr(attr, "type"): # pragma: no cover
47
-
48
- if str(attr.type) in ["DATE", "DATETIME"] and attr_val:
49
- try:
50
- attr_val = attr_val.replace("T", " ")
51
- datetime.strptime(attr_val, '%Y-%m-%d %H:%M')
52
- attr_val += ":00"
53
- except ValueError:
54
- pass
55
- except Exception as exc:
56
- safrs.log.warning(exc)
57
-
58
-
59
- return super()._s_parse_attr_value(attr_name, attr_val)
60
-
61
- class TestBase(Base):
62
- __abstract__ = True
63
- def __init__(self, *args, **kwargs):
64
- for name, val in kwargs.items():
65
- col = getattr(self.__class__, name)
66
- if 'amount_total' == name:
67
- debug_stop = 'stop'
68
- if val is not None:
69
- if str(col.type) in ["DATE", "DATETIME"]:
70
- pass
71
- else:
72
- kwargs[name] = col.type.python_type(val)
73
- return super().__init__(*args, **kwargs)
@@ -1,139 +0,0 @@
1
- import json
2
- from sqlalchemy.ext.declarative import declarative_base
3
- from sqlalchemy import Column, DECIMAL, Date, ForeignKey, Integer, String
4
- from safrs import SAFRSBase, ValidationError
5
- from flask_login import UserMixin
6
- import safrs, flask_sqlalchemy
7
- from safrs import jsonapi_attr
8
- from flask_sqlalchemy import SQLAlchemy
9
- from datetime import datetime
10
- import operator
11
- import json
12
-
13
-
14
- Base = declarative_base() # type: flask_sqlalchemy.model.DefaultMeta
15
- #vh new x
16
- @classmethod
17
- def jsonapi_filter(cls):
18
- """
19
- Use this to override SAFRS JSON:API filtering
20
-
21
- Returns:
22
- _type_: SQLAlchemy query filter
23
- """
24
- from sqlalchemy import text, or_, and_
25
- from flask import request
26
- expressions = []
27
- sqlWhere = ""
28
- query = cls._s_query
29
- if args := request.args:
30
- from api.system.expression_parser import advancedFilter
31
- expressions, sqlWhere = advancedFilter(cls, args)
32
- if sqlWhere != "":
33
- return query.filter(text(sqlWhere))
34
- else:
35
- return query.filter(and_(*expressions))
36
-
37
- class SAFRSBaseX(SAFRSBase, safrs.DB.Model):
38
- __abstract__ = True
39
- if do_enable_ont_advanced_filters := False:
40
- jsonapi_filter = jsonapi_filter
41
-
42
- def _s_parse_attr_value(self, attr_name: str, attr_val: any):
43
- """
44
- Parse the given jsonapi attribute value so it can be stored in the db
45
- :param attr_name: attribute name
46
- :param attr_val: attribute value
47
- :return: parsed value
48
- """
49
- attr = self.__class__._s_jsonapi_attrs.get(attr_name, None)
50
- if hasattr(attr, "type"): # pragma: no cover
51
-
52
- if str(attr.type) in ["DATE", "DATETIME"] and attr_val:
53
- try:
54
- attr_val = attr_val.replace("T", " ")
55
- datetime.strptime(attr_val, '%Y-%m-%d %H:%M')
56
- attr_val += ":00"
57
- except ValueError:
58
- pass
59
- except Exception as exc:
60
- safrs.log.warning(exc)
61
-
62
-
63
- return super()._s_parse_attr_value(attr_name, attr_val)
64
-
65
-
66
- @classmethod
67
- def _s_filter(cls, *filter_args, **filter_kwargs):
68
- """
69
- Apply a filter to this model
70
- :param filter_args: A list of filters information to apply, passed as a request URL parameter.
71
- Each filter object has the following fields:
72
- - name: The name of the field you want to filter on.
73
- - op: The operation you want to use (all sqlalchemy operations are available). The valid values are:
74
- - like: Invoke SQL like (or "ilike", "match", "notilike")
75
- - eq: check if field is equal to something
76
- - ge: check if field is greater than or equal to something
77
- - gt: check if field is greater than to something
78
- - ne: check if field is not equal to something
79
- - is_: check if field is a value
80
- - is_not: check if field is not a value
81
- - le: check if field is less than or equal to something
82
- - lt: check if field is less than to something
83
- - val: The value that you want to compare.
84
- :return: sqla query object
85
- """
86
- try:
87
- filters = json.loads(filter_args[0])
88
- except json.decoder.JSONDecodeError:
89
- raise ValidationError("Invalid filter format (see https://github.com/thomaxxl/safrs/wiki)")
90
-
91
- if not isinstance(filters, list):
92
- filters = [filters]
93
-
94
- expressions = []
95
- query = cls._s_query
96
-
97
- for filt in filters:
98
- if not isinstance(filt, dict):
99
- safrs.log.warning(f"Invalid filter '{filt}'")
100
- continue
101
- attr_name = filt.get("name")
102
- attr_val = filt.get("val")
103
- if attr_name != "id" and attr_name not in cls._s_jsonapi_attrs:
104
- raise ValidationError(f'Invalid filter "{filt}", unknown attribute "{attr_name}"')
105
-
106
- op_name = filt.get("op", "").strip("_")
107
- attr = cls._s_jsonapi_attrs[attr_name] if attr_name != "id" else cls.id
108
- if op_name in ["in", "notin"]:
109
- op = getattr(attr, op_name + "_")
110
- query = query.filter(op(attr_val))
111
- elif op_name in ["like", "ilike", "match", "notilike"] and hasattr(attr, "like"):
112
- # => attr is Column or InstrumentedAttribute
113
- like = getattr(attr, op_name)
114
- expressions.append(like(attr_val))
115
- elif not hasattr(operator, op_name):
116
- raise ValidationError(f'Invalid filter "{filt}", unknown operator "{op_name}"')
117
- else:
118
- op = getattr(operator, op_name)
119
- expressions.append(op(attr, attr_val))
120
-
121
- if len(filters) > 1:
122
- return query.filter(operator.and_(*expressions))
123
- else:
124
- return query.filter(*expressions)
125
-
126
-
127
- class TestBase(Base):
128
- __abstract__ = True
129
- def __init__(self, *args, **kwargs):
130
- for name, val in kwargs.items():
131
- col = getattr(self.__class__, name)
132
- if 'amount_total' == name:
133
- debug_stop = 'stop'
134
- if val is not None:
135
- if str(col.type) in ["DATE", "DATETIME"]:
136
- pass
137
- else:
138
- kwargs[name] = col.type.python_type(val)
139
- return super().__init__(*args, **kwargs)