dmart 1.4.33__py3-none-any.whl → 1.4.36__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 (298) hide show
  1. dmart/__init__.py +8 -0
  2. dmart/alembic/README +1 -0
  3. dmart/alembic/notes.txt +11 -0
  4. dmart/alembic/script.py.mako +28 -0
  5. dmart/alembic.ini +117 -0
  6. dmart/config.env.sample +27 -0
  7. dmart/conftest.py +13 -0
  8. dmart/curl.sh +196 -0
  9. dmart.py → dmart/dmart.py +47 -40
  10. dmart/hypercorn_config.toml +3 -0
  11. dmart/info.json +1 -0
  12. dmart/login_creds.sh +7 -0
  13. dmart/login_creds.sh.sample +7 -0
  14. main.py → dmart/main.py +4 -1
  15. dmart/manifest.sh +12 -0
  16. dmart/plugins/action_log/config.json +13 -0
  17. dmart/plugins/admin_notification_sender/config.json +13 -0
  18. dmart/plugins/ldap_manager/config.json +12 -0
  19. dmart/plugins/ldap_manager/dmart.schema +146 -0
  20. dmart/plugins/ldap_manager/slapd.conf +53 -0
  21. dmart/plugins/local_notification/config.json +13 -0
  22. dmart/plugins/realtime_updates_notifier/config.json +12 -0
  23. dmart/plugins/redis_db_update/config.json +13 -0
  24. dmart/plugins/resource_folders_creation/config.json +12 -0
  25. dmart/plugins/system_notification_sender/config.json +13 -0
  26. dmart/plugins/update_access_controls/config.json +12 -0
  27. dmart/publish.sh +57 -0
  28. dmart/pylint.sh +16 -0
  29. dmart/pyrightconfig.json +7 -0
  30. dmart/redis_connections.sh +13 -0
  31. dmart/reload.sh +56 -0
  32. dmart/run.sh +3 -0
  33. dmart/test_utils.py +34 -0
  34. {dmart-1.4.33.dist-info → dmart-1.4.36.dist-info}/METADATA +1 -1
  35. dmart-1.4.36.dist-info/RECORD +285 -0
  36. dmart-1.4.36.dist-info/entry_points.txt +2 -0
  37. dmart-1.4.36.dist-info/top_level.txt +1 -0
  38. dmart-1.4.33.dist-info/RECORD +0 -264
  39. dmart-1.4.33.dist-info/entry_points.txt +0 -2
  40. dmart-1.4.33.dist-info/top_level.txt +0 -24
  41. pytests/api_user_models_erros_test.py +0 -16
  42. pytests/api_user_models_requests_test.py +0 -98
  43. pytests/archive_test.py +0 -72
  44. pytests/base_test.py +0 -300
  45. pytests/get_settings_test.py +0 -14
  46. pytests/json_to_db_migration_test.py +0 -237
  47. pytests/service_test.py +0 -26
  48. pytests/test_info.py +0 -55
  49. pytests/test_status.py +0 -15
  50. utils/__init__.py +0 -0
  51. {alembic → dmart/alembic}/__init__.py +0 -0
  52. {alembic → dmart/alembic}/env.py +0 -0
  53. {alembic → dmart/alembic}/scripts/__init__.py +0 -0
  54. {alembic → dmart/alembic}/scripts/calculate_checksums.py +0 -0
  55. {alembic → dmart/alembic}/scripts/migration_f7a4949eed19.py +0 -0
  56. {alembic → dmart/alembic}/versions/0f3d2b1a7c21_add_authz_materialized_views.py +0 -0
  57. {alembic → dmart/alembic}/versions/10d2041b94d4_last_checksum_history.py +0 -0
  58. {alembic → dmart/alembic}/versions/1cf4e1ee3cb8_ext_permission_with_filter_fields_values.py +0 -0
  59. {alembic → dmart/alembic}/versions/26bfe19b49d4_rm_failedloginattempts.py +0 -0
  60. {alembic → dmart/alembic}/versions/3c8bca2219cc_add_otp_table.py +0 -0
  61. {alembic → dmart/alembic}/versions/6675fd9dfe42_remove_unique_from_sessions_table.py +0 -0
  62. {alembic → dmart/alembic}/versions/71bc1df82e6a_adding_user_last_login_at.py +0 -0
  63. {alembic → dmart/alembic}/versions/74288ccbd3b5_initial.py +0 -0
  64. {alembic → dmart/alembic}/versions/7520a89a8467_rm_activesession_table.py +0 -0
  65. {alembic → dmart/alembic}/versions/848b623755a4_make_created_nd_updated_at_required.py +0 -0
  66. {alembic → dmart/alembic}/versions/8640dcbebf85_add_notes_to_users.py +0 -0
  67. {alembic → dmart/alembic}/versions/91c94250232a_adding_fk_on_owner_shortname.py +0 -0
  68. {alembic → dmart/alembic}/versions/98ecd6f56f9a_ext_meta_with_owner_group_shortname.py +0 -0
  69. {alembic → dmart/alembic}/versions/9aae9138c4ef_indexing_created_at_updated_at.py +0 -0
  70. {alembic → dmart/alembic}/versions/__init__.py +0 -0
  71. {alembic → dmart/alembic}/versions/b53f916b3f6d_json_to_jsonb.py +0 -0
  72. {alembic → dmart/alembic}/versions/eb5f1ec65156_adding_user_locked_to_device.py +0 -0
  73. {alembic → dmart/alembic}/versions/f7a4949eed19_adding_query_policies_to_meta.py +0 -0
  74. {api → dmart/api}/__init__.py +0 -0
  75. {api → dmart/api}/info/__init__.py +0 -0
  76. {api → dmart/api}/info/router.py +0 -0
  77. {api → dmart/api}/managed/__init__.py +0 -0
  78. {api → dmart/api}/managed/router.py +0 -0
  79. {api → dmart/api}/managed/utils.py +0 -0
  80. {api → dmart/api}/public/__init__.py +0 -0
  81. {api → dmart/api}/public/router.py +0 -0
  82. {api → dmart/api}/qr/__init__.py +0 -0
  83. {api → dmart/api}/qr/router.py +0 -0
  84. {api → dmart/api}/user/__init__.py +0 -0
  85. {api → dmart/api}/user/model/__init__.py +0 -0
  86. {api → dmart/api}/user/model/errors.py +0 -0
  87. {api → dmart/api}/user/model/requests.py +0 -0
  88. {api → dmart/api}/user/model/responses.py +0 -0
  89. {api → dmart/api}/user/router.py +0 -0
  90. {api → dmart/api}/user/service.py +0 -0
  91. /bundler.py → /dmart/bundler.py +0 -0
  92. {config → dmart/config}/__init__.py +0 -0
  93. {config → dmart/config}/channels.json +0 -0
  94. {config → dmart/config}/notification.json +0 -0
  95. {cxb → dmart/cxb}/__init__.py +0 -0
  96. {cxb/client → dmart/cxb}/assets/@codemirror-Rn7_6DkE.js +0 -0
  97. {cxb/client → dmart/cxb}/assets/@edraj-CS4NwVbD.js +0 -0
  98. {cxb/client → dmart/cxb}/assets/@floating-ui-BwwcF-xh.js +0 -0
  99. {cxb/client → dmart/cxb}/assets/@formatjs-yKEsAtjs.js +0 -0
  100. {cxb/client → dmart/cxb}/assets/@fortawesome-DRW1UCdr.js +0 -0
  101. {cxb/client → dmart/cxb}/assets/@jsonquerylang-laKNoFFq.js +0 -0
  102. {cxb/client → dmart/cxb}/assets/@lezer-za4Q-8Ew.js +0 -0
  103. {cxb/client → dmart/cxb}/assets/@marijn-DXwl3gUT.js +0 -0
  104. {cxb/client → dmart/cxb}/assets/@popperjs-l0sNRNKZ.js +0 -0
  105. {cxb/client → dmart/cxb}/assets/@replit--ERk53eB.js +0 -0
  106. {cxb/client → dmart/cxb}/assets/@roxi-CGMFK4i8.js +0 -0
  107. {cxb/client → dmart/cxb}/assets/@typewriter-cCzskkIv.js +0 -0
  108. {cxb/client → dmart/cxb}/assets/@zerodevx-BlBZjKxu.js +0 -0
  109. {cxb/client → dmart/cxb}/assets/@zerodevx-CVEpe6WZ.css +0 -0
  110. {cxb/client → dmart/cxb}/assets/BreadCrumbLite-DAhOx38v.js +0 -0
  111. {cxb/client → dmart/cxb}/assets/EntryRenderer-25YDhRen.js +0 -0
  112. {cxb/client → dmart/cxb}/assets/EntryRenderer-DXytdFp9.css +0 -0
  113. {cxb/client → dmart/cxb}/assets/ListView-BpAycA2h.js +0 -0
  114. {cxb/client → dmart/cxb}/assets/ListView-U8of-_c-.css +0 -0
  115. {cxb/client → dmart/cxb}/assets/Prism--hMplq-p.js +0 -0
  116. {cxb/client → dmart/cxb}/assets/Prism-Uh6uStUw.css +0 -0
  117. {cxb/client → dmart/cxb}/assets/Table2Cols-BsbwicQm.js +0 -0
  118. {cxb/client → dmart/cxb}/assets/_..-BvT6vdHa.css +0 -0
  119. {cxb/client → dmart/cxb}/assets/_...404_-fuLH_rX9.js +0 -0
  120. {cxb/client → dmart/cxb}/assets/_...fallback_-Ba_NLmAE.js +0 -0
  121. {cxb/client → dmart/cxb}/assets/_module-Bfk8MiCs.js +0 -0
  122. {cxb/client → dmart/cxb}/assets/_module-CEW0D5oI.js +0 -0
  123. {cxb/client → dmart/cxb}/assets/_module-Dgq0ZVtz.js +0 -0
  124. {cxb/client → dmart/cxb}/assets/ajv-Cpj98o6Y.js +0 -0
  125. {cxb/client → dmart/cxb}/assets/axios-CG2WSiiR.js +0 -0
  126. {cxb/client → dmart/cxb}/assets/clsx-B-dksMZM.js +0 -0
  127. {cxb/client → dmart/cxb}/assets/codemirror-wrapped-line-indent-DPhKvljI.js +0 -0
  128. {cxb/client → dmart/cxb}/assets/compare-C3AjiGFR.js +0 -0
  129. {cxb/client → dmart/cxb}/assets/compute-scroll-into-view-Bl8rNFhg.js +0 -0
  130. {cxb/client → dmart/cxb}/assets/consolite-DlCuI0F9.js +0 -0
  131. {cxb/client → dmart/cxb}/assets/crelt-C8TCjufn.js +0 -0
  132. {cxb/client → dmart/cxb}/assets/date-fns-l0sNRNKZ.js +0 -0
  133. {cxb/client → dmart/cxb}/assets/deepmerge-rn4rBaHU.js +0 -0
  134. {cxb/client → dmart/cxb}/assets/dmart_services-AL6-IdDE.js +0 -0
  135. {cxb/client → dmart/cxb}/assets/downloadFile-D08i0YDh.js +0 -0
  136. {cxb/client → dmart/cxb}/assets/easy-signal-BiPFIK3O.js +0 -0
  137. {cxb/client → dmart/cxb}/assets/esm-env-rsSWfq8L.js +0 -0
  138. {cxb/client → dmart/cxb}/assets/export-OF_rTiXu.js +0 -0
  139. {cxb/client → dmart/cxb}/assets/fast-deep-equal-l0sNRNKZ.js +0 -0
  140. {cxb/client → dmart/cxb}/assets/fast-diff-C-IidNf4.js +0 -0
  141. {cxb/client → dmart/cxb}/assets/fast-uri-l0sNRNKZ.js +0 -0
  142. {cxb/client → dmart/cxb}/assets/flowbite-svelte-BLvjb-sa.js +0 -0
  143. {cxb/client → dmart/cxb}/assets/flowbite-svelte-CD54FDqW.css +0 -0
  144. {cxb/client → dmart/cxb}/assets/flowbite-svelte-icons-BI8GVhw_.js +0 -0
  145. {cxb/client → dmart/cxb}/assets/github-slugger-CQ4oX9Ud.js +0 -0
  146. {cxb/client → dmart/cxb}/assets/global-igKv-1g9.js +0 -0
  147. {cxb/client → dmart/cxb}/assets/hookar-BMRD9G9H.js +0 -0
  148. {cxb/client → dmart/cxb}/assets/immutable-json-patch-DtRO2E_S.js +0 -0
  149. {cxb/client → dmart/cxb}/assets/import-1vE3gBat.js +0 -0
  150. {cxb/client → dmart/cxb}/assets/index-B-eTh-ZX.js +0 -0
  151. {cxb/client → dmart/cxb}/assets/index-BVyxzKtH.js +0 -0
  152. {cxb/client → dmart/cxb}/assets/index-BdeNM69f.js +0 -0
  153. {cxb/client → dmart/cxb}/assets/index-C6cPO4op.js +0 -0
  154. {cxb/client → dmart/cxb}/assets/index-CC-A1ipE.js +0 -0
  155. {cxb/client → dmart/cxb}/assets/index-CTxJ-lDp.js +0 -0
  156. {cxb/client → dmart/cxb}/assets/index-Cd-F5j_k.js +0 -0
  157. {cxb/client → dmart/cxb}/assets/index-D742rwaM.js +0 -0
  158. {cxb/client → dmart/cxb}/assets/index-DTfhnhwd.js +0 -0
  159. {cxb/client → dmart/cxb}/assets/index-DdXRK7n9.js +0 -0
  160. {cxb/client → dmart/cxb}/assets/index-DtiCmB4o.js +0 -0
  161. {cxb/client → dmart/cxb}/assets/index-NBrXBlLA.css +0 -0
  162. {cxb/client → dmart/cxb}/assets/index-ac-Buu_H.js +0 -0
  163. {cxb/client → dmart/cxb}/assets/index-iYkH7C67.js +0 -0
  164. {cxb/client → dmart/cxb}/assets/info-B986lRiM.js +0 -0
  165. {cxb/client → dmart/cxb}/assets/intl-messageformat-Dc5UU-HB.js +0 -0
  166. {cxb/client → dmart/cxb}/assets/jmespath-l0sNRNKZ.js +0 -0
  167. {cxb/client → dmart/cxb}/assets/json-schema-traverse-l0sNRNKZ.js +0 -0
  168. {cxb/client → dmart/cxb}/assets/json-source-map-DRgZidqy.js +0 -0
  169. {cxb/client → dmart/cxb}/assets/jsonpath-plus-l0sNRNKZ.js +0 -0
  170. {cxb/client → dmart/cxb}/assets/jsonrepair-B30Dx381.js +0 -0
  171. {cxb/client → dmart/cxb}/assets/lodash-es-DZVAA2ox.js +0 -0
  172. {cxb/client → dmart/cxb}/assets/marked-DKjyhwJX.js +0 -0
  173. {cxb/client → dmart/cxb}/assets/marked-gfm-heading-id-U5zO829x.js +0 -0
  174. {cxb/client → dmart/cxb}/assets/marked-mangle-CDMeiHC6.js +0 -0
  175. {cxb/client → dmart/cxb}/assets/memoize-one-BdPwpGay.js +0 -0
  176. {cxb/client → dmart/cxb}/assets/natural-compare-lite-Bg2Xcf-o.js +0 -0
  177. {cxb/client → dmart/cxb}/assets/pagination-svelte-D5CyoiE_.js +0 -0
  178. {cxb/client → dmart/cxb}/assets/pagination-svelte-v10nAbbM.css +0 -0
  179. {cxb/client → dmart/cxb}/assets/plantuml-encoder-C47mzt9T.js +0 -0
  180. {cxb/client → dmart/cxb}/assets/prismjs-DTUiLGJu.js +0 -0
  181. {cxb/client → dmart/cxb}/assets/profile-BUf-tKMe.js +0 -0
  182. {cxb/client → dmart/cxb}/assets/query-CNmXTsgf.js +0 -0
  183. {cxb/client → dmart/cxb}/assets/queryHelpers-C9iBWwqe.js +0 -0
  184. {cxb/client → dmart/cxb}/assets/scroll-into-view-if-needed-KR58zyjF.js +0 -0
  185. {cxb/client → dmart/cxb}/assets/spaces-0oyGvpii.js +0 -0
  186. {cxb/client → dmart/cxb}/assets/style-mod-Bs6eFhZE.js +0 -0
  187. {cxb/client → dmart/cxb}/assets/svelte-B2XmcTi_.js +0 -0
  188. {cxb/client → dmart/cxb}/assets/svelte-awesome-COLlx0DN.css +0 -0
  189. {cxb/client → dmart/cxb}/assets/svelte-awesome-DhnMA6Q_.js +0 -0
  190. {cxb/client → dmart/cxb}/assets/svelte-datatables-net-CY7LBj6I.js +0 -0
  191. {cxb/client → dmart/cxb}/assets/svelte-floating-ui-BlS3sOAQ.js +0 -0
  192. {cxb/client → dmart/cxb}/assets/svelte-i18n-CT2KkQaN.js +0 -0
  193. {cxb/client → dmart/cxb}/assets/svelte-jsoneditor-BzfX6Usi.css +0 -0
  194. {cxb/client → dmart/cxb}/assets/svelte-jsoneditor-CUGSvWId.js +0 -0
  195. {cxb/client → dmart/cxb}/assets/svelte-select-CegQKzqH.css +0 -0
  196. {cxb/client → dmart/cxb}/assets/svelte-select-CjHAt_85.js +0 -0
  197. {cxb/client → dmart/cxb}/assets/tailwind-merge-CJvxXMcu.js +0 -0
  198. {cxb/client → dmart/cxb}/assets/tailwind-variants-Cj20BoQ3.js +0 -0
  199. {cxb/client → dmart/cxb}/assets/toast-B9WDyfyI.js +0 -0
  200. {cxb/client → dmart/cxb}/assets/tslib-pJfR_DrR.js +0 -0
  201. {cxb/client → dmart/cxb}/assets/typewriter-editor-DkTVIJdm.js +0 -0
  202. {cxb/client → dmart/cxb}/assets/user-DeK_NB5v.js +0 -0
  203. {cxb/client → dmart/cxb}/assets/vanilla-picker-l5rcX3cq.js +0 -0
  204. {cxb/client → dmart/cxb}/assets/w3c-keyname-Vcq4gwWv.js +0 -0
  205. {cxb/client → dmart/cxb}/config.json +0 -0
  206. {cxb/client → dmart/cxb}/config.sample.json +0 -0
  207. {cxb/client → dmart/cxb}/favicon.ico +0 -0
  208. {cxb/client → dmart/cxb}/favicon.png +0 -0
  209. {cxb/client → dmart/cxb}/index.html +0 -0
  210. {data_adapters → dmart/data_adapters}/__init__.py +0 -0
  211. {data_adapters → dmart/data_adapters}/adapter.py +0 -0
  212. {data_adapters → dmart/data_adapters}/base_data_adapter.py +0 -0
  213. {data_adapters → dmart/data_adapters}/file/__init__.py +0 -0
  214. {data_adapters → dmart/data_adapters}/file/adapter.py +0 -0
  215. {data_adapters → dmart/data_adapters}/file/adapter_helpers.py +0 -0
  216. {data_adapters → dmart/data_adapters}/file/archive.py +0 -0
  217. {data_adapters → dmart/data_adapters}/file/create_index.py +0 -0
  218. {data_adapters → dmart/data_adapters}/file/create_users_folders.py +0 -0
  219. {data_adapters → dmart/data_adapters}/file/custom_validations.py +0 -0
  220. {data_adapters → dmart/data_adapters}/file/drop_index.py +0 -0
  221. {data_adapters → dmart/data_adapters}/file/health_check.py +0 -0
  222. {data_adapters → dmart/data_adapters}/file/redis_services.py +0 -0
  223. {data_adapters → dmart/data_adapters}/helpers.py +0 -0
  224. {data_adapters → dmart/data_adapters}/sql/__init__.py +0 -0
  225. {data_adapters → dmart/data_adapters}/sql/adapter.py +0 -0
  226. {data_adapters → dmart/data_adapters}/sql/adapter_helpers.py +0 -0
  227. {data_adapters → dmart/data_adapters}/sql/create_tables.py +0 -0
  228. {data_adapters → dmart/data_adapters}/sql/create_users_folders.py +0 -0
  229. {data_adapters → dmart/data_adapters}/sql/db_to_json_migration.py +0 -0
  230. {data_adapters → dmart/data_adapters}/sql/health_check_sql.py +0 -0
  231. {data_adapters → dmart/data_adapters}/sql/json_to_db_migration.py +0 -0
  232. {data_adapters → dmart/data_adapters}/sql/update_query_policies.py +0 -0
  233. /data_generator.py → /dmart/data_generator.py +0 -0
  234. /get_settings.py → /dmart/get_settings.py +0 -0
  235. {languages → dmart/languages}/__init__.py +0 -0
  236. {languages → dmart/languages}/arabic.json +0 -0
  237. {languages → dmart/languages}/english.json +0 -0
  238. {languages → dmart/languages}/kurdish.json +0 -0
  239. {languages → dmart/languages}/loader.py +0 -0
  240. /migrate.py → /dmart/migrate.py +0 -0
  241. {models → dmart/models}/__init__.py +0 -0
  242. {models → dmart/models}/api.py +0 -0
  243. {models → dmart/models}/core.py +0 -0
  244. {models → dmart/models}/enums.py +0 -0
  245. /password_gen.py → /dmart/password_gen.py +0 -0
  246. {plugins → dmart/plugins}/__init__.py +0 -0
  247. {plugins → dmart/plugins}/action_log/__init__.py +0 -0
  248. {plugins → dmart/plugins}/action_log/plugin.py +0 -0
  249. {plugins → dmart/plugins}/admin_notification_sender/__init__.py +0 -0
  250. {plugins → dmart/plugins}/admin_notification_sender/plugin.py +0 -0
  251. {plugins → dmart/plugins}/ldap_manager/__init__.py +0 -0
  252. {plugins → dmart/plugins}/ldap_manager/plugin.py +0 -0
  253. {plugins → dmart/plugins}/local_notification/__init__.py +0 -0
  254. {plugins → dmart/plugins}/local_notification/plugin.py +0 -0
  255. {plugins → dmart/plugins}/realtime_updates_notifier/__init__.py +0 -0
  256. {plugins → dmart/plugins}/realtime_updates_notifier/plugin.py +0 -0
  257. {plugins → dmart/plugins}/redis_db_update/__init__.py +0 -0
  258. {plugins → dmart/plugins}/redis_db_update/plugin.py +0 -0
  259. {plugins → dmart/plugins}/resource_folders_creation/__init__.py +0 -0
  260. {plugins → dmart/plugins}/resource_folders_creation/plugin.py +0 -0
  261. {plugins → dmart/plugins}/system_notification_sender/__init__.py +0 -0
  262. {plugins → dmart/plugins}/system_notification_sender/plugin.py +0 -0
  263. {plugins → dmart/plugins}/update_access_controls/__init__.py +0 -0
  264. {plugins → dmart/plugins}/update_access_controls/plugin.py +0 -0
  265. /run_notification_campaign.py → /dmart/run_notification_campaign.py +0 -0
  266. /scheduled_notification_handler.py → /dmart/scheduled_notification_handler.py +0 -0
  267. /schema_migration.py → /dmart/schema_migration.py +0 -0
  268. /schema_modulate.py → /dmart/schema_modulate.py +0 -0
  269. /set_admin_passwd.py → /dmart/set_admin_passwd.py +0 -0
  270. /sync.py → /dmart/sync.py +0 -0
  271. {pytests → dmart/utils}/__init__.py +0 -0
  272. {utils → dmart/utils}/access_control.py +0 -0
  273. {utils → dmart/utils}/async_request.py +0 -0
  274. {utils → dmart/utils}/exporter.py +0 -0
  275. {utils → dmart/utils}/firebase_notifier.py +0 -0
  276. {utils → dmart/utils}/generate_email.py +0 -0
  277. {utils → dmart/utils}/helpers.py +0 -0
  278. {utils → dmart/utils}/hypercorn_config.py +0 -0
  279. {utils → dmart/utils}/internal_error_code.py +0 -0
  280. {utils → dmart/utils}/jwt.py +0 -0
  281. {utils → dmart/utils}/logger.py +0 -0
  282. {utils → dmart/utils}/middleware.py +0 -0
  283. {utils → dmart/utils}/notification.py +0 -0
  284. {utils → dmart/utils}/password_hashing.py +0 -0
  285. {utils → dmart/utils}/plugin_manager.py +0 -0
  286. {utils → dmart/utils}/query_policies_helper.py +0 -0
  287. {utils → dmart/utils}/regex.py +0 -0
  288. {utils → dmart/utils}/repository.py +0 -0
  289. {utils → dmart/utils}/router_helper.py +0 -0
  290. {utils → dmart/utils}/settings.py +0 -0
  291. {utils → dmart/utils}/sms_notifier.py +0 -0
  292. {utils → dmart/utils}/social_sso.py +0 -0
  293. {utils → dmart/utils}/templates/activation.html.j2 +0 -0
  294. {utils → dmart/utils}/templates/reminder.html.j2 +0 -0
  295. {utils → dmart/utils}/ticket_sys_utils.py +0 -0
  296. {utils → dmart/utils}/web_notifier.py +0 -0
  297. /websocket.py → /dmart/websocket.py +0 -0
  298. {dmart-1.4.33.dist-info → dmart-1.4.36.dist-info}/WHEEL +0 -0
