taon 0.0.0 → 18.0.12

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 (668) hide show
  1. package/README.md +115 -0
  2. package/assets/shared/shared_folder_info.txt +7 -0
  3. package/bin/start.js +279 -0
  4. package/bin/taon +2 -1
  5. package/bin/taon-debug +2 -2
  6. package/bin/taon-debug-brk +3 -2
  7. package/browser/README.md +24 -0
  8. package/browser/esm2022/lib/base-classes/base-abstract-entity.mjs +18 -0
  9. package/browser/esm2022/lib/base-classes/base-class.mjs +17 -0
  10. package/browser/esm2022/lib/base-classes/base-context.mjs +14 -0
  11. package/browser/esm2022/lib/base-classes/base-controller.mjs +18 -0
  12. package/browser/esm2022/lib/base-classes/base-crud-controller.mjs +279 -0
  13. package/browser/esm2022/lib/base-classes/base-entity.mjs +18 -0
  14. package/browser/esm2022/lib/base-classes/base-injector.mjs +160 -0
  15. package/browser/esm2022/lib/base-classes/base-provider.mjs +6 -0
  16. package/browser/esm2022/lib/base-classes/base-repository.mjs +514 -0
  17. package/browser/esm2022/lib/base-classes/base-subscriber-for-entity.mjs +137 -0
  18. package/browser/esm2022/lib/base-classes/base-subscriber.mjs +27 -0
  19. package/browser/esm2022/lib/base-classes/base.mjs +26 -0
  20. package/browser/esm2022/lib/constants.mjs +4 -0
  21. package/browser/esm2022/lib/create-context.mjs +87 -0
  22. package/browser/esm2022/lib/decorators/classes/controller-decorator.mjs +15 -0
  23. package/browser/esm2022/lib/decorators/classes/entity-decorator.mjs +27 -0
  24. package/browser/esm2022/lib/decorators/classes/provider-decorator.mjs +15 -0
  25. package/browser/esm2022/lib/decorators/classes/repository-decorator.mjs +15 -0
  26. package/browser/esm2022/lib/decorators/classes/subscriber-decorator.mjs +41 -0
  27. package/browser/esm2022/lib/decorators/http/http-decorators.mjs +22 -0
  28. package/browser/esm2022/lib/decorators/http/http-methods-decorators.mjs +78 -0
  29. package/browser/esm2022/lib/decorators/http/http-params-decorators.mjs +47 -0
  30. package/browser/esm2022/lib/dependency-injection/di-container.mjs +32 -0
  31. package/browser/esm2022/lib/endpoint-context.mjs +1746 -0
  32. package/browser/esm2022/lib/entity-process.mjs +207 -0
  33. package/browser/esm2022/lib/env.mjs +6 -0
  34. package/browser/esm2022/lib/get-response-value.mjs +41 -0
  35. package/browser/esm2022/lib/helpers/class-helpers.mjs +183 -0
  36. package/browser/esm2022/lib/helpers/taon-helpers.mjs +120 -0
  37. package/browser/esm2022/lib/index.mjs +79 -0
  38. package/browser/esm2022/lib/inject.mjs +70 -0
  39. package/browser/esm2022/lib/models.mjs +77 -0
  40. package/browser/esm2022/lib/orm.mjs +6 -0
  41. package/browser/esm2022/lib/realtime/realtime-client.mjs +129 -0
  42. package/browser/esm2022/lib/realtime/realtime-core.mjs +54 -0
  43. package/browser/esm2022/lib/realtime/realtime-server.mjs +274 -0
  44. package/browser/esm2022/lib/realtime/realtime-strategy/index.mjs +7 -0
  45. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.mjs +98 -0
  46. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.mjs +45 -0
  47. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.mjs +40 -0
  48. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.mjs +25 -0
  49. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.mjs +4 -0
  50. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc.mjs +49 -0
  51. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.mjs +5 -0
  52. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.mjs +50 -0
  53. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.mjs +48 -0
  54. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.mjs +35 -0
  55. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.mjs +43 -0
  56. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.mjs +4 -0
  57. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock.mjs +28 -0
  58. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-socket-io.mjs +33 -0
  59. package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy.mjs +10 -0
  60. package/browser/esm2022/lib/realtime/realtime-subs-manager.mjs +79 -0
  61. package/browser/esm2022/lib/realtime/realtime.models.mjs +4 -0
  62. package/browser/esm2022/lib/storage.mjs +5 -0
  63. package/browser/esm2022/lib/symbols.mjs +89 -0
  64. package/browser/esm2022/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.mjs +4 -0
  65. package/browser/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.mjs +32 -0
  66. package/browser/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.mjs +167 -0
  67. package/browser/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin.service.mjs +64 -0
  68. package/browser/esm2022/lib/validators.mjs +76 -0
  69. package/browser/esm2022/public-api.mjs +2 -0
  70. package/browser/esm2022/taon.mjs +5 -0
  71. package/browser/fesm2022/taon.mjs +4901 -0
  72. package/browser/fesm2022/taon.mjs.map +1 -0
  73. package/browser/index.d.ts +6 -0
  74. package/browser/lib/base-classes/base-abstract-entity.d.ts +7 -0
  75. package/browser/lib/base-classes/base-class.d.ts +9 -0
  76. package/browser/lib/base-classes/base-context.d.ts +17 -0
  77. package/browser/lib/base-classes/base-controller.d.ts +8 -0
  78. package/browser/lib/base-classes/base-crud-controller.d.ts +28 -0
  79. package/browser/lib/base-classes/base-entity.d.ts +8 -0
  80. package/browser/lib/base-classes/base-injector.d.ts +60 -0
  81. package/browser/lib/base-classes/base-provider.d.ts +4 -0
  82. package/browser/lib/base-classes/base-repository.d.ts +249 -0
  83. package/browser/lib/base-classes/base-subscriber-for-entity.d.ts +82 -0
  84. package/browser/lib/base-classes/base-subscriber.d.ts +5 -0
  85. package/browser/lib/base-classes/base.d.ts +36 -0
  86. package/browser/lib/constants.d.ts +2 -0
  87. package/browser/lib/create-context.d.ts +25 -0
  88. package/browser/lib/decorators/classes/controller-decorator.d.ts +13 -0
  89. package/browser/lib/decorators/classes/entity-decorator.d.ts +17 -0
  90. package/browser/lib/decorators/classes/provider-decorator.d.ts +5 -0
  91. package/browser/lib/decorators/classes/repository-decorator.d.ts +5 -0
  92. package/browser/lib/decorators/classes/subscriber-decorator.d.ts +6 -0
  93. package/browser/lib/decorators/http/http-decorators.d.ts +18 -0
  94. package/browser/lib/decorators/http/http-methods-decorators.d.ts +15 -0
  95. package/browser/lib/decorators/http/http-params-decorators.d.ts +6 -0
  96. package/browser/lib/dependency-injection/di-container.d.ts +6 -0
  97. package/browser/lib/endpoint-context.d.ts +117 -0
  98. package/browser/lib/entity-process.d.ts +40 -0
  99. package/browser/lib/env.d.ts +3 -0
  100. package/browser/lib/get-response-value.d.ts +7 -0
  101. package/browser/lib/helpers/class-helpers.d.ts +19 -0
  102. package/browser/lib/helpers/taon-helpers.d.ts +17 -0
  103. package/browser/lib/index.d.ts +113 -0
  104. package/browser/lib/inject.d.ts +9 -0
  105. package/browser/lib/models.d.ts +175 -0
  106. package/browser/lib/orm.d.ts +3 -0
  107. package/browser/lib/realtime/realtime-client.d.ts +32 -0
  108. package/browser/lib/realtime/realtime-core.d.ts +41 -0
  109. package/browser/lib/realtime/realtime-server.d.ts +14 -0
  110. package/browser/lib/realtime/realtime-strategy/index.d.ts +5 -0
  111. package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +22 -0
  112. package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +17 -0
  113. package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +11 -0
  114. package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +11 -0
  115. package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +14 -0
  116. package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +23 -0
  117. package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +3 -0
  118. package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +17 -0
  119. package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +18 -0
  120. package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +12 -0
  121. package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +14 -0
  122. package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +12 -0
  123. package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +15 -0
  124. package/browser/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +17 -0
  125. package/browser/lib/realtime/realtime-strategy/realtime-strategy.d.ts +13 -0
  126. package/browser/lib/realtime/realtime-subs-manager.d.ts +15 -0
  127. package/browser/lib/realtime/realtime.models.d.ts +14 -0
  128. package/browser/lib/storage.d.ts +2 -0
  129. package/browser/lib/symbols.d.ts +73 -0
  130. package/browser/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +6 -0
  131. package/browser/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +18 -0
  132. package/browser/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +51 -0
  133. package/browser/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +25 -0
  134. package/browser/lib/validators.d.ts +8 -0
  135. package/browser/package.json +25 -0
  136. package/browser/public-api.d.ts +2 -0
  137. package/cli.d.ts +1 -0
  138. package/cli.js +24 -0
  139. package/cli.js.map +1 -0
  140. package/client/README.md +24 -0
  141. package/client/esm2022/lib/base-classes/base-abstract-entity.mjs +18 -0
  142. package/client/esm2022/lib/base-classes/base-class.mjs +17 -0
  143. package/client/esm2022/lib/base-classes/base-context.mjs +14 -0
  144. package/client/esm2022/lib/base-classes/base-controller.mjs +18 -0
  145. package/client/esm2022/lib/base-classes/base-crud-controller.mjs +279 -0
  146. package/client/esm2022/lib/base-classes/base-entity.mjs +18 -0
  147. package/client/esm2022/lib/base-classes/base-injector.mjs +160 -0
  148. package/client/esm2022/lib/base-classes/base-provider.mjs +6 -0
  149. package/client/esm2022/lib/base-classes/base-repository.mjs +514 -0
  150. package/client/esm2022/lib/base-classes/base-subscriber-for-entity.mjs +137 -0
  151. package/client/esm2022/lib/base-classes/base-subscriber.mjs +27 -0
  152. package/client/esm2022/lib/base-classes/base.mjs +26 -0
  153. package/client/esm2022/lib/constants.mjs +4 -0
  154. package/client/esm2022/lib/create-context.mjs +87 -0
  155. package/client/esm2022/lib/decorators/classes/controller-decorator.mjs +15 -0
  156. package/client/esm2022/lib/decorators/classes/entity-decorator.mjs +27 -0
  157. package/client/esm2022/lib/decorators/classes/provider-decorator.mjs +15 -0
  158. package/client/esm2022/lib/decorators/classes/repository-decorator.mjs +15 -0
  159. package/client/esm2022/lib/decorators/classes/subscriber-decorator.mjs +41 -0
  160. package/client/esm2022/lib/decorators/http/http-decorators.mjs +22 -0
  161. package/client/esm2022/lib/decorators/http/http-methods-decorators.mjs +78 -0
  162. package/client/esm2022/lib/decorators/http/http-params-decorators.mjs +47 -0
  163. package/client/esm2022/lib/dependency-injection/di-container.mjs +32 -0
  164. package/client/esm2022/lib/endpoint-context.mjs +1746 -0
  165. package/client/esm2022/lib/entity-process.mjs +207 -0
  166. package/client/esm2022/lib/env.mjs +6 -0
  167. package/client/esm2022/lib/get-response-value.mjs +41 -0
  168. package/client/esm2022/lib/helpers/class-helpers.mjs +183 -0
  169. package/client/esm2022/lib/helpers/taon-helpers.mjs +120 -0
  170. package/client/esm2022/lib/index.mjs +79 -0
  171. package/client/esm2022/lib/inject.mjs +70 -0
  172. package/client/esm2022/lib/models.mjs +77 -0
  173. package/client/esm2022/lib/orm.mjs +6 -0
  174. package/client/esm2022/lib/realtime/realtime-client.mjs +129 -0
  175. package/client/esm2022/lib/realtime/realtime-core.mjs +54 -0
  176. package/client/esm2022/lib/realtime/realtime-server.mjs +274 -0
  177. package/client/esm2022/lib/realtime/realtime-strategy/index.mjs +7 -0
  178. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.mjs +98 -0
  179. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.mjs +45 -0
  180. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.mjs +40 -0
  181. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.mjs +25 -0
  182. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.mjs +4 -0
  183. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc.mjs +49 -0
  184. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.mjs +5 -0
  185. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.mjs +50 -0
  186. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.mjs +48 -0
  187. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.mjs +35 -0
  188. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.mjs +43 -0
  189. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.mjs +4 -0
  190. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock.mjs +28 -0
  191. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-socket-io.mjs +33 -0
  192. package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy.mjs +10 -0
  193. package/client/esm2022/lib/realtime/realtime-subs-manager.mjs +79 -0
  194. package/client/esm2022/lib/realtime/realtime.models.mjs +4 -0
  195. package/client/esm2022/lib/storage.mjs +5 -0
  196. package/client/esm2022/lib/symbols.mjs +89 -0
  197. package/client/esm2022/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.mjs +4 -0
  198. package/client/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.mjs +32 -0
  199. package/client/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.mjs +167 -0
  200. package/client/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin.service.mjs +64 -0
  201. package/client/esm2022/lib/validators.mjs +76 -0
  202. package/client/esm2022/public-api.mjs +2 -0
  203. package/client/esm2022/taon.mjs +5 -0
  204. package/client/fesm2022/taon.mjs +4901 -0
  205. package/client/fesm2022/taon.mjs.map +1 -0
  206. package/client/index.d.ts +6 -0
  207. package/client/lib/base-classes/base-abstract-entity.d.ts +7 -0
  208. package/client/lib/base-classes/base-class.d.ts +9 -0
  209. package/client/lib/base-classes/base-context.d.ts +17 -0
  210. package/client/lib/base-classes/base-controller.d.ts +8 -0
  211. package/client/lib/base-classes/base-crud-controller.d.ts +28 -0
  212. package/client/lib/base-classes/base-entity.d.ts +8 -0
  213. package/client/lib/base-classes/base-injector.d.ts +60 -0
  214. package/client/lib/base-classes/base-provider.d.ts +4 -0
  215. package/client/lib/base-classes/base-repository.d.ts +249 -0
  216. package/client/lib/base-classes/base-subscriber-for-entity.d.ts +82 -0
  217. package/client/lib/base-classes/base-subscriber.d.ts +5 -0
  218. package/client/lib/base-classes/base.d.ts +36 -0
  219. package/client/lib/constants.d.ts +2 -0
  220. package/client/lib/create-context.d.ts +25 -0
  221. package/client/lib/decorators/classes/controller-decorator.d.ts +13 -0
  222. package/client/lib/decorators/classes/entity-decorator.d.ts +17 -0
  223. package/client/lib/decorators/classes/provider-decorator.d.ts +5 -0
  224. package/client/lib/decorators/classes/repository-decorator.d.ts +5 -0
  225. package/client/lib/decorators/classes/subscriber-decorator.d.ts +6 -0
  226. package/client/lib/decorators/http/http-decorators.d.ts +18 -0
  227. package/client/lib/decorators/http/http-methods-decorators.d.ts +15 -0
  228. package/client/lib/decorators/http/http-params-decorators.d.ts +6 -0
  229. package/client/lib/dependency-injection/di-container.d.ts +6 -0
  230. package/client/lib/endpoint-context.d.ts +117 -0
  231. package/client/lib/entity-process.d.ts +40 -0
  232. package/client/lib/env.d.ts +3 -0
  233. package/client/lib/get-response-value.d.ts +7 -0
  234. package/client/lib/helpers/class-helpers.d.ts +19 -0
  235. package/client/lib/helpers/taon-helpers.d.ts +17 -0
  236. package/client/lib/index.d.ts +113 -0
  237. package/client/lib/inject.d.ts +9 -0
  238. package/client/lib/models.d.ts +175 -0
  239. package/client/lib/orm.d.ts +3 -0
  240. package/client/lib/realtime/realtime-client.d.ts +32 -0
  241. package/client/lib/realtime/realtime-core.d.ts +41 -0
  242. package/client/lib/realtime/realtime-server.d.ts +14 -0
  243. package/client/lib/realtime/realtime-strategy/index.d.ts +5 -0
  244. package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +22 -0
  245. package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +17 -0
  246. package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +11 -0
  247. package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +11 -0
  248. package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +14 -0
  249. package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +23 -0
  250. package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +3 -0
  251. package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +17 -0
  252. package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +18 -0
  253. package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +12 -0
  254. package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +14 -0
  255. package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +12 -0
  256. package/client/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +15 -0
  257. package/client/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +17 -0
  258. package/client/lib/realtime/realtime-strategy/realtime-strategy.d.ts +13 -0
  259. package/client/lib/realtime/realtime-subs-manager.d.ts +15 -0
  260. package/client/lib/realtime/realtime.models.d.ts +14 -0
  261. package/client/lib/storage.d.ts +2 -0
  262. package/client/lib/symbols.d.ts +73 -0
  263. package/client/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +6 -0
  264. package/client/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +18 -0
  265. package/client/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +51 -0
  266. package/client/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +25 -0
  267. package/client/lib/validators.d.ts +8 -0
  268. package/client/public-api.d.ts +2 -0
  269. package/index.d.ts +1 -0
  270. package/index.js +5 -1
  271. package/index.js.map +1 -0
  272. package/lib/base-classes/base-abstract-entity.d.ts +6 -0
  273. package/lib/base-classes/base-abstract-entity.js +40 -0
  274. package/lib/base-classes/base-abstract-entity.js.map +1 -0
  275. package/lib/base-classes/base-class.d.ts +8 -0
  276. package/lib/base-classes/base-class.js +35 -0
  277. package/lib/base-classes/base-class.js.map +1 -0
  278. package/lib/base-classes/base-context.d.ts +16 -0
  279. package/lib/base-classes/base-context.js +15 -0
  280. package/lib/base-classes/base-context.js.map +1 -0
  281. package/lib/base-classes/base-controller.d.ts +7 -0
  282. package/lib/base-classes/base-controller.js +24 -0
  283. package/lib/base-classes/base-controller.js.map +1 -0
  284. package/lib/base-classes/base-crud-controller.d.ts +27 -0
  285. package/lib/base-classes/base-crud-controller.js +385 -0
  286. package/lib/base-classes/base-crud-controller.js.map +1 -0
  287. package/lib/base-classes/base-entity.d.ts +7 -0
  288. package/lib/base-classes/base-entity.js +25 -0
  289. package/lib/base-classes/base-entity.js.map +1 -0
  290. package/lib/base-classes/base-injector.d.ts +59 -0
  291. package/lib/base-classes/base-injector.js +220 -0
  292. package/lib/base-classes/base-injector.js.map +1 -0
  293. package/lib/base-classes/base-provider.d.ts +3 -0
  294. package/lib/base-classes/base-provider.js +14 -0
  295. package/lib/base-classes/base-provider.js.map +1 -0
  296. package/lib/base-classes/base-repository.d.ts +254 -0
  297. package/lib/base-classes/base-repository.js +780 -0
  298. package/lib/base-classes/base-repository.js.map +1 -0
  299. package/lib/base-classes/base-subscriber-for-entity.d.ts +81 -0
  300. package/lib/base-classes/base-subscriber-for-entity.js +136 -0
  301. package/lib/base-classes/base-subscriber-for-entity.js.map +1 -0
  302. package/lib/base-classes/base-subscriber.d.ts +4 -0
  303. package/lib/base-classes/base-subscriber.js +25 -0
  304. package/lib/base-classes/base-subscriber.js.map +1 -0
  305. package/lib/base-classes/base.d.ts +35 -0
  306. package/lib/base-classes/base.js +27 -0
  307. package/lib/base-classes/base.js.map +1 -0
  308. package/lib/build-info._auto-generated_.d.ts +1 -0
  309. package/lib/build-info._auto-generated_.js +5 -0
  310. package/lib/build-info._auto-generated_.js.map +1 -0
  311. package/lib/constants.d.ts +1 -0
  312. package/lib/constants.js +3 -0
  313. package/lib/constants.js.map +1 -0
  314. package/lib/create-context.d.ts +24 -0
  315. package/lib/create-context.js +183 -0
  316. package/lib/create-context.js.map +1 -0
  317. package/lib/decorators/classes/controller-decorator.d.ts +12 -0
  318. package/lib/decorators/classes/controller-decorator.js +24 -0
  319. package/lib/decorators/classes/controller-decorator.js.map +1 -0
  320. package/lib/decorators/classes/entity-decorator.d.ts +16 -0
  321. package/lib/decorators/classes/entity-decorator.js +39 -0
  322. package/lib/decorators/classes/entity-decorator.js.map +1 -0
  323. package/lib/decorators/classes/provider-decorator.d.ts +4 -0
  324. package/lib/decorators/classes/provider-decorator.js +24 -0
  325. package/lib/decorators/classes/provider-decorator.js.map +1 -0
  326. package/lib/decorators/classes/repository-decorator.d.ts +4 -0
  327. package/lib/decorators/classes/repository-decorator.js +24 -0
  328. package/lib/decorators/classes/repository-decorator.js.map +1 -0
  329. package/lib/decorators/classes/subscriber-decorator.d.ts +5 -0
  330. package/lib/decorators/classes/subscriber-decorator.js +75 -0
  331. package/lib/decorators/classes/subscriber-decorator.js.map +1 -0
  332. package/lib/decorators/http/http-decorators.d.ts +17 -0
  333. package/lib/decorators/http/http-decorators.js +23 -0
  334. package/lib/decorators/http/http-decorators.js.map +1 -0
  335. package/lib/decorators/http/http-methods-decorators.d.ts +14 -0
  336. package/lib/decorators/http/http-methods-decorators.js +91 -0
  337. package/lib/decorators/http/http-methods-decorators.js.map +1 -0
  338. package/lib/decorators/http/http-params-decorators.d.ts +5 -0
  339. package/lib/decorators/http/http-params-decorators.js +55 -0
  340. package/lib/decorators/http/http-params-decorators.js.map +1 -0
  341. package/lib/dependency-injection/di-container.d.ts +5 -0
  342. package/lib/dependency-injection/di-container.js +40 -0
  343. package/lib/dependency-injection/di-container.js.map +1 -0
  344. package/lib/endpoint-context.d.ts +117 -0
  345. package/lib/endpoint-context.js +2128 -0
  346. package/lib/endpoint-context.js.map +1 -0
  347. package/lib/entity-process.d.ts +39 -0
  348. package/lib/entity-process.js +261 -0
  349. package/lib/entity-process.js.map +1 -0
  350. package/lib/env.d.ts +2 -0
  351. package/lib/env.js +7 -0
  352. package/lib/env.js.map +1 -0
  353. package/lib/formly/formly-group-wrapper-component.d.ts +5 -0
  354. package/lib/formly/formly-group-wrapper-component.js +28 -0
  355. package/lib/formly/formly-group-wrapper-component.js.map +1 -0
  356. package/lib/formly/formly-repeat-component.d.ts +5 -0
  357. package/lib/formly/formly-repeat-component.js +47 -0
  358. package/lib/formly/formly-repeat-component.js.map +1 -0
  359. package/lib/formly/formly.models.d.ts +1 -0
  360. package/lib/formly/formly.models.js +3 -0
  361. package/lib/formly/formly.models.js.map +1 -0
  362. package/lib/formly/fromly.d.ts +16 -0
  363. package/lib/formly/fromly.js +213 -0
  364. package/lib/formly/fromly.js.map +1 -0
  365. package/lib/formly/type-from-entity.d.ts +20 -0
  366. package/lib/formly/type-from-entity.js +65 -0
  367. package/lib/formly/type-from-entity.js.map +1 -0
  368. package/lib/get-response-value.d.ts +6 -0
  369. package/lib/get-response-value.js +65 -0
  370. package/lib/get-response-value.js.map +1 -0
  371. package/lib/helpers/class-helpers.d.ts +18 -0
  372. package/lib/helpers/class-helpers.js +227 -0
  373. package/lib/helpers/class-helpers.js.map +1 -0
  374. package/lib/helpers/taon-helpers.d.ts +16 -0
  375. package/lib/helpers/taon-helpers.js +144 -0
  376. package/lib/helpers/taon-helpers.js.map +1 -0
  377. package/lib/index.d.ts +112 -0
  378. package/lib/index.js +113 -0
  379. package/lib/index.js.map +1 -0
  380. package/lib/inject.d.ts +8 -0
  381. package/lib/inject.js +84 -0
  382. package/lib/inject.js.map +1 -0
  383. package/lib/models.d.ts +180 -0
  384. package/lib/models.js +107 -0
  385. package/lib/models.js.map +1 -0
  386. package/lib/orm.d.ts +51 -0
  387. package/lib/orm.js +79 -0
  388. package/lib/orm.js.map +1 -0
  389. package/lib/realtime/realtime-client.d.ts +31 -0
  390. package/lib/realtime/realtime-client.js +158 -0
  391. package/lib/realtime/realtime-client.js.map +1 -0
  392. package/lib/realtime/realtime-core.d.ts +40 -0
  393. package/lib/realtime/realtime-core.js +72 -0
  394. package/lib/realtime/realtime-core.js.map +1 -0
  395. package/lib/realtime/realtime-server.d.ts +13 -0
  396. package/lib/realtime/realtime-server.js +193 -0
  397. package/lib/realtime/realtime-server.js.map +1 -0
  398. package/lib/realtime/realtime-strategy/index.d.ts +4 -0
  399. package/lib/realtime/realtime-strategy/index.js +8 -0
  400. package/lib/realtime/realtime-strategy/index.js.map +1 -0
  401. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.d.ts +0 -0
  402. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js +5 -0
  403. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js.map +1 -0
  404. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +22 -0
  405. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js +139 -0
  406. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js.map +1 -0
  407. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +16 -0
  408. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js +68 -0
  409. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js.map +1 -0
  410. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +10 -0
  411. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js +56 -0
  412. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js.map +1 -0
  413. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +10 -0
  414. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js +50 -0
  415. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js.map +1 -0
  416. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +13 -0
  417. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js +3 -0
  418. package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js.map +1 -0
  419. package/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +22 -0
  420. package/lib/realtime/realtime-strategy/realtime-strategy-ipc.js +68 -0
  421. package/lib/realtime/realtime-strategy/realtime-strategy-ipc.js.map +1 -0
  422. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +2 -0
  423. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js +6 -0
  424. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js.map +1 -0
  425. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +16 -0
  426. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js +54 -0
  427. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js.map +1 -0
  428. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +17 -0
  429. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js +52 -0
  430. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js.map +1 -0
  431. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +11 -0
  432. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js +39 -0
  433. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js.map +1 -0
  434. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +13 -0
  435. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js +46 -0
  436. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js.map +1 -0
  437. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +11 -0
  438. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js +3 -0
  439. package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js.map +1 -0
  440. package/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +14 -0
  441. package/lib/realtime/realtime-strategy/realtime-strategy-mock.js +42 -0
  442. package/lib/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -0
  443. package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +17 -0
  444. package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.js +48 -0
  445. package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.js.map +1 -0
  446. package/lib/realtime/realtime-strategy/realtime-strategy.d.ts +12 -0
  447. package/lib/realtime/realtime-strategy/realtime-strategy.js +14 -0
  448. package/lib/realtime/realtime-strategy/realtime-strategy.js.map +1 -0
  449. package/lib/realtime/realtime-subs-manager.d.ts +14 -0
  450. package/lib/realtime/realtime-subs-manager.js +102 -0
  451. package/lib/realtime/realtime-subs-manager.js.map +1 -0
  452. package/lib/realtime/realtime.models.d.ts +13 -0
  453. package/lib/realtime/realtime.models.js +3 -0
  454. package/lib/realtime/realtime.models.js.map +1 -0
  455. package/lib/storage.d.ts +1 -0
  456. package/lib/storage.js +6 -0
  457. package/lib/storage.js.map +1 -0
  458. package/lib/symbols.d.ts +72 -0
  459. package/lib/symbols.js +91 -0
  460. package/lib/symbols.js.map +1 -0
  461. package/lib/ui/directives/firedev-inject-html.directive.d.ts +6 -0
  462. package/lib/ui/directives/firedev-long-press.directive.d.ts +22 -0
  463. package/lib/ui/directives/index.d.ts +4 -0
  464. package/lib/ui/directives/index.js +5 -0
  465. package/lib/ui/directives/index.js.map +1 -0
  466. package/lib/ui/directives/safe.pipe.d.ts +7 -0
  467. package/lib/ui/directives/view-mode.d.ts +5 -0
  468. package/lib/ui/directives/view-mode.js +10 -0
  469. package/lib/ui/directives/view-mode.js.map +1 -0
  470. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +2 -0
  471. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js +5 -0
  472. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js.map +1 -0
  473. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +31 -0
  474. package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +2 -0
  475. package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.d.ts +1 -0
  476. package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js +5 -0
  477. package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js.map +1 -0
  478. package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/taon-db-admin.component.d.ts +9 -0
  479. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +2 -0
  480. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js +5 -0
  481. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js.map +1 -0
  482. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +14 -0
  483. package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +2 -0
  484. package/lib/ui/taon-admin-mode-configuration/index.d.ts +4 -0
  485. package/lib/ui/taon-admin-mode-configuration/index.js +5 -0
  486. package/lib/ui/taon-admin-mode-configuration/index.js.map +1 -0
  487. package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +5 -0
  488. package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js +3 -0
  489. package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js.map +1 -0
  490. package/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +14 -0
  491. package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +47 -0
  492. package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +2 -0
  493. package/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +21 -0
  494. package/lib/ui/taon-github-fork-me-corner/index.d.ts +2 -0
  495. package/lib/ui/taon-github-fork-me-corner/index.js +5 -0
  496. package/lib/ui/taon-github-fork-me-corner/index.js.map +1 -0
  497. package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.component.d.ts +3 -0
  498. package/lib/ui/taon-github-fork-me-corner/taon-github-fork-me-corner.module.d.ts +2 -0
  499. package/lib/ui/taon-github-fork-me-ribbon/index.d.ts +2 -0
  500. package/lib/ui/taon-github-fork-me-ribbon/index.js +5 -0
  501. package/lib/ui/taon-github-fork-me-ribbon/index.js.map +1 -0
  502. package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.component.d.ts +3 -0
  503. package/lib/ui/taon-github-fork-me-ribbon/taon-github-fork-me-ribbon.module.d.ts +2 -0
  504. package/lib/ui/taon-notifications/index.d.ts +4 -0
  505. package/lib/ui/taon-notifications/index.js +11 -0
  506. package/lib/ui/taon-notifications/index.js.map +1 -0
  507. package/lib/ui/taon-notifications/taon-notifications.component.d.ts +9 -0
  508. package/lib/ui/taon-notifications/taon-notifications.models.d.ts +6 -0
  509. package/lib/ui/taon-notifications/taon-notifications.models.js +5 -0
  510. package/lib/ui/taon-notifications/taon-notifications.models.js.map +1 -0
  511. package/lib/ui/taon-notifications/taon-notifications.module.d.ts +2 -0
  512. package/lib/ui/taon-notifications/taon-notifications.service.d.ts +11 -0
  513. package/lib/ui/taon-progress-bar/index.d.ts +2 -0
  514. package/lib/ui/taon-progress-bar/index.js +5 -0
  515. package/lib/ui/taon-progress-bar/index.js.map +1 -0
  516. package/lib/ui/taon-progress-bar/taon-progress-bar.component.d.ts +14 -0
  517. package/lib/ui/taon-progress-bar/taon-progress-bar.module.d.ts +2 -0
  518. package/lib/ui/taon-session-passcode/index.d.ts +1 -0
  519. package/lib/ui/taon-session-passcode/index.js +5 -0
  520. package/lib/ui/taon-session-passcode/index.js.map +1 -0
  521. package/lib/ui/taon-session-passcode/taon-session-passcode.component.d.ts +35 -0
  522. package/lib/ui/taon.models.d.ts +11 -0
  523. package/lib/ui/taon.models.js +3 -0
  524. package/lib/ui/taon.models.js.map +1 -0
  525. package/lib/ui/toan-full-material.module.d.ts +2 -0
  526. package/lib/validators.d.ts +7 -0
  527. package/lib/validators.js +53 -0
  528. package/lib/validators.js.map +1 -0
  529. package/old-app .d.ts +0 -0
  530. package/old-app .js +115 -0
  531. package/old-app .js.map +1 -0
  532. package/package.json +74 -11
  533. package/playground.d.ts +0 -0
  534. package/playground.js +172 -0
  535. package/playground.js.map +1 -0
  536. package/src.d.ts +6 -0
  537. package/taon.jsonc +48 -0
  538. package/tmp-environment.json +393 -0
  539. package/websql/README.md +24 -0
  540. package/websql/esm2022/lib/base-classes/base-abstract-entity.mjs +25 -0
  541. package/websql/esm2022/lib/base-classes/base-class.mjs +17 -0
  542. package/websql/esm2022/lib/base-classes/base-context.mjs +14 -0
  543. package/websql/esm2022/lib/base-classes/base-controller.mjs +18 -0
  544. package/websql/esm2022/lib/base-classes/base-crud-controller.mjs +238 -0
  545. package/websql/esm2022/lib/base-classes/base-entity.mjs +16 -0
  546. package/websql/esm2022/lib/base-classes/base-injector.mjs +160 -0
  547. package/websql/esm2022/lib/base-classes/base-provider.mjs +6 -0
  548. package/websql/esm2022/lib/base-classes/base-repository.mjs +431 -0
  549. package/websql/esm2022/lib/base-classes/base-subscriber-for-entity.mjs +137 -0
  550. package/websql/esm2022/lib/base-classes/base-subscriber.mjs +27 -0
  551. package/websql/esm2022/lib/base-classes/base.mjs +26 -0
  552. package/websql/esm2022/lib/constants.mjs +4 -0
  553. package/websql/esm2022/lib/create-context.mjs +86 -0
  554. package/websql/esm2022/lib/decorators/classes/controller-decorator.mjs +15 -0
  555. package/websql/esm2022/lib/decorators/classes/entity-decorator.mjs +25 -0
  556. package/websql/esm2022/lib/decorators/classes/provider-decorator.mjs +15 -0
  557. package/websql/esm2022/lib/decorators/classes/repository-decorator.mjs +15 -0
  558. package/websql/esm2022/lib/decorators/classes/subscriber-decorator.mjs +41 -0
  559. package/websql/esm2022/lib/decorators/http/http-decorators.mjs +22 -0
  560. package/websql/esm2022/lib/decorators/http/http-methods-decorators.mjs +78 -0
  561. package/websql/esm2022/lib/decorators/http/http-params-decorators.mjs +47 -0
  562. package/websql/esm2022/lib/dependency-injection/di-container.mjs +32 -0
  563. package/websql/esm2022/lib/endpoint-context.mjs +1506 -0
  564. package/websql/esm2022/lib/entity-process.mjs +207 -0
  565. package/websql/esm2022/lib/env.mjs +6 -0
  566. package/websql/esm2022/lib/get-response-value.mjs +45 -0
  567. package/websql/esm2022/lib/helpers/class-helpers.mjs +183 -0
  568. package/websql/esm2022/lib/helpers/taon-helpers.mjs +120 -0
  569. package/websql/esm2022/lib/index.mjs +81 -0
  570. package/websql/esm2022/lib/inject.mjs +70 -0
  571. package/websql/esm2022/lib/models.mjs +70 -0
  572. package/websql/esm2022/lib/orm.mjs +60 -0
  573. package/websql/esm2022/lib/realtime/realtime-client.mjs +129 -0
  574. package/websql/esm2022/lib/realtime/realtime-core.mjs +54 -0
  575. package/websql/esm2022/lib/realtime/realtime-server.mjs +158 -0
  576. package/websql/esm2022/lib/realtime/realtime-strategy/index.mjs +7 -0
  577. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.mjs +98 -0
  578. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.mjs +45 -0
  579. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.mjs +40 -0
  580. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.mjs +25 -0
  581. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.mjs +4 -0
  582. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc.mjs +48 -0
  583. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.mjs +5 -0
  584. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.mjs +50 -0
  585. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.mjs +48 -0
  586. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.mjs +35 -0
  587. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.mjs +43 -0
  588. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.mjs +4 -0
  589. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock.mjs +28 -0
  590. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-socket-io.mjs +33 -0
  591. package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy.mjs +10 -0
  592. package/websql/esm2022/lib/realtime/realtime-subs-manager.mjs +79 -0
  593. package/websql/esm2022/lib/realtime/realtime.models.mjs +4 -0
  594. package/websql/esm2022/lib/storage.mjs +5 -0
  595. package/websql/esm2022/lib/symbols.mjs +89 -0
  596. package/websql/esm2022/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.mjs +4 -0
  597. package/websql/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.mjs +32 -0
  598. package/websql/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.mjs +167 -0
  599. package/websql/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin.service.mjs +64 -0
  600. package/websql/esm2022/lib/validators.mjs +76 -0
  601. package/websql/esm2022/public-api.mjs +2 -0
  602. package/websql/esm2022/taon.mjs +5 -0
  603. package/websql/fesm2022/taon.mjs +4595 -0
  604. package/websql/fesm2022/taon.mjs.map +1 -0
  605. package/websql/index.d.ts +6 -0
  606. package/websql/lib/base-classes/base-abstract-entity.d.ts +7 -0
  607. package/websql/lib/base-classes/base-class.d.ts +9 -0
  608. package/websql/lib/base-classes/base-context.d.ts +17 -0
  609. package/websql/lib/base-classes/base-controller.d.ts +8 -0
  610. package/websql/lib/base-classes/base-crud-controller.d.ts +28 -0
  611. package/websql/lib/base-classes/base-entity.d.ts +8 -0
  612. package/websql/lib/base-classes/base-injector.d.ts +60 -0
  613. package/websql/lib/base-classes/base-provider.d.ts +4 -0
  614. package/websql/lib/base-classes/base-repository.d.ts +255 -0
  615. package/websql/lib/base-classes/base-subscriber-for-entity.d.ts +82 -0
  616. package/websql/lib/base-classes/base-subscriber.d.ts +5 -0
  617. package/websql/lib/base-classes/base.d.ts +36 -0
  618. package/websql/lib/constants.d.ts +2 -0
  619. package/websql/lib/create-context.d.ts +25 -0
  620. package/websql/lib/decorators/classes/controller-decorator.d.ts +13 -0
  621. package/websql/lib/decorators/classes/entity-decorator.d.ts +17 -0
  622. package/websql/lib/decorators/classes/provider-decorator.d.ts +5 -0
  623. package/websql/lib/decorators/classes/repository-decorator.d.ts +5 -0
  624. package/websql/lib/decorators/classes/subscriber-decorator.d.ts +6 -0
  625. package/websql/lib/decorators/http/http-decorators.d.ts +18 -0
  626. package/websql/lib/decorators/http/http-methods-decorators.d.ts +15 -0
  627. package/websql/lib/decorators/http/http-params-decorators.d.ts +6 -0
  628. package/websql/lib/dependency-injection/di-container.d.ts +6 -0
  629. package/websql/lib/endpoint-context.d.ts +117 -0
  630. package/websql/lib/entity-process.d.ts +40 -0
  631. package/websql/lib/env.d.ts +3 -0
  632. package/websql/lib/get-response-value.d.ts +7 -0
  633. package/websql/lib/helpers/class-helpers.d.ts +19 -0
  634. package/websql/lib/helpers/taon-helpers.d.ts +17 -0
  635. package/websql/lib/index.d.ts +113 -0
  636. package/websql/lib/inject.d.ts +9 -0
  637. package/websql/lib/models.d.ts +181 -0
  638. package/websql/lib/orm.d.ts +52 -0
  639. package/websql/lib/realtime/realtime-client.d.ts +32 -0
  640. package/websql/lib/realtime/realtime-core.d.ts +41 -0
  641. package/websql/lib/realtime/realtime-server.d.ts +14 -0
  642. package/websql/lib/realtime/realtime-strategy/index.d.ts +5 -0
  643. package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +22 -0
  644. package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +17 -0
  645. package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +11 -0
  646. package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +11 -0
  647. package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +14 -0
  648. package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +23 -0
  649. package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +3 -0
  650. package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +17 -0
  651. package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +18 -0
  652. package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +12 -0
  653. package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +14 -0
  654. package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +12 -0
  655. package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +15 -0
  656. package/websql/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +17 -0
  657. package/websql/lib/realtime/realtime-strategy/realtime-strategy.d.ts +13 -0
  658. package/websql/lib/realtime/realtime-subs-manager.d.ts +15 -0
  659. package/websql/lib/realtime/realtime.models.d.ts +14 -0
  660. package/websql/lib/storage.d.ts +2 -0
  661. package/websql/lib/symbols.d.ts +73 -0
  662. package/websql/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +6 -0
  663. package/websql/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +18 -0
  664. package/websql/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +51 -0
  665. package/websql/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +25 -0
  666. package/websql/lib/validators.d.ts +8 -0
  667. package/websql/package.json +25 -0
  668. package/websql/public-api.d.ts +2 -0
