taon 21.0.18 → 21.0.29

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 (412) hide show
  1. package/README.md +11 -2
  2. package/browser/fesm2022/taon-browser.mjs +1167 -1011
  3. package/browser/fesm2022/taon-browser.mjs.map +1 -1
  4. package/browser/package.json +1 -1
  5. package/browser/types/taon-browser.d.ts +7 -3
  6. package/browser-prod/README.md +24 -0
  7. package/browser-prod/fesm2022/taon-browser.mjs +8367 -0
  8. package/browser-prod/fesm2022/taon-browser.mjs.map +1 -0
  9. package/browser-prod/types/taon-browser.d.ts +2178 -0
  10. package/lib/base-classes/base-context.js +4 -0
  11. package/lib/base-classes/base-context.js.map +1 -1
  12. package/lib/build-info._auto-generated_.d.ts +5 -1
  13. package/lib/build-info._auto-generated_.js +6 -2
  14. package/lib/build-info._auto-generated_.js.map +1 -1
  15. package/lib/decorators/classes/middleware-decorator.d.ts +1 -0
  16. package/lib/decorators/classes/middleware-decorator.js +1 -0
  17. package/lib/decorators/classes/middleware-decorator.js.map +1 -1
  18. package/lib/decorators/classes/subscriber-decorator.d.ts +1 -1
  19. package/lib/decorators/classes/subscriber-decorator.js.map +1 -1
  20. package/lib/env/env.angular-node-app.d.ts +30 -28
  21. package/lib/env/env.angular-node-app.js +32 -30
  22. package/lib/env/env.angular-node-app.js.map +1 -1
  23. package/lib/env/env.docs-webapp.d.ts +30 -28
  24. package/lib/env/env.docs-webapp.js +32 -30
  25. package/lib/env/env.docs-webapp.js.map +1 -1
  26. package/lib/env/env.electron-app.d.ts +30 -28
  27. package/lib/env/env.electron-app.js +32 -30
  28. package/lib/env/env.electron-app.js.map +1 -1
  29. package/lib/env/env.mobile-app.d.ts +30 -28
  30. package/lib/env/env.mobile-app.js +32 -30
  31. package/lib/env/env.mobile-app.js.map +1 -1
  32. package/lib/env/env.npm-lib-and-cli-tool.d.ts +30 -28
  33. package/lib/env/env.npm-lib-and-cli-tool.js +32 -30
  34. package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
  35. package/lib/env/env.vscode-plugin.d.ts +30 -28
  36. package/lib/env/env.vscode-plugin.js +32 -30
  37. package/lib/env/env.vscode-plugin.js.map +1 -1
  38. package/lib/formly/type-from-entity.js +9 -9
  39. package/lib/formly/type-from-entity.js.map +1 -1
  40. package/lib/global-state/taon-global-state/index.d.ts +6 -0
  41. package/lib/global-state/taon-global-state/index.js +23 -0
  42. package/lib/global-state/taon-global-state/index.js.map +1 -0
  43. package/lib/global-state/taon-global-state/taon-global-state-api.service.d.ts +7 -0
  44. package/lib/global-state/taon-global-state/taon-global-state.abstract.context.d.ts +19 -0
  45. package/lib/global-state/taon-global-state/taon-global-state.abstract.context.js +23 -0
  46. package/lib/global-state/taon-global-state/taon-global-state.abstract.context.js.map +1 -0
  47. package/lib/global-state/taon-global-state/taon-global-state.constants.d.ts +2 -0
  48. package/lib/global-state/taon-global-state/taon-global-state.constants.js +11 -0
  49. package/lib/global-state/taon-global-state/taon-global-state.constants.js.map +1 -0
  50. package/lib/global-state/taon-global-state/taon-global-state.controller.d.ts +11 -0
  51. package/lib/global-state/taon-global-state/taon-global-state.controller.js +62 -0
  52. package/lib/global-state/taon-global-state/taon-global-state.controller.js.map +1 -0
  53. package/lib/global-state/taon-global-state/taon-global-state.entity.d.ts +7 -0
  54. package/lib/global-state/taon-global-state/taon-global-state.entity.js +64 -0
  55. package/lib/global-state/taon-global-state/taon-global-state.entity.js.map +1 -0
  56. package/lib/global-state/taon-global-state/taon-global-state.middleware.d.ts +3 -0
  57. package/lib/global-state/taon-global-state/taon-global-state.middleware.js +22 -0
  58. package/lib/global-state/taon-global-state/taon-global-state.middleware.js.map +1 -0
  59. package/lib/global-state/taon-global-state/taon-global-state.models.d.ts +28 -0
  60. package/lib/global-state/taon-global-state/taon-global-state.models.js +48 -0
  61. package/lib/global-state/taon-global-state/taon-global-state.models.js.map +1 -0
  62. package/lib/global-state/taon-global-state/taon-global-state.provider.d.ts +3 -0
  63. package/lib/global-state/taon-global-state/taon-global-state.provider.js +22 -0
  64. package/lib/global-state/taon-global-state/taon-global-state.provider.js.map +1 -0
  65. package/lib/global-state/taon-global-state/taon-global-state.repository.d.ts +9 -0
  66. package/lib/global-state/taon-global-state/taon-global-state.repository.js +53 -0
  67. package/lib/global-state/taon-global-state/taon-global-state.repository.js.map +1 -0
  68. package/lib/global-state/taon-global-state/taon-global-state.subscriber.d.ts +7 -0
  69. package/lib/global-state/taon-global-state/taon-global-state.subscriber.js +29 -0
  70. package/lib/global-state/taon-global-state/taon-global-state.subscriber.js.map +1 -0
  71. package/lib/global-state/taon-global-state/taon-global-state.utils.d.ts +4 -0
  72. package/lib/global-state/taon-global-state/taon-global-state.utils.js +16 -0
  73. package/lib/global-state/taon-global-state/taon-global-state.utils.js.map +1 -0
  74. package/lib/global-state/taon-transaction-registry/index.d.ts +11 -0
  75. package/lib/global-state/taon-transaction-registry/index.js +28 -0
  76. package/lib/global-state/taon-transaction-registry/index.js.map +1 -0
  77. package/lib/global-state/taon-transaction-registry/taon-transaction-registry-api.service.d.ts +7 -0
  78. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.d.ts +19 -0
  79. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +25 -0
  80. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js.map +1 -0
  81. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.constants.d.ts +2 -0
  82. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +9 -0
  83. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.constants.js.map +1 -0
  84. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.controller.d.ts +9 -0
  85. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +52 -0
  86. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.controller.js.map +1 -0
  87. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.entity.d.ts +12 -0
  88. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +77 -0
  89. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.entity.js.map +1 -0
  90. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.middleware.d.ts +3 -0
  91. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +22 -0
  92. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js.map +1 -0
  93. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.models.d.ts +6 -0
  94. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.models.js +11 -0
  95. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.models.js.map +1 -0
  96. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.provider.d.ts +3 -0
  97. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +22 -0
  98. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.provider.js.map +1 -0
  99. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.repository.d.ts +9 -0
  100. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +38 -0
  101. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.repository.js.map +1 -0
  102. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.d.ts +7 -0
  103. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +29 -0
  104. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js.map +1 -0
  105. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.utils.d.ts +4 -0
  106. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +11 -0
  107. package/lib/global-state/taon-transaction-registry/taon-transaction-registry.utils.js.map +1 -0
  108. package/lib/orm/columns.d.ts +5 -1
  109. package/lib/orm/columns.js +12 -2
  110. package/lib/orm/columns.js.map +1 -1
  111. package/lib/ui/index.js +2 -2
  112. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  113. package/lib-prod/base-classes/base-abstract-entity.d.ts +7 -0
  114. package/lib-prod/base-classes/base-abstract-entity.js +42 -0
  115. package/lib-prod/base-classes/base-abstract-entity.js.map +1 -0
  116. package/lib-prod/base-classes/base-angular-service.d.ts +27 -0
  117. package/lib-prod/base-classes/base-angular-service.js +89 -0
  118. package/lib-prod/base-classes/base-angular-service.js.map +1 -0
  119. package/lib-prod/base-classes/base-class.d.ts +15 -0
  120. package/lib-prod/base-classes/base-class.js +40 -0
  121. package/lib-prod/base-classes/base-class.js.map +1 -0
  122. package/lib-prod/base-classes/base-context.d.ts +20 -0
  123. package/lib-prod/base-classes/base-context.js +23 -0
  124. package/lib-prod/base-classes/base-context.js.map +1 -0
  125. package/lib-prod/base-classes/base-controller.d.ts +83 -0
  126. package/lib-prod/base-classes/base-controller.js +173 -0
  127. package/lib-prod/base-classes/base-controller.js.map +1 -0
  128. package/lib-prod/base-classes/base-crud-controller.d.ts +28 -0
  129. package/lib-prod/base-classes/base-crud-controller.js +319 -0
  130. package/lib-prod/base-classes/base-crud-controller.js.map +1 -0
  131. package/lib-prod/base-classes/base-custom-repository.d.ts +3 -0
  132. package/lib-prod/base-classes/base-custom-repository.js +19 -0
  133. package/lib-prod/base-classes/base-custom-repository.js.map +1 -0
  134. package/lib-prod/base-classes/base-electron-service.d.ts +0 -0
  135. package/lib-prod/base-classes/base-electron-service.js +50 -0
  136. package/lib-prod/base-classes/base-electron-service.js.map +1 -0
  137. package/lib-prod/base-classes/base-entity.d.ts +16 -0
  138. package/lib-prod/base-classes/base-entity.js +32 -0
  139. package/lib-prod/base-classes/base-entity.js.map +1 -0
  140. package/lib-prod/base-classes/base-file-upload.middleware.d.ts +14 -0
  141. package/lib-prod/base-classes/base-file-upload.middleware.js +85 -0
  142. package/lib-prod/base-classes/base-file-upload.middleware.js.map +1 -0
  143. package/lib-prod/base-classes/base-injector.d.ts +67 -0
  144. package/lib-prod/base-classes/base-injector.js +198 -0
  145. package/lib-prod/base-classes/base-injector.js.map +1 -0
  146. package/lib-prod/base-classes/base-middleware.d.ts +38 -0
  147. package/lib-prod/base-classes/base-middleware.js +14 -0
  148. package/lib-prod/base-classes/base-middleware.js.map +1 -0
  149. package/lib-prod/base-classes/base-migration.d.ts +11 -0
  150. package/lib-prod/base-classes/base-migration.js +25 -0
  151. package/lib-prod/base-classes/base-migration.js.map +1 -0
  152. package/lib-prod/base-classes/base-provider.d.ts +8 -0
  153. package/lib-prod/base-classes/base-provider.js +13 -0
  154. package/lib-prod/base-classes/base-provider.js.map +1 -0
  155. package/lib-prod/base-classes/base-repository.d.ts +272 -0
  156. package/lib-prod/base-classes/base-repository.js +634 -0
  157. package/lib-prod/base-classes/base-repository.js.map +1 -0
  158. package/lib-prod/base-classes/base-subscriber-for-entity.d.ts +81 -0
  159. package/lib-prod/base-classes/base-subscriber-for-entity.js +155 -0
  160. package/lib-prod/base-classes/base-subscriber-for-entity.js.map +1 -0
  161. package/lib-prod/base-classes/base.d.ts +1 -0
  162. package/lib-prod/base-classes/base.js +20 -0
  163. package/lib-prod/base-classes/base.js.map +1 -0
  164. package/lib-prod/build-info._auto-generated_.d.ts +24 -0
  165. package/lib-prod/build-info._auto-generated_.js +30 -0
  166. package/lib-prod/build-info._auto-generated_.js.map +1 -0
  167. package/lib-prod/config/controller-config.d.ts +21 -0
  168. package/lib-prod/config/controller-config.js +34 -0
  169. package/lib-prod/config/controller-config.js.map +1 -0
  170. package/lib-prod/config/controller-options.d.ts +16 -0
  171. package/lib-prod/config/controller-options.js +8 -0
  172. package/lib-prod/config/controller-options.js.map +1 -0
  173. package/lib-prod/config/method-config.d.ts +39 -0
  174. package/lib-prod/config/method-config.js +12 -0
  175. package/lib-prod/config/method-config.js.map +1 -0
  176. package/lib-prod/config/param-config.d.ts +8 -0
  177. package/lib-prod/config/param-config.js +8 -0
  178. package/lib-prod/config/param-config.js.map +1 -0
  179. package/lib-prod/constants.d.ts +9 -0
  180. package/lib-prod/constants.js +32 -0
  181. package/lib-prod/constants.js.map +1 -0
  182. package/lib-prod/context-db-migrations.d.ts +17 -0
  183. package/lib-prod/context-db-migrations.js +349 -0
  184. package/lib-prod/context-db-migrations.js.map +1 -0
  185. package/lib-prod/create-context.d.ts +78 -0
  186. package/lib-prod/create-context.js +223 -0
  187. package/lib-prod/create-context.js.map +1 -0
  188. package/lib-prod/decorators/classes/controller-decorator.d.ts +5 -0
  189. package/lib-prod/decorators/classes/controller-decorator.js +21 -0
  190. package/lib-prod/decorators/classes/controller-decorator.js.map +1 -0
  191. package/lib-prod/decorators/classes/entity-decorator.d.ts +19 -0
  192. package/lib-prod/decorators/classes/entity-decorator.js +43 -0
  193. package/lib-prod/decorators/classes/entity-decorator.js.map +1 -0
  194. package/lib-prod/decorators/classes/middleware-decorator.d.ts +8 -0
  195. package/lib-prod/decorators/classes/middleware-decorator.js +22 -0
  196. package/lib-prod/decorators/classes/middleware-decorator.js.map +1 -0
  197. package/lib-prod/decorators/classes/migration-decorator.d.ts +7 -0
  198. package/lib-prod/decorators/classes/migration-decorator.js +21 -0
  199. package/lib-prod/decorators/classes/migration-decorator.js.map +1 -0
  200. package/lib-prod/decorators/classes/provider-decorator.d.ts +7 -0
  201. package/lib-prod/decorators/classes/provider-decorator.js +21 -0
  202. package/lib-prod/decorators/classes/provider-decorator.js.map +1 -0
  203. package/lib-prod/decorators/classes/repository-decorator.d.ts +7 -0
  204. package/lib-prod/decorators/classes/repository-decorator.js +21 -0
  205. package/lib-prod/decorators/classes/repository-decorator.js.map +1 -0
  206. package/lib-prod/decorators/classes/subscriber-decorator.d.ts +8 -0
  207. package/lib-prod/decorators/classes/subscriber-decorator.js +22 -0
  208. package/lib-prod/decorators/classes/subscriber-decorator.js.map +1 -0
  209. package/lib-prod/decorators/decorator-abstract-opt.d.ts +3 -0
  210. package/lib-prod/decorators/decorator-abstract-opt.js +7 -0
  211. package/lib-prod/decorators/decorator-abstract-opt.js.map +1 -0
  212. package/lib-prod/decorators/http/http-decorators.d.ts +2 -0
  213. package/lib-prod/decorators/http/http-decorators.js +24 -0
  214. package/lib-prod/decorators/http/http-decorators.js.map +1 -0
  215. package/lib-prod/decorators/http/http-methods-decorators.d.ts +70 -0
  216. package/lib-prod/decorators/http/http-methods-decorators.js +112 -0
  217. package/lib-prod/decorators/http/http-methods-decorators.js.map +1 -0
  218. package/lib-prod/decorators/http/http-params-decorators.d.ts +8 -0
  219. package/lib-prod/decorators/http/http-params-decorators.js +50 -0
  220. package/lib-prod/decorators/http/http-params-decorators.js.map +1 -0
  221. package/lib-prod/dependency-injection/di-container.d.ts +5 -0
  222. package/lib-prod/dependency-injection/di-container.js +35 -0
  223. package/lib-prod/dependency-injection/di-container.js.map +1 -0
  224. package/lib-prod/endpoint-context-storage.d.ts +11 -0
  225. package/lib-prod/endpoint-context-storage.js +38 -0
  226. package/lib-prod/endpoint-context-storage.js.map +1 -0
  227. package/lib-prod/endpoint-context.d.ts +196 -0
  228. package/lib-prod/endpoint-context.js +2416 -0
  229. package/lib-prod/endpoint-context.js.map +1 -0
  230. package/lib-prod/entity-process.d.ts +39 -0
  231. package/lib-prod/entity-process.js +242 -0
  232. package/lib-prod/entity-process.js.map +1 -0
  233. package/lib-prod/env/env.angular-node-app.d.ts +64 -0
  234. package/lib-prod/env/env.angular-node-app.js +71 -0
  235. package/lib-prod/env/env.angular-node-app.js.map +1 -0
  236. package/lib-prod/env/env.docs-webapp.d.ts +64 -0
  237. package/lib-prod/env/env.docs-webapp.js +71 -0
  238. package/lib-prod/env/env.docs-webapp.js.map +1 -0
  239. package/lib-prod/env/env.electron-app.d.ts +64 -0
  240. package/lib-prod/env/env.electron-app.js +71 -0
  241. package/lib-prod/env/env.electron-app.js.map +1 -0
  242. package/lib-prod/env/env.mobile-app.d.ts +64 -0
  243. package/lib-prod/env/env.mobile-app.js +71 -0
  244. package/lib-prod/env/env.mobile-app.js.map +1 -0
  245. package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +64 -0
  246. package/lib-prod/env/env.npm-lib-and-cli-tool.js +71 -0
  247. package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +1 -0
  248. package/lib-prod/env/env.vscode-plugin.d.ts +64 -0
  249. package/lib-prod/env/env.vscode-plugin.js +71 -0
  250. package/lib-prod/env/env.vscode-plugin.js.map +1 -0
  251. package/lib-prod/env/index.d.ts +6 -0
  252. package/lib-prod/env/index.js +23 -0
  253. package/lib-prod/env/index.js.map +1 -0
  254. package/lib-prod/express-types.d.ts +1 -0
  255. package/lib-prod/express-types.js +3 -0
  256. package/lib-prod/express-types.js.map +1 -0
  257. package/lib-prod/formly/formly.models.d.ts +1 -0
  258. package/lib-prod/formly/formly.models.js +3 -0
  259. package/lib-prod/formly/formly.models.js.map +1 -0
  260. package/lib-prod/formly/fromly.d.ts +16 -0
  261. package/lib-prod/formly/fromly.js +209 -0
  262. package/lib-prod/formly/fromly.js.map +1 -0
  263. package/lib-prod/formly/type-from-entity.d.ts +20 -0
  264. package/lib-prod/formly/type-from-entity.js +60 -0
  265. package/lib-prod/formly/type-from-entity.js.map +1 -0
  266. package/lib-prod/get-response-value.d.ts +6 -0
  267. package/lib-prod/get-response-value.js +27 -0
  268. package/lib-prod/get-response-value.js.map +1 -0
  269. package/lib-prod/global-state/taon-global-state/index.d.ts +5 -0
  270. package/lib-prod/global-state/taon-global-state/index.js +23 -0
  271. package/lib-prod/global-state/taon-global-state/index.js.map +1 -0
  272. package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.d.ts +19 -0
  273. package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +23 -0
  274. package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js.map +1 -0
  275. package/lib-prod/global-state/taon-global-state/taon-global-state.constants.d.ts +2 -0
  276. package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +11 -0
  277. package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js.map +1 -0
  278. package/lib-prod/global-state/taon-global-state/taon-global-state.controller.d.ts +11 -0
  279. package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +62 -0
  280. package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js.map +1 -0
  281. package/lib-prod/global-state/taon-global-state/taon-global-state.entity.d.ts +7 -0
  282. package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +64 -0
  283. package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js.map +1 -0
  284. package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.d.ts +3 -0
  285. package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +22 -0
  286. package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js.map +1 -0
  287. package/lib-prod/global-state/taon-global-state/taon-global-state.models.d.ts +28 -0
  288. package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +48 -0
  289. package/lib-prod/global-state/taon-global-state/taon-global-state.models.js.map +1 -0
  290. package/lib-prod/global-state/taon-global-state/taon-global-state.provider.d.ts +3 -0
  291. package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +22 -0
  292. package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js.map +1 -0
  293. package/lib-prod/global-state/taon-global-state/taon-global-state.repository.d.ts +9 -0
  294. package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +53 -0
  295. package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js.map +1 -0
  296. package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.d.ts +7 -0
  297. package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +29 -0
  298. package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js.map +1 -0
  299. package/lib-prod/global-state/taon-global-state/taon-global-state.utils.d.ts +4 -0
  300. package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +16 -0
  301. package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js.map +1 -0
  302. package/lib-prod/global-state/taon-transaction-registry/index.d.ts +10 -0
  303. package/lib-prod/global-state/taon-transaction-registry/index.js +28 -0
  304. package/lib-prod/global-state/taon-transaction-registry/index.js.map +1 -0
  305. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.d.ts +19 -0
  306. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +25 -0
  307. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js.map +1 -0
  308. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.d.ts +2 -0
  309. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +9 -0
  310. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js.map +1 -0
  311. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.d.ts +9 -0
  312. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +52 -0
  313. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js.map +1 -0
  314. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.d.ts +12 -0
  315. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +77 -0
  316. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js.map +1 -0
  317. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.d.ts +3 -0
  318. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +22 -0
  319. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js.map +1 -0
  320. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.d.ts +6 -0
  321. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +11 -0
  322. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js.map +1 -0
  323. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.d.ts +3 -0
  324. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +22 -0
  325. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js.map +1 -0
  326. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.d.ts +9 -0
  327. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +38 -0
  328. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js.map +1 -0
  329. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.d.ts +7 -0
  330. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +29 -0
  331. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js.map +1 -0
  332. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.d.ts +4 -0
  333. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +11 -0
  334. package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js.map +1 -0
  335. package/lib-prod/helpers/class-helpers.d.ts +24 -0
  336. package/lib-prod/helpers/class-helpers.js +233 -0
  337. package/lib-prod/helpers/class-helpers.js.map +1 -0
  338. package/lib-prod/helpers/clone-obj.d.ts +1 -0
  339. package/lib-prod/helpers/clone-obj.js +22 -0
  340. package/lib-prod/helpers/clone-obj.js.map +1 -0
  341. package/lib-prod/helpers/taon-helpers.d.ts +18 -0
  342. package/lib-prod/helpers/taon-helpers.js +152 -0
  343. package/lib-prod/helpers/taon-helpers.js.map +1 -0
  344. package/lib-prod/index._auto-generated_.d.ts +0 -0
  345. package/lib-prod/index._auto-generated_.js +6 -0
  346. package/lib-prod/index._auto-generated_.js.map +1 -0
  347. package/lib-prod/index.d.ts +234 -0
  348. package/lib-prod/index.js +272 -0
  349. package/lib-prod/index.js.map +1 -0
  350. package/lib-prod/inject.d.ts +4 -0
  351. package/lib-prod/inject.js +94 -0
  352. package/lib-prod/inject.js.map +1 -0
  353. package/lib-prod/models.d.ts +260 -0
  354. package/lib-prod/models.js +125 -0
  355. package/lib-prod/models.js.map +1 -0
  356. package/lib-prod/orm/columns.d.ts +32 -0
  357. package/lib-prod/orm/columns.js +112 -0
  358. package/lib-prod/orm/columns.js.map +1 -0
  359. package/lib-prod/orm/index.d.ts +1 -0
  360. package/lib-prod/orm/index.js +73 -0
  361. package/lib-prod/orm/index.js.map +1 -0
  362. package/lib-prod/realtime/realtime-client.d.ts +41 -0
  363. package/lib-prod/realtime/realtime-client.js +204 -0
  364. package/lib-prod/realtime/realtime-client.js.map +1 -0
  365. package/lib-prod/realtime/realtime-core.d.ts +40 -0
  366. package/lib-prod/realtime/realtime-core.js +106 -0
  367. package/lib-prod/realtime/realtime-core.js.map +1 -0
  368. package/lib-prod/realtime/realtime-server.d.ts +43 -0
  369. package/lib-prod/realtime/realtime-server.js +243 -0
  370. package/lib-prod/realtime/realtime-server.js.map +1 -0
  371. package/lib-prod/realtime/realtime-strategy/index.d.ts +4 -0
  372. package/lib-prod/realtime/realtime-strategy/index.js +21 -0
  373. package/lib-prod/realtime/realtime-strategy/index.js.map +1 -0
  374. package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +80 -0
  375. package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +297 -0
  376. package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js.map +1 -0
  377. package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.d.ts +14 -0
  378. package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +303 -0
  379. package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -0
  380. package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +16 -0
  381. package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +33 -0
  382. package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js.map +1 -0
  383. package/lib-prod/realtime/realtime-strategy/realtime-strategy.d.ts +11 -0
  384. package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +17 -0
  385. package/lib-prod/realtime/realtime-strategy/realtime-strategy.js.map +1 -0
  386. package/lib-prod/realtime/realtime-subs-manager.d.ts +14 -0
  387. package/lib-prod/realtime/realtime-subs-manager.js +94 -0
  388. package/lib-prod/realtime/realtime-subs-manager.js.map +1 -0
  389. package/lib-prod/realtime/realtime.models.d.ts +27 -0
  390. package/lib-prod/realtime/realtime.models.js +3 -0
  391. package/lib-prod/realtime/realtime.models.js.map +1 -0
  392. package/lib-prod/symbols.d.ts +65 -0
  393. package/lib-prod/symbols.js +110 -0
  394. package/lib-prod/symbols.js.map +1 -0
  395. package/lib-prod/ui/index.d.ts +1 -0
  396. package/lib-prod/ui/index.js +5 -0
  397. package/lib-prod/ui/index.js.map +1 -0
  398. package/lib-prod/ui/taon-admin-mode-configuration/index.d.ts +1 -0
  399. package/lib-prod/ui/taon-admin-mode-configuration/index.js +5 -0
  400. package/lib-prod/ui/taon-admin-mode-configuration/index.js.map +1 -0
  401. package/lib-prod/validators.d.ts +7 -0
  402. package/lib-prod/validators.js +85 -0
  403. package/lib-prod/validators.js.map +1 -0
  404. package/package.json +5 -5
  405. package/websql/fesm2022/taon-websql.mjs +1387 -1141
  406. package/websql/fesm2022/taon-websql.mjs.map +1 -1
  407. package/websql/package.json +1 -1
  408. package/websql/types/taon-websql.d.ts +7 -3
  409. package/websql-prod/README.md +24 -0
  410. package/websql-prod/fesm2022/taon-websql.mjs +8198 -0
  411. package/websql-prod/fesm2022/taon-websql.mjs.map +1 -0
  412. package/websql-prod/types/taon-websql.d.ts +2187 -0