dmart/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ import os
2
+ import sys
3
+
4
+ # This allows internal imports to work without prefixing 'dmart.'
5
+ # when the package is installed in a bundled way.
6
+ _pkg_dir = os.path.dirname(__file__)
7
+ if _pkg_dir not in sys.path:
8
+ sys.path.insert(0, _pkg_dir)
dmart/alembic/README ADDED
@@ -0,0 +1 @@
1
+ Generic single-database configuration.
@@ -0,0 +1,11 @@
1
+ # 1st : Make sure in alembic.ini to have proper db config for sqlalchemy.url
2
+
3
+
4
+ # To establish the base for a previously created database run the following
5
+
6
+ CREATE TABLE alembic_version (
7
+ version_num VARCHAR(32) NOT NULL,
8
+ CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
9
+ );
10
+
11
+ INSERT INTO alembic_version (version_num) VALUES ('74288ccbd3b5') RETURNING alembic_version.version_num;
@@ -0,0 +1,28 @@
1
+ """${message}
2
+
3
+ Revision ID: ${up_revision}
4
+ Revises: ${down_revision | comma,n}
5
+ Create Date: ${create_date}
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+ from alembic import op
11
+ import sqlalchemy as sa
12
+ import sqlmodel
13
+ import sqlmodel.sql.sqltypes
14
+ ${imports if imports else ""}
15
+
16
+ # revision identifiers, used by Alembic.
17
+ revision: str = ${repr(up_revision)}
18
+ down_revision: Union[str, None] = ${repr(down_revision)}
19
+ branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
20
+ depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
21
+
22
+
23
+ def upgrade() -> None:
24
+ ${upgrades if upgrades else "pass"}
25
+
26
+
27
+ def downgrade() -> None:
28
+ ${downgrades if downgrades else "pass"}
dmart/alembic.ini ADDED
@@ -0,0 +1,117 @@
1
+ # A generic, single database configuration.
2
+
3
+ [alembic]
4
+ # path to migration scripts
5
+ # Use forward slashes (/) also on windows to provide an os agnostic path
6
+ script_location = alembic
7
+
8
+ # template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
9
+ # Uncomment the line below if you want the files to be prepended with date and time
10
+ # see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
11
+ # for all available tokens
12
+ # file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
13
+
14
+ # sys.path path, will be prepended to sys.path if present.
15
+ # defaults to the current working directory.
16
+ prepend_sys_path = .
17
+
18
+ # timezone to use when rendering the date within the migration file
19
+ # as well as the filename.
20
+ # If specified, requires the python>=3.9 or backports.zoneinfo library.
21
+ # Any required deps can installed by adding `alembic[tz]` to the pip requirements
22
+ # string value is passed to ZoneInfo()
23
+ # leave blank for localtime
24
+ # timezone =
25
+
26
+ # max length of characters to apply to the "slug" field
27
+ # truncate_slug_length = 40
28
+
29
+ # set to 'true' to run the environment during
30
+ # the 'revision' command, regardless of autogenerate
31
+ # revision_environment = false
32
+
33
+ # set to 'true' to allow .pyc and .pyo files without
34
+ # a source .py file to be detected as revisions in the
35
+ # versions/ directory
36
+ # sourceless = false
37
+
38
+ # version location specification; This defaults
39
+ # to alembic/versions. When using multiple version
40
+ # directories, initial revisions must be specified with --version-path.
41
+ # The path separator used here should be the separator specified by "version_path_separator" below.
42
+ # version_locations = %(here)s/bar:%(here)s/bat:alembic/versions
43
+
44
+ # version path separator; As mentioned above, this is the character used to split
45
+ # version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.
46
+ # If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas.
47
+ # Valid values for version_path_separator are:
48
+ #
49
+ # version_path_separator = :
50
+ # version_path_separator = ;
51
+ # version_path_separator = space
52
+ # version_path_separator = newline
53
+ version_path_separator = os # Use os.pathsep. Default configuration used for new projects.
54
+
55
+ # set to 'true' to search source files recursively
56
+ # in each "version_locations" directory
57
+ # new in Alembic version 1.10
58
+ # recursive_version_locations = false
59
+
60
+ # the output encoding used when revision files
61
+ # are written from script.py.mako
62
+ # output_encoding = utf-8
63
+
64
+ sqlalchemy.url = postgresql+asyncpg://dmart:somepassword@localhost:5432/dmart
65
+
66
+
67
+ [post_write_hooks]
68
+ # post_write_hooks defines scripts or Python functions that are run
69
+ # on newly generated revision scripts. See the documentation for further
70
+ # detail and examples
71
+
72
+ # format using "black" - use the console_scripts runner, against the "black" entrypoint
73
+ # hooks = black
74
+ # black.type = console_scripts
75
+ # black.entrypoint = black
76
+ # black.options = -l 79 REVISION_SCRIPT_FILENAME
77
+
78
+ # lint with attempts to fix using "ruff" - use the exec runner, execute a binary
79
+ # hooks = ruff
80
+ # ruff.type = exec
81
+ # ruff.executable = %(here)s/.venv/bin/ruff
82
+ # ruff.options = --fix REVISION_SCRIPT_FILENAME
83
+
84
+ # Logging configuration
85
+ [loggers]
86
+ keys = root,sqlalchemy,alembic
87
+
88
+ [handlers]
89
+ keys = console
90
+
91
+ [formatters]
92
+ keys = generic
93
+
94
+ [logger_root]
95
+ level = WARNING
96
+ handlers = console
97
+ qualname =
98
+
99
+ [logger_sqlalchemy]
100
+ level = WARNING
101
+ handlers =
102
+ qualname = sqlalchemy.engine
103
+
104
+ [logger_alembic]
105
+ level = INFO
106
+ handlers =
107
+ qualname = alembic
108
+
109
+ [handler_console]
110
+ class = StreamHandler
111
+ args = (sys.stderr,)
112
+ level = NOTSET
113
+ formatter = generic
114
+
115
+ [formatter_generic]
116
+ format = %(levelname)-5.5s [%(name)s] %(message)s
117
+ datefmt = %H:%M:%S
@@ -0,0 +1,27 @@
1
+ APP_URL="http://0.0.0.0:8282"
2
+ JWT_SECRET="ABC"
3
+ JWT_ALGORITHM="HS256"
4
+ LOG_FILE="../../logs/dmart.ljson.log"
5
+ WS_LOG_FILE="../../logs/websocket.ljson.log"
6
+ SPACES_FOLDER="../sample/spaces/"
7
+ BASE_PATH=""
8
+ MANAGEMENT_SPACE="management"
9
+ LISTENING_HOST="0.0.0.0"
10
+ LISTENING_PORT=8282
11
+ LOCK_PERIOD=180
12
+ mock_smtp_api=True
13
+ mock_smpp_api=True
14
+ IS_REGISTRABLE=True
15
+ smpp_auth_key=
16
+ REDIS_HOST="127.0.0.1"
17
+ REDIS_PASSWORD=""
18
+ REDIS_PORT=6379
19
+ mock_otp_code="123456"
20
+ ACTIVE_DATA_DB="file" # allowed values: file, sql
21
+ # DATABASE_DRIVER="postgresql+asyncpg"
22
+ DATABASE_DRIVER="postgresql+psycopg"
23
+ DATABASE_USERNAME="dmart"
24
+ DATABASE_PASSWORD="somepassword"
25
+ DATABASE_HOST="localhost"
26
+ DATABASE_PORT=5432
27
+ DATABASE_NAME="dmart"
dmart/conftest.py ADDED
@@ -0,0 +1,13 @@
1
+ from main import app
2
+ from httpx import AsyncClient, ASGITransport
3
+ import pytest
4
+
5
+ @pytest.fixture(scope="session")
6
+ def anyio_backend():
7
+ return "asyncio"
8
+
9
+
10
+ @pytest.fixture(scope="session")
11
+ async def client():
12
+ async with AsyncClient(transport=ASGITransport(app=app, raise_app_exceptions=False), base_url="http://localhost",) as client:
13
+ yield client
dmart/curl.sh ADDED
@@ -0,0 +1,196 @@
1
+ #!/bin/bash
2
+
3
+ API_URL="http://127.0.0.1:8282"
4
+ CT="Content-Type: application/json"
5
+ SHORTNAME="97326c47"
6
+
7
+ source ./login_creds.sh
8
+ declare -i RESULT=0
9
+
10
+ # echo -n -e "Create user: \t\t"
11
+ # CREATE=$(jq -c -n --arg shortname "$SHORTNAME" --arg msisdn "$MSISDN" --arg password "$PASSWORD" '{resource_type: "user", subpath: "users", shortname: $shortname, attributes:{password: $password, msisdn:$msisdn, invitation: "hello"}}')
12
+ # curl -s -H "$CT" -d "$CREATE" "${API_URL}/user/create?invitation=$INVITATION" | jq .status
13
+
14
+ # #echo -n -e "Send OTP using MSISDN: \t"
15
+ # #curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"msisdn": "'${MSISDN}'"}' ${API_URL}/user/otp-request | jq .
16
+
17
+ # #echo -n -e "Confirm OTP using MSISDN: \t"
18
+ # #curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"msisdn": "'${MSISDN}'", "code": "'${OTP_CODE}'"}' ${API_URL}/user/otp-confirm | jq .
19
+
20
+ echo -n -e "Login with admin: \t\t" >&2
21
+ AUTH_TOKEN=$(curl -i -s -H "$CT" -d "$SUPERMAN" ${API_URL}/user/login | grep set-cookie | sed 's/^[^=]*=\(.*\); Http.*$/\1/g')
22
+ RESULT+=$?
23
+ echo "$AUTH_TOKEN" | cut -d '.' -f 1 | base64 -d | jq .typ >&2
24
+ RESULT+=$?
25
+ # curl -s -c mycookies.jar -H "$CT" -d "$LOGIN" ${API_URL}/user/login | jq .status
26
+
27
+ echo -n -e "Get profile: \t\t\t" >&2
28
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" $API_URL/user/profile | jq .status | tee /dev/stderr | grep -q "success"
29
+ RESULT+=$?
30
+
31
+ echo -n -e "Create user from admin: \t" >&2
32
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"management","request_type":"create","records":[{"resource_type":"user","subpath":"users","shortname":"distributor","attributes":{"roles": ["test_role"], "msisdn": "7895412658", "email": "dummy_unqiue@gmail.com"}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
33
+ RESULT+=$?
34
+
35
+ echo -n -e "update user from admin: \t" >&2
36
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"management","request_type":"update","records":[{"resource_type":"user","subpath":"users","shortname":"distributor","attributes":{"roles": ["test_role"], "msisdn": "7895412658", "email": "dummy_unqiue@gmail.com"}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
37
+ RESULT+=$?
38
+
39
+ echo -n -e "Verify Email/msisdn admin side: " >&2
40
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"management","request_type":"update","records":[{"resource_type":"user","subpath":"users","shortname":"distributor","attributes":{"is_email_verified":true,"is_msisdn_verified":true}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
41
+ RESULT+=$?
42
+
43
+ echo -n -e "Reset user from admin side\t" >&2
44
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d $'{"shortname": "distributor"}' ${API_URL}/user/reset | jq .status | tee /dev/stderr | grep -q "success"
45
+ RESULT+=$?
46
+
47
+ echo -n -e "Delete user from admin: \t" >&2
48
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"management","request_type":"delete","records":[{"resource_type":"user","subpath":"users","shortname":"distributor","attributes":{}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
49
+ RESULT+=$?
50
+
51
+ #echo -n -e "Health check: \t\t\t"
52
+ #curl -s -H "Authorization: Bearer $AUTH_TOKEN" ${API_URL}/managed/health/management | jq .status | tee /dev/stderr | grep -q "success"
53
+ #RESULT+=$?
54
+
55
+ echo -n -e "Collection Contacts Query: \t" >&2
56
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"type": "search","space_name": "management","subpath": "users","retrieve_json_payload": true,"search": "","retrieve_attachments": true}' ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
57
+ RESULT+=$?
58
+
59
+ # echo -n -e "Saved Queries for Report"
60
+ # curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"attributes": {"limit": 10,"offcet": 0,"key_search": ""},"resource_type": "content","shortname": "info_service","subpath": "/reports"}' ${API_URL}/managed/excute/query/aftersales | jq
61
+
62
+ echo -n -e "JQ filter: \t\t\t" >&2
63
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"type": "search","space_name": "applications","subpath": "/","filter_types": ["folder"],"search": "applications","jq_filter" : ".[].shortname_title"}' ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
64
+ RESULT+=$?
65
+
66
+ echo -n -e "Reload security: \t\t" >&2
67
+ curl -s -b mycookies.jar -H "$CT" -H "Authorization: Bearer $AUTH_TOKEN" ${API_URL}/managed/reload-security-data | jq .status | tee /dev/stderr | grep -q "success"
68
+ RESULT+=$?
69
+
70
+ echo -n -e "Delete dummy space: \t\t" >&2
71
+ DELETE=$(jq -c -n '{ "space_name": "dummy", "request_type": "delete", "records": [{ "resource_type": "space", "subpath": "/", "shortname": "dummy","attributes": {} } ]}')
72
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$DELETE" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
73
+ # RESULT+=$?
74
+
75
+ echo -n -e "Create a new space (dummy): \t" >&2
76
+ CREATE=$(jq -c -n '{ "space_name": "dummy", "request_type": "create", "records": [{ "resource_type": "space", "subpath": "/", "shortname": "dummy","attributes": {"hide_space": true} } ]}')
77
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$CREATE" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
78
+ RESULT+=$?
79
+
80
+ echo -n -e "Query spaces: \t\t\t" >&2
81
+ RECORD=$(jq -c -n '{space_name: "dummy", type: "spaces", subpath: "/"}')
82
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$RECORD" ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
83
+ RESULT+=$?
84
+
85
+ echo -n -e "Create TLF folder: \t\t" >&2
86
+ REQUEST=$(jq -c -n '{ space_name: "dummy", request_type:"create", records: [{resource_type: "folder", subpath: "/", shortname: "myfolder", attributes:{tags: ["one","two"], "description": {"en": "dummy","ar": "dummy","ku": "dummy"},"displayname" : {"en": "en","ar": "ar", "ku":"ku"}, "payload": { "content_type": "json", "schema_shortname": "folder_rendering", "body": { "shortname_title": "Schema Shortname", "content_schema_shortnames": ["meta_schema"], "index_attributes": [ { "key": "shortname", "name": "Schema Shortname" }], "allow_create": false, "allow_update": false, "allow_delete": false, "use_media": false }}}}]}')
87
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
88
+ RESULT+=$?
89
+ SUBPATH="posts"
90
+
91
+ echo -n -e "Create posts folder: \t\t" >&2
92
+ REQUEST=$(jq -c -n --arg subpath "/" --arg shortname "posts" '{ space_name: "dummy", request_type:"create", records: [{resource_type: "folder", subpath: "/", shortname: "posts", attributes:{tags: ["one","two"], is_active: true, "description": {"en": "dummy","ar": "dummy","ku": "dummy"},"displayname" : {"en": "en","ar": "ar", "ku":"ku"}, "payload": { "content_type": "json", "schema_shortname": "folder_rendering", "body": { "shortname_title": "Shortname", "content_schema_shortnames": ["content"], "index_attributes": [ { "key": "shortname", "name": "Shortname" }], "allow_create": false, "allow_update": false, "allow_delete": false, "use_media": false }}}}]}')
93
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
94
+ RESULT+=$?
95
+
96
+ echo -n -e "Create workflow folder: \t" >&2
97
+ REQUEST=$(jq -c -n '{ space_name: "dummy", request_type:"create", records: [{resource_type: "folder", subpath: "/", shortname: "workflows", attributes:{ "description": {"en": "dummy","ar": "dummy","ku": "dummy"},"displayname" : {"en": "en","ar": "ar", "ku":"ku"}, "payload": { "content_type": "json", "schema_shortname": "folder_rendering", "body": { "shortname_title": "Schema Shortname", "content_schema_shortnames": ["meta_schema"], "index_attributes": [ { "key": "shortname", "name": "Schema Shortname" }], "allow_create": false, "allow_update": false, "allow_delete": false, "use_media": false }}}}]}')
98
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
99
+ RESULT+=$?
100
+ SUBPATH="posts"
101
+
102
+ echo -n -e "Query folders: \t\t\t" >&2
103
+ REQUEST=$(jq -c -n '{ space_name: "dummy", type:"subpath", subpath: "/", }')
104
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
105
+ RESULT+=$?
106
+
107
+ echo -n -e "Create Schema for workflows: \t" >&2
108
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' 'request_type: "create"' -F 'request_record=@"../sample/test/createschemawork.json"' -F 'payload_file=@"../sample/test/workflow_schema.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
109
+ RESULT+=$?
110
+
111
+ echo -n -e "Create content for workflows: \t" >&2
112
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' -F 'request_record=@"../sample/test/createticket.json"' -F 'payload_file=@"../sample/test/ticket_workflow.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
113
+ RESULT+=$?
114
+
115
+ echo -n -e "Create Schema for ticket: \t" >&2
116
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' -F 'request_record=@"../sample/test/createschema.json"' -F 'payload_file=@"../sample/test/schema.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
117
+ RESULT+=$?
118
+
119
+ # echo -n -e "Create QR Code: \t\t" >&2
120
+ # TEMP_FILE=$(mktemp)
121
+ # curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" --output $TEMP_FILE ${API_URL}/qr/generate/ticket/dummy/myfolder/an_example # | jq .status | tee /dev/stderr | grep -q "success"
122
+ # RESULT+=$?
123
+ # file -ib $TEMP_FILE >&2
124
+ # rm -f $TEMP_FILE
125
+ #curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F ${API_URL}/qr/generate/ticket/dummy/myfolder/an_example | jq .status | tee /dev/stderr | grep -q "success"
126
+
127
+ echo -n -e "Create ticket: \t\t\t" >&2
128
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' 'request_type: "create"' -F 'request_record=@"../sample/test/ticketcontent.json"' -F 'payload_file=@"../sample/test/ticketbody.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
129
+ RESULT+=$?
130
+
131
+ echo -n -e "Move ticket: \t\t\t" >&2
132
+ curl -s -H "$CT" -H "Authorization: Bearer $AUTH_TOKEN" -d '{"space_name": "dummy","request_type": "move","records": [{"resource_type": "ticket","subpath": "/myfolder","shortname": "an_example","attributes": {"src_subpath": "/myfolder","src_shortname": "an_example","dest_subpath": "/myfolder_new","dest_shortname": "an_example_new", "src_space_name": "dummy", "dest_space_name": "dummy", "is_active": true}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
133
+
134
+ echo -n -e "Move back to old: \t\t" >&2
135
+ curl -s -H "$CT" -H "Authorization: Bearer $AUTH_TOKEN" -d '{"space_name": "dummy","request_type": "move","records": [{"resource_type": "ticket","subpath": "/myfolder_new","shortname": "an_example_new","attributes": {"src_subpath": "/myfolder_new","src_shortname": "an_example_new","dest_subpath": "/myfolder","dest_shortname": "an_example", "src_space_name": "dummy", "dest_space_name": "dummy","is_active": true}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
136
+
137
+ echo -n -e "Lock ticket: \t\t\t" >&2
138
+ curl -s -X "PUT" -H "Authorization: Bearer $AUTH_TOKEN" ${API_URL}/managed/lock/ticket/dummy/myfolder/an_example | jq .status | tee /dev/stderr | grep -q "success"
139
+
140
+ echo -n -e "Unlock ticket: \t\t\t" >&2
141
+ curl -s -X "DELETE" -H "Authorization: Bearer $AUTH_TOKEN" ${API_URL}/managed/lock/dummy/myfolder/an_example | jq .status | tee /dev/stderr | grep -q "success"
142
+
143
+ echo -n -e "Create Content: \t\t" >&2
144
+ REQUEST=$(jq -c -n --arg subpath "$SUBPATH" --arg shortname "$SHORTNAME" '{ space_name: "dummy", request_type:"create", records: [{resource_type: "content", subpath: $subpath, shortname: $shortname, attributes:{payload: {body: {"message": "this content created from curl request for dummying"}, content_type: "json"}, tags: ["one","two"], "description": {"en": "dummy","ar": "dummy","ku": "dummy"},"displayname" : {"en": "en","ar": "ar", "ku":"ku"}}}]}')
145
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
146
+ RESULT+=$?
147
+
148
+ echo -n -e "Create content: \t\t" >&2
149
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' -F 'request_record=@"../sample/test/createcontent.json"' -F 'payload_file=@"../sample/test/data.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
150
+ RESULT+=$?
151
+
152
+ echo -n -e "Comment on content: \t\t"
153
+ COMMENT_SHORTNAME="greatcomment"
154
+ COMMENT_SUBPATH="$SUBPATH/$SHORTNAME"
155
+ RECORD=$(jq -c -n --arg subpath "$COMMENT_SUBPATH" --arg shortname "$COMMENT_SHORTNAME" '{ space_name: "dummy", request_type:"create", records: [{resource_type: "comment", subpath: $subpath, shortname: $shortname, attributes:{body: "A comment insdie the content resource"}}]}')
156
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$RECORD" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
157
+
158
+ echo -n -e "Managed CSV: \t\t\t" >&2
159
+ curl -s -H "accept: text/csv" -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"dummy","subpath":"myfolder","type":"subpath","retrieve_json_payload":true,"limit":5}' ${API_URL}/managed/csv | wc -l | xargs -IN test N -ge 2 > /dev/null && echo '"success"' #| xargs -0 echo | jq .status | tee /dev/stderr | grep -q "success"
160
+ RESULT+=$?
161
+
162
+ echo -n -e "Update content: \t\t" >&2
163
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" --data-binary "@../sample/test/updatecontent.json" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
164
+ RESULT+=$?
165
+
166
+ echo -n -e "Upload attachment: \t\t" >&2
167
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' -F 'request_record=@"../sample/test/createmedia.json"' -F 'payload_file=@"../sample/test/logo.jpeg"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
168
+ RESULT+=$?
169
+
170
+ echo -n -e "Delete content: \t\t" >&2
171
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" --data-binary "@../sample/test/deletecontent.json" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
172
+ RESULT+=$?
173
+
174
+ echo -n -e "Query content: \t\t\t" >&2
175
+ RECORD=$(jq -c -n --arg subpath "$SUBPATH" '{space_name: "dummy", type: "subpath", subpath: $subpath}')
176
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$RECORD" ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
177
+ RESULT+=$?
178
+
179
+ #echo -n -e "reload redis data: \t\t"
180
+ #RECORD=$(jq -c -n --arg subpath "$SUBPATH" '{space_name: "dummy", for_schemas: ["dummy_schema"]}')
181
+ #curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$RECORD" ${API_URL}/managed/reload-redis-data | jq .status | tee /dev/stderr | grep -q "success"
182
+
183
+ #echo -n -e "Delete admin: \t\t"
184
+ #curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{}' $API_URL/user/delete | jq .status | tee /dev/stderr | grep -q "success"
185
+
186
+ echo -n -e "Delete dummy space: \t\t" >&2
187
+ DELETE=$(jq -c -n '{ "space_name": "dummy", "request_type": "delete", "records": [{ "resource_type": "space", "subpath": "/", "shortname": "dummy","attributes": {} } ]}')
188
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$DELETE" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
189
+ RESULT+=$?
190
+
191
+ echo -n -e "Server manifest: " >&2
192
+ curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" ${API_URL}/info/manifest | jq . >&2
193
+ RESULT+=$?
194
+
195
+ echo "Sum of exit codes = $RESULT" >&2
196
+ exit $RESULT
@@ -40,7 +40,6 @@ commands = """ server
40
40
  archive
