fastapi-factory-utilities 0.3.3__py3-none-any.whl → 0.8.2__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 (75) hide show
  1. fastapi_factory_utilities/core/api/__init__.py +1 -1
  2. fastapi_factory_utilities/core/api/v1/sys/health.py +1 -1
  3. fastapi_factory_utilities/core/app/__init__.py +4 -4
  4. fastapi_factory_utilities/core/app/application.py +22 -26
  5. fastapi_factory_utilities/core/app/builder.py +19 -35
  6. fastapi_factory_utilities/core/app/config.py +2 -0
  7. fastapi_factory_utilities/core/app/fastapi_builder.py +3 -2
  8. fastapi_factory_utilities/core/exceptions.py +64 -28
  9. fastapi_factory_utilities/core/plugins/__init__.py +2 -31
  10. fastapi_factory_utilities/core/plugins/abstracts.py +40 -0
  11. fastapi_factory_utilities/core/plugins/aiopika/__init__.py +25 -0
  12. fastapi_factory_utilities/core/plugins/aiopika/abstract.py +48 -0
  13. fastapi_factory_utilities/core/plugins/aiopika/configs.py +85 -0
  14. fastapi_factory_utilities/core/plugins/aiopika/depends.py +20 -0
  15. fastapi_factory_utilities/core/plugins/aiopika/exceptions.py +29 -0
  16. fastapi_factory_utilities/core/plugins/aiopika/exchange.py +69 -0
  17. fastapi_factory_utilities/core/plugins/aiopika/listener/__init__.py +7 -0
  18. fastapi_factory_utilities/core/plugins/aiopika/listener/abstract.py +72 -0
  19. fastapi_factory_utilities/core/plugins/aiopika/message.py +86 -0
  20. fastapi_factory_utilities/core/plugins/aiopika/plugins.py +84 -0
  21. fastapi_factory_utilities/core/plugins/aiopika/publisher/__init__.py +7 -0
  22. fastapi_factory_utilities/core/plugins/aiopika/publisher/abstract.py +66 -0
  23. fastapi_factory_utilities/core/plugins/aiopika/queue.py +88 -0
  24. fastapi_factory_utilities/core/plugins/odm_plugin/__init__.py +14 -157
  25. fastapi_factory_utilities/core/plugins/odm_plugin/builder.py +4 -3
  26. fastapi_factory_utilities/core/plugins/odm_plugin/configs.py +1 -1
  27. fastapi_factory_utilities/core/plugins/odm_plugin/documents.py +1 -1
  28. fastapi_factory_utilities/core/plugins/odm_plugin/helpers.py +16 -0
  29. fastapi_factory_utilities/core/plugins/odm_plugin/plugins.py +155 -0
  30. fastapi_factory_utilities/core/plugins/odm_plugin/repositories.py +12 -23
  31. fastapi_factory_utilities/core/plugins/opentelemetry_plugin/__init__.py +8 -115
  32. fastapi_factory_utilities/core/plugins/opentelemetry_plugin/instruments/__init__.py +85 -0
  33. fastapi_factory_utilities/core/plugins/opentelemetry_plugin/plugins.py +137 -0
  34. fastapi_factory_utilities/core/plugins/taskiq_plugins/__init__.py +31 -0
  35. fastapi_factory_utilities/core/plugins/taskiq_plugins/configs.py +12 -0
  36. fastapi_factory_utilities/core/plugins/taskiq_plugins/depends.py +51 -0
  37. fastapi_factory_utilities/core/plugins/taskiq_plugins/exceptions.py +13 -0
  38. fastapi_factory_utilities/core/plugins/taskiq_plugins/plugin.py +41 -0
  39. fastapi_factory_utilities/core/plugins/taskiq_plugins/schedulers.py +187 -0
  40. fastapi_factory_utilities/core/protocols.py +1 -54
  41. fastapi_factory_utilities/core/security/__init__.py +5 -0
  42. fastapi_factory_utilities/core/security/abstracts.py +42 -0
  43. fastapi_factory_utilities/core/security/jwt/__init__.py +41 -0
  44. fastapi_factory_utilities/core/security/jwt/configs.py +32 -0
  45. fastapi_factory_utilities/core/security/jwt/decoders.py +130 -0
  46. fastapi_factory_utilities/core/security/jwt/exceptions.py +23 -0
  47. fastapi_factory_utilities/core/security/jwt/objects.py +107 -0
  48. fastapi_factory_utilities/core/security/jwt/services.py +176 -0
  49. fastapi_factory_utilities/core/security/jwt/stores.py +43 -0
  50. fastapi_factory_utilities/core/security/jwt/types.py +9 -0
  51. fastapi_factory_utilities/core/security/jwt/verifiers.py +46 -0
  52. fastapi_factory_utilities/core/security/kratos.py +53 -33
  53. fastapi_factory_utilities/core/services/hydra/__init__.py +20 -0
  54. fastapi_factory_utilities/core/services/hydra/exceptions.py +15 -0
  55. fastapi_factory_utilities/core/services/hydra/objects.py +26 -0
  56. fastapi_factory_utilities/core/services/hydra/services.py +200 -0
  57. fastapi_factory_utilities/core/services/status/__init__.py +2 -2
  58. fastapi_factory_utilities/core/services/status/exceptions.py +1 -1
  59. fastapi_factory_utilities/core/utils/status.py +2 -1
  60. fastapi_factory_utilities/core/utils/yaml_reader.py +1 -1
  61. fastapi_factory_utilities/example/app.py +15 -5
  62. fastapi_factory_utilities/example/entities/books/__init__.py +1 -1
  63. fastapi_factory_utilities/example/models/books/__init__.py +1 -1
  64. {fastapi_factory_utilities-0.3.3.dist-info → fastapi_factory_utilities-0.8.2.dist-info}/METADATA +21 -15
  65. fastapi_factory_utilities-0.8.2.dist-info/RECORD +111 -0
  66. {fastapi_factory_utilities-0.3.3.dist-info → fastapi_factory_utilities-0.8.2.dist-info}/WHEEL +1 -1
  67. fastapi_factory_utilities/core/app/plugin_manager/__init__.py +0 -15
  68. fastapi_factory_utilities/core/app/plugin_manager/exceptions.py +0 -33
  69. fastapi_factory_utilities/core/app/plugin_manager/plugin_manager.py +0 -190
  70. fastapi_factory_utilities/core/plugins/example/__init__.py +0 -31
  71. fastapi_factory_utilities/core/plugins/httpx_plugin/__init__.py +0 -31
  72. fastapi_factory_utilities/core/security/jwt.py +0 -158
  73. fastapi_factory_utilities-0.3.3.dist-info/RECORD +0 -78
  74. {fastapi_factory_utilities-0.3.3.dist-info → fastapi_factory_utilities-0.8.2.dist-info}/entry_points.txt +0 -0
  75. {fastapi_factory_utilities-0.3.3.dist-info → fastapi_factory_utilities-0.8.2.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,111 @@
1
+ fastapi_factory_utilities/__main__.py,sha256=w8o9KpyHcxGyLHmTK8ixbIqJIsB3NbIGuAMY7OfnxrA,147
2
+ fastapi_factory_utilities/core/__init__.py,sha256=tt5a-MgeFt_oACkc9K5xl2rynIbca9DGqsKBDEqGzto,34
3
+ fastapi_factory_utilities/core/api/__init__.py,sha256=fAwgRcRry1nIyAL7CsCbpwR87n5tWnBWKEPH6QZCpp8,542
4
+ fastapi_factory_utilities/core/api/tags.py,sha256=3hQcTeW0FS78sPTJ2PB44dMDTSkoW-xKj7rrfKX2Lk0,154
5
+ fastapi_factory_utilities/core/api/v1/sys/__init__.py,sha256=mTXhpn3_KgQ1snt0-0PFmGvFr4n5srQRRADEdRSGFJM,345
6
+ fastapi_factory_utilities/core/api/v1/sys/health.py,sha256=LILUwfyqeBDlf4GSpkU_3bxMjZPCLanOBkMGDKtQufY,2867
7
+ fastapi_factory_utilities/core/api/v1/sys/readiness.py,sha256=xIY8pQLShU7KWRtlOUK5gTDyZ8aB1KBvLczC6boT-tg,1711
8
+ fastapi_factory_utilities/core/app/__init__.py,sha256=6Ee_zK-KzJWoOElsAnGdBz8giRJlhAPMaEzs0I3gvrA,596
9
+ fastapi_factory_utilities/core/app/application.py,sha256=fJTKgfqBWD1xzE7Y9ToZEBDrd1PxHtnZ7SHLmkS1S1M,4737
10
+ fastapi_factory_utilities/core/app/builder.py,sha256=gkmhGVYFu2zbW5sxWyh6Pn5ysdCIvn1_WqNJMKls54s,3820
11
+ fastapi_factory_utilities/core/app/config.py,sha256=MuV4G_M4QgZWYHoulusJLv_m4Qr2php-Cg9Jum4qkNA,7303
12
+ fastapi_factory_utilities/core/app/enums.py,sha256=X1upnaehYU0eHExXTde5xsH-pI9q7HZDNsOEF5PApdg,226
13
+ fastapi_factory_utilities/core/app/exceptions.py,sha256=tQDf0_4j5xgCbku7TL7JaZGs3_bjsWG2YLBCydQJpPw,664
14
+ fastapi_factory_utilities/core/app/fastapi_builder.py,sha256=7egWkS98nTiVBe2Bw5dQzDBryQCkz4w7gnY9HA24NFg,2855
15
+ fastapi_factory_utilities/core/exceptions.py,sha256=JeGUBiEC0dsS1uObP5SuJgUu_aCF5lCDdEFTL0Eq4W4,3221
16
+ fastapi_factory_utilities/core/plugins/__init__.py,sha256=7ctIv2Jx2uOUpgm8ITFRuZxHi6OXvlVS0VcbszVzvis,114
17
+ fastapi_factory_utilities/core/plugins/abstracts.py,sha256=p5iXmeOVD737G73I2keKV0Y-jLGQf2vYbTSR1LgrA14,1165
18
+ fastapi_factory_utilities/core/plugins/aiopika/__init__.py,sha256=flXanbhbjFaOsgx7jZvtW0bVLT_NXHypIPFO1tIHoCM,705
19
+ fastapi_factory_utilities/core/plugins/aiopika/abstract.py,sha256=TcvDwdaLV0UqFHQy6Sn3Y5Fp-1463dhL7VNB9LTKL5I,1682
20
+ fastapi_factory_utilities/core/plugins/aiopika/configs.py,sha256=BEPE8Ss7q_yCyuii4nywmIgh67iNLdhKxUm8tC0PdCY,3706
21
+ fastapi_factory_utilities/core/plugins/aiopika/depends.py,sha256=5xna571hCIdqzbo0t1CW-yzmJMSpEw_KUeJh5nBXjwQ,761
22
+ fastapi_factory_utilities/core/plugins/aiopika/exceptions.py,sha256=AkBKT8HVPpJDAntLNlOLp6lpQpKI-k8gxNzU24FsOF0,985
23
+ fastapi_factory_utilities/core/plugins/aiopika/exchange.py,sha256=MxASHfkIwFPAvIoRhGAXkzfsOPBAm5JfLkivcQtLvds,2501
24
+ fastapi_factory_utilities/core/plugins/aiopika/listener/__init__.py,sha256=LsTyu6kGoUm7c5OvSQTDJL7d8CG9TeARBHHVe_HGsHY,148
25
+ fastapi_factory_utilities/core/plugins/aiopika/listener/abstract.py,sha256=XGYfm3bZSJHG1B97tS9GqK3V9gZ3EpTEVcHyF0L9Xtc,2618
26
+ fastapi_factory_utilities/core/plugins/aiopika/message.py,sha256=y1tEhJWOXg1R7y7iA6F1VSZccsRPBB01IMYuU9BfikA,2885
27
+ fastapi_factory_utilities/core/plugins/aiopika/plugins.py,sha256=0lLYt-ZG3g3m8wi1tCCPEhTUBqaXuEJOwHEcrvP7FYc,3284
28
+ fastapi_factory_utilities/core/plugins/aiopika/publisher/__init__.py,sha256=MGGdygH72xHZ4QAwvbUZKQt-_mPzLmMxHyAACSNnZ_c,151
29
+ fastapi_factory_utilities/core/plugins/aiopika/publisher/abstract.py,sha256=PmIG5zlx-tFUAneHtbknR0Ik5flz8pMTzxcreY2hZ7s,2494
30
+ fastapi_factory_utilities/core/plugins/aiopika/queue.py,sha256=VivCbsIgqM36P_7VTZdOZ9kGop2m0kPCvDVQ1nEJCTo,2874
31
+ fastapi_factory_utilities/core/plugins/odm_plugin/__init__.py,sha256=JsVz4GBiZRmm4qpUD1-Wsg2tRXTn-VO5fU-W1whZo4E,683
32
+ fastapi_factory_utilities/core/plugins/odm_plugin/builder.py,sha256=MdO1D0C9LQpoqtNFqgPwSYedLzXR6PArhkoJw6wzykg,8761
33
+ fastapi_factory_utilities/core/plugins/odm_plugin/configs.py,sha256=5bVbtsLwJhuIvt8FCzOvk002G8qFmZumWkN75bPKatc,331
34
+ fastapi_factory_utilities/core/plugins/odm_plugin/depends.py,sha256=OcLsfTLzMBk_xFV6qsMy_-qFkiphEbbEuaHUooagxg8,730
35
+ fastapi_factory_utilities/core/plugins/odm_plugin/documents.py,sha256=4aQNrD26d0S542_LYmxxm07Q8SWzbGe3PCpho6iWY5Q,1102
36
+ fastapi_factory_utilities/core/plugins/odm_plugin/exceptions.py,sha256=acnKJB0lGAzDs-7-LjBap8shjP3iV1a7dw7ouPVF27o,551
37
+ fastapi_factory_utilities/core/plugins/odm_plugin/helpers.py,sha256=s9iEujDZbTmTb9FByJAVUzLkjQpsciQT9dytkeosKuE,463
38
+ fastapi_factory_utilities/core/plugins/odm_plugin/plugins.py,sha256=0jsLtw4NxZB6bDcBLBvWHqB-RELoewsSXTJdAOGunSY,6443
39
+ fastapi_factory_utilities/core/plugins/odm_plugin/repositories.py,sha256=GJ3ovlxzTpiJ2_XlgARtwn6j0SbQxxAray_r8QWvGok,11313
40
+ fastapi_factory_utilities/core/plugins/opentelemetry_plugin/__init__.py,sha256=xXHn5dUxhgdDDQMpTHf3voolzS0E3zE2RFbtFHJzb38,641
41
+ fastapi_factory_utilities/core/plugins/opentelemetry_plugin/builder.py,sha256=9npQImifYAbEg0lFG7KwZ8V78SNrPoaINgd8vKitdMw,12509
42
+ fastapi_factory_utilities/core/plugins/opentelemetry_plugin/configs.py,sha256=pMG9leMB7rtdkdGFLIxXflV7bf9epGrrYPt2N97KZcM,3750
43
+ fastapi_factory_utilities/core/plugins/opentelemetry_plugin/exceptions.py,sha256=CpsHayfQpP0zghN8y5PP6TBy-cXhHoNxBR--I86gAdE,327
44
+ fastapi_factory_utilities/core/plugins/opentelemetry_plugin/helpers.py,sha256=qpTIzX67orJz7vy6SBIwRs24omMBoToJkhpurZRjPuk,1533
45
+ fastapi_factory_utilities/core/plugins/opentelemetry_plugin/instruments/__init__.py,sha256=lMtdd1DSDrFcXggf0qMpB1RJC7aBqWMpOBXxC8-bqPY,3307
46
+ fastapi_factory_utilities/core/plugins/opentelemetry_plugin/plugins.py,sha256=v9W4bqEljcRgeSL8pf-4yZ7SGXOFmxVoljthvcLdy6Q,5356
47
+ fastapi_factory_utilities/core/plugins/taskiq_plugins/__init__.py,sha256=zLZh8HU-oY1FL977yXt51AV95p8WCBJY2cleVUU7w6M,850
48
+ fastapi_factory_utilities/core/plugins/taskiq_plugins/configs.py,sha256=O2rgFFWJNBUZ7ozfhM0Lj5Te-58qBNrQtw_N0mosAu4,304
49
+ fastapi_factory_utilities/core/plugins/taskiq_plugins/depends.py,sha256=XBxC1uUdMhYtqZDqmUEKI80y5L7mDoXXjN8dZjEvVAo,1602
50
+ fastapi_factory_utilities/core/plugins/taskiq_plugins/exceptions.py,sha256=1Xq_DqDFiQm2YU-2pGxziy-EeMhHiUsUwV0XdY_rQls,456
51
+ fastapi_factory_utilities/core/plugins/taskiq_plugins/plugin.py,sha256=gUlU2s7aLB2lkAAPdLqVc-BY16PessSYTGMGgNcKCSA,1602
52
+ fastapi_factory_utilities/core/plugins/taskiq_plugins/schedulers.py,sha256=82Yh7Y_MUxiWjrHPnsW_Ax-CWREAT6eC_bVl-HW5a3E,7208
53
+ fastapi_factory_utilities/core/protocols.py,sha256=w5FQqMAZ_OulG5hQWkoOapNSnxsjBPq4EjvWNXXdI_c,859
54
+ fastapi_factory_utilities/core/security/__init__.py,sha256=C_EnEZLMrhmAktNmSD80-0eqhs38AFnTmp-3UC7L0cg,119
55
+ fastapi_factory_utilities/core/security/abstracts.py,sha256=xas-gFTqWzxWMZNZx4qdtAzYW_XA8vH2N1wlBx0CuN8,1247
56
+ fastapi_factory_utilities/core/security/jwt/__init__.py,sha256=yj8OHMAxQyY_vv0CZtSQlBUSchGHomHif2qWPNnv21k,1107
57
+ fastapi_factory_utilities/core/security/jwt/configs.py,sha256=FaqBXdH3W1e95DrFl1QMqF6Teyp5ZvGq42EC8GCwGNM,1367
58
+ fastapi_factory_utilities/core/security/jwt/decoders.py,sha256=byj--PbnVbBHrZm6lWE2SH3XX37zPuWdujcLgogdB1U,4935
59
+ fastapi_factory_utilities/core/security/jwt/exceptions.py,sha256=9kxA4JLq9tfBfnwf-Wadpy9RiU8IjcijifqUS8KFhz0,642
60
+ fastapi_factory_utilities/core/security/jwt/objects.py,sha256=z4geVMnrZVPV0aaf-p0NIY4WHXhQox2UiKyHTHH5DOc,3986
61
+ fastapi_factory_utilities/core/security/jwt/services.py,sha256=8NAXI8RniXZAzNJzg8I9nisu5ch8fP83c9Tm-vdM4p8,7240
62
+ fastapi_factory_utilities/core/security/jwt/stores.py,sha256=LhAAputlPFBZyVMhm5blHKX6eKYo_GxrULANgYBWKio,1193
63
+ fastapi_factory_utilities/core/security/jwt/types.py,sha256=FO9fIDh67pK0iVzQGeH_M9AWRqCQQS2S7GqkHkZBQBo,288
64
+ fastapi_factory_utilities/core/security/jwt/verifiers.py,sha256=bf6nlm3dCk4Ej1ncB-gfIRRXc5I5np9IzAo1vDhwo1c,1292
65
+ fastapi_factory_utilities/core/security/kratos.py,sha256=Nfol2sIHlRSw5JdzzFsa89_C15lrLLQMeUd55QAGZDc,3193
66
+ fastapi_factory_utilities/core/services/hydra/__init__.py,sha256=b6q22Qiapcg4xzoWNI5_qyT5wwcRJ7hiK1ItGmspgW8,616
67
+ fastapi_factory_utilities/core/services/hydra/exceptions.py,sha256=ePMrfZturU2IVcxOebR0CbVKKqprce_fK-4UXbPPgNI,450
68
+ fastapi_factory_utilities/core/services/hydra/objects.py,sha256=2CeV_4zmwwpfbXQ0TM9B_UnNkZuIRXweFP_VALBo57c,601
69
+ fastapi_factory_utilities/core/services/hydra/services.py,sha256=JvRyAW7J5zG-r4hE6Y0VzeQZuOcwfjU4eGgo6k_bqJg,8235
70
+ fastapi_factory_utilities/core/services/kratos/__init__.py,sha256=DaC29-Ol0WR5vX56IHLGDXP9UrhISq0Juhg_sJTasw4,368
71
+ fastapi_factory_utilities/core/services/kratos/enums.py,sha256=ULJppowlZbOjdnUIXQyI4_nHmHZoNnv7-M1CYQBYXFY,220
72
+ fastapi_factory_utilities/core/services/kratos/exceptions.py,sha256=xAX01-lQvPpADgcwhB5YWSy1UqAxG38s2rlU9AJBJd8,472
73
+ fastapi_factory_utilities/core/services/kratos/objects.py,sha256=a0npt4Q6d9UbF0w3e6EvyKLwMWO2l639_dFjruA8_2c,980
74
+ fastapi_factory_utilities/core/services/kratos/services.py,sha256=RFKrME6M6omWiHORMBCSyvIG0BsimQaCfnmtsOdFfsg,3158
75
+ fastapi_factory_utilities/core/services/status/__init__.py,sha256=kkR2Xx-kbHb_QXkkBSUNIK5y_eNM4YCElFftBAooIY0,370
76
+ fastapi_factory_utilities/core/services/status/enums.py,sha256=IUxWAd0Ecknri4BqzaqoDRRhT_8LdcgtQcNqgNVDXGE,599
77
+ fastapi_factory_utilities/core/services/status/exceptions.py,sha256=nA22c9djJMTRh_uN2WD0iKs-wRLZ09hhdPEx3slt1Bw,840
78
+ fastapi_factory_utilities/core/services/status/health_calculator_strategies.py,sha256=p2KKJo-dq1j9iWHT0mvlBKtldH9m8l31aytLkUsb9nQ,1634
79
+ fastapi_factory_utilities/core/services/status/readiness_calculator_strategies.py,sha256=hA1LX2pSxva-7bVaQ0dw8NpTbl1ZWDtXd9xzqQUGUsI,1354
80
+ fastapi_factory_utilities/core/services/status/services.py,sha256=qtgYdnxNQMbb6q6G9uGasRO3lZcpiWNmw1padPkh6jA,8490
81
+ fastapi_factory_utilities/core/services/status/types.py,sha256=GJOGRra6NtpUS4q1cr4cdWR0BbIUtEwP7vQX-sXX5jQ,3297
82
+ fastapi_factory_utilities/core/utils/configs.py,sha256=qM0pCrsK8ZyfCoyova_VrhR4eUX3LSPCbWunGMWcSVg,2581
83
+ fastapi_factory_utilities/core/utils/importlib.py,sha256=DYcPo7K0s95WV5xxtucpufWsTj8Pxv25sWunDmmNUYI,797
84
+ fastapi_factory_utilities/core/utils/log.py,sha256=6V9CL3bQio4e47YxcSXM2JQRGhVxuBfmcEbcF4RtCfQ,6393
85
+ fastapi_factory_utilities/core/utils/status.py,sha256=ADdi4NzkJy0qNVC86tKV09wdpuPhuCKSrvYn9tzNVn8,1934
86
+ fastapi_factory_utilities/core/utils/uvicorn.py,sha256=XThylG-nOPVL00w6MIWGODnweoM7VxmpSFcyoPcmqns,2609
87
+ fastapi_factory_utilities/core/utils/yaml_reader.py,sha256=2XenSHqymZsgff70upPZtyx0-BsiUdTENKmrxaOBLeE,6100
88
+ fastapi_factory_utilities/example/__init__.py,sha256=LEKnPTBcgDyfHeOjlVxjK5lFdFqS-7-mHDuVuM2Jh_Y,206
89
+ fastapi_factory_utilities/example/__main__.py,sha256=Iwp_6rK7Lcv2F-XAKn6xjxQHOWjx2OjgwKAr91tfUfk,135
90
+ fastapi_factory_utilities/example/api/__init__.py,sha256=qI82eeSwVjR6jSkX1pxm8ALv9WPQ_iHurFY4G2K7VzE,554
91
+ fastapi_factory_utilities/example/api/books/__init__.py,sha256=zXARBnjywJwg1XsLbcixYWcHH4uC9mF-kbbX4P8cVgA,160
92
+ fastapi_factory_utilities/example/api/books/responses.py,sha256=21WeD6bdg0MCD_0vRHwmsL4W79iDcG9NnDLemXysc84,540
93
+ fastapi_factory_utilities/example/api/books/routes.py,sha256=bwg8Bhvoj9vx2SdwunzFS-Z3cHECtjl_yGdo8MfiGEM,1529
94
+ fastapi_factory_utilities/example/app.py,sha256=MInt71wnDEC9yqVJeT3hChj7DRmg7sI3Ta0KkfubdyU,2076
95
+ fastapi_factory_utilities/example/application.yaml,sha256=5xRyFSuMxmgZ5Mikai94UqKYJ7PxJp8omlXobTjv14M,485
96
+ fastapi_factory_utilities/example/entities/books/__init__.py,sha256=cpTMhLpenb359lOT9HHUv6DzKX8fKl4WCzcsB3ddk6Q,185
97
+ fastapi_factory_utilities/example/entities/books/entities.py,sha256=rLE01lE7U6WizrD5ZHMRwkynd8_dWF6DltBFH61f-Do,405
98
+ fastapi_factory_utilities/example/entities/books/enums.py,sha256=lXYUvhIkT1pi0teflMpnqeafeiBZMokyWxoFLgzV6a8,330
99
+ fastapi_factory_utilities/example/entities/books/types.py,sha256=7LYGPu-CcI3noIORJyIZlVF-CBugWPXEqgDzWrO3XmQ,1558
100
+ fastapi_factory_utilities/example/models/__init__.py,sha256=RJmp3R9bhbQv7n0WOlsHP65LqbEs_DjF9hzYKwYTRGo,22
101
+ fastapi_factory_utilities/example/models/books/__init__.py,sha256=IPS3rLLnZncV-VAxgsipxUD7l4r04ewo_Hx2Naj2lT0,181
102
+ fastapi_factory_utilities/example/models/books/document.py,sha256=lYJfMGr5GqEEsn7L--PFs75hC2q-jQx77wl7EhTrp5U,568
103
+ fastapi_factory_utilities/example/models/books/repository.py,sha256=7K63uAsSEGZ2EXqufU4Tc8KpymgXK8JX8WjAE2Sw8ok,387
104
+ fastapi_factory_utilities/example/services/books/__init__.py,sha256=Z06yNRoA7Zg3TGN-Q9rrvJg6Bbx-qJw661MVwukV6vQ,148
105
+ fastapi_factory_utilities/example/services/books/services.py,sha256=-x7d4hotUWLzWo5uImMjFmtNcSTHwWv2bfttIbYYKbA,5380
106
+ fastapi_factory_utilities/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
+ fastapi_factory_utilities-0.8.2.dist-info/METADATA,sha256=9Di7jC-8E-jnDnihtQw271-alJQBgyCo4VRO4BiHRbc,3741
108
+ fastapi_factory_utilities-0.8.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
109
+ fastapi_factory_utilities-0.8.2.dist-info/entry_points.txt,sha256=IK0VcBexXo4uXQmTrbfhhnnfq4GmXPRn0GBB8hzlsq4,101
110
+ fastapi_factory_utilities-0.8.2.dist-info/licenses/LICENSE,sha256=iO1nLzMMst6vEiqgSUrfrbetM7b0bvdzXhbed5tqG8o,1074
111
+ fastapi_factory_utilities-0.8.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.2
2
+ Generator: poetry-core 2.2.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,15 +0,0 @@
1
- """Provide PluginManager."""
2
-
3
- from .exceptions import (
4
- InvalidPluginError,
5
- PluginManagerError,
6
- PluginPreConditionNotMetError,
7
- )
8
- from .plugin_manager import PluginManager
9
-
10
- __all__: list[str] = [
11
- "PluginManager",
12
- "PluginManagerError",
13
- "InvalidPluginError",
14
- "PluginPreConditionNotMetError",
15
- ]
@@ -1,33 +0,0 @@
1
- """Provide the exceptions for the plugin manager."""
2
-
3
- from fastapi_factory_utilities.core.exceptions import FastAPIFactoryUtilitiesError
4
-
5
-
6
- class PluginManagerError(FastAPIFactoryUtilitiesError):
7
- """Generic plugin manager error."""
8
-
9
-
10
- class InvalidPluginError(PluginManagerError):
11
- """The plugin is invalid."""
12
-
13
- def __init__(self, plugin_name: str, message: str) -> None:
14
- """Instantiate the exception.
15
-
16
- Args:
17
- plugin_name (str): The plugin name.
18
- message (str): The message
19
- """
20
- super().__init__(message=f"Invalid plugin: {plugin_name}, {message}")
21
-
22
-
23
- class PluginPreConditionNotMetError(PluginManagerError):
24
- """The plugin pre-condition is not met."""
25
-
26
- def __init__(self, plugin_name: str, message: str) -> None:
27
- """Instantiate the exception.
28
-
29
- Args:
30
- plugin_name (str): The plugin name.
31
- message (str): The message
32
- """
33
- super().__init__(message=f"Plugin pre-condition not met: {plugin_name}, {message}")
@@ -1,190 +0,0 @@
1
- """Plugin manager.
2
-
3
- This module provides the plugin manager for the application.
4
-
5
- Objective:
6
- - Provide a way to manage plugins for the application.
7
- - The plugins are activated based on the configuration.
8
- - The plugins are checked for pre-conditions.
9
- - The plugins are loaded on application load.
10
- - The plugins are started on application startup.
11
- - The plugins are stopped on application shutdown.
12
- """
13
-
14
- from importlib import import_module
15
- from types import ModuleType
16
- from typing import Self
17
-
18
- from fastapi_factory_utilities.core.plugins import PluginsEnum, PluginState
19
- from fastapi_factory_utilities.core.protocols import (
20
- ApplicationAbstractProtocol,
21
- PluginProtocol,
22
- )
23
-
24
- from .exceptions import InvalidPluginError, PluginPreConditionNotMetError
25
-
26
-
27
- class PluginManager:
28
- """Plugin manager for the application."""
29
-
30
- DEFAULT_PLUGIN_PACKAGE: str = "fastapi_factory_utilities.core.plugins"
31
-
32
- @classmethod
33
- def _import_module(cls, name: str, package: str) -> ModuleType:
34
- """Import the module. This is a wrapper around the import_module function to be able to mock it in the tests.
35
-
36
- Args:
37
- name (str): The name of the module.
38
- package (str): The package of the module.
39
-
40
- Returns:
41
- ModuleType: The module.
42
-
43
- Raises:
44
- ImportError: If the module cannot be imported.
45
- ModuleNotFoundError: If the module is not found.
46
- """
47
- return import_module(name=f"{package}.{name}")
48
-
49
- @classmethod
50
- def _check_pre_conditions(
51
- cls, plugin_package: str, want_to_activate_plugins: list[PluginsEnum], application: ApplicationAbstractProtocol
52
- ) -> list[PluginProtocol]:
53
- """Check the pre-conditions for the plugins.
54
-
55
- Args:
56
- plugin_package (str): The package for the plugins.
57
- want_to_activate_plugins (list[PluginsEnum]): The plugins to activate.
58
- application (BaseApplicationProtocol): The application.
59
-
60
- Returns:
61
- list[PluginProtocol]: The activated plugins.
62
-
63
- Raises:
64
- InvalidPluginError: If the plugin is invalid.
65
- PluginPreConditionNotMetError: If the pre-conditions are not met.
66
- """
67
- plugins: list[PluginProtocol] = []
68
-
69
- for plugin_enum in want_to_activate_plugins:
70
-
71
- try:
72
- # Using a custom import function to be able to mock it in the tests.
73
- plugin_module: ModuleType = cls._import_module(name=plugin_enum.value, package=plugin_package)
74
- except (ImportError, ModuleNotFoundError) as import_error:
75
- # TODO: Later, if we introduce extra mecanism to manage dependencies,
76
- # we must handle a part of the error here. To be able to provide a better error message.
77
- # For now, we just raise the error.
78
- raise InvalidPluginError(
79
- plugin_name=plugin_enum.value, message="Error importing the plugin "
80
- ) from import_error
81
-
82
- if not isinstance(plugin_module, PluginProtocol):
83
- raise InvalidPluginError(
84
- plugin_name=plugin_enum.value, message="The plugin does not implement the PluginProtocol"
85
- )
86
-
87
- if not plugin_module.pre_conditions_check(application=application):
88
- raise PluginPreConditionNotMetError(
89
- plugin_name=plugin_enum.value, message="The pre-conditions are not met"
90
- )
91
-
92
- plugins.append(plugin_module)
93
-
94
- return plugins
95
-
96
- def __init__(self, activated: list[PluginsEnum] | None = None, plugin_package: str | None = None) -> None:
97
- """Instanciate the plugin manager."""
98
- self._plugin_package: str = plugin_package or self.DEFAULT_PLUGIN_PACKAGE
99
- self._plugins_wanted_to_be_activated: list[PluginsEnum] = activated or []
100
- self._activated_plugins: list[PluginProtocol] = []
101
- self._states: list[PluginState] = []
102
-
103
- def activate(self, plugin: PluginsEnum) -> Self:
104
- """Activate a plugin.
105
-
106
- Args:
107
- plugin (PluginsEnum): The plugin to activate.
108
-
109
- Returns:
110
- Self: The plugin manager.
111
- """
112
- self._plugins_wanted_to_be_activated.append(plugin)
113
-
114
- return self
115
-
116
- @property
117
- def states(self) -> list[PluginState]:
118
- """Get the states."""
119
- return self._states
120
-
121
- def add_application_context(self, application: ApplicationAbstractProtocol) -> Self:
122
- """Add the application context to the plugins.
123
-
124
- Args:
125
- application (BaseApplicationProtocol): The application.
126
-
127
- Returns:
128
- Self: The plugin manager.
129
- """
130
- self._application: ApplicationAbstractProtocol = application
131
-
132
- return self
133
-
134
- def add_states(self, states: list[PluginState]) -> Self:
135
- """Add the states to the plugin manager.
136
-
137
- Args:
138
- states (list[PluginState]): The states.
139
-
140
- Returns:
141
- Self: The plugin manager.
142
- """
143
- for state in states:
144
- self._states.append(state)
145
- return self
146
-
147
- def clear_states(self) -> Self:
148
- """Clear the states."""
149
- self._states = []
150
- return self
151
-
152
- def load(self) -> Self:
153
- """Load the plugins.
154
-
155
- Returns:
156
- Self: The plugin manager.
157
-
158
- Raises:
159
- InvalidPluginError: If the plugin is invalid.
160
- PluginPreConditionNotMetError: If the pre-conditions are not met.
161
-
162
- """
163
- # Remove duplicates.
164
- self._plugins_wanted_to_be_activated = list(set(self._plugins_wanted_to_be_activated))
165
- # Check the pre-conditions for the plugins.
166
- self._activated_plugins = self._check_pre_conditions(
167
- plugin_package=self._plugin_package,
168
- want_to_activate_plugins=self._plugins_wanted_to_be_activated,
169
- application=self._application,
170
- )
171
- # Load from the previous check.
172
- for plugin in self._activated_plugins:
173
- self.add_states(states=plugin.on_load(application=self._application) or [])
174
-
175
- return self
176
-
177
- async def trigger_startup(self) -> Self:
178
- """Trigger the startup of the plugins."""
179
- for plugin in self._activated_plugins:
180
- states: list[PluginState] | None = await plugin.on_startup(application=self._application)
181
- self.add_states(states=states or [])
182
-
183
- return self
184
-
185
- async def trigger_shutdown(self) -> Self:
186
- """Trigger the shutdown of the plugins."""
187
- for plugin in self._activated_plugins:
188
- await plugin.on_shutdown(application=self._application)
189
-
190
- return self
@@ -1,31 +0,0 @@
1
- """Example Plugin Module."""
2
-
3
- from typing import TYPE_CHECKING
4
-
5
- if TYPE_CHECKING:
6
- from fastapi_factory_utilities.core.plugins import PluginState
7
- from fastapi_factory_utilities.core.protocols import ApplicationAbstractProtocol
8
-
9
-
10
- def pre_conditions_check(application: "ApplicationAbstractProtocol") -> bool: # pylint: disable=unused-argument
11
- """Check the pre-conditions for the example plugin."""
12
- return True
13
-
14
-
15
- def on_load(
16
- application: "ApplicationAbstractProtocol", # pylint: disable=unused-argument
17
- ) -> list["PluginState"] | None:
18
- """Actions to perform on load for the example plugin."""
19
- return
20
-
21
-
22
- async def on_startup(
23
- application: "ApplicationAbstractProtocol", # pylint: disable=unused-argument
24
- ) -> list["PluginState"] | None:
25
- """Actions to perform on startup for the example plugin."""
26
- return
27
-
28
-
29
- async def on_shutdown(application: "ApplicationAbstractProtocol") -> None: # pylint: disable=unused-argument
30
- """Actions to perform on shutdown for the example plugin."""
31
- return
@@ -1,31 +0,0 @@
1
- """Httpx Plugin Module."""
2
-
3
- from typing import TYPE_CHECKING
4
-
5
- if TYPE_CHECKING:
6
- from fastapi_factory_utilities.core.plugins import PluginState
7
- from fastapi_factory_utilities.core.protocols import ApplicationAbstractProtocol
8
-
9
-
10
- def pre_conditions_check(application: "ApplicationAbstractProtocol") -> bool: # pylint: disable=unused-argument
11
- """Check the pre-conditions for the example plugin."""
12
- return True
13
-
14
-
15
- def on_load(
16
- application: "ApplicationAbstractProtocol", # pylint: disable=unused-argument
17
- ) -> list["PluginState"] | None:
18
- """Actions to perform on load for the example plugin."""
19
- return
20
-
21
-
22
- async def on_startup(
23
- application: "ApplicationAbstractProtocol", # pylint: disable=unused-argument
24
- ) -> list["PluginState"] | None:
25
- """Actions to perform on startup for the example plugin."""
26
- return
27
-
28
-
29
- async def on_shutdown(application: "ApplicationAbstractProtocol") -> None: # pylint: disable=unused-argument
30
- """Actions to perform on shutdown for the example plugin."""
31
- return
@@ -1,158 +0,0 @@
1
- """Provides security-related functions for the API."""
2
-
3
- from asyncio import Task, TaskGroup
4
- from http import HTTPStatus
5
- from typing import Any, ClassVar, NewType, cast
6
-
7
- import jwt
8
- import pydantic
9
- from fastapi import Request
10
- from fastapi.exceptions import HTTPException
11
- from pydantic import BaseModel
12
-
13
- Scope = NewType("Scope", str)
14
-
15
-
16
- class JWTBearerDecoded(BaseModel):
17
- """JWT bearer token decoded."""
18
-
19
- model_config: ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
20
- arbitrary_types_allowed=True,
21
- extra="forbid",
22
- frozen=True,
23
- )
24
-
25
- scopes: list[str] | None = None
26
-
27
-
28
- class JWTBearerAuthentication:
29
- """JWT Bearer Authentication.
30
-
31
- This class is used to authenticate users using JWT tokens.
32
- It extracts the token from the request, decodes it, and verifies its validity.
33
- """
34
-
35
- def __init__(self, scopes: list[Scope] | None = None, jwt_raw: str | None = None) -> None:
36
- """Initialize the OAuth2 class.
37
-
38
- Args:
39
- scopes (SecurityScopes): Security scopes for the OAuth2.
40
- jwt_raw (str): JWT token to be used for authentication.
41
- """
42
- self.jwt_raw: str | None = jwt_raw
43
- self.scopes: list[Scope] | None = scopes
44
-
45
- def _extract_raw_token(self, request: Request) -> str:
46
- """Extract the raw token from the request.
47
-
48
- Args:
49
- request (Request): FastAPI request object.
50
-
51
- Returns:
52
- str: Raw token.
53
-
54
- Raises:
55
- HTTPException: If the token is missing or invalid.
56
- """
57
- try:
58
- authorization_header: str | None = request.headers.get("Authorization")
59
- except (AttributeError, KeyError) as e:
60
- raise HTTPException(status_code=HTTPStatus.UNAUTHORIZED, detail="Missing Credentials") from e
61
-
62
- if not authorization_header:
63
- raise HTTPException(status_code=HTTPStatus.UNAUTHORIZED, detail="Missing Credentials")
64
-
65
- if not authorization_header.startswith("Bearer "):
66
- raise HTTPException(status_code=HTTPStatus.UNAUTHORIZED, detail="Invalid Credentials")
67
-
68
- return authorization_header.split(sep=" ")[1]
69
-
70
- async def _decode_jwt(self, jwt_raw: str) -> JWTBearerDecoded:
71
- """Decode the JWT token.
72
-
73
- Args:
74
- jwt_raw (str): Raw JWT token.
75
-
76
- Returns:
77
- JWTBearerDecoded: Decoded JWT token.
78
-
79
- Raises:
80
- HTTPException: If the token is invalid or expired.
81
- """
82
- try:
83
- jwt_decoded: dict[str, Any] = cast(
84
- dict[str, Any],
85
- jwt.decode(
86
- jwt=jwt_raw,
87
- algorithms=["HS256", "RS256"],
88
- options={"verify_signature": True},
89
- ),
90
- )
91
- return JWTBearerDecoded(**jwt_decoded)
92
- except jwt.ExpiredSignatureError as e:
93
- raise HTTPException(status_code=HTTPStatus.UNAUTHORIZED, detail="Token expired") from e
94
- except jwt.InvalidTokenError as e:
95
- raise HTTPException(status_code=HTTPStatus.UNAUTHORIZED, detail="Invalid token") from e
96
- except pydantic.ValidationError as e:
97
- raise HTTPException(status_code=HTTPStatus.UNAUTHORIZED, detail=f"Invalid token: {e.json()}") from e
98
-
99
- async def _verify(self, jwt_raw: str) -> None:
100
- """Verify the JWT token.
101
-
102
- Args:
103
- jwt_raw (str): Raw JWT token.
104
- """
105
- pass
106
-
107
- def _has_scope(self, jwt_decoded: JWTBearerDecoded) -> None:
108
- """Check if the JWT token has the required scope.
109
-
110
- Args:
111
- jwt_decoded (JWTBearerDecoded): Decoded JWT token.
112
-
113
- """
114
- # Just Authentication (no scopes, no authorization)
115
- if not self.scopes:
116
- return
117
- # JWT without scopes (no authorization)
118
- if not jwt_decoded.scopes:
119
- raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail="Unauthorized")
120
- # Check if all required scopes are present
121
- if not all(scope in jwt_decoded.scopes for scope in (self.scopes or [])):
122
- raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail="Unauthorized")
123
-
124
- # All scopes are valid (authorization)
125
- return
126
-
127
- async def __call__(self, request: Request | None = None) -> JWTBearerDecoded:
128
- """Call the JWT bearer authentication.
129
-
130
- Args:
131
- request (Request): FastAPI request object.
132
-
133
- Returns:
134
- JWTBearerDecoded: Decoded JWT token.
135
-
136
- Raises:
137
- HTTPException: If the token is missing or invalid.
138
- """
139
- # Ensure that the jwt will be provided
140
- # by the request or by the jwt parameter
141
- if self.jwt_raw is None and request is None:
142
- raise HTTPException(status_code=HTTPStatus.UNAUTHORIZED, detail="Missing Credentials")
143
- jwt_raw: str = (
144
- self.jwt_raw
145
- if self.jwt_raw is not None
146
- else self._extract_raw_token(request=request) # type: ignore[arg-type]
147
- )
148
- # Execute the io bound and cpu bound tasks in parallel
149
- async with TaskGroup() as tg:
150
- # TODO: Can be disabled by configuration (for operation purposes)
151
- # Ensure that the jwt is not revoked or expired
152
- tg.create_task(self._verify(jwt_raw=jwt_raw), name="verify_jwt")
153
- # Ensure that the jwt is not altered or expired
154
- task_decode: Task[Any] = tg.create_task(self._decode_jwt(jwt_raw=jwt_raw), name="decode_jwt")
155
- # Scope Validation
156
- jwt_decoded: JWTBearerDecoded = task_decode.result()
157
- self._has_scope(jwt_decoded=jwt_decoded)
158
- return jwt_decoded