@@ -14,7 +14,7 @@ import { SYMBOL, CLASS } from 'typescript-class-helpers/browser';
14
14
  import * as JSON5 from 'json5';
15
15
  import { io } from 'socket.io-client';
16
16
  import { isPlatformServer, isPlatformBrowser } from '@angular/common';
17
- import { __decorate, __metadata, __param } from 'tslib';
17
+ import { __decorate, __param, __metadata } from 'tslib';
18
18
  import * as i1 from '@ngx-formly/core';
19
19
  import { FieldWrapper, FieldArrayType } from '@ngx-formly/core';
20
20
 
@@ -5768,13 +5768,204 @@ class TaonBaseAngularService {
5768
5768
  return currentContext ? currentContext.getClass(ctor) : void 0;
5769
5769
  });
5770
5770
  }
5771
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TaonBaseAngularService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5772
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TaonBaseAngularService }); }
5771
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TaonBaseAngularService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5772
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TaonBaseAngularService }); }
5773
5773
  }
5774
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TaonBaseAngularService, decorators: [{
5774
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TaonBaseAngularService, decorators: [{
5775
5775
  type: Injectable
5776
5776
  }], ctorParameters: () => [] });
5777
5777
 
5778
+ /**
5779
+ * Entity decorator
5780
+ */
5781
+ function TaonEntity(options) {
5782
+ return function (constructor) {
5783
+ options = options || {};
5784
+ options.uniqueKeyProp = options.uniqueKeyProp || 'id';
5785
+ ClassHelpers.setName(constructor, options?.className);
5786
+ Mapping.DefaultModelWithMapping(options?.defaultModelValues || {}, _.merge(options?.defaultModelMapping || {}, (options?.defaultModelMappingDeep || {})))(constructor);
5787
+ // TODO when entit metadata generator read use this
5788
+ Mapping.DefaultModelWithMapping(void 0, {})(constructor);
5789
+ Reflect.defineMetadata(Symbols.metadata.options.entity, options, constructor);
5790
+ Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
5791
+ /* */
5792
+ /* */
5793
+ CLASS.setName(constructor, options?.className); // TODO QUICK_FIX for ng2-rest
5794
+ };
5795
+ }
5796
+ class TaonEntityOptions extends DecoratorAbstractOpt {
5797
+ }
5798
+
5799
+ //#region imports
5800
+ //#endregion
5801
+ let TAON_GLOBAL_STATE = class TAON_GLOBAL_STATE extends TaonBaseAbstractEntity {
5802
+ };
5803
+ TAON_GLOBAL_STATE = __decorate([
5804
+ TaonEntity({
5805
+ className: 'TAON_GLOBAL_STATE',
5806
+ createTable: true,
5807
+ })
5808
+ ], TAON_GLOBAL_STATE);
5809
+
5810
+ /**
5811
+ * Controller decorator
5812
+ */
5813
+ function TaonController(options) {
5814
+ return function (constructor) {
5815
+ ClassHelpers.setName(constructor, options?.className);
5816
+ Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
5817
+ const cfg = ClassHelpers.ensureClassConfig(constructor);
5818
+ options = options || {};
5819
+ cfg.className = options.className || constructor.name;
5820
+ cfg.path = options.path || '';
5821
+ cfg.realtime = options.realtime;
5822
+ cfg.middlewares = options.middlewares;
5823
+ };
5824
+ }
5825
+
5826
+ const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
5827
+ const methodConfig = ClassHelpers.ensureMethodConfig(target, propertyKey);
5828
+ let options;
5829
+ if (typeof pathOrOptions === 'object') {
5830
+ options = pathOrOptions;
5831
+ pathOrOptions = options.path;
5832
+ pathIsGlobal = !!options.pathIsGlobal;
5833
+ path = options.path;
5834
+ }
5835
+ else {
5836
+ options = { pathOrOptions, pathIsGlobal };
5837
+ }
5838
+ const { overrideContentType, overrideResponseType, overrideExpressSendAsHtml, middlewares, } = options;
5839
+ methodConfig.methodName = propertyKey;
5840
+ methodConfig.middlewares = middlewares;
5841
+ methodConfig.type = method;
5842
+ if (!path) {
5843
+ let paramsPathConcatedPath = '';
5844
+ for (const key in methodConfig.parameters) {
5845
+ if (methodConfig.parameters.hasOwnProperty(key)) {
5846
+ const element = methodConfig.parameters[key];
5847
+ if (element.paramType === 'Path' &&
5848
+ _.isString(element.paramName) &&
5849
+ element.paramName.trim().length > 0) {
5850
+ paramsPathConcatedPath += `/${element.paramName}/:${element.paramName}`;
5851
+ }
5852
+ }
5853
+ }
5854
+ methodConfig.path = `/${propertyKey}${paramsPathConcatedPath}`;
5855
+ }
5856
+ else {
5857
+ methodConfig.path = path;
5858
+ }
5859
+ methodConfig.descriptor = descriptor;
5860
+ methodConfig.global = pathIsGlobal;
5861
+ methodConfig.contentType = overrideContentType;
5862
+ methodConfig.responseType = overrideResponseType;
5863
+ methodConfig.overrideExpressSendAsHtml = overrideExpressSendAsHtml;
5864
+ };
5865
+ function GET(pathOrOptions, pathIsGlobal = false) {
5866
+ return function (target, propertyKey, descriptor) {
5867
+ metaReq('get', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
5868
+ };
5869
+ }
5870
+ /**
5871
+ * Method for sending html website from text
5872
+ * Example
5873
+ *
5874
+ * ```ts
5875
+ * ...
5876
+ * // in your taon controller
5877
+ * ..Taon.Http.HTML()
5878
+ * sendHtmlDummyWebsite(): Taon.ResponseHtml {
5879
+ * return `
5880
+ <html>
5881
+ <head>
5882
+ <title>Dummy website</title>
5883
+ </head>
5884
+ <body>
5885
+ <h1>This is dummy website</h1>
5886
+ <p>Served as HTML string from Taon controller method</p>
5887
+ </body>
5888
+ </html>
5889
+ * `; *
5890
+ * }
5891
+ * ...
5892
+ * ```
5893
+ */
5894
+ function HTML(pathOrOptions) {
5895
+ return function (target, propertyKey, descriptor) {
5896
+ const opt = pathOrOptions;
5897
+ opt.overrideExpressSendAsHtml = true;
5898
+ metaReq('get', opt, target, propertyKey, descriptor, pathOrOptions, opt.pathIsGlobal);
5899
+ };
5900
+ }
5901
+ function HEAD(pathOrOptions, pathIsGlobal = false) {
5902
+ return function (target, propertyKey, descriptor) {
5903
+ metaReq('head', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
5904
+ };
5905
+ }
5906
+ function POST(pathOrOptions, pathIsGlobal = false) {
5907
+ return function (target, propertyKey, descriptor) {
5908
+ metaReq('post', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
5909
+ };
5910
+ }
5911
+ function PUT(pathOrOptions, pathIsGlobal = false) {
5912
+ return function (target, propertyKey, descriptor) {
5913
+ metaReq('put', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
5914
+ };
5915
+ }
5916
+ function PATCH(pathOrOptions, pathIsGlobal = false) {
5917
+ return function (target, propertyKey, descriptor) {
5918
+ metaReq('patch', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
5919
+ };
5920
+ }
5921
+ function DELETE(pathOrOptions, pathIsGlobal = false) {
5922
+ return function (target, propertyKey, descriptor) {
5923
+ metaReq('delete', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
5924
+ };
5925
+ }
5926
+
5927
+ function metaParam(param, name, expire, defaultValue = undefined, target, propertyKey, parameterIndex) {
5928
+ const methodCfg = ClassHelpers.ensureMethodConfig(target, propertyKey);
5929
+ const nameKey = name ? name : param;
5930
+ // const key = name || `${param}_${parameterIndex}`;
5931
+ methodCfg.parameters[nameKey] = {
5932
+ index: parameterIndex,
5933
+ paramName: name,
5934
+ paramType: param,
5935
+ defaultType: defaultValue,
5936
+ expireInSeconds: expire,
5937
+ };
5938
+ // console.log('params updated', methodConfig);
5939
+ }
5940
+ /**
5941
+ * @deprecated use Taon.Http.Param.Path (is more safe and cleaner)
5942
+ */
5943
+ function Path(name) {
5944
+ return function (target, propertyKey, parameterIndex) {
5945
+ metaParam('Path', name, undefined, {}, target, propertyKey, parameterIndex);
5946
+ };
5947
+ }
5948
+ function Query(name) {
5949
+ return function (target, propertyKey, parameterIndex) {
5950
+ metaParam('Query', name, undefined, {}, target, propertyKey, parameterIndex);
5951
+ };
5952
+ }
5953
+ function Cookie(name, expireInSecond = 3600) {
5954
+ return function (target, propertyKey, parameterIndex) {
5955
+ metaParam('Cookie', name, expireInSecond, {}, target, propertyKey, parameterIndex);
5956
+ };
5957
+ }
5958
+ function Header(name) {
5959
+ return function (target, propertyKey, parameterIndex) {
5960
+ metaParam('Header', name, undefined, {}, target, propertyKey, parameterIndex);
5961
+ };
5962
+ }
5963
+ function Body(name) {
5964
+ return function (target, propertyKey, parameterIndex) {
5965
+ metaParam('Body', name, undefined, {}, target, propertyKey, parameterIndex);
5966
+ };
5967
+ }
5968
+
5778
5969
  /**
5779
5970
  * Provider decorator
5780
5971
  */
@@ -6049,46 +6240,14 @@ TaonBaseFileUploadMiddleware = __decorate([
6049
6240
  })
6050
6241
  ], TaonBaseFileUploadMiddleware);
6051
6242
 
6052
- /**
6053
- * Repository decorator
6054
- */
6055
- function TaonRepository(options) {
6056
- return function (constructor) {
6057
- Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
6058
- Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
6059
- ClassHelpers.setName(constructor, options?.className);
6060
- };
6061
- }
6062
- class TaonRepositoryOptions extends DecoratorAbstractOpt {
6063
- }
6064
-
6065
- //#endregion
6066
- let TaonBaseCustomRepository = class TaonBaseCustomRepository extends TaonBaseInjector {
6067
- };
6068
- TaonBaseCustomRepository = __decorate([
6069
- TaonRepository({ className: 'TaonBaseCustomRepository' })
6070
- ], TaonBaseCustomRepository);
6071
-
6072
- //#endregion
6073
- const INDEX_KEYS_NO_FOR_UPDATE = ['id'];
6074
- let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomRepository {
6075
- constructor(
6076
- // Injected through TaonBaseCrudController
6077
- __entityClassResolveFn) {
6078
- super();
6079
- this.REPOS_CACHE_KEY = Symbol('repository cache inside instance');
6080
- this.allowedTypesToUpdate = ['simple-json', 'simple-array', 'json'];
6081
- // @ts-ignore
6082
- this.entityClassResolveFn = __entityClassResolveFn;
6083
- }
6084
- get dbQuery() {
6085
- /* */
6086
- /* */
6087
- /* */
6088
- /* */
6089
- /* */
6090
- /* */
6091
- /* */
6243
+ let TaonBaseController = class TaonBaseController extends TaonBaseInjector {
6244
+ /**
6245
+ * Hook that is called when taon app is inited
6246
+ * (all contexts are created and inited)
6247
+ */
6248
+ async afterAllCtxInited(options) { }
6249
+ //#region upload form data to server
6250
+ uploadFormDataToServer(formData, queryParams) {
6092
6251
  /* */
6093
6252
  /* */
6094
6253
  /* */
@@ -6101,18 +6260,8 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6101
6260
  /* */
6102
6261
  /* */
6103
6262
  /* */
6104
- return (void 0);
6105
- }
6106
- //#endregion
6107
- //#region connection
6108
- get connection() {
6109
6263
  /* */
6110
6264
  /* */
6111
- return (void 0);
6112
- }
6113
- //#endregion
6114
- //#region repository
6115
- get repository() {
6116
6265
  /* */
6117
6266
  /* */
6118
6267
  /* */
@@ -6125,6 +6274,19 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6125
6274
  /* */
6126
6275
  /* */
6127
6276
  /* */
6277
+ return (void 0);
6278
+ }
6279
+ //#endregion
6280
+ //#region after file upload hook
6281
+ /**
6282
+ * Hook after file is uploaded
6283
+ * through `uploadFormDataToServer` or `uploadLocalFileToServer`
6284
+ */
6285
+ afterFileUploadAction(file, queryParams) {
6286
+ // empty
6287
+ }
6288
+ //#region upload local file to server
6289
+ async uploadLocalFileToServer(absFilePath, options, queryParams) {
6128
6290
  /* */
6129
6291
  /* */
6130
6292
  /* */
@@ -6137,58 +6299,139 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6137
6299
  /* */
6138
6300
  /* */
6139
6301
  /* */
6140
- /* */
6141
- /* */
6142
- /* */
6143
- /* */
6144
- /* */
6145
- return (void 0);
6146
- }
6147
- /**
6148
- * target for repository
6149
- */
6150
- get target() {
6151
- /* */
6152
- /* */
6153
- return (void 0);
6154
- }
6155
- /**
6156
- * alias to repository
6157
- */
6158
- get repo() {
6159
- /* */
6160
- /* */
6161
- return (void 0);
6162
- }
6163
- get repositoryExists() {
6164
6302
  /* */
6165
6303
  /* */
6166
6304
  return (void 0);
6167
6305
  }
6168
6306
  //#endregion
6169
- //#region crud operations / typeorm / has id
6307
+ // async check() {
6308
+ // await this._waitForProperStatusChange({
6309
+ // request: () => this.uploadFormDataToServer(void 0, void 0).request(),
6310
+ // statusCheck: resp => resp.body.json[0].ok,
6311
+ // });
6312
+ // }
6170
6313
  /**
6171
- * Checks if entity has an id.
6172
- * If entity composite compose ids, it will check them all.
6314
+ * Easy way to wait for status change with http (1s default) pooling.
6315
+ *
6316
+ * example (in sub class):
6317
+ * ```ts
6318
+ async check() {
6319
+ await this.waitForProperStatusChange({
6320
+ request: () => this.uploadFormDataToServer(void 0, void 0).request(),
6321
+ statusCheck: resp => resp.body.json[0].ok,
6322
+ });
6323
+ }
6324
+ * ```
6173
6325
  */
6174
- hasId(entity) {
6175
- return this.repo.hasId(entity);
6326
+ async _waitForProperStatusChange(options) {
6327
+ const poolingInterval = options.poolingInterval || 1000;
6328
+ const taonRequest = options.request;
6329
+ let maxTries = options.maxTries || Number.POSITIVE_INFINITY;
6330
+ let i = 0;
6331
+ let httpErrorsCount = 0;
6332
+ while (true) {
6333
+ await UtilsTerminal.waitMilliseconds(poolingInterval);
6334
+ try {
6335
+ const resp = await taonRequest({
6336
+ reqIndexNum: i,
6337
+ httpErrorsCount,
6338
+ });
6339
+ if (options.statusCheck && options.statusCheck(resp)) {
6340
+ return;
6341
+ }
6342
+ }
6343
+ catch (error) {
6344
+ httpErrorsCount++;
6345
+ if (options.loopRequestsOnBackendError) {
6346
+ const isProperTaonError = error instanceof HttpResponseError &&
6347
+ error.body.json[CoreModels.TaonHttpErrorCustomProp];
6348
+ const isHttpError = error instanceof HttpResponseError && !isProperTaonError;
6349
+ const isUnknownError = !(error instanceof HttpResponseError);
6350
+ const resBool = await options.loopRequestsOnBackendError({
6351
+ taonError: isProperTaonError ? error : void 0,
6352
+ unknownHttpError: isHttpError ? error : void 0,
6353
+ unknownError: isUnknownError ? error : void 0,
6354
+ reqIndexNum: i,
6355
+ httpErrorsCount,
6356
+ });
6357
+ if (resBool) {
6358
+ i++;
6359
+ continue;
6360
+ }
6361
+ else {
6362
+ return;
6363
+ }
6364
+ }
6365
+ if (httpErrorsCount >
6366
+ (options.allowedHttpErrors || Number.POSITIVE_INFINITY)) {
6367
+ throw new Error(`Too many http errors (${httpErrorsCount}) for "${options.actionName}".`);
6368
+ }
6369
+ }
6370
+ if (i++ > maxTries) {
6371
+ throw new Error(`Timeout waiting for "${options.actionName}" to be finished. Waited for ${maxTries} seconds`);
6372
+ }
6373
+ }
6176
6374
  }
6375
+ };
6376
+ __decorate([
6377
+ POST({
6378
+ overrideContentType: 'multipart/form-data',
6379
+ middlewares: ({ parentMiddlewares }) => ({
6380
+ ...parentMiddlewares,
6381
+ TaonBaseFileUploadMiddleware,
6382
+ }),
6383
+ }),
6384
+ __param(0, Body()),
6385
+ __param(1, Query()),
6386
+ __metadata("design:type", Function),
6387
+ __metadata("design:paramtypes", [FormData, Object]),
6388
+ __metadata("design:returntype", Object)
6389
+ ], TaonBaseController.prototype, "uploadFormDataToServer", null);
6390
+ TaonBaseController = __decorate([
6391
+ TaonController({
6392
+ className: 'TaonBaseController',
6393
+ })
6394
+ ], TaonBaseController);
6395
+
6396
+ //#endregion
6397
+ /**
6398
+ * Please override property entityClassFn with entity class.
6399
+ */
6400
+ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseController {
6177
6401
  //#endregion
6178
- //#region crud operations / typeorm / get id
6179
- /**
6180
- * Gets entity mixed id.
6181
- */
6182
- getId(entity) {
6183
- return this.repo.getId(entity);
6402
+ //#region init
6403
+ async _() {
6404
+ if (!_.isFunction(this.entityClassResolveFn)) {
6405
+ Helpers.warn(`Skipping initing CRUD controller ${ClassHelpers.getName(this)} because entityClassResolveFn is not provided.`);
6406
+ return;
6407
+ }
6408
+ let entityClassFn = this.entityClassResolveFn();
6409
+ this.db = this.injectRepo(entityClassFn);
6410
+ if (entityClassFn) {
6411
+ const configEntity = Reflect.getMetadata(Symbols.metadata.options.entity, ClassHelpers.getClassFnFromObject(this));
6412
+ if (configEntity?.createTable === false) {
6413
+ Helpers.warn(`Table for entity ${ClassHelpers.getName(entityClassFn)} will not be created. Crud will not work properly.`);
6414
+ }
6415
+ }
6416
+ else {
6417
+ Helpers.error(`Entity class not provided for controller ${ClassHelpers.getName(this)}.
6418
+
6419
+ Please provide entity as class property entityClassFn:
6420
+
6421
+ class ${ClassHelpers.getName(this)} extends TaonBaseCrudController<Entity> {
6422
+ // ...
6423
+ entityClassResolveFn = ()=> MyEntityClass;
6424
+ // ...
6425
+ }
6426
+
6427
+ `);
6428
+ }
6429
+ await super._();
6184
6430
  }
6185
6431
  //#endregion
6186
- //#region crud operations / typeorm / create & bulk create
6187
- /**
6188
- Saves a given entity in the database.
6189
- * If entity does not exist in the database then inserts, otherwise updates.
6190
- */
6191
- async save(item, options) {
6432
+ //#region bufferd changes
6433
+ bufforedChanges(id, property, alreadyLength) {
6434
+ /* */
6192
6435
  /* */
6193
6436
  /* */
6194
6437
  /* */
@@ -6205,14 +6448,9 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6205
6448
  /* */
6206
6449
  return (void 0);
6207
6450
  }
6208
- /**
6209
- * Creates a new entity instance or instances.
6210
- * Can copy properties from the given object into new entities.
6211
- */
6212
- create(plainEntityLikeOrPlainEntityLikes) {
6213
- return this.repo.create(plainEntityLikeOrPlainEntityLikes);
6214
- }
6215
- async bulkSave(items, options) {
6451
+ //#endregion
6452
+ //#region pagintation
6453
+ pagination(pageNumber = 1, pageSize = 10, search = '') {
6216
6454
  /* */
6217
6455
  /* */
6218
6456
  /* */
@@ -6222,82 +6460,6 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6222
6460
  /* */
6223
6461
  /* */
6224
6462
  /* */
6225
- return (void 0);
6226
- }
6227
- /**
6228
- * @deprecated use bulkSave instead
6229
- */
6230
- async bulkCreate(items, options) {
6231
- return this.bulkSave(items, options);
6232
- }
6233
- //#region old typeorm version
6234
- /**
6235
- * Saves all given entities in the database.
6236
- * If entities do not exist in the database then inserts, otherwise updates.
6237
- */
6238
- // save<T extends DeepPartial<Entity>>(
6239
- // entities: T[],
6240
- // options: SaveOptions & {
6241
- // reload: false;
6242
- // },
6243
- // ): Promise<T[]>;
6244
- // /**
6245
- // * Saves all given entities in the database.
6246
- // * If entities do not exist in the database then inserts, otherwise updates.
6247
- // */
6248
- // save<T extends DeepPartial<Entity>>(
6249
- // entities: T[],
6250
- // options?: SaveOptions,
6251
- // ): Promise<(T & Entity)[]>;
6252
- // /**
6253
- // * Saves a given entity in the database.
6254
- // * If entity does not exist in the database then inserts, otherwise updates.
6255
- // */
6256
- // save<T extends DeepPartial<Entity>>(
6257
- // entity: T,
6258
- // options: SaveOptions & {
6259
- // reload: false;
6260
- // },
6261
- // ): Promise<T>;
6262
- // /**
6263
- // * Saves a given entity in the database.
6264
- // * If entity does not exist in the database then inserts, otherwise updates.
6265
- // */
6266
- // save<T extends DeepPartial<Entity>>(
6267
- // entity: T,
6268
- // options?: SaveOptions,
6269
- // ): Promise<T & Entity> {
6270
- // return this.repo.save(entity, options);
6271
- // }
6272
- //#endregion
6273
- //#endregion
6274
- //#region crud operations / typeorm / merge
6275
- /**
6276
- * Merges multiple entities (or entity-like objects) into a given entity.
6277
- */
6278
- merge(mergeIntoEntity, ...entityLikes) {
6279
- return this.repo.merge(mergeIntoEntity, ...entityLikes);
6280
- }
6281
- //#endregion
6282
- //#region crud operations / typeorm / preload
6283
- /**
6284
- * Creates a new entity from the given plain javascript object. If entity already exist in the database, then
6285
- * it loads it (and everything related to it), replaces all values with the new ones from the given object
6286
- * and returns this new entity. This new entity is actually a loaded from the db entity with all properties
6287
- * replaced from the new object.
6288
- *
6289
- * Note that given entity-like object must have an entity id / primary key to find entity by.
6290
- * Returns undefined if entity with given id was not found.
6291
- */
6292
- preload(entityLike) {
6293
- return this.repo.preload(entityLike);
6294
- }
6295
- //#endregion
6296
- //#region crud operations / typeorm / remove (delete) & bulk remove (delete)
6297
- /**
6298
- * Removes a given entities from the database.
6299
- */
6300
- async remove(idOrEntity) {
6301
6463
  /* */
6302
6464
  /* */
6303
6465
  /* */
@@ -6320,27 +6482,53 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6320
6482
  /* */
6321
6483
  /* */
6322
6484
  /* */
6323
- return (void 0);
6324
- }
6325
- /**
6326
- * alias to remove
6327
- */
6328
- async delete(idOrEntity) {
6329
- return this.remove(idOrEntity);
6485
+ /* */
6486
+ /* */
6487
+ /* */
6488
+ /* */
6489
+ /* */
6490
+ /* */
6491
+ /* */
6492
+ return (void 0);
6330
6493
  }
6331
- /**
6332
- * alias to removeById
6333
- */
6334
- async deleteById(id) {
6335
- return this.remove(id);
6494
+ //#endregion
6495
+ //#region get all
6496
+ getAll() {
6497
+ /* */
6498
+ /* */
6499
+ /* */
6500
+ /* */
6501
+ /* */
6502
+ /* */
6503
+ /* */
6504
+ /* */
6505
+ /* */
6506
+ return (void 0);
6336
6507
  }
6337
- async bulkRemove(idsOrEntities) {
6508
+ //#endregion
6509
+ //#region get by id
6510
+ getBy(id) {
6511
+ /* */
6338
6512
  /* */
6513
+ /* */
6514
+ /* */
6515
+ /* */
6516
+ return (void 0);
6517
+ }
6518
+ //#endregion
6519
+ //#region update by id
6520
+ updateById(id, item) {
6339
6521
  /* */
6340
6522
  /* */
6341
6523
  /* */
6342
6524
  /* */
6343
6525
  /* */
6526
+ /* */
6527
+ return (void 0);
6528
+ }
6529
+ //#endregion
6530
+ //#region patch by id
6531
+ patchById(id, item) {
6344
6532
  /* */
6345
6533
  /* */
6346
6534
  /* */
@@ -6349,47 +6537,194 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6349
6537
  /* */
6350
6538
  return (void 0);
6351
6539
  }
6352
- async bulkDelete(ids) {
6353
- return this.bulkRemove(ids);
6540
+ //#endregion
6541
+ //#region bulk update
6542
+ bulkUpdate(items) {
6543
+ /* */
6544
+ /* */
6545
+ /* */
6546
+ /* */
6547
+ /* */
6548
+ /* */
6549
+ /* */
6550
+ /* */
6551
+ return (void 0);
6354
6552
  }
6355
- /**
6356
- * Records the delete date of a given entity.
6357
- */
6358
- softRemove(entity, options) {
6359
- return this.repo.softRemove(entity, options);
6553
+ //#endregion
6554
+ //#region delete by id
6555
+ deleteById(id) {
6556
+ /* */
6557
+ /* */
6558
+ /* */
6559
+ /* */
6560
+ /* */
6561
+ return (void 0);
6360
6562
  }
6361
- /**
6362
- * Recovers a given entity in the database.
6363
- */
6364
- recover(entity, options) {
6365
- return this.repo.recover(entity, options);
6563
+ //#endregion
6564
+ //#region bulk delete
6565
+ bulkDelete(ids) {
6566
+ /* */
6567
+ /* */
6568
+ /* */
6569
+ /* */
6570
+ /* */
6571
+ return (void 0);
6366
6572
  }
6367
6573
  //#endregion
6368
- //#region crud operations / typeorm / insert
6369
- /**
6370
- * Inserts a given entity into the database.
6371
- * Unlike save method executes a primitive operation without cascades, relations and other operations included.
6372
- * Executes fast and efficient INSERT query.
6373
- * Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted.
6374
- */
6375
- insert(entity) {
6376
- // debugger;
6377
- return this.repo.insert(entity);
6574
+ //#region bulk delete
6575
+ clearTable() {
6576
+ /* */
6577
+ /* */
6578
+ /* */
6579
+ /* */
6580
+ return (void 0);
6378
6581
  }
6379
6582
  //#endregion
6380
- //#region crud operations / typeorm / update & build update
6381
- async update(item) {
6583
+ //#region create
6584
+ save(item) {
6585
+ /* */
6586
+ /* */
6382
6587
  /* */
6383
6588
  /* */
6384
6589
  /* */
6385
6590
  return (void 0);
6386
6591
  }
6387
- async updateById(id, item) {
6592
+ //#endregion
6593
+ //#region bulk create
6594
+ bulkCreate(items) {
6388
6595
  /* */
6389
6596
  /* */
6390
6597
  /* */
6391
6598
  /* */
6392
6599
  /* */
6600
+ return (void 0);
6601
+ }
6602
+ };
6603
+ __decorate([
6604
+ GET(),
6605
+ __param(0, Query(`id`)),
6606
+ __param(1, Query(`property`)),
6607
+ __param(2, Query('alreadyLength')),
6608
+ __metadata("design:type", Function),
6609
+ __metadata("design:paramtypes", [Object, String, Number]),
6610
+ __metadata("design:returntype", Object)
6611
+ ], TaonBaseCrudController.prototype, "bufforedChanges", null);
6612
+ __decorate([
6613
+ GET(),
6614
+ __param(0, Query('pageNumber')),
6615
+ __param(1, Query('pageSize')),
6616
+ __param(2, Query('search')),
6617
+ __metadata("design:type", Function),
6618
+ __metadata("design:paramtypes", [Number, Number, String]),
6619
+ __metadata("design:returntype", Object)
6620
+ ], TaonBaseCrudController.prototype, "pagination", null);
6621
+ __decorate([
6622
+ GET(),
6623
+ __metadata("design:type", Function),
6624
+ __metadata("design:paramtypes", []),
6625
+ __metadata("design:returntype", Object)
6626
+ ], TaonBaseCrudController.prototype, "getAll", null);
6627
+ __decorate([
6628
+ GET(),
6629
+ __param(0, Query(`id`)),
6630
+ __metadata("design:type", Function),
6631
+ __metadata("design:paramtypes", [Object]),
6632
+ __metadata("design:returntype", Object)
6633
+ ], TaonBaseCrudController.prototype, "getBy", null);
6634
+ __decorate([
6635
+ PUT(),
6636
+ __param(0, Query(`id`)),
6637
+ __param(1, Body()),
6638
+ __metadata("design:type", Function),
6639
+ __metadata("design:paramtypes", [Object, Object]),
6640
+ __metadata("design:returntype", Object)
6641
+ ], TaonBaseCrudController.prototype, "updateById", null);
6642
+ __decorate([
6643
+ PATCH(),
6644
+ __param(0, Query(`id`)),
6645
+ __param(1, Body()),
6646
+ __metadata("design:type", Function),
6647
+ __metadata("design:paramtypes", [Object, Object]),
6648
+ __metadata("design:returntype", Object)
6649
+ ], TaonBaseCrudController.prototype, "patchById", null);
6650
+ __decorate([
6651
+ PUT(),
6652
+ __param(0, Body()),
6653
+ __metadata("design:type", Function),
6654
+ __metadata("design:paramtypes", [Array]),
6655
+ __metadata("design:returntype", Object)
6656
+ ], TaonBaseCrudController.prototype, "bulkUpdate", null);
6657
+ __decorate([
6658
+ DELETE(),
6659
+ __param(0, Query(`id`)),
6660
+ __metadata("design:type", Function),
6661
+ __metadata("design:paramtypes", [Object]),
6662
+ __metadata("design:returntype", Object)
6663
+ ], TaonBaseCrudController.prototype, "deleteById", null);
6664
+ __decorate([
6665
+ DELETE(),
6666
+ __param(0, Query(`ids`)),
6667
+ __metadata("design:type", Function),
6668
+ __metadata("design:paramtypes", [Array]),
6669
+ __metadata("design:returntype", Object)
6670
+ ], TaonBaseCrudController.prototype, "bulkDelete", null);
6671
+ __decorate([
6672
+ DELETE(),
6673
+ __metadata("design:type", Function),
6674
+ __metadata("design:paramtypes", []),
6675
+ __metadata("design:returntype", Object)
6676
+ ], TaonBaseCrudController.prototype, "clearTable", null);
6677
+ __decorate([
6678
+ POST(),
6679
+ __param(0, Body()),
6680
+ __metadata("design:type", Function),
6681
+ __metadata("design:paramtypes", [Object]),
6682
+ __metadata("design:returntype", Object)
6683
+ ], TaonBaseCrudController.prototype, "save", null);
6684
+ __decorate([
6685
+ POST(),
6686
+ __param(0, Body()),
6687
+ __metadata("design:type", Function),
6688
+ __metadata("design:paramtypes", [Object]),
6689
+ __metadata("design:returntype", Object)
6690
+ ], TaonBaseCrudController.prototype, "bulkCreate", null);
6691
+ TaonBaseCrudController = __decorate([
6692
+ TaonController({ className: 'TaonBaseCrudController' })
6693
+ ], TaonBaseCrudController);
6694
+
6695
+ /**
6696
+ * Repository decorator
6697
+ */
6698
+ function TaonRepository(options) {
6699
+ return function (constructor) {
6700
+ Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
6701
+ Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
6702
+ ClassHelpers.setName(constructor, options?.className);
6703
+ };
6704
+ }
6705
+ class TaonRepositoryOptions extends DecoratorAbstractOpt {
6706
+ }
6707
+
6708
+ //#endregion
6709
+ let TaonBaseCustomRepository = class TaonBaseCustomRepository extends TaonBaseInjector {
6710
+ };
6711
+ TaonBaseCustomRepository = __decorate([
6712
+ TaonRepository({ className: 'TaonBaseCustomRepository' })
6713
+ ], TaonBaseCustomRepository);
6714
+
6715
+ //#endregion
6716
+ const INDEX_KEYS_NO_FOR_UPDATE = ['id'];
6717
+ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomRepository {
6718
+ constructor(
6719
+ // Injected through TaonBaseCrudController
6720
+ __entityClassResolveFn) {
6721
+ super();
6722
+ this.REPOS_CACHE_KEY = Symbol('repository cache inside instance');
6723
+ this.allowedTypesToUpdate = ['simple-json', 'simple-array', 'json'];
6724
+ // @ts-ignore
6725
+ this.entityClassResolveFn = __entityClassResolveFn;
6726
+ }
6727
+ get dbQuery() {
6393
6728
  /* */
6394
6729
  /* */
6395
6730
  /* */
@@ -6409,6 +6744,18 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6409
6744
  /* */
6410
6745
  /* */
6411
6746
  /* */
6747
+ return (void 0);
6748
+ }
6749
+ //#endregion
6750
+ //#region connection
6751
+ get connection() {
6752
+ /* */
6753
+ /* */
6754
+ return (void 0);
6755
+ }
6756
+ //#endregion
6757
+ //#region repository
6758
+ get repository() {
6412
6759
  /* */
6413
6760
  /* */
6414
6761
  /* */
@@ -6429,9 +6776,6 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6429
6776
  /* */
6430
6777
  /* */
6431
6778
  /* */
6432
- return (void 0);
6433
- }
6434
- async bulkUpdate(items) {
6435
6779
  /* */
6436
6780
  /* */
6437
6781
  /* */
@@ -6443,244 +6787,280 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6443
6787
  /* */
6444
6788
  return (void 0);
6445
6789
  }
6446
- //#region tpeorm update version
6447
- // this version suck and will not return update entity
6448
- // /**
6449
- // * Updates entity partially. Entity can be found by a given conditions.
6450
- // * Unlike save method executes a primitive operation without cascades, relations and other operations included.
6451
- // * Executes fast and efficient UPDATE query.
6452
- // * Does not check if entity exist in the database.
6453
- // */
6454
- // update(
6455
- // criteria:
6456
- // | string
6457
- // | string[]
6458
- // | number
6459
- // | number[]
6460
- // | Date
6461
- // | Date[]
6462
- // | ObjectID
6463
- // | ObjectID[]
6464
- // | FindOptionsWhere<Entity>,
6465
- // partialEntity: QueryDeepPartialEntity<Entity>,
6466
- // ): Promise<UpdateResult> {
6467
- // return this.repo.update(criteria, partialEntity);
6468
- // }
6469
- //#endregion
6470
- //#endregion
6471
- //#region crud operations / typeorm / upsert
6472
6790
  /**
6473
- * Inserts a given entity into the database, unless a unique constraint conflicts then updates the entity
6474
- * Unlike save method executes a primitive operation without cascades, relations and other operations included.
6475
- * Executes fast and efficient INSERT ... ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE query.
6791
+ * target for repository
6476
6792
  */
6477
- upsert(entityOrEntities, conflictPathsOrOptions) {
6478
- return this.repo.upsert(entityOrEntities, conflictPathsOrOptions);
6793
+ get target() {
6794
+ /* */
6795
+ /* */
6796
+ return (void 0);
6479
6797
  }
6480
- //#endregion
6481
- //#region crud operations / typeorm / soft delete
6482
6798
  /**
6483
- * Records the delete date of entities by a given criteria.
6484
- * Unlike save method executes a primitive operation without cascades, relations and other operations included.
6485
- * Executes fast and efficient SOFT-DELETE query.
6486
- * Does not check if entity exist in the database.
6799
+ * alias to repository
6487
6800
  */
6488
- softDelete(criteria) {
6489
- return this.repo.softDelete(criteria);
6801
+ get repo() {
6802
+ /* */
6803
+ /* */
6804
+ return (void 0);
6805
+ }
6806
+ get repositoryExists() {
6807
+ /* */
6808
+ /* */
6809
+ return (void 0);
6490
6810
  }
6491
6811
  //#endregion
6492
- //#region crud operations / typeorm / restore
6812
+ //#region crud operations / typeorm / has id
6493
6813
  /**
6494
- * Restores entities by a given criteria.
6495
- * Unlike save method executes a primitive operation without cascades, relations and other operations included.
6496
- * Executes fast and efficient SOFT-DELETE query.
6497
- * Does not check if entity exist in the database.
6814
+ * Checks if entity has an id.
6815
+ * If entity composite compose ids, it will check them all.
6498
6816
  */
6499
- restore(criteria) {
6500
- return this.repo.restore(criteria);
6817
+ hasId(entity) {
6818
+ return this.repo.hasId(entity);
6501
6819
  }
6502
6820
  //#endregion
6503
- //#region crud operations / typeorm / count
6821
+ //#region crud operations / typeorm / get id
6504
6822
  /**
6505
- * Counts entities that match given options.
6506
- * Useful for pagination.
6823
+ * Gets entity mixed id.
6507
6824
  */
6508
- count(options) {
6509
- return this.repo.count(options);
6825
+ getId(entity) {
6826
+ return this.repo.getId(entity);
6510
6827
  }
6511
6828
  //#endregion
6512
- //#region crud operations / typeorm / count by
6829
+ //#region crud operations / typeorm / create & bulk create
6513
6830
  /**
6514
- * Counts entities that match given conditions.
6515
- * Useful for pagination.
6831
+ Saves a given entity in the database.
6832
+ * If entity does not exist in the database then inserts, otherwise updates.
6516
6833
  */
6517
- countBy(where) {
6518
- return this.repo.countBy(where);
6834
+ async save(item, options) {
6835
+ /* */
6836
+ /* */
6837
+ /* */
6838
+ /* */
6839
+ /* */
6840
+ /* */
6841
+ /* */
6842
+ /* */
6843
+ /* */
6844
+ /* */
6845
+ /* */
6846
+ /* */
6847
+ /* */
6848
+ /* */
6849
+ return (void 0);
6519
6850
  }
6520
- //#endregion
6521
- //#region crud operations / typeorm / find
6522
6851
  /**
6523
- * Finds entities that match given find options.
6852
+ * Creates a new entity instance or instances.
6853
+ * Can copy properties from the given object into new entities.
6524
6854
  */
6525
- find(options) {
6526
- return this.repo.find(options);
6855
+ create(plainEntityLikeOrPlainEntityLikes) {
6856
+ return this.repo.create(plainEntityLikeOrPlainEntityLikes);
6857
+ }
6858
+ async bulkSave(items, options) {
6859
+ /* */
6860
+ /* */
6861
+ /* */
6862
+ /* */
6863
+ /* */
6864
+ /* */
6865
+ /* */
6866
+ /* */
6867
+ /* */
6868
+ return (void 0);
6527
6869
  }
6528
- //#endregion
6529
- //#region crud operations / typeorm / find by
6530
6870
  /**
6531
- * Finds entities that match given find options.
6871
+ * @deprecated use bulkSave instead
6532
6872
  */
6533
- findBy(where) {
6534
- return this.repo.findBy(where);
6873
+ async bulkCreate(items, options) {
6874
+ return this.bulkSave(items, options);
6535
6875
  }
6536
- //#endregion
6537
- //#region crud operations / typeorm / find and count
6538
- // async findAndCount(options: { take: number; skip: number }) {
6539
- // const { take, skip } = options;
6540
- // const [result, total] = await this.repo.findAndCount({
6541
- // // where: { name: Like('%' + keyword + '%') },
6542
- // // order: { name: "DESC" },
6543
- // take: take,
6544
- // skip: skip,
6545
- // });
6546
- // return { result, total };
6547
- // }
6548
- //
6876
+ //#region old typeorm version
6549
6877
  /**
6550
- * Finds entities that match given find options.
6551
- * Also counts all entities that match given conditions,
6552
- * but ignores pagination settings (from and take options).
6878
+ * Saves all given entities in the database.
6879
+ * If entities do not exist in the database then inserts, otherwise updates.
6553
6880
  */
6554
- findAndCount(options) {
6555
- return this.repo.findAndCount(options);
6556
- }
6881
+ // save<T extends DeepPartial<Entity>>(
6882
+ // entities: T[],
6883
+ // options: SaveOptions & {
6884
+ // reload: false;
6885
+ // },
6886
+ // ): Promise<T[]>;
6887
+ // /**
6888
+ // * Saves all given entities in the database.
6889
+ // * If entities do not exist in the database then inserts, otherwise updates.
6890
+ // */
6891
+ // save<T extends DeepPartial<Entity>>(
6892
+ // entities: T[],
6893
+ // options?: SaveOptions,
6894
+ // ): Promise<(T & Entity)[]>;
6895
+ // /**
6896
+ // * Saves a given entity in the database.
6897
+ // * If entity does not exist in the database then inserts, otherwise updates.
6898
+ // */
6899
+ // save<T extends DeepPartial<Entity>>(
6900
+ // entity: T,
6901
+ // options: SaveOptions & {
6902
+ // reload: false;
6903
+ // },
6904
+ // ): Promise<T>;
6905
+ // /**
6906
+ // * Saves a given entity in the database.
6907
+ // * If entity does not exist in the database then inserts, otherwise updates.
6908
+ // */
6909
+ // save<T extends DeepPartial<Entity>>(
6910
+ // entity: T,
6911
+ // options?: SaveOptions,
6912
+ // ): Promise<T & Entity> {
6913
+ // return this.repo.save(entity, options);
6914
+ // }
6557
6915
  //#endregion
6558
- //#region crud operations / typeorm / find and count by
6916
+ //#endregion
6917
+ //#region crud operations / typeorm / merge
6559
6918
  /**
6560
- * Finds entities that match given WHERE conditions.
6561
- * Also counts all entities that match given conditions,
6562
- * but ignores pagination settings (from and take options).
6919
+ * Merges multiple entities (or entity-like objects) into a given entity.
6563
6920
  */
6564
- findAndCountBy(where) {
6565
- return this.repo.findAndCountBy(where);
6921
+ merge(mergeIntoEntity, ...entityLikes) {
6922
+ return this.repo.merge(mergeIntoEntity, ...entityLikes);
6566
6923
  }
6567
6924
  //#endregion
6568
- //#region crud operations / typeorm / find by ids
6925
+ //#region crud operations / typeorm / preload
6569
6926
  /**
6570
- * Finds entities with ids.
6571
- * Optionally find options or conditions can be applied.
6572
- *
6573
- * @deprecated use `findBy` method instead in conjunction with `In` operator, for example:
6927
+ * Creates a new entity from the given plain javascript object. If entity already exist in the database, then
6928
+ * it loads it (and everything related to it), replaces all values with the new ones from the given object
6929
+ * and returns this new entity. This new entity is actually a loaded from the db entity with all properties
6930
+ * replaced from the new object.
6574
6931
  *
6575
- * .findBy({
6576
- * id: In([1, 2, 3])
6577
- * })
6932
+ * Note that given entity-like object must have an entity id / primary key to find entity by.
6933
+ * Returns undefined if entity with given id was not found.
6578
6934
  */
6579
- findByIds(ids) {
6580
- return this.repo.findByIds(ids);
6935
+ preload(entityLike) {
6936
+ return this.repo.preload(entityLike);
6581
6937
  }
6582
6938
  //#endregion
6583
- //#region crud operations / typeorm / find one
6939
+ //#region crud operations / typeorm / remove (delete) & bulk remove (delete)
6584
6940
  /**
6585
- * Finds first entity by a given find options.
6586
- * If entity was not found in the database - returns null.
6941
+ * Removes a given entities from the database.
6587
6942
  */
6588
- findOne(options) {
6589
- return this.repo.findOne(options);
6943
+ async remove(idOrEntity) {
6944
+ /* */
6945
+ /* */
6946
+ /* */
6947
+ /* */
6948
+ /* */
6949
+ /* */
6950
+ /* */
6951
+ /* */
6952
+ /* */
6953
+ /* */
6954
+ /* */
6955
+ /* */
6956
+ /* */
6957
+ /* */
6958
+ /* */
6959
+ /* */
6960
+ /* */
6961
+ /* */
6962
+ /* */
6963
+ /* */
6964
+ /* */
6965
+ /* */
6966
+ return (void 0);
6590
6967
  }
6591
- //#endregion
6592
- //#region crud operations / typeorm / find one by
6593
6968
  /**
6594
- * Finds first entity that matches given where condition.
6595
- * If entity was not found in the database - returns null.
6969
+ * alias to remove
6596
6970
  */
6597
- findOneBy(where) {
6598
- return this.repo.findOneBy(where);
6971
+ async delete(idOrEntity) {
6972
+ return this.remove(idOrEntity);
6599
6973
  }
6600
- //#endregion
6601
- //#region crud operations / typeorm / find one or fail
6602
- /**
6603
- * Finds first entity that matches given id.
6604
- * If entity was not found in the database - returns null.
6605
- *
6606
- * @deprecated use `findOneBy` method instead in conjunction with `In` operator, for example:
6607
- *
6608
- * .findOneBy({
6609
- * id: 1 // where "id" is your primary column name
6610
- * })
6611
- */
6612
- findOneById(id) {
6613
- return this.repo.findOneById(id);
6614
- }
6615
- //#endregion
6616
- //#region crud operations / typeorm / find one or fail
6617
6974
  /**
6618
- * Finds first entity by a given find options.
6619
- * If entity was not found in the database - rejects with error.
6975
+ * alias to removeById
6620
6976
  */
6621
- findOneOrFail(options) {
6622
- return this.repo.findOneOrFail(options);
6977
+ async deleteById(id) {
6978
+ return this.remove(id);
6623
6979
  }
6624
- //#endregion
6625
- //#region crud operations / typeorm / find one by or fail
6626
- /**
6627
- * Finds first entity that matches given where condition.
6628
- * If entity was not found in the database - rejects with error.
6629
- */
6630
- findOneByOrFail(where) {
6631
- return this.repo.findOneByOrFail(where);
6980
+ async bulkRemove(idsOrEntities) {
6981
+ /* */
6982
+ /* */
6983
+ /* */
6984
+ /* */
6985
+ /* */
6986
+ /* */
6987
+ /* */
6988
+ /* */
6989
+ /* */
6990
+ /* */
6991
+ /* */
6992
+ /* */
6993
+ return (void 0);
6632
6994
  }
6633
- //#endregion
6634
- //#region crud operations / typeorm / query
6635
- /**
6636
- * Executes a raw SQL query and returns a raw database results.
6637
- * Raw query execution is supported only by relational databases (MongoDB is not supported).
6638
- */
6639
- query(query, parameters) {
6640
- return this.repo.query(query, parameters);
6995
+ async bulkDelete(ids) {
6996
+ return this.bulkRemove(ids);
6641
6997
  }
6642
- //#endregion
6643
- //#region crud operations / typeorm / query
6644
6998
  /**
6645
- * Executes a raw SQL query and returns a raw database results.
6646
- * Raw query execution is supported only by relational databases (MongoDB is not supported).
6999
+ * Records the delete date of a given entity.
6647
7000
  */
6648
- createQueryBuilder(alias, queryRunner) {
6649
- return this.repo.createQueryBuilder(alias, queryRunner);
7001
+ softRemove(entity, options) {
7002
+ return this.repo.softRemove(entity, options);
6650
7003
  }
6651
- //#endregion
6652
- //#region crud operations / typeorm / clear
6653
7004
  /**
6654
- * Clears all the data from the given table/collection (truncates/drops it).
6655
- *
6656
- * Note: this method uses TRUNCATE and may not work as you expect in transactions on some platforms.
6657
- * @see https://stackoverflow.com/a/5972738/925151
7005
+ * Recovers a given entity in the database.
6658
7006
  */
6659
- clear() {
6660
- return this.repo.clear();
7007
+ recover(entity, options) {
7008
+ return this.repo.recover(entity, options);
6661
7009
  }
6662
7010
  //#endregion
6663
- //#region crud operations / typeorm / increment
7011
+ //#region crud operations / typeorm / insert
6664
7012
  /**
6665
- * Increments some column by provided value of the entities matched given conditions.
7013
+ * Inserts a given entity into the database.
7014
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
7015
+ * Executes fast and efficient INSERT query.
7016
+ * Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted.
6666
7017
  */
6667
- increment(conditions, propertyPath, value) {
6668
- return this.repo.increment(conditions, propertyPath, value);
7018
+ insert(entity) {
7019
+ // debugger;
7020
+ return this.repo.insert(entity);
6669
7021
  }
6670
7022
  //#endregion
6671
- //#region crud operations / typeorm / decrement
6672
- /**
6673
- * Decrements some column by provided value of the entities matched given conditions.
6674
- */
6675
- decrement(conditions, propertyPath, value) {
6676
- return this.repo.decrement(conditions, propertyPath, value);
7023
+ //#region crud operations / typeorm / update & build update
7024
+ async update(item) {
7025
+ /* */
7026
+ /* */
7027
+ /* */
7028
+ return (void 0);
6677
7029
  }
6678
- //#endregion
6679
- //#region crud operations / get all
6680
- /**
6681
- * @deprecated use findAndCount instead
6682
- */
6683
- async getAll() {
7030
+ async updateById(id, item) {
7031
+ /* */
7032
+ /* */
7033
+ /* */
7034
+ /* */
7035
+ /* */
7036
+ /* */
7037
+ /* */
7038
+ /* */
7039
+ /* */
7040
+ /* */
7041
+ /* */
7042
+ /* */
7043
+ /* */
7044
+ /* */
7045
+ /* */
7046
+ /* */
7047
+ /* */
7048
+ /* */
7049
+ /* */
7050
+ /* */
7051
+ /* */
7052
+ /* */
7053
+ /* */
7054
+ /* */
7055
+ /* */
7056
+ /* */
7057
+ /* */
7058
+ /* */
7059
+ /* */
7060
+ /* */
7061
+ /* */
7062
+ /* */
7063
+ /* */
6684
7064
  /* */
6685
7065
  /* */
6686
7066
  /* */
@@ -6694,9 +7074,10 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6694
7074
  /* */
6695
7075
  return (void 0);
6696
7076
  }
6697
- //#endregion
6698
- //#region crud operations / get by id
6699
- async getBy(id) {
7077
+ async bulkUpdate(items) {
7078
+ /* */
7079
+ /* */
7080
+ /* */
6700
7081
  /* */
6701
7082
  /* */
6702
7083
  /* */
@@ -6705,501 +7086,250 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
6705
7086
  /* */
6706
7087
  return (void 0);
6707
7088
  }
6708
- };
6709
- TaonBaseRepository = __decorate([
6710
- TaonRepository({ className: 'TaonBaseRepository' }),
6711
- __metadata("design:paramtypes", [Function])
6712
- ], TaonBaseRepository);
6713
-
6714
- const TaonBaseContext = createContext(() => ({
6715
- contextName: 'TaonBaseContext',
6716
- abstract: true,
6717
- middlewares: {
6718
- TaonBaseFileUploadMiddleware,
6719
- },
6720
- repositories: {
6721
- // @ts-ignore
6722
- TaonBaseRepository,
6723
- },
6724
- }));
6725
-
6726
- var baseContext = /*#__PURE__*/Object.freeze({
6727
- __proto__: null,
6728
- TaonBaseContext: TaonBaseContext
6729
- });
6730
-
6731
- /**
6732
- * Controller decorator
6733
- */
6734
- function TaonController(options) {
6735
- return function (constructor) {
6736
- ClassHelpers.setName(constructor, options?.className);
6737
- Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
6738
- const cfg = ClassHelpers.ensureClassConfig(constructor);
6739
- options = options || {};
6740
- cfg.className = options.className || constructor.name;
6741
- cfg.path = options.path || '';
6742
- cfg.realtime = options.realtime;
6743
- cfg.middlewares = options.middlewares;
6744
- };
6745
- }
6746
-
6747
- const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
6748
- const methodConfig = ClassHelpers.ensureMethodConfig(target, propertyKey);
6749
- let options;
6750
- if (typeof pathOrOptions === 'object') {
6751
- options = pathOrOptions;
6752
- pathOrOptions = options.path;
6753
- pathIsGlobal = !!options.pathIsGlobal;
6754
- path = options.path;
7089
+ //#region tpeorm update version
7090
+ // this version suck and will not return update entity
7091
+ // /**
7092
+ // * Updates entity partially. Entity can be found by a given conditions.
7093
+ // * Unlike save method executes a primitive operation without cascades, relations and other operations included.
7094
+ // * Executes fast and efficient UPDATE query.
7095
+ // * Does not check if entity exist in the database.
7096
+ // */
7097
+ // update(
7098
+ // criteria:
7099
+ // | string
7100
+ // | string[]
7101
+ // | number
7102
+ // | number[]
7103
+ // | Date
7104
+ // | Date[]
7105
+ // | ObjectID
7106
+ // | ObjectID[]
7107
+ // | FindOptionsWhere<Entity>,
7108
+ // partialEntity: QueryDeepPartialEntity<Entity>,
7109
+ // ): Promise<UpdateResult> {
7110
+ // return this.repo.update(criteria, partialEntity);
7111
+ // }
7112
+ //#endregion
7113
+ //#endregion
7114
+ //#region crud operations / typeorm / upsert
7115
+ /**
7116
+ * Inserts a given entity into the database, unless a unique constraint conflicts then updates the entity
7117
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
7118
+ * Executes fast and efficient INSERT ... ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE query.
7119
+ */
7120
+ upsert(entityOrEntities, conflictPathsOrOptions) {
7121
+ return this.repo.upsert(entityOrEntities, conflictPathsOrOptions);
6755
7122
  }
6756
- else {
6757
- options = { pathOrOptions, pathIsGlobal };
7123
+ //#endregion
7124
+ //#region crud operations / typeorm / soft delete
7125
+ /**
7126
+ * Records the delete date of entities by a given criteria.
7127
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
7128
+ * Executes fast and efficient SOFT-DELETE query.
7129
+ * Does not check if entity exist in the database.
7130
+ */
7131
+ softDelete(criteria) {
7132
+ return this.repo.softDelete(criteria);
6758
7133
  }
6759
- const { overrideContentType, overrideResponseType, overrideExpressSendAsHtml, middlewares, } = options;
6760
- methodConfig.methodName = propertyKey;
6761
- methodConfig.middlewares = middlewares;
6762
- methodConfig.type = method;
6763
- if (!path) {
6764
- let paramsPathConcatedPath = '';
6765
- for (const key in methodConfig.parameters) {
6766
- if (methodConfig.parameters.hasOwnProperty(key)) {
6767
- const element = methodConfig.parameters[key];
6768
- if (element.paramType === 'Path' &&
6769
- _.isString(element.paramName) &&
6770
- element.paramName.trim().length > 0) {
6771
- paramsPathConcatedPath += `/${element.paramName}/:${element.paramName}`;
6772
- }
6773
- }
6774
- }
6775
- methodConfig.path = `/${propertyKey}${paramsPathConcatedPath}`;
7134
+ //#endregion
7135
+ //#region crud operations / typeorm / restore
7136
+ /**
7137
+ * Restores entities by a given criteria.
7138
+ * Unlike save method executes a primitive operation without cascades, relations and other operations included.
7139
+ * Executes fast and efficient SOFT-DELETE query.
7140
+ * Does not check if entity exist in the database.
7141
+ */
7142
+ restore(criteria) {
7143
+ return this.repo.restore(criteria);
6776
7144
  }
6777
- else {
6778
- methodConfig.path = path;
7145
+ //#endregion
7146
+ //#region crud operations / typeorm / count
7147
+ /**
7148
+ * Counts entities that match given options.
7149
+ * Useful for pagination.
7150
+ */
7151
+ count(options) {
7152
+ return this.repo.count(options);
6779
7153
  }
6780
- methodConfig.descriptor = descriptor;
6781
- methodConfig.global = pathIsGlobal;
6782
- methodConfig.contentType = overrideContentType;
6783
- methodConfig.responseType = overrideResponseType;
6784
- methodConfig.overrideExpressSendAsHtml = overrideExpressSendAsHtml;
6785
- };
6786
- function GET(pathOrOptions, pathIsGlobal = false) {
6787
- return function (target, propertyKey, descriptor) {
6788
- metaReq('get', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
6789
- };
6790
- }
6791
- /**
6792
- * Method for sending html website from text
6793
- * Example
6794
- *
6795
- * ```ts
6796
- * ...
6797
- * // in your taon controller
6798
- * ..Taon.Http.HTML()
6799
- * sendHtmlDummyWebsite(): Taon.ResponseHtml {
6800
- * return `
6801
- <html>
6802
- <head>
6803
- <title>Dummy website</title>
6804
- </head>
6805
- <body>
6806
- <h1>This is dummy website</h1>
6807
- <p>Served as HTML string from Taon controller method</p>
6808
- </body>
6809
- </html>
6810
- * `; *
6811
- * }
6812
- * ...
6813
- * ```
6814
- */
6815
- function HTML(pathOrOptions) {
6816
- return function (target, propertyKey, descriptor) {
6817
- const opt = pathOrOptions;
6818
- opt.overrideExpressSendAsHtml = true;
6819
- metaReq('get', opt, target, propertyKey, descriptor, pathOrOptions, opt.pathIsGlobal);
6820
- };
6821
- }
6822
- function HEAD(pathOrOptions, pathIsGlobal = false) {
6823
- return function (target, propertyKey, descriptor) {
6824
- metaReq('head', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
6825
- };
6826
- }
6827
- function POST(pathOrOptions, pathIsGlobal = false) {
6828
- return function (target, propertyKey, descriptor) {
6829
- metaReq('post', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
6830
- };
6831
- }
6832
- function PUT(pathOrOptions, pathIsGlobal = false) {
6833
- return function (target, propertyKey, descriptor) {
6834
- metaReq('put', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
6835
- };
6836
- }
6837
- function PATCH(pathOrOptions, pathIsGlobal = false) {
6838
- return function (target, propertyKey, descriptor) {
6839
- metaReq('patch', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
6840
- };
6841
- }
6842
- function DELETE(pathOrOptions, pathIsGlobal = false) {
6843
- return function (target, propertyKey, descriptor) {
6844
- metaReq('delete', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
6845
- };
6846
- }
6847
-
6848
- function metaParam(param, name, expire, defaultValue = undefined, target, propertyKey, parameterIndex) {
6849
- const methodCfg = ClassHelpers.ensureMethodConfig(target, propertyKey);
6850
- const nameKey = name ? name : param;
6851
- // const key = name || `${param}_${parameterIndex}`;
6852
- methodCfg.parameters[nameKey] = {
6853
- index: parameterIndex,
6854
- paramName: name,
6855
- paramType: param,
6856
- defaultType: defaultValue,
6857
- expireInSeconds: expire,
6858
- };
6859
- // console.log('params updated', methodConfig);
6860
- }
6861
- /**
6862
- * @deprecated use Taon.Http.Param.Path (is more safe and cleaner)
6863
- */
6864
- function Path(name) {
6865
- return function (target, propertyKey, parameterIndex) {
6866
- metaParam('Path', name, undefined, {}, target, propertyKey, parameterIndex);
6867
- };
6868
- }
6869
- function Query(name) {
6870
- return function (target, propertyKey, parameterIndex) {
6871
- metaParam('Query', name, undefined, {}, target, propertyKey, parameterIndex);
6872
- };
6873
- }
6874
- function Cookie(name, expireInSecond = 3600) {
6875
- return function (target, propertyKey, parameterIndex) {
6876
- metaParam('Cookie', name, expireInSecond, {}, target, propertyKey, parameterIndex);
6877
- };
6878
- }
6879
- function Header(name) {
6880
- return function (target, propertyKey, parameterIndex) {
6881
- metaParam('Header', name, undefined, {}, target, propertyKey, parameterIndex);
6882
- };
6883
- }
6884
- function Body(name) {
6885
- return function (target, propertyKey, parameterIndex) {
6886
- metaParam('Body', name, undefined, {}, target, propertyKey, parameterIndex);
6887
- };
6888
- }
6889
-
6890
- let TaonBaseController = class TaonBaseController extends TaonBaseInjector {
7154
+ //#endregion
7155
+ //#region crud operations / typeorm / count by
6891
7156
  /**
6892
- * Hook that is called when taon app is inited
6893
- * (all contexts are created and inited)
7157
+ * Counts entities that match given conditions.
7158
+ * Useful for pagination.
6894
7159
  */
6895
- async afterAllCtxInited(options) { }
6896
- //#region upload form data to server
6897
- uploadFormDataToServer(formData, queryParams) {
6898
- /* */
6899
- /* */
6900
- /* */
6901
- /* */
6902
- /* */
6903
- /* */
6904
- /* */
6905
- /* */
6906
- /* */
6907
- /* */
6908
- /* */
6909
- /* */
6910
- /* */
6911
- /* */
6912
- /* */
6913
- /* */
6914
- /* */
6915
- /* */
6916
- /* */
6917
- /* */
6918
- /* */
6919
- /* */
6920
- /* */
6921
- /* */
6922
- /* */
6923
- /* */
6924
- return (void 0);
7160
+ countBy(where) {
7161
+ return this.repo.countBy(where);
6925
7162
  }
6926
7163
  //#endregion
6927
- //#region after file upload hook
7164
+ //#region crud operations / typeorm / find
6928
7165
  /**
6929
- * Hook after file is uploaded
6930
- * through `uploadFormDataToServer` or `uploadLocalFileToServer`
7166
+ * Finds entities that match given find options.
6931
7167
  */
6932
- afterFileUploadAction(file, queryParams) {
6933
- // empty
7168
+ find(options) {
7169
+ return this.repo.find(options);
6934
7170
  }
6935
- //#region upload local file to server
6936
- async uploadLocalFileToServer(absFilePath, options, queryParams) {
6937
- /* */
6938
- /* */
6939
- /* */
6940
- /* */
6941
- /* */
6942
- /* */
6943
- /* */
6944
- /* */
6945
- /* */
6946
- /* */
6947
- /* */
6948
- /* */
6949
- /* */
6950
- /* */
6951
- return (void 0);
7171
+ //#endregion
7172
+ //#region crud operations / typeorm / find by
7173
+ /**
7174
+ * Finds entities that match given find options.
7175
+ */
7176
+ findBy(where) {
7177
+ return this.repo.findBy(where);
6952
7178
  }
6953
7179
  //#endregion
6954
- // async check() {
6955
- // await this._waitForProperStatusChange({
6956
- // request: () => this.uploadFormDataToServer(void 0, void 0).request(),
6957
- // statusCheck: resp => resp.body.json[0].ok,
6958
- // });
7180
+ //#region crud operations / typeorm / find and count
7181
+ // async findAndCount(options: { take: number; skip: number }) {
7182
+ // const { take, skip } = options;
7183
+ // const [result, total] = await this.repo.findAndCount({
7184
+ // // where: { name: Like('%' + keyword + '%') },
7185
+ // // order: { name: "DESC" },
7186
+ // take: take,
7187
+ // skip: skip,
7188
+ // });
7189
+ // return { result, total };
6959
7190
  // }
7191
+ //
6960
7192
  /**
6961
- * Easy way to wait for status change with http (1s default) pooling.
6962
- *
6963
- * example (in sub class):
6964
- * ```ts
6965
- async check() {
6966
- await this.waitForProperStatusChange({
6967
- request: () => this.uploadFormDataToServer(void 0, void 0).request(),
6968
- statusCheck: resp => resp.body.json[0].ok,
6969
- });
6970
- }
6971
- * ```
7193
+ * Finds entities that match given find options.
7194
+ * Also counts all entities that match given conditions,
7195
+ * but ignores pagination settings (from and take options).
6972
7196
  */
6973
- async _waitForProperStatusChange(options) {
6974
- const poolingInterval = options.poolingInterval || 1000;
6975
- const taonRequest = options.request;
6976
- let maxTries = options.maxTries || Number.POSITIVE_INFINITY;
6977
- let i = 0;
6978
- let httpErrorsCount = 0;
6979
- while (true) {
6980
- await UtilsTerminal.waitMilliseconds(poolingInterval);
6981
- try {
6982
- const resp = await taonRequest({
6983
- reqIndexNum: i,
6984
- httpErrorsCount,
6985
- });
6986
- if (options.statusCheck && options.statusCheck(resp)) {
6987
- return;
6988
- }
6989
- }
6990
- catch (error) {
6991
- httpErrorsCount++;
6992
- if (options.loopRequestsOnBackendError) {
6993
- const isProperTaonError = error instanceof HttpResponseError &&
6994
- error.body.json[CoreModels.TaonHttpErrorCustomProp];
6995
- const isHttpError = error instanceof HttpResponseError && !isProperTaonError;
6996
- const isUnknownError = !(error instanceof HttpResponseError);
6997
- const resBool = await options.loopRequestsOnBackendError({
6998
- taonError: isProperTaonError ? error : void 0,
6999
- unknownHttpError: isHttpError ? error : void 0,
7000
- unknownError: isUnknownError ? error : void 0,
7001
- reqIndexNum: i,
7002
- httpErrorsCount,
7003
- });
7004
- if (resBool) {
7005
- i++;
7006
- continue;
7007
- }
7008
- else {
7009
- return;
7010
- }
7011
- }
7012
- if (httpErrorsCount >
7013
- (options.allowedHttpErrors || Number.POSITIVE_INFINITY)) {
7014
- throw new Error(`Too many http errors (${httpErrorsCount}) for "${options.actionName}".`);
7015
- }
7016
- }
7017
- if (i++ > maxTries) {
7018
- throw new Error(`Timeout waiting for "${options.actionName}" to be finished. Waited for ${maxTries} seconds`);
7019
- }
7020
- }
7197
+ findAndCount(options) {
7198
+ return this.repo.findAndCount(options);
7199
+ }
7200
+ //#endregion
7201
+ //#region crud operations / typeorm / find and count by
7202
+ /**
7203
+ * Finds entities that match given WHERE conditions.
7204
+ * Also counts all entities that match given conditions,
7205
+ * but ignores pagination settings (from and take options).
7206
+ */
7207
+ findAndCountBy(where) {
7208
+ return this.repo.findAndCountBy(where);
7209
+ }
7210
+ //#endregion
7211
+ //#region crud operations / typeorm / find by ids
7212
+ /**
7213
+ * Finds entities with ids.
7214
+ * Optionally find options or conditions can be applied.
7215
+ *
7216
+ * @deprecated use `findBy` method instead in conjunction with `In` operator, for example:
7217
+ *
7218
+ * .findBy({
7219
+ * id: In([1, 2, 3])
7220
+ * })
7221
+ */
7222
+ findByIds(ids) {
7223
+ return this.repo.findByIds(ids);
7021
7224
  }
7022
- };
7023
- __decorate([
7024
- POST({
7025
- overrideContentType: 'multipart/form-data',
7026
- middlewares: ({ parentMiddlewares }) => ({
7027
- ...parentMiddlewares,
7028
- TaonBaseFileUploadMiddleware,
7029
- }),
7030
- }),
7031
- __param(0, Body()),
7032
- __param(1, Query()),
7033
- __metadata("design:type", Function),
7034
- __metadata("design:paramtypes", [FormData, Object]),
7035
- __metadata("design:returntype", Object)
7036
- ], TaonBaseController.prototype, "uploadFormDataToServer", null);
7037
- TaonBaseController = __decorate([
7038
- TaonController({
7039
- className: 'TaonBaseController',
7040
- })
7041
- ], TaonBaseController);
7042
-
7043
- //#endregion
7044
- /**
7045
- * Please override property entityClassFn with entity class.
7046
- */
7047
- let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseController {
7048
7225
  //#endregion
7049
- //#region init
7050
- async _() {
7051
- if (!_.isFunction(this.entityClassResolveFn)) {
7052
- Helpers.warn(`Skipping initing CRUD controller ${ClassHelpers.getName(this)} because entityClassResolveFn is not provided.`);
7053
- return;
7054
- }
7055
- let entityClassFn = this.entityClassResolveFn();
7056
- this.db = this.injectRepo(entityClassFn);
7057
- if (entityClassFn) {
7058
- const configEntity = Reflect.getMetadata(Symbols.metadata.options.entity, ClassHelpers.getClassFnFromObject(this));
7059
- if (configEntity?.createTable === false) {
7060
- Helpers.warn(`Table for entity ${ClassHelpers.getName(entityClassFn)} will not be created. Crud will not work properly.`);
7061
- }
7062
- }
7063
- else {
7064
- Helpers.error(`Entity class not provided for controller ${ClassHelpers.getName(this)}.
7065
-
7066
- Please provide entity as class property entityClassFn:
7067
-
7068
- class ${ClassHelpers.getName(this)} extends TaonBaseCrudController<Entity> {
7069
- // ...
7070
- entityClassResolveFn = ()=> MyEntityClass;
7071
- // ...
7072
- }
7073
-
7074
- `);
7075
- }
7076
- await super._();
7226
+ //#region crud operations / typeorm / find one
7227
+ /**
7228
+ * Finds first entity by a given find options.
7229
+ * If entity was not found in the database - returns null.
7230
+ */
7231
+ findOne(options) {
7232
+ return this.repo.findOne(options);
7077
7233
  }
7078
7234
  //#endregion
7079
- //#region bufferd changes
7080
- bufforedChanges(id, property, alreadyLength) {
7081
- /* */
7082
- /* */
7083
- /* */
7084
- /* */
7085
- /* */
7086
- /* */
7087
- /* */
7088
- /* */
7089
- /* */
7090
- /* */
7091
- /* */
7092
- /* */
7093
- /* */
7094
- /* */
7095
- /* */
7096
- return (void 0);
7235
+ //#region crud operations / typeorm / find one by
7236
+ /**
7237
+ * Finds first entity that matches given where condition.
7238
+ * If entity was not found in the database - returns null.
7239
+ */
7240
+ findOneBy(where) {
7241
+ return this.repo.findOneBy(where);
7097
7242
  }
7098
7243
  //#endregion
7099
- //#region pagintation
7100
- pagination(pageNumber = 1, pageSize = 10, search = '') {
7101
- /* */
7102
- /* */
7103
- /* */
7104
- /* */
7105
- /* */
7106
- /* */
7107
- /* */
7108
- /* */
7109
- /* */
7110
- /* */
7111
- /* */
7112
- /* */
7113
- /* */
7114
- /* */
7115
- /* */
7116
- /* */
7117
- /* */
7118
- /* */
7119
- /* */
7120
- /* */
7121
- /* */
7122
- /* */
7123
- /* */
7124
- /* */
7125
- /* */
7126
- /* */
7127
- /* */
7128
- /* */
7129
- /* */
7130
- /* */
7131
- /* */
7132
- /* */
7133
- /* */
7134
- /* */
7135
- /* */
7136
- /* */
7137
- /* */
7138
- /* */
7139
- return (void 0);
7244
+ //#region crud operations / typeorm / find one or fail
7245
+ /**
7246
+ * Finds first entity that matches given id.
7247
+ * If entity was not found in the database - returns null.
7248
+ *
7249
+ * @deprecated use `findOneBy` method instead in conjunction with `In` operator, for example:
7250
+ *
7251
+ * .findOneBy({
7252
+ * id: 1 // where "id" is your primary column name
7253
+ * })
7254
+ */
7255
+ findOneById(id) {
7256
+ return this.repo.findOneById(id);
7140
7257
  }
7141
7258
  //#endregion
7142
- //#region get all
7143
- getAll() {
7144
- /* */
7145
- /* */
7146
- /* */
7147
- /* */
7148
- /* */
7149
- /* */
7150
- /* */
7151
- /* */
7152
- /* */
7153
- return (void 0);
7259
+ //#region crud operations / typeorm / find one or fail
7260
+ /**
7261
+ * Finds first entity by a given find options.
7262
+ * If entity was not found in the database - rejects with error.
7263
+ */
7264
+ findOneOrFail(options) {
7265
+ return this.repo.findOneOrFail(options);
7154
7266
  }
7155
7267
  //#endregion
7156
- //#region get by id
7157
- getBy(id) {
7158
- /* */
7159
- /* */
7160
- /* */
7161
- /* */
7162
- /* */
7163
- return (void 0);
7268
+ //#region crud operations / typeorm / find one by or fail
7269
+ /**
7270
+ * Finds first entity that matches given where condition.
7271
+ * If entity was not found in the database - rejects with error.
7272
+ */
7273
+ findOneByOrFail(where) {
7274
+ return this.repo.findOneByOrFail(where);
7164
7275
  }
7165
7276
  //#endregion
7166
- //#region update by id
7167
- updateById(id, item) {
7168
- /* */
7169
- /* */
7170
- /* */
7171
- /* */
7172
- /* */
7173
- /* */
7174
- return (void 0);
7277
+ //#region crud operations / typeorm / query
7278
+ /**
7279
+ * Executes a raw SQL query and returns a raw database results.
7280
+ * Raw query execution is supported only by relational databases (MongoDB is not supported).
7281
+ */
7282
+ query(query, parameters) {
7283
+ return this.repo.query(query, parameters);
7175
7284
  }
7176
7285
  //#endregion
7177
- //#region patch by id
7178
- patchById(id, item) {
7179
- /* */
7180
- /* */
7181
- /* */
7182
- /* */
7183
- /* */
7184
- /* */
7185
- return (void 0);
7286
+ //#region crud operations / typeorm / query
7287
+ /**
7288
+ * Executes a raw SQL query and returns a raw database results.
7289
+ * Raw query execution is supported only by relational databases (MongoDB is not supported).
7290
+ */
7291
+ createQueryBuilder(alias, queryRunner) {
7292
+ return this.repo.createQueryBuilder(alias, queryRunner);
7186
7293
  }
7187
7294
  //#endregion
7188
- //#region bulk update
7189
- bulkUpdate(items) {
7190
- /* */
7191
- /* */
7295
+ //#region crud operations / typeorm / clear
7296
+ /**
7297
+ * Clears all the data from the given table/collection (truncates/drops it).
7298
+ *
7299
+ * Note: this method uses TRUNCATE and may not work as you expect in transactions on some platforms.
7300
+ * @see https://stackoverflow.com/a/5972738/925151
7301
+ */
7302
+ clear() {
7303
+ return this.repo.clear();
7304
+ }
7305
+ //#endregion
7306
+ //#region crud operations / typeorm / increment
7307
+ /**
7308
+ * Increments some column by provided value of the entities matched given conditions.
7309
+ */
7310
+ increment(conditions, propertyPath, value) {
7311
+ return this.repo.increment(conditions, propertyPath, value);
7312
+ }
7313
+ //#endregion
7314
+ //#region crud operations / typeorm / decrement
7315
+ /**
7316
+ * Decrements some column by provided value of the entities matched given conditions.
7317
+ */
7318
+ decrement(conditions, propertyPath, value) {
7319
+ return this.repo.decrement(conditions, propertyPath, value);
7320
+ }
7321
+ //#endregion
7322
+ //#region crud operations / get all
7323
+ /**
7324
+ * @deprecated use findAndCount instead
7325
+ */
7326
+ async getAll() {
7192
7327
  /* */
7193
7328
  /* */
7194
7329
  /* */
7195
7330
  /* */
7196
7331
  /* */
7197
7332
  /* */
7198
- return (void 0);
7199
- }
7200
- //#endregion
7201
- //#region delete by id
7202
- deleteById(id) {
7203
7333
  /* */
7204
7334
  /* */
7205
7335
  /* */
@@ -7208,8 +7338,9 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
7208
7338
  return (void 0);
7209
7339
  }
7210
7340
  //#endregion
7211
- //#region bulk delete
7212
- bulkDelete(ids) {
7341
+ //#region crud operations / get by id
7342
+ async getBy(id) {
7343
+ /* */
7213
7344
  /* */
7214
7345
  /* */
7215
7346
  /* */
@@ -7217,18 +7348,30 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
7217
7348
  /* */
7218
7349
  return (void 0);
7219
7350
  }
7220
- //#endregion
7221
- //#region bulk delete
7222
- clearTable() {
7351
+ };
7352
+ TaonBaseRepository = __decorate([
7353
+ TaonRepository({ className: 'TaonBaseRepository' }),
7354
+ __metadata("design:paramtypes", [Function])
7355
+ ], TaonBaseRepository);
7356
+
7357
+ //#region imports
7358
+ //#endregion
7359
+ let TaonGlobalStateRepository = class TaonGlobalStateRepository extends TaonBaseRepository {
7360
+ constructor() {
7361
+ super(...arguments);
7362
+ this.entityClassResolveFn = () => TAON_GLOBAL_STATE;
7363
+ }
7364
+ async getLastStatus() {
7365
+ /* */
7223
7366
  /* */
7224
7367
  /* */
7225
7368
  /* */
7226
7369
  /* */
7227
7370
  return (void 0);
7228
7371
  }
7229
- //#endregion
7230
- //#region create
7231
- save(item) {
7372
+ async setDraining(secondsBeforeReadonly = 0) {
7373
+ /* */
7374
+ /* */
7232
7375
  /* */
7233
7376
  /* */
7234
7377
  /* */
@@ -7236,9 +7379,8 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
7236
7379
  /* */
7237
7380
  return (void 0);
7238
7381
  }
7239
- //#endregion
7240
- //#region bulk create
7241
- bulkCreate(items) {
7382
+ async transitionTo(next) {
7383
+ /* */
7242
7384
  /* */
7243
7385
  /* */
7244
7386
  /* */
@@ -7247,115 +7389,52 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
7247
7389
  return (void 0);
7248
7390
  }
7249
7391
  };
7392
+ TaonGlobalStateRepository = __decorate([
7393
+ TaonRepository({
7394
+ className: 'TaonGlobalStateRepository',
7395
+ })
7396
+ ], TaonGlobalStateRepository);
7397
+
7398
+ //#region imports
7399
+ //#endregion
7400
+ let TaonGlobalStateController = class TaonGlobalStateController extends TaonBaseCrudController {
7401
+ constructor() {
7402
+ super(...arguments);
7403
+ this.entityClassResolveFn = () => TAON_GLOBAL_STATE;
7404
+ this.taonGlobalStateRepository = this.injectCustomRepo(TaonGlobalStateRepository);
7405
+ }
7406
+ getStatus() {
7407
+ return async () => {
7408
+ /* */
7409
+ /* */
7410
+ /* */
7411
+ return (void 0);
7412
+ };
7413
+ }
7414
+ setDraining(secondsBeforeReadonly = 0) {
7415
+ return async () => {
7416
+ await this.taonGlobalStateRepository.setDraining(secondsBeforeReadonly);
7417
+ };
7418
+ }
7419
+ };
7250
7420
  __decorate([
7251
7421
  GET(),
7252
- __param(0, Query(`id`)),
7253
- __param(1, Query(`property`)),
7254
- __param(2, Query('alreadyLength')),
7255
- __metadata("design:type", Function),
7256
- __metadata("design:paramtypes", [Object, String, Number]),
7257
- __metadata("design:returntype", Object)
7258
- ], TaonBaseCrudController.prototype, "bufforedChanges", null);
7259
- __decorate([
7260
- GET(),
7261
- __param(0, Query('pageNumber')),
7262
- __param(1, Query('pageSize')),
7263
- __param(2, Query('search')),
7264
- __metadata("design:type", Function),
7265
- __metadata("design:paramtypes", [Number, Number, String]),
7266
- __metadata("design:returntype", Object)
7267
- ], TaonBaseCrudController.prototype, "pagination", null);
7268
- __decorate([
7269
- GET(),
7270
- __metadata("design:type", Function),
7271
- __metadata("design:paramtypes", []),
7272
- __metadata("design:returntype", Object)
7273
- ], TaonBaseCrudController.prototype, "getAll", null);
7274
- __decorate([
7275
- GET(),
7276
- __param(0, Query(`id`)),
7277
- __metadata("design:type", Function),
7278
- __metadata("design:paramtypes", [Object]),
7279
- __metadata("design:returntype", Object)
7280
- ], TaonBaseCrudController.prototype, "getBy", null);
7281
- __decorate([
7282
- PUT(),
7283
- __param(0, Query(`id`)),
7284
- __param(1, Body()),
7285
- __metadata("design:type", Function),
7286
- __metadata("design:paramtypes", [Object, Object]),
7287
- __metadata("design:returntype", Object)
7288
- ], TaonBaseCrudController.prototype, "updateById", null);
7289
- __decorate([
7290
- PATCH(),
7291
- __param(0, Query(`id`)),
7292
- __param(1, Body()),
7293
- __metadata("design:type", Function),
7294
- __metadata("design:paramtypes", [Object, Object]),
7295
- __metadata("design:returntype", Object)
7296
- ], TaonBaseCrudController.prototype, "patchById", null);
7297
- __decorate([
7298
- PUT(),
7299
- __param(0, Body()),
7300
- __metadata("design:type", Function),
7301
- __metadata("design:paramtypes", [Array]),
7302
- __metadata("design:returntype", Object)
7303
- ], TaonBaseCrudController.prototype, "bulkUpdate", null);
7304
- __decorate([
7305
- DELETE(),
7306
- __param(0, Query(`id`)),
7307
- __metadata("design:type", Function),
7308
- __metadata("design:paramtypes", [Object]),
7309
- __metadata("design:returntype", Object)
7310
- ], TaonBaseCrudController.prototype, "deleteById", null);
7311
- __decorate([
7312
- DELETE(),
7313
- __param(0, Query(`ids`)),
7314
- __metadata("design:type", Function),
7315
- __metadata("design:paramtypes", [Array]),
7316
- __metadata("design:returntype", Object)
7317
- ], TaonBaseCrudController.prototype, "bulkDelete", null);
7318
- __decorate([
7319
- DELETE(),
7320
7422
  __metadata("design:type", Function),
7321
7423
  __metadata("design:paramtypes", []),
7322
7424
  __metadata("design:returntype", Object)
7323
- ], TaonBaseCrudController.prototype, "clearTable", null);
7324
- __decorate([
7325
- POST(),
7326
- __param(0, Body()),
7327
- __metadata("design:type", Function),
7328
- __metadata("design:paramtypes", [Object]),
7329
- __metadata("design:returntype", Object)
7330
- ], TaonBaseCrudController.prototype, "save", null);
7425
+ ], TaonGlobalStateController.prototype, "getStatus", null);
7331
7426
  __decorate([
7332
7427
  POST(),
7333
- __param(0, Body()),
7428
+ __param(0, Query('secondsBeforeReadonly')),
7334
7429
  __metadata("design:type", Function),
7335
7430
  __metadata("design:paramtypes", [Object]),
7336
7431
  __metadata("design:returntype", Object)
7337
- ], TaonBaseCrudController.prototype, "bulkCreate", null);
7338
- TaonBaseCrudController = __decorate([
7339
- TaonController({ className: 'TaonBaseCrudController' })
7340
- ], TaonBaseCrudController);
7341
-
7342
- class TaonBaseMigration extends TaonBaseInjector {
7343
- /**
7344
- * by default is READY to run
7345
- */
7346
- isReadyToRun() {
7347
- return true;
7348
- }
7349
- getDescription() {
7350
- return _.startCase(ClassHelpers.getName(this));
7351
- }
7352
- async up(queryRunner) {
7353
- console.log(`[TaonBaseMigration] Running migration UP "${ClassHelpers.getName(this)}"`);
7354
- }
7355
- async down(queryRunner) {
7356
- console.log(`[TaonBaseMigration] Running migration DOWN "${ClassHelpers.getName(this)}"`);
7357
- }
7358
- }
7432
+ ], TaonGlobalStateController.prototype, "setDraining", null);
7433
+ TaonGlobalStateController = __decorate([
7434
+ TaonController({
7435
+ className: 'TaonGlobalStateController',
7436
+ })
7437
+ ], TaonGlobalStateController);
7359
7438
 
7360
7439
  /**
7361
7440
  * TODO
@@ -7365,6 +7444,39 @@ class TaonBaseMigration extends TaonBaseInjector {
7365
7444
  class TaonBaseProvider extends TaonBaseInjector {
7366
7445
  }
7367
7446
 
7447
+ /**
7448
+ * Provider decorator
7449
+ */
7450
+ function TaonProvider(options) {
7451
+ return function (constructor) {
7452
+ Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
7453
+ Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
7454
+ ClassHelpers.setName(constructor, options?.className || constructor.name);
7455
+ };
7456
+ }
7457
+ class TaonProviderOptions extends DecoratorAbstractOpt {
7458
+ }
7459
+
7460
+ //#region imports
7461
+ //#endregion
7462
+ let TaonGlobalStateProvider = class TaonGlobalStateProvider extends TaonBaseProvider {
7463
+ };
7464
+ TaonGlobalStateProvider = __decorate([
7465
+ TaonProvider({
7466
+ className: 'TaonGlobalStateProvider',
7467
+ })
7468
+ ], TaonGlobalStateProvider);
7469
+
7470
+ //#region imports
7471
+ //#endregion
7472
+ let TaonGlobalStateMiddleware = class TaonGlobalStateMiddleware extends TaonBaseMiddleware {
7473
+ };
7474
+ TaonGlobalStateMiddleware = __decorate([
7475
+ TaonMiddleware({
7476
+ className: 'TaonGlobalStateMiddleware',
7477
+ })
7478
+ ], TaonGlobalStateMiddleware);
7479
+
7368
7480
  /**
7369
7481
  * Subscriber decorator
7370
7482
  */
@@ -7521,6 +7633,75 @@ TaonBaseSubscriberForEntity = __decorate([
7521
7633
  })
7522
7634
  ], TaonBaseSubscriberForEntity);
7523
7635
 
7636
+ //#region imports
7637
+ //#endregion
7638
+ let TaonGlobalStateSubscriber = class TaonGlobalStateSubscriber extends TaonBaseSubscriberForEntity {
7639
+ constructor() {
7640
+ super(...arguments);
7641
+ this.taonGlobalStateProvider = this.injectProvider(TaonGlobalStateProvider);
7642
+ }
7643
+ listenTo() {
7644
+ return TAON_GLOBAL_STATE;
7645
+ }
7646
+ };
7647
+ TaonGlobalStateSubscriber = __decorate([
7648
+ TaonSubscriber({
7649
+ className: 'TaonGlobalStateSubscriber',
7650
+ // allowedEvents: ['afterUpdate'],
7651
+ })
7652
+ ], TaonGlobalStateSubscriber);
7653
+
7654
+ //#region imports
7655
+ //#endregion
7656
+ const TaonGlobalStateContext = createContext(() => ({
7657
+ contextName: 'TaonGlobalStateContext',
7658
+ abstract: true,
7659
+ entities: { TAON_GLOBAL_STATE },
7660
+ controllers: { TaonGlobalStateController },
7661
+ repositories: { TaonGlobalStateRepository },
7662
+ providers: { TaonGlobalStateProvider },
7663
+ middlewares: { TaonGlobalStateMiddleware },
7664
+ subscribers: { TaonGlobalStateSubscriber },
7665
+ }));
7666
+
7667
+ const TaonBaseContext = createContext(() => ({
7668
+ contextName: 'TaonBaseContext',
7669
+ abstract: true,
7670
+ contexts: {
7671
+ TaonGlobalStateContext,
7672
+ },
7673
+ middlewares: {
7674
+ TaonBaseFileUploadMiddleware,
7675
+ },
7676
+ repositories: {
7677
+ // @ts-ignore
7678
+ TaonBaseRepository,
7679
+ },
7680
+ }));
7681
+
7682
+ var baseContext = /*#__PURE__*/Object.freeze({
7683
+ __proto__: null,
7684
+ TaonBaseContext: TaonBaseContext
7685
+ });
7686
+
7687
+ class TaonBaseMigration extends TaonBaseInjector {
7688
+ /**
7689
+ * by default is READY to run
7690
+ */
7691
+ isReadyToRun() {
7692
+ return true;
7693
+ }
7694
+ getDescription() {
7695
+ return _.startCase(ClassHelpers.getName(this));
7696
+ }
7697
+ async up(queryRunner) {
7698
+ console.log(`[TaonBaseMigration] Running migration UP "${ClassHelpers.getName(this)}"`);
7699
+ }
7700
+ async down(queryRunner) {
7701
+ console.log(`[TaonBaseMigration] Running migration DOWN "${ClassHelpers.getName(this)}"`);
7702
+ }
7703
+ }
7704
+
7524
7705
  //#region models / method config
7525
7706
  /**
7526
7707
  * @link './decorators/http/http-methods-decorators.ts' TaonHttpDecoratorOptions
@@ -7534,8 +7715,8 @@ class ParamConfig {
7534
7715
  }
7535
7716
 
7536
7717
  class FormlyHorizontalWrapper extends FieldWrapper {
7537
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: FormlyHorizontalWrapper, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
7538
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: FormlyHorizontalWrapper, isStandalone: false, selector: "formly-horizontal-wrapper", viewQueries: [{ propertyName: "fieldComponent", first: true, predicate: ["fieldComponent"], descendants: true, read: ViewContainerRef }], usesInheritance: true, ngImport: i0, template: `
7718
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: FormlyHorizontalWrapper, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
7719
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.9", type: FormlyHorizontalWrapper, isStandalone: false, selector: "formly-horizontal-wrapper", viewQueries: [{ propertyName: "fieldComponent", first: true, predicate: ["fieldComponent"], descendants: true, read: ViewContainerRef }], usesInheritance: true, ngImport: i0, template: `
7539
7720
  <div class="form-group row">
7540
7721
  <label
7541
7722
  [attr.for]="id"
@@ -7552,7 +7733,7 @@ class FormlyHorizontalWrapper extends FieldWrapper {
7552
7733
  </div>
7553
7734
  `, isInline: true, styles: [":host{display:block;padding:5px;margin-bottom:5px;border:1px dotted gray}\n"] }); }
7554
7735
  }
7555
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: FormlyHorizontalWrapper, decorators: [{
7736
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: FormlyHorizontalWrapper, decorators: [{
7556
7737
  type: Component,
7557
7738
  args: [{ selector: 'formly-horizontal-wrapper', standalone: false, template: `
7558
7739
  <div class="form-group row">
@@ -7597,8 +7778,8 @@ class RepeatTypeComponent extends FieldArrayType {
7597
7778
  // @ts-ignore
7598
7779
  super(builder);
7599
7780
  }
7600
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RepeatTypeComponent, deps: [{ token: i1.FormlyFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
7601
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: RepeatTypeComponent, isStandalone: false, selector: "formly-repeat-section", usesInheritance: true, ngImport: i0, template: `
7781
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: RepeatTypeComponent, deps: [{ token: i1.FormlyFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
7782
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.9", type: RepeatTypeComponent, isStandalone: false, selector: "formly-repeat-section", usesInheritance: true, ngImport: i0, template: `
7602
7783
  <div *ngIf="field.fieldGroup && field.fieldGroup.length === 0">
7603
7784
  Press button to add new element...
7604
7785
  </div>
@@ -7630,7 +7811,7 @@ class RepeatTypeComponent extends FieldArrayType {
7630
7811
  </div>
7631
7812
  `, isInline: true, styles: [":host{display:block;padding:5px;margin-bottom:5px;border:1px solid gray}formly-group{display:block;border:1px dashed gray;margin-bottom:5px;padding:5px}.taon-formly-array{padding:5px;background:#fff}\n"] }); }
7632
7813
  }
7633
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RepeatTypeComponent, decorators: [{
7814
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: RepeatTypeComponent, decorators: [{
7634
7815
  type: Component,
7635
7816
  args: [{ selector: 'formly-repeat-section', standalone: false, template: `
7636
7817
  <div *ngIf="field.fieldGroup && field.fieldGroup.length === 0">
@@ -7936,7 +8117,16 @@ const String100Column = (defaultValue = null) => Column({
7936
8117
  default: defaultValue,
7937
8118
  });
7938
8119
  /**
7939
- * 100 characters varchar
8120
+ * 20 characters varchar
8121
+ */
8122
+ const String20Column = (defaultValue = null) => Column({
8123
+ type: 'varchar',
8124
+ length: 20,
8125
+ nullable: _.isNil(defaultValue),
8126
+ default: defaultValue,
8127
+ });
8128
+ /**
8129
+ * 45 characters varchar
7940
8130
  */
7941
8131
  const String45Column = (defaultValue = null) => Column({
7942
8132
  type: 'varchar',
@@ -7968,27 +8158,6 @@ const SimpleJsonColumn = () => Column({ type: 'simple-json', nullable: true });
7968
8158
  const BooleanColumn = (defaultValue) => Column({ type: 'boolean', nullable: true, default: defaultValue });
7969
8159
  const DateTimeColumn = (defaultValue = null) => Column({ type: 'datetime', nullable: true, default: defaultValue });
7970
8160
 
7971
- /**
7972
- * Entity decorator
7973
- */
7974
- function TaonEntity(options) {
7975
- return function (constructor) {
7976
- options = options || {};
7977
- options.uniqueKeyProp = options.uniqueKeyProp || 'id';
7978
- ClassHelpers.setName(constructor, options?.className);
7979
- Mapping.DefaultModelWithMapping(options?.defaultModelValues || {}, _.merge(options?.defaultModelMapping || {}, (options?.defaultModelMappingDeep || {})))(constructor);
7980
- // TODO when entit metadata generator read use this
7981
- Mapping.DefaultModelWithMapping(void 0, {})(constructor);
7982
- Reflect.defineMetadata(Symbols.metadata.options.entity, options, constructor);
7983
- Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
7984
- /* */
7985
- /* */
7986
- CLASS.setName(constructor, options?.className); // TODO QUICK_FIX for ng2-rest
7987
- };
7988
- }
7989
- class TaonEntityOptions extends DecoratorAbstractOpt {
7990
- }
7991
-
7992
8161
  /**
7993
8162
  * Migration decorator
7994
8163
  */
@@ -8002,19 +8171,6 @@ function TaonMigration(options) {
8002
8171
  class TaonMigrationOptions extends DecoratorAbstractOpt {
8003
8172
  }
8004
8173
 
8005
- /**
8006
- * Provider decorator
8007
- */
8008
- function TaonProvider(options) {
8009
- return function (constructor) {
8010
- Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
8011
- Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
8012
- ClassHelpers.setName(constructor, options?.className || constructor.name);
8013
- };
8014
- }
8015
- class TaonProviderOptions extends DecoratorAbstractOpt {
8016
- }
8017
-
8018
8174
  // TODO export all things
8019
8175
  var Taon;
8020
8176
  (function (Taon) {
@@ -8207,5 +8363,5 @@ const TAON_FLATTEN_MAPPING = {
8207
8363
  * Generated bundle index. Do not edit.
8208
8364
  */
8209
8365
 
8210
- export { BaseTaonClassesNames, Body, BooleanColumn, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, ContextDbMigrations, ContextsEndpointStorage, ControllerConfig, Cookie, DELETE, DITaonContainer, DateTimeColumn, DecimalNumberColumn, DecoratorAbstractOpt, EndpointContext, EntityProcess, FormlyHorizontalWrapper, GET, HEAD, HTML, Header, MethodConfig, MockNamespaceIpc, MockServerIpc, MockSocketIpc, Models, NumberColumn, PATCH, POST, PUT, ParamConfig, Path, Query, RealtimeClient, RealtimeCore, RealtimeServer, RealtimeStrategy, RealtimeStrategyIpc, RealtimeStrategyMock, RealtimeStrategySocketIO, RealtimeSubsManager, RegisterComponentType, RegisterComponentTypeForEntity, RepeatTypeComponent, SimpleJsonColumn, String100Column, String200Column, String45Column, String500Column, StringColumn, Symbols, TAON_CONTEXT, TAON_FLATTEN_MAPPING, Taon, TaonAdminService, TaonBaseAbstractEntity, TaonBaseAngularService, TaonBaseClass, TaonBaseContext, TaonBaseController, TaonBaseCrudController, TaonBaseCustomRepository, TaonBaseEntity, TaonBaseFileUploadMiddleware, TaonBaseInjector, TaonBaseMiddleware, TaonBaseMigration, TaonBaseProvider, TaonBaseRepository, TaonBaseSubscriberForEntity, TaonController, TaonControllerOptions, TaonEntity, TaonEntityKeysToOmitArr, TaonEntityOptions, TaonHelpers, TaonMiddleware, TaonMiddlewareOptions, TaonMigration, TaonMigrationOptions, TaonProvider, TaonProviderOptions, TaonRepository, TaonRepositoryOptions, TaonRestResponseWrapper, TaonSubscriber, TaonSubscriberOptions, TaonTempDatabasesFolder, TaonTempRoutesFolder, Validators, apiPrefix, cloneObj, controllerConfigFrom, createContext, createContextTemplate, findTypeForEntity, getFromlyConfigFor, getRegisteredComponents, getResponseValue, getTransformFunction, inject, singleTransform, typeFromEntity, typeFromName };
8366
+ export { BaseTaonClassesNames, Body, BooleanColumn, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, ContextDbMigrations, ContextsEndpointStorage, ControllerConfig, Cookie, DELETE, DITaonContainer, DateTimeColumn, DecimalNumberColumn, DecoratorAbstractOpt, EndpointContext, EntityProcess, FormlyHorizontalWrapper, GET, HEAD, HTML, Header, MethodConfig, MockNamespaceIpc, MockServerIpc, MockSocketIpc, Models, NumberColumn, PATCH, POST, PUT, ParamConfig, Path, Query, RealtimeClient, RealtimeCore, RealtimeServer, RealtimeStrategy, RealtimeStrategyIpc, RealtimeStrategyMock, RealtimeStrategySocketIO, RealtimeSubsManager, RegisterComponentType, RegisterComponentTypeForEntity, RepeatTypeComponent, SimpleJsonColumn, String100Column, String200Column, String20Column, String45Column, String500Column, StringColumn, Symbols, TAON_CONTEXT, TAON_FLATTEN_MAPPING, Taon, TaonAdminService, TaonBaseAbstractEntity, TaonBaseAngularService, TaonBaseClass, TaonBaseContext, TaonBaseController, TaonBaseCrudController, TaonBaseCustomRepository, TaonBaseEntity, TaonBaseFileUploadMiddleware, TaonBaseInjector, TaonBaseMiddleware, TaonBaseMigration, TaonBaseProvider, TaonBaseRepository, TaonBaseSubscriberForEntity, TaonController, TaonControllerOptions, TaonEntity, TaonEntityKeysToOmitArr, TaonEntityOptions, TaonHelpers, TaonMiddleware, TaonMiddlewareOptions, TaonMigration, TaonMigrationOptions, TaonProvider, TaonProviderOptions, TaonRepository, TaonRepositoryOptions, TaonRestResponseWrapper, TaonSubscriber, TaonSubscriberOptions, TaonTempDatabasesFolder, TaonTempRoutesFolder, Validators, apiPrefix, cloneObj, controllerConfigFrom, createContext, createContextTemplate, findTypeForEntity, getFromlyConfigFor, getRegisteredComponents, getResponseValue, getTransformFunction, inject, singleTransform, typeFromEntity, typeFromName };
8211
8367
  //# sourceMappingURL=taon-browser.mjs.map