41
41
  json_to_db
42
42
  db_to_json
43
- migrate
44
43
  help
45
44
  version
46
45
  info
@@ -256,14 +255,14 @@ def hypercorn_main() -> int:
256
255
  type=int,
257
256
  )
258
257
  args = parser.parse_args(sys.argv[1:])
259
-
260
- config = Config()
261
- if args.config and os.path.exists(args.config):
262
- config = Config.from_toml(args.config)
263
- else:
258
+
259
+ if args.config == "hypercorn_config.toml" and not os.path.exists(args.config):
260
+ config = Config()
264
261
  config.backlog = 2000
265
262
  config.workers = 1
266
263
  config.bind = ["localhost:8282"]
264
+ else:
265
+ config = Config.from_toml(args.config)
267
266
 
268
267
  config.application_path = args.application
269
268
 
@@ -356,9 +355,9 @@ def hypercorn_main() -> int:
356
355
  port = 8282
357
356
  host = "127.0.0.1"
358
357
 
359
- if len(config.bind) > 0:
358
+ if len(args.binds) > 0:
360
359
  try:
361
- bind_parts = config.bind[0].split(":")
360
+ bind_parts = args.binds[0].split(":")
362
361
  if len(bind_parts) == 2:
363
362
  host = bind_parts[0]