@@ -0,0 +1,4901 @@
1
+ import 'reflect-metadata';
2
+ import * as coreHelpers from 'tnp-core/browser';
3
+ import { _, Helpers } from 'tnp-core/browser';
4
+ import { Models as Models$1, RestHeaders, Resource, Mapping } from 'ng2-rest/browser';
5
+ import { OrignalClassKey } from 'taon-typeorm/browser';
6
+ import { SYMBOL, CLASS } from 'typescript-class-helpers/browser';
7
+ import * as JSON5 from 'json5';
8
+ import { __decorate, __param, __metadata } from 'tslib';
9
+ import { JSON10 } from 'json10/browser';
10
+ import { Observable, from, Subject } from 'rxjs';
11
+ import axios from 'axios';
12
+ import { io } from 'socket.io-client';
13
+ import { Stor } from 'taon-storage/browser';
14
+ import { config } from 'tnp-config/browser';
15
+ import * as i0 from '@angular/core';
16
+ import { Injectable, inject as inject$1 } from '@angular/core';
17
+
18
+ var Symbols;
19
+ (function (Symbols) {
20
+ Symbols.ctxInClassOrClassObj = Symbol();
21
+ Symbols.classNameStaticProperty = SYMBOL.ClassNameStaticProperty;
22
+ Symbols.fullClassNameStaticProperty = `$$fullclassName$$`;
23
+ Symbols.orignalClass = OrignalClassKey;
24
+ Symbols.orignalClassClonesObj = `$$originalClassClonesObj$$`;
25
+ Symbols.classMethodsNames = `$$classMethodsNames$$`;
26
+ Symbols.REALTIME = {
27
+ NAMESPACE: (contextName) => `${contextName}:taonRealtimeNsp`,
28
+ TABLE_CHANGE(contextName, tableName) {
29
+ return `${contextName}:listentablename${tableName}`;
30
+ },
31
+ /**
32
+ * for backendSocket.in(ROOM_NAME).emit(EVENT)
33
+ *
34
+ * Room names are uniqe..
35
+ * here I am limiting number of event for clients.
36
+ */
37
+ ROOM_NAME: {
38
+ CUSTOM(contextName, customEvent) {
39
+ return `${contextName}:roomcustomevnet${customEvent}`;
40
+ },
41
+ /**
42
+ * @LAST TODO
43
+ */
44
+ SUBSCRIBER_EVENT(contextName, className, propertyName) {
45
+ return `${contextName}:room${_.camelCase(className)}${propertyName}`.toLowerCase();
46
+ },
47
+ UPDATE_ENTITY(contextName, className, entityId) {
48
+ return `${contextName}:room${_.camelCase(className)}${entityId}`.toLowerCase();
49
+ },
50
+ UPDATE_ENTITY_PROPERTY(contextName, className, property, entityId) {
51
+ return `${contextName}:room${_.camelCase(className)}${_.camelCase(property)}${entityId}`.toLowerCase();
52
+ },
53
+ SUBSCRIBE: {
54
+ CUSTOM: (contextName) => `${contextName}:roomSubscribeCustomRoomEvent`,
55
+ ENTITY_UPDATE_EVENTS: (contextName) => `${contextName}:roomSubscribeEntityEvents`,
56
+ ENTITY_PROPERTY_UPDATE_EVENTS: (contextName) => `${contextName}:roomSubscribeEntityPropertyEvents`,
57
+ },
58
+ UNSUBSCRIBE: {
59
+ CUSTOM: (contextName) => `${contextName}:roomUnsubscribeCustomRoomEvent`,
60
+ ENTITY_UPDATE_EVENTS: (contextName) => `${contextName}:roomUnsubscribeEntityEvents`,
61
+ ENTITY_PROPERTY_UPDATE_EVENTS: (contextName) => `${contextName}:roomUnsubscribeEntityPropertyEvents`,
62
+ },
63
+ },
64
+ };
65
+ Symbols.metadata = {
66
+ className: `class:realname`,
67
+ options: {
68
+ runtimeController: `runtime:controller:options`,
69
+ controller: `controller:options`,
70
+ controllerMethod: `controller:method:options`,
71
+ entity: `entity:options`,
72
+ repository: `repository:options`,
73
+ provider: `provider:options`,
74
+ subscriber: `subscriber:options`,
75
+ },
76
+ };
77
+ Symbols.old = {
78
+ HAS_TABLE_IN_DB: Symbol(),
79
+ MDC_KEY: `modeldataconfig`,
80
+ WEBSQL_REST_PROGRESS_FUN: Symbol(),
81
+ WEBSQL_REST_PROGRESS_FUN_START: Symbol(),
82
+ WEBSQL_REST_PROGRESS_FUN_DONE: Symbol(),
83
+ WEBSQL_REST_PROGRESS_TIMEOUT: Symbol(),
84
+ X_TOTAL_COUNT: `x-total-count`,
85
+ CIRCURAL_OBJECTS_MAP_BODY: `circuralmapbody`,
86
+ CIRCURAL_OBJECTS_MAP_QUERY_PARAM: `circuralmapbody`,
87
+ MAPPING_CONFIG_HEADER: `mappingheader`,
88
+ MAPPING_CONFIG_HEADER_BODY_PARAMS: `mhbodyparams`,
89
+ MAPPING_CONFIG_HEADER_QUERY_PARAMS: `mhqueryparams`,
90
+ ENDPOINT_META_CONFIG: `ng2_rest_endpoint_config`,
91
+ CLASS_DECORATOR_CONTEXT: `$$ng2_rest_class_context`,
92
+ SOCKET_MSG: `socketmessageng2rest`,
93
+ ANGULAR: {
94
+ INPUT_NAMES: Symbol(),
95
+ },
96
+ ERROR_MESSAGES: {
97
+ CLASS_NAME_MATCH: `Please check if your "class name" matches @Controller( className ) or @Entity( className )`,
98
+ },
99
+ };
100
+ })(Symbols || (Symbols = {}));
101
+ ;
102
+ ({}); // @--end-of-file-for-module=taon lib/symbols.ts
103
+
104
+ var Validators;
105
+ (function (Validators) {
106
+ Validators.classNameVlidation = (className, target) => {
107
+ setTimeout(() => {
108
+ if (_.isUndefined(className)) {
109
+ throw `[Taon]
110
+ Please provide "className" property for each Controller and Entity:
111
+
112
+ @Taon.Controller({ className: 'MyExampleCtrl' })
113
+ class MyExampleCtrl {
114
+ ...
115
+ }
116
+
117
+ @Taon.Entity({ className: 'MyExampleEntity' })
118
+ class MyExampleEntity {
119
+ ...
120
+ }
121
+
122
+ Notice that minified javascript code does not preserve
123
+ Functions/Classes names -this is only solution to preserve classes names.
124
+
125
+ `;
126
+ }
127
+ });
128
+ return _.isUndefined(className) ? target.name : className;
129
+ };
130
+ Validators.checkIfMethodsWithReponseTYpeAlowed = (methods, current) => {
131
+ const defaultResponseType = 'text or JSON';
132
+ if (!current.responseType) {
133
+ return;
134
+ }
135
+ for (let index = 0; index < methods.length; index++) {
136
+ const m = methods[index];
137
+ if (m.path === current.path && m.responseType !== current.responseType) {
138
+ throw new Error(`
139
+ [taon] you can have 2 methods with same path but differetn reponseType-s
140
+
141
+ ${m.methodName}( ... path: ${m.path} ) -> responseType: ${m.responseType || defaultResponseType}
142
+ ${current.methodName}( ... path: ${current.path} ) -> responseType: ${current.responseType}
143
+
144
+ Please change path name on of the methods.
145
+
146
+ `);
147
+ }
148
+ }
149
+ };
150
+ Validators.validateClassFunctions = (controllers, entities, proviers, repositories) => {
151
+ if (_.isArray(controllers) &&
152
+ controllers.filter(f => !_.isFunction(f)).length > 0) {
153
+ console.error('controllers', controllers);
154
+ throw `
155
+
156
+ Incorect value for property "controllers" inside Taon.Init(...)
157
+
158
+ `;
159
+ }
160
+ if (_.isArray(entities) &&
161
+ entities.filter(f => !_.isFunction(f)).length > 0) {
162
+ console.error('entites', entities);
163
+ throw `
164
+
165
+ Incorect value for property "entities" inside Taon.Init(...)
166
+
167
+ `;
168
+ }
169
+ };
170
+ Validators.preventUndefinedModel = (model, id) => {
171
+ if (_.isUndefined(model)) {
172
+ throw `Bad update by id, config, id: ${id}`;
173
+ }
174
+ };
175
+ })(Validators || (Validators = {}));
176
+ ;
177
+ ({}); // @--end-of-file-for-module=taon lib/validators.ts
178
+
179
+ var TaonHelpers;
180
+ (function (TaonHelpers) {
181
+ TaonHelpers.fillUpTo = (s, nCharacters) => {
182
+ return _.times(nCharacters, n => {
183
+ if (s.charAt(n)) {
184
+ return s.charAt(n);
185
+ }
186
+ return ' ';
187
+ }).join('');
188
+ };
189
+ TaonHelpers.isGoodPath = (p) => {
190
+ return p && typeof p === 'string' && p.trim() !== '';
191
+ };
192
+ TaonHelpers.tryTransformParam = param => {
193
+ if (typeof param === 'string') {
194
+ let n = Number(param);
195
+ if (!isNaN(n))
196
+ return n;
197
+ const bool = param.trim().toLowerCase();
198
+ if (bool === 'true') {
199
+ return true;
200
+ }
201
+ if (bool === 'false') {
202
+ return false;
203
+ }
204
+ try {
205
+ const t = JSON5.parse(param);
206
+ return t;
207
+ }
208
+ catch (e) {
209
+ return param;
210
+ }
211
+ }
212
+ return param;
213
+ };
214
+ TaonHelpers.getExpressPath = (c, pathOrClassConfig) => {
215
+ if (typeof pathOrClassConfig === 'string')
216
+ return `${c.calculatedPath}${pathOrClassConfig}`.replace(/\/$/, '');
217
+ return `${c.calculatedPath}${pathOrClassConfig.path}`.replace(/\/$/, '');
218
+ };
219
+ TaonHelpers.defaultType = value => {
220
+ if (typeof value === 'string')
221
+ return '';
222
+ if (typeof value === 'boolean')
223
+ return false;
224
+ if (Array.isArray(value))
225
+ return {};
226
+ if (typeof value === 'object')
227
+ return {};
228
+ };
229
+ TaonHelpers.parseJSONwithStringJSONs = (object, waring = false) => {
230
+ if (!_.isObject(object)) {
231
+ if (waring) {
232
+ console.error(`
233
+ parseJSONwithStringJSONs(...)
234
+ Parameter should be a object, but is ${typeof object}
235
+ `, object);
236
+ }
237
+ return object;
238
+ }
239
+ let res = _.cloneDeep(object);
240
+ Object.keys(res).forEach(key => {
241
+ let isJson = false;
242
+ try {
243
+ const possibleJSON = JSON.parse(res[key]);
244
+ res[key] = possibleJSON;
245
+ isJson = true;
246
+ }
247
+ catch (e) {
248
+ isJson = false;
249
+ }
250
+ if (isJson) {
251
+ res[key] = TaonHelpers.parseJSONwithStringJSONs(res[key], false);
252
+ }
253
+ });
254
+ return res;
255
+ };
256
+ TaonHelpers.isPlainFileOrFolder = filePath => {
257
+ return /^([a-zA-Z]|\-|\_|\@|\#|\$|\!|\^|\&|\*|\(|\))+$/.test(filePath);
258
+ };
259
+ TaonHelpers.ipcKeyNameResponse = (target, methodConfig, expressPath) => {
260
+ return [
261
+ 'response',
262
+ ClassHelpers.getName(target),
263
+ methodConfig.methodName,
264
+ methodConfig.type,
265
+ expressPath,
266
+ ].join('--');
267
+ };
268
+ TaonHelpers.ipcKeyNameRequest = (target, methodConfig, expressPath) => {
269
+ return [
270
+ 'request',
271
+ ClassHelpers.getName(target),
272
+ methodConfig.methodName,
273
+ methodConfig.type,
274
+ expressPath,
275
+ ].join('--');
276
+ };
277
+ TaonHelpers.websqlMocks = headers => {
278
+ const response = {
279
+ status(status) {
280
+ return {
281
+ send(send) {
282
+ },
283
+ };
284
+ },
285
+ setHeader(key, value) {
286
+ headers[key] = value;
287
+ },
288
+ };
289
+ const request = {};
290
+ return { request, response };
291
+ };
292
+ })(TaonHelpers || (TaonHelpers = {}));
293
+ ;
294
+ ({}); // @--end-of-file-for-module=taon lib/helpers/taon-helpers.ts
295
+
296
+ /* */
297
+ /* */
298
+ var ClassHelpers;
299
+ (function (ClassHelpers) {
300
+ /**
301
+ * TODO - repalce in every place when getting class fn from object
302
+ */
303
+ ClassHelpers.getClassFnFromObject = (json) => {
304
+ if (_.isUndefined(json) || _.isNull(json)) {
305
+ return;
306
+ }
307
+ if (json.constructor) {
308
+ return json.constructor;
309
+ }
310
+ const p = Object.getPrototypeOf(json);
311
+ return p && p.constructor && p.constructor.name !== 'Object'
312
+ ? p.constructor
313
+ : void 0;
314
+ };
315
+ ClassHelpers.getName = (classFnOrObject) => {
316
+ if (classFnOrObject instanceof FormData) {
317
+ return 'FormData';
318
+ }
319
+ if (!classFnOrObject) {
320
+ console.error('OBJECT OR CLASS', classFnOrObject);
321
+ throw new Error(`Cannot get name from this object or class.`);
322
+ }
323
+ return ((classFnOrObject[Symbols.classNameStaticProperty]
324
+ ? classFnOrObject[Symbols.classNameStaticProperty]
325
+ : classFnOrObject?.constructor[Symbols.classNameStaticProperty]) ||
326
+ CLASS.getName(classFnOrObject));
327
+ };
328
+ ClassHelpers.getOrginalClass = (classFnOrObject) => {
329
+ const org = classFnOrObject[Symbols.orignalClass];
330
+ if (!org) {
331
+ return classFnOrObject;
332
+ }
333
+ return ClassHelpers.getOrginalClass(org);
334
+ };
335
+ ClassHelpers.getFullInternalName = (classFnOrObject) => {
336
+ if (!classFnOrObject) {
337
+ throw new Error(`Cannot get name from: ${classFnOrObject}`);
338
+ }
339
+ return ((classFnOrObject[Symbols.fullClassNameStaticProperty]
340
+ ? classFnOrObject[Symbols.fullClassNameStaticProperty]
341
+ : classFnOrObject?.constructor[Symbols.fullClassNameStaticProperty]) ||
342
+ void 0);
343
+ };
344
+ ClassHelpers.getUniquKey = (classFnOrObject) => {
345
+ const classFn = _.isFunction(classFnOrObject)
346
+ ? classFnOrObject
347
+ : classFnOrObject.constructor;
348
+ const config = Reflect.getMetadata(Symbols.metadata.options.controller, classFn);
349
+ return config.uniqueKeyProp;
350
+ };
351
+ ClassHelpers.isContextClassObject = (obj) => {
352
+ if (!_.isObject(obj) ||
353
+ _.isArray(obj) ||
354
+ _.isRegExp(obj) ||
355
+ _.isBuffer(obj) ||
356
+ _.isArrayBuffer(obj)) {
357
+ return false;
358
+ }
359
+ if (_.isDate(obj)) {
360
+ return true;
361
+ }
362
+ const className = ClassHelpers.getName(obj);
363
+ return _.isString(className) && className !== 'Object';
364
+ };
365
+ ClassHelpers.setName = (target, className) => {
366
+ Validators.classNameVlidation(className, target);
367
+ target[Symbols.classNameStaticProperty] = className;
368
+ };
369
+ ClassHelpers.hasParentClassWithName = (target, className, targets = []) => {
370
+ if (!target) {
371
+ return false;
372
+ }
373
+ targets.push(target);
374
+ let targetProto = Object.getPrototypeOf(target);
375
+ if (_.isFunction(targetProto) &&
376
+ ClassHelpers.getName(targetProto) === className) {
377
+ return true;
378
+ }
379
+ return ClassHelpers.hasParentClassWithName(targetProto, className, targets);
380
+ };
381
+ ClassHelpers.getControllerConfig = (target) => {
382
+ const classMetadataOptions = Reflect.getMetadata(Symbols.metadata.options.controller, target);
383
+ const classMetadata = _.merge(new Models.ControllerConfig(), classMetadataOptions);
384
+ const methodNames = ClassHelpers.getMethodsNames(target); // Object.getOwnPropertyNames(target.prototype);
385
+ for (const methodName of methodNames) {
386
+ const methodMetadata = Reflect.getMetadata(Symbols.metadata.options.controllerMethod, target, methodName);
387
+ if (methodMetadata) {
388
+ classMetadata.methods[methodName] = methodMetadata;
389
+ }
390
+ }
391
+ return classMetadata;
392
+ };
393
+ const notAllowedAsMethodName = [
394
+ 'length',
395
+ 'name',
396
+ 'arguments',
397
+ 'caller',
398
+ 'constructor',
399
+ 'apply',
400
+ 'bind',
401
+ 'call',
402
+ 'toString',
403
+ '__defineGetter__',
404
+ '__defineSetter__',
405
+ 'hasOwnProperty',
406
+ '__lookupGetter__',
407
+ '__lookupSetter__',
408
+ 'isPrototypeOf',
409
+ 'propertyIsEnumerable',
410
+ 'valueOf',
411
+ '__proto__',
412
+ 'toLocaleString',
413
+ ];
414
+ ClassHelpers.getMethodsNames = (classOrClassInstance, allMethodsNames = []) => {
415
+ if (!classOrClassInstance) {
416
+ return allMethodsNames;
417
+ }
418
+ const isClassFunction = _.isFunction(classOrClassInstance);
419
+ const classFun = isClassFunction
420
+ ? classOrClassInstance
421
+ : Object.getPrototypeOf(classOrClassInstance);
422
+ const objectToCheck = isClassFunction
423
+ ? classOrClassInstance?.prototype
424
+ : classOrClassInstance;
425
+ const prototypeObj = Object.getPrototypeOf(objectToCheck || {});
426
+ const properties = _.uniq([
427
+ ...Object.getOwnPropertyNames(objectToCheck || {}),
428
+ ...Object.getOwnPropertyNames(prototypeObj || {}),
429
+ ...Object.keys(objectToCheck || {}),
430
+ ...Object.keys(prototypeObj || {}),
431
+ ]).filter(f => !!f && !notAllowedAsMethodName.includes(f));
432
+ properties
433
+ .filter(methodName => typeof objectToCheck[methodName] === 'function')
434
+ .forEach(p => allMethodsNames.push(p));
435
+ if (!classFun ||
436
+ !classFun.constructor ||
437
+ classFun?.constructor?.name === 'Object') {
438
+ return allMethodsNames;
439
+ }
440
+ return ClassHelpers.getMethodsNames(Object.getPrototypeOf(classFun), allMethodsNames);
441
+ };
442
+ ClassHelpers.getControllerConfigs = (target, configs = [], callerTarget) => {
443
+ if (!_.isFunction(target)) {
444
+ throw `[typescript-class-helper][getClassConfig] Cannot get class config from: ${target}`;
445
+ }
446
+ let config;
447
+ const parentClass = Object.getPrototypeOf(target);
448
+ const parentName = parentClass ? ClassHelpers.getName(parentClass) : void 0;
449
+ const isValidParent = _.isFunction(parentClass) && parentName !== '';
450
+ config = ClassHelpers.getControllerConfig(target);
451
+ configs.push(config);
452
+ return isValidParent
453
+ ? ClassHelpers.getControllerConfigs(parentClass, configs, target)
454
+ : configs;
455
+ };
456
+ ClassHelpers.getCalculatedPathFor = (target) => {
457
+ const configs = ClassHelpers.getControllerConfigs(target);
458
+ const parentscalculatedPath = _.slice(configs, 1)
459
+ .reverse()
460
+ .map(bc => {
461
+ if (TaonHelpers.isGoodPath(bc.path)) {
462
+ return bc.path;
463
+ }
464
+ return bc.className;
465
+ })
466
+ .join('/');
467
+ return `/${parentscalculatedPath}/${ClassHelpers.getName(target)}`;
468
+ };
469
+ })(ClassHelpers || (ClassHelpers = {}));
470
+ ;
471
+ ({}); // @--end-of-file-for-module=taon lib/helpers/class-helpers.ts
472
+
473
+ /* */
474
+ /* */
475
+ var Models;
476
+ (function (Models) {
477
+ let ClassType;
478
+ (function (ClassType) {
479
+ ClassType["ENTITY"] = "ENTITY";
480
+ ClassType["CONTROLLER"] = "CONTROLLER";
481
+ ClassType["REPOSITORY"] = "REPOSITORY";
482
+ ClassType["PROVIDER"] = "PROVIDER";
483
+ ClassType["SUBSCRIBER"] = "SUBSCRIBER";
484
+ })(ClassType = Models.ClassType || (Models.ClassType = {}));
485
+ Models.ClassTypeKey = {
486
+ [ClassType.ENTITY]: 'entities',
487
+ [ClassType.CONTROLLER]: 'controllers',
488
+ [ClassType.REPOSITORY]: 'repositories',
489
+ [ClassType.PROVIDER]: 'providers',
490
+ [ClassType.SUBSCRIBER]: 'subscribers',
491
+ };
492
+ class DecoratorAbstractOpt {
493
+ }
494
+ Models.DecoratorAbstractOpt = DecoratorAbstractOpt;
495
+ class ParamConfig {
496
+ }
497
+ Models.ParamConfig = ParamConfig;
498
+ class MethodConfig {
499
+ constructor() {
500
+ /* */
501
+ /* */
502
+ this.parameters = {};
503
+ }
504
+ }
505
+ Models.MethodConfig = MethodConfig;
506
+ class ControllerConfig extends DecoratorAbstractOpt {
507
+ constructor() {
508
+ super(...arguments);
509
+ this.methods = {};
510
+ }
511
+ }
512
+ Models.ControllerConfig = ControllerConfig;
513
+ class RuntimeControllerConfig extends ControllerConfig {
514
+ }
515
+ Models.RuntimeControllerConfig = RuntimeControllerConfig;
516
+ let Http;
517
+ (function (Http) {
518
+ Http.Rest = Models$1;
519
+ class Errors {
520
+ constructor(message, code = 400) {
521
+ this.message = message;
522
+ this.code = code;
523
+ this.toString = () => {
524
+ return this.message;
525
+ };
526
+ }
527
+ static create(message, code = 400) {
528
+ return new Errors(message, code);
529
+ }
530
+ static entityNotFound(entity) {
531
+ return Errors.create(`Entity ${ClassHelpers.getName(entity)} not found`);
532
+ }
533
+ static custom(message, code = 400) {
534
+ return Errors.create(message, code);
535
+ }
536
+ }
537
+ Http.Errors = Errors;
538
+ /* */
539
+ /* */
540
+ /* */
541
+ /* */
542
+ /* */
543
+ })(Http = Models.Http || (Models.Http = {}));
544
+ })(Models || (Models = {}));
545
+ ;
546
+ ({}); // @--end-of-file-for-module=taon lib/models.ts
547
+
548
+ const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
549
+ let options;
550
+ if (typeof pathOrOptions === 'object') {
551
+ options = pathOrOptions;
552
+ pathOrOptions = options.path;
553
+ pathIsGlobal = !!options.pathIsGlobal;
554
+ path = options.path;
555
+ }
556
+ else {
557
+ options = { pathOrOptions, pathIsGlobal };
558
+ }
559
+ const { overrideContentType, overridResponseType } = options;
560
+ let methodConfig = Reflect.getMetadata(Symbols.metadata.options.controllerMethod, target.constructor, propertyKey);
561
+ if (!methodConfig) {
562
+ methodConfig = new Models.MethodConfig();
563
+ Reflect.defineMetadata(Symbols.metadata.options.controllerMethod, methodConfig, target.constructor, propertyKey);
564
+ }
565
+ methodConfig.methodName = propertyKey;
566
+ methodConfig.type = method;
567
+ if (!path) {
568
+ let paramsPathConcatedPath = '';
569
+ for (const key in methodConfig.parameters) {
570
+ if (methodConfig.parameters.hasOwnProperty(key)) {
571
+ const element = methodConfig.parameters[key];
572
+ if (element.paramType === 'Path' &&
573
+ _.isString(element.paramName) &&
574
+ element.paramName.trim().length > 0) {
575
+ paramsPathConcatedPath += `/${element.paramName}/:${element.paramName}`;
576
+ }
577
+ }
578
+ }
579
+ methodConfig.path = `/${propertyKey}${paramsPathConcatedPath}`;
580
+ }
581
+ else {
582
+ methodConfig.path = path;
583
+ }
584
+ methodConfig.descriptor = descriptor;
585
+ methodConfig.global = pathIsGlobal;
586
+ methodConfig.contentType = overrideContentType;
587
+ methodConfig.responseType = overridResponseType;
588
+ Reflect.defineMetadata(Symbols.metadata.options.controllerMethod, methodConfig, target.constructor, propertyKey);
589
+ };
590
+ function GET(pathOrOptions, pathIsGlobal = false) {
591
+ return function (target, propertyKey, descriptor) {
592
+ metaReq('get', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
593
+ };
594
+ }
595
+ function HEAD(pathOrOptions, pathIsGlobal = false) {
596
+ return function (target, propertyKey, descriptor) {
597
+ metaReq('head', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
598
+ };
599
+ }
600
+ function POST(pathOrOptions, pathIsGlobal = false) {
601
+ return function (target, propertyKey, descriptor) {
602
+ metaReq('post', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
603
+ };
604
+ }
605
+ function PUT(pathOrOptions, pathIsGlobal = false) {
606
+ return function (target, propertyKey, descriptor) {
607
+ metaReq('put', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
608
+ };
609
+ }
610
+ function PATCH(pathOrOptions, pathIsGlobal = false) {
611
+ return function (target, propertyKey, descriptor) {
612
+ metaReq('patch', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
613
+ };
614
+ }
615
+ function DELETE(pathOrOptions, pathIsGlobal = false) {
616
+ return function (target, propertyKey, descriptor) {
617
+ metaReq('delete', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
618
+ };
619
+ }
620
+ ;
621
+ ({}); // @--end-of-file-for-module=taon lib/decorators/http/http-methods-decorators.ts
622
+
623
+ function metaParam(param, name, expire, defaultValue = undefined, target, propertyKey, parameterIndex) {
624
+ let methodConfig = Reflect.getMetadata(Symbols.metadata.options.controllerMethod, target.constructor, propertyKey);
625
+ if (!methodConfig) {
626
+ methodConfig = new Models.MethodConfig();
627
+ Reflect.defineMetadata(Symbols.metadata.options.controllerMethod, methodConfig, target.constructor, propertyKey);
628
+ }
629
+ const nameKey = name ? name : param;
630
+ const p = (methodConfig.parameters[nameKey] = !methodConfig.parameters[nameKey]
631
+ ? new Models.ParamConfig()
632
+ : methodConfig.parameters[nameKey]);
633
+ p.index = parameterIndex;
634
+ p.paramName = name;
635
+ p.paramType = param;
636
+ p.defaultType = defaultValue;
637
+ p.expireInSeconds = expire;
638
+ Reflect.defineMetadata(Symbols.metadata.options.controllerMethod, methodConfig, target.constructor, propertyKey);
639
+ }
640
+ function Path(name) {
641
+ return function (target, propertyKey, parameterIndex) {
642
+ metaParam('Path', name, undefined, {}, target, propertyKey, parameterIndex);
643
+ };
644
+ }
645
+ function Query(name) {
646
+ return function (target, propertyKey, parameterIndex) {
647
+ metaParam('Query', name, undefined, {}, target, propertyKey, parameterIndex);
648
+ };
649
+ }
650
+ function Cookie(name, expireInSecond = 3600) {
651
+ return function (target, propertyKey, parameterIndex) {
652
+ metaParam('Cookie', name, expireInSecond, {}, target, propertyKey, parameterIndex);
653
+ };
654
+ }
655
+ function Header(name) {
656
+ return function (target, propertyKey, parameterIndex) {
657
+ metaParam('Header', name, undefined, {}, target, propertyKey, parameterIndex);
658
+ };
659
+ }
660
+ function Body(name) {
661
+ return function (target, propertyKey, parameterIndex) {
662
+ metaParam('Body', name, undefined, {}, target, propertyKey, parameterIndex);
663
+ };
664
+ }
665
+ ;
666
+ ({}); // @--end-of-file-for-module=taon lib/decorators/http/http-params-decorators.ts
667
+
668
+ var Http;
669
+ (function (Http) {
670
+ Http.GET = GET;
671
+ Http.POST = POST;
672
+ Http.PUT = PUT;
673
+ Http.DELETE = DELETE;
674
+ Http.PATCH = PATCH;
675
+ Http.HEAD = HEAD;
676
+ let Param;
677
+ (function (Param) {
678
+ Param.Query = Query;
679
+ Param.Path = Path;
680
+ Param.Body = Body;
681
+ Param.Cookie = Cookie;
682
+ Param.Header = Header;
683
+ })(Param = Http.Param || (Http.Param = {}));
684
+ })(Http || (Http = {}));
685
+ ;
686
+ ({}); // @--end-of-file-for-module=taon lib/decorators/http/http-decorators.ts
687
+
688
+ function TaonController(options) {
689
+ return function (constructor) {
690
+ ClassHelpers.setName(constructor, options?.className);
691
+ Reflect.defineMetadata(Symbols.metadata.options.controller, options, constructor);
692
+ Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
693
+ };
694
+ }
695
+ class TaonControllerOptions extends Models.DecoratorAbstractOpt {
696
+ }
697
+ ;
698
+ ({}); // @--end-of-file-for-module=taon lib/decorators/classes/controller-decorator.ts
699
+
700
+ class BaseInjector {
701
+ constructor() {
702
+ /**
703
+ * Repositories to init (by controller)
704
+ */
705
+ this.__repositories_to_init__ = [];
706
+ }
707
+ /**
708
+ * class initialization hook
709
+ * taon after class instace creation
710
+ */
711
+ async _() {
712
+ const reposToInit = this.__repositories_to_init__;
713
+ for (const repo of reposToInit) {
714
+ await repo.__init(this);
715
+ }
716
+ }
717
+ /**
718
+ * Current endpoint context
719
+ */
720
+ get __endpoint_context__() {
721
+ return this[Symbols.ctxInClassOrClassObj];
722
+ }
723
+ /**
724
+ * inject crud repo for entity
725
+ */
726
+ injectRepo(entityForCrud) {
727
+ const repoProxy = this.__inject(void 0, {
728
+ localInstance: true,
729
+ resolveClassFromContext: 'BaseRepository',
730
+ locaInstanceConstructorArgs: [() => entityForCrud],
731
+ });
732
+ this.__repositories_to_init__.push(repoProxy);
733
+ return repoProxy;
734
+ }
735
+ injectCustomRepository(cutomRepositoryClass) {
736
+ const repoProxy = this.__inject(cutomRepositoryClass, {
737
+ localInstance: true,
738
+ locaInstanceConstructorArgs: [
739
+ () => cutomRepositoryClass.prototype.entityClassResolveFn(),
740
+ ],
741
+ });
742
+ this.__repositories_to_init__.push(repoProxy);
743
+ return repoProxy;
744
+ }
745
+ /**
746
+ * aliast to .injectRepository()
747
+ */
748
+ injectCustomRepo(cutomRepositoryClass) {
749
+ const repoProxy = this.injectCustomRepository(cutomRepositoryClass);
750
+ this.__repositories_to_init__.push(repoProxy);
751
+ return repoProxy;
752
+ }
753
+ injectController(ctor) {
754
+ return this.__inject(ctor, { localInstance: false });
755
+ }
756
+ /**
757
+ * aliast to .injectController()
758
+ */
759
+ injectSubscriber(ctor) {
760
+ return this.__inject(ctor, { localInstance: false });
761
+ }
762
+ /**
763
+ * aliast to .injectController()
764
+ */
765
+ injectCtrl(ctor) {
766
+ return this.injectController(ctor);
767
+ }
768
+ /**
769
+ * global provider available in every context
770
+ */
771
+ injectGlobalProvider(ctor) {
772
+ return this.__inject(ctor, { localInstance: false });
773
+ }
774
+ /**
775
+ * context scoped provider
776
+ * TODO
777
+ */
778
+ injectContextProvider(ctor) {
779
+ return this.__inject(ctor, { localInstance: false });
780
+ }
781
+ /**
782
+ * Inject: Controllers, Providers, Repositories, Services, etc.
783
+ * TODO addd nest js injecting
784
+ */
785
+ __inject(ctor, options) {
786
+ if (!options) {
787
+ options = {};
788
+ }
789
+ const contextClassInstance = this;
790
+ return new Proxy({}, {
791
+ get: (__, propName) => {
792
+ const contextFromClass = ctor && ctor[Symbols.ctxInClassOrClassObj];
793
+ const resultContext = contextFromClass
794
+ ? contextFromClass
795
+ : this.__endpoint_context__;
796
+ if (options.resolveClassFromContext) {
797
+ const resolvedClass = resultContext.getClassFunByClassName(options.resolveClassFromContext);
798
+ ctor = resolvedClass;
799
+ }
800
+ if (resultContext) {
801
+ var instance = resultContext.inject(ctor, {
802
+ ...options,
803
+ contextClassInstance,
804
+ });
805
+ if (!instance) {
806
+ throw new Error(`Not able to inject "${ClassHelpers.getName(ctor) || ctor.name}" inside ` +
807
+ `property "${propName?.toString()}" on class "${ClassHelpers.getName(this)}".
808
+
809
+ Please add "${ClassHelpers.getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories)
810
+
811
+ `);
812
+ }
813
+ const result = typeof instance[propName] === 'function'
814
+ ? instance[propName].bind(instance)
815
+ : instance[propName];
816
+ return result;
817
+ }
818
+ },
819
+ set: (__, propName, value) => {
820
+ const contextFromClass = ctor && ctor[Symbols.ctxInClassOrClassObj];
821
+ const resultContext = contextFromClass
822
+ ? contextFromClass
823
+ : this.__endpoint_context__;
824
+ if (options.resolveClassFromContext) {
825
+ const resolvedClass = resultContext.getClassFunByClassName(options.resolveClassFromContext);
826
+ ctor = resolvedClass;
827
+ }
828
+ if (resultContext) {
829
+ var instance = resultContext.inject(ctor, {
830
+ ...options,
831
+ contextClassInstance,
832
+ });
833
+ if (!instance) {
834
+ const classNameNotResolved = ClassHelpers.getName(ctor) || ctor.name;
835
+ throw new Error(`Not able to inject "${classNameNotResolved}" inside ` +
836
+ `property "${propName?.toString()}" on class "${ClassHelpers.getName(this)}".
837
+
838
+ Please add "${ClassHelpers.getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories)
839
+
840
+ `);
841
+ }
842
+ instance[propName] = value;
843
+ }
844
+ return true;
845
+ },
846
+ });
847
+ }
848
+ clone(override) {
849
+ const classFn = ClassHelpers.getClassFnFromObject(this);
850
+ const result = _.merge(new classFn(), _.merge(_.cloneDeep(this), override));
851
+ return result;
852
+ }
853
+ }
854
+ ;
855
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-injector.ts
856
+
857
+ let BaseController = class BaseController extends BaseInjector {
858
+ /**
859
+ * init example data for db
860
+ */
861
+ initExampleDbData() {
862
+ return void 0;
863
+ }
864
+ };
865
+ BaseController = __decorate([
866
+ TaonController({ className: 'BaseController' })
867
+ ], BaseController);
868
+ ;
869
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-controller.ts
870
+
871
+ /**
872
+ * Please override property entityClassFn with entity class.
873
+ */
874
+ let BaseCrudController = class BaseCrudController extends BaseController {
875
+ async _() {
876
+ if (!_.isFunction(this.entityClassResolveFn)) {
877
+ Helpers.warn(`Skipping initing CRUD controller ${ClassHelpers.getName(this)} because entityClassResolveFn is not provided.`);
878
+ return;
879
+ }
880
+ let entityClassFn = this.entityClassResolveFn();
881
+ this.db = this.injectRepo(entityClassFn);
882
+ if (entityClassFn) {
883
+ const configEntity = Reflect.getMetadata(Symbols.metadata.options.entity, ClassHelpers.getClassFnFromObject(this));
884
+ if (configEntity?.createTable === false) {
885
+ Helpers.warn(`Table for entity ${ClassHelpers.getName(entityClassFn)} will not be created. Crud will not work properly.`);
886
+ }
887
+ }
888
+ else {
889
+ Helpers.error(`Entity class not provided for controller ${ClassHelpers.getName(this)}.
890
+
891
+ Please provide entity as class propery entityClassFn:
892
+
893
+ class ${ClassHelpers.getName(this)} extends BaseCrudController<Entity> {
894
+
895
+ entityClassResolveFn = ()=> MyEntityClass;
896
+
897
+ }
898
+
899
+ `);
900
+ }
901
+ await super._();
902
+ }
903
+ bufforedChanges(id, property, alreadyLength) {
904
+ /* */
905
+ /* */
906
+ /* */
907
+ /* */
908
+ /* */
909
+ /* */
910
+ /* */
911
+ /* */
912
+ /* */
913
+ /* */
914
+ /* */
915
+ /* */
916
+ /* */
917
+ /* */
918
+ /* */
919
+ return (void 0);
920
+ }
921
+ pagination(pageNumber = 1, pageSize = 10, search = '') {
922
+ /* */
923
+ /* */
924
+ /* */
925
+ /* */
926
+ /* */
927
+ /* */
928
+ /* */
929
+ /* */
930
+ /* */
931
+ /* */
932
+ /* */
933
+ /* */
934
+ /* */
935
+ /* */
936
+ /* */
937
+ /* */
938
+ /* */
939
+ /* */
940
+ /* */
941
+ /* */
942
+ /* */
943
+ /* */
944
+ /* */
945
+ /* */
946
+ /* */
947
+ /* */
948
+ /* */
949
+ /* */
950
+ /* */
951
+ /* */
952
+ /* */
953
+ /* */
954
+ /* */
955
+ /* */
956
+ /* */
957
+ /* */
958
+ /* */
959
+ /* */
960
+ return (void 0);
961
+ }
962
+ getAll() {
963
+ /* */
964
+ /* */
965
+ /* */
966
+ /* */
967
+ /* */
968
+ /* */
969
+ /* */
970
+ /* */
971
+ /* */
972
+ return (void 0);
973
+ }
974
+ getBy(id) {
975
+ /* */
976
+ /* */
977
+ /* */
978
+ /* */
979
+ /* */
980
+ return (void 0);
981
+ }
982
+ updateById(id, item) {
983
+ /* */
984
+ /* */
985
+ /* */
986
+ /* */
987
+ /* */
988
+ /* */
989
+ return (void 0);
990
+ }
991
+ patchById(id, item) {
992
+ /* */
993
+ /* */
994
+ /* */
995
+ /* */
996
+ /* */
997
+ /* */
998
+ return (void 0);
999
+ }
1000
+ bulkUpdate(items) {
1001
+ /* */
1002
+ /* */
1003
+ /* */
1004
+ /* */
1005
+ /* */
1006
+ /* */
1007
+ /* */
1008
+ /* */
1009
+ return (void 0);
1010
+ }
1011
+ deleteById(id) {
1012
+ /* */
1013
+ /* */
1014
+ /* */
1015
+ /* */
1016
+ /* */
1017
+ return (void 0);
1018
+ }
1019
+ bulkDelete(ids) {
1020
+ /* */
1021
+ /* */
1022
+ /* */
1023
+ /* */
1024
+ /* */
1025
+ return (void 0);
1026
+ }
1027
+ create(item) {
1028
+ /* */
1029
+ /* */
1030
+ /* */
1031
+ /* */
1032
+ /* */
1033
+ return (void 0);
1034
+ }
1035
+ bulkCreate(items) {
1036
+ /* */
1037
+ /* */
1038
+ /* */
1039
+ /* */
1040
+ /* */
1041
+ return (void 0);
1042
+ }
1043
+ };
1044
+ __decorate([
1045
+ GET(`/:id/property/:property`),
1046
+ __param(0, Path(`id`)),
1047
+ __param(1, Path(`property`)),
1048
+ __param(2, Query('alreadyLength')),
1049
+ __metadata("design:type", Function),
1050
+ __metadata("design:paramtypes", [Object, String, Number]),
1051
+ __metadata("design:returntype", Object)
1052
+ ], BaseCrudController.prototype, "bufforedChanges", null);
1053
+ __decorate([
1054
+ GET(),
1055
+ __param(0, Query('pageNumber')),
1056
+ __param(1, Query('pageSize')),
1057
+ __param(2, Query('search')),
1058
+ __metadata("design:type", Function),
1059
+ __metadata("design:paramtypes", [Number, Number, String]),
1060
+ __metadata("design:returntype", Object)
1061
+ ], BaseCrudController.prototype, "pagination", null);
1062
+ __decorate([
1063
+ GET(),
1064
+ __metadata("design:type", Function),
1065
+ __metadata("design:paramtypes", []),
1066
+ __metadata("design:returntype", Object)
1067
+ ], BaseCrudController.prototype, "getAll", null);
1068
+ __decorate([
1069
+ GET(`/:id`),
1070
+ __param(0, Path(`id`)),
1071
+ __metadata("design:type", Function),
1072
+ __metadata("design:paramtypes", [Object]),
1073
+ __metadata("design:returntype", Object)
1074
+ ], BaseCrudController.prototype, "getBy", null);
1075
+ __decorate([
1076
+ PUT(`/:id`),
1077
+ __param(0, Path(`id`)),
1078
+ __param(1, Body()),
1079
+ __metadata("design:type", Function),
1080
+ __metadata("design:paramtypes", [Object, Object]),
1081
+ __metadata("design:returntype", Object)
1082
+ ], BaseCrudController.prototype, "updateById", null);
1083
+ __decorate([
1084
+ PATCH(`/:id`),
1085
+ __param(0, Path(`id`)),
1086
+ __param(1, Body()),
1087
+ __metadata("design:type", Function),
1088
+ __metadata("design:paramtypes", [Object, Object]),
1089
+ __metadata("design:returntype", Object)
1090
+ ], BaseCrudController.prototype, "patchById", null);
1091
+ __decorate([
1092
+ PUT(),
1093
+ __param(0, Body()),
1094
+ __metadata("design:type", Function),
1095
+ __metadata("design:paramtypes", [Array]),
1096
+ __metadata("design:returntype", Object)
1097
+ ], BaseCrudController.prototype, "bulkUpdate", null);
1098
+ __decorate([
1099
+ DELETE(`/:id`),
1100
+ __param(0, Path(`id`)),
1101
+ __metadata("design:type", Function),
1102
+ __metadata("design:paramtypes", [Number]),
1103
+ __metadata("design:returntype", Object)
1104
+ ], BaseCrudController.prototype, "deleteById", null);
1105
+ __decorate([
1106
+ DELETE(`/bulkDelete/:ids`),
1107
+ __param(0, Path(`ids`)),
1108
+ __metadata("design:type", Function),
1109
+ __metadata("design:paramtypes", [Array]),
1110
+ __metadata("design:returntype", Object)
1111
+ ], BaseCrudController.prototype, "bulkDelete", null);
1112
+ __decorate([
1113
+ POST(),
1114
+ __param(0, Body()),
1115
+ __metadata("design:type", Function),
1116
+ __metadata("design:paramtypes", [Object]),
1117
+ __metadata("design:returntype", Object)
1118
+ ], BaseCrudController.prototype, "create", null);
1119
+ __decorate([
1120
+ POST(),
1121
+ __param(0, Body()),
1122
+ __metadata("design:type", Function),
1123
+ __metadata("design:paramtypes", [Object]),
1124
+ __metadata("design:returntype", Object)
1125
+ ], BaseCrudController.prototype, "bulkCreate", null);
1126
+ BaseCrudController = __decorate([
1127
+ TaonController({ className: 'BaseCrudController' })
1128
+ ], BaseCrudController);
1129
+ ;
1130
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-crud-controller.ts
1131
+
1132
+ class BaseClass {
1133
+ /**
1134
+ * class initialization hook
1135
+ * taon after class instace creation
1136
+ */
1137
+ async _() { }
1138
+ clone(override) {
1139
+ const classFn = ClassHelpers.getClassFnFromObject(this);
1140
+ const result = _.merge(new classFn(), _.merge(_.cloneDeep(this), override));
1141
+ return result;
1142
+ }
1143
+ }
1144
+ ;
1145
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-class.ts
1146
+
1147
+ /* */
1148
+ /* */
1149
+ let EntityDecorator$1 = () => {
1150
+ return (target) => { };
1151
+ };
1152
+ /* */
1153
+ /* */
1154
+ let BaseEntity = class BaseEntity extends BaseClass {
1155
+ };
1156
+ BaseEntity = __decorate([
1157
+ EntityDecorator$1()
1158
+ ], BaseEntity);
1159
+ ;
1160
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-entity.ts
1161
+
1162
+ /* */
1163
+ /* */
1164
+ let EntityDecorator = () => {
1165
+ return (target) => { };
1166
+ };
1167
+ /* */
1168
+ /* */
1169
+ let BaseAbstractEntity = class BaseAbstractEntity extends BaseEntity {
1170
+ };
1171
+ BaseAbstractEntity = __decorate([
1172
+ EntityDecorator()
1173
+ ], BaseAbstractEntity);
1174
+ ;
1175
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-abstract-entity.ts
1176
+
1177
+ function TaonRepository(options) {
1178
+ return function (constructor) {
1179
+ Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
1180
+ Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
1181
+ ClassHelpers.setName(constructor, options?.className);
1182
+ };
1183
+ }
1184
+ class TaonRepositoryOptions extends Models.DecoratorAbstractOpt {
1185
+ }
1186
+ ;
1187
+ ({}); // @--end-of-file-for-module=taon lib/decorators/classes/repository-decorator.ts
1188
+
1189
+ const INDEX_KEYS_NO_FOR_UPDATE = ['id'];
1190
+ let BaseRepository = class BaseRepository extends BaseInjector {
1191
+ constructor(__entityClassResolveFn) {
1192
+ super();
1193
+ this.__entityClassResolveFn = __entityClassResolveFn;
1194
+ // @ts-ignore
1195
+ this.entityClassResolveFn = __entityClassResolveFn;
1196
+ }
1197
+ get dbQuery() {
1198
+ /* */
1199
+ /* */
1200
+ /* */
1201
+ /* */
1202
+ /* */
1203
+ /* */
1204
+ /* */
1205
+ /* */
1206
+ /* */
1207
+ /* */
1208
+ /* */
1209
+ /* */
1210
+ /* */
1211
+ /* */
1212
+ /* */
1213
+ /* */
1214
+ /* */
1215
+ /* */
1216
+ /* */
1217
+ return (void 0);
1218
+ }
1219
+ get connection() {
1220
+ /* */
1221
+ /* */
1222
+ return (void 0);
1223
+ }
1224
+ /* */
1225
+ /* */
1226
+ get repository() {
1227
+ /* */
1228
+ /* */
1229
+ return (void 0);
1230
+ }
1231
+ /**
1232
+ * target for repository
1233
+ */
1234
+ get target() {
1235
+ /* */
1236
+ /* */
1237
+ return (void 0);
1238
+ }
1239
+ /**
1240
+ * alias to repository
1241
+ */
1242
+ get repo() {
1243
+ /* */
1244
+ /* */
1245
+ return (void 0);
1246
+ }
1247
+ get repositoryExists() {
1248
+ /* */
1249
+ /* */
1250
+ return (void 0);
1251
+ }
1252
+ async __init(context) {
1253
+ /* */
1254
+ /* */
1255
+ /* */
1256
+ /* */
1257
+ /* */
1258
+ /* */
1259
+ /* */
1260
+ /* */
1261
+ /* */
1262
+ /* */
1263
+ /* */
1264
+ /* */
1265
+ /* */
1266
+ /* */
1267
+ /* */
1268
+ /* */
1269
+ /* */
1270
+ /* */
1271
+ /* */
1272
+ /* */
1273
+ /* */
1274
+ /* */
1275
+ /* */
1276
+ /* */
1277
+ /* */
1278
+ /* */
1279
+ /* */
1280
+ /* */
1281
+ /* */
1282
+ /* */
1283
+ /* */
1284
+ /* */
1285
+ /* */
1286
+ /* */
1287
+ /* */
1288
+ /* */
1289
+ /* */
1290
+ /* */
1291
+ /* */
1292
+ /* */
1293
+ /* */
1294
+ /* */
1295
+ /* */
1296
+ /* */
1297
+ /* */
1298
+ /* */
1299
+ /* */
1300
+ /* */
1301
+ /* */
1302
+ /* */
1303
+ /* */
1304
+ }
1305
+ /**
1306
+ * Checks if entity has an id.
1307
+ * If entity composite compose ids, it will check them all.
1308
+ */
1309
+ hasId(entity) {
1310
+ return this.repo.hasId(entity);
1311
+ }
1312
+ /**
1313
+ * Gets entity mixed id.
1314
+ */
1315
+ getId(entity) {
1316
+ return this.repo.getId(entity);
1317
+ }
1318
+ /**
1319
+ Saves a given entity in the database.
1320
+ * If entity does not exist in the database then inserts, otherwise updates.
1321
+ */
1322
+ async save(item, options) {
1323
+ /* */
1324
+ /* */
1325
+ /* */
1326
+ /* */
1327
+ /* */
1328
+ /* */
1329
+ /* */
1330
+ /* */
1331
+ /* */
1332
+ /* */
1333
+ /* */
1334
+ return (void 0);
1335
+ }
1336
+ /**
1337
+ * alias to save
1338
+ * -> it will actuall create new entity in db
1339
+ * in oposite to typeorm create method
1340
+ */
1341
+ async create(item, options) {
1342
+ return this.save(item, options);
1343
+ }
1344
+ async bulkSave(items, options) {
1345
+ /* */
1346
+ /* */
1347
+ /* */
1348
+ /* */
1349
+ /* */
1350
+ /* */
1351
+ /* */
1352
+ /* */
1353
+ /* */
1354
+ return (void 0);
1355
+ }
1356
+ async bulkCreate(items, options) {
1357
+ return this.bulkSave(items, options);
1358
+ }
1359
+ /**
1360
+ * Saves all given entities in the database.
1361
+ * If entities do not exist in the database then inserts, otherwise updates.
1362
+ */
1363
+ /**
1364
+ * Merges multiple entities (or entity-like objects) into a given entity.
1365
+ */
1366
+ merge(mergeIntoEntity, ...entityLikes) {
1367
+ return this.repo.merge(mergeIntoEntity, ...entityLikes);
1368
+ }
1369
+ /**
1370
+ * Creates a new entity from the given plain javascript object. If entity already exist in the database, then
1371
+ * it loads it (and everything related to it), replaces all values with the new ones from the given object
1372
+ * and returns this new entity. This new entity is actually a loaded from the db entity with all properties
1373
+ * replaced from the new object.
1374
+ *
1375
+ * Note that given entity-like object must have an entity id / primary key to find entity by.
1376
+ * Returns undefined if entity with given id was not found.
1377
+ */
1378
+ preload(entityLike) {
1379
+ return this.repo.preload(entityLike);
1380
+ }
1381
+ /**
1382
+ * Removes a given entities from the database.
1383
+ */
1384
+ async remove(idOrEntity) {
1385
+ /* */
1386
+ /* */
1387
+ /* */
1388
+ /* */
1389
+ /* */
1390
+ /* */
1391
+ /* */
1392
+ /* */
1393
+ /* */
1394
+ /* */
1395
+ /* */
1396
+ /* */
1397
+ /* */
1398
+ return (void 0);
1399
+ }
1400
+ /**
1401
+ * alias to remove
1402
+ */
1403
+ async delete(idOrEntity) {
1404
+ return this.remove(idOrEntity);
1405
+ }
1406
+ /**
1407
+ * alias to removeById
1408
+ */
1409
+ async deleteById(id) {
1410
+ return this.remove(id);
1411
+ }
1412
+ async bulkRemove(idsOrEntities) {
1413
+ /* */
1414
+ /* */
1415
+ /* */
1416
+ /* */
1417
+ /* */
1418
+ /* */
1419
+ /* */
1420
+ /* */
1421
+ /* */
1422
+ /* */
1423
+ /* */
1424
+ /* */
1425
+ return (void 0);
1426
+ }
1427
+ async bulkDelete(ids) {
1428
+ return this.bulkRemove(ids);
1429
+ }
1430
+ /**
1431
+ * Records the delete date of a given entity.
1432
+ */
1433
+ softRemove(entity, options) {
1434
+ return this.repo.softRemove(entity, options);
1435
+ }
1436
+ /**
1437
+ * Recovers a given entity in the database.
1438
+ */
1439
+ recover(entity, options) {
1440
+ return this.repo.recover(entity, options);
1441
+ }
1442
+ /**
1443
+ * Inserts a given entity into the database.
1444
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
1445
+ * Executes fast and efficient INSERT query.
1446
+ * Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted.
1447
+ */
1448
+ insert(entity) {
1449
+ return this.repo.insert(entity);
1450
+ }
1451
+ async update(item) {
1452
+ /* */
1453
+ /* */
1454
+ /* */
1455
+ return (void 0);
1456
+ }
1457
+ async updateById(id, item) {
1458
+ /* */
1459
+ /* */
1460
+ /* */
1461
+ /* */
1462
+ /* */
1463
+ /* */
1464
+ /* */
1465
+ /* */
1466
+ /* */
1467
+ /* */
1468
+ /* */
1469
+ /* */
1470
+ /* */
1471
+ /* */
1472
+ /* */
1473
+ /* */
1474
+ /* */
1475
+ /* */
1476
+ /* */
1477
+ /* */
1478
+ /* */
1479
+ /* */
1480
+ /* */
1481
+ /* */
1482
+ /* */
1483
+ /* */
1484
+ /* */
1485
+ /* */
1486
+ /* */
1487
+ /* */
1488
+ /* */
1489
+ /* */
1490
+ /* */
1491
+ /* */
1492
+ /* */
1493
+ /* */
1494
+ /* */
1495
+ /* */
1496
+ /* */
1497
+ /* */
1498
+ /* */
1499
+ /* */
1500
+ return (void 0);
1501
+ }
1502
+ async bulkUpdate(items) {
1503
+ /* */
1504
+ /* */
1505
+ /* */
1506
+ /* */
1507
+ /* */
1508
+ /* */
1509
+ /* */
1510
+ /* */
1511
+ /* */
1512
+ return (void 0);
1513
+ }
1514
+ /**
1515
+ * Inserts a given entity into the database, unless a unique constraint conflicts then updates the entity
1516
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
1517
+ * Executes fast and efficient INSERT ... ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE query.
1518
+ */
1519
+ upsert(entityOrEntities, conflictPathsOrOptions) {
1520
+ return this.repo.upsert(entityOrEntities, conflictPathsOrOptions);
1521
+ }
1522
+ /**
1523
+ * Records the delete date of entities by a given criteria.
1524
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
1525
+ * Executes fast and efficient SOFT-DELETE query.
1526
+ * Does not check if entity exist in the database.
1527
+ */
1528
+ softDelete(criteria) {
1529
+ return this.repo.softDelete(criteria);
1530
+ }
1531
+ /**
1532
+ * Restores entities by a given criteria.
1533
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
1534
+ * Executes fast and efficient SOFT-DELETE query.
1535
+ * Does not check if entity exist in the database.
1536
+ */
1537
+ restore(criteria) {
1538
+ return this.repo.restore(criteria);
1539
+ }
1540
+ /**
1541
+ * Counts entities that match given options.
1542
+ * Useful for pagination.
1543
+ */
1544
+ count(options) {
1545
+ return this.repo.count(options);
1546
+ }
1547
+ /**
1548
+ * Counts entities that match given conditions.
1549
+ * Useful for pagination.
1550
+ */
1551
+ countBy(where) {
1552
+ return this.repo.countBy(where);
1553
+ }
1554
+ /**
1555
+ * Finds entities that match given find options.
1556
+ */
1557
+ find(options) {
1558
+ return this.repo.find(options);
1559
+ }
1560
+ /**
1561
+ * Finds entities that match given find options.
1562
+ */
1563
+ findBy(where) {
1564
+ return this.repo.findBy(where);
1565
+ }
1566
+ //
1567
+ /**
1568
+ * Finds entities that match given find options.
1569
+ * Also counts all entities that match given conditions,
1570
+ * but ignores pagination settings (from and take options).
1571
+ */
1572
+ findAndCount(options) {
1573
+ return this.repo.findAndCount(options);
1574
+ }
1575
+ /**
1576
+ * Finds entities that match given WHERE conditions.
1577
+ * Also counts all entities that match given conditions,
1578
+ * but ignores pagination settings (from and take options).
1579
+ */
1580
+ findAndCountBy(where) {
1581
+ return this.repo.findAndCountBy(where);
1582
+ }
1583
+ /**
1584
+ * Finds entities with ids.
1585
+ * Optionally find options or conditions can be applied.
1586
+ *
1587
+ * @deprecated use `findBy` method instead in conjunction with `In` operator, for example:
1588
+ *
1589
+ * .findBy({
1590
+ * id: In([1, 2, 3])
1591
+ * })
1592
+ */
1593
+ findByIds(ids) {
1594
+ return this.repo.findByIds(ids);
1595
+ }
1596
+ /**
1597
+ * Finds first entity by a given find options.
1598
+ * If entity was not found in the database - returns null.
1599
+ */
1600
+ findOne(options) {
1601
+ return this.repo.findOne(options);
1602
+ }
1603
+ /**
1604
+ * Finds first entity that matches given where condition.
1605
+ * If entity was not found in the database - returns null.
1606
+ */
1607
+ findOneBy(where) {
1608
+ return this.repo.findOneBy(where);
1609
+ }
1610
+ /**
1611
+ * Finds first entity that matches given id.
1612
+ * If entity was not found in the database - returns null.
1613
+ *
1614
+ * @deprecated use `findOneBy` method instead in conjunction with `In` operator, for example:
1615
+ *
1616
+ * .findOneBy({
1617
+ * id: 1 // where "id" is your primary column name
1618
+ * })
1619
+ */
1620
+ findOneById(id) {
1621
+ return this.repo.findOneById(id);
1622
+ }
1623
+ /**
1624
+ * Finds first entity by a given find options.
1625
+ * If entity was not found in the database - rejects with error.
1626
+ */
1627
+ findOneOrFail(options) {
1628
+ return this.repo.findOneOrFail(options);
1629
+ }
1630
+ /**
1631
+ * Finds first entity that matches given where condition.
1632
+ * If entity was not found in the database - rejects with error.
1633
+ */
1634
+ findOneByOrFail(where) {
1635
+ return this.repo.findOneByOrFail(where);
1636
+ }
1637
+ /**
1638
+ * Executes a raw SQL query and returns a raw database results.
1639
+ * Raw query execution is supported only by relational databases (MongoDB is not supported).
1640
+ */
1641
+ query(query, parameters) {
1642
+ return this.repo.query(query, parameters);
1643
+ }
1644
+ /**
1645
+ * Clears all the data from the given table/collection (truncates/drops it).
1646
+ *
1647
+ * Note: this method uses TRUNCATE and may not work as you expect in transactions on some platforms.
1648
+ * @see https://stackoverflow.com/a/5972738/925151
1649
+ */
1650
+ clear() {
1651
+ return this.repo.clear();
1652
+ }
1653
+ /**
1654
+ * Increments some column by provided value of the entities matched given conditions.
1655
+ */
1656
+ increment(conditions, propertyPath, value) {
1657
+ return this.repo.increment(conditions, propertyPath, value);
1658
+ }
1659
+ /**
1660
+ * Decrements some column by provided value of the entities matched given conditions.
1661
+ */
1662
+ decrement(conditions, propertyPath, value) {
1663
+ return this.repo.decrement(conditions, propertyPath, value);
1664
+ }
1665
+ /**
1666
+ * @deprecated use findAndCount instead
1667
+ */
1668
+ async getAll() {
1669
+ /* */
1670
+ /* */
1671
+ /* */
1672
+ /* */
1673
+ /* */
1674
+ /* */
1675
+ /* */
1676
+ /* */
1677
+ /* */
1678
+ /* */
1679
+ /* */
1680
+ return (void 0);
1681
+ }
1682
+ async getBy(id) {
1683
+ /* */
1684
+ /* */
1685
+ /* */
1686
+ /* */
1687
+ /* */
1688
+ /* */
1689
+ return (void 0);
1690
+ }
1691
+ };
1692
+ BaseRepository = __decorate([
1693
+ TaonRepository({ className: 'BaseRepository' }),
1694
+ __metadata("design:paramtypes", [Function])
1695
+ ], BaseRepository);
1696
+ ;
1697
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-repository.ts
1698
+
1699
+ class BaseProvider extends BaseInjector {
1700
+ }
1701
+ ;
1702
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-provider.ts
1703
+
1704
+ class DITaonContainer {
1705
+ static { this.instances = new Map(); }
1706
+ static resolve(target) {
1707
+ if (DITaonContainer.instances.has(target)) {
1708
+ return DITaonContainer.instances.get(target);
1709
+ }
1710
+ const injections = []; // tokens.map(token => Container.inject<any>(token));
1711
+ const instance = new target(...injections);
1712
+ DITaonContainer.instances.set(target, instance);
1713
+ return instance;
1714
+ }
1715
+ static inject(target) {
1716
+ return new Proxy({}, {
1717
+ get: (_, propName) => {
1718
+ let instance = DITaonContainer.instances.get(target) ||
1719
+ DITaonContainer.resolve(target);
1720
+ return typeof instance[propName] === 'function'
1721
+ ? instance[propName].bind(instance)
1722
+ : instance[propName];
1723
+ },
1724
+ set: (_, propName, value) => {
1725
+ let instance = DITaonContainer.instances.get(target) ||
1726
+ DITaonContainer.resolve(target);
1727
+ instance[propName] = value;
1728
+ return true;
1729
+ },
1730
+ });
1731
+ }
1732
+ }
1733
+ ;
1734
+ ({}); // @--end-of-file-for-module=taon lib/dependency-injection/di-container.ts
1735
+
1736
+ const getResponseValue = (response, options) => {
1737
+ /* */
1738
+ /* */
1739
+ /* */
1740
+ /* */
1741
+ /* */
1742
+ /* */
1743
+ /* */
1744
+ /* */
1745
+ /* */
1746
+ /* */
1747
+ /* */
1748
+ /* */
1749
+ /* */
1750
+ /* */
1751
+ /* */
1752
+ /* */
1753
+ /* */
1754
+ /* */
1755
+ /* */
1756
+ /* */
1757
+ /* */
1758
+ /* */
1759
+ /* */
1760
+ /* */
1761
+ /* */
1762
+ /* */
1763
+ /* */
1764
+ /* */
1765
+ /* */
1766
+ /* */
1767
+ /* */
1768
+ /* */
1769
+ /* */
1770
+ /* */
1771
+ /* */
1772
+ return (void 0);
1773
+ };
1774
+ ;
1775
+ ({}); // @--end-of-file-for-module=taon lib/get-response-value.ts
1776
+
1777
+ const ENV$1 = Helpers.isBrowser ? window['ENV'] : global['ENV'];
1778
+ ;
1779
+ ({}); // @--end-of-file-for-module=taon lib/env.ts
1780
+
1781
+ /* */
1782
+ /* */
1783
+ class RealtimeSubsManager {
1784
+ constructor(options) {
1785
+ this.options = options;
1786
+ this.isListening = false;
1787
+ this.observers = [];
1788
+ }
1789
+ startListenIfNotStarted(realtime) {
1790
+ if (this.options.core.ctx.disabledRealtime) {
1791
+ console.warn(`[Taon][startListenIfNotStarted] sockets are disabled`);
1792
+ return;
1793
+ }
1794
+ if (!realtime) {
1795
+ console.warn(`[Taon][startListenIfNotStarted] invalid socket connection`);
1796
+ return;
1797
+ }
1798
+ if (!this.isListening) {
1799
+ const subscribeEvent = Symbols.REALTIME.ROOM_NAME.SUBSCRIBE.CUSTOM(this.options.core.ctx.contextName);
1800
+ this.isListening = true;
1801
+ if (this.options.customEvent) {
1802
+ realtime.emit(subscribeEvent, this.options.roomName);
1803
+ }
1804
+ else {
1805
+ if (_.isString(this.options.property)) {
1806
+ realtime.emit(Symbols.REALTIME.ROOM_NAME.SUBSCRIBE.ENTITY_PROPERTY_UPDATE_EVENTS(this.options.core.ctx.contextName), this.options.roomName);
1807
+ }
1808
+ else {
1809
+ realtime.emit(Symbols.REALTIME.ROOM_NAME.SUBSCRIBE.ENTITY_UPDATE_EVENTS(this.options.core.ctx.contextName), this.options.roomName);
1810
+ }
1811
+ }
1812
+ realtime.on(this.options.roomName, data => {
1813
+ this.update(data);
1814
+ });
1815
+ }
1816
+ }
1817
+ add(observer) {
1818
+ this.observers.push(observer);
1819
+ }
1820
+ remove(observer) {
1821
+ this.observers = this.observers.filter(obs => obs !== observer);
1822
+ if (this.observers.length === 0) {
1823
+ this.isListening = false;
1824
+ const { core, customEvent, roomName, property } = this.options;
1825
+ const realtime = core.FE_REALTIME;
1826
+ if (customEvent) {
1827
+ realtime.emit(Symbols.REALTIME.ROOM_NAME.UNSUBSCRIBE.CUSTOM(this.options.core.ctx.contextName), roomName);
1828
+ }
1829
+ else {
1830
+ if (_.isString(property)) {
1831
+ realtime.emit(Symbols.REALTIME.ROOM_NAME.UNSUBSCRIBE.ENTITY_PROPERTY_UPDATE_EVENTS(this.options.core.ctx.contextName), roomName);
1832
+ }
1833
+ else {
1834
+ realtime.emit(Symbols.REALTIME.ROOM_NAME.UNSUBSCRIBE.ENTITY_UPDATE_EVENTS(this.options.core.ctx.contextName), roomName);
1835
+ }
1836
+ }
1837
+ }
1838
+ }
1839
+ update(data) {
1840
+ const ngZone = this.options.core.ctx.ngZone;
1841
+ this.observers.forEach(observer => {
1842
+ if (!observer.closed) {
1843
+ if (ngZone) {
1844
+ ngZone.run(() => {
1845
+ observer.next(data);
1846
+ });
1847
+ }
1848
+ else {
1849
+ observer.next(data);
1850
+ }
1851
+ }
1852
+ });
1853
+ }
1854
+ }
1855
+ ;
1856
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-subs-manager.ts
1857
+
1858
+ class RealtimeClient {
1859
+ constructor(core) {
1860
+ this.core = core;
1861
+ this.subsmanagers = {};
1862
+ this.core = core;
1863
+ if (!core.ctx.disabledRealtime) {
1864
+ this.init();
1865
+ }
1866
+ }
1867
+ init() {
1868
+ const nspPath = {
1869
+ global: this.core.pathFor(),
1870
+ realtime: this.core.pathFor(Symbols.REALTIME.NAMESPACE(this.core.ctx.contextName)),
1871
+ };
1872
+ this.core.ctx.logRealtime &&
1873
+ console.info('[CLIENT] NAMESPACE GLOBAL ', nspPath.global.href + ` host: ${this.core.ctx.host}`);
1874
+ this.core.ctx.logRealtime &&
1875
+ console.info('[CLIENT] NAMESPACE REALTIME', nspPath.realtime.href + ` host: ${this.core.ctx.host}`);
1876
+ this.core.FE = this.core.strategy.io(nspPath.global.origin, {
1877
+ path: nspPath.global.pathname,
1878
+ });
1879
+ if (this.core.FE.on) {
1880
+ this.core.FE.on('connect', () => {
1881
+ console.info(`[CLIENT] conented to GLOBAL namespace ${this.core.FE.id} of host: ${this.core.ctx.host}`);
1882
+ });
1883
+ }
1884
+ this.core.FE_REALTIME = this.core.strategy.io(nspPath.realtime.origin, {
1885
+ path: nspPath.realtime.pathname,
1886
+ });
1887
+ if (this.core.FE_REALTIME.on) {
1888
+ this.core.FE_REALTIME.on('connect', () => {
1889
+ console.info(`[CLIENT] conented to REALTIME namespace ${this.core.FE_REALTIME.id} host: ${this.core.ctx.host}`);
1890
+ });
1891
+ }
1892
+ }
1893
+ /**
1894
+ * Changes trigger on backend needs to be done manually.. example code:
1895
+ *
1896
+ * ...
1897
+ * Context.Realtime.Server.TrigggerEntityChanges(myEntityInstance);
1898
+ * ...
1899
+ */
1900
+ listenChangesEntity(entityClassFn, idOrUniqValue, options) {
1901
+ options = options || {};
1902
+ const { property, customEvent } = options;
1903
+ const className = !customEvent && ClassHelpers.getName(entityClassFn);
1904
+ if (_.isString(property)) {
1905
+ if (property.trim() === '') {
1906
+ throw new Error(`[Taon][listenChangesEntity.. incorect property '' for ${className}`);
1907
+ }
1908
+ }
1909
+ return new Observable(observer => {
1910
+ if (this.core.ctx.disabledRealtime) {
1911
+ console.error(`[Taon][realtime rxjs] remove taon config flag:
1912
+
1913
+ ...
1914
+ disabledRealtime: true
1915
+ ...
1916
+
1917
+ to use socket realtime connection;
1918
+ `);
1919
+ return () => {
1920
+ };
1921
+ }
1922
+ let roomName;
1923
+ if (customEvent) {
1924
+ roomName = Symbols.REALTIME.ROOM_NAME.CUSTOM(this.core.ctx.contextName, customEvent);
1925
+ }
1926
+ else {
1927
+ roomName = _.isString(property)
1928
+ ? Symbols.REALTIME.ROOM_NAME.UPDATE_ENTITY_PROPERTY(this.core.ctx.contextName, className, property, idOrUniqValue)
1929
+ : Symbols.REALTIME.ROOM_NAME.UPDATE_ENTITY(this.core.ctx.contextName, className, idOrUniqValue);
1930
+ }
1931
+ const roomSubOptions = {
1932
+ core: this.core,
1933
+ property,
1934
+ roomName,
1935
+ customEvent,
1936
+ };
1937
+ const subManagerId = this.getRoomIdFrom(roomSubOptions);
1938
+ if (!this.subsmanagers[subManagerId]) {
1939
+ this.subsmanagers[subManagerId] = new RealtimeSubsManager(roomSubOptions);
1940
+ }
1941
+ const inst = this.subsmanagers[subManagerId];
1942
+ inst.add(observer);
1943
+ inst.startListenIfNotStarted(this.core.FE_REALTIME);
1944
+ return () => {
1945
+ inst.remove(observer);
1946
+ };
1947
+ });
1948
+ }
1949
+ listenChangesEntityTable(entityClassFn) {
1950
+ const className = ClassHelpers.getName(entityClassFn);
1951
+ return this.listenChangesEntity(entityClassFn, void 0, {
1952
+ customEvent: Symbols.REALTIME.TABLE_CHANGE(this.core.ctx.contextName, className),
1953
+ });
1954
+ }
1955
+ /**
1956
+ * Changes trigger on backend needs to be done manually.. example code:
1957
+ *
1958
+ * ...
1959
+ * Context.Realtime.Server.TrigggerEntityChanges(myEntityInstance);
1960
+ * // or
1961
+ * Context.Realtime.Server.TrigggerEntityPropertyChanges(myEntityInstance,{ property: 'geolocationX' });
1962
+ * ...
1963
+ */
1964
+ listenChangesEntityObj(entity, options) {
1965
+ const classFn = ClassHelpers.getClassFnFromObject(entity);
1966
+ const uniqueKey = ClassHelpers.getUniquKey(classFn);
1967
+ return this.listenChangesEntity(classFn, entity[uniqueKey], options);
1968
+ }
1969
+ listenChangesCustomEvent(customEvent) {
1970
+ return this.listenChangesEntity(void 0, void 0, {
1971
+ customEvent,
1972
+ });
1973
+ }
1974
+ getRoomIdFrom(options) {
1975
+ const url = new URL(options.core.ctx.host);
1976
+ return `${this.core.ctx.contextName}:${url.origin}|${options.roomName}|${options.property}|${options.customEvent}`;
1977
+ }
1978
+ }
1979
+ ;
1980
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-client.ts
1981
+
1982
+ const SOCKET_EVENT_DEBOUNCE = 500;
1983
+ class RealtimeServer {
1984
+ constructor(core) {
1985
+ this.core = core;
1986
+ this.jobs = {};
1987
+ this.core = core;
1988
+ if (!core.ctx.disabledRealtime) {
1989
+ /* */
1990
+ /* */
1991
+ }
1992
+ }
1993
+ init() {
1994
+ /* */
1995
+ /* */
1996
+ /* */
1997
+ /* */
1998
+ /* */
1999
+ /* */
2000
+ /* */
2001
+ /* */
2002
+ /* */
2003
+ /* */
2004
+ /* */
2005
+ /* */
2006
+ /* */
2007
+ /* */
2008
+ /* */
2009
+ /* */
2010
+ /* */
2011
+ /* */
2012
+ /* */
2013
+ /* */
2014
+ /* */
2015
+ /* */
2016
+ /* */
2017
+ /* */
2018
+ /* */
2019
+ /* */
2020
+ /* */
2021
+ /* */
2022
+ /* */
2023
+ /* */
2024
+ /* */
2025
+ /* */
2026
+ /* */
2027
+ /* */
2028
+ /* */
2029
+ /* */
2030
+ /* */
2031
+ /* */
2032
+ /* */
2033
+ /* */
2034
+ /* */
2035
+ /* */
2036
+ /* */
2037
+ /* */
2038
+ /* */
2039
+ /* */
2040
+ /* */
2041
+ /* */
2042
+ /* */
2043
+ /* */
2044
+ /* */
2045
+ /* */
2046
+ /* */
2047
+ /* */
2048
+ /* */
2049
+ /* */
2050
+ /* */
2051
+ /* */
2052
+ /* */
2053
+ /* */
2054
+ /* */
2055
+ /* */
2056
+ /* */
2057
+ /* */
2058
+ /* */
2059
+ /* */
2060
+ /* */
2061
+ /* */
2062
+ /* */
2063
+ /* */
2064
+ /* */
2065
+ /* */
2066
+ /* */
2067
+ /* */
2068
+ /* */
2069
+ /* */
2070
+ /* */
2071
+ /* */
2072
+ /* */
2073
+ /* */
2074
+ /* */
2075
+ /* */
2076
+ /* */
2077
+ /* */
2078
+ /* */
2079
+ /* */
2080
+ /* */
2081
+ /* */
2082
+ /* */
2083
+ /* */
2084
+ /* */
2085
+ /* */
2086
+ /* */
2087
+ /* */
2088
+ /* */
2089
+ /* */
2090
+ /* */
2091
+ /* */
2092
+ /* */
2093
+ /* */
2094
+ /* */
2095
+ /* */
2096
+ /* */
2097
+ /* */
2098
+ /* */
2099
+ /* */
2100
+ /* */
2101
+ /* */
2102
+ /* */
2103
+ /* */
2104
+ /* */
2105
+ /* */
2106
+ /* */
2107
+ /* */
2108
+ /* */
2109
+ /* */
2110
+ /* */
2111
+ /* */
2112
+ /* */
2113
+ /* */
2114
+ /* */
2115
+ /* */
2116
+ /* */
2117
+ /* */
2118
+ /* */
2119
+ /* */
2120
+ /* */
2121
+ /* */
2122
+ /* */
2123
+ /* */
2124
+ /* */
2125
+ /* */
2126
+ /* */
2127
+ /* */
2128
+ /* */
2129
+ /* */
2130
+ /* */
2131
+ /* */
2132
+ /* */
2133
+ /* */
2134
+ /* */
2135
+ /* */
2136
+ /* */
2137
+ /* */
2138
+ /* */
2139
+ /* */
2140
+ /* */
2141
+ /* */
2142
+ /* */
2143
+ /* */
2144
+ }
2145
+ triggerChanges(entityObjOrClass, property, valueOfUniquPropery, customEvent, customEventData) {
2146
+ /* */
2147
+ /* */
2148
+ /* */
2149
+ /* */
2150
+ /* */
2151
+ /* */
2152
+ /* */
2153
+ /* */
2154
+ /* */
2155
+ /* */
2156
+ /* */
2157
+ /* */
2158
+ /* */
2159
+ /* */
2160
+ /* */
2161
+ /* */
2162
+ /* */
2163
+ /* */
2164
+ /* */
2165
+ /* */
2166
+ /* */
2167
+ /* */
2168
+ /* */
2169
+ /* */
2170
+ /* */
2171
+ /* */
2172
+ /* */
2173
+ /* */
2174
+ /* */
2175
+ /* */
2176
+ /* */
2177
+ /* */
2178
+ /* */
2179
+ /* */
2180
+ /* */
2181
+ /* */
2182
+ /* */
2183
+ /* */
2184
+ /* */
2185
+ /* */
2186
+ /* */
2187
+ /* */
2188
+ /* */
2189
+ /* */
2190
+ /* */
2191
+ /* */
2192
+ /* */
2193
+ /* */
2194
+ /* */
2195
+ /* */
2196
+ /* */
2197
+ /* */
2198
+ /* */
2199
+ /* */
2200
+ /* */
2201
+ /* */
2202
+ /* */
2203
+ /* */
2204
+ /* */
2205
+ /* */
2206
+ /* */
2207
+ /* */
2208
+ /* */
2209
+ /* */
2210
+ /* */
2211
+ /* */
2212
+ /* */
2213
+ /* */
2214
+ }
2215
+ trigggerEntityChanges(entityObjOrClass, idToTrigger) {
2216
+ if (this.core.ctx.disabledRealtime) {
2217
+ const className = ClassHelpers.getName(entityObjOrClass);
2218
+ console.warn(`[Taon][TrigggerEntityChanges] Entity "${className}' is not realtime`);
2219
+ return;
2220
+ }
2221
+ this.triggerChanges(entityObjOrClass, void 0, idToTrigger);
2222
+ }
2223
+ trigggerEntityPropertyChanges(entityObjOrClass, property, idToTrigger) {
2224
+ if (this.core.ctx.disabledRealtime) {
2225
+ const className = ClassHelpers.getName(entityObjOrClass);
2226
+ console.warn(`[Taon][TrigggerEntityPropertyChanges][property=${property}] Entity "${className}' is not realtime`);
2227
+ return;
2228
+ }
2229
+ if (_.isArray(property)) {
2230
+ property.forEach(propertyFromArr => {
2231
+ this.triggerChanges(entityObjOrClass, propertyFromArr, idToTrigger);
2232
+ });
2233
+ }
2234
+ else {
2235
+ this.triggerChanges(entityObjOrClass, property, idToTrigger);
2236
+ }
2237
+ }
2238
+ triggerCustomEvent(customEvent, dataToPush) {
2239
+ this.triggerChanges(void 0, void 0, void 0, customEvent, dataToPush);
2240
+ }
2241
+ trigggerEntityTableChanges(entityClass) {
2242
+ const className = ClassHelpers.getName(entityClass);
2243
+ if (this.core.ctx.disabledRealtime) {
2244
+ console.warn(`[Taon][TrigggerEntityTableChanges] Entity "${className}' is not realtime`);
2245
+ return;
2246
+ }
2247
+ this.triggerChanges(entityClass, void 0, void 0, Symbols.REALTIME.TABLE_CHANGE(this.core.ctx.contextName, className));
2248
+ }
2249
+ }
2250
+ ;
2251
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-server.ts
2252
+
2253
+ class RealtimeStrategy {
2254
+ constructor(ctx) {
2255
+ this.ctx = ctx;
2256
+ }
2257
+ testTypes() {
2258
+ }
2259
+ }
2260
+ ;
2261
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy.ts
2262
+
2263
+ class IpcRendererNamespace {
2264
+ constructor(name) {
2265
+ this.name = name;
2266
+ this.listeners = {};
2267
+ this.ipcRenderer = window.require('electron').ipcRenderer;
2268
+ }
2269
+ on(eventName, callback) {
2270
+ if (!this.listeners[eventName]) {
2271
+ this.listeners[eventName] = [];
2272
+ }
2273
+ this.listeners[eventName].push(callback);
2274
+ const listenToEvent = `(${this.name}) "${eventName}"`;
2275
+ this.ipcRenderer.on(listenToEvent, callback);
2276
+ if (eventName === 'connect') {
2277
+ this.emit('connection');
2278
+ }
2279
+ else {
2280
+ this.emit(eventName);
2281
+ }
2282
+ }
2283
+ off(event, callback) {
2284
+ if (!this.listeners[event])
2285
+ return;
2286
+ if (callback) {
2287
+ this.listeners[event] = this.listeners[event].filter(listener => listener !== callback);
2288
+ }
2289
+ else {
2290
+ delete this.listeners[event];
2291
+ }
2292
+ const removeListener = `(${this.name}) "${event}"`;
2293
+ this.ipcRenderer.removeListener(removeListener, callback);
2294
+ }
2295
+ emit(event, ...args) {
2296
+ const emitEvent = `(${this.name}) "${event}"`;
2297
+ this.ipcRenderer.send(emitEvent, ...args);
2298
+ }
2299
+ }
2300
+ ;
2301
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.ts
2302
+
2303
+ class IpcRendererWrapper {
2304
+ constructor(contextName) {
2305
+ this.contextName = contextName;
2306
+ this.namespaces = {
2307
+ '/': new IpcRendererNamespace('/'),
2308
+ };
2309
+ this.connected = false;
2310
+ }
2311
+ of(namespace) {
2312
+ if (!this.namespaces[namespace]) {
2313
+ this.namespaces[namespace] = new IpcRendererNamespace(namespace);
2314
+ }
2315
+ return this.namespaces[namespace];
2316
+ }
2317
+ on(event, callback) {
2318
+ this.namespaces['/'].on(event, callback);
2319
+ }
2320
+ emit(event, ...args) {
2321
+ this.namespaces['/'].emit(event, ...args);
2322
+ }
2323
+ }
2324
+ ;
2325
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.ts
2326
+
2327
+ /**
2328
+ * Purpose:
2329
+ * - backend-browser communication between 2 processes in electron mode
2330
+ */
2331
+ class RealtimeStrategyIpc extends RealtimeStrategy {
2332
+ toString() {
2333
+ return 'ipc';
2334
+ }
2335
+ establishConnection() {
2336
+ throw new Error('Method not implemented.');
2337
+ }
2338
+ constructor(ctx) {
2339
+ super(ctx);
2340
+ this.ctx = ctx;
2341
+ this.contextsServers = {};
2342
+ this.contextsIO = {};
2343
+ }
2344
+ get io() {
2345
+ return ((__, { path: namespacePath }) => {
2346
+ if (this.contextsIO[namespacePath]) {
2347
+ return this.contextsIO[namespacePath];
2348
+ }
2349
+ const wrap = new IpcRendererWrapper(this.ctx.contextName);
2350
+ const nsp = wrap.of(namespacePath);
2351
+ this.contextsIO[namespacePath] = nsp;
2352
+ return nsp;
2353
+ });
2354
+ return void 0;
2355
+ }
2356
+ get Server() {
2357
+ /* */
2358
+ /* */
2359
+ /* */
2360
+ /* */
2361
+ /* */
2362
+ /* */
2363
+ /* */
2364
+ /* */
2365
+ /* */
2366
+ /* */
2367
+ /* */
2368
+ return void 0;
2369
+ }
2370
+ }
2371
+ ;
2372
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-ipc.ts
2373
+
2374
+ class MockNamespace {
2375
+ constructor(name, contextName) {
2376
+ this.name = name;
2377
+ this.contextName = contextName;
2378
+ this.rooms = {};
2379
+ this.sockets = new Set();
2380
+ }
2381
+ on(event, callback) {
2382
+ if (event === 'connection') {
2383
+ this.sockets.forEach(socket => callback(socket));
2384
+ }
2385
+ }
2386
+ emit(event, data) {
2387
+ this.sockets.forEach(socket => socket.emit(event, data));
2388
+ }
2389
+ to(room) {
2390
+ return {
2391
+ emit: (event, data) => {
2392
+ if (this.rooms[room]) {
2393
+ this.rooms[room].forEach(socket => socket.emit(event, data));
2394
+ }
2395
+ }
2396
+ };
2397
+ }
2398
+ joinRoom(socket, room) {
2399
+ if (!this.rooms[room]) {
2400
+ this.rooms[room] = new Set();
2401
+ }
2402
+ this.rooms[room].add(socket);
2403
+ }
2404
+ leaveRoom(socket, room) {
2405
+ if (this.rooms[room]) {
2406
+ this.rooms[room].delete(socket);
2407
+ if (this.rooms[room].size === 0) {
2408
+ delete this.rooms[room];
2409
+ }
2410
+ }
2411
+ }
2412
+ addSocket(socket) {
2413
+ this.sockets.add(socket);
2414
+ }
2415
+ removeSocket(socket) {
2416
+ this.sockets.delete(socket);
2417
+ }
2418
+ }
2419
+ ;
2420
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.ts
2421
+
2422
+ class MockSocket {
2423
+ constructor(id, namespace) {
2424
+ this.id = id;
2425
+ this.namespace = namespace;
2426
+ this.listeners = {};
2427
+ this.namespace.addSocket(this);
2428
+ }
2429
+ on(event, callback) {
2430
+ if (!this.listeners[event]) {
2431
+ this.listeners[event] = [];
2432
+ }
2433
+ this.listeners[event].push(callback);
2434
+ }
2435
+ off(event, callback) {
2436
+ if (!this.listeners[event])
2437
+ return;
2438
+ if (callback) {
2439
+ this.listeners[event] = this.listeners[event].filter(listener => listener !== callback);
2440
+ }
2441
+ else {
2442
+ delete this.listeners[event];
2443
+ }
2444
+ }
2445
+ emit(event, data) {
2446
+ if (this.listeners[event]) {
2447
+ this.listeners[event].forEach(listener => listener(data));
2448
+ }
2449
+ }
2450
+ join(room) {
2451
+ this.namespace.joinRoom(this, room);
2452
+ }
2453
+ leave(room) {
2454
+ this.namespace.leaveRoom(this, room);
2455
+ }
2456
+ disconnect() {
2457
+ this.emit('disconnect');
2458
+ this.namespace.removeSocket(this);
2459
+ this.listeners = {};
2460
+ }
2461
+ }
2462
+ ;
2463
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.ts
2464
+
2465
+ class MockServer {
2466
+ constructor(contextName) {
2467
+ this.contextName = contextName;
2468
+ this.namespaces = {
2469
+ '/': new MockNamespace('/', this.contextName)
2470
+ };
2471
+ }
2472
+ of(namespace) {
2473
+ if (!this.namespaces[namespace]) {
2474
+ this.namespaces[namespace] = new MockNamespace(namespace, this.contextName);
2475
+ }
2476
+ return this.namespaces[namespace];
2477
+ }
2478
+ on(event, callback) {
2479
+ if (event === 'connection') {
2480
+ this.namespaces['/'].on('connection', callback);
2481
+ }
2482
+ }
2483
+ emit(event, data) {
2484
+ this.namespaces['/'].emit(event, data);
2485
+ }
2486
+ connect(id, namespace = '/') {
2487
+ const ns = this.of(namespace);
2488
+ const socket = new MockSocket(id, ns);
2489
+ ns.on('connection', (socket) => {
2490
+ socket.emit('connect');
2491
+ });
2492
+ return socket;
2493
+ }
2494
+ }
2495
+ ;
2496
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.ts
2497
+
2498
+ class MockClientSocket {
2499
+ constructor(serverSocket, contextName) {
2500
+ this.serverSocket = serverSocket;
2501
+ this.contextName = contextName;
2502
+ this.listeners = {};
2503
+ serverSocket.on('message', (data) => this.emit('message', data));
2504
+ }
2505
+ on(event, callback) {
2506
+ if (!this.listeners[event]) {
2507
+ this.listeners[event] = [];
2508
+ }
2509
+ this.listeners[event].push(callback);
2510
+ }
2511
+ off(event, callback) {
2512
+ if (!this.listeners[event])
2513
+ return;
2514
+ if (callback) {
2515
+ this.listeners[event] = this.listeners[event].filter(listener => listener !== callback);
2516
+ }
2517
+ else {
2518
+ delete this.listeners[event];
2519
+ }
2520
+ }
2521
+ emit(event, data) {
2522
+ this.serverSocket.emit(event, data);
2523
+ if (this.listeners[event]) {
2524
+ this.listeners[event].forEach(listener => listener(data));
2525
+ }
2526
+ }
2527
+ disconnect() {
2528
+ this.serverSocket.disconnect();
2529
+ this.listeners = {};
2530
+ }
2531
+ join(room) {
2532
+ this.serverSocket.join(room);
2533
+ }
2534
+ leave(room) {
2535
+ this.serverSocket.leave(room);
2536
+ }
2537
+ }
2538
+ function mockIo(server) {
2539
+ return (namespace = '/') => {
2540
+ const socketId = Math.random().toString(36).substring(2);
2541
+ const serverSocket = server.connect(socketId, namespace);
2542
+ return new MockClientSocket(serverSocket, server.contextName);
2543
+ };
2544
+ }
2545
+ ;
2546
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.ts
2547
+
2548
+ ;
2549
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.ts
2550
+
2551
+ /**
2552
+ * Purpose:
2553
+ * - browser-browser communication mock (in websql mode)
2554
+ */
2555
+ class RealtimeStrategyMock extends RealtimeStrategy {
2556
+ toString() {
2557
+ return 'mock';
2558
+ }
2559
+ constructor(ctx) {
2560
+ super(ctx);
2561
+ this.ctx = ctx;
2562
+ }
2563
+ get Server() {
2564
+ return MockServer;
2565
+ }
2566
+ ;
2567
+ get io() {
2568
+ return mockIo;
2569
+ }
2570
+ establishConnection() {
2571
+ throw new Error('Method not implemented.');
2572
+ }
2573
+ }
2574
+ ;
2575
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock.ts
2576
+
2577
+ /**
2578
+ * Purpose:
2579
+ * - backend-browser communication
2580
+ * - backend-backend communication
2581
+ */
2582
+ class RealtimeStrategySocketIO extends RealtimeStrategy {
2583
+ toString() {
2584
+ return 'socket-io';
2585
+ }
2586
+ constructor(ctx) {
2587
+ super(ctx);
2588
+ this.ctx = ctx;
2589
+ }
2590
+ get Server() {
2591
+ /* */
2592
+ /* */
2593
+ return (void 0);
2594
+ }
2595
+ ;
2596
+ get io() {
2597
+ return io;
2598
+ }
2599
+ establishConnection() {
2600
+ throw new Error('Method not implemented.');
2601
+ }
2602
+ }
2603
+ ;
2604
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-socket-io.ts
2605
+
2606
+ ;
2607
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/index.ts
2608
+
2609
+ /**
2610
+ * Realtime class
2611
+ * - mock (when browser-browser)
2612
+ * - sockets (from socket io when backend-browser)
2613
+ * - ipc (when electron is used or between processes)
2614
+ * - webworker (when webworker is used in browser or nodejs)
2615
+ */
2616
+ class RealtimeCore {
2617
+ constructor(ctx) {
2618
+ this.ctx = ctx;
2619
+ this.allHttpMethods = [
2620
+ 'GET',
2621
+ 'POST',
2622
+ 'PUT',
2623
+ 'DELETE',
2624
+ 'PATCH',
2625
+ 'OPTIONS',
2626
+ 'HEAD',
2627
+ ];
2628
+ this.strategy = this.resolveStrategy();
2629
+ ctx.logFramework &&
2630
+ console.log(`[taon] realtime strategy: ${this.strategy}`);
2631
+ this.client = new RealtimeClient(this);
2632
+ this.server = new RealtimeServer(this);
2633
+ }
2634
+ resolveStrategy() {
2635
+ if (this.ctx.mode === 'backend-frontend(websql)') {
2636
+ return new RealtimeStrategyMock(this.ctx);
2637
+ }
2638
+ if (this.ctx.mode === 'backend-frontend(ipc-electron)') {
2639
+ return new RealtimeStrategyIpc(this.ctx);
2640
+ }
2641
+ return new RealtimeStrategySocketIO(this.ctx);
2642
+ }
2643
+ pathFor(namespace) {
2644
+ const uri = this.ctx.uri;
2645
+ let nsp = namespace ? namespace : '';
2646
+ nsp = nsp === '/' ? '' : nsp;
2647
+ const pathname = uri.pathname !== '/' ? uri.pathname : '';
2648
+ let prefix = `taonContext-`;
2649
+ if (Helpers.isElectron) {
2650
+ prefix = ``;
2651
+ }
2652
+ const href = `${uri.origin}${pathname}/${prefix}${nsp}`;
2653
+ return new URL(href);
2654
+ }
2655
+ }
2656
+ ;
2657
+ ({}); // @--end-of-file-for-module=taon lib/realtime/realtime-core.ts
2658
+
2659
+ /* eslint-disable @typescript-eslint/typedef */
2660
+ class EndpointContext {
2661
+ static initNgZone(ngZone) {
2662
+ this.ngZone = ngZone;
2663
+ }
2664
+ static findForTraget(classFnOrObject) {
2665
+ const obj = ClassHelpers.getClassFnFromObject(classFnOrObject) || {};
2666
+ return (classFnOrObject[Symbols.ctxInClassOrClassObj] ||
2667
+ obj[Symbols.ctxInClassOrClassObj]);
2668
+ }
2669
+ get realtimeClient() {
2670
+ return this.realtime.client;
2671
+ }
2672
+ get realtimeServer() {
2673
+ return this.realtime.server;
2674
+ }
2675
+ get logHttp() {
2676
+ if (_.isObject(this.config?.logs)) {
2677
+ return !!this.config.logs.http;
2678
+ }
2679
+ return this.config?.logs === true;
2680
+ }
2681
+ get logRealtime() {
2682
+ if (_.isObject(this.config?.logs)) {
2683
+ return !!this.config.logs.realtime;
2684
+ }
2685
+ return this.config?.logs === true;
2686
+ }
2687
+ get logFramework() {
2688
+ if (_.isObject(this.config?.logs)) {
2689
+ return !!this.config.logs.framework;
2690
+ }
2691
+ return this.config?.logs === true;
2692
+ }
2693
+ get logDb() {
2694
+ if (_.isObject(this.config?.logs)) {
2695
+ return !!this.config.logs.db;
2696
+ }
2697
+ return this.config?.logs === true;
2698
+ }
2699
+ constructor(originalConfig, configFn) {
2700
+ this.originalConfig = originalConfig;
2701
+ this.configFn = configFn;
2702
+ this.disabledRealtime = false;
2703
+ /**
2704
+ * check whether context is inited
2705
+ * (with init() function )
2706
+ */
2707
+ this.inited = false;
2708
+ this.localInstaceObjSymbol = Symbol('localInstaceObjSymbol');
2709
+ /**
2710
+ * all instances of classes from context
2711
+ * key is class name
2712
+ */
2713
+ this.allClassesInstances = {};
2714
+ this.classInstancesByNameObj = {};
2715
+ this.objWithClassesInstancesArr = {};
2716
+ this.activeRoutes = [];
2717
+ this.injectableTypesfromContexts = [
2718
+ Models.ClassType.CONTROLLER,
2719
+ Models.ClassType.PROVIDER,
2720
+ Models.ClassType.REPOSITORY,
2721
+ Models.ClassType.SUBSCRIBER,
2722
+ ];
2723
+ this.allTypesfromContexts = [
2724
+ ...this.injectableTypesfromContexts,
2725
+ Models.ClassType.ENTITY,
2726
+ ];
2727
+ this.expressApp = {};
2728
+ this.entitiesTriggers = {};
2729
+ this.cloneClassWithNewMetadata = ({ BaseClass, className, config, ctx, classType, }) => {
2730
+ const cloneClass = () => {
2731
+ var _a, _b, _c, _d, _e;
2732
+ if (BaseClass[Symbols.fullClassNameStaticProperty] ===
2733
+ `${ctx.contextName}.${className}`) {
2734
+ return BaseClass;
2735
+ }
2736
+ return class extends BaseClass {
2737
+ constructor() {
2738
+ super(...arguments);
2739
+ this[_e] = ctx;
2740
+ }
2741
+ static { _a = Symbols.orignalClass, _b = Symbols.fullClassNameStaticProperty, _c = Symbols.classNameStaticProperty, _d = Symbols.ctxInClassOrClassObj, _e = Symbols.ctxInClassOrClassObj; }
2742
+ // @ts-ignore
2743
+ static { this[_a] = BaseClass; }
2744
+ // @ts-ignore
2745
+ static { this[_b] = `${ctx.contextName}.${className}`; }
2746
+ // @ts-ignore
2747
+ static { this[_c] = className; }
2748
+ static { this[_d] = ctx; }
2749
+ static __getFullPathForClass__(arr = []) {
2750
+ const name = this[Symbols.fullClassNameStaticProperty];
2751
+ arr.push(name);
2752
+ // @ts-ignore
2753
+ if (this[Symbols.orignalClass] && // @ts-ignore
2754
+ this[Symbols.orignalClass].__getFullPathForClass__) {
2755
+ // @ts-ignore
2756
+ this[Symbols.orignalClass].__getFullPathForClass__(arr);
2757
+ }
2758
+ return arr.join('/');
2759
+ }
2760
+ static get fullPathForClass() {
2761
+ return this.__getFullPathForClass__();
2762
+ }
2763
+ };
2764
+ };
2765
+ const cloneClassFunction = cloneClass();
2766
+ return cloneClassFunction;
2767
+ };
2768
+ this.cloneClassesObjWithNewMetadata = ({ classesInput, config, ctx, classType, }) => {
2769
+ const classes = {};
2770
+ for (const key of Object.keys(classesInput || {})) {
2771
+ const BaseClass = classesInput[key];
2772
+ if (!BaseClass) {
2773
+ Helpers.error(`Class ${key} is not defined in context ${ctx.contextName}
2774
+
2775
+ Please check if you have correct import in context file
2776
+
2777
+ `);
2778
+ }
2779
+ var className = Reflect.getMetadata(Symbols.metadata.className, BaseClass);
2780
+ className = className || key;
2781
+ BaseClass[Symbols.classNameStaticProperty] = className;
2782
+ const clonedClass = this.cloneClassWithNewMetadata({
2783
+ BaseClass,
2784
+ className,
2785
+ config,
2786
+ ctx,
2787
+ classType,
2788
+ });
2789
+ classes[className] = clonedClass;
2790
+ }
2791
+ return classes;
2792
+ };
2793
+ }
2794
+ async init(options) {
2795
+ const { initFromRecrusiveContextResovle } = options || {}; // TODO use it ?
2796
+ this.inited = true;
2797
+ this.config = this.configFn(ENV$1);
2798
+ if (this.config.host) {
2799
+ this.mode = 'backend-frontend(tcp+udp)';
2800
+ /* */
2801
+ /* */
2802
+ }
2803
+ if (this.config.remoteHost) {
2804
+ if (this.config.host) {
2805
+ Helpers.error(`[taon] You can't have remoteHost and host at the same time`, false, true);
2806
+ }
2807
+ this.mode = 'remote-backend(tcp+udp)';
2808
+ }
2809
+ if (this.config.useIpcWhenElectron && Helpers.isElectron) {
2810
+ this.mode = 'backend-frontend(ipc-electron)';
2811
+ }
2812
+ if (!this.mode && !this.config.abstract) {
2813
+ Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
2814
+ /* */
2815
+ /* */
2816
+ }
2817
+ if (this.config.database === true) {
2818
+ this.databaseConfig = this.getAutoGeneratedConfig();
2819
+ }
2820
+ else if (_.isObject(this.config.database)) {
2821
+ this.databaseConfig = _.cloneDeep(this.config.database);
2822
+ }
2823
+ if (this.config.session) {
2824
+ this.session = _.cloneDeep(this.config.session);
2825
+ const oneHour = 1000 * 60 * 60 * 1; // 24;
2826
+ if (!this.session.cookieMaxAge) {
2827
+ this.session.cookieMaxAge = oneHour;
2828
+ }
2829
+ axios.defaults.withCredentials = true;
2830
+ }
2831
+ this.config.contexts = this.config.contexts || {};
2832
+ this.config.entities = this.config.entities || {};
2833
+ this.config.controllers = this.config.controllers || {};
2834
+ this.config.repositories = this.config.repositories || {};
2835
+ this.config.providers = this.config.providers || {};
2836
+ this.config.subscribers = this.config.subscribers || {};
2837
+ this.config.entities = {
2838
+ ...(await this.getRecrusiveClassesfromContextsObj(Models.ClassType.ENTITY)),
2839
+ ...this.config.entities,
2840
+ };
2841
+ this.config.controllers = {
2842
+ ...(await this.getRecrusiveClassesfromContextsObj(Models.ClassType.CONTROLLER)),
2843
+ ...this.config.controllers,
2844
+ };
2845
+ this.config.providers = {
2846
+ ...(await this.getRecrusiveClassesfromContextsObj(Models.ClassType.PROVIDER)),
2847
+ ...this.config.providers,
2848
+ };
2849
+ this.config.subscribers = {
2850
+ ...(await this.getRecrusiveClassesfromContextsObj(Models.ClassType.SUBSCRIBER)),
2851
+ ...this.config.subscribers,
2852
+ };
2853
+ this.config.repositories = {
2854
+ ...(await this.getRecrusiveClassesfromContextsObj(Models.ClassType.REPOSITORY)),
2855
+ ...this.config.repositories,
2856
+ };
2857
+ this.config.controllers = this.cloneClassesObjWithNewMetadata({
2858
+ classesInput: this.config.controllers,
2859
+ config: this.config,
2860
+ ctx: this,
2861
+ classType: Models.ClassType.CONTROLLER,
2862
+ });
2863
+ this.config.repositories = this.cloneClassesObjWithNewMetadata({
2864
+ classesInput: this.config.repositories,
2865
+ config: this.config,
2866
+ ctx: this,
2867
+ classType: Models.ClassType.REPOSITORY,
2868
+ });
2869
+ this.config.providers = this.cloneClassesObjWithNewMetadata({
2870
+ classesInput: this.config.providers,
2871
+ config: this.config,
2872
+ ctx: this,
2873
+ classType: Models.ClassType.PROVIDER,
2874
+ });
2875
+ this.config.subscribers = this.cloneClassesObjWithNewMetadata({
2876
+ classesInput: this.config.subscribers,
2877
+ config: this.config,
2878
+ ctx: this,
2879
+ classType: Models.ClassType.SUBSCRIBER,
2880
+ });
2881
+ for (const classTypeName of this.injectableTypesfromContexts) {
2882
+ this.classInstancesByNameObj[classTypeName] = {};
2883
+ this.objWithClassesInstancesArr[classTypeName] = [];
2884
+ }
2885
+ for (const classTypeName of this.injectableTypesfromContexts) {
2886
+ await this.createInstances(this.config[Models.ClassTypeKey[classTypeName]], classTypeName);
2887
+ }
2888
+ if (this.mode === 'backend-frontend(tcp+udp)' && !this.config.abstract) {
2889
+ /* */
2890
+ /* */
2891
+ /* */
2892
+ /* */
2893
+ /* */
2894
+ /* */
2895
+ /* */
2896
+ /* */
2897
+ /* */
2898
+ /* */
2899
+ /* */
2900
+ /* */
2901
+ /* */
2902
+ /* */
2903
+ /* */
2904
+ /* */
2905
+ /* */
2906
+ /* */
2907
+ /* */
2908
+ }
2909
+ if (!this.config.abstract) {
2910
+ this.disabledRealtime = !!this.config.disabledRealtime;
2911
+ /* */
2912
+ /* */
2913
+ /* */
2914
+ /* */
2915
+ /* */
2916
+ this.realtime = new RealtimeCore(this);
2917
+ }
2918
+ if (this.config.abstract) {
2919
+ this.logFramework &&
2920
+ Helpers.info(`[taon] Create abstract context: ${this.config.contextName}`);
2921
+ }
2922
+ else {
2923
+ if (this.config.remoteHost) {
2924
+ this.logFramework &&
2925
+ Helpers.info(`[taon] Create context for remote host: ${this.config.remoteHost}`);
2926
+ }
2927
+ else {
2928
+ this.logFramework &&
2929
+ Helpers.info(`[taon] Create context for host: ${this.config.host}`);
2930
+ }
2931
+ }
2932
+ Object.keys(this.config).forEach(key => {
2933
+ this.originalConfig[key] = this.config[key];
2934
+ });
2935
+ }
2936
+ getAutoGeneratedConfig() {
2937
+ /* */
2938
+ /* */
2939
+ /* */
2940
+ /* */
2941
+ /* */
2942
+ /* */
2943
+ /* */
2944
+ /* */
2945
+ /* */
2946
+ /* */
2947
+ /* */
2948
+ /* */
2949
+ /* */
2950
+ /* */
2951
+ /* */
2952
+ /* */
2953
+ /* */
2954
+ /* */
2955
+ /* */
2956
+ /* */
2957
+ /* */
2958
+ /* */
2959
+ /* */
2960
+ /* */
2961
+ /* */
2962
+ /* */
2963
+ /* */
2964
+ /* */
2965
+ /* */
2966
+ /* */
2967
+ /* */
2968
+ /* */
2969
+ /* */
2970
+ /* */
2971
+ /* */
2972
+ /* */
2973
+ /* */
2974
+ /* */
2975
+ /* */
2976
+ /* */
2977
+ /* */
2978
+ /* */
2979
+ /* */
2980
+ /* */
2981
+ /* */
2982
+ /* */
2983
+ /* */
2984
+ /* */
2985
+ /* */
2986
+ /* */
2987
+ /* */
2988
+ /* */
2989
+ /* */
2990
+ /* */
2991
+ /* */
2992
+ /* */
2993
+ /* */
2994
+ /* */
2995
+ /* */
2996
+ /* */
2997
+ /* */
2998
+ /* */
2999
+ /* */
3000
+ /* */
3001
+ /* */
3002
+ /* */
3003
+ /* */
3004
+ /* */
3005
+ /* */
3006
+ /* */
3007
+ /* */
3008
+ /* */
3009
+ /* */
3010
+ /* */
3011
+ /* */
3012
+ /* */
3013
+ /* */
3014
+ /* */
3015
+ /* */
3016
+ /* */
3017
+ /* */
3018
+ return (void 0);
3019
+ }
3020
+ get ngZone() {
3021
+ return EndpointContext.ngZone;
3022
+ return;
3023
+ }
3024
+ startServer() {
3025
+ /* */
3026
+ /* */
3027
+ /* */
3028
+ /* */
3029
+ /* */
3030
+ /* */
3031
+ /* */
3032
+ /* */
3033
+ /* */
3034
+ /* */
3035
+ /* */
3036
+ /* */
3037
+ /* */
3038
+ return (void 0);
3039
+ }
3040
+ displayRoutes(app) {
3041
+ /* */
3042
+ /* */
3043
+ /* */
3044
+ /* */
3045
+ /* */
3046
+ /* */
3047
+ /* */
3048
+ /* */
3049
+ /* */
3050
+ /* */
3051
+ /* */
3052
+ /* */
3053
+ /* */
3054
+ /* */
3055
+ /* */
3056
+ /* */
3057
+ /* */
3058
+ /* */
3059
+ /* */
3060
+ /* */
3061
+ /* */
3062
+ /* */
3063
+ /* */
3064
+ /* */
3065
+ /* */
3066
+ /* */
3067
+ /* */
3068
+ /* */
3069
+ }
3070
+ get modeAllowsDatabaseCreation() {
3071
+ return (this.mode === 'backend-frontend(tcp+udp)' ||
3072
+ this.mode === 'backend-frontend(websql)' ||
3073
+ this.mode === 'backend-frontend(ipc-electron)');
3074
+ }
3075
+ async getRecrusiveClassesfromContextsObj(classType) {
3076
+ const arr = await this.getRecrusiveClassesfromContexts(classType);
3077
+ return arr.reduce((acc, c) => {
3078
+ acc[ClassHelpers.getName(c)] = c;
3079
+ return acc;
3080
+ }, {});
3081
+ }
3082
+ async getRecrusiveClassesfromContexts(classType, arr = []) {
3083
+ const contexts = Object.values(this.config.contexts || {});
3084
+ for (const ctx of contexts) {
3085
+ const ref = await ctx.__ref();
3086
+ const classesInput = ref.getClassFunBy(classType);
3087
+ const clonedClasses = Object.values(this.cloneClassesObjWithNewMetadata({
3088
+ classesInput,
3089
+ config: this.config,
3090
+ ctx: this,
3091
+ classType,
3092
+ }));
3093
+ clonedClasses.forEach(c => arr.push(c));
3094
+ await ref.getRecrusiveClassesfromContexts(classType, arr);
3095
+ }
3096
+ return arr;
3097
+ }
3098
+ getClassInstanceObjBy(classType) {
3099
+ return this.classInstancesByNameObj[classType];
3100
+ }
3101
+ getClassesInstancesArrBy(classType) {
3102
+ return this.objWithClassesInstancesArr[classType];
3103
+ }
3104
+ inject(ctor, options) {
3105
+ if (!options) {
3106
+ options = {};
3107
+ }
3108
+ const className = ClassHelpers.getName(ctor);
3109
+ const locaInstanceConstructorArgs = options.locaInstanceConstructorArgs || [];
3110
+ if (this.isCLassType(Models.ClassType.REPOSITORY, ctor)) {
3111
+ options.localInstance = true;
3112
+ }
3113
+ if (options?.localInstance) {
3114
+ const ctxClassFn = this.getClassFunByClassName(className);
3115
+ let entityName = '';
3116
+ if (className === 'BaseRepository') {
3117
+ const entityFn = locaInstanceConstructorArgs[0];
3118
+ const entity = entityFn && entityFn();
3119
+ entityName = entity && ClassHelpers.getName(entity);
3120
+ }
3121
+ if (!options.contextClassInstance[this.localInstaceObjSymbol]) {
3122
+ options.contextClassInstance[this.localInstaceObjSymbol] = {};
3123
+ }
3124
+ const instanceKey = className + (entityName ? `.${entityName}` : '');
3125
+ const existed = options.contextClassInstance[this.localInstaceObjSymbol][instanceKey];
3126
+ if (existed) {
3127
+ return existed;
3128
+ }
3129
+ if (!ctxClassFn) {
3130
+ throw new Error(`Not able to inject "${className}" inside context "${this.contextName}"
3131
+
3132
+ Make sure they share the same context or import context where "${className}" is defined.
3133
+
3134
+ `);
3135
+ }
3136
+ const injectedInstance = new ctxClassFn(...locaInstanceConstructorArgs);
3137
+ options.contextClassInstance[this.localInstaceObjSymbol][instanceKey] =
3138
+ injectedInstance;
3139
+ return injectedInstance;
3140
+ }
3141
+ const contextScopeInstance = this.allClassesInstances[className];
3142
+ return contextScopeInstance;
3143
+ }
3144
+ /**
3145
+ * alias for inject
3146
+ */
3147
+ getInstanceBy(ctor) {
3148
+ return this.inject(ctor, { localInstance: false });
3149
+ }
3150
+ checkIfContextInitialized() {
3151
+ if (_.isUndefined(this.config)) {
3152
+ throw new Error(`Please check if your context has been initilized.
3153
+
3154
+
3155
+ await Context.initialize();
3156
+
3157
+
3158
+
3159
+ `);
3160
+ }
3161
+ }
3162
+ getClassFunBy(classType) {
3163
+ this.checkIfContextInitialized();
3164
+ switch (classType) {
3165
+ case Models.ClassType.CONTROLLER:
3166
+ return this.config.controllers;
3167
+ case Models.ClassType.ENTITY:
3168
+ return this.config.entities;
3169
+ case Models.ClassType.PROVIDER:
3170
+ return this.config.providers;
3171
+ case Models.ClassType.REPOSITORY:
3172
+ return this.config.repositories;
3173
+ case Models.ClassType.SUBSCRIBER:
3174
+ return this.config.subscribers;
3175
+ }
3176
+ }
3177
+ isCLassType(classType, classFn) {
3178
+ return !!this.getClassFunBy(classType)[ClassHelpers.getName(classFn)];
3179
+ }
3180
+ /**
3181
+ * Only for injectable types
3182
+ * Only for classType: CONTROLLER, REPOSITORY, PROVIDER
3183
+ */
3184
+ getClassFunByClassName(className) {
3185
+ for (const classTypeName of this.allTypesfromContexts) {
3186
+ const classesForInjectableType = this.config[Models.ClassTypeKey[classTypeName]];
3187
+ if (classesForInjectableType[className]) {
3188
+ return classesForInjectableType[className];
3189
+ }
3190
+ }
3191
+ }
3192
+ getClassFunByClass(classFunction) {
3193
+ const className = ClassHelpers.getName(classFunction);
3194
+ return this.getClassFunByClassName(className);
3195
+ }
3196
+ getClassFunByArr(classType) {
3197
+ return Object.values(this.getClassFunBy(classType) || {});
3198
+ }
3199
+ async createInstances(classes, classType) {
3200
+ for (const classFn of [
3201
+ ...Object.values(classes),
3202
+ ]) {
3203
+ const instance = DITaonContainer.resolve(classFn);
3204
+ const classInstancesByNameObj = this.classInstancesByNameObj[classType];
3205
+ const className = ClassHelpers.getName(classFn);
3206
+ classInstancesByNameObj[className] = instance;
3207
+ this.config[Models.ClassTypeKey[classType]][className] = classFn;
3208
+ this.objWithClassesInstancesArr[classType].push(instance);
3209
+ this.allClassesInstances[className] = instance;
3210
+ }
3211
+ }
3212
+ async reinitControllers() {
3213
+ const controllers = this.getClassesInstancesArrBy(Models.ClassType.CONTROLLER);
3214
+ for (const ctrl of controllers) {
3215
+ if (_.isFunction(ctrl.initExampleDbData)) {
3216
+ await Helpers.runSyncOrAsync({
3217
+ functionFn: ctrl.initExampleDbData,
3218
+ context: ctrl,
3219
+ });
3220
+ }
3221
+ }
3222
+ }
3223
+ async initClasses() {
3224
+ for (const classTypeName of [
3225
+ Models.ClassType.PROVIDER,
3226
+ Models.ClassType.REPOSITORY,
3227
+ Models.ClassType.CONTROLLER,
3228
+ Models.ClassType.ENTITY,
3229
+ ]) {
3230
+ for (const classFun of this.getClassFunByArr(classTypeName)) {
3231
+ if (_.isFunction(classFun._)) {
3232
+ await Helpers.runSyncOrAsync({
3233
+ functionFn: classFun._,
3234
+ context: classFun,
3235
+ });
3236
+ }
3237
+ }
3238
+ }
3239
+ for (const classTypeName of [
3240
+ Models.ClassType.PROVIDER,
3241
+ Models.ClassType.REPOSITORY,
3242
+ Models.ClassType.CONTROLLER,
3243
+ ]) {
3244
+ for (const ctrl of this.getClassesInstancesArrBy(classTypeName)) {
3245
+ if (_.isFunction(ctrl._)) {
3246
+ await Helpers.runSyncOrAsync({
3247
+ functionFn: ctrl._,
3248
+ context: ctrl,
3249
+ });
3250
+ }
3251
+ }
3252
+ }
3253
+ }
3254
+ isActiveOn(classInstance) {
3255
+ let contextRef = classInstance[Symbols.ctxInClassOrClassObj];
3256
+ return this === contextRef;
3257
+ }
3258
+ get uri() {
3259
+ const url = this.host
3260
+ ? new URL(this.host)
3261
+ : this.remoteHost
3262
+ ? new URL(this.remoteHost)
3263
+ : void 0;
3264
+ return url;
3265
+ }
3266
+ get isHttpServer() {
3267
+ return this.uri.protocol === 'https:';
3268
+ }
3269
+ /**
3270
+ * ipc/udp needs this
3271
+ */
3272
+ get contextName() {
3273
+ return this.config.contextName;
3274
+ }
3275
+ get publicAssets() {
3276
+ return this.config?.publicAssets || [];
3277
+ }
3278
+ get isProductionMode() {
3279
+ return this.config.productionMode;
3280
+ }
3281
+ get remoteHost() {
3282
+ return this.config.remoteHost;
3283
+ }
3284
+ get host() {
3285
+ return this.config.host;
3286
+ }
3287
+ get orgin() {
3288
+ return this.uri?.origin;
3289
+ }
3290
+ async initSubscribers() {
3291
+ return; // TODO
3292
+ /* */
3293
+ /* */
3294
+ /* */
3295
+ /* */
3296
+ /* */
3297
+ /* */
3298
+ /* */
3299
+ /* */
3300
+ /* */
3301
+ /* */
3302
+ /* */
3303
+ /* */
3304
+ /* */
3305
+ /* */
3306
+ /* */
3307
+ /* */
3308
+ /* */
3309
+ /* */
3310
+ /* */
3311
+ /* */
3312
+ return (void 0);
3313
+ /* */
3314
+ /* */
3315
+ /* */
3316
+ /* */
3317
+ /* */
3318
+ /* */
3319
+ /* */
3320
+ /* */
3321
+ /* */
3322
+ /* */
3323
+ /* */
3324
+ /* */
3325
+ /* */
3326
+ /* */
3327
+ /* */
3328
+ /* */
3329
+ /* */
3330
+ /* */
3331
+ /* */
3332
+ /* */
3333
+ /* */
3334
+ /* */
3335
+ /* */
3336
+ /* */
3337
+ /* */
3338
+ /* */
3339
+ /* */
3340
+ /* */
3341
+ /* */
3342
+ /* */
3343
+ /* */
3344
+ /* */
3345
+ /* */
3346
+ /* */
3347
+ /* */
3348
+ /* */
3349
+ /* */
3350
+ /* */
3351
+ /* */
3352
+ /* */
3353
+ /* */
3354
+ /* */
3355
+ /* */
3356
+ /* */
3357
+ /* */
3358
+ /* */
3359
+ /* */
3360
+ /* */
3361
+ /* */
3362
+ /* */
3363
+ /* */
3364
+ /* */
3365
+ /* */
3366
+ /* */
3367
+ /* */
3368
+ /* */
3369
+ /* */
3370
+ /* */
3371
+ /* */
3372
+ /* */
3373
+ /* */
3374
+ /* */
3375
+ /* */
3376
+ /* */
3377
+ /* */
3378
+ /* */
3379
+ /* */
3380
+ /* */
3381
+ /* */
3382
+ /* */
3383
+ /* */
3384
+ /* */
3385
+ /* */
3386
+ /* */
3387
+ /* */
3388
+ /* */
3389
+ /* */
3390
+ /* */
3391
+ /* */
3392
+ /* */
3393
+ /* */
3394
+ /* */
3395
+ /* */
3396
+ /* */
3397
+ /* */
3398
+ /* */
3399
+ /* */
3400
+ /* */
3401
+ /* */
3402
+ /* */
3403
+ /* */
3404
+ /* */
3405
+ /* */
3406
+ /* */
3407
+ /* */
3408
+ /* */
3409
+ /* */
3410
+ /* */
3411
+ /* */
3412
+ /* */
3413
+ /* */
3414
+ /* */
3415
+ /* */
3416
+ /* */
3417
+ /* */
3418
+ /* */
3419
+ /* */
3420
+ /* */
3421
+ /* */
3422
+ /* */
3423
+ /* */
3424
+ /* */
3425
+ /* */
3426
+ /* */
3427
+ /* */
3428
+ /* */
3429
+ /* */
3430
+ /* */
3431
+ /* */
3432
+ /* */
3433
+ /* */
3434
+ /* */
3435
+ /* */
3436
+ /* */
3437
+ /* */
3438
+ /* */
3439
+ }
3440
+ async initEntities() {
3441
+ /* */
3442
+ /* */
3443
+ /* */
3444
+ /* */
3445
+ /* */
3446
+ /* */
3447
+ /* */
3448
+ /* */
3449
+ /* */
3450
+ /* */
3451
+ /* */
3452
+ /* */
3453
+ /* */
3454
+ /* */
3455
+ /* */
3456
+ /* */
3457
+ /* */
3458
+ /* */
3459
+ /* */
3460
+ /* */
3461
+ /* */
3462
+ /* */
3463
+ /* */
3464
+ /* */
3465
+ /* */
3466
+ /* */
3467
+ }
3468
+ async initDatabaseConnection() {
3469
+ /* */
3470
+ /* */
3471
+ /* */
3472
+ /* */
3473
+ /* */
3474
+ /* */
3475
+ /* */
3476
+ /* */
3477
+ /* */
3478
+ /* */
3479
+ /* */
3480
+ /* */
3481
+ /* */
3482
+ /* */
3483
+ /* */
3484
+ /* */
3485
+ /* */
3486
+ /* */
3487
+ /* */
3488
+ /* */
3489
+ /* */
3490
+ /* */
3491
+ /* */
3492
+ /* */
3493
+ /* */
3494
+ /* */
3495
+ /* */
3496
+ /* */
3497
+ /* */
3498
+ /* */
3499
+ /* */
3500
+ /* */
3501
+ /* */
3502
+ /* */
3503
+ /* */
3504
+ /* */
3505
+ /* */
3506
+ /* */
3507
+ /* */
3508
+ /* */
3509
+ /* */
3510
+ /* */
3511
+ /* */
3512
+ /* */
3513
+ /* */
3514
+ /* */
3515
+ /* */
3516
+ /* */
3517
+ /* */
3518
+ /* */
3519
+ /* */
3520
+ /* */
3521
+ /* */
3522
+ /* */
3523
+ /* */
3524
+ /* */
3525
+ /* */
3526
+ /* */
3527
+ /* */
3528
+ /* */
3529
+ /* */
3530
+ /* */
3531
+ /* */
3532
+ /* */
3533
+ /* */
3534
+ /* */
3535
+ /* */
3536
+ /* */
3537
+ /* */
3538
+ /* */
3539
+ /* */
3540
+ /* */
3541
+ /* */
3542
+ /* */
3543
+ /* */
3544
+ /* */
3545
+ /* */
3546
+ /* */
3547
+ /* */
3548
+ /* */
3549
+ /* */
3550
+ /* */
3551
+ return (void 0);
3552
+ }
3553
+ initMetadata() {
3554
+ const allControllers = this.getClassFunByArr(Models.ClassType.CONTROLLER);
3555
+ for (const controllerClassFn of allControllers) {
3556
+ controllerClassFn[Symbols.classMethodsNames] =
3557
+ ClassHelpers.getMethodsNames(controllerClassFn);
3558
+ const configs = ClassHelpers.getControllerConfigs(controllerClassFn);
3559
+ const classConfig = configs[0];
3560
+ const parentscalculatedPath = _.slice(configs, 1)
3561
+ .reverse()
3562
+ .map(bc => {
3563
+ if (TaonHelpers.isGoodPath(bc.path)) {
3564
+ return bc.path;
3565
+ }
3566
+ return bc.className;
3567
+ })
3568
+ .join('/');
3569
+ if (TaonHelpers.isGoodPath(classConfig.path)) {
3570
+ classConfig.calculatedPath = classConfig.path;
3571
+ }
3572
+ else {
3573
+ classConfig.calculatedPath =
3574
+ `${parentscalculatedPath}/${ClassHelpers.getName(controllerClassFn)}`
3575
+ .replace(/\/\//g, '/')
3576
+ .split('/')
3577
+ .reduce((acc, bc) => {
3578
+ return _.last(acc) === bc ? acc : [...acc, bc];
3579
+ }, [])
3580
+ .join('/');
3581
+ }
3582
+ _.slice(configs, 1).forEach(bc => {
3583
+ const alreadyIs = classConfig.methods;
3584
+ const toMerge = _.cloneDeep(bc.methods);
3585
+ for (const key in toMerge) {
3586
+ if (toMerge.hasOwnProperty(key) && !alreadyIs[key]) {
3587
+ const element = toMerge[key];
3588
+ alreadyIs[key] = element;
3589
+ }
3590
+ }
3591
+ });
3592
+ /* */
3593
+ /* */
3594
+ this.logHttp &&
3595
+ console.groupCollapsed(`[taon][express-server] routes [${classConfig.className}]`);
3596
+ /* */
3597
+ /* */
3598
+ Object.keys(classConfig.methods).forEach(methodName => {
3599
+ const methodConfig = classConfig.methods[methodName];
3600
+ const type = methodConfig.type;
3601
+ const expressPath = methodConfig.global
3602
+ ? `/${methodConfig.path?.replace(/\//, '')}`
3603
+ : TaonHelpers.getExpressPath(classConfig, methodConfig);
3604
+ if (Helpers.isNode || Helpers.isWebSQL) {
3605
+ /* */
3606
+ /* */
3607
+ /* */
3608
+ /* */
3609
+ /* */
3610
+ /* */
3611
+ /* */
3612
+ /* */
3613
+ /* */
3614
+ /* */
3615
+ /* */
3616
+ /* */
3617
+ /* */
3618
+ /* */
3619
+ }
3620
+ const shouldInitClient = Helpers.isBrowser || this.remoteHost || Helpers.isWebSQL;
3621
+ if (shouldInitClient) {
3622
+ this.initClient(controllerClassFn, type, methodConfig, expressPath);
3623
+ }
3624
+ });
3625
+ /* */
3626
+ /* */
3627
+ this.logHttp && console.groupEnd();
3628
+ /* */
3629
+ /* */
3630
+ }
3631
+ }
3632
+ writeActiveRoutes() {
3633
+ const contexts = [this];
3634
+ /* */
3635
+ /* */
3636
+ /* */
3637
+ /* */
3638
+ /* */
3639
+ /* */
3640
+ /* */
3641
+ /* */
3642
+ /* */
3643
+ /* */
3644
+ /* */
3645
+ /* */
3646
+ /* */
3647
+ /* */
3648
+ /* */
3649
+ /* */
3650
+ /* */
3651
+ /* */
3652
+ /* */
3653
+ /* */
3654
+ /* */
3655
+ /* */
3656
+ /* */
3657
+ /* */
3658
+ /* */
3659
+ /* */
3660
+ /* */
3661
+ /* */
3662
+ /* */
3663
+ /* */
3664
+ /* */
3665
+ }
3666
+ get middlewares() {
3667
+ /* */
3668
+ /* */
3669
+ return (void 0);
3670
+ }
3671
+ initMidleware() {
3672
+ /* */
3673
+ /* */
3674
+ /* */
3675
+ /* */
3676
+ /* */
3677
+ /* */
3678
+ /* */
3679
+ /* */
3680
+ /* */
3681
+ /* */
3682
+ /* */
3683
+ /* */
3684
+ /* */
3685
+ /* */
3686
+ /* */
3687
+ /* */
3688
+ /* */
3689
+ /* */
3690
+ /* */
3691
+ /* */
3692
+ /* */
3693
+ /* */
3694
+ /* */
3695
+ /* */
3696
+ /* */
3697
+ /* */
3698
+ /* */
3699
+ /* */
3700
+ /* */
3701
+ /* */
3702
+ /* */
3703
+ /* */
3704
+ /* */
3705
+ /* */
3706
+ /* */
3707
+ /* */
3708
+ /* */
3709
+ /* */
3710
+ /* */
3711
+ /* */
3712
+ /* */
3713
+ /* */
3714
+ /* */
3715
+ /* */
3716
+ /* */
3717
+ /* */
3718
+ /* */
3719
+ /* */
3720
+ /* */
3721
+ /* */
3722
+ /* */
3723
+ /* */
3724
+ /* */
3725
+ /* */
3726
+ /* */
3727
+ /* */
3728
+ /* */
3729
+ /* */
3730
+ /* */
3731
+ /* */
3732
+ /* */
3733
+ /* */
3734
+ /* */
3735
+ /* */
3736
+ /* */
3737
+ /* */
3738
+ /* */
3739
+ /* */
3740
+ /* */
3741
+ /* */
3742
+ /* */
3743
+ /* */
3744
+ /* */
3745
+ /* */
3746
+ /* */
3747
+ /* */
3748
+ /* */
3749
+ /* */
3750
+ /* */
3751
+ /* */
3752
+ /* */
3753
+ /* */
3754
+ /* */
3755
+ /* */
3756
+ /* */
3757
+ /* */
3758
+ /* */
3759
+ /* */
3760
+ /* */
3761
+ /* */
3762
+ /* */
3763
+ /* */
3764
+ /* */
3765
+ /* */
3766
+ /* */
3767
+ /* */
3768
+ /* */
3769
+ /* */
3770
+ /* */
3771
+ /* */
3772
+ /* */
3773
+ /* */
3774
+ }
3775
+ initServer(type, methodConfig, classConfig, expressPath, target) {
3776
+ /* */
3777
+ /* */
3778
+ /* */
3779
+ /* */
3780
+ /* */
3781
+ /* */
3782
+ /* */
3783
+ /* */
3784
+ const url = this.uri;
3785
+ const getResult = async (resolvedParams, req, res) => {
3786
+ const response = methodConfig.descriptor.value.apply(
3787
+ /**
3788
+ * Context for method @GET,@PUT etc.
3789
+ */
3790
+ this.getInstanceBy(target),
3791
+ /**
3792
+ * Params for metjod @GET, @PUT etc.
3793
+ */
3794
+ resolvedParams);
3795
+ let result = await getResponseValue(response, { req, res });
3796
+ return result;
3797
+ };
3798
+ url.pathname = url.pathname.replace(/\/$/, '');
3799
+ expressPath = url.pathname.startsWith('/')
3800
+ ? `${url.pathname}${expressPath}`
3801
+ : expressPath;
3802
+ expressPath = expressPath.replace(/\/\//g, '/');
3803
+ if (Helpers.isElectron) {
3804
+ /* */
3805
+ /* */
3806
+ /* */
3807
+ /* */
3808
+ /* */
3809
+ /* */
3810
+ /* */
3811
+ /* */
3812
+ /* */
3813
+ /* */
3814
+ /* */
3815
+ /* */
3816
+ /* */
3817
+ /* */
3818
+ /* */
3819
+ /* */
3820
+ /* */
3821
+ /* */
3822
+ /* */
3823
+ /* */
3824
+ /* */
3825
+ }
3826
+ if (!this.remoteHost) {
3827
+ /* */
3828
+ /* */
3829
+ /* */
3830
+ /* */
3831
+ /* */
3832
+ /* */
3833
+ /* */
3834
+ /* */
3835
+ /* */
3836
+ /* */
3837
+ /* */
3838
+ /* */
3839
+ /* */
3840
+ /* */
3841
+ /* */
3842
+ /* */
3843
+ /* */
3844
+ /* */
3845
+ /* */
3846
+ /* */
3847
+ /* */
3848
+ /* */
3849
+ /* */
3850
+ /* */
3851
+ /* */
3852
+ /* */
3853
+ /* */
3854
+ /* */
3855
+ /* */
3856
+ /* */
3857
+ /* */
3858
+ /* */
3859
+ /* */
3860
+ /* */
3861
+ /* */
3862
+ /* */
3863
+ /* */
3864
+ /* */
3865
+ /* */
3866
+ /* */
3867
+ /* */
3868
+ /* */
3869
+ /* */
3870
+ /* */
3871
+ /* */
3872
+ /* */
3873
+ /* */
3874
+ /* */
3875
+ /* */
3876
+ /* */
3877
+ /* */
3878
+ /* */
3879
+ /* */
3880
+ /* */
3881
+ /* */
3882
+ /* */
3883
+ /* */
3884
+ /* */
3885
+ /* */
3886
+ /* */
3887
+ /* */
3888
+ /* */
3889
+ /* */
3890
+ /* */
3891
+ /* */
3892
+ /* */
3893
+ /* */
3894
+ /* */
3895
+ /* */
3896
+ /* */
3897
+ /* */
3898
+ /* */
3899
+ /* */
3900
+ /* */
3901
+ /* */
3902
+ /* */
3903
+ /* */
3904
+ /* */
3905
+ /* */
3906
+ /* */
3907
+ /* */
3908
+ /* */
3909
+ /* */
3910
+ /* */
3911
+ /* */
3912
+ /* */
3913
+ /* */
3914
+ /* */
3915
+ /* */
3916
+ /* */
3917
+ /* */
3918
+ /* */
3919
+ /* */
3920
+ /* */
3921
+ /* */
3922
+ /* */
3923
+ /* */
3924
+ /* */
3925
+ /* */
3926
+ /* */
3927
+ /* */
3928
+ /* */
3929
+ /* */
3930
+ /* */
3931
+ /* */
3932
+ /* */
3933
+ /* */
3934
+ /* */
3935
+ /* */
3936
+ /* */
3937
+ /* */
3938
+ /* */
3939
+ /* */
3940
+ /* */
3941
+ /* */
3942
+ /* */
3943
+ /* */
3944
+ /* */
3945
+ /* */
3946
+ /* */
3947
+ /* */
3948
+ /* */
3949
+ /* */
3950
+ /* */
3951
+ /* */
3952
+ /* */
3953
+ /* */
3954
+ /* */
3955
+ /* */
3956
+ /* */
3957
+ /* */
3958
+ /* */
3959
+ /* */
3960
+ /* */
3961
+ /* */
3962
+ /* */
3963
+ /* */
3964
+ /* */
3965
+ /* */
3966
+ /* */
3967
+ /* */
3968
+ /* */
3969
+ /* */
3970
+ /* */
3971
+ /* */
3972
+ /* */
3973
+ /* */
3974
+ /* */
3975
+ /* */
3976
+ /* */
3977
+ /* */
3978
+ /* */
3979
+ /* */
3980
+ /* */
3981
+ /* */
3982
+ /* */
3983
+ /* */
3984
+ /* */
3985
+ /* */
3986
+ /* */
3987
+ /* */
3988
+ /* */
3989
+ /* */
3990
+ /* */
3991
+ /* */
3992
+ /* */
3993
+ /* */
3994
+ /* */
3995
+ /* */
3996
+ /* */
3997
+ /* */
3998
+ /* */
3999
+ /* */
4000
+ /* */
4001
+ /* */
4002
+ /* */
4003
+ /* */
4004
+ /* */
4005
+ /* */
4006
+ /* */
4007
+ /* */
4008
+ /* */
4009
+ /* */
4010
+ /* */
4011
+ /* */
4012
+ /* */
4013
+ /* */
4014
+ /* */
4015
+ /* */
4016
+ /* */
4017
+ /* */
4018
+ /* */
4019
+ /* */
4020
+ /* */
4021
+ /* */
4022
+ /* */
4023
+ /* */
4024
+ /* */
4025
+ /* */
4026
+ /* */
4027
+ /* */
4028
+ /* */
4029
+ /* */
4030
+ /* */
4031
+ /* */
4032
+ /* */
4033
+ /* */
4034
+ /* */
4035
+ /* */
4036
+ /* */
4037
+ /* */
4038
+ /* */
4039
+ /* */
4040
+ /* */
4041
+ /* */
4042
+ /* */
4043
+ /* */
4044
+ /* */
4045
+ /* */
4046
+ /* */
4047
+ }
4048
+ return {
4049
+ routePath: expressPath,
4050
+ method: methodConfig.type,
4051
+ };
4052
+ }
4053
+ /**
4054
+ * client can be browser or nodejs (when remote host)
4055
+ */
4056
+ initClient(target, type, methodConfig, expressPath) {
4057
+ const ctx = this;
4058
+ this.logHttp && console.log(`${type?.toUpperCase()} ${expressPath} `);
4059
+ let storage;
4060
+ if (Helpers.isBrowser) {
4061
+ storage = window;
4062
+ }
4063
+ /* */
4064
+ /* */
4065
+ /* */
4066
+ /* */
4067
+ const orgMethods = target.prototype[methodConfig.methodName];
4068
+ if (Helpers.isElectron) {
4069
+ target.prototype[methodConfig.methodName] = function (...args) {
4070
+ const received = new Promise(async (resolve, reject) => {
4071
+ const headers = {};
4072
+ const { request, response } = TaonHelpers.websqlMocks(headers);
4073
+ Helpers.ipcRenderer.once(TaonHelpers.ipcKeyNameResponse(target, methodConfig, expressPath), (event, responseData) => {
4074
+ let res = responseData;
4075
+ console.log({ responseData });
4076
+ try {
4077
+ const body = res;
4078
+ res = new Models$1.HttpResponse({
4079
+ body: void 0,
4080
+ isArray: void 0,
4081
+ method: methodConfig.type,
4082
+ url: `${ctx.uri.origin}${'' // TODO express path
4083
+ }${methodConfig.path} `,
4084
+ }, Helpers.isBlob(body) || _.isString(body)
4085
+ ? body
4086
+ : JSON.stringify(body), RestHeaders.from(headers), void 0, () => body);
4087
+ resolve(res);
4088
+ }
4089
+ catch (error) {
4090
+ console.error(error);
4091
+ reject(error);
4092
+ }
4093
+ });
4094
+ Helpers.ipcRenderer.send(TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath), args);
4095
+ });
4096
+ received['observable'] = from(received);
4097
+ return {
4098
+ received,
4099
+ };
4100
+ };
4101
+ return;
4102
+ }
4103
+ /* */
4104
+ /* */
4105
+ /* */
4106
+ /* */
4107
+ /* */
4108
+ /* */
4109
+ /* */
4110
+ /* */
4111
+ /* */
4112
+ /* */
4113
+ /* */
4114
+ /* */
4115
+ /* */
4116
+ /* */
4117
+ /* */
4118
+ /* */
4119
+ /* */
4120
+ /* */
4121
+ /* */
4122
+ /* */
4123
+ /* */
4124
+ /* */
4125
+ /* */
4126
+ /* */
4127
+ /* */
4128
+ /* */
4129
+ /* */
4130
+ /* */
4131
+ /* */
4132
+ /* */
4133
+ /* */
4134
+ /* */
4135
+ /* */
4136
+ /* */
4137
+ /* */
4138
+ /* */
4139
+ /* */
4140
+ /* */
4141
+ /* */
4142
+ /* */
4143
+ /* */
4144
+ /* */
4145
+ /* */
4146
+ /* */
4147
+ /* */
4148
+ /* */
4149
+ /* */
4150
+ /* */
4151
+ /* */
4152
+ /* */
4153
+ /* */
4154
+ /* */
4155
+ /* */
4156
+ /* */
4157
+ /* */
4158
+ /* */
4159
+ /* */
4160
+ /* */
4161
+ /* */
4162
+ /* */
4163
+ /* */
4164
+ /* */
4165
+ /* */
4166
+ /* */
4167
+ /* */
4168
+ /* */
4169
+ /* */
4170
+ /* */
4171
+ /* */
4172
+ /* */
4173
+ /* */
4174
+ /* */
4175
+ /* */
4176
+ /* */
4177
+ /* */
4178
+ /* */
4179
+ /* */
4180
+ /* */
4181
+ /* */
4182
+ /* */
4183
+ /* */
4184
+ /* */
4185
+ /* */
4186
+ /* */
4187
+ /* */
4188
+ /* */
4189
+ /* */
4190
+ /* */
4191
+ /* */
4192
+ /* */
4193
+ /* */
4194
+ /* */
4195
+ /* */
4196
+ /* */
4197
+ /* */
4198
+ /* */
4199
+ /* */
4200
+ /* */
4201
+ /* */
4202
+ /* */
4203
+ /* */
4204
+ /* */
4205
+ /* */
4206
+ /* */
4207
+ /* */
4208
+ /* */
4209
+ /* */
4210
+ /* */
4211
+ /* */
4212
+ /* */
4213
+ /* */
4214
+ /* */
4215
+ /* */
4216
+ /* */
4217
+ /* */
4218
+ /* */
4219
+ /* */
4220
+ /* */
4221
+ /* */
4222
+ /* */
4223
+ /* */
4224
+ /* */
4225
+ /* */
4226
+ /* */
4227
+ /* */
4228
+ /* */
4229
+ /* */
4230
+ /* */
4231
+ /* */
4232
+ /* */
4233
+ /* */
4234
+ /* */
4235
+ /* */
4236
+ /* */
4237
+ /* */
4238
+ /* */
4239
+ /* */
4240
+ /* */
4241
+ /* */
4242
+ /* */
4243
+ /* */
4244
+ /* */
4245
+ target.prototype[methodConfig.methodName] = function (...args) {
4246
+ if (!storage[Symbols.old.ENDPOINT_META_CONFIG])
4247
+ storage[Symbols.old.ENDPOINT_META_CONFIG] = {};
4248
+ if (!storage[Symbols.old.ENDPOINT_META_CONFIG][ctx.uri.href])
4249
+ storage[Symbols.old.ENDPOINT_META_CONFIG][ctx.uri.href] = {};
4250
+ const endpoints = storage[Symbols.old.ENDPOINT_META_CONFIG];
4251
+ let rest;
4252
+ if (!endpoints[ctx.uri.href][expressPath]) {
4253
+ let headers = {};
4254
+ if (methodConfig.contentType && !methodConfig.responseType) {
4255
+ rest = Resource.create(ctx.uri.href, expressPath, Symbols.old.MAPPING_CONFIG_HEADER, Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, RestHeaders.from({
4256
+ 'Content-Type': methodConfig.contentType,
4257
+ Accept: methodConfig.contentType,
4258
+ }));
4259
+ }
4260
+ else if (methodConfig.contentType && methodConfig.responseType) {
4261
+ rest = Resource.create(ctx.uri.href, expressPath, Symbols.old.MAPPING_CONFIG_HEADER, Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, RestHeaders.from({
4262
+ 'Content-Type': methodConfig.contentType,
4263
+ Accept: methodConfig.contentType,
4264
+ responsetypeaxios: methodConfig.responseType,
4265
+ }));
4266
+ }
4267
+ else if (!methodConfig.contentType && methodConfig.responseType) {
4268
+ rest = Resource.create(ctx.uri.href, expressPath, Symbols.old.MAPPING_CONFIG_HEADER, Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, RestHeaders.from({
4269
+ responsetypeaxios: methodConfig.responseType,
4270
+ }));
4271
+ }
4272
+ else {
4273
+ rest = Resource.create(ctx.uri.href, expressPath, Symbols.old.MAPPING_CONFIG_HEADER, Symbols.old.CIRCURAL_OBJECTS_MAP_BODY);
4274
+ }
4275
+ endpoints[ctx.uri.href][expressPath] = rest;
4276
+ }
4277
+ else {
4278
+ rest = endpoints[ctx.uri.href][expressPath];
4279
+ }
4280
+ const method = type.toLowerCase();
4281
+ const isWithBody = method === 'put' || method === 'post';
4282
+ const pathPrams = {};
4283
+ let queryParams = {};
4284
+ let bodyObject = {};
4285
+ args.forEach((param, i) => {
4286
+ let currentParam = void 0;
4287
+ for (let pp in methodConfig.parameters) {
4288
+ let v = methodConfig.parameters[pp];
4289
+ if (v.index === i) {
4290
+ currentParam = v;
4291
+ break;
4292
+ }
4293
+ }
4294
+ if (currentParam.paramType === 'Path') {
4295
+ pathPrams[currentParam.paramName] = param;
4296
+ }
4297
+ if (currentParam.paramType === 'Query') {
4298
+ if (currentParam.paramName) {
4299
+ const mapping = Mapping.decode(param, !ctx.isProductionMode);
4300
+ if (mapping) {
4301
+ rest.headers.set(`${Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
4302
+ }
4303
+ queryParams[currentParam.paramName] = param;
4304
+ }
4305
+ else {
4306
+ const mapping = Mapping.decode(param, !ctx.isProductionMode);
4307
+ if (mapping) {
4308
+ rest.headers.set(Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS, JSON.stringify(mapping));
4309
+ }
4310
+ queryParams = _.cloneDeep(param);
4311
+ }
4312
+ }
4313
+ if (currentParam.paramType === 'Header') {
4314
+ if (currentParam.paramName) {
4315
+ if (currentParam.paramName === Symbols.old.MDC_KEY) {
4316
+ rest.headers.set(currentParam.paramName, encodeURIComponent(JSON.stringify(param)));
4317
+ }
4318
+ else {
4319
+ rest.headers.set(currentParam.paramName, param);
4320
+ }
4321
+ }
4322
+ else {
4323
+ for (let header in param) {
4324
+ rest.headers.set(header, param[header]);
4325
+ }
4326
+ }
4327
+ }
4328
+ if (currentParam.paramType === 'Cookie') {
4329
+ Resource.Cookies.write(currentParam.paramName, param, currentParam.expireInSeconds);
4330
+ }
4331
+ if (currentParam.paramType === 'Body') {
4332
+ if (currentParam.paramName) {
4333
+ if (ClassHelpers.getName(bodyObject) === 'FormData') {
4334
+ throw new Error(`[taon - framework] Don use param names when posting / putting FormData.
4335
+ Use this:
4336
+
4337
+ (@Taon.Http.Param.Body() formData: FormData) ...
4338
+
4339
+
4340
+ instead
4341
+
4342
+ (@Taon.Http.Param.Body('${currentParam.paramName}') formData: FormData) ...
4343
+
4344
+ `);
4345
+ }
4346
+ const mapping = Mapping.decode(param, !ctx.isProductionMode);
4347
+ if (mapping) {
4348
+ rest.headers.set(`${Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS}${currentParam.paramName} `, JSON.stringify(mapping));
4349
+ }
4350
+ bodyObject[currentParam.paramName] = param;
4351
+ }
4352
+ else {
4353
+ const mapping = Mapping.decode(param, !ctx.isProductionMode);
4354
+ if (mapping) {
4355
+ rest.headers.set(Symbols.old.MAPPING_CONFIG_HEADER_BODY_PARAMS, JSON.stringify(mapping));
4356
+ }
4357
+ bodyObject = param;
4358
+ }
4359
+ }
4360
+ });
4361
+ if (typeof bodyObject === 'object' &&
4362
+ ClassHelpers.getName(bodyObject) !== 'FormData') {
4363
+ let circuralFromItem = [];
4364
+ bodyObject = JSON10.parse(JSON10.stringify(bodyObject, void 0, void 0, circs => {
4365
+ circuralFromItem = circs;
4366
+ }));
4367
+ rest.headers.set(Symbols.old.CIRCURAL_OBJECTS_MAP_BODY, JSON10.stringify(circuralFromItem));
4368
+ }
4369
+ if (typeof queryParams === 'object') {
4370
+ let circuralFromQueryParams = [];
4371
+ queryParams = JSON10.parse(JSON10.stringify(queryParams, void 0, void 0, circs => {
4372
+ circuralFromQueryParams = circs;
4373
+ }));
4374
+ rest.headers.set(Symbols.old.CIRCURAL_OBJECTS_MAP_QUERY_PARAM, JSON10.stringify(circuralFromQueryParams));
4375
+ }
4376
+ const httpResultObj = {
4377
+ received: isWithBody
4378
+ ? rest.model(pathPrams)[method](bodyObject, [queryParams])
4379
+ : rest.model(pathPrams)[method]([queryParams]),
4380
+ };
4381
+ return httpResultObj;
4382
+ };
4383
+ }
4384
+ }
4385
+ ;
4386
+ ({}); // @--end-of-file-for-module=taon lib/endpoint-context.ts
4387
+
4388
+ const globalPublicStorage = Helpers.isBrowser ? window : global;
4389
+ ;
4390
+ ({}); // @--end-of-file-for-module=taon lib/storage.ts
4391
+
4392
+ const ENV = Helpers.isBrowser ? window['ENV'] : global['ENV'];
4393
+ class TaonAdmin {
4394
+ constructor() {
4395
+ this.scrollableEnabled = false; // TOOD false by default
4396
+ this.onEditMode = new Subject();
4397
+ this.onEditMode$ = this.onEditMode.asObservable();
4398
+ this.enabledTabs = [];
4399
+ this.scrollableEnabled = !!ENV?.useGlobalNgxScrollbar;
4400
+ }
4401
+ static get Instance() {
4402
+ if (!globalPublicStorage[config.frameworkNames.taon]) {
4403
+ globalPublicStorage[config.frameworkNames.taon] = new TaonAdmin();
4404
+ }
4405
+ return globalPublicStorage[config.frameworkNames.taon];
4406
+ }
4407
+ setEditMode(value) {
4408
+ this.onEditMode.next(value);
4409
+ }
4410
+ setKeepWebsqlDbDataAfterReload(value) {
4411
+ this.keepWebsqlDbDataAfterReload = value;
4412
+ }
4413
+ hide() {
4414
+ this.draggablePopupMode = false;
4415
+ this.adminPanelIsOpen = false;
4416
+ }
4417
+ show() {
4418
+ this.draggablePopupMode = false;
4419
+ this.adminPanelIsOpen = true;
4420
+ }
4421
+ logout() { }
4422
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TaonAdmin, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4423
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TaonAdmin, providedIn: 'root' }); }
4424
+ }
4425
+ __decorate([
4426
+ Stor.property.in.localstorage.for(TaonAdmin).withDefaultValue(false),
4427
+ __metadata("design:type", Boolean)
4428
+ ], TaonAdmin.prototype, "adminPanelIsOpen", void 0);
4429
+ __decorate([
4430
+ Stor.property.in.localstorage.for(TaonAdmin).withDefaultValue(false),
4431
+ __metadata("design:type", Boolean)
4432
+ ], TaonAdmin.prototype, "draggablePopupMode", void 0);
4433
+ __decorate([
4434
+ Stor.property.in.localstorage.for(TaonAdmin).withDefaultValue(false),
4435
+ __metadata("design:type", Boolean)
4436
+ ], TaonAdmin.prototype, "draggablePopupModeFullScreen", void 0);
4437
+ __decorate([
4438
+ Stor.property.in.localstorage.for(TaonAdmin).withDefaultValue(false),
4439
+ __metadata("design:type", Boolean)
4440
+ ], TaonAdmin.prototype, "keepWebsqlDbDataAfterReload", void 0);
4441
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TaonAdmin, decorators: [{
4442
+ type: Injectable,
4443
+ args: [{ providedIn: 'root' }]
4444
+ }], ctorParameters: () => [] });
4445
+ ;
4446
+ ({}); // @--end-of-file-for-module=taon lib/ui/taon-admin-mode-configuration/taon-admin.service.ts
4447
+
4448
+ const createContext = (configFn) => {
4449
+ let config = configFn(ENV$1);
4450
+ const endpointContextRef = new EndpointContext(config, configFn);
4451
+ const res = {
4452
+ types: {
4453
+ get controllers() {
4454
+ return config.controllers;
4455
+ },
4456
+ get repositories() {
4457
+ return config.repositories;
4458
+ },
4459
+ get providers() {
4460
+ return config.providers;
4461
+ },
4462
+ get subscribers() {
4463
+ return config.subscribers;
4464
+ },
4465
+ },
4466
+ get contexts() {
4467
+ return config.contexts;
4468
+ },
4469
+ get contextName() {
4470
+ return config.contextName;
4471
+ },
4472
+ /**
4473
+ * - get reference to internal context
4474
+ */
4475
+ async __ref() {
4476
+ if (!endpointContextRef.inited) {
4477
+ await endpointContextRef.init({
4478
+ initFromRecrusiveContextResovle: true,
4479
+ });
4480
+ }
4481
+ return endpointContextRef;
4482
+ },
4483
+ get __refSync() {
4484
+ return endpointContextRef;
4485
+ },
4486
+ getClassInstance(ctor) {
4487
+ return endpointContextRef.getInstanceBy(ctor);
4488
+ },
4489
+ getClass(ctor) {
4490
+ const classFun = endpointContextRef.getClassFunByClass(ctor);
4491
+ return classFun;
4492
+ },
4493
+ /**
4494
+ * - create controller instances for context
4495
+ * - init database (if enable) + migation scripts
4496
+ */
4497
+ initialize: async () => {
4498
+ return await new Promise(async (resolve, reject) => {
4499
+ setTimeout(async () => {
4500
+ await endpointContextRef.init();
4501
+ if (config.abstract) {
4502
+ throw new Error(`Abstract context can not be initialized`);
4503
+ }
4504
+ await endpointContextRef.initEntities();
4505
+ await endpointContextRef.initSubscribers();
4506
+ await endpointContextRef.initDatabaseConnection();
4507
+ endpointContextRef.initMetadata();
4508
+ endpointContextRef.startServer();
4509
+ /* */
4510
+ /* */
4511
+ await endpointContextRef.initClasses();
4512
+ let keepWebsqlDbDataAfterReload = false;
4513
+ keepWebsqlDbDataAfterReload =
4514
+ TaonAdmin.Instance.keepWebsqlDbDataAfterReload;
4515
+ if (!Helpers.isNode && keepWebsqlDbDataAfterReload) {
4516
+ Helpers.info(`[taon] Keep websql data after reload`);
4517
+ }
4518
+ else {
4519
+ await endpointContextRef.reinitControllers();
4520
+ }
4521
+ resolve(endpointContextRef);
4522
+ });
4523
+ });
4524
+ },
4525
+ };
4526
+ return res;
4527
+ };
4528
+ ;
4529
+ ({}); // @--end-of-file-for-module=taon lib/create-context.ts
4530
+
4531
+ const BaseContext = createContext(() => ({
4532
+ contextName: 'BaseContext',
4533
+ abstract: true,
4534
+ repositories: {
4535
+ // @ts-ignore
4536
+ BaseRepository,
4537
+ },
4538
+ }));
4539
+ ;
4540
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-context.ts
4541
+
4542
+ var baseContext = /*#__PURE__*/Object.freeze({
4543
+ __proto__: null,
4544
+ BaseContext: BaseContext
4545
+ });
4546
+
4547
+ class TaonSubscriberOptions extends Models.DecoratorAbstractOpt {
4548
+ }
4549
+ function TaonSubscriber(options) {
4550
+ return function (constructor) {
4551
+ Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
4552
+ Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
4553
+ ClassHelpers.setName(constructor, options?.className);
4554
+ return class extends constructor {
4555
+ constructor(...args) {
4556
+ super(...args);
4557
+ const methodNamesAll = ClassHelpers.getMethodsNames(constructor.prototype);
4558
+ const methodNames = methodNamesAll.filter(m => {
4559
+ return (!['__trigger_event__', 'clone'].includes(m) &&
4560
+ !m.startsWith('_') &&
4561
+ !m.startsWith('inject'));
4562
+ });
4563
+ methodNames.forEach(methodName => {
4564
+ const originalMethod = this[methodName];
4565
+ this[methodName] = async (...methodArgs) => {
4566
+ const result = originalMethod.apply(this, methodArgs);
4567
+ if (result instanceof Promise) {
4568
+ await result;
4569
+ }
4570
+ if (options.allowedEvents === undefined ||
4571
+ options.allowedEvents.includes(methodName)) {
4572
+ // @ts-ignore
4573
+ this.__trigger_event__(methodName);
4574
+ }
4575
+ return result;
4576
+ };
4577
+ });
4578
+ }
4579
+ };
4580
+ };
4581
+ }
4582
+ ;
4583
+ ({}); // @--end-of-file-for-module=taon lib/decorators/classes/subscriber-decorator.ts
4584
+
4585
+ let BaseSubscriber = class BaseSubscriber extends BaseInjector {
4586
+ __trigger_event__(eventName) {
4587
+ const ctx = this.__endpoint_context__;
4588
+ console.log('Trigger event', eventName, ctx);
4589
+ }
4590
+ };
4591
+ BaseSubscriber = __decorate([
4592
+ TaonSubscriber({
4593
+ className: 'BaseSubscriber',
4594
+ })
4595
+ ], BaseSubscriber);
4596
+ ;
4597
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-subscriber.ts
4598
+
4599
+ let BaseSubscriberForEntity = class BaseSubscriberForEntity extends BaseInjector {
4600
+ /**
4601
+ * Called after entity is loaded.
4602
+ */
4603
+ afterLoad(entity) {
4604
+ console.log(`AFTER ENTITY LOADED: `, entity);
4605
+ }
4606
+ /**
4607
+ * Called before query execution.
4608
+ */
4609
+ beforeQuery(event) {
4610
+ console.log(`BEFORE QUERY: `, event.query);
4611
+ }
4612
+ /**
4613
+ * Called after query execution.
4614
+ */
4615
+ afterQuery(event) {
4616
+ console.log(`AFTER QUERY: `, event.query);
4617
+ }
4618
+ /**
4619
+ * Called before entity insertion.
4620
+ */
4621
+ beforeInsert(event) {
4622
+ console.log(`BEFORE ENTITY INSERTED: `, event.entity);
4623
+ }
4624
+ /**
4625
+ * Called after entity insertion.
4626
+ */
4627
+ afterInsert(event) {
4628
+ console.log(`AFTER ENTITY INSERTED: `, event.entity);
4629
+ }
4630
+ /**
4631
+ * Called before entity update.
4632
+ */
4633
+ beforeUpdate(event) {
4634
+ console.log(`BEFORE ENTITY UPDATED: `, event.entity);
4635
+ }
4636
+ /**
4637
+ * Called after entity update.
4638
+ */
4639
+ afterUpdate(event) {
4640
+ console.log(`AFTER ENTITY UPDATED: `, event.entity);
4641
+ }
4642
+ /**
4643
+ * Called before entity removal.
4644
+ */
4645
+ beforeRemove(event) {
4646
+ console.log(`BEFORE ENTITY WITH ID ${event.entityId} REMOVED: `, event.entity);
4647
+ }
4648
+ /**
4649
+ * Called after entity removal.
4650
+ */
4651
+ afterRemove(event) {
4652
+ console.log(`AFTER ENTITY WITH ID ${event.entityId} REMOVED: `, event.entity);
4653
+ }
4654
+ /**
4655
+ * Called before entity removal.
4656
+ */
4657
+ beforeSoftRemove(event) {
4658
+ console.log(`BEFORE ENTITY WITH ID ${event.entityId} SOFT REMOVED: `, event.entity);
4659
+ }
4660
+ /**
4661
+ * Called after entity removal.
4662
+ */
4663
+ afterSoftRemove(event) {
4664
+ console.log(`AFTER ENTITY WITH ID ${event.entityId} SOFT REMOVED: `, event.entity);
4665
+ }
4666
+ /**
4667
+ * Called before entity recovery.
4668
+ */
4669
+ beforeRecover(event) {
4670
+ console.log(`BEFORE ENTITY WITH ID ${event.entityId} RECOVERED: `, event.entity);
4671
+ }
4672
+ /**
4673
+ * Called after entity recovery.
4674
+ */
4675
+ afterRecover(event) {
4676
+ console.log(`AFTER ENTITY WITH ID ${event.entityId} RECOVERED: `, event.entity);
4677
+ }
4678
+ /**
4679
+ * Called before transaction start.
4680
+ */
4681
+ beforeTransactionStart(event) {
4682
+ console.log(`BEFORE TRANSACTION STARTED: `, event);
4683
+ }
4684
+ /**
4685
+ * Called after transaction start.
4686
+ */
4687
+ afterTransactionStart(event) {
4688
+ console.log(`AFTER TRANSACTION STARTED: `, event);
4689
+ }
4690
+ /**
4691
+ * Called before transaction commit.
4692
+ */
4693
+ beforeTransactionCommit(event) {
4694
+ console.log(`BEFORE TRANSACTION COMMITTED: `, event);
4695
+ }
4696
+ /**
4697
+ * Called after transaction commit.
4698
+ */
4699
+ afterTransactionCommit(event) {
4700
+ console.log(`AFTER TRANSACTION COMMITTED: `, event);
4701
+ }
4702
+ /**
4703
+ * Called before transaction rollback.
4704
+ */
4705
+ beforeTransactionRollback(event) {
4706
+ console.log(`BEFORE TRANSACTION ROLLBACK: `, event);
4707
+ }
4708
+ /**
4709
+ * Called after transaction rollback.
4710
+ */
4711
+ afterTransactionRollback(event) {
4712
+ console.log(`AFTER TRANSACTION ROLLBACK: `, event);
4713
+ }
4714
+ };
4715
+ BaseSubscriberForEntity = __decorate([
4716
+ TaonSubscriber({
4717
+ className: 'BaseSubscriberForEntity',
4718
+ })
4719
+ ], BaseSubscriberForEntity);
4720
+ ;
4721
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base-subscriber-for-entity.ts
4722
+
4723
+ var Base;
4724
+ (function (Base) {
4725
+ Base.Controller = BaseController;
4726
+ Base.CrudController = BaseCrudController;
4727
+ Base.Entity = BaseEntity;
4728
+ Base.AbstractEntity = BaseAbstractEntity;
4729
+ Base.Provider = BaseProvider;
4730
+ Base.Class = BaseClass;
4731
+ Base.Repository = BaseRepository;
4732
+ Base.Subscriber = BaseSubscriber;
4733
+ Base.SubscriberForEntity = BaseSubscriberForEntity;
4734
+ Base.Context = BaseContext;
4735
+ })(Base || (Base = {}));
4736
+ ;
4737
+ ({}); // @--end-of-file-for-module=taon lib/base-classes/base.ts
4738
+
4739
+ /* */
4740
+ /* */
4741
+ function TaonEntity(options) {
4742
+ return function (constructor) {
4743
+ options = options || {};
4744
+ options.uniqueKeyProp = options.uniqueKeyProp || 'id';
4745
+ ClassHelpers.setName(constructor, options?.className);
4746
+ Mapping.DefaultModelWithMapping(options?.defaultModelValues || {}, _.merge(options?.defaultModelMapping || {}, (options?.defaultModelMappingDeep || {})))(constructor);
4747
+ Mapping.DefaultModelWithMapping(void 0, {})(constructor);
4748
+ Reflect.defineMetadata(Symbols.metadata.options.entity, options, constructor);
4749
+ Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
4750
+ /* */
4751
+ /* */
4752
+ CLASS.setName(constructor, options?.className); // TODO QUICK_FIX for ng2-rest
4753
+ };
4754
+ }
4755
+ class TaonEntityOptions extends Models.DecoratorAbstractOpt {
4756
+ }
4757
+ ;
4758
+ ({}); // @--end-of-file-for-module=taon lib/decorators/classes/entity-decorator.ts
4759
+
4760
+ function TaonProvider(options) {
4761
+ return function (constructor) {
4762
+ Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
4763
+ Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
4764
+ ClassHelpers.setName(constructor, options?.className || constructor.name);
4765
+ };
4766
+ }
4767
+ class TaonProviderOptions extends Models.DecoratorAbstractOpt {
4768
+ }
4769
+ ;
4770
+ ({}); // @--end-of-file-for-module=taon lib/decorators/classes/provider-decorator.ts
4771
+
4772
+ const inject = (entity) => {
4773
+ return new Proxy({}, {
4774
+ get: (_, propName) => {
4775
+ if (propName === 'hasOwnProperty') {
4776
+ return () => false;
4777
+ }
4778
+ const ctor = entity();
4779
+ const contextFromClass = ctor[Symbols.ctxInClassOrClassObj];
4780
+ const resultContext = contextFromClass;
4781
+ if (resultContext) {
4782
+ let instance = resultContext.inject(ctor);
4783
+ if (propName === 'getOriginalPrototype') {
4784
+ return () => Object.getPrototypeOf(instance);
4785
+ }
4786
+ if (propName === 'getOriginalConstructor') {
4787
+ return () => instance.constructor;
4788
+ }
4789
+ const methods = ctor[Symbols.classMethodsNames] || [];
4790
+ const isMethods = methods.includes(propName);
4791
+ const methodOrProperty = isMethods
4792
+ ? instance[propName].bind(instance)
4793
+ : instance[propName];
4794
+ return methodOrProperty;
4795
+ }
4796
+ return inject$1(ctor)[propName];
4797
+ },
4798
+ });
4799
+ };
4800
+ const injectController = inject;
4801
+ const injectSubscriberEvents = (subscriberClassResolveFn, eventName) => {
4802
+ const eventsSrc = new Subject();
4803
+ const obs = eventsSrc.asObservable();
4804
+ let isFirstSubscription = true;
4805
+ const proxiedObservable = new Proxy(obs, {
4806
+ get(target, prop, receiver) {
4807
+ if (prop === 'subscribe') {
4808
+ return (...args) => {
4809
+ if (isFirstSubscription) {
4810
+ isFirstSubscription = false;
4811
+ const subscriberClassFN = subscriberClassResolveFn();
4812
+ const ctx = subscriberClassFN[Symbols.ctxInClassOrClassObj];
4813
+ if (!ctx) {
4814
+ throw new Error(`You are trying to inject class without context. Use context like this;
4815
+
4816
+ Taon.injectSubscriberEvents( ()=> ` +
4817
+ `MyContext.getInstance(${subscriberClassFN?.name}), '${eventName}' )
4818
+
4819
+
4820
+ `);
4821
+ }
4822
+ const subscriberInstance = ctx.getInstanceBy(subscriberClassFN);
4823
+ console.log('First subscription, you can access arguments here:', {
4824
+ subscriberClassFN,
4825
+ eventName,
4826
+ });
4827
+ }
4828
+ return target.subscribe(...args);
4829
+ };
4830
+ }
4831
+ return Reflect.get(target, prop, receiver);
4832
+ },
4833
+ });
4834
+ return proxiedObservable;
4835
+ };
4836
+ ;
4837
+ ({}); // @--end-of-file-for-module=taon lib/inject.ts
4838
+
4839
+ ;
4840
+ ({}); // @--end-of-file-for-module=taon lib/constants.ts
4841
+
4842
+ var Taon;
4843
+ (function (Taon) {
4844
+ Taon.Http = Http;
4845
+ Taon.Base = Base;
4846
+ Taon.getResponseValue = getResponseValue;
4847
+ Taon.Controller = TaonController;
4848
+ Taon.Entity = TaonEntity;
4849
+ Taon.Provider = TaonProvider;
4850
+ Taon.Repository = TaonRepository;
4851
+ Taon.Subscriber = TaonSubscriber;
4852
+ /**
4853
+ * @deprecated
4854
+ */
4855
+ Taon.isBrowser = coreHelpers.Helpers.isBrowser;
4856
+ /**
4857
+ * @deprecated
4858
+ */
4859
+ Taon.isNode = coreHelpers.Helpers.isNode;
4860
+ /**
4861
+ * @deprecated
4862
+ */
4863
+ Taon.isWebSQL = coreHelpers.Helpers.isWebSQL;
4864
+ /**
4865
+ * @deprecated
4866
+ */
4867
+ Taon.isElectron = coreHelpers.Helpers.isElectron;
4868
+ Taon.createContext = createContext;
4869
+ Taon.inject = inject;
4870
+ Taon.initNgZone = (ngZone) => {
4871
+ EndpointContext.initNgZone(ngZone);
4872
+ };
4873
+ Taon.symbols = Symbols;
4874
+ /**
4875
+ * @deprecated
4876
+ * use createContext instead
4877
+ */
4878
+ Taon.init = async (options) => {
4879
+ const BaseContext = (await Promise.resolve().then(function () { return baseContext; }))
4880
+ .BaseContext;
4881
+ const context = Taon.createContext(() => ({
4882
+ contextName: 'default',
4883
+ host: options.host,
4884
+ contexts: { BaseContext },
4885
+ database: true,
4886
+ entities: Array.from(options.entities),
4887
+ controllers: Array.from(options.controllers),
4888
+ }));
4889
+ await context.initialize();
4890
+ return context;
4891
+ };
4892
+ })(Taon || (Taon = {}));
4893
+ ;
4894
+ ({}); // @--end-of-file-for-module=taon lib/index.ts
4895
+
4896
+ /**
4897
+ * Generated bundle index. Do not edit.
4898
+ */
4899
+
4900
+ export { BaseContext, BaseController, BaseEntity, BaseProvider, BaseRepository, BaseSubscriber, ClassHelpers, Models, Taon, createContext, inject };
4901
+ //# sourceMappingURL=taon.mjs.map