364
363
  port = int(bind_parts[1])
@@ -368,6 +367,9 @@ def hypercorn_main() -> int:
368
367
  print(e)
369
368
  pass
370
369
 
370
+ if host == "0.0.0.0":
371
+ host = "127.0.0.1"
372
+
371
373
  url = f"http://{host}:{port}{settings.cxb_url}/"
372
374
 
373
375
  def open_browser():
@@ -381,38 +383,43 @@ def hypercorn_main() -> int:
381
383
 
382
384
 
383
385
  def main():
384
- args = sys.argv[1:]
385
- if len(args) == 0:
386
+ if not os.path.exists("config.env"):
387
+ print("Notice: config.env not found, using default settings from settings.py")
388
+
389
+ sys.argv = sys.argv[1:]
390
+ if len(sys.argv) == 0:
386
391
  print("You must provide a command to run:")
387
392
  print(commands)
388
393
  sys.exit(1)
389
394
 
390
- match args[0]:
395
+ match sys.argv[0]:
391
396
  case "hyper":
392
397
  hypercorn_main()
393
398
  case "server" | "serve":
394
399
  open_cxb = False
395
- if "--open-cxb" in args:
400
+ if "--open-cxb" in sys.argv:
396
401
  open_cxb = True
397
- args.remove("--open-cxb")
402
+ sys.argv.remove("--open-cxb")
398
403
 
399
- if "--cxb-config" in args:
400
- idx = args.index("--cxb-config")
401
- if idx + 1 < len(args):
402
- os.environ["DMART_CXB_CONFIG"] = args[idx + 1]
403
- args.pop(idx + 1)
404
- args.pop(idx)
404
+ if "--cxb-config" in sys.argv:
405
+ idx = sys.argv.index("--cxb-config")
406
+ if idx + 1 < len(sys.argv):
407
+ os.environ["DMART_CXB_CONFIG"] = sys.argv[idx + 1]
408
+ sys.argv.pop(idx + 1)
409
+ sys.argv.pop(idx)
405
410
 
406
411
  if open_cxb:
407
- url = f"http://{settings.listening_host}:{settings.listening_port}/cxb/"
412
+ host = settings.listening_host
413
+ if host == "0.0.0.0":
414
+ host = "127.0.0.1"
415
+ url = f"http://{host}:{settings.listening_port}{settings.cxb_url}/"
408
416
  def open_browser():
409
- time.sleep(1)
417
+ time.sleep(2)
410
418
  webbrowser.open(url)
411
419
 
412
420
  import threading
413
421
  threading.Thread(target=open_browser, daemon=True).start()
414
422
 
415
- sys.argv = [sys.argv[0]] + args
416
423
  asyncio.run(server())
417
424
  case "health-check":
418
425
  parser = argparse.ArgumentParser(
@@ -423,9 +430,9 @@ def main():
423
430
  parser.add_argument("-s", "--space", help="hit the target space or pass (all) to make the full health check")
424
431
  parser.add_argument("-m", "--schemas", nargs="*", help="hit the target schema inside the space")
425
432
 
426
- args_parsed = parser.parse_args(args[1:])
433
+ args = parser.parse_args()
427
434
  before_time = time.time()
428
- asyncio.run(health_check(args_parsed.type, args_parsed.space, args_parsed.schemas))
435
+ asyncio.run(health_check(args.type, args.space, args.schemas))
429
436
  print(f'total time: {"{:.2f}".format(time.time() - before_time)} sec')
430
437
  case "create-index":
431
438
  parser = argparse.ArgumentParser(
@@ -443,9 +450,9 @@ def main():
443
450
  "--flushall", action='store_true', help="FLUSHALL data on Redis"
444
451
  )
445
452
 
446
- args_parsed = parser.parse_args(args[1:])
453
+ args = parser.parse_args()
447
454
 
448
- asyncio.run(create_index(args_parsed.space, args_parsed.schemas, args_parsed.subpaths, args_parsed.flushall))
455
+ asyncio.run(create_index(args.space, args.schemas, args.subpaths, args.flushall))
449
456
  case "export":
450
457
  parser = argparse.ArgumentParser()
451
458
  parser.add_argument(
@@ -462,24 +469,24 @@ def main():
462
469
  "--since",
463
470
  help="Export entries created/updated since the provided timestamp",
464
471
  )
465
- args_parsed = parser.parse_args(args[1:])
472
+ args = parser.parse_args()
466
473
  since = None
467
474
  output_path = ""
468
- if args_parsed.output:
469
- output_path = args_parsed.output
475
+ if args.output:
476
+ output_path = args.output
470
477
 
471
- if args_parsed.since:
472
- since = int(round(float(args_parsed.since) * 1000))
478
+ if args.since:
479
+ since = int(round(float(args.since) * 1000))
473
480
 
474
- if not os.path.isdir(args_parsed.spaces):
475
- exit_with_error(f"The spaces folder {args_parsed.spaces} is not found.")
481
+ if not os.path.isdir(args.spaces):
482
+ exit_with_error(f"The spaces folder {args.spaces} is not found.")
476
483
 
477
484
  out_path = os.path.join(output_path, OUTPUT_FOLDER_NAME)
478
485
  if os.path.isdir(out_path):
479
486
  shutil.rmtree(out_path)
480
487
 
481
488
  tasks = []
482
- with open(args_parsed.config, "r") as f:
489
+ with open(args.config, "r") as f:
483
490
  config_objs = json.load(f)
484
491
 
485
492
  for config_obj in config_objs:
@@ -491,7 +498,7 @@ def main():
491
498
  config_obj.get("schema_shortname", ""),
492
499
  config_obj.get("included_meta_fields", {}),
493
500
  config_obj.get("excluded_payload_fields", {}),
494
- args_parsed.spaces, output_path, since))
501
+ args.spaces, output_path, since))
495
502
 
496
503
  asyncio.run(exporter(tasks))
497
504
 
@@ -520,11 +527,11 @@ def main():
520
527
  help="The number of day, older than which, the entries will be archived (based on updated_at)",
521
528
  )
522
529
 
523
- args_parsed = parser.parse_args(args[1:])
524
- space = args_parsed.space
525
- subpath = args_parsed.subpath
526
- olderthan = args_parsed.olderthan
527
- schema = args_parsed.schema or "meta"
530
+ args = parser.parse_args()
531
+ space = args.space
532
+ subpath = args.subpath
533
+ olderthan = args.olderthan
534
+ schema = args.schema or "meta"
528
535
 
529
536
  asyncio.run(archive(space, subpath, schema, olderthan))
530
537
  print("Done.")
@@ -0,0 +1,3 @@
1
+ backlog = 2000
2
+ workers = 1
3
+ bind = 'localhost:8282'
dmart/info.json ADDED
@@ -0,0 +1 @@
1
+ {"branch": "pypi", "version": "2e6304dd", "tag": "v1.4.0-72-g2e6304dd", "version_date": "'Mon Jan 19 08:55:04 2026 +0000'"}
dmart/login_creds.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ # Super manager login creds. Do not leave spaces in the value
4
+ export SUPERMAN='{"shortname":"dmart","password":"Test1234"}'
5
+
6
+ # Exctra account used for testing
7
+ export ALIBABA='{"shortname":"alibaba","password":"Test1234"}'
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ # Super manager login creds. Do not leave spaces in the value
4
+ export SUPERMAN='{"shortname":"dmart","password":"xxxx"}'
5
+
6
+ # Exctra account used for testing
7
+ export ALIBABA='{"shortname":"alibaba","password":"xxxx"}'
main.py → dmart/main.py RENAMED
@@ -480,7 +480,10 @@ asyncio.run(plugin_manager.load_plugins(app, capture_body))
480
480
 
481
481
 
482
482
  cxb_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "cxb")
483
- if not os.path.exists(cxb_path):
483
+ if os.path.isdir(os.path.join(cxb_path, "client")):
484
+ cxb_path = os.path.join(cxb_path, "client")
485
+
486
+ if not os.path.exists(os.path.join(cxb_path, "index.html")):
484
487
  project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
485
488
  cxb_dist_path = os.path.join(project_root, "cxb", "dist", "client")
486
489
  if os.path.isdir(cxb_dist_path):