@wavemaker/app-ng-runtime 11.10.5-rc.6100 → 11.11.0-1.6140

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 (1174) hide show
  1. package/build-task/bundles/index.umd.js +94 -68
  2. package/build-task/esm2022/advanced/carousel/carousel-template/carousel-template.build.mjs +8 -8
  3. package/build-task/esm2022/containers/repeat-template.build.mjs +5 -5
  4. package/build-task/esm2022/containers/wizard/wizard-step/wizard-step.build.mjs +2 -2
  5. package/build-task/esm2022/containers/wizard/wizard.build.mjs +33 -4
  6. package/build-task/esm2022/data/form/form-field/form-field.build.mjs +10 -10
  7. package/build-task/esm2022/data/table/table-column/table-column.build.mjs +15 -11
  8. package/build-task/esm2022/page/page.build.mjs +2 -8
  9. package/build-task/esm2022/public_api.mjs +1 -1
  10. package/build-task/fesm2022/index.mjs +95 -69
  11. package/build-task/fesm2022/index.mjs.map +1 -1
  12. package/components/advanced/carousel/bundles/index.umd.js +8 -36
  13. package/components/advanced/carousel/carousel-template/carousel-template.directive.d.ts +1 -1
  14. package/components/advanced/carousel/carousel.directive.d.ts +1 -1
  15. package/components/advanced/carousel/esm2022/carousel-template/carousel-template.directive.mjs +3 -2
  16. package/components/advanced/carousel/esm2022/carousel.directive.mjs +3 -2
  17. package/components/advanced/carousel/esm2022/public_api.mjs +1 -2
  18. package/components/advanced/carousel/fesm2022/index.mjs +8 -36
  19. package/components/advanced/carousel/fesm2022/index.mjs.map +1 -1
  20. package/components/advanced/carousel/public_api.d.ts +0 -1
  21. package/components/advanced/custom/bundles/index.umd.js +8 -33
  22. package/components/advanced/custom/custom-widget-container/custom-widget-container.directive.d.ts +1 -1
  23. package/components/advanced/custom/custom-widget.directive.d.ts +1 -1
  24. package/components/advanced/custom/esm2022/custom-widget-container/custom-widget-container.directive.mjs +3 -2
  25. package/components/advanced/custom/esm2022/custom-widget.directive.mjs +3 -2
  26. package/components/advanced/custom/esm2022/public_api.mjs +1 -2
  27. package/components/advanced/custom/fesm2022/index.mjs +7 -32
  28. package/components/advanced/custom/fesm2022/index.mjs.map +1 -1
  29. package/components/advanced/custom/public_api.d.ts +0 -1
  30. package/components/advanced/login/bundles/index.umd.js +10 -34
  31. package/components/advanced/login/esm2022/login.component.mjs +7 -6
  32. package/components/advanced/login/esm2022/public_api.mjs +1 -2
  33. package/components/advanced/login/fesm2022/index.mjs +8 -32
  34. package/components/advanced/login/fesm2022/index.mjs.map +1 -1
  35. package/components/advanced/login/login.component.d.ts +1 -1
  36. package/components/advanced/login/public_api.d.ts +0 -1
  37. package/components/advanced/marquee/bundles/index.umd.js +6 -29
  38. package/components/advanced/marquee/esm2022/marquee.directive.mjs +3 -2
  39. package/components/advanced/marquee/esm2022/public_api.mjs +1 -2
  40. package/components/advanced/marquee/fesm2022/index.mjs +5 -28
  41. package/components/advanced/marquee/fesm2022/index.mjs.map +1 -1
  42. package/components/advanced/marquee/marquee.directive.d.ts +1 -1
  43. package/components/advanced/marquee/public_api.d.ts +0 -1
  44. package/components/base/bundles/index.umd.js +86 -278
  45. package/components/base/components.module.d.ts +13 -15
  46. package/components/base/directives/show-in-device.directive.d.ts +1 -1
  47. package/components/base/esm2022/components.module.mjs +7 -13
  48. package/components/base/esm2022/directives/show-in-device.directive.mjs +3 -2
  49. package/components/base/esm2022/pipes/custom-pipes.mjs +33 -16
  50. package/components/base/esm2022/pipes/image.pipe.mjs +3 -2
  51. package/components/base/esm2022/pipes/sanitize.pipe.mjs +3 -2
  52. package/components/base/esm2022/pipes/trust-as.pipe.mjs +3 -2
  53. package/components/base/esm2022/public_api.mjs +1 -2
  54. package/components/base/esm2022/utils/form-utils.mjs +3 -1
  55. package/components/base/esm2022/utils/live-utils.mjs +3 -7
  56. package/components/base/esm2022/widgets/common/base/base-field-validations.mjs +4 -2
  57. package/components/base/esm2022/widgets/common/base/base.component.mjs +3 -5
  58. package/components/base/esm2022/widgets/common/base/custom-widget-container.directive.mjs +3 -2
  59. package/components/base/esm2022/widgets/common/base/partial-container.directive.mjs +3 -2
  60. package/components/base/esm2022/widgets/common/base/text-content.directive.mjs +3 -2
  61. package/components/base/esm2022/widgets/common/container/container.directive.mjs +3 -2
  62. package/components/base/esm2022/widgets/common/dialog/dialog.service.mjs +3 -3
  63. package/components/base/esm2022/widgets/common/item-template/item-template.directive.mjs +3 -2
  64. package/components/base/esm2022/widgets/common/lazy-load/lazy-load.directive.mjs +3 -2
  65. package/components/base/esm2022/widgets/common/message/message.component.mjs +5 -5
  66. package/components/base/esm2022/widgets/common/partial/partial.directive.mjs +3 -2
  67. package/components/base/esm2022/widgets/common/partial-param/partial-param.directive.mjs +5 -3
  68. package/components/base/esm2022/widgets/common/redraw/redrawable.directive.mjs +3 -2
  69. package/components/base/esm2022/widgets/common/repeat-template/repeat-template.directive.mjs +3 -2
  70. package/components/base/fesm2022/index.mjs +85 -276
  71. package/components/base/fesm2022/index.mjs.map +1 -1
  72. package/components/base/pipes/custom-pipes.d.ts +15 -15
  73. package/components/base/pipes/image.pipe.d.ts +1 -1
  74. package/components/base/pipes/sanitize.pipe.d.ts +1 -1
  75. package/components/base/pipes/trust-as.pipe.d.ts +1 -1
  76. package/components/base/public_api.d.ts +0 -1
  77. package/components/base/widgets/common/base/custom-widget-container.directive.d.ts +1 -1
  78. package/components/base/widgets/common/base/partial-container.directive.d.ts +1 -1
  79. package/components/base/widgets/common/base/text-content.directive.d.ts +1 -1
  80. package/components/base/widgets/common/container/container.directive.d.ts +1 -1
  81. package/components/base/widgets/common/item-template/item-template.directive.d.ts +1 -1
  82. package/components/base/widgets/common/lazy-load/lazy-load.directive.d.ts +1 -1
  83. package/components/base/widgets/common/message/message.component.d.ts +1 -1
  84. package/components/base/widgets/common/partial/partial.directive.d.ts +1 -1
  85. package/components/base/widgets/common/partial-param/partial-param.directive.d.ts +2 -2
  86. package/components/base/widgets/common/redraw/redrawable.directive.d.ts +1 -1
  87. package/components/base/widgets/common/repeat-template/repeat-template.directive.d.ts +1 -1
  88. package/components/basic/default/anchor/anchor.component.d.ts +1 -1
  89. package/components/basic/default/audio/audio.component.d.ts +1 -1
  90. package/components/basic/default/bundles/index.umd.js +100 -148
  91. package/components/basic/default/esm2022/anchor/anchor.component.mjs +23 -21
  92. package/components/basic/default/esm2022/audio/audio.component.mjs +7 -6
  93. package/components/basic/default/esm2022/html/html.directive.mjs +3 -2
  94. package/components/basic/default/esm2022/icon/icon.component.mjs +17 -16
  95. package/components/basic/default/esm2022/iframe/iframe.component.mjs +14 -13
  96. package/components/basic/default/esm2022/label/label.directive.mjs +3 -2
  97. package/components/basic/default/esm2022/picture/picture.directive.mjs +3 -2
  98. package/components/basic/default/esm2022/picture/picture.props.mjs +1 -5
  99. package/components/basic/default/esm2022/public_api.mjs +1 -2
  100. package/components/basic/default/esm2022/spinner/spinner.component.mjs +26 -24
  101. package/components/basic/default/esm2022/video/video.component.mjs +19 -18
  102. package/components/basic/default/fesm2022/index.mjs +101 -148
  103. package/components/basic/default/fesm2022/index.mjs.map +1 -1
  104. package/components/basic/default/html/html.directive.d.ts +1 -1
  105. package/components/basic/default/icon/icon.component.d.ts +1 -1
  106. package/components/basic/default/iframe/iframe.component.d.ts +1 -1
  107. package/components/basic/default/label/label.directive.d.ts +1 -1
  108. package/components/basic/default/picture/picture.directive.d.ts +1 -1
  109. package/components/basic/default/public_api.d.ts +0 -1
  110. package/components/basic/default/spinner/spinner.component.d.ts +1 -1
  111. package/components/basic/default/video/video.component.d.ts +1 -1
  112. package/components/basic/progress/bundles/index.umd.js +20 -51
  113. package/components/basic/progress/esm2022/progress-bar/progress-bar.component.mjs +12 -11
  114. package/components/basic/progress/esm2022/progress-circle/progress-circle.component.mjs +8 -6
  115. package/components/basic/progress/esm2022/public_api.mjs +1 -2
  116. package/components/basic/progress/fesm2022/index.mjs +19 -49
  117. package/components/basic/progress/fesm2022/index.mjs.map +1 -1
  118. package/components/basic/progress/progress-bar/progress-bar.component.d.ts +1 -1
  119. package/components/basic/progress/progress-circle/progress-circle.component.d.ts +1 -1
  120. package/components/basic/progress/public_api.d.ts +0 -1
  121. package/components/basic/rich-text-editor/bundles/index.umd.js +15 -40
  122. package/components/basic/rich-text-editor/esm2022/public_api.mjs +1 -2
  123. package/components/basic/rich-text-editor/esm2022/rich-text-editor.component.mjs +13 -12
  124. package/components/basic/rich-text-editor/fesm2022/index.mjs +13 -37
  125. package/components/basic/rich-text-editor/fesm2022/index.mjs.map +1 -1
  126. package/components/basic/rich-text-editor/public_api.d.ts +0 -1
  127. package/components/basic/rich-text-editor/rich-text-editor.component.d.ts +1 -1
  128. package/components/basic/search/bundles/index.umd.js +170 -207
  129. package/components/basic/search/esm2022/public_api.mjs +1 -2
  130. package/components/basic/search/esm2022/scrollable.directive.mjs +3 -2
  131. package/components/basic/search/esm2022/search.component.mjs +76 -72
  132. package/components/basic/search/fesm2022/index.mjs +107 -143
  133. package/components/basic/search/fesm2022/index.mjs.map +1 -1
  134. package/components/basic/search/public_api.d.ts +0 -1
  135. package/components/basic/search/scrollable.directive.d.ts +1 -1
  136. package/components/basic/search/search.component.d.ts +1 -1
  137. package/components/basic/tree/bundles/index.umd.js +9 -33
  138. package/components/basic/tree/esm2022/public_api.mjs +1 -2
  139. package/components/basic/tree/esm2022/tree.component.mjs +7 -6
  140. package/components/basic/tree/fesm2022/index.mjs +8 -32
  141. package/components/basic/tree/fesm2022/index.mjs.map +1 -1
  142. package/components/basic/tree/public_api.d.ts +0 -1
  143. package/components/basic/tree/tree.component.d.ts +1 -1
  144. package/components/chart/bundles/index.umd.js +27 -53
  145. package/components/chart/chart.component.d.ts +1 -1
  146. package/components/chart/esm2022/chart.component.mjs +26 -24
  147. package/components/chart/esm2022/chart.utils.mjs +3 -1
  148. package/components/chart/esm2022/public_api.mjs +1 -2
  149. package/components/chart/fesm2022/index.mjs +27 -52
  150. package/components/chart/fesm2022/index.mjs.map +1 -1
  151. package/components/chart/public_api.d.ts +0 -1
  152. package/components/containers/accordion/accordion-pane/accordion-pane.component.d.ts +1 -1
  153. package/components/containers/accordion/accordion.directive.d.ts +1 -1
  154. package/components/containers/accordion/bundles/index.umd.js +208 -237
  155. package/components/containers/accordion/esm2022/accordion-pane/accordion-pane.component.mjs +10 -11
  156. package/components/containers/accordion/esm2022/accordion.directive.mjs +5 -4
  157. package/components/containers/accordion/esm2022/public_api.mjs +1 -2
  158. package/components/containers/accordion/fesm2022/index.mjs +189 -217
  159. package/components/containers/accordion/fesm2022/index.mjs.map +1 -1
  160. package/components/containers/accordion/public_api.d.ts +0 -1
  161. package/components/containers/layout-grid/bundles/index.umd.js +13 -43
  162. package/components/containers/layout-grid/esm2022/layout-grid-column/layout-grid-column.directive.mjs +7 -9
  163. package/components/containers/layout-grid/esm2022/layout-grid-row/layout-grid-row.directive.mjs +3 -2
  164. package/components/containers/layout-grid/esm2022/layout-grid.directive.mjs +3 -2
  165. package/components/containers/layout-grid/esm2022/public_api.mjs +1 -2
  166. package/components/containers/layout-grid/fesm2022/index.mjs +13 -43
  167. package/components/containers/layout-grid/fesm2022/index.mjs.map +1 -1
  168. package/components/containers/layout-grid/layout-grid-column/layout-grid-column.directive.d.ts +1 -1
  169. package/components/containers/layout-grid/layout-grid-row/layout-grid-row.directive.d.ts +1 -1
  170. package/components/containers/layout-grid/layout-grid.directive.d.ts +1 -1
  171. package/components/containers/layout-grid/public_api.d.ts +0 -1
  172. package/components/containers/linear-layout/bundles/index.umd.js +8 -33
  173. package/components/containers/linear-layout/esm2022/linear-layout-item/linear-layout-item.directive.mjs +3 -2
  174. package/components/containers/linear-layout/esm2022/linear-layout.directive.mjs +3 -2
  175. package/components/containers/linear-layout/esm2022/public_api.mjs +1 -2
  176. package/components/containers/linear-layout/fesm2022/index.mjs +7 -32
  177. package/components/containers/linear-layout/fesm2022/index.mjs.map +1 -1
  178. package/components/containers/linear-layout/linear-layout-item/linear-layout-item.directive.d.ts +1 -1
  179. package/components/containers/linear-layout/linear-layout.directive.d.ts +1 -1
  180. package/components/containers/linear-layout/public_api.d.ts +0 -1
  181. package/components/containers/panel/bundles/index.umd.js +87 -118
  182. package/components/containers/panel/esm2022/panel.component.mjs +48 -46
  183. package/components/containers/panel/esm2022/public_api.mjs +1 -2
  184. package/components/containers/panel/fesm2022/index.mjs +49 -79
  185. package/components/containers/panel/fesm2022/index.mjs.map +1 -1
  186. package/components/containers/panel/panel.component.d.ts +1 -1
  187. package/components/containers/panel/public_api.d.ts +0 -1
  188. package/components/containers/tabs/bundles/index.umd.js +112 -120
  189. package/components/containers/tabs/esm2022/public_api.mjs +1 -2
  190. package/components/containers/tabs/esm2022/tab-pane/tab-pane.component.mjs +8 -10
  191. package/components/containers/tabs/esm2022/tabs.component.mjs +61 -38
  192. package/components/containers/tabs/esm2022/tabs.props.mjs +2 -5
  193. package/components/containers/tabs/fesm2022/index.mjs +72 -81
  194. package/components/containers/tabs/fesm2022/index.mjs.map +1 -1
  195. package/components/containers/tabs/public_api.d.ts +0 -1
  196. package/components/containers/tabs/tab-pane/tab-pane.component.d.ts +1 -1
  197. package/components/containers/tabs/tabs.component.d.ts +3 -1
  198. package/components/containers/tile/bundles/index.umd.js +6 -29
  199. package/components/containers/tile/esm2022/public_api.mjs +1 -2
  200. package/components/containers/tile/esm2022/tile.directive.mjs +3 -2
  201. package/components/containers/tile/fesm2022/index.mjs +5 -28
  202. package/components/containers/tile/fesm2022/index.mjs.map +1 -1
  203. package/components/containers/tile/public_api.d.ts +0 -1
  204. package/components/containers/tile/tile.directive.d.ts +1 -1
  205. package/components/containers/wizard/bundles/index.umd.js +355 -189
  206. package/components/containers/wizard/esm2022/public_api.mjs +2 -3
  207. package/components/containers/wizard/esm2022/wizard-action/wizard-action.directive.mjs +3 -2
  208. package/components/containers/wizard/esm2022/wizard-step/wizard-step.component.mjs +176 -0
  209. package/components/containers/wizard/esm2022/wizard-step/wizard-step.props.mjs +8 -5
  210. package/components/containers/wizard/esm2022/wizard.component.mjs +264 -105
  211. package/components/containers/wizard/esm2022/wizard.props.mjs +8 -4
  212. package/components/containers/wizard/fesm2022/index.mjs +323 -155
  213. package/components/containers/wizard/fesm2022/index.mjs.map +1 -1
  214. package/components/containers/wizard/public_api.d.ts +1 -2
  215. package/components/containers/wizard/wizard-action/wizard-action.directive.d.ts +1 -1
  216. package/components/containers/wizard/wizard-step/{wizard-step.directive.d.ts → wizard-step.component.d.ts} +12 -6
  217. package/components/containers/wizard/wizard.component.d.ts +64 -18
  218. package/components/data/card/bundles/index.umd.js +92 -135
  219. package/components/data/card/card-actions/card-actions.directive.d.ts +1 -1
  220. package/components/data/card/card-content/card-content.component.d.ts +1 -1
  221. package/components/data/card/card-footer/card-footer.directive.d.ts +1 -1
  222. package/components/data/card/card.component.d.ts +1 -1
  223. package/components/data/card/esm2022/card-actions/card-actions.directive.mjs +3 -2
  224. package/components/data/card/esm2022/card-content/card-content.component.mjs +7 -6
  225. package/components/data/card/esm2022/card-footer/card-footer.directive.mjs +3 -2
  226. package/components/data/card/esm2022/card.component.mjs +39 -38
  227. package/components/data/card/esm2022/public_api.mjs +1 -2
  228. package/components/data/card/fesm2022/index.mjs +49 -92
  229. package/components/data/card/fesm2022/index.mjs.map +1 -1
  230. package/components/data/card/public_api.d.ts +0 -1
  231. package/components/data/form/bundles/index.umd.js +115 -182
  232. package/components/data/form/esm2022/form-action/form-action.directive.mjs +3 -2
  233. package/components/data/form/esm2022/form-field/form-field.directive.mjs +3 -2
  234. package/components/data/form/esm2022/form-widget.directive.mjs +3 -2
  235. package/components/data/form/esm2022/form.component.mjs +101 -104
  236. package/components/data/form/esm2022/form.props.mjs +1 -11
  237. package/components/data/form/esm2022/live-actions/dependson.directive.mjs +3 -2
  238. package/components/data/form/esm2022/live-actions/live-actions.directive.mjs +3 -2
  239. package/components/data/form/esm2022/live-filter/live-filter.directive.mjs +3 -2
  240. package/components/data/form/esm2022/live-form/live-form.directive.mjs +3 -6
  241. package/components/data/form/esm2022/public_api.mjs +1 -2
  242. package/components/data/form/fesm2022/index.mjs +117 -184
  243. package/components/data/form/fesm2022/index.mjs.map +1 -1
  244. package/components/data/form/form-action/form-action.directive.d.ts +1 -1
  245. package/components/data/form/form-field/form-field.directive.d.ts +1 -1
  246. package/components/data/form/form-widget.directive.d.ts +1 -1
  247. package/components/data/form/form.component.d.ts +1 -1
  248. package/components/data/form/live-actions/dependson.directive.d.ts +1 -1
  249. package/components/data/form/live-actions/live-actions.directive.d.ts +1 -1
  250. package/components/data/form/live-filter/live-filter.directive.d.ts +1 -1
  251. package/components/data/form/live-form/live-form.directive.d.ts +1 -1
  252. package/components/data/form/public_api.d.ts +0 -1
  253. package/components/data/list/bundles/index.umd.js +195 -504
  254. package/components/data/list/esm2022/list-item.directive.mjs +4 -3
  255. package/components/data/list/esm2022/list.component.mjs +187 -232
  256. package/components/data/list/esm2022/list.props.mjs +2 -3
  257. package/components/data/list/esm2022/public_api.mjs +1 -2
  258. package/components/data/list/fesm2022/index.mjs +193 -502
  259. package/components/data/list/fesm2022/index.mjs.map +1 -1
  260. package/components/data/list/list-item.directive.d.ts +1 -1
  261. package/components/data/list/list.component.d.ts +1 -1
  262. package/components/data/list/public_api.d.ts +0 -1
  263. package/components/data/live-table/bundles/index.umd.js +9 -33
  264. package/components/data/live-table/esm2022/live-table.component.mjs +7 -6
  265. package/components/data/live-table/esm2022/public_api.mjs +1 -2
  266. package/components/data/live-table/fesm2022/index.mjs +8 -32
  267. package/components/data/live-table/fesm2022/index.mjs.map +1 -1
  268. package/components/data/live-table/live-table.component.d.ts +1 -1
  269. package/components/data/live-table/public_api.d.ts +0 -1
  270. package/components/data/pagination/bundles/index.umd.js +80 -110
  271. package/components/data/pagination/esm2022/pagination.component.mjs +80 -76
  272. package/components/data/pagination/esm2022/public_api.mjs +1 -2
  273. package/components/data/pagination/fesm2022/index.mjs +81 -110
  274. package/components/data/pagination/fesm2022/index.mjs.map +1 -1
  275. package/components/data/pagination/pagination.component.d.ts +1 -1
  276. package/components/data/pagination/public_api.d.ts +0 -1
  277. package/components/data/table/bundles/index.umd.js +69 -135
  278. package/components/data/table/esm2022/public_api.mjs +1 -2
  279. package/components/data/table/esm2022/table-action/table-action.directive.mjs +3 -2
  280. package/components/data/table/esm2022/table-column/table-column.directive.mjs +3 -2
  281. package/components/data/table/esm2022/table-column-group/table-column-group.directive.mjs +3 -2
  282. package/components/data/table/esm2022/table-cud.directive.mjs +3 -2
  283. package/components/data/table/esm2022/table-filter.directive.mjs +5 -2
  284. package/components/data/table/esm2022/table-row/table-row.directive.mjs +3 -2
  285. package/components/data/table/esm2022/table-row-action/table-row-action.directive.mjs +3 -2
  286. package/components/data/table/esm2022/table.component.mjs +51 -48
  287. package/components/data/table/fesm2022/index.mjs +73 -140
  288. package/components/data/table/fesm2022/index.mjs.map +1 -1
  289. package/components/data/table/public_api.d.ts +0 -1
  290. package/components/data/table/table-action/table-action.directive.d.ts +1 -1
  291. package/components/data/table/table-column/table-column.directive.d.ts +1 -1
  292. package/components/data/table/table-column-group/table-column-group.directive.d.ts +1 -1
  293. package/components/data/table/table-cud.directive.d.ts +1 -1
  294. package/components/data/table/table-filter.directive.d.ts +1 -1
  295. package/components/data/table/table-row/table-row.directive.d.ts +1 -1
  296. package/components/data/table/table-row-action/table-row-action.directive.d.ts +1 -1
  297. package/components/data/table/table.component.d.ts +1 -1
  298. package/components/dialogs/alert-dialog/alert-dialog.component.d.ts +1 -1
  299. package/components/dialogs/alert-dialog/bundles/index.umd.js +32 -64
  300. package/components/dialogs/alert-dialog/esm2022/alert-dialog.component.mjs +10 -10
  301. package/components/dialogs/alert-dialog/esm2022/public_api.mjs +1 -2
  302. package/components/dialogs/alert-dialog/fesm2022/index.mjs +11 -43
  303. package/components/dialogs/alert-dialog/fesm2022/index.mjs.map +1 -1
  304. package/components/dialogs/alert-dialog/public_api.d.ts +0 -1
  305. package/components/dialogs/confirm-dialog/bundles/index.umd.js +10 -42
  306. package/components/dialogs/confirm-dialog/confirm-dialog.component.d.ts +1 -1
  307. package/components/dialogs/confirm-dialog/esm2022/confirm-dialog.component.mjs +9 -9
  308. package/components/dialogs/confirm-dialog/esm2022/public_api.mjs +1 -2
  309. package/components/dialogs/confirm-dialog/fesm2022/index.mjs +10 -42
  310. package/components/dialogs/confirm-dialog/fesm2022/index.mjs.map +1 -1
  311. package/components/dialogs/confirm-dialog/public_api.d.ts +0 -1
  312. package/components/dialogs/default/bundles/index.umd.js +76 -136
  313. package/components/dialogs/default/dialog-body/dialog-body.directive.d.ts +1 -1
  314. package/components/dialogs/default/dialog-footer/dialog-footer.directive.d.ts +1 -1
  315. package/components/dialogs/default/dialog-header/dialog-header.component.d.ts +1 -1
  316. package/components/dialogs/default/esm2022/base-dialog.mjs +3 -3
  317. package/components/dialogs/default/esm2022/dialog-body/dialog-body.directive.mjs +3 -2
  318. package/components/dialogs/default/esm2022/dialog-footer/dialog-footer.directive.mjs +3 -2
  319. package/components/dialogs/default/esm2022/dialog-header/dialog-header.component.mjs +70 -97
  320. package/components/dialogs/default/esm2022/public_api.mjs +1 -2
  321. package/components/dialogs/default/fesm2022/index.mjs +78 -137
  322. package/components/dialogs/default/fesm2022/index.mjs.map +1 -1
  323. package/components/dialogs/default/public_api.d.ts +0 -1
  324. package/components/dialogs/design-dialog/bundles/index.umd.js +16 -47
  325. package/components/dialogs/design-dialog/dialog.component.d.ts +1 -1
  326. package/components/dialogs/design-dialog/esm2022/dialog.component.mjs +14 -13
  327. package/components/dialogs/design-dialog/esm2022/public_api.mjs +1 -2
  328. package/components/dialogs/design-dialog/fesm2022/index.mjs +14 -45
  329. package/components/dialogs/design-dialog/fesm2022/index.mjs.map +1 -1
  330. package/components/dialogs/design-dialog/public_api.d.ts +0 -1
  331. package/components/dialogs/iframe-dialog/bundles/index.umd.js +20 -57
  332. package/components/dialogs/iframe-dialog/esm2022/iframe-dialog.component.mjs +21 -21
  333. package/components/dialogs/iframe-dialog/esm2022/public_api.mjs +1 -2
  334. package/components/dialogs/iframe-dialog/fesm2022/index.mjs +21 -57
  335. package/components/dialogs/iframe-dialog/fesm2022/index.mjs.map +1 -1
  336. package/components/dialogs/iframe-dialog/iframe-dialog.component.d.ts +1 -1
  337. package/components/dialogs/iframe-dialog/public_api.d.ts +0 -1
  338. package/components/dialogs/login-dialog/bundles/index.umd.js +6 -38
  339. package/components/dialogs/login-dialog/esm2022/login-dialog.directive.mjs +3 -2
  340. package/components/dialogs/login-dialog/esm2022/public_api.mjs +1 -2
  341. package/components/dialogs/login-dialog/fesm2022/index.mjs +6 -41
  342. package/components/dialogs/login-dialog/fesm2022/index.mjs.map +1 -1
  343. package/components/dialogs/login-dialog/login-dialog.directive.d.ts +1 -1
  344. package/components/dialogs/login-dialog/public_api.d.ts +0 -1
  345. package/components/dialogs/partial-dialog/bundles/index.umd.js +17 -49
  346. package/components/dialogs/partial-dialog/esm2022/partial-dialog.component.mjs +16 -15
  347. package/components/dialogs/partial-dialog/esm2022/public_api.mjs +1 -2
  348. package/components/dialogs/partial-dialog/fesm2022/index.mjs +16 -47
  349. package/components/dialogs/partial-dialog/fesm2022/index.mjs.map +1 -1
  350. package/components/dialogs/partial-dialog/partial-dialog.component.d.ts +1 -1
  351. package/components/dialogs/partial-dialog/public_api.d.ts +0 -1
  352. package/components/input/calendar/bundles/index.umd.js +24 -46
  353. package/components/input/calendar/calendar.component.d.ts +1 -1
  354. package/components/input/calendar/esm2022/calendar.component.mjs +28 -10
  355. package/components/input/calendar/esm2022/calendar.props.mjs +1 -1
  356. package/components/input/calendar/esm2022/public_api.mjs +1 -2
  357. package/components/input/calendar/fesm2022/index.mjs +30 -48
  358. package/components/input/calendar/fesm2022/index.mjs.map +1 -1
  359. package/components/input/calendar/public_api.d.ts +0 -1
  360. package/components/input/chips/bundles/index.umd.js +86 -114
  361. package/components/input/chips/chips.component.d.ts +1 -1
  362. package/components/input/chips/esm2022/chips.component.mjs +28 -27
  363. package/components/input/chips/esm2022/public_api.mjs +1 -2
  364. package/components/input/chips/fesm2022/index.mjs +29 -56
  365. package/components/input/chips/fesm2022/index.mjs.map +1 -1
  366. package/components/input/chips/public_api.d.ts +0 -1
  367. package/components/input/color-picker/bundles/index.umd.js +14 -42
  368. package/components/input/color-picker/color-picker.component.d.ts +1 -1
  369. package/components/input/color-picker/esm2022/color-picker.component.mjs +14 -8
  370. package/components/input/color-picker/esm2022/public_api.mjs +1 -2
  371. package/components/input/color-picker/fesm2022/index.mjs +15 -42
  372. package/components/input/color-picker/fesm2022/index.mjs.map +1 -1
  373. package/components/input/color-picker/public_api.d.ts +0 -1
  374. package/components/input/currency/bundles/index.umd.js +11 -41
  375. package/components/input/currency/currency.component.d.ts +1 -1
  376. package/components/input/currency/esm2022/currency.component.mjs +8 -6
  377. package/components/input/currency/esm2022/public_api.mjs +1 -2
  378. package/components/input/currency/fesm2022/index.mjs +11 -41
  379. package/components/input/currency/fesm2022/index.mjs.map +1 -1
  380. package/components/input/currency/public_api.d.ts +0 -1
  381. package/components/input/default/bundles/index.umd.js +2183 -2263
  382. package/components/input/default/button/button.component.d.ts +1 -1
  383. package/components/input/default/button-group/button-group.directive.d.ts +1 -1
  384. package/components/input/default/caption-position.directive.d.ts +1 -1
  385. package/components/input/default/checkbox/checkbox.component.d.ts +1 -1
  386. package/components/input/default/checkboxset/checkboxset.component.d.ts +1 -1
  387. package/components/input/default/composite/composite.directive.d.ts +1 -1
  388. package/components/input/default/esm2022/button/button.component.mjs +23 -21
  389. package/components/input/default/esm2022/button-group/button-group.directive.mjs +3 -2
  390. package/components/input/default/esm2022/caption-position.directive.mjs +3 -2
  391. package/components/input/default/esm2022/checkbox/checkbox.component.mjs +9 -6
  392. package/components/input/default/esm2022/checkboxset/checkboxset.component.mjs +73 -72
  393. package/components/input/default/esm2022/composite/composite.directive.mjs +3 -2
  394. package/components/input/default/esm2022/number/number.component.mjs +9 -6
  395. package/components/input/default/esm2022/public_api.mjs +1 -2
  396. package/components/input/default/esm2022/radioset/radioset.component.mjs +73 -72
  397. package/components/input/default/esm2022/select/select.component.mjs +29 -32
  398. package/components/input/default/esm2022/switch/switch.component.mjs +29 -27
  399. package/components/input/default/esm2022/text/calendar/input-calendar.component.mjs +9 -6
  400. package/components/input/default/esm2022/text/color/input-color.component.mjs +9 -6
  401. package/components/input/default/esm2022/text/email/input-email.component.mjs +9 -6
  402. package/components/input/default/esm2022/text/number/input-number.component.mjs +9 -6
  403. package/components/input/default/esm2022/text/text/input-text.component.mjs +10 -6
  404. package/components/input/default/esm2022/textarea/textarea.component.mjs +14 -11
  405. package/components/input/default/fesm2022/index.mjs +2198 -2277
  406. package/components/input/default/fesm2022/index.mjs.map +1 -1
  407. package/components/input/default/number/number.component.d.ts +1 -1
  408. package/components/input/default/public_api.d.ts +0 -1
  409. package/components/input/default/radioset/radioset.component.d.ts +1 -1
  410. package/components/input/default/select/select.component.d.ts +1 -1
  411. package/components/input/default/switch/switch.component.d.ts +1 -1
  412. package/components/input/default/text/calendar/input-calendar.component.d.ts +1 -1
  413. package/components/input/default/text/color/input-color.component.d.ts +1 -1
  414. package/components/input/default/text/email/input-email.component.d.ts +1 -1
  415. package/components/input/default/text/number/input-number.component.d.ts +1 -1
  416. package/components/input/default/text/text/input-text.component.d.ts +1 -1
  417. package/components/input/default/textarea/textarea.component.d.ts +1 -1
  418. package/components/input/epoch/base-date-time.component.d.ts +0 -1
  419. package/components/input/epoch/bundles/index.umd.js +220 -262
  420. package/components/input/epoch/date/date.component.d.ts +1 -1
  421. package/components/input/epoch/date/imaskUtil.d.ts +2 -2
  422. package/components/input/epoch/date-time/date-time-picker.component.d.ts +6 -6
  423. package/components/input/epoch/date-time/date-time.component.d.ts +1 -1
  424. package/components/input/epoch/esm2022/base-date-time.component.mjs +6 -9
  425. package/components/input/epoch/esm2022/date/date.component.mjs +19 -18
  426. package/components/input/epoch/esm2022/date/imaskUtil.mjs +3 -1
  427. package/components/input/epoch/esm2022/date-time/date-time-picker.component.mjs +76 -62
  428. package/components/input/epoch/esm2022/date-time/date-time.component.mjs +28 -24
  429. package/components/input/epoch/esm2022/picker/picker.component.mjs +33 -28
  430. package/components/input/epoch/esm2022/public_api.mjs +1 -2
  431. package/components/input/epoch/esm2022/time/time.component.mjs +25 -21
  432. package/components/input/epoch/fesm2022/index.mjs +196 -237
  433. package/components/input/epoch/fesm2022/index.mjs.map +1 -1
  434. package/components/input/epoch/picker/picker.component.d.ts +2 -2
  435. package/components/input/epoch/public_api.d.ts +0 -1
  436. package/components/input/epoch/time/time.component.d.ts +1 -1
  437. package/components/input/file-upload/bundles/index.umd.js +135 -178
  438. package/components/input/file-upload/esm2022/file-upload.component.mjs +133 -150
  439. package/components/input/file-upload/esm2022/public_api.mjs +1 -2
  440. package/components/input/file-upload/fesm2022/index.mjs +133 -175
  441. package/components/input/file-upload/fesm2022/index.mjs.map +1 -1
  442. package/components/input/file-upload/file-upload.component.d.ts +1 -2
  443. package/components/input/file-upload/public_api.d.ts +0 -1
  444. package/components/input/rating/bundles/index.umd.js +50 -77
  445. package/components/input/rating/esm2022/public_api.mjs +1 -2
  446. package/components/input/rating/esm2022/rating.component.mjs +23 -20
  447. package/components/input/rating/fesm2022/index.mjs +23 -49
  448. package/components/input/rating/fesm2022/index.mjs.map +1 -1
  449. package/components/input/rating/public_api.d.ts +0 -1
  450. package/components/input/rating/rating.component.d.ts +1 -1
  451. package/components/input/slider/bundles/index.umd.js +35 -63
  452. package/components/input/slider/esm2022/public_api.mjs +1 -2
  453. package/components/input/slider/esm2022/slider.component.mjs +15 -13
  454. package/components/input/slider/fesm2022/index.mjs +15 -42
  455. package/components/input/slider/fesm2022/index.mjs.map +1 -1
  456. package/components/input/slider/public_api.d.ts +0 -1
  457. package/components/input/slider/slider.component.d.ts +1 -1
  458. package/components/navigation/breadcrumb/breadcrumb.component.d.ts +1 -1
  459. package/components/navigation/breadcrumb/bundles/index.umd.js +40 -67
  460. package/components/navigation/breadcrumb/esm2022/breadcrumb.component.mjs +23 -21
  461. package/components/navigation/breadcrumb/esm2022/public_api.mjs +1 -2
  462. package/components/navigation/breadcrumb/fesm2022/index.mjs +23 -50
  463. package/components/navigation/breadcrumb/fesm2022/index.mjs.map +1 -1
  464. package/components/navigation/breadcrumb/public_api.d.ts +0 -1
  465. package/components/navigation/menu/bundles/index.umd.js +642 -696
  466. package/components/navigation/menu/esm2022/menu-adapator.component.mjs +1 -1
  467. package/components/navigation/menu/esm2022/menu-dropdown/menu-dropdown.component.mjs +11 -9
  468. package/components/navigation/menu/esm2022/menu-dropdown-item/menu-dropdown-item.component.mjs +24 -18
  469. package/components/navigation/menu/esm2022/menu.component.mjs +34 -31
  470. package/components/navigation/menu/esm2022/nav/nav-item/nav-item.directive.mjs +3 -2
  471. package/components/navigation/menu/esm2022/nav/nav.component.mjs +39 -29
  472. package/components/navigation/menu/esm2022/nav/navigation-control.directive.mjs +6 -3
  473. package/components/navigation/menu/esm2022/public_api.mjs +1 -2
  474. package/components/navigation/menu/fesm2022/index.mjs +534 -587
  475. package/components/navigation/menu/fesm2022/index.mjs.map +1 -1
  476. package/components/navigation/menu/menu-dropdown/menu-dropdown.component.d.ts +1 -1
  477. package/components/navigation/menu/menu-dropdown-item/menu-dropdown-item.component.d.ts +1 -1
  478. package/components/navigation/menu/menu.component.d.ts +1 -1
  479. package/components/navigation/menu/nav/nav-item/nav-item.directive.d.ts +1 -1
  480. package/components/navigation/menu/nav/nav.component.d.ts +1 -1
  481. package/components/navigation/menu/nav/navigation-control.directive.d.ts +1 -1
  482. package/components/navigation/menu/public_api.d.ts +0 -1
  483. package/components/navigation/navbar/bundles/index.umd.js +20 -44
  484. package/components/navigation/navbar/esm2022/navbar.component.mjs +18 -16
  485. package/components/navigation/navbar/esm2022/public_api.mjs +1 -2
  486. package/components/navigation/navbar/fesm2022/index.mjs +18 -41
  487. package/components/navigation/navbar/fesm2022/index.mjs.map +1 -1
  488. package/components/navigation/navbar/navbar.component.d.ts +1 -1
  489. package/components/navigation/navbar/public_api.d.ts +0 -1
  490. package/components/navigation/popover/bundles/index.umd.js +12 -43
  491. package/components/navigation/popover/esm2022/popover.component.mjs +11 -9
  492. package/components/navigation/popover/esm2022/public_api.mjs +1 -2
  493. package/components/navigation/popover/fesm2022/index.mjs +11 -41
  494. package/components/navigation/popover/fesm2022/index.mjs.map +1 -1
  495. package/components/navigation/popover/popover.component.d.ts +1 -1
  496. package/components/navigation/popover/public_api.d.ts +0 -1
  497. package/components/page/default/bundles/index.umd.js +96 -138
  498. package/components/page/default/content/content.component.d.ts +1 -1
  499. package/components/page/default/esm2022/content/content.component.mjs +7 -6
  500. package/components/page/default/esm2022/layout.directive.mjs +3 -2
  501. package/components/page/default/esm2022/page-content/page-content.component.mjs +7 -6
  502. package/components/page/default/esm2022/page-content/page-content.props.mjs +2 -3
  503. package/components/page/default/esm2022/page.directive.mjs +3 -2
  504. package/components/page/default/esm2022/public_api.mjs +1 -2
  505. package/components/page/default/esm2022/router-outlet.directive.mjs +3 -2
  506. package/components/page/default/esm2022/spa-page.directive.mjs +3 -2
  507. package/components/page/default/fesm2022/index.mjs +96 -138
  508. package/components/page/default/fesm2022/index.mjs.map +1 -1
  509. package/components/page/default/layout.directive.d.ts +1 -1
  510. package/components/page/default/page-content/page-content.component.d.ts +1 -1
  511. package/components/page/default/page.directive.d.ts +1 -1
  512. package/components/page/default/public_api.d.ts +0 -1
  513. package/components/page/default/router-outlet.directive.d.ts +1 -1
  514. package/components/page/default/spa-page.directive.d.ts +1 -1
  515. package/components/page/footer/bundles/index.umd.js +6 -29
  516. package/components/page/footer/esm2022/footer.directive.mjs +3 -2
  517. package/components/page/footer/esm2022/public_api.mjs +1 -2
  518. package/components/page/footer/fesm2022/index.mjs +5 -28
  519. package/components/page/footer/fesm2022/index.mjs.map +1 -1
  520. package/components/page/footer/footer.directive.d.ts +1 -1
  521. package/components/page/footer/public_api.d.ts +0 -1
  522. package/components/page/header/bundles/index.umd.js +9 -33
  523. package/components/page/header/esm2022/header.component.mjs +7 -6
  524. package/components/page/header/esm2022/public_api.mjs +1 -2
  525. package/components/page/header/fesm2022/index.mjs +8 -32
  526. package/components/page/header/fesm2022/index.mjs.map +1 -1
  527. package/components/page/header/header.component.d.ts +1 -1
  528. package/components/page/header/public_api.d.ts +0 -1
  529. package/components/page/left-panel/bundles/index.umd.js +6 -29
  530. package/components/page/left-panel/esm2022/left-panel.directive.mjs +3 -2
  531. package/components/page/left-panel/esm2022/public_api.mjs +1 -2
  532. package/components/page/left-panel/fesm2022/index.mjs +5 -28
  533. package/components/page/left-panel/fesm2022/index.mjs.map +1 -1
  534. package/components/page/left-panel/left-panel.directive.d.ts +1 -1
  535. package/components/page/left-panel/public_api.d.ts +0 -1
  536. package/components/page/right-panel/bundles/index.umd.js +6 -29
  537. package/components/page/right-panel/esm2022/public_api.mjs +1 -2
  538. package/components/page/right-panel/esm2022/right-panel.directive.mjs +3 -2
  539. package/components/page/right-panel/fesm2022/index.mjs +5 -28
  540. package/components/page/right-panel/fesm2022/index.mjs.map +1 -1
  541. package/components/page/right-panel/public_api.d.ts +0 -1
  542. package/components/page/right-panel/right-panel.directive.d.ts +1 -1
  543. package/components/page/top-nav/bundles/index.umd.js +6 -29
  544. package/components/page/top-nav/esm2022/public_api.mjs +1 -2
  545. package/components/page/top-nav/esm2022/top-nav.directive.mjs +3 -2
  546. package/components/page/top-nav/fesm2022/index.mjs +5 -28
  547. package/components/page/top-nav/fesm2022/index.mjs.map +1 -1
  548. package/components/page/top-nav/public_api.d.ts +0 -1
  549. package/components/page/top-nav/top-nav.directive.d.ts +1 -1
  550. package/components/prefab/bundles/index.umd.js +8 -33
  551. package/components/prefab/esm2022/prefab-container/prefab-container.directive.mjs +3 -2
  552. package/components/prefab/esm2022/prefab.directive.mjs +3 -2
  553. package/components/prefab/esm2022/public_api.mjs +1 -2
  554. package/components/prefab/fesm2022/index.mjs +7 -32
  555. package/components/prefab/fesm2022/index.mjs.map +1 -1
  556. package/components/prefab/prefab-container/prefab-container.directive.d.ts +1 -1
  557. package/components/prefab/prefab.directive.d.ts +1 -1
  558. package/components/prefab/public_api.d.ts +0 -1
  559. package/core/bundles/index.umd.js +32 -85
  560. package/core/esm2022/public_api.mjs +2 -3
  561. package/core/esm2022/types/types.mjs +1 -1
  562. package/core/esm2022/utils/build-utils.mjs +9 -5
  563. package/core/esm2022/utils/utils.mjs +12 -40
  564. package/core/fesm2022/index.mjs +32 -81
  565. package/core/fesm2022/index.mjs.map +1 -1
  566. package/core/public_api.d.ts +1 -2
  567. package/core/types/types.d.ts +1 -0
  568. package/core/utils/utils.d.ts +1 -3
  569. package/http/bundles/index.umd.js +9 -34
  570. package/http/esm2022/http.service.mjs +6 -3
  571. package/http/esm2022/public_api.mjs +4 -2
  572. package/http/fesm2022/index.mjs +9 -34
  573. package/http/fesm2022/index.mjs.map +1 -1
  574. package/http/public_api.d.ts +3 -1
  575. package/npm-shrinkwrap.json +2 -2
  576. package/oAuth/bundles/index.umd.js +9 -42
  577. package/oAuth/esm2022/oAuth.utils.mjs +7 -23
  578. package/oAuth/esm2022/public_api.mjs +1 -2
  579. package/oAuth/fesm2022/index.mjs +8 -40
  580. package/oAuth/fesm2022/index.mjs.map +1 -1
  581. package/oAuth/public_api.d.ts +0 -1
  582. package/package-lock.json +2 -2
  583. package/package.json +1 -1
  584. package/runtime/base/bundles/index.umd.js +690 -596
  585. package/runtime/base/components/app-component/app.component.d.ts +1 -1
  586. package/runtime/base/components/app-spinner.component.d.ts +1 -1
  587. package/runtime/base/components/custom-toaster.component.d.ts +1 -1
  588. package/runtime/base/components/empty-component/empty-page.component.d.ts +1 -1
  589. package/runtime/base/components/prefab-preview.component.d.ts +1 -1
  590. package/runtime/base/directives/accessroles.directive.d.ts +1 -1
  591. package/runtime/base/directives/prefab.directive.d.ts +1 -1
  592. package/runtime/base/esm2022/components/app-component/app.component.mjs +42 -49
  593. package/runtime/base/esm2022/components/app-spinner.component.mjs +29 -21
  594. package/runtime/base/esm2022/components/base-page.component.mjs +3 -11
  595. package/runtime/base/esm2022/components/base-spa-page.component.mjs +3 -11
  596. package/runtime/base/esm2022/components/custom-toaster.component.mjs +20 -14
  597. package/runtime/base/esm2022/components/empty-component/empty-page.component.mjs +4 -3
  598. package/runtime/base/esm2022/components/prefab-preview.component.mjs +8 -6
  599. package/runtime/base/esm2022/directives/accessroles.directive.mjs +3 -2
  600. package/runtime/base/esm2022/directives/prefab.directive.mjs +3 -2
  601. package/runtime/base/esm2022/public_api.mjs +1 -1
  602. package/runtime/base/esm2022/resolves/security-config.resolve.mjs +4 -6
  603. package/runtime/base/esm2022/runtime-base.module.mjs +486 -337
  604. package/runtime/base/esm2022/services/app.manager.service.mjs +31 -48
  605. package/runtime/base/esm2022/services/app.service.mjs +8 -1
  606. package/runtime/base/esm2022/services/i18n.service.mjs +39 -72
  607. package/runtime/base/fesm2022/index.mjs +697 -605
  608. package/runtime/base/fesm2022/index.mjs.map +1 -1
  609. package/runtime/base/runtime-base.module.d.ts +115 -84
  610. package/runtime/base/services/app.service.d.ts +1 -0
  611. package/runtime/base/services/i18n.service.d.ts +1 -1
  612. package/runtime/dynamic/app/app.config.d.ts +5 -0
  613. package/runtime/dynamic/app/components/page-wrapper.component.d.ts +1 -1
  614. package/runtime/dynamic/bundles/index.umd.js +270 -117
  615. package/runtime/dynamic/esm2022/app/app.config.mjs +136 -0
  616. package/runtime/dynamic/esm2022/app/app.module.mjs +151 -105
  617. package/runtime/dynamic/esm2022/app/components/page-wrapper.component.mjs +7 -4
  618. package/runtime/dynamic/esm2022/app/services/component-ref-provider.service.mjs +1 -1
  619. package/runtime/dynamic/esm2022/main.mjs +11 -16
  620. package/runtime/dynamic/fesm2022/index.mjs +340 -184
  621. package/runtime/dynamic/fesm2022/index.mjs.map +1 -1
  622. package/security/bundles/index.umd.js +3 -34
  623. package/security/esm2022/public_api.mjs +1 -2
  624. package/security/esm2022/security.service.mjs +4 -15
  625. package/security/fesm2022/index.mjs +5 -32
  626. package/security/fesm2022/index.mjs.map +1 -1
  627. package/security/public_api.d.ts +0 -1
  628. package/transpiler/bundles/index.umd.js +271 -168
  629. package/transpiler/esm2022/build.mjs +1 -6
  630. package/transpiler/esm2022/imports.mjs +268 -161
  631. package/transpiler/fesm2022/index.mjs +267 -165
  632. package/transpiler/fesm2022/index.mjs.map +1 -1
  633. package/variables/bundles/index.umd.js +16 -197
  634. package/variables/constants/variables.constants.d.ts +0 -2
  635. package/variables/esm2022/constants/variables.constants.mjs +1 -3
  636. package/variables/esm2022/factory/variable-manager.factory.mjs +1 -3
  637. package/variables/esm2022/factory/variable.factory.mjs +1 -5
  638. package/variables/esm2022/manager/action/logout-action.manager.mjs +5 -7
  639. package/variables/esm2022/manager/variable/web-socket-variable.manager.mjs +3 -3
  640. package/variables/esm2022/public_api.mjs +1 -5
  641. package/variables/esm2022/service/metadata-service/metadata.service.mjs +6 -11
  642. package/variables/esm2022/util/variable/service-variable.utils.mjs +1 -4
  643. package/variables/esm2022/util/variable/variables.utils.mjs +5 -19
  644. package/variables/fesm2022/index.mjs +16 -198
  645. package/variables/fesm2022/index.mjs.map +1 -1
  646. package/variables/public_api.d.ts +0 -4
  647. package/components/advanced/carousel/carousel.module.d.ts +0 -11
  648. package/components/advanced/carousel/esm2022/carousel.module.mjs +0 -36
  649. package/components/advanced/custom/custom-widget.module.d.ts +0 -10
  650. package/components/advanced/custom/esm2022/custom-widget.module.mjs +0 -32
  651. package/components/advanced/login/esm2022/login.module.mjs +0 -28
  652. package/components/advanced/login/login.module.d.ts +0 -9
  653. package/components/advanced/marquee/esm2022/marquee.module.mjs +0 -28
  654. package/components/advanced/marquee/marquee.module.d.ts +0 -9
  655. package/components/base/esm2022/widgets/common/smooth-scroll/smooth-scroll.directive.mjs +0 -221
  656. package/components/base/widgets/common/smooth-scroll/smooth-scroll.directive.d.ts +0 -22
  657. package/components/basic/default/basic.module.d.ts +0 -17
  658. package/components/basic/default/esm2022/basic.module.mjs +0 -60
  659. package/components/basic/progress/esm2022/progress.module.mjs +0 -36
  660. package/components/basic/progress/progress.module.d.ts +0 -11
  661. package/components/basic/rich-text-editor/esm2022/rich-text-editor.module.mjs +0 -28
  662. package/components/basic/rich-text-editor/rich-text-editor.module.d.ts +0 -9
  663. package/components/basic/search/esm2022/search.module.mjs +0 -45
  664. package/components/basic/search/search.module.d.ts +0 -12
  665. package/components/basic/tree/esm2022/tree.module.mjs +0 -28
  666. package/components/basic/tree/tree.module.d.ts +0 -9
  667. package/components/chart/chart.module.d.ts +0 -10
  668. package/components/chart/esm2022/chart.module.mjs +0 -32
  669. package/components/containers/accordion/accordion.module.d.ts +0 -10
  670. package/components/containers/accordion/esm2022/accordion.module.mjs +0 -32
  671. package/components/containers/layout-grid/esm2022/layout-grid.module.mjs +0 -36
  672. package/components/containers/layout-grid/layout-grid.module.d.ts +0 -11
  673. package/components/containers/linear-layout/esm2022/linear-layout.module.mjs +0 -32
  674. package/components/containers/linear-layout/linear-layout.module.d.ts +0 -10
  675. package/components/containers/panel/esm2022/panel.module.mjs +0 -36
  676. package/components/containers/panel/panel.module.d.ts +0 -11
  677. package/components/containers/tabs/esm2022/tabs.module.mjs +0 -32
  678. package/components/containers/tabs/tabs.module.d.ts +0 -10
  679. package/components/containers/tile/esm2022/tile.module.mjs +0 -28
  680. package/components/containers/tile/tile.module.d.ts +0 -9
  681. package/components/containers/wizard/esm2022/wizard-step/wizard-step.directive.mjs +0 -140
  682. package/components/containers/wizard/esm2022/wizard.module.mjs +0 -40
  683. package/components/containers/wizard/wizard.module.d.ts +0 -12
  684. package/components/data/card/card.module.d.ts +0 -15
  685. package/components/data/card/esm2022/card.module.mjs +0 -52
  686. package/components/data/form/esm2022/form.module.mjs +0 -68
  687. package/components/data/form/form.module.d.ts +0 -19
  688. package/components/data/list/esm2022/list.module.mjs +0 -40
  689. package/components/data/list/list.module.d.ts +0 -11
  690. package/components/data/live-table/esm2022/live-table.module.mjs +0 -28
  691. package/components/data/live-table/live-table.module.d.ts +0 -9
  692. package/components/data/pagination/esm2022/pagination.module.mjs +0 -36
  693. package/components/data/pagination/pagination.module.d.ts +0 -11
  694. package/components/data/table/esm2022/table.module.mjs +0 -91
  695. package/components/data/table/table.module.d.ts +0 -24
  696. package/components/dialogs/alert-dialog/alert-dialog.module.d.ts +0 -11
  697. package/components/dialogs/alert-dialog/esm2022/alert-dialog.module.mjs +0 -36
  698. package/components/dialogs/confirm-dialog/confirm-dialog.module.d.ts +0 -11
  699. package/components/dialogs/confirm-dialog/esm2022/confirm-dialog.module.mjs +0 -36
  700. package/components/dialogs/default/dialog.module.d.ts +0 -12
  701. package/components/dialogs/default/esm2022/dialog.module.mjs +0 -40
  702. package/components/dialogs/design-dialog/design-dialog.module.d.ts +0 -11
  703. package/components/dialogs/design-dialog/esm2022/design-dialog.module.mjs +0 -36
  704. package/components/dialogs/iframe-dialog/esm2022/iframe-dialog.module.mjs +0 -40
  705. package/components/dialogs/iframe-dialog/iframe-dialog.module.d.ts +0 -12
  706. package/components/dialogs/login-dialog/esm2022/login-dialog.module.mjs +0 -40
  707. package/components/dialogs/login-dialog/login-dialog.module.d.ts +0 -12
  708. package/components/dialogs/partial-dialog/esm2022/partial-dialog.module.mjs +0 -36
  709. package/components/dialogs/partial-dialog/partial-dialog.module.d.ts +0 -11
  710. package/components/input/calendar/calendar.module.d.ts +0 -12
  711. package/components/input/calendar/esm2022/calendar.module.mjs +0 -40
  712. package/components/input/chips/chips.module.d.ts +0 -10
  713. package/components/input/chips/esm2022/chips.module.mjs +0 -32
  714. package/components/input/color-picker/color-picker.module.d.ts +0 -11
  715. package/components/input/color-picker/esm2022/color-picker.module.mjs +0 -36
  716. package/components/input/currency/currency.module.d.ts +0 -11
  717. package/components/input/currency/esm2022/currency.module.mjs +0 -36
  718. package/components/input/default/esm2022/input.module.mjs +0 -96
  719. package/components/input/default/input.module.d.ts +0 -26
  720. package/components/input/epoch/epoch.module.d.ts +0 -18
  721. package/components/input/epoch/esm2022/epoch.module.mjs +0 -70
  722. package/components/input/file-upload/esm2022/file-upload.module.mjs +0 -28
  723. package/components/input/file-upload/file-upload.module.d.ts +0 -9
  724. package/components/input/rating/esm2022/rating.module.mjs +0 -32
  725. package/components/input/rating/rating.module.d.ts +0 -10
  726. package/components/input/slider/esm2022/slider.module.mjs +0 -32
  727. package/components/input/slider/slider.module.d.ts +0 -10
  728. package/components/navigation/breadcrumb/breadcrumb.module.d.ts +0 -10
  729. package/components/navigation/breadcrumb/esm2022/breadcrumb.module.mjs +0 -32
  730. package/components/navigation/menu/esm2022/menu.module.mjs +0 -71
  731. package/components/navigation/menu/menu.module.d.ts +0 -17
  732. package/components/navigation/navbar/esm2022/navbar.module.mjs +0 -28
  733. package/components/navigation/navbar/navbar.module.d.ts +0 -9
  734. package/components/navigation/popover/esm2022/popover.module.mjs +0 -36
  735. package/components/navigation/popover/popover.module.d.ts +0 -11
  736. package/components/page/default/esm2022/page.module.mjs +0 -55
  737. package/components/page/default/page.module.d.ts +0 -14
  738. package/components/page/footer/esm2022/footer.module.mjs +0 -28
  739. package/components/page/footer/footer.module.d.ts +0 -9
  740. package/components/page/header/esm2022/header.module.mjs +0 -28
  741. package/components/page/header/header.module.d.ts +0 -9
  742. package/components/page/left-panel/esm2022/left-panel.module.mjs +0 -28
  743. package/components/page/left-panel/left-panel.module.d.ts +0 -9
  744. package/components/page/right-panel/esm2022/right-panel.module.mjs +0 -28
  745. package/components/page/right-panel/right-panel.module.d.ts +0 -9
  746. package/components/page/top-nav/esm2022/top-nav.module.mjs +0 -28
  747. package/components/page/top-nav/top-nav.module.d.ts +0 -9
  748. package/components/prefab/esm2022/prefab.module.mjs +0 -32
  749. package/components/prefab/prefab.module.d.ts +0 -10
  750. package/core/core.module.d.ts +0 -9
  751. package/core/esm2022/core.module.mjs +0 -27
  752. package/http/esm2022/http-service.module.mjs +0 -36
  753. package/http/http-service.module.d.ts +0 -14
  754. package/locales/fullcalendar/af.js +0 -27
  755. package/locales/fullcalendar/ar-dz.js +0 -28
  756. package/locales/fullcalendar/ar-kw.js +0 -28
  757. package/locales/fullcalendar/ar-ly.js +0 -28
  758. package/locales/fullcalendar/ar-ma.js +0 -28
  759. package/locales/fullcalendar/ar-sa.js +0 -28
  760. package/locales/fullcalendar/ar-tn.js +0 -28
  761. package/locales/fullcalendar/ar.js +0 -28
  762. package/locales/fullcalendar/az.js +0 -29
  763. package/locales/fullcalendar/bg.js +0 -28
  764. package/locales/fullcalendar/bs.js +0 -29
  765. package/locales/fullcalendar/ca.js +0 -27
  766. package/locales/fullcalendar/cs.js +0 -29
  767. package/locales/fullcalendar/da.js +0 -27
  768. package/locales/fullcalendar/de.js +0 -30
  769. package/locales/fullcalendar/el.js +0 -27
  770. package/locales/fullcalendar/en-au.js +0 -14
  771. package/locales/fullcalendar/en-gb.js +0 -14
  772. package/locales/fullcalendar/en-nz.js +0 -14
  773. package/locales/fullcalendar/es-us.js +0 -27
  774. package/locales/fullcalendar/es.js +0 -27
  775. package/locales/fullcalendar/et.js +0 -29
  776. package/locales/fullcalendar/eu.js +0 -27
  777. package/locales/fullcalendar/fa.js +0 -30
  778. package/locales/fullcalendar/fi.js +0 -27
  779. package/locales/fullcalendar/fr-ca.js +0 -24
  780. package/locales/fullcalendar/fr-ch.js +0 -28
  781. package/locales/fullcalendar/fr.js +0 -28
  782. package/locales/fullcalendar/gl.js +0 -27
  783. package/locales/fullcalendar/he.js +0 -24
  784. package/locales/fullcalendar/hi.js +0 -29
  785. package/locales/fullcalendar/hr.js +0 -29
  786. package/locales/fullcalendar/hu.js +0 -27
  787. package/locales/fullcalendar/id.js +0 -27
  788. package/locales/fullcalendar/is.js +0 -27
  789. package/locales/fullcalendar/it.js +0 -29
  790. package/locales/fullcalendar/ja.js +0 -25
  791. package/locales/fullcalendar/ka.js +0 -29
  792. package/locales/fullcalendar/kk.js +0 -29
  793. package/locales/fullcalendar/ko.js +0 -23
  794. package/locales/fullcalendar/lb.js +0 -27
  795. package/locales/fullcalendar/lt.js +0 -27
  796. package/locales/fullcalendar/lv.js +0 -29
  797. package/locales/fullcalendar/mk.js +0 -25
  798. package/locales/fullcalendar/ms.js +0 -29
  799. package/locales/fullcalendar/nb.js +0 -27
  800. package/locales/fullcalendar/ne.js +0 -27
  801. package/locales/fullcalendar/nl.js +0 -27
  802. package/locales/fullcalendar/nn.js +0 -27
  803. package/locales/fullcalendar/pl.js +0 -27
  804. package/locales/fullcalendar/pt-br.js +0 -25
  805. package/locales/fullcalendar/pt.js +0 -27
  806. package/locales/fullcalendar/ro.js +0 -29
  807. package/locales/fullcalendar/ru.js +0 -29
  808. package/locales/fullcalendar/sk.js +0 -29
  809. package/locales/fullcalendar/sl.js +0 -27
  810. package/locales/fullcalendar/sq.js +0 -29
  811. package/locales/fullcalendar/sr-cyrl.js +0 -29
  812. package/locales/fullcalendar/sr.js +0 -29
  813. package/locales/fullcalendar/sv.js +0 -27
  814. package/locales/fullcalendar/th.js +0 -30
  815. package/locales/fullcalendar/tr.js +0 -27
  816. package/locales/fullcalendar/ug.js +0 -17
  817. package/locales/fullcalendar/uk.js +0 -29
  818. package/locales/fullcalendar/uz.js +0 -21
  819. package/locales/fullcalendar/vi.js +0 -29
  820. package/locales/fullcalendar/zh-cn.js +0 -30
  821. package/locales/fullcalendar/zh-tw.js +0 -23
  822. package/mobile/components/basic/default/.npmignore +0 -2
  823. package/mobile/components/basic/default/anchor/anchor.directive.d.ts +0 -8
  824. package/mobile/components/basic/default/app-update/app-update.component.d.ts +0 -26
  825. package/mobile/components/basic/default/basic.module.d.ts +0 -15
  826. package/mobile/components/basic/default/bundles/index.umd.js +0 -980
  827. package/mobile/components/basic/default/esm2022/anchor/anchor.directive.mjs +0 -44
  828. package/mobile/components/basic/default/esm2022/app-update/app-update.component.mjs +0 -116
  829. package/mobile/components/basic/default/esm2022/basic.module.mjs +0 -52
  830. package/mobile/components/basic/default/esm2022/file-browser/file-browser.component.mjs +0 -236
  831. package/mobile/components/basic/default/esm2022/file-browser/file-selector.service.mjs +0 -85
  832. package/mobile/components/basic/default/esm2022/image-cache/image-cache.directive.mjs +0 -61
  833. package/mobile/components/basic/default/esm2022/index.mjs +0 -5
  834. package/mobile/components/basic/default/esm2022/network-info-toaster/network-info-toaster.component.mjs +0 -183
  835. package/mobile/components/basic/default/esm2022/network-info-toaster/network-info-toaster.props.mjs +0 -5
  836. package/mobile/components/basic/default/esm2022/process-manager/process-management.service.mjs +0 -47
  837. package/mobile/components/basic/default/esm2022/process-manager/process-manager.component.mjs +0 -175
  838. package/mobile/components/basic/default/esm2022/public_api.mjs +0 -10
  839. package/mobile/components/basic/default/fesm2022/index.mjs +0 -958
  840. package/mobile/components/basic/default/fesm2022/index.mjs.map +0 -1
  841. package/mobile/components/basic/default/file-browser/file-browser.component.d.ts +0 -39
  842. package/mobile/components/basic/default/file-browser/file-selector.service.d.ts +0 -27
  843. package/mobile/components/basic/default/image-cache/image-cache.directive.d.ts +0 -18
  844. package/mobile/components/basic/default/index.d.ts +0 -5
  845. package/mobile/components/basic/default/network-info-toaster/network-info-toaster.component.d.ts +0 -28
  846. package/mobile/components/basic/default/network-info-toaster/network-info-toaster.props.d.ts +0 -1
  847. package/mobile/components/basic/default/package.json +0 -23
  848. package/mobile/components/basic/default/process-manager/process-management.service.d.ts +0 -36
  849. package/mobile/components/basic/default/process-manager/process-manager.component.d.ts +0 -33
  850. package/mobile/components/basic/default/public_api.d.ts +0 -9
  851. package/mobile/components/basic/search/.npmignore +0 -2
  852. package/mobile/components/basic/search/bundles/index.umd.js +0 -66
  853. package/mobile/components/basic/search/esm2022/index.mjs +0 -5
  854. package/mobile/components/basic/search/esm2022/public_api.mjs +0 -3
  855. package/mobile/components/basic/search/esm2022/search.directive.mjs +0 -17
  856. package/mobile/components/basic/search/esm2022/search.module.mjs +0 -28
  857. package/mobile/components/basic/search/fesm2022/index.mjs +0 -49
  858. package/mobile/components/basic/search/fesm2022/index.mjs.map +0 -1
  859. package/mobile/components/basic/search/index.d.ts +0 -5
  860. package/mobile/components/basic/search/package.json +0 -23
  861. package/mobile/components/basic/search/public_api.d.ts +0 -2
  862. package/mobile/components/basic/search/search.directive.d.ts +0 -7
  863. package/mobile/components/basic/search/search.module.d.ts +0 -9
  864. package/mobile/components/containers/segmented-control/.npmignore +0 -2
  865. package/mobile/components/containers/segmented-control/bundles/index.umd.js +0 -281
  866. package/mobile/components/containers/segmented-control/esm2022/index.mjs +0 -5
  867. package/mobile/components/containers/segmented-control/esm2022/public_api.mjs +0 -4
  868. package/mobile/components/containers/segmented-control/esm2022/segment-content/segment-content.component.mjs +0 -70
  869. package/mobile/components/containers/segmented-control/esm2022/segment-content/segment-content.props.mjs +0 -14
  870. package/mobile/components/containers/segmented-control/esm2022/segmented-control.component.mjs +0 -147
  871. package/mobile/components/containers/segmented-control/esm2022/segmented-control.module.mjs +0 -32
  872. package/mobile/components/containers/segmented-control/esm2022/segmented-control.props.mjs +0 -9
  873. package/mobile/components/containers/segmented-control/fesm2022/index.mjs +0 -264
  874. package/mobile/components/containers/segmented-control/fesm2022/index.mjs.map +0 -1
  875. package/mobile/components/containers/segmented-control/index.d.ts +0 -5
  876. package/mobile/components/containers/segmented-control/package.json +0 -23
  877. package/mobile/components/containers/segmented-control/public_api.d.ts +0 -3
  878. package/mobile/components/containers/segmented-control/segment-content/segment-content.component.d.ts +0 -18
  879. package/mobile/components/containers/segmented-control/segment-content/segment-content.props.d.ts +0 -1
  880. package/mobile/components/containers/segmented-control/segmented-control.component.d.ts +0 -20
  881. package/mobile/components/containers/segmented-control/segmented-control.module.d.ts +0 -10
  882. package/mobile/components/containers/segmented-control/segmented-control.props.d.ts +0 -1
  883. package/mobile/components/data/media-list/.npmignore +0 -2
  884. package/mobile/components/data/media-list/bundles/index.umd.js +0 -310
  885. package/mobile/components/data/media-list/esm2022/index.mjs +0 -5
  886. package/mobile/components/data/media-list/esm2022/media-list-item/media-list-item.directive.mjs +0 -24
  887. package/mobile/components/data/media-list/esm2022/media-list.component.mjs +0 -213
  888. package/mobile/components/data/media-list/esm2022/media-list.module.mjs +0 -48
  889. package/mobile/components/data/media-list/esm2022/media-list.props.mjs +0 -16
  890. package/mobile/components/data/media-list/esm2022/public_api.mjs +0 -4
  891. package/mobile/components/data/media-list/fesm2022/index.mjs +0 -297
  892. package/mobile/components/data/media-list/fesm2022/index.mjs.map +0 -1
  893. package/mobile/components/data/media-list/index.d.ts +0 -5
  894. package/mobile/components/data/media-list/media-list-item/media-list-item.directive.d.ts +0 -8
  895. package/mobile/components/data/media-list/media-list.component.d.ts +0 -33
  896. package/mobile/components/data/media-list/media-list.module.d.ts +0 -14
  897. package/mobile/components/data/media-list/media-list.props.d.ts +0 -1
  898. package/mobile/components/data/media-list/package.json +0 -23
  899. package/mobile/components/data/media-list/public_api.d.ts +0 -3
  900. package/mobile/components/device/barcode-scanner/.npmignore +0 -2
  901. package/mobile/components/device/barcode-scanner/barcode-scanner.component.d.ts +0 -18
  902. package/mobile/components/device/barcode-scanner/barcode-scanner.module.d.ts +0 -9
  903. package/mobile/components/device/barcode-scanner/barcode-scanner.props.d.ts +0 -1
  904. package/mobile/components/device/barcode-scanner/bundles/index.umd.js +0 -129
  905. package/mobile/components/device/barcode-scanner/esm2022/barcode-scanner.component.mjs +0 -69
  906. package/mobile/components/device/barcode-scanner/esm2022/barcode-scanner.module.mjs +0 -28
  907. package/mobile/components/device/barcode-scanner/esm2022/barcode-scanner.props.mjs +0 -15
  908. package/mobile/components/device/barcode-scanner/esm2022/index.mjs +0 -5
  909. package/mobile/components/device/barcode-scanner/esm2022/public_api.mjs +0 -3
  910. package/mobile/components/device/barcode-scanner/fesm2022/index.mjs +0 -112
  911. package/mobile/components/device/barcode-scanner/fesm2022/index.mjs.map +0 -1
  912. package/mobile/components/device/barcode-scanner/index.d.ts +0 -5
  913. package/mobile/components/device/barcode-scanner/package.json +0 -23
  914. package/mobile/components/device/barcode-scanner/public_api.d.ts +0 -2
  915. package/mobile/components/device/camera/.npmignore +0 -2
  916. package/mobile/components/device/camera/bundles/index.umd.js +0 -170
  917. package/mobile/components/device/camera/camera.component.d.ts +0 -37
  918. package/mobile/components/device/camera/camera.module.d.ts +0 -9
  919. package/mobile/components/device/camera/camera.props.d.ts +0 -1
  920. package/mobile/components/device/camera/esm2022/camera.component.mjs +0 -101
  921. package/mobile/components/device/camera/esm2022/camera.module.mjs +0 -28
  922. package/mobile/components/device/camera/esm2022/camera.props.mjs +0 -25
  923. package/mobile/components/device/camera/esm2022/index.mjs +0 -5
  924. package/mobile/components/device/camera/esm2022/public_api.mjs +0 -3
  925. package/mobile/components/device/camera/fesm2022/index.mjs +0 -153
  926. package/mobile/components/device/camera/fesm2022/index.mjs.map +0 -1
  927. package/mobile/components/device/camera/index.d.ts +0 -5
  928. package/mobile/components/device/camera/package.json +0 -23
  929. package/mobile/components/device/camera/public_api.d.ts +0 -2
  930. package/mobile/components/input/file-upload/.npmignore +0 -2
  931. package/mobile/components/input/file-upload/bundles/index.umd.js +0 -88
  932. package/mobile/components/input/file-upload/esm2022/file-upload.directive.mjs +0 -41
  933. package/mobile/components/input/file-upload/esm2022/file-upload.module.mjs +0 -28
  934. package/mobile/components/input/file-upload/esm2022/index.mjs +0 -5
  935. package/mobile/components/input/file-upload/esm2022/public_api.mjs +0 -3
  936. package/mobile/components/input/file-upload/fesm2022/index.mjs +0 -71
  937. package/mobile/components/input/file-upload/fesm2022/index.mjs.map +0 -1
  938. package/mobile/components/input/file-upload/file-upload.directive.d.ts +0 -11
  939. package/mobile/components/input/file-upload/file-upload.module.d.ts +0 -9
  940. package/mobile/components/input/file-upload/index.d.ts +0 -5
  941. package/mobile/components/input/file-upload/package.json +0 -23
  942. package/mobile/components/input/file-upload/public_api.d.ts +0 -2
  943. package/mobile/components/page/default/.npmignore +0 -2
  944. package/mobile/components/page/default/bundles/index.umd.js +0 -127
  945. package/mobile/components/page/default/esm2022/index.mjs +0 -5
  946. package/mobile/components/page/default/esm2022/page-content-loader/page-content-loader.component.mjs +0 -24
  947. package/mobile/components/page/default/esm2022/page.directive.mjs +0 -58
  948. package/mobile/components/page/default/esm2022/page.module.mjs +0 -32
  949. package/mobile/components/page/default/esm2022/public_api.mjs +0 -4
  950. package/mobile/components/page/default/fesm2022/index.mjs +0 -110
  951. package/mobile/components/page/default/fesm2022/index.mjs.map +0 -1
  952. package/mobile/components/page/default/index.d.ts +0 -5
  953. package/mobile/components/page/default/package.json +0 -23
  954. package/mobile/components/page/default/page-content-loader/page-content-loader.component.d.ts +0 -7
  955. package/mobile/components/page/default/page.directive.d.ts +0 -19
  956. package/mobile/components/page/default/page.module.d.ts +0 -10
  957. package/mobile/components/page/default/public_api.d.ts +0 -3
  958. package/mobile/components/page/left-panel/.npmignore +0 -2
  959. package/mobile/components/page/left-panel/bundles/index.umd.js +0 -91
  960. package/mobile/components/page/left-panel/esm2022/index.mjs +0 -5
  961. package/mobile/components/page/left-panel/esm2022/left-panel.directive.mjs +0 -45
  962. package/mobile/components/page/left-panel/esm2022/left-panel.module.mjs +0 -28
  963. package/mobile/components/page/left-panel/esm2022/public_api.mjs +0 -3
  964. package/mobile/components/page/left-panel/fesm2022/index.mjs +0 -74
  965. package/mobile/components/page/left-panel/fesm2022/index.mjs.map +0 -1
  966. package/mobile/components/page/left-panel/index.d.ts +0 -5
  967. package/mobile/components/page/left-panel/left-panel.directive.d.ts +0 -16
  968. package/mobile/components/page/left-panel/left-panel.module.d.ts +0 -9
  969. package/mobile/components/page/left-panel/package.json +0 -23
  970. package/mobile/components/page/left-panel/public_api.d.ts +0 -2
  971. package/mobile/components/page/mobile-navbar/.npmignore +0 -2
  972. package/mobile/components/page/mobile-navbar/bundles/index.umd.js +0 -332
  973. package/mobile/components/page/mobile-navbar/esm2022/index.mjs +0 -5
  974. package/mobile/components/page/mobile-navbar/esm2022/mobile-navbar.component.mjs +0 -247
  975. package/mobile/components/page/mobile-navbar/esm2022/mobile-navbar.module.mjs +0 -32
  976. package/mobile/components/page/mobile-navbar/esm2022/mobile-navbar.props.mjs +0 -41
  977. package/mobile/components/page/mobile-navbar/esm2022/public_api.mjs +0 -3
  978. package/mobile/components/page/mobile-navbar/fesm2022/index.mjs +0 -317
  979. package/mobile/components/page/mobile-navbar/fesm2022/index.mjs.map +0 -1
  980. package/mobile/components/page/mobile-navbar/index.d.ts +0 -5
  981. package/mobile/components/page/mobile-navbar/mobile-navbar.component.d.ts +0 -50
  982. package/mobile/components/page/mobile-navbar/mobile-navbar.module.d.ts +0 -10
  983. package/mobile/components/page/mobile-navbar/mobile-navbar.props.d.ts +0 -2
  984. package/mobile/components/page/mobile-navbar/package.json +0 -23
  985. package/mobile/components/page/mobile-navbar/public_api.d.ts +0 -2
  986. package/mobile/components/page/tab-bar/.npmignore +0 -2
  987. package/mobile/components/page/tab-bar/bundles/index.umd.js +0 -279
  988. package/mobile/components/page/tab-bar/esm2022/index.mjs +0 -5
  989. package/mobile/components/page/tab-bar/esm2022/public_api.mjs +0 -3
  990. package/mobile/components/page/tab-bar/esm2022/tab-bar.module.mjs +0 -28
  991. package/mobile/components/page/tab-bar/esm2022/tabbar.component.mjs +0 -219
  992. package/mobile/components/page/tab-bar/esm2022/tabbar.props.mjs +0 -15
  993. package/mobile/components/page/tab-bar/fesm2022/index.mjs +0 -262
  994. package/mobile/components/page/tab-bar/fesm2022/index.mjs.map +0 -1
  995. package/mobile/components/page/tab-bar/index.d.ts +0 -5
  996. package/mobile/components/page/tab-bar/package.json +0 -23
  997. package/mobile/components/page/tab-bar/public_api.d.ts +0 -2
  998. package/mobile/components/page/tab-bar/tab-bar.module.d.ts +0 -9
  999. package/mobile/components/page/tab-bar/tabbar.component.d.ts +0 -40
  1000. package/mobile/components/page/tab-bar/tabbar.props.d.ts +0 -1
  1001. package/mobile/core/.npmignore +0 -2
  1002. package/mobile/core/bundles/index.umd.js +0 -1658
  1003. package/mobile/core/core.module.d.ts +0 -15
  1004. package/mobile/core/esm2022/core.module.mjs +0 -79
  1005. package/mobile/core/esm2022/index.mjs +0 -5
  1006. package/mobile/core/esm2022/native.xhr.mjs +0 -340
  1007. package/mobile/core/esm2022/public_api.mjs +0 -12
  1008. package/mobile/core/esm2022/services/device-file-cache.service.mjs +0 -92
  1009. package/mobile/core/esm2022/services/device-file-download.service.mjs +0 -154
  1010. package/mobile/core/esm2022/services/device-file-opener.service.mjs +0 -112
  1011. package/mobile/core/esm2022/services/device-file-upload.service.mjs +0 -91
  1012. package/mobile/core/esm2022/services/device-file.service.mjs +0 -237
  1013. package/mobile/core/esm2022/services/device-start-up-service.mjs +0 -2
  1014. package/mobile/core/esm2022/services/device.service.mjs +0 -150
  1015. package/mobile/core/esm2022/services/ext-app-message.service.mjs +0 -114
  1016. package/mobile/core/esm2022/services/network.service.mjs +0 -358
  1017. package/mobile/core/fesm2022/index.mjs +0 -1660
  1018. package/mobile/core/fesm2022/index.mjs.map +0 -1
  1019. package/mobile/core/index.d.ts +0 -5
  1020. package/mobile/core/native.xhr.d.ts +0 -36
  1021. package/mobile/core/package.json +0 -28
  1022. package/mobile/core/public_api.d.ts +0 -11
  1023. package/mobile/core/services/device-file-cache.service.d.ts +0 -24
  1024. package/mobile/core/services/device-file-download.service.d.ts +0 -36
  1025. package/mobile/core/services/device-file-opener.service.d.ts +0 -25
  1026. package/mobile/core/services/device-file-upload.service.d.ts +0 -27
  1027. package/mobile/core/services/device-file.service.d.ts +0 -45
  1028. package/mobile/core/services/device-start-up-service.d.ts +0 -4
  1029. package/mobile/core/services/device.service.d.ts +0 -52
  1030. package/mobile/core/services/ext-app-message.service.d.ts +0 -24
  1031. package/mobile/core/services/network.service.d.ts +0 -118
  1032. package/mobile/offline/.npmignore +0 -2
  1033. package/mobile/offline/bundles/index.umd.js +0 -3512
  1034. package/mobile/offline/esm2022/index.mjs +0 -5
  1035. package/mobile/offline/esm2022/models/config.mjs +0 -64
  1036. package/mobile/offline/esm2022/models/local-db-store.mjs +0 -412
  1037. package/mobile/offline/esm2022/offline.module.mjs +0 -100
  1038. package/mobile/offline/esm2022/public_api.mjs +0 -7
  1039. package/mobile/offline/esm2022/services/change-log.service.mjs +0 -332
  1040. package/mobile/offline/esm2022/services/local-db-data-pull.service.mjs +0 -525
  1041. package/mobile/offline/esm2022/services/local-db-management.service.mjs +0 -855
  1042. package/mobile/offline/esm2022/services/local-db.service.mjs +0 -193
  1043. package/mobile/offline/esm2022/services/local-key-value.service.mjs +0 -87
  1044. package/mobile/offline/esm2022/services/push.service.mjs +0 -49
  1045. package/mobile/offline/esm2022/services/workers/error-blocker.mjs +0 -115
  1046. package/mobile/offline/esm2022/services/workers/file-handler.mjs +0 -162
  1047. package/mobile/offline/esm2022/services/workers/id-resolver.mjs +0 -154
  1048. package/mobile/offline/esm2022/services/workers/multi-part-param-transformer.mjs +0 -63
  1049. package/mobile/offline/esm2022/utils/file-upload.utils.mjs +0 -59
  1050. package/mobile/offline/esm2022/utils/live-variable.utils.mjs +0 -232
  1051. package/mobile/offline/esm2022/utils/query-executor.utils.mjs +0 -82
  1052. package/mobile/offline/esm2022/utils/security.utils.mjs +0 -119
  1053. package/mobile/offline/esm2022/utils/utils.mjs +0 -8
  1054. package/mobile/offline/fesm2022/index.mjs +0 -3529
  1055. package/mobile/offline/fesm2022/index.mjs.map +0 -1
  1056. package/mobile/offline/index.d.ts +0 -5
  1057. package/mobile/offline/models/config.d.ts +0 -80
  1058. package/mobile/offline/models/local-db-store.d.ts +0 -119
  1059. package/mobile/offline/offline.module.d.ts +0 -17
  1060. package/mobile/offline/package.json +0 -28
  1061. package/mobile/offline/public_api.d.ts +0 -6
  1062. package/mobile/offline/services/change-log.service.d.ts +0 -112
  1063. package/mobile/offline/services/local-db-data-pull.service.d.ts +0 -139
  1064. package/mobile/offline/services/local-db-management.service.d.ts +0 -179
  1065. package/mobile/offline/services/local-db.service.d.ts +0 -83
  1066. package/mobile/offline/services/local-key-value.service.d.ts +0 -38
  1067. package/mobile/offline/services/push.service.d.ts +0 -11
  1068. package/mobile/offline/services/workers/error-blocker.d.ts +0 -26
  1069. package/mobile/offline/services/workers/file-handler.d.ts +0 -56
  1070. package/mobile/offline/services/workers/id-resolver.d.ts +0 -26
  1071. package/mobile/offline/services/workers/multi-part-param-transformer.d.ts +0 -11
  1072. package/mobile/offline/utils/file-upload.utils.d.ts +0 -14
  1073. package/mobile/offline/utils/live-variable.utils.d.ts +0 -24
  1074. package/mobile/offline/utils/query-executor.utils.d.ts +0 -15
  1075. package/mobile/offline/utils/security.utils.d.ts +0 -19
  1076. package/mobile/offline/utils/utils.d.ts +0 -2
  1077. package/mobile/placeholder/runtime/.npmignore +0 -2
  1078. package/mobile/placeholder/runtime/bundles/index.umd.js +0 -70
  1079. package/mobile/placeholder/runtime/components/app-ext.component.d.ts +0 -5
  1080. package/mobile/placeholder/runtime/esm2022/components/app-ext.component.mjs +0 -19
  1081. package/mobile/placeholder/runtime/esm2022/index.mjs +0 -5
  1082. package/mobile/placeholder/runtime/esm2022/mobile-runtime.module.mjs +0 -27
  1083. package/mobile/placeholder/runtime/esm2022/public_api.mjs +0 -3
  1084. package/mobile/placeholder/runtime/fesm2022/index.mjs +0 -50
  1085. package/mobile/placeholder/runtime/fesm2022/index.mjs.map +0 -1
  1086. package/mobile/placeholder/runtime/index.d.ts +0 -5
  1087. package/mobile/placeholder/runtime/mobile-runtime.module.d.ts +0 -9
  1088. package/mobile/placeholder/runtime/package.json +0 -27
  1089. package/mobile/placeholder/runtime/public_api.d.ts +0 -2
  1090. package/mobile/placeholder/runtime-dynamic/.npmignore +0 -2
  1091. package/mobile/placeholder/runtime-dynamic/bundles/index.umd.js +0 -40
  1092. package/mobile/placeholder/runtime-dynamic/esm2022/index.mjs +0 -5
  1093. package/mobile/placeholder/runtime-dynamic/esm2022/mobile-runtime-dynamic.module.mjs +0 -13
  1094. package/mobile/placeholder/runtime-dynamic/esm2022/public_api.mjs +0 -2
  1095. package/mobile/placeholder/runtime-dynamic/fesm2022/index.mjs +0 -20
  1096. package/mobile/placeholder/runtime-dynamic/fesm2022/index.mjs.map +0 -1
  1097. package/mobile/placeholder/runtime-dynamic/index.d.ts +0 -5
  1098. package/mobile/placeholder/runtime-dynamic/mobile-runtime-dynamic.module.d.ts +0 -7
  1099. package/mobile/placeholder/runtime-dynamic/package.json +0 -23
  1100. package/mobile/placeholder/runtime-dynamic/public_api.d.ts +0 -1
  1101. package/mobile/runtime/.npmignore +0 -2
  1102. package/mobile/runtime/bundles/index.umd.js +0 -732
  1103. package/mobile/runtime/components/app-ext.component.d.ts +0 -14
  1104. package/mobile/runtime/esm2022/components/app-ext.component.mjs +0 -59
  1105. package/mobile/runtime/esm2022/index.mjs +0 -5
  1106. package/mobile/runtime/esm2022/mobile-runtime.module.mjs +0 -351
  1107. package/mobile/runtime/esm2022/public_api.mjs +0 -6
  1108. package/mobile/runtime/esm2022/services/cookie.service.mjs +0 -135
  1109. package/mobile/runtime/esm2022/services/http-interceptor.service.mjs +0 -147
  1110. package/mobile/runtime/esm2022/services/webprocess.service.mjs +0 -76
  1111. package/mobile/runtime/fesm2022/index.mjs +0 -742
  1112. package/mobile/runtime/fesm2022/index.mjs.map +0 -1
  1113. package/mobile/runtime/index.d.ts +0 -5
  1114. package/mobile/runtime/mobile-runtime.module.d.ts +0 -51
  1115. package/mobile/runtime/package.json +0 -28
  1116. package/mobile/runtime/public_api.d.ts +0 -5
  1117. package/mobile/runtime/services/cookie.service.d.ts +0 -31
  1118. package/mobile/runtime/services/http-interceptor.service.d.ts +0 -19
  1119. package/mobile/runtime/services/webprocess.service.d.ts +0 -15
  1120. package/mobile/runtime-dynamic/.npmignore +0 -2
  1121. package/mobile/runtime-dynamic/bundles/index.umd.js +0 -461
  1122. package/mobile/runtime-dynamic/esm2022/index.mjs +0 -5
  1123. package/mobile/runtime-dynamic/esm2022/mobile-runtime-dynamic.module.mjs +0 -48
  1124. package/mobile/runtime-dynamic/esm2022/public_api.mjs +0 -2
  1125. package/mobile/runtime-dynamic/esm2022/services/live-sync.service.mjs +0 -404
  1126. package/mobile/runtime-dynamic/fesm2022/index.mjs +0 -454
  1127. package/mobile/runtime-dynamic/fesm2022/index.mjs.map +0 -1
  1128. package/mobile/runtime-dynamic/index.d.ts +0 -5
  1129. package/mobile/runtime-dynamic/mobile-runtime-dynamic.module.d.ts +0 -8
  1130. package/mobile/runtime-dynamic/package.json +0 -23
  1131. package/mobile/runtime-dynamic/public_api.d.ts +0 -1
  1132. package/mobile/runtime-dynamic/services/live-sync.service.d.ts +0 -38
  1133. package/mobile/variables/.npmignore +0 -2
  1134. package/mobile/variables/bundles/index.umd.js +0 -1166
  1135. package/mobile/variables/esm2022/index.mjs +0 -5
  1136. package/mobile/variables/esm2022/public_api.mjs +0 -10
  1137. package/mobile/variables/esm2022/services/calendar-service.mjs +0 -77
  1138. package/mobile/variables/esm2022/services/camera-service.mjs +0 -70
  1139. package/mobile/variables/esm2022/services/contacts-service.mjs +0 -74
  1140. package/mobile/variables/esm2022/services/datasync-service.mjs +0 -363
  1141. package/mobile/variables/esm2022/services/device-service/device-service.mjs +0 -161
  1142. package/mobile/variables/esm2022/services/device-service/location-service.mjs +0 -200
  1143. package/mobile/variables/esm2022/services/file-service.mjs +0 -87
  1144. package/mobile/variables/esm2022/services/scan-service.mjs +0 -60
  1145. package/mobile/variables/esm2022/variables.module.mjs +0 -78
  1146. package/mobile/variables/fesm2022/index.mjs +0 -1143
  1147. package/mobile/variables/fesm2022/index.mjs.map +0 -1
  1148. package/mobile/variables/index.d.ts +0 -5
  1149. package/mobile/variables/package.json +0 -28
  1150. package/mobile/variables/public_api.d.ts +0 -9
  1151. package/mobile/variables/services/calendar-service.d.ts +0 -10
  1152. package/mobile/variables/services/camera-service.d.ts +0 -8
  1153. package/mobile/variables/services/contacts-service.d.ts +0 -6
  1154. package/mobile/variables/services/datasync-service.d.ts +0 -11
  1155. package/mobile/variables/services/device-service/device-service.d.ts +0 -17
  1156. package/mobile/variables/services/device-service/location-service.d.ts +0 -63
  1157. package/mobile/variables/services/file-service.d.ts +0 -7
  1158. package/mobile/variables/services/scan-service.d.ts +0 -7
  1159. package/mobile/variables/variables.module.d.ts +0 -25
  1160. package/oAuth/esm2022/oAuth.module.mjs +0 -19
  1161. package/oAuth/oAuth.module.d.ts +0 -8
  1162. package/scripts/fullcalendar/main.min.js +0 -6
  1163. package/security/esm2022/security.module.mjs +0 -19
  1164. package/security/security.module.d.ts +0 -8
  1165. package/variables/esm2022/manager/variable/device-variable-manager.mjs +0 -48
  1166. package/variables/esm2022/manager/variable/device-variable-operation.mjs +0 -2
  1167. package/variables/esm2022/manager/variable/device-variable-service.mjs +0 -45
  1168. package/variables/esm2022/model/variable/device-variable.mjs +0 -19
  1169. package/variables/esm2022/variables.module.mjs +0 -52
  1170. package/variables/manager/variable/device-variable-manager.d.ts +0 -26
  1171. package/variables/manager/variable/device-variable-operation.d.ts +0 -37
  1172. package/variables/manager/variable/device-variable-service.d.ts +0 -6
  1173. package/variables/model/variable/device-variable.d.ts +0 -6
  1174. package/variables/variables.module.d.ts +0 -16
@@ -1,3512 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@awesome-cordova-plugins/file/ngx'), require('@wm/core'), require('@wm/mobile/core'), require('@wm/security'), require('@awesome-cordova-plugins/app-version/ngx'), require('@awesome-cordova-plugins/sqlite/ngx'), require('@wm/variables'), require('lodash-es'), require('rxjs'), require('@wavemaker/variables')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common', '@awesome-cordova-plugins/file/ngx', '@wm/core', '@wm/mobile/core', '@wm/security', '@awesome-cordova-plugins/app-version/ngx', '@awesome-cordova-plugins/sqlite/ngx', '@wm/variables', 'lodash-es', 'rxjs', '@wavemaker/variables'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.mobile = global.wm.mobile || {}, global.wm.mobile.offline = {}), global.ng.core, global.ng.common, global.awesomeCordova.plugins, global.wm.core, global.wm.mobile.core, global.wm.security, global.awesomeCordova.plugins, global.awesomeCordova.plugins, global.wm.variables, global._, global.rxjs, global.wm_common_variables));
5
- })(this, (function (exports, i0, common, i3$1, i1$1, i3, i5, i1, i6, variables, lodashEs, rxjs, variables$1) { 'use strict';
6
-
7
- function _interopNamespaceDefault(e) {
8
- var n = Object.create(null);
9
- if (e) {
10
- Object.keys(e).forEach(function (k) {
11
- if (k !== 'default') {
12
- var d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: function () { return e[k]; }
16
- });
17
- }
18
- });
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
-
24
- var i0__namespace = /*#__PURE__*/_interopNamespaceDefault(i0);
25
- var i3$1__namespace = /*#__PURE__*/_interopNamespaceDefault(i3$1);
26
- var i1$1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1$1);
27
- var i3__namespace = /*#__PURE__*/_interopNamespaceDefault(i3);
28
- var i5__namespace = /*#__PURE__*/_interopNamespaceDefault(i5);
29
- var i1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1);
30
- var i6__namespace = /*#__PURE__*/_interopNamespaceDefault(i6);
31
-
32
- class LocalKeyValueService {
33
- static { this.SERVICE_NAME = 'LocalKeyValueService'; }
34
- /**
35
- * retrieves the value mapped to the key.
36
- *
37
- * @param {string} key key
38
- * @returns {object} a promise that is resolved when value is retrieved from store.
39
- */
40
- get(key) {
41
- return this.fetchEntry(key)
42
- .then(result => {
43
- let value;
44
- if (result && result.length > 0) {
45
- value = result[0].value;
46
- if (value) {
47
- value = JSON.parse(value);
48
- }
49
- }
50
- return value;
51
- });
52
- }
53
- /**
54
- * Initializes the service with the given store.
55
- *
56
- * @param {object} storeToUse a store with id, key, value with fields.
57
- * @returns {object} a promise that is resolved when data is persisted.
58
- */
59
- init(storeToUse) {
60
- this.store = storeToUse;
61
- }
62
- /**
63
- * clear data in all databases.
64
- *
65
- * @param {string} key key
66
- * @param {string} value value
67
- * @returns {object} a promise that is resolved when data is persisted.
68
- */
69
- put(key, value) {
70
- if (value) {
71
- value = JSON.stringify(value);
72
- }
73
- return this.fetchEntry(key).then(result => {
74
- if (result && result.length > 0) {
75
- return this.store.save({
76
- 'id': result[0].id,
77
- 'key': key,
78
- 'value': value
79
- });
80
- }
81
- return this.store.add({
82
- 'key': key,
83
- 'value': value
84
- });
85
- });
86
- }
87
- /**
88
- * clear data in all databases.
89
- *
90
- * @param {string} key key
91
- * @returns {object} a promise that is resolved when respective value is removed from store.
92
- */
93
- remove(key) {
94
- return this.fetchEntry(key).then(result => {
95
- if (result && result.length > 0) {
96
- return this.store.delete(result[0].id);
97
- }
98
- });
99
- }
100
- fetchEntry(key) {
101
- const filterCriteria = [{
102
- 'attributeName': 'key',
103
- 'attributeValue': key,
104
- 'attributeType': 'STRING',
105
- 'filterCondition': 'EQUALS'
106
- }];
107
- return this.store.filter(filterCriteria);
108
- }
109
- static { this.ɵfac = function LocalKeyValueService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LocalKeyValueService)(); }; }
110
- static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: LocalKeyValueService, factory: LocalKeyValueService.ɵfac, providedIn: 'root' }); }
111
- }
112
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(LocalKeyValueService, [{
113
- type: i0.Injectable,
114
- args: [{ providedIn: 'root' }]
115
- }], null, null); })();
116
-
117
- const WM_LOCAL_OFFLINE_CALL = 'WM_LOCAL_OFFLINE_CALL';
118
- const escapeName = (name) => {
119
- if (name) {
120
- name = name.replace(/"/g, '""');
121
- return '"' + name + '"';
122
- }
123
- };
124
-
125
- const insertRecordSqlTemplate = (schema) => {
126
- const columnNames = [], placeHolder = [];
127
- lodashEs.forEach(schema.columns, col => {
128
- columnNames.push(escapeName(col.name));
129
- placeHolder.push('?');
130
- });
131
- return `INSERT INTO ${escapeName(schema.name)} (${columnNames.join(',')}) VALUES (${placeHolder.join(',')})`;
132
- };
133
- const replaceRecordSqlTemplate = (schema) => {
134
- const columnNames = [], placeHolder = [];
135
- lodashEs.forEach(schema.columns, col => {
136
- columnNames.push(escapeName(col.name));
137
- placeHolder.push('?');
138
- });
139
- return `REPLACE INTO ${escapeName(schema.name)} (${columnNames.join(',')}) VALUES (${placeHolder.join(',')})`;
140
- };
141
- const deleteRecordTemplate = (schema) => {
142
- const primaryKeyField = lodashEs.find(schema.columns, 'primaryKey');
143
- if (primaryKeyField) {
144
- return `DELETE FROM ${escapeName(schema.name)} WHERE ${escapeName(primaryKeyField.name)} = ?`;
145
- }
146
- return '';
147
- };
148
- const selectSqlTemplate = (schema) => {
149
- const columns = [], joins = [];
150
- schema.columns.forEach(col => {
151
- let childTableName;
152
- columns.push(escapeName(schema.name) + '.' + escapeName(col.name) + ' as ' + col.fieldName);
153
- if (col.foreignRelations) {
154
- col.foreignRelations.forEach(foreignRelation => {
155
- childTableName = foreignRelation.sourceFieldName;
156
- lodashEs.forEach(foreignRelation.dataMapper, (childCol, childFiledName) => {
157
- columns.push(childTableName + '.' + escapeName(childCol.name) + ' as \'' + childFiledName + '\'');
158
- });
159
- joins.push(` LEFT JOIN ${escapeName(foreignRelation.targetTable)} ${childTableName}
160
- ON ${childTableName}.${escapeName(foreignRelation.targetColumn)} = ${escapeName(schema.name)}.${escapeName(col.name)}`);
161
- });
162
- }
163
- });
164
- return `SELECT ${columns.join(',')} FROM ${escapeName(schema.name)} ${joins.join(' ')}`;
165
- };
166
- const countQueryTemplate = (schema) => {
167
- const joins = [];
168
- schema.columns.forEach(col => {
169
- let childTableName;
170
- if (col.foreignRelations) {
171
- col.foreignRelations.forEach(foreignRelation => {
172
- childTableName = foreignRelation.sourceFieldName;
173
- joins.push(` LEFT JOIN ${escapeName(foreignRelation.targetTable)} ${childTableName}
174
- ON ${childTableName}.${escapeName(foreignRelation.targetColumn)} = ${escapeName(schema.name)}.${escapeName(col.name)}`);
175
- });
176
- }
177
- });
178
- return `SELECT count(*) as count FROM ${escapeName(schema.name)} ${joins.join(' ')}`;
179
- };
180
- const generateWherClause = (store, filterCriteria) => {
181
- let conditions;
182
- const fieldToColumnMapping = store.fieldToColumnMapping, tableName = store.entitySchema.name;
183
- if (!lodashEs.isEmpty(filterCriteria) && lodashEs.isString(filterCriteria)) {
184
- return ' WHERE ' + filterCriteria;
185
- }
186
- if (filterCriteria) {
187
- conditions = filterCriteria.map(filterCriterion => {
188
- const colName = fieldToColumnMapping[filterCriterion.attributeName], condition = filterCriterion.filterCondition;
189
- let target = filterCriterion.attributeValue, operator = '=';
190
- if (filterCriterion.attributeType === 'STRING') {
191
- if (condition === 'STARTING_WITH') {
192
- target = target + '%';
193
- operator = 'like';
194
- }
195
- else if (condition === 'ENDING_WITH') {
196
- target = '%' + target;
197
- operator = 'like';
198
- }
199
- else if (condition === 'CONTAINING') {
200
- target = '%' + target + '%';
201
- operator = 'like';
202
- }
203
- target = `'${target}'`;
204
- }
205
- else if (filterCriterion.attributeType === 'BOOLEAN') {
206
- target = (target === true ? 1 : 0);
207
- }
208
- return `${escapeName(tableName)}.${escapeName(colName)} ${operator} ${target}`;
209
- });
210
- }
211
- return conditions && conditions.length > 0 ? ' WHERE ' + conditions.join(' AND ') : '';
212
- };
213
- const generateOrderByClause = (store, sort) => {
214
- if (sort) {
215
- return ' ORDER BY ' + lodashEs.map(sort.split(','), field => {
216
- const splits = lodashEs.trim(field).split(' ');
217
- splits[0] = escapeName(store.entitySchema.name) + '.' + escapeName(store.fieldToColumnMapping[splits[0]]);
218
- return splits.join(' ');
219
- }).join(',');
220
- }
221
- return '';
222
- };
223
- const geneateLimitClause = page => {
224
- page = page || {};
225
- return ' LIMIT ' + (page.limit || 100) + ' OFFSET ' + (page.offset || 0);
226
- };
227
- const mapRowDataToObj = (schema, dataObj) => {
228
- schema.columns.forEach(col => {
229
- const val = dataObj[col.fieldName];
230
- if (col.foreignRelations) {
231
- col.foreignRelations.forEach(foreignRelation => {
232
- let childEntity = null;
233
- lodashEs.forEach(foreignRelation.dataMapper, function (childCol, childFieldName) {
234
- const fieldValue = dataObj[childFieldName];
235
- if (i1$1.isDefined(fieldValue) && fieldValue !== null && fieldValue !== '') {
236
- childEntity = childEntity || {};
237
- childEntity[childCol.fieldName] = dataObj[childFieldName];
238
- }
239
- delete dataObj[childFieldName];
240
- });
241
- dataObj[foreignRelation.sourceFieldName] = childEntity;
242
- });
243
- }
244
- else if (col.sqlType === 'boolean' && !lodashEs.isNil(val)) {
245
- dataObj[col.fieldName] = (val === 1);
246
- }
247
- });
248
- return dataObj;
249
- };
250
- const getValue = (entity, col) => {
251
- let value = entity[col.fieldName];
252
- if (col.foreignRelations) {
253
- col.foreignRelations.some(foreignRelation => {
254
- if (foreignRelation.targetEntity && entity[foreignRelation.sourceFieldName]) {
255
- value = entity[foreignRelation.sourceFieldName][foreignRelation.targetFieldName];
256
- return true;
257
- }
258
- return false;
259
- });
260
- }
261
- if (lodashEs.isNil(value)) {
262
- return col.defaultValue;
263
- }
264
- else if (col.sqlType === 'boolean') {
265
- return (value === true ? 1 : 0);
266
- }
267
- else {
268
- return value;
269
- }
270
- };
271
- const mapObjToRow = (store, entity) => {
272
- const row = {};
273
- store.entitySchema.columns.forEach(col => row[col.name] = getValue(entity, col));
274
- return row;
275
- };
276
- class LocalDBStore {
277
- constructor(deviceFileService, entitySchema, file, localDbManagementService, sqliteObject) {
278
- this.deviceFileService = deviceFileService;
279
- this.entitySchema = entitySchema;
280
- this.file = file;
281
- this.localDbManagementService = localDbManagementService;
282
- this.sqliteObject = sqliteObject;
283
- this.fieldToColumnMapping = {};
284
- this.primaryKeyField = lodashEs.find(this.entitySchema.columns, 'primaryKey');
285
- this.primaryKeyName = this.primaryKeyField ? this.primaryKeyField.fieldName : undefined;
286
- this.entitySchema.columns.forEach(c => {
287
- this.fieldToColumnMapping[c.fieldName] = c.name;
288
- if (c.foreignRelations) {
289
- c.foreignRelations.forEach(foreignRelation => {
290
- this.fieldToColumnMapping[foreignRelation.targetPath] = c.name;
291
- lodashEs.forEach(foreignRelation.dataMapper, (childCol, childFieldName) => {
292
- this.fieldToColumnMapping[childFieldName] = foreignRelation.sourceFieldName + '.' + childCol.name;
293
- });
294
- });
295
- }
296
- });
297
- this.insertRecordSqlTemplate = insertRecordSqlTemplate(this.entitySchema);
298
- this.replaceRecordSqlTemplate = replaceRecordSqlTemplate(this.entitySchema);
299
- this.deleteRecordTemplate = deleteRecordTemplate(this.entitySchema);
300
- this.selectSqlTemplate = selectSqlTemplate(this.entitySchema);
301
- this.countQuery = countQueryTemplate(this.entitySchema);
302
- }
303
- add(entity) {
304
- if (this.primaryKeyName) {
305
- const idValue = entity[this.primaryKeyName];
306
- if (this.primaryKeyField.sqlType === 'number'
307
- && (!i1$1.isDefined(idValue) || (lodashEs.isString(idValue) && lodashEs.isEmpty(lodashEs.trim(idValue))))) {
308
- if (this.primaryKeyField.generatorType === 'identity') {
309
- // updating the id with the latest id obtained from nextId.
310
- entity[this.primaryKeyName] = this.localDbManagementService.nextIdCount();
311
- }
312
- else {
313
- // for assigned type, get the primaryKeyValue from the relatedTableData which is inside the entity
314
- const primaryKeyValue = this.getValue(entity, this.primaryKeyName);
315
- entity[this.primaryKeyName] = primaryKeyValue;
316
- }
317
- }
318
- }
319
- const rowData = mapObjToRow(this, entity);
320
- const params = this.entitySchema.columns.map(f => rowData[f.name]);
321
- return this.sqliteObject.executeSql(this.insertRecordSqlTemplate, params)
322
- .then(result => result.insertId);
323
- }
324
- /**
325
- * clears all data of this store.
326
- * @returns {object} promise
327
- */
328
- clear() {
329
- return this.sqliteObject.executeSql('DELETE FROM ' + escapeName(this.entitySchema.name));
330
- }
331
- /**
332
- * creates the stores if it does not exist
333
- * @returns {Promise<any>}
334
- */
335
- create() {
336
- return this.sqliteObject.executeSql(this.createTableSql(this.entitySchema)).then(() => this);
337
- }
338
- /**
339
- * counts the number of records that satisfy the given filter criteria.
340
- * @param {FilterCriterion[]} filterCriteria
341
- * @returns {object} promise that is resolved with count
342
- */
343
- count(filterCriteria) {
344
- const sql = this.countQuery + generateWherClause(this, filterCriteria);
345
- return this.sqliteObject.executeSql(sql).then(result => result.rows.item(0)['count']);
346
- }
347
- /**
348
- * This function deserializes the given map object to FormData, provided that map object was
349
- * serialized by using serialize method of this store.
350
- * @param {object} map object to deserialize
351
- * @returns {object} promise that is resolved with the deserialized FormData.
352
- */
353
- deserialize(map) {
354
- return this.deserializeMapToFormData(map);
355
- }
356
- /**
357
- * filters data of this store that statisfy the given filter criteria.
358
- * @param {FilterCriterion[]} filterCriteria
359
- * @param {string=} sort ex: 'filedname asc/desc'
360
- * @param {object=} page {'offset' : 0, "limit" : 20}
361
- * @returns {object} promise that is resolved with the filtered data.
362
- */
363
- filter(filterCriteria, sort, page) {
364
- let sql = this.selectSqlTemplate;
365
- sql += generateWherClause(this, filterCriteria);
366
- sql += generateOrderByClause(this, sort);
367
- sql += geneateLimitClause(page);
368
- return this.sqliteObject.executeSql(sql)
369
- .then(result => {
370
- const objArr = [], rowCount = result.rows.length;
371
- for (let i = 0; i < rowCount; i++) {
372
- objArr.push(mapRowDataToObj(this.entitySchema, result.rows.item(i)));
373
- }
374
- return objArr;
375
- });
376
- }
377
- // fetches all the data related to the primaryKey
378
- refresh(data) {
379
- const primaryKeyName = this.primaryKeyName;
380
- const primaryKey = this.getValue(data, primaryKeyName);
381
- if (!primaryKey) {
382
- return Promise.resolve(data);
383
- }
384
- return this.get(primaryKey);
385
- }
386
- /**
387
- * deletes the record with the given primary key.
388
- * @param {object} primaryKey primary key of the record
389
- * @returns {object} promise
390
- */
391
- delete(primaryKey) {
392
- return this.sqliteObject.executeSql(this.deleteRecordTemplate, [primaryKey]);
393
- }
394
- /**
395
- * finds the record with the given primary key.
396
- * @param {object} primaryKey primary key of the record
397
- * @returns {object} promise that is resolved with entity
398
- */
399
- get(primaryKey) {
400
- const filterCriteria = [{
401
- attributeName: this.primaryKeyName,
402
- filterCondition: '=',
403
- attributeValue: primaryKey,
404
- attributeType: this.primaryKeyField.sqlType.toUpperCase()
405
- }];
406
- return this.filter(filterCriteria).then(function (obj) {
407
- return obj && obj.length === 1 ? obj[0] : undefined;
408
- });
409
- }
410
- /**
411
- * retrieve the value for the given field.
412
- *
413
- * @param entity
414
- * @param {string} fieldName
415
- * @returns {undefined | any | number}
416
- */
417
- getValue(entity, fieldName) {
418
- const column = this.entitySchema.columns.find(col => col.fieldName === fieldName);
419
- return getValue(entity, column);
420
- }
421
- /**
422
- * saves the given entity to the store. If the record is not available, then a new record will be created.
423
- * @param {object} entity the entity to save
424
- * @returns {object} promise
425
- */
426
- save(entity) {
427
- return this.saveAll([entity]);
428
- }
429
- /**
430
- * saves the given entity to the store. If the record is not available, then a new record will be created.
431
- * @param {object} entities the entity to save
432
- * @returns {object} promise
433
- */
434
- saveAll(entities) {
435
- // filtering the null entities
436
- entities = lodashEs.filter(entities, null);
437
- const queries = lodashEs.map(entities, entity => {
438
- const rowData = mapObjToRow(this, entity);
439
- const params = this.entitySchema.columns.map(f => rowData[f.name]);
440
- return [this.replaceRecordSqlTemplate, params];
441
- });
442
- return this.sqliteObject.sqlBatch(queries);
443
- }
444
- /**
445
- * Based on this store columns, this function converts the given FormData to a map object.
446
- * Multipart file is stored as a local file. If form data cannot be serialized,
447
- * then formData is returned back.
448
- * @param {FormData} formData object to serialize
449
- * @returns {object} promise that is resolved with a map.
450
- */
451
- serialize(formData) {
452
- return this.serializeFormDataToMap(formData);
453
- }
454
- /**
455
- * Save blob to a local file
456
- * @param blob
457
- * @returns {*}
458
- */
459
- saveBlobToFile(blob) {
460
- const fileName = this.deviceFileService.appendToFileName(blob.name), uploadDir = this.deviceFileService.getUploadDirectory();
461
- return this.file.writeFile(uploadDir, fileName, blob).then(function () {
462
- return {
463
- 'name': blob.name,
464
- 'type': blob.type,
465
- 'lastModified': blob.lastModified,
466
- 'lastModifiedDate': blob.lastModifiedDate,
467
- 'size': blob.size,
468
- 'wmLocalPath': uploadDir + '/' + fileName
469
- };
470
- });
471
- }
472
- /**
473
- * Converts form data object to map for storing request in local database..
474
- */
475
- serializeFormDataToMap(formData) {
476
- const blobColumns = lodashEs.filter(this.entitySchema.columns, {
477
- 'sqlType': 'blob'
478
- }), promises = [];
479
- let map = {};
480
- if (formData && typeof formData.append === 'function' && formData.rowData) {
481
- lodashEs.forEach(formData.rowData, (fieldData, fieldName) => {
482
- if (fieldData && lodashEs.find(blobColumns, { 'fieldName': fieldName })) {
483
- promises.push(this.saveBlobToFile(fieldData).then(localFile => {
484
- map[fieldName] = localFile;
485
- }));
486
- }
487
- else {
488
- map[fieldName] = fieldData;
489
- }
490
- });
491
- }
492
- else {
493
- map = formData;
494
- }
495
- return Promise.all(promises).then(() => map);
496
- }
497
- /**
498
- * Converts map object back to form data.
499
- */
500
- deserializeMapToFormData(map) {
501
- const formData = new FormData(), blobColumns = this.entitySchema.columns.filter(c => c.sqlType === 'blob'), promises = [];
502
- lodashEs.forEach(blobColumns, column => {
503
- const value = map[column.fieldName];
504
- if (value && value.wmLocalPath) {
505
- promises.push(i1$1.convertToBlob(value.wmLocalPath)
506
- .then(result => formData.append(column.fieldName, result.blob, value.name)));
507
- map[column.fieldName] = '';
508
- }
509
- });
510
- formData.append(variables.SWAGGER_CONSTANTS.WM_DATA_JSON, new Blob([JSON.stringify(map)], {
511
- type: 'application/json'
512
- }));
513
- return Promise.all(promises).then(() => formData);
514
- }
515
- createTableSql(schema) {
516
- // @ts-ignore
517
- const fieldStr = lodashEs.reduce(schema.columns, (result, f) => {
518
- let str = escapeName(f.name);
519
- if (f.primaryKey) {
520
- if (f.sqlType === 'number' && f.generatorType === 'databaseIdentity') {
521
- str += ' INTEGER PRIMARY KEY AUTOINCREMENT';
522
- }
523
- else {
524
- str += ' PRIMARY KEY';
525
- }
526
- }
527
- return result ? result + ',' + str : str;
528
- }, false);
529
- return `CREATE TABLE IF NOT EXISTS ${escapeName(schema.name)} (${fieldStr})`;
530
- }
531
- }
532
-
533
- class DBInfo {
534
- constructor() {
535
- this.schema = {
536
- name: '',
537
- isInternal: false,
538
- entities: new Map()
539
- };
540
- this.stores = new Map();
541
- this.queries = new Map();
542
- }
543
- }
544
- class ColumnInfo {
545
- constructor(name, fieldName) {
546
- this.name = name;
547
- this.fieldName = fieldName;
548
- this.primaryKey = false;
549
- this.fieldName = this.fieldName || this.name;
550
- }
551
- }
552
- var PullType;
553
- (function (PullType) {
554
- PullType["LIVE"] = "LIVE";
555
- PullType["BUNDLED"] = "BUNDLED";
556
- PullType["APP_START"] = "APP_START";
557
- })(PullType || (PullType = {}));
558
-
559
- const NEXT_ID_COUNT = 'localDBStore.nextIdCount';
560
- const META_LOCATION = 'www/metadata/app';
561
- const OFFLINE_WAVEMAKER_DATABASE_SCHEMA = {
562
- name: 'wavemaker',
563
- version: 1,
564
- isInternal: true,
565
- tables: [
566
- {
567
- name: 'key_value',
568
- entityName: 'key-value',
569
- columns: [{
570
- fieldName: 'id',
571
- name: 'id',
572
- generatorType: 'databaseIdentity',
573
- sqlType: 'number',
574
- primaryKey: true
575
- }, {
576
- fieldName: 'key',
577
- name: 'key'
578
- }, {
579
- name: 'value',
580
- fieldName: 'value'
581
- }]
582
- },
583
- {
584
- name: 'offlineChangeLog',
585
- entityName: 'offlineChangeLog',
586
- columns: [{
587
- fieldName: 'id',
588
- name: 'id',
589
- generatorType: 'databaseIdentity',
590
- sqlType: 'number',
591
- primaryKey: true
592
- }, {
593
- name: 'service',
594
- fieldName: 'service'
595
- }, {
596
- name: 'operation',
597
- fieldName: 'operation'
598
- }, {
599
- name: 'params',
600
- fieldName: 'params'
601
- }, {
602
- name: 'timestamp',
603
- fieldName: 'timestamp'
604
- }, {
605
- name: 'hasError',
606
- fieldName: 'hasError'
607
- }, {
608
- name: 'errorMessage',
609
- fieldName: 'errorMessage'
610
- }]
611
- }
612
- ]
613
- };
614
- class LocalDBManagementService {
615
- static { this.SERVICE_NAME = 'LocalDBManagementService'; }
616
- constructor(appVersion, deviceService, deviceFileService, file, localKeyValueService, securityService, sqlite) {
617
- this.appVersion = appVersion;
618
- this.deviceService = deviceService;
619
- this.deviceFileService = deviceFileService;
620
- this.file = file;
621
- this.localKeyValueService = localKeyValueService;
622
- this.securityService = securityService;
623
- this.sqlite = sqlite;
624
- this.callbacks = [];
625
- this._logSql = false;
626
- this.nextId = 100000000000;
627
- this.systemProperties = {
628
- 'USER_ID': {
629
- 'name': 'USER_ID',
630
- 'value': () => this.securityService.getLoggedInUser().then(userInfo => userInfo.userId)
631
- },
632
- 'USER_NAME': {
633
- 'name': 'USER_NAME',
634
- 'value': () => this.securityService.getLoggedInUser().then(userInfo => userInfo.userName)
635
- },
636
- 'DATE_TIME': {
637
- 'name': 'DATE_TIME',
638
- 'value': () => moment().format('YYYY-MM-DDThh:mm:ss')
639
- },
640
- 'DATE': {
641
- 'name': 'CURRENT_DATE',
642
- 'value': () => moment().format('YYYY-MM-DD')
643
- },
644
- 'TIME': {
645
- 'name': 'TIME',
646
- 'value': () => moment().format('hh:mm:ss')
647
- }
648
- };
649
- }
650
- /**
651
- * Closes all databases.
652
- *
653
- * @returns {object} a promise.
654
- */
655
- close() {
656
- return new Promise((resolve, reject) => {
657
- // Before closing databases, give some time for the pending transactions (if any).
658
- setTimeout(() => {
659
- // @ts-ignore
660
- const closePromises = lodashEs.map(lodashEs.values(this.databases), db => db.sqliteObject.close());
661
- Promise.all(closePromises).then(resolve, reject);
662
- }, 1000);
663
- });
664
- }
665
- nextIdCount() {
666
- this.nextId = this.nextId + 1;
667
- this.localKeyValueService.put(NEXT_ID_COUNT, this.nextId);
668
- return this.nextId;
669
- }
670
- /**
671
- * Executes a named query.
672
- *
673
- * @param {string} dbName name of database on which the named query has to be run
674
- * @param {string} queryName name of the query to execute
675
- * @param {object} params parameters required for query.
676
- * @returns {object} a promise.
677
- */
678
- executeNamedQuery(dbName, queryName, params) {
679
- let queryData, paramPromises;
680
- if (!this.databases[dbName] || !this.databases[dbName].queries[queryName]) {
681
- return Promise.reject(`Query by name ' ${queryName} ' Not Found`);
682
- }
683
- queryData = this.databases[dbName].queries[queryName];
684
- paramPromises = lodashEs.chain(queryData.params)
685
- .filter(p => p.variableType !== 'PROMPT')
686
- .forEach(p => {
687
- const paramValue = this.systemProperties[p.variableType].value(p.name, params);
688
- return i1$1.toPromise(paramValue).then(v => params[p.name] = v);
689
- }).value();
690
- return Promise.all(paramPromises).then(() => {
691
- params = lodashEs.map(queryData.params, p => {
692
- // Sqlite will accept DateTime value as below format.
693
- if (typeof params[p.name] !== 'string'
694
- && (p.type === i1$1.DataType.DATETIME || p.type === i1$1.DataType.LOCALDATETIME)) {
695
- return variables.formatDate(params[p.name], p.type);
696
- }
697
- // sqlite accepts the bool val as 1,0 hence convert the boolean value to number
698
- if (p.type === i1$1.DataType.BOOLEAN) {
699
- return this.convertBoolToInt(params[p.name]);
700
- }
701
- return params[p.name];
702
- });
703
- return this.executeSQLQuery(dbName, queryData.query, params)
704
- .then(result => {
705
- let firstRow, needTransform;
706
- if (!lodashEs.isEmpty(result.rows)) {
707
- firstRow = result.rows[0];
708
- needTransform = lodashEs.find(queryData.response.properties, p => !firstRow.hasOwnProperty(p.fieldName));
709
- if (!lodashEs.isUndefined(needTransform)) {
710
- result.rows = lodashEs.map(result.rows, row => {
711
- const transformedRow = {}, rowWithUpperKeys = {};
712
- // This is to make search for data as case-insensitive
713
- lodashEs.forEach(row, (v, k) => rowWithUpperKeys[k.toUpperCase()] = v);
714
- lodashEs.forEach(queryData.response.properties, p => {
715
- // format the value depending on the typeRef specified in properties.
716
- const propType = i1$1.extractType(p.fieldType.typeRef);
717
- i1$1.DEFAULT_FORMATS[lodashEs.toUpper(propType)];
718
- const fieldVal = row[p.name];
719
- if (fieldVal && typeof fieldVal !== 'string'
720
- && (propType === i1$1.DataType.DATETIME || propType === i1$1.DataType.LOCALDATETIME || propType === i1$1.DataType.DATE)) {
721
- if (moment(fieldVal).isValid()) {
722
- row[p.name] = variables.formatDate(fieldVal, propType);
723
- }
724
- else if (moment(fieldVal, 'HH:mm').isValid()) {
725
- // if the value is in HH:mm:ss format, it returns a wrong date. So append the date to the given value to get date
726
- row[p.name] = moment().format('YYYY-MM-DD') + 'T' + fieldVal;
727
- }
728
- }
729
- if (propType === i1$1.DataType.BOOLEAN) {
730
- row[p.name] = this.convertIntToBool(fieldVal);
731
- }
732
- rowWithUpperKeys[p.nameInUpperCase] = row[p.name];
733
- transformedRow[p.name] = row[p.name];
734
- transformedRow[p.fieldName] = row[p.fieldName] || rowWithUpperKeys[p.nameInUpperCase];
735
- });
736
- return transformedRow;
737
- });
738
- }
739
- }
740
- return result;
741
- });
742
- });
743
- }
744
- /**
745
- * This function will export the databases in a zip format.
746
- *
747
- * @returns {object} a promise that is resolved when zip is created.
748
- */
749
- exportDB() {
750
- return new Promise((resolve, reject) => {
751
- const folderToExport = 'offline_temp_' + lodashEs.now(), folderToExportFullPath = cordova.file.cacheDirectory + folderToExport + '/', zipFileName = '_offline_data.zip', metaInfo = {
752
- app: null,
753
- OS: '',
754
- createdOn: 0
755
- };
756
- let zipDirectory;
757
- if (i1$1.isIos()) {
758
- // In IOS, save zip to documents directory so that user can export the file from IOS devices using iTUNES.
759
- zipDirectory = cordova.file.documentsDirectory;
760
- }
761
- else {
762
- // In Android, save zip to download directory.
763
- zipDirectory = cordova.file.externalRootDirectory + 'Download/';
764
- }
765
- // Create a temporary folder to copy all the content to export
766
- this.file.createDir(cordova.file.cacheDirectory, folderToExport, false)
767
- .then(() => {
768
- // Copy databases to temporary folder for export
769
- return this.file.copyDir(this.dbInstallParentDirectory, this.dbInstallDirectoryName, folderToExportFullPath, 'databases')
770
- .then(() => {
771
- // Prepare meta info to identify the zip and other info
772
- return this.getAppInfo();
773
- }).then(appInfo => {
774
- metaInfo.app = appInfo;
775
- if (i1$1.isIos()) {
776
- metaInfo.OS = 'IOS';
777
- }
778
- else if (i1$1.isAndroid()) {
779
- metaInfo.OS = 'ANDROID';
780
- }
781
- metaInfo.createdOn = lodashEs.now();
782
- return metaInfo;
783
- }).then(() => i1$1.executePromiseChain(this.getCallbacksFor('preExport'), [folderToExportFullPath, metaInfo]))
784
- .then(() => {
785
- // Write meta data to META.json
786
- return this.file.writeFile(folderToExportFullPath, 'META.json', JSON.stringify(metaInfo));
787
- });
788
- }).then(() => {
789
- // Prepare name to use for the zip.
790
- let appName = metaInfo.app.name;
791
- appName = appName.replace(/\s+/g, '_');
792
- return this.deviceFileService.newFileName(zipDirectory, appName + zipFileName)
793
- .then(fileName => {
794
- // Zip the temporary folder for export
795
- return new Promise((rs, re) => {
796
- Zeep.zip({
797
- from: folderToExportFullPath,
798
- to: zipDirectory + fileName
799
- }, () => rs(zipDirectory + fileName), re);
800
- });
801
- });
802
- }).then(resolve, reject)
803
- .catch(i1$1.noop).then(() => {
804
- // Remove temporary folder for export
805
- return this.deviceFileService.removeDir(cordova.file.cacheDirectory + folderToExport);
806
- });
807
- });
808
- }
809
- /**
810
- * returns store bound to the dataModelName and entityName.
811
- *
812
- * @param dataModelName
813
- * @param entityName
814
- * @returns {*}
815
- */
816
- getStore(dataModelName, entityName) {
817
- return new Promise((resolve, reject) => {
818
- if (this.databases[dataModelName]) {
819
- resolve(this.databases[dataModelName].stores[entityName]);
820
- }
821
- reject(`store with name'${entityName}' in datamodel '${dataModelName}' is not found`);
822
- });
823
- }
824
- /**
825
- * This function will replace the databases with the files provided in zip. If import gets failed,
826
- * then app reverts back to use old databases.
827
- *
828
- * @param {string} zipPath location of the zip file.
829
- * @param {boolean} revertIfFails If true, then a backup is created and when import fails, backup is reverted back.
830
- * @returns {object} a promise that is resolved when zip is created.
831
- */
832
- importDB(zipPath, revertIfFails) {
833
- return new Promise((resolve, reject) => {
834
- const importFolder = 'offline_temp_' + lodashEs.now(), importFolderFullPath = cordova.file.cacheDirectory + importFolder + '/';
835
- let zipMeta;
836
- // Create a temporary folder to unzip the contents of the zip.
837
- this.file.createDir(cordova.file.cacheDirectory, importFolder, false)
838
- .then(() => {
839
- return new Promise((rs, re) => {
840
- // Unzip to temporary location
841
- Zeep.unzip({
842
- from: zipPath,
843
- to: importFolderFullPath
844
- }, rs, re);
845
- });
846
- }).then(() => {
847
- /*
848
- * read meta data and allow import only package name of the app from which this zip is created
849
- * and the package name of this app are same.
850
- */
851
- return this.file.readAsText(importFolderFullPath, 'META.json')
852
- .then(text => {
853
- zipMeta = JSON.parse(text);
854
- return this.getAppInfo();
855
- }).then(appInfo => {
856
- if (!zipMeta.app) {
857
- return Promise.reject('meta information is not found in zip');
858
- }
859
- if (zipMeta.app.packageName !== appInfo.packageName) {
860
- return Promise.reject('database zip of app with same package name can only be imported');
861
- }
862
- });
863
- }).then(() => {
864
- let backupZip;
865
- return this.close()
866
- .then(() => {
867
- if (revertIfFails) {
868
- // create backup
869
- return this.exportDB()
870
- .then(path => backupZip = path);
871
- }
872
- }).then(() => {
873
- // delete existing databases
874
- return this.deviceFileService.removeDir(this.dbInstallDirectory);
875
- }).then(() => {
876
- // copy imported databases
877
- return this.file.copyDir(importFolderFullPath, 'databases', this.dbInstallParentDirectory, this.dbInstallDirectoryName);
878
- }).then(() => {
879
- // reload databases
880
- this.databases = null;
881
- return this.loadDatabases();
882
- }).then(() => i1$1.executePromiseChain(this.getCallbacksFor('postImport'), [importFolderFullPath, zipMeta]))
883
- .then(() => {
884
- if (backupZip) {
885
- return this.deviceFileService.removeFile(backupZip);
886
- }
887
- }, (reason) => {
888
- if (backupZip) {
889
- return this.importDB(backupZip, false)
890
- .then(() => {
891
- this.deviceFileService.removeFile(backupZip);
892
- return Promise.reject(reason);
893
- });
894
- }
895
- return Promise.reject(reason);
896
- });
897
- }).then(resolve, reject)
898
- .catch(i1$1.noop)
899
- .then(() => {
900
- return this.deviceFileService.removeDir(cordova.file.cacheDirectory + importFolder);
901
- });
902
- });
903
- }
904
- /**
905
- * @param {string} dataModelName Name of the data model
906
- * @param {string} entityName Name of the entity
907
- * @param {string} operation Name of the operation (READ, INSERT, UPDATE, DELETE)
908
- * @returns {boolean} returns true, if the given operation can be performed as per configuration.
909
- */
910
- isOperationAllowed(dataModelName, entityName, operation) {
911
- return this.getStore(dataModelName, entityName).then(store => {
912
- if (!store) {
913
- return false;
914
- }
915
- if (operation === 'READ') {
916
- return store.entitySchema.pushConfig.readEnabled;
917
- }
918
- if (operation === 'INSERT') {
919
- return store.entitySchema.pushConfig.insertEnabled;
920
- }
921
- if (operation === 'UPDATE') {
922
- return store.entitySchema.pushConfig.updateEnabled;
923
- }
924
- if (operation === 'DELETE') {
925
- return store.entitySchema.pushConfig.deleteEnabled;
926
- }
927
- return false;
928
- }).catch(() => {
929
- return false;
930
- });
931
- }
932
- loadDatabases() {
933
- let newDatabasesCreated = false;
934
- if (this.databases) {
935
- return Promise.resolve(this.databases);
936
- }
937
- else {
938
- if (i1$1.isIos()) {
939
- this.dbInstallDirectoryName = 'LocalDatabase';
940
- this.dbInstallParentDirectory = cordova.file.applicationStorageDirectory + 'Library/';
941
- }
942
- else {
943
- this.dbInstallDirectoryName = 'databases';
944
- this.dbInstallParentDirectory = cordova.file.applicationStorageDirectory;
945
- }
946
- this.dbInstallDirectory = this.dbInstallParentDirectory + this.dbInstallDirectoryName;
947
- this.databases = new Map();
948
- return this.setUpDatabases()
949
- .then(flag => newDatabasesCreated = flag)
950
- .then(() => this.loadDBSchemas())
951
- .then(metadata => this.loadNamedQueries(metadata))
952
- .then(metadata => this.loadOfflineConfig(metadata))
953
- .then(metadata => {
954
- return Promise.all(lodashEs.map(metadata, dbMetadata => {
955
- return this.openDatabase(dbMetadata)
956
- .then(database => {
957
- this.databases[dbMetadata.schema.name] = database;
958
- });
959
- }));
960
- }).then(() => {
961
- return this.getStore('wavemaker', 'key-value').then(store => {
962
- this.localKeyValueService.init(store);
963
- return this.localKeyValueService.get(NEXT_ID_COUNT).then(val => {
964
- this.nextId = val || this.nextId;
965
- });
966
- });
967
- }).then(() => {
968
- if (newDatabasesCreated) {
969
- return this.normalizeData()
970
- .then(() => this.disableForeignKeys())
971
- .then(() => this.deviceService.getAppBuildTime())
972
- .then(dbSeedCreationTime => {
973
- return i1$1.executePromiseChain(lodashEs.map(this.callbacks, 'onDbCreate'), [{
974
- 'databases': this.databases,
975
- 'dbCreatedOn': lodashEs.now(),
976
- 'dbSeedCreatedOn': dbSeedCreationTime
977
- }]);
978
- }).then(() => this.databases);
979
- }
980
- else {
981
- return this.databases;
982
- }
983
- });
984
- }
985
- }
986
- /**
987
- * using this function one can listen events such as onDbCreate, 'preExport' and 'postImport'.
988
- *
989
- * @param {object} listener an object with functions mapped to event names.
990
- */
991
- registerCallback(listener) {
992
- this.callbacks.push(listener);
993
- }
994
- setLogSQl(flag) {
995
- this._logSql = flag;
996
- }
997
- /**
998
- * Deletes any existing databases (except wavemaker db) and copies the databases that are packaged with the app.
999
- *
1000
- * @returns {*}
1001
- */
1002
- cleanAndCopyDatabases() {
1003
- const dbSeedFolder = cordova.file.applicationDirectory + META_LOCATION;
1004
- return this.file.createDir(this.dbInstallParentDirectory, this.dbInstallDirectoryName, false)
1005
- .catch(i1$1.noop)
1006
- .then(() => this.deviceFileService.listFiles(this.dbInstallDirectory, /.+\.db$/))
1007
- .then(files => {
1008
- if (files && files.length > 0) {
1009
- return Promise.all(files.map(f => {
1010
- if (f['name'] !== 'wavemaker.db') {
1011
- return this.file.removeFile(this.dbInstallDirectory, f['name']);
1012
- }
1013
- }));
1014
- }
1015
- })
1016
- .then(() => this.deviceFileService.listFiles(dbSeedFolder, /.+\.db$/))
1017
- .then(files => {
1018
- if (files && files.length > 0) {
1019
- return this.file.createDir(this.dbInstallParentDirectory, this.dbInstallDirectoryName, false)
1020
- .catch(i1$1.noop)
1021
- .then(() => Promise.all(files.map(f => this.file.copyFile(dbSeedFolder, f['name'], this.dbInstallDirectory, f['name']))));
1022
- }
1023
- });
1024
- }
1025
- // Picks essential details from the given schema.
1026
- compactEntitySchema(schema, entity, transformedSchemas) {
1027
- const reqEntity = transformedSchemas[entity['entityName']];
1028
- reqEntity.entityName = entity['entityName'];
1029
- reqEntity.name = entity['name'];
1030
- reqEntity.columns = [];
1031
- entity.columns.forEach(col => {
1032
- let defaultValue = col.columnValue ? col.columnValue.defaultValue : '';
1033
- const type = col.sqlType;
1034
- if (type === 'number' && !col.primaryKey) {
1035
- defaultValue = lodashEs.isEmpty(defaultValue) ? null : lodashEs.parseInt(defaultValue);
1036
- }
1037
- else if (type === 'boolean') {
1038
- defaultValue = lodashEs.isEmpty(defaultValue) ? null : (defaultValue === 'true' ? 1 : 0);
1039
- }
1040
- else {
1041
- defaultValue = lodashEs.isEmpty(defaultValue) ? null : defaultValue;
1042
- }
1043
- reqEntity.columns.push({
1044
- name: col['name'],
1045
- fieldName: col['fieldName'],
1046
- generatorType: col['generatorType'],
1047
- sqlType: col['sqlType'],
1048
- primaryKey: col['primaryKey'],
1049
- defaultValue: defaultValue
1050
- });
1051
- });
1052
- lodashEs.forEach(entity.relations, r => {
1053
- let targetEntitySchema, targetEntity, col, sourceColumn, mapping;
1054
- if (r.cardinality === 'ManyToOne' || r.cardinality === 'OneToOne') {
1055
- targetEntity = lodashEs.find(schema.tables, t => t.name === r.targetTable);
1056
- mapping = r.mappings[0];
1057
- if (targetEntity) {
1058
- targetEntity = targetEntity.entityName;
1059
- sourceColumn = mapping.sourceColumn;
1060
- col = reqEntity.columns.find(column => column.name === sourceColumn);
1061
- targetEntitySchema = schema.tables.find(table => table.name === r.targetTable);
1062
- const foreignRelation = {
1063
- sourceFieldName: r.fieldName,
1064
- targetEntity: targetEntity,
1065
- targetTable: r.targetTable,
1066
- targetColumn: mapping.targetColumn,
1067
- targetPath: '',
1068
- dataMapper: [],
1069
- targetFieldName: targetEntitySchema.columns.find(column => column.name === mapping.targetColumn).fieldName
1070
- };
1071
- foreignRelation.targetPath = foreignRelation.sourceFieldName + '.' + foreignRelation.targetFieldName;
1072
- // @ts-ignore
1073
- foreignRelation.dataMapper = lodashEs.chain(targetEntitySchema.columns)
1074
- .keyBy(childCol => foreignRelation.sourceFieldName + '.' + childCol.fieldName)
1075
- .mapValues(childCol => new ColumnInfo(childCol.name, childCol.fieldName)).value();
1076
- col.foreignRelations = col.foreignRelations || [];
1077
- col.foreignRelations.push(foreignRelation);
1078
- }
1079
- }
1080
- });
1081
- return reqEntity;
1082
- }
1083
- // Loads necessary details of queries
1084
- compactQueries(queriesByDB) {
1085
- const queries = new Map();
1086
- lodashEs.forEach(queriesByDB.queries, queryData => {
1087
- let query, params;
1088
- if (queryData.nativeSql && queryData.type === 'SELECT') {
1089
- query = lodashEs.isEmpty(queryData.offlineQueryString) ? queryData.queryString : queryData.offlineQueryString;
1090
- params = lodashEs.map(this.extractQueryParams(query), p => {
1091
- const paramObj = lodashEs.find(queryData.parameters, { 'name': p });
1092
- return {
1093
- name: paramObj.name,
1094
- type: paramObj.type,
1095
- variableType: paramObj.variableType
1096
- };
1097
- });
1098
- params.forEach(p => query = lodashEs.replace(query, ':' + p.name, '?'));
1099
- queries[queryData.name] = {
1100
- name: queryData.name,
1101
- query: query,
1102
- params: params,
1103
- response: {
1104
- properties: lodashEs.map(queryData.response.properties, p => {
1105
- p.nameInUpperCase = p.name.toUpperCase();
1106
- return p;
1107
- })
1108
- }
1109
- };
1110
- }
1111
- });
1112
- return queries;
1113
- }
1114
- // Loads necessary details of remote schema
1115
- compactSchema(schema) {
1116
- const dbInfo = new DBInfo();
1117
- const transformedSchemas = new Map();
1118
- schema.tables.forEach(entitySchema => {
1119
- transformedSchemas[entitySchema.entityName] = {};
1120
- });
1121
- schema.tables.forEach(entitySchema => {
1122
- this.compactEntitySchema(schema, entitySchema, transformedSchemas);
1123
- });
1124
- dbInfo.schema.name = schema.name;
1125
- dbInfo.schema.isInternal = schema.isInternal;
1126
- dbInfo.schema.entities = transformedSchemas;
1127
- return dbInfo;
1128
- }
1129
- convertBoolToInt(bool) {
1130
- return lodashEs.toString(bool) === 'true' ? 1 : 0;
1131
- }
1132
- convertIntToBool(int) {
1133
- return int ? true : false;
1134
- }
1135
- /**
1136
- * Turns off foreign keys
1137
- * @returns {*}
1138
- */
1139
- disableForeignKeys() {
1140
- // @ts-ignore
1141
- return Promise.all(lodashEs.map(this.databases, db => this.executeSQLQuery(db.schema.name, 'PRAGMA foreign_keys = OFF')));
1142
- }
1143
- /**
1144
- * Executes SQL query;
1145
- *
1146
- * @param dbName
1147
- * @param sql
1148
- * @param params
1149
- * @returns {*}
1150
- */
1151
- executeSQLQuery(dbName, sql, params, logOutput) {
1152
- const db = this.databases[dbName];
1153
- if (db) {
1154
- return db.sqliteObject.executeSql(sql, params, logOutput)
1155
- .then(result => {
1156
- const data = [], rows = result.rows;
1157
- for (let i = 0; i < rows.length; i++) {
1158
- data.push(rows.item(i));
1159
- }
1160
- return {
1161
- 'rowsAffected': result.rowsAffected,
1162
- 'rows': data
1163
- };
1164
- });
1165
- }
1166
- return Promise.reject(`No Database with name ${dbName} found`);
1167
- }
1168
- // get the params of the query or procedure.
1169
- extractQueryParams(query) {
1170
- let params, aliasParams;
1171
- aliasParams = query.match(/[^"'\w\\]:\s*\w+\s*/g) || [];
1172
- if (aliasParams.length) {
1173
- params = aliasParams.map(x => (/[=|\W]/g.test(x)) ? x.replace(/\W/g, '').trim() : x.trim());
1174
- }
1175
- else {
1176
- params = null;
1177
- }
1178
- return params;
1179
- }
1180
- /**
1181
- * Returns a promise that is resolved with application info such as packageName, appName, versionNumber, versionCode.
1182
- * @returns {*}
1183
- */
1184
- getAppInfo() {
1185
- const appInfo = {
1186
- name: '',
1187
- packageName: '',
1188
- versionNumber: '',
1189
- versionCode: null
1190
- };
1191
- return this.appVersion.getPackageName()
1192
- .then(packageName => {
1193
- appInfo.packageName = packageName;
1194
- return this.appVersion.getAppName();
1195
- }).then(appName => {
1196
- appInfo.name = appName;
1197
- return this.appVersion.getVersionNumber();
1198
- }).then(versionNumber => {
1199
- appInfo.versionNumber = versionNumber;
1200
- return this.appVersion.getVersionCode();
1201
- }).then(versionCode => {
1202
- appInfo.versionCode = versionCode;
1203
- return appInfo;
1204
- });
1205
- }
1206
- getCallbacksFor(event) {
1207
- return this.callbacks.map(c => {
1208
- if (c[event]) {
1209
- return c[event].bind(c);
1210
- }
1211
- return null;
1212
- });
1213
- }
1214
- /**
1215
- * Searches for the files with given regex in 'www/metadata/app'and returns an array that contains the JSON
1216
- * content present in each file.
1217
- *
1218
- * @param {string} fileNameRegex regex pattern to search for files.
1219
- * @returns {*} A promise that is resolved with an array
1220
- */
1221
- getMetaInfo(fileNameRegex) {
1222
- const folder = cordova.file.applicationDirectory + META_LOCATION + '/';
1223
- return this.deviceFileService.listFiles(folder, fileNameRegex)
1224
- .then(files => Promise.all(lodashEs.map(files, f => {
1225
- return new Promise((resolve, reject) => {
1226
- // Cordova File reader has buffer issues with large files.
1227
- // so, using ajax to retrieve local json
1228
- $.getJSON(i1$1.transformFileURI(folder) + f['name'], data => resolve(data));
1229
- });
1230
- })));
1231
- }
1232
- /**
1233
- * Returns true, if the given entity's data is bundled along with application installer.
1234
- * @param dataModelName name of the data model
1235
- * @param entityName name of the entity
1236
- * @returns {Promise<any>}
1237
- */
1238
- isBundled(dataModelName, entityName) {
1239
- return this.getStore(dataModelName, entityName).then(store => {
1240
- return store.entitySchema.pullConfig.pullType === PullType.BUNDLED;
1241
- });
1242
- }
1243
- /**
1244
- * Loads local database schemas from *_data_model.json.
1245
- *
1246
- * @returns {*} A promise that is resolved with metadata.
1247
- */
1248
- loadDBSchemas() {
1249
- return this.getMetaInfo(/.+_dataModel\.json$/)
1250
- .then((schemas) => {
1251
- const metadata = new Map();
1252
- schemas = lodashEs.isArray(schemas) ? schemas : [schemas];
1253
- schemas.push(OFFLINE_WAVEMAKER_DATABASE_SCHEMA);
1254
- schemas.map(s => this.compactSchema(s))
1255
- .forEach(s => {
1256
- metadata[s.schema.name] = s;
1257
- });
1258
- return metadata;
1259
- });
1260
- }
1261
- /**
1262
- * Load named queries from *_query.json.
1263
- *
1264
- * @param {*} metadata
1265
- * @returns {*} A promise that is resolved with metadata
1266
- */
1267
- loadNamedQueries(metadata) {
1268
- return this.getMetaInfo(/.+_query\.json$/)
1269
- .then((queriesByDBs) => {
1270
- queriesByDBs = lodashEs.isArray(queriesByDBs) ? queriesByDBs : [queriesByDBs];
1271
- queriesByDBs.map(e => metadata[e.name].queries = this.compactQueries(e));
1272
- return metadata;
1273
- });
1274
- }
1275
- /**
1276
- * Load offline configuration from *_offline.json.
1277
- *
1278
- * @param {*} metadata
1279
- * @returns {*} A promise that is resolved with metadata
1280
- */
1281
- loadOfflineConfig(metadata) {
1282
- return this.getMetaInfo(/.+_offline\.json$/)
1283
- .then(configs => {
1284
- lodashEs.forEach(configs, config => {
1285
- // @ts-ignore
1286
- lodashEs.forEach(config.entities, entityConfig => {
1287
- // @ts-ignore
1288
- const entitySchema = lodashEs.find(metadata[config.name].schema.entities, schema => schema.name === entityConfig.name);
1289
- lodashEs.assignIn(entitySchema, entityConfig);
1290
- });
1291
- });
1292
- return metadata;
1293
- });
1294
- }
1295
- logSql(sqliteObject) {
1296
- const logger = console, originalExecuteSql = sqliteObject.executeSql;
1297
- sqliteObject.executeSql = (sql, params, logOutput) => {
1298
- const startTime = lodashEs.now();
1299
- return originalExecuteSql.call(sqliteObject, sql, params).then(result => {
1300
- if (logOutput || this._logSql) {
1301
- const objArr = [], rowCount = result.rows.length;
1302
- for (let i = 0; i < rowCount; i++) {
1303
- objArr.push(result.rows.item(i));
1304
- }
1305
- logger.debug('SQL "%s" with params %O took [%d ms]. And the result is %O', sql, params, lodashEs.now() - startTime, objArr);
1306
- }
1307
- return result;
1308
- }, error => {
1309
- logger.error('SQL "%s" with params %O failed with error message %s', sql, params, error.message);
1310
- return Promise.reject(error);
1311
- });
1312
- };
1313
- }
1314
- /**
1315
- * SQLite does not support boolean data. Instead of using boolean values, data will be changed to 0 or 1.
1316
- * If the value is 'true', then 1 is set as value. If value is not 1 nor null, then column value is set as 0.
1317
- * @param dbName
1318
- * @param tableName
1319
- * @param colName
1320
- * @returns {*}
1321
- */
1322
- normalizeBooleanData(dbName, tableName, colName) {
1323
- const trueTo1Query = `update ${escapeName(tableName)} set ${escapeName(colName)} = 1 where ${escapeName(colName)} = 'true'`, exceptNullAnd1to0Query = `update ${escapeName(tableName)} set ${escapeName(colName)} = 0
1324
- where ${escapeName(colName)} is not null and ${escapeName(colName)} != 1`;
1325
- return this.executeSQLQuery(dbName, trueTo1Query)
1326
- .then(() => this.executeSQLQuery(dbName, exceptNullAnd1to0Query));
1327
- }
1328
- /**
1329
- * Converts data to support SQLite.
1330
- * @returns {*}
1331
- */
1332
- normalizeData() {
1333
- return Promise.all(lodashEs.map(this.databases, database => {
1334
- // @ts-ignore
1335
- return Promise.all(lodashEs.map(database.schema.entities, entitySchema => {
1336
- return Promise.all(lodashEs.map(entitySchema.columns, column => {
1337
- if (column.sqlType === 'boolean') {
1338
- // @ts-ignore
1339
- return this.normalizeBooleanData(database.schema.name, entitySchema.name, column.name);
1340
- }
1341
- }));
1342
- }));
1343
- }));
1344
- }
1345
- openDatabase(database) {
1346
- return this.sqlite.create({
1347
- name: database.schema.name + '.db',
1348
- location: 'default'
1349
- }).then(sqliteObject => {
1350
- database.sqliteObject = sqliteObject;
1351
- this.logSql(sqliteObject);
1352
- const storePromises = lodashEs.map(database.schema.entities, entitySchema => {
1353
- // @ts-ignore
1354
- const store = new LocalDBStore(this.deviceFileService, entitySchema, this.file, this, sqliteObject);
1355
- return store.create();
1356
- });
1357
- return Promise.all(storePromises).then(stores => {
1358
- lodashEs.forEach(stores, store => {
1359
- database.stores[store.entitySchema.entityName] = store;
1360
- });
1361
- return database;
1362
- });
1363
- });
1364
- }
1365
- /**
1366
- * When app is opened for first time after a fresh install or update, then old databases are removed and
1367
- * new databases are created using bundled databases.
1368
- *
1369
- * @returns {*} a promise that is resolved with true, if the databases are newly created or resolved with false
1370
- * if existing databases are being used.
1371
- */
1372
- setUpDatabases() {
1373
- return this.deviceService.getAppBuildTime()
1374
- .then((buildTime) => {
1375
- const dbInfo = this.deviceService.getEntry('database') || {};
1376
- if (!dbInfo.lastBuildTime || dbInfo.lastBuildTime !== buildTime) {
1377
- return this.cleanAndCopyDatabases()
1378
- .then(() => {
1379
- dbInfo.lastBuildTime = buildTime;
1380
- return this.deviceService.storeEntry('database', dbInfo);
1381
- }).then(() => true);
1382
- }
1383
- return false;
1384
- });
1385
- }
1386
- static { this.ɵfac = function LocalDBManagementService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LocalDBManagementService)(i0__namespace.ɵɵinject(i1__namespace.AppVersion), i0__namespace.ɵɵinject(i3__namespace.DeviceService), i0__namespace.ɵɵinject(i3__namespace.DeviceFileService), i0__namespace.ɵɵinject(i3$1__namespace.File), i0__namespace.ɵɵinject(LocalKeyValueService), i0__namespace.ɵɵinject(i5__namespace.SecurityService), i0__namespace.ɵɵinject(i6__namespace.SQLite)); }; }
1387
- static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: LocalDBManagementService, factory: LocalDBManagementService.ɵfac, providedIn: 'root' }); }
1388
- }
1389
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(LocalDBManagementService, [{
1390
- type: i0.Injectable,
1391
- args: [{ providedIn: 'root' }]
1392
- }], () => [{ type: i1__namespace.AppVersion }, { type: i3__namespace.DeviceService }, { type: i3__namespace.DeviceFileService }, { type: i3$1__namespace.File }, { type: LocalKeyValueService }, { type: i5__namespace.SecurityService }, { type: i6__namespace.SQLite }], null); })();
1393
-
1394
- class PushService {
1395
- }
1396
- const CONTEXT_KEY = 'changeLogService.flushContext';
1397
- const LAST_PUSH_INFO_KEY = 'changeLogService.lastPushInfo';
1398
- class ChangeLogService {
1399
- static { this.SERVICE_NAME = 'ChangeLogService'; }
1400
- constructor(localDBManagementService, localKeyValueService, pushService, networkService) {
1401
- this.localDBManagementService = localDBManagementService;
1402
- this.localKeyValueService = localKeyValueService;
1403
- this.pushService = pushService;
1404
- this.networkService = networkService;
1405
- this.workers = [];
1406
- this.currentPushInfo = {};
1407
- this.addWorker(new FlushTracker(this, this.localKeyValueService, this.currentPushInfo));
1408
- }
1409
- /**
1410
- * adds a service call to the log. Call will be invoked in next flush.
1411
- *
1412
- * @Param {string} name of service (This should be available through $injector)
1413
- * @Param {string} name of method to invoke.
1414
- * @Param {object} params
1415
- */
1416
- add(service, operation, params) {
1417
- const change = {
1418
- service: service,
1419
- operation: operation,
1420
- params: params,
1421
- hasError: 0
1422
- };
1423
- return i1$1.executePromiseChain(this.getWorkers('transformParamsToMap'), [change])
1424
- .then(() => i1$1.executePromiseChain(this.getWorkers('onAddCall'), [change]))
1425
- .then(() => {
1426
- change.params = JSON.stringify(change.params);
1427
- return this.getStore().then(store => store.add(change)).then(i1$1.noop);
1428
- });
1429
- }
1430
- addWorker(worker) {
1431
- this.workers.push(worker);
1432
- }
1433
- /**
1434
- * Clears the current log.
1435
- */
1436
- clearLog() {
1437
- return this.getStore().then(s => s.clear());
1438
- }
1439
- /**
1440
- * Flush the current log. If a flush is already running, then the promise of that flush is returned back.
1441
- */
1442
- flush(progressObserver) {
1443
- let flushPromise;
1444
- if (!this.deferredFlush) {
1445
- this.deferredFlush = i1$1.getAbortableDefer();
1446
- this.createContext().then(context => {
1447
- this.flushContext = context;
1448
- return i1$1.executePromiseChain(this.getWorkers('preFlush'), [this.flushContext]);
1449
- })
1450
- .then(() => {
1451
- flushPromise = this._flush(progressObserver);
1452
- this.deferredFlush.onAbort = () => flushPromise.abort();
1453
- return flushPromise;
1454
- })
1455
- .catch(i1$1.noop)
1456
- .then(() => {
1457
- Promise.resolve().then(() => {
1458
- if (this.currentPushInfo.totalTaskCount === this.currentPushInfo.completedTaskCount) {
1459
- return this.flushContext.clear().then(() => this.flushContext = null);
1460
- }
1461
- }).then(() => {
1462
- progressObserver.complete();
1463
- if (this.currentPushInfo.failedTaskCount > 0) {
1464
- this.deferredFlush.reject(this.currentPushInfo);
1465
- }
1466
- else {
1467
- this.deferredFlush.resolve(this.currentPushInfo);
1468
- }
1469
- this.deferredFlush = null;
1470
- }).then(() => {
1471
- return i1$1.executePromiseChain(this.getWorkers('postFlush'), [this.currentPushInfo, this.flushContext]);
1472
- });
1473
- });
1474
- }
1475
- return this.deferredFlush.promise;
1476
- }
1477
- /**
1478
- * Returns the complete change list
1479
- */
1480
- getChanges() {
1481
- return this.getStore().then(s => s.filter(undefined, 'id', {
1482
- offset: 0,
1483
- limit: 500
1484
- })).then(changes => {
1485
- changes.forEach(change => {
1486
- change.params = JSON.parse(change.params);
1487
- });
1488
- return changes;
1489
- });
1490
- }
1491
- /**
1492
- * @returns {array} an array of changes that failed with error.
1493
- */
1494
- getErrors() {
1495
- return this.getStore().then(s => s.filter([{
1496
- attributeName: 'hasError',
1497
- attributeValue: 1,
1498
- attributeType: 'NUMBER',
1499
- filterCondition: 'EQUALS'
1500
- }]));
1501
- }
1502
- getLastPushInfo() {
1503
- return this.localKeyValueService.get(LAST_PUSH_INFO_KEY)
1504
- .then(info => {
1505
- if (lodashEs.isString(info.startTime)) {
1506
- info.startTime = new Date(info.startTime);
1507
- }
1508
- if (lodashEs.isString(info.endTime)) {
1509
- info.endTime = new Date(info.endTime);
1510
- }
1511
- return info;
1512
- });
1513
- }
1514
- /**
1515
- * @returns {number} number of changes that are pending to push.
1516
- */
1517
- getLogLength() {
1518
- return this.getStore().then(s => s.count([{
1519
- attributeName: 'hasError',
1520
- attributeValue: 0,
1521
- attributeType: 'NUMBER',
1522
- filterCondition: 'EQUALS'
1523
- }]));
1524
- }
1525
- /*
1526
- * Retrieves the entity store to use by ChangeLogService.
1527
- */
1528
- getStore() {
1529
- return this.localDBManagementService.getStore('wavemaker', 'offlineChangeLog');
1530
- }
1531
- /**
1532
- * Returns true, if a flush process is in progress. Otherwise, returns false.
1533
- *
1534
- * @returns {boolean} returns true, if a flush process is in progress. Otherwise, returns false.
1535
- */
1536
- isFlushInProgress() {
1537
- return !(lodashEs.isUndefined(this.deferredFlush) || lodashEs.isNull(this.deferredFlush));
1538
- }
1539
- /**
1540
- * Stops the ongoing flush process.
1541
- *
1542
- * @returns {object} a promise that is resolved when the flush process is stopped.
1543
- */
1544
- stop() {
1545
- return new Promise(resolve => {
1546
- if (this.deferredFlush) {
1547
- this.deferredFlush.promise.catch().then(resolve);
1548
- this.deferredFlush.promise.abort();
1549
- }
1550
- else {
1551
- resolve();
1552
- }
1553
- });
1554
- }
1555
- createContext() {
1556
- return this.localKeyValueService.get(CONTEXT_KEY)
1557
- .then(context => {
1558
- context = context || {};
1559
- return {
1560
- 'clear': () => {
1561
- context = {};
1562
- return this.localKeyValueService.remove(CONTEXT_KEY);
1563
- },
1564
- 'get': key => {
1565
- let value = context[key];
1566
- if (!value) {
1567
- value = {};
1568
- context[key] = value;
1569
- }
1570
- return value;
1571
- },
1572
- 'save': () => this.localKeyValueService.put(CONTEXT_KEY, context)
1573
- };
1574
- });
1575
- }
1576
- // Flushes the complete log one after another.
1577
- _flush(progressObserver, defer) {
1578
- defer = defer || i1$1.getAbortableDefer();
1579
- if (defer.isAborted) {
1580
- return Promise.resolve();
1581
- }
1582
- this.getNextChange()
1583
- .then(change => {
1584
- if (change) {
1585
- change.params = JSON.parse(change.params);
1586
- return this.flushChange(change);
1587
- }
1588
- })
1589
- .then(change => {
1590
- progressObserver.next(this.currentPushInfo);
1591
- if (change) {
1592
- return this.getStore()
1593
- .then(s => s.delete(change.id))
1594
- .then(() => this._flush(progressObserver, defer));
1595
- }
1596
- else {
1597
- defer.resolve();
1598
- }
1599
- }, change => {
1600
- if (this.networkService.isConnected()) {
1601
- change.hasError = 1;
1602
- change.params = JSON.stringify(change.params);
1603
- this.getStore()
1604
- .then(s => s.save(change))
1605
- .then(() => this._flush(progressObserver, defer));
1606
- }
1607
- else {
1608
- let connectPromise = this.networkService.onConnect();
1609
- defer.promise.catch(function () {
1610
- if (connectPromise) {
1611
- connectPromise.abort();
1612
- }
1613
- });
1614
- connectPromise.then(() => {
1615
- this._flush(progressObserver, defer);
1616
- connectPromise = null;
1617
- });
1618
- }
1619
- });
1620
- return defer.promise;
1621
- }
1622
- flushChange(change) {
1623
- const self = this;
1624
- return i1$1.executePromiseChain(this.getWorkers('preCall'), [change])
1625
- .then(() => change.hasError ? Promise.reject(change.errorMessage) : '')
1626
- .then(() => i1$1.executePromiseChain(this.getWorkers('transformParamsFromMap'), [change]))
1627
- .then(() => this.pushService.push(change))
1628
- .then(function () {
1629
- return i1$1.executePromiseChain(lodashEs.reverse(self.getWorkers('postCallSuccess')), [change, arguments])
1630
- .then(() => change);
1631
- }).catch(function () {
1632
- if (self.networkService.isConnected()) {
1633
- return i1$1.executePromiseChain(lodashEs.reverse(self.getWorkers('postCallError')), [change, arguments])
1634
- .catch(i1$1.noop).then(() => Promise.reject(change));
1635
- }
1636
- return Promise.reject(change);
1637
- });
1638
- }
1639
- // Flushes the first registered change.
1640
- getNextChange() {
1641
- const filterCriteria = [{
1642
- attributeName: 'hasError',
1643
- attributeValue: 0,
1644
- attributeType: 'NUMBER',
1645
- filterCondition: 'EQUALS'
1646
- }];
1647
- return this.getStore().then(s => s.filter(filterCriteria, 'id', {
1648
- offset: 0,
1649
- limit: 1
1650
- })).then((changes) => {
1651
- return changes && changes[0];
1652
- });
1653
- }
1654
- getWorkers(type) {
1655
- return lodashEs.map(this.workers, w => w[type] && w[type].bind(w));
1656
- }
1657
- static { this.ɵfac = function ChangeLogService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ChangeLogService)(i0__namespace.ɵɵinject(LocalDBManagementService), i0__namespace.ɵɵinject(LocalKeyValueService), i0__namespace.ɵɵinject(PushService), i0__namespace.ɵɵinject(i3__namespace.NetworkService)); }; }
1658
- static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: ChangeLogService, factory: ChangeLogService.ɵfac, providedIn: 'root' }); }
1659
- }
1660
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(ChangeLogService, [{
1661
- type: i0.Injectable,
1662
- args: [{ providedIn: 'root' }]
1663
- }], () => [{ type: LocalDBManagementService }, { type: LocalKeyValueService }, { type: PushService }, { type: i3__namespace.NetworkService }], null); })();
1664
- class FlushTracker {
1665
- constructor(changeLogService, localKeyValueService, pushInfo) {
1666
- this.changeLogService = changeLogService;
1667
- this.localKeyValueService = localKeyValueService;
1668
- this.pushInfo = pushInfo;
1669
- this.logger = window.console;
1670
- }
1671
- onAddCall(change) {
1672
- this.logger.debug('Added the following call %o to log.', change);
1673
- }
1674
- preFlush(flushContext) {
1675
- this.pushInfo.totalTaskCount = 0;
1676
- this.pushInfo.successfulTaskCount = 0;
1677
- this.pushInfo.failedTaskCount = 0;
1678
- this.pushInfo.completedTaskCount = 0;
1679
- this.pushInfo.inProgress = true;
1680
- this.pushInfo.startTime = new Date();
1681
- this.flushContext = flushContext;
1682
- this.logger.debug('Starting flush');
1683
- return this.changeLogService.getStore().then(store => {
1684
- return store.count([{
1685
- attributeName: 'hasError',
1686
- attributeValue: 0,
1687
- attributeType: 'NUMBER',
1688
- filterCondition: 'EQUALS'
1689
- }]);
1690
- }).then(count => this.pushInfo.totalTaskCount = count);
1691
- }
1692
- postFlush(stats, flushContext) {
1693
- this.logger.debug('flush completed. {Success : %i , Error : %i , completed : %i, total : %i }.', this.pushInfo.successfulTaskCount, this.pushInfo.failedTaskCount, this.pushInfo.completedTaskCount, this.pushInfo.totalTaskCount);
1694
- this.pushInfo.inProgress = false;
1695
- this.pushInfo.endTime = new Date();
1696
- this.localKeyValueService.put(LAST_PUSH_INFO_KEY, this.pushInfo);
1697
- this.flushContext = null;
1698
- }
1699
- preCall(change) {
1700
- this.logger.debug('%i. Invoking call %o', (1 + this.pushInfo.completedTaskCount), change);
1701
- }
1702
- postCallError(change, response) {
1703
- this.pushInfo.completedTaskCount++;
1704
- this.pushInfo.failedTaskCount++;
1705
- this.logger.error('call failed with the response %o.', response);
1706
- return this.flushContext.save();
1707
- }
1708
- postCallSuccess(change, response) {
1709
- this.pushInfo.completedTaskCount++;
1710
- this.pushInfo.successfulTaskCount++;
1711
- this.logger.debug('call returned the following response %o.', response);
1712
- return this.flushContext.save();
1713
- }
1714
- }
1715
-
1716
- class LocalDbService {
1717
- static { this.SERVICE_NAME = 'LocalDbService'; }
1718
- constructor(localDBManagementService) {
1719
- this.localDBManagementService = localDBManagementService;
1720
- this.searchTableData = this.readTableData.bind(this);
1721
- this.searchTableDataWithQuery = this.readTableData.bind(this);
1722
- this.getDistinctDataByFields = this.readTableData.bind(this);
1723
- }
1724
- getStore(params) {
1725
- return this.localDBManagementService.getStore(params.dataModelName, params.entityName);
1726
- }
1727
- /**
1728
- * Method to insert data into the specified table. This modification will be added to offline change log.
1729
- *
1730
- * @param {object} params
1731
- * Object containing name of the project & table data to be inserted.
1732
- * @param {function=} successCallback
1733
- * Callback function to be triggered on success.
1734
- * @param {function=} failureCallback
1735
- * Callback function to be triggered on failure.
1736
- */
1737
- insertTableData(params, successCallback, failureCallback, options = {}) {
1738
- this.getStore(params).then(store => {
1739
- const isPKAutoIncremented = (store.primaryKeyField && store.primaryKeyField.generatorType === 'identity');
1740
- if (lodashEs.get(options, 'resetPrimaryKey') !== false && isPKAutoIncremented && params.data[store.primaryKeyName]) {
1741
- delete params.data[store.primaryKeyName];
1742
- }
1743
- return store.add(params.data).then(() => {
1744
- store.refresh(params.data).then(successCallback);
1745
- });
1746
- }).catch(failureCallback);
1747
- }
1748
- /**
1749
- * Method to insert multi part data into the specified table. This modification will be added to offline change log.
1750
- *
1751
- * @param {object} params
1752
- * Object containing name of the project & table data to be inserted.
1753
- * @param {function=} successCallback
1754
- * Callback function to be triggered on success.
1755
- * @param {function=} failureCallback
1756
- * Callback function to be triggered on failure.
1757
- */
1758
- insertMultiPartTableData(params, successCallback, failureCallback, options = {}) {
1759
- this.getStore(params).then(store => {
1760
- store.serialize(params.data).then(data => {
1761
- params.data = data;
1762
- this.insertTableData(params, successCallback, failureCallback, options);
1763
- });
1764
- }).catch(failureCallback);
1765
- }
1766
- /**
1767
- * Method to update data in the specified table. This modification will be added to offline change log.
1768
- *
1769
- * @param {object} params
1770
- * Object containing name of the project & table data to be updated.
1771
- * @param {function=} successCallback
1772
- * Callback function to be triggered on success.
1773
- * @param {function=} failureCallback
1774
- * Callback function to be triggered on failure.
1775
- */
1776
- updateTableData(params, successCallback, failureCallback) {
1777
- this.getStore(params).then(store => {
1778
- return store.save(params.data)
1779
- .then(() => {
1780
- store.refresh(params.data).then(successCallback);
1781
- });
1782
- }).catch(failureCallback);
1783
- }
1784
- /**
1785
- * Method to update multi part data in the specified table. This modification will be added to offline change log.
1786
- *
1787
- * @param {object} params
1788
- * Object containing name of the project & table data to be updated.
1789
- * @param {function=} successCallback
1790
- * Callback function to be triggered on success.
1791
- * @param {function=} failureCallback
1792
- * Callback function to be triggered on failure.
1793
- */
1794
- updateMultiPartTableData(params, successCallback, failureCallback) {
1795
- const data = (params.data && params.data.rowData) || params.data;
1796
- this.getStore(params).then(store => {
1797
- return store.save(data);
1798
- }).then(() => {
1799
- if (successCallback) {
1800
- successCallback(data);
1801
- }
1802
- }).catch(failureCallback);
1803
- }
1804
- /**
1805
- * Method to delete data in the specified table. This modification will be added to offline change log.
1806
- *
1807
- * @param {object} params
1808
- * Object containing name of the project & table data to be inserted.
1809
- * @param {function=} successCallback
1810
- * Callback function to be triggered on success.
1811
- * @param {function=} failureCallback
1812
- * Callback function to be triggered on failure.
1813
- */
1814
- deleteTableData(params, successCallback, failureCallback) {
1815
- this.getStore(params).then(store => {
1816
- const pkField = store.primaryKeyField, id = params[pkField.fieldName] || params[pkField.name] || (params.data && params.data[pkField.fieldName]) || params.id;
1817
- store.delete(id).then(successCallback);
1818
- }).catch(failureCallback);
1819
- }
1820
- /**
1821
- * Method to read data from a specified table.
1822
- *
1823
- * @param {object} params
1824
- * Object containing name of the project & table data to be inserted.
1825
- * @param {function=} successCallback
1826
- * Callback function to be triggered on success.
1827
- * @param {function=} failureCallback
1828
- * Callback function to be triggered on failure.
1829
- */
1830
- readTableData(params, successCallback, failureCallback) {
1831
- this.getStore(params).then(store => {
1832
- let filter = params.filter((filterGroup, filterFields) => {
1833
- this.convertFieldNameToColumnName(store, filterGroup, filterFields);
1834
- }, true);
1835
- // convert wm_bool function with boolean value to 0/1
1836
- filter = filter.replace(/wm_bool\('true'\)/g, 1).replace(/wm_bool\('false'\)/g, 0);
1837
- return store.count(filter).then(totalElements => {
1838
- const sort = params.sort.split('=')[1];
1839
- return store.filter(filter, sort, {
1840
- offset: (params.page - 1) * params.size,
1841
- limit: params.size
1842
- }).then(data => {
1843
- const totalPages = Math.ceil(totalElements / params.size);
1844
- successCallback({
1845
- 'content': data,
1846
- 'first': (params.page === 1),
1847
- 'last': (params.page === totalPages),
1848
- 'number': (params.page - 1),
1849
- 'numberOfElements': data.length,
1850
- 'size': params.size,
1851
- 'sort': {
1852
- 'sorted': !!sort,
1853
- 'unsorted': !sort
1854
- },
1855
- 'totalElements': totalElements,
1856
- 'totalPages': totalPages
1857
- });
1858
- });
1859
- });
1860
- }).catch(failureCallback);
1861
- }
1862
- escapeName(name) {
1863
- if (name) {
1864
- name = name.replace(/"/g, '""');
1865
- return '"' + name.replace(/\./g, '"."') + '"';
1866
- }
1867
- return name;
1868
- }
1869
- // returns the columnName appending with the schema name.
1870
- getColumnName(store, fieldName) {
1871
- if (store.fieldToColumnMapping[fieldName]) {
1872
- const columnName = this.escapeName(store.fieldToColumnMapping[fieldName]);
1873
- if (columnName.indexOf('.') < 0) {
1874
- return this.escapeName(store.entitySchema.name) + '.' + columnName;
1875
- }
1876
- return columnName;
1877
- }
1878
- return fieldName;
1879
- }
1880
- convertFieldNameToColumnName(store, filterGroup, options) {
1881
- lodashEs.forEach(filterGroup.rules, rule => {
1882
- if (rule.rules) {
1883
- this.convertFieldNameToColumnName(store, rule);
1884
- }
1885
- else {
1886
- rule.target = this.getColumnName(store, rule.target);
1887
- }
1888
- });
1889
- // handling the scenario where variable options can have filterField. For example: search filter query
1890
- if (options && options.filterFields) {
1891
- options.filterFields = lodashEs.mapKeys(options.filterFields, (v, k) => {
1892
- return this.getColumnName(store, k);
1893
- });
1894
- }
1895
- }
1896
- static { this.ɵfac = function LocalDbService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LocalDbService)(i0__namespace.ɵɵinject(LocalDBManagementService)); }; }
1897
- static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: LocalDbService, factory: LocalDbService.ɵfac, providedIn: 'root' }); }
1898
- }
1899
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(LocalDbService, [{
1900
- type: i0.Injectable,
1901
- args: [{ providedIn: 'root' }]
1902
- }], () => [{ type: LocalDBManagementService }], null); })();
1903
-
1904
- const STORE_KEY$2 = 'offlineFileUpload';
1905
- class FileHandler {
1906
- constructor() {
1907
- this.logger = window.console;
1908
- }
1909
- preFlush(context) {
1910
- this.fileStore = context.get(STORE_KEY$2);
1911
- }
1912
- /**
1913
- * Replaces all local paths with the remote path using mappings created during 'uploadToServer'.
1914
- */
1915
- preCall(change) {
1916
- if (change.service === 'DatabaseService') {
1917
- change.params.data = lodashEs.mapValues(change.params.data, v => {
1918
- const remoteUrl = this.fileStore[v];
1919
- if (remoteUrl) {
1920
- this.logger.debug('swapped file path from %s -> %s', v, remoteUrl);
1921
- return remoteUrl;
1922
- }
1923
- return v;
1924
- });
1925
- }
1926
- }
1927
- postCallSuccess(change, response) {
1928
- if (change.service === 'OfflineFileUploadService'
1929
- && change.operation === 'uploadToServer') {
1930
- const remoteFile = JSON.parse(response[0].text)[0];
1931
- /*
1932
- * A mapping will be created between local path and remote path.
1933
- * This will be used to resolve local paths in entities.
1934
- */
1935
- this.fileStore[change.params.file] = remoteFile.path;
1936
- this.fileStore[change.params.file + '?inline'] = remoteFile.inlinePath;
1937
- }
1938
- }
1939
- }
1940
- class UploadedFilesImportAndExportService {
1941
- constructor(changeLogService, deviceFileService, localDBManagementService, file) {
1942
- this.changeLogService = changeLogService;
1943
- this.deviceFileService = deviceFileService;
1944
- this.localDBManagementService = localDBManagementService;
1945
- this.file = file;
1946
- }
1947
- preExport(folderToExport, meta) {
1948
- // copy offline uploads
1949
- const uploadFullPath = this.deviceFileService.getUploadDirectory(), lastIndexOfSep = uploadFullPath.lastIndexOf('/'), uploadParentDir = uploadFullPath.substring(0, lastIndexOfSep + 1), uploadDirName = uploadFullPath.substring(lastIndexOfSep + 1);
1950
- meta.uploadDir = uploadFullPath;
1951
- return this.file.copyDir(uploadParentDir, uploadDirName, folderToExport, 'uploads');
1952
- }
1953
- postImport(importedFolder, meta) {
1954
- const uploadFullPath = this.deviceFileService.getUploadDirectory(), lastIndexOfSep = uploadFullPath.lastIndexOf('/'), uploadParentDir = uploadFullPath.substring(0, lastIndexOfSep + 1), uploadDirName = uploadFullPath.substring(lastIndexOfSep + 1);
1955
- this.uploadDir = uploadFullPath;
1956
- return this.file.checkDir(importedFolder, 'uploads')
1957
- .then(() => {
1958
- return this.deviceFileService.removeDir(uploadFullPath)
1959
- .then(() => this.file.copyDir(importedFolder, 'uploads', uploadParentDir, uploadDirName))
1960
- .then(() => this.updateChanges(meta));
1961
- }, i1$1.noop);
1962
- }
1963
- /**
1964
- * returns back the changes that were logged.
1965
- * @param page page number
1966
- * @param size size of page
1967
- * @returns {*}
1968
- */
1969
- getChanges(page, size) {
1970
- return this.changeLogService.getStore().then(strore => {
1971
- return (strore.filter([], 'id', {
1972
- offset: (page - 1) * size,
1973
- limit: size
1974
- }));
1975
- });
1976
- }
1977
- /**
1978
- * If this is a database change, then it will replace old upload directory with the current upload directory
1979
- * and its corresponding owner object, if it has primary key.
1980
- *
1981
- * @param change
1982
- * @param oldUploadDir
1983
- * @param uploadDir
1984
- * @returns {*}
1985
- */
1986
- updateDBChange(change, oldUploadDir, uploadDir) {
1987
- const modifiedProperties = {}, entityName = change.params.entityName, dataModelName = change.params.dataModelName;
1988
- change.params.data = lodashEs.mapValues(change.params.data, function (v, k) {
1989
- let mv = v, isModified = false;
1990
- if (lodashEs.isString(v)) {
1991
- mv = lodashEs.replace(v, oldUploadDir, uploadDir);
1992
- isModified = !lodashEs.isEqual(mv, v);
1993
- }
1994
- else { // @ts-ignore
1995
- if (lodashEs.isObject(v) && v.wmLocalPath) {
1996
- // insertMultiPartData and updateMultiPartData
1997
- // @ts-ignore
1998
- mv = lodashEs.replace(v.wmLocalPath, oldUploadDir, uploadDir);
1999
- // @ts-ignore
2000
- isModified = !lodashEs.isEqual(mv, v.wmLocalPath);
2001
- }
2002
- }
2003
- if (isModified) {
2004
- modifiedProperties[k] = mv;
2005
- }
2006
- return mv;
2007
- });
2008
- if (!lodashEs.isEmpty(modifiedProperties)) {
2009
- this.localDBManagementService.getStore(dataModelName, entityName)
2010
- .then(store => {
2011
- // If there is a primary for the entity, then update actual row with the modifications
2012
- if (store.primaryKeyField && store.primaryKeyField.generatorType === 'identity') {
2013
- const primaryKeyName = store.primaryKeyName;
2014
- const primaryKey = change.params.data[primaryKeyName];
2015
- return store.get(primaryKey)
2016
- .then(obj => store.save(lodashEs.assignIn(obj, modifiedProperties)));
2017
- }
2018
- }).then(() => {
2019
- change.params = JSON.stringify(change.params);
2020
- return this.changeLogService.getStore().then(store => store.save(change));
2021
- });
2022
- }
2023
- }
2024
- /**
2025
- * This function check this change to update old upload directory path.
2026
- *
2027
- * @param change
2028
- * @param metaInfo
2029
- * @returns {*}
2030
- */
2031
- updateChange(change, metaInfo) {
2032
- change.params = JSON.parse(change.params);
2033
- if (change.service === 'OfflineFileUploadService'
2034
- && change.operation === 'uploadToServer') {
2035
- change.params.file = lodashEs.replace(change.params.file, metaInfo.uploadDir, this.uploadDir);
2036
- change.params = JSON.stringify(change.params);
2037
- return this.changeLogService.getStore().then(store => store.save(change));
2038
- }
2039
- if (change.service === 'DatabaseService') {
2040
- return this.updateDBChange(change, metaInfo.uploadDir, this.uploadDir);
2041
- }
2042
- }
2043
- /**
2044
- * This function will visit all the changes and modify them, if necessary.
2045
- * @param metaInfo
2046
- * @param page
2047
- * @returns {*}
2048
- */
2049
- updateChanges(metaInfo, page = 1) {
2050
- const size = 10;
2051
- return this.getChanges(page, size)
2052
- .then(changes => {
2053
- if (changes && changes.length > 0) {
2054
- return Promise.all(changes.map(change => this.updateChange(change, metaInfo)));
2055
- }
2056
- }).then(result => {
2057
- if (result && result.length === size) {
2058
- return this.updateChanges(metaInfo, page + 1);
2059
- }
2060
- });
2061
- }
2062
- }
2063
-
2064
- const STORE_KEY$1 = 'errorBlockerStore';
2065
- class ErrorBlocker {
2066
- constructor(localDBManagementService) {
2067
- this.localDBManagementService = localDBManagementService;
2068
- }
2069
- preFlush(context) {
2070
- this.errorStore = context.get(STORE_KEY$1);
2071
- }
2072
- // block all calls related to the error entities
2073
- preCall(change) {
2074
- if (change && change.service === 'DatabaseService') {
2075
- const entityName = change.params.entityName;
2076
- const dataModelName = change.params.dataModelName;
2077
- switch (change.operation) {
2078
- case 'insertTableData':
2079
- case 'insertMultiPartTableData':
2080
- case 'updateTableData':
2081
- case 'updateMultiPartTableData':
2082
- return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {
2083
- this.blockCall(store, change, dataModelName, entityName, change.params.data);
2084
- });
2085
- case 'deleteTableData':
2086
- return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {
2087
- this.blockCall(store, change, dataModelName, entityName, change.params);
2088
- });
2089
- }
2090
- }
2091
- }
2092
- // store error entity id
2093
- postCallSuccess(change) {
2094
- if (change && change.service === 'DatabaseService') {
2095
- const entityName = change.params.entityName;
2096
- const dataModelName = change.params.dataModelName;
2097
- return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {
2098
- const id = change['dataLocalId'] || change.params.data[store.primaryKeyName];
2099
- if (!(lodashEs.isUndefined(id) || lodashEs.isNull(id))) {
2100
- this.removeError(dataModelName, entityName, id);
2101
- }
2102
- });
2103
- }
2104
- }
2105
- // store error entity id
2106
- postCallError(change) {
2107
- if (change && change.service === 'DatabaseService') {
2108
- const entityName = change.params.entityName;
2109
- const dataModelName = change.params.dataModelName;
2110
- return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {
2111
- const id = change['dataLocalId'] || (change.params.data && change.params.data[store.primaryKeyName]) || change.params[store.primaryKeyName] || change.params.id;
2112
- if (!(lodashEs.isUndefined(id) || lodashEs.isNull(id))) {
2113
- this.recordError(dataModelName, entityName, id);
2114
- }
2115
- });
2116
- }
2117
- }
2118
- /**
2119
- * If there is an earlier call of the object or its relations that got failed, then this call will be
2120
- * marked for discard.
2121
- *
2122
- * @param store LocalDBStore
2123
- * @param change change to block
2124
- * @param dataModelName
2125
- * @param entityName
2126
- * @param data
2127
- */
2128
- blockCall(store, change, dataModelName, entityName, data) {
2129
- if (change.hasError === 0) {
2130
- this.checkForPreviousError(store, change, dataModelName, entityName, data);
2131
- store.entitySchema.columns.forEach(col => {
2132
- if (col.foreignRelations) {
2133
- col.foreignRelations.some(foreignRelation => {
2134
- if (data[foreignRelation.sourceFieldName]) {
2135
- this.blockCall(store, change, dataModelName, foreignRelation.targetEntity, data[foreignRelation.sourceFieldName]);
2136
- }
2137
- else if (data[col.fieldName]) {
2138
- this.checkForPreviousError(store, change, dataModelName, foreignRelation.targetEntity, data, col.fieldName);
2139
- }
2140
- return change.hasError === 1;
2141
- });
2142
- }
2143
- });
2144
- }
2145
- }
2146
- // A helper function to check for earlier failures.
2147
- checkForPreviousError(store, change, dataModelName, entityName, data, key) {
2148
- const primaryKey = key || store.primaryKeyName;
2149
- if (this.hasError(dataModelName, entityName, data[primaryKey])) {
2150
- change.hasError = 1;
2151
- change.errorMessage = `Blocked call due to error in previous call of entity [ ${entityName} ] with id [ ${data[primaryKey]} ]`;
2152
- }
2153
- }
2154
- hasError(dataModelName, entityName, id) {
2155
- if (this.errorStore[dataModelName]
2156
- && this.errorStore[dataModelName][entityName]
2157
- && this.errorStore[dataModelName][entityName][id]) {
2158
- return true;
2159
- }
2160
- return false;
2161
- }
2162
- // Removes entity identifier from error list.
2163
- removeError(dataModelName, entityName, id) {
2164
- if (this.errorStore[dataModelName]
2165
- && this.errorStore[dataModelName][entityName]
2166
- && this.errorStore[dataModelName][entityName][id]) {
2167
- delete this.errorStore[dataModelName][entityName][id];
2168
- }
2169
- }
2170
- // Save error entity identifier.
2171
- recordError(dataModelName, entityName, id) {
2172
- this.errorStore[dataModelName] = this.errorStore[dataModelName] || {};
2173
- this.errorStore[dataModelName][entityName] = this.errorStore[dataModelName][entityName] || {};
2174
- this.errorStore[dataModelName][entityName][id] = true;
2175
- }
2176
- }
2177
-
2178
- const STORE_KEY = 'idConflictResolution';
2179
- /**
2180
- * In offline database, a insert could generate the Id of an entity. During flush, id of that entity might get changed.
2181
- * Due to that, relationship inconsistency arises. To prevent that, wherever this entity is referred in the next flush
2182
- * call, Id has to be replaced with that of new one.
2183
- */
2184
- class IdResolver {
2185
- constructor(localDBManagementService) {
2186
- this.localDBManagementService = localDBManagementService;
2187
- this.logger = window.console;
2188
- }
2189
- preFlush(context) {
2190
- this.idStore = context.get(STORE_KEY);
2191
- }
2192
- // Exchane Ids, Before any database operation.
2193
- preCall(change) {
2194
- if (change && change.service === 'DatabaseService') {
2195
- const entityName = change.params.entityName;
2196
- const dataModelName = change.params.dataModelName;
2197
- switch (change.operation) {
2198
- case 'insertTableData':
2199
- case 'insertMultiPartTableData':
2200
- change.params.skipLocalDB = true;
2201
- return this.localDBManagementService.getStore(dataModelName, entityName)
2202
- .then(store => {
2203
- const primaryKeyName = store.primaryKeyName;
2204
- if (primaryKeyName) {
2205
- this.transactionLocalId = change.params.data[primaryKeyName];
2206
- change['dataLocalId'] = this.transactionLocalId;
2207
- }
2208
- return this.exchangeIds(store, dataModelName, entityName, change.params.data)
2209
- .then(() => {
2210
- if (store.primaryKeyField && store.primaryKeyField.generatorType === 'identity') {
2211
- delete change.params.data[primaryKeyName];
2212
- }
2213
- else {
2214
- const relationalPrimaryKeyValue = store.getValue(change.params.data, store.primaryKeyName);
2215
- // for the data referring to the relational table based on primary key assign the primaryField values to the relationalPrimaryKeyValue
2216
- if (i1$1.isDefined(relationalPrimaryKeyValue)) {
2217
- change.params.data[primaryKeyName] = relationalPrimaryKeyValue;
2218
- if (this.transactionLocalId !== null) {
2219
- this.pushIdToStore(dataModelName, entityName, this.transactionLocalId, relationalPrimaryKeyValue);
2220
- }
2221
- }
2222
- this.transactionLocalId = null;
2223
- }
2224
- });
2225
- });
2226
- case 'updateTableData':
2227
- case 'updateMultiPartTableData':
2228
- case 'deleteTableData':
2229
- return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {
2230
- // on update call, passing id to exchangeId as change.params id(local value 10000000+) is not updated with the latest id from db
2231
- this.exchangeId(store, dataModelName, entityName, change.params, 'id');
2232
- if (change.params.data) {
2233
- return this.exchangeIds(store, dataModelName, entityName, change.params.data);
2234
- }
2235
- });
2236
- }
2237
- }
2238
- }
2239
- // After every database insert, track the Id change.
2240
- postCallSuccess(change, response) {
2241
- if (change && change.service === 'DatabaseService'
2242
- && (change.operation === 'insertTableData' || change.operation === 'insertMultiPartTableData')
2243
- && this.transactionLocalId) {
2244
- const data = response[0].body;
2245
- const entityName = change.params.entityName;
2246
- const dataModelName = change.params.dataModelName;
2247
- return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {
2248
- this.pushIdToStore(dataModelName, entityName, this.transactionLocalId, data[store.primaryKeyName]);
2249
- return store.delete(this.transactionLocalId).catch(i1$1.noop).then(() => {
2250
- this.transactionLocalId = null;
2251
- return store.save(data);
2252
- });
2253
- });
2254
- }
2255
- }
2256
- // store error entity id
2257
- postCallError(change) {
2258
- if (change && change.service === 'DatabaseService'
2259
- && (change.operation === 'insertTableData' || change.operation === 'insertMultiPartTableData')
2260
- && this.transactionLocalId) {
2261
- const entityName = change.params.entityName;
2262
- const dataModelName = change.params.dataModelName;
2263
- return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {
2264
- change.params.data[store.primaryKeyName] = this.transactionLocalId;
2265
- });
2266
- }
2267
- }
2268
- getEntityIdStore(dataModelName, entityName) {
2269
- this.idStore[dataModelName] = this.idStore[dataModelName] || {};
2270
- this.idStore[dataModelName][entityName] = this.idStore[dataModelName][entityName] || {};
2271
- return this.idStore[dataModelName][entityName];
2272
- }
2273
- // if local id is different, then create a mapping for exchange.
2274
- pushIdToStore(dataModelName, entityName, transactionLocalId, remoteId) {
2275
- if (transactionLocalId !== remoteId) {
2276
- this.getEntityIdStore(dataModelName, entityName)[transactionLocalId] = remoteId;
2277
- this.logger.debug('Conflict found for entity (%s) with local id (%i) and remote Id (%i)', entityName, transactionLocalId, remoteId);
2278
- }
2279
- }
2280
- logResolution(entityName, localId, remoteId) {
2281
- this.logger.debug('Conflict resolved found for entity (%s) with local id (%i) and remote Id (%i)', entityName, localId, remoteId);
2282
- }
2283
- // Exchange primary key of the given entity
2284
- exchangeId(store, dataModelName, entityName, data, keyName) {
2285
- const primaryKeyName = keyName || store.primaryKeyName;
2286
- const entityIdStore = this.getEntityIdStore(dataModelName, entityName);
2287
- if (data && primaryKeyName) {
2288
- const localId = data[primaryKeyName];
2289
- let remoteId = localId;
2290
- while (entityIdStore[remoteId]) {
2291
- remoteId = entityIdStore[remoteId];
2292
- }
2293
- if (remoteId !== localId) {
2294
- data[primaryKeyName] = remoteId;
2295
- this.logResolution(entityName, localId, remoteId);
2296
- }
2297
- }
2298
- }
2299
- // Looks primary key changes in the given entity or in the relations
2300
- exchangeIds(store, dataModelName, entityName, data) {
2301
- this.exchangeId(store, dataModelName, entityName, data);
2302
- const exchangeIdPromises = [];
2303
- store.entitySchema.columns.forEach(col => {
2304
- if (col.foreignRelations) {
2305
- col.foreignRelations.forEach(foreignRelation => {
2306
- if (data[col.fieldName]) { // if id value
2307
- this.exchangeId(store, dataModelName, foreignRelation.targetEntity, data, col.fieldName);
2308
- }
2309
- if (data[foreignRelation.sourceFieldName]) { // if object reference
2310
- exchangeIdPromises.push(this.localDBManagementService.getStore(dataModelName, foreignRelation.targetEntity)
2311
- .then(refStore => {
2312
- return this.exchangeIds(refStore, dataModelName, foreignRelation.targetEntity, data[foreignRelation.sourceFieldName]);
2313
- }));
2314
- }
2315
- });
2316
- }
2317
- });
2318
- return Promise.all(exchangeIdPromises);
2319
- }
2320
- static { this.ɵfac = function IdResolver_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || IdResolver)(i0__namespace.ɵɵinject(LocalDBManagementService)); }; }
2321
- static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: IdResolver, factory: IdResolver.ɵfac }); }
2322
- }
2323
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(IdResolver, [{
2324
- type: i0.Injectable
2325
- }], () => [{ type: LocalDBManagementService }], null); })();
2326
-
2327
- class MultiPartParamTransformer {
2328
- constructor(deviceFileService, localDBManagementService) {
2329
- this.deviceFileService = deviceFileService;
2330
- this.localDBManagementService = localDBManagementService;
2331
- }
2332
- postCallSuccess(change) {
2333
- if (change && change.service === 'DatabaseService') {
2334
- switch (change.operation) {
2335
- case 'insertMultiPartTableData':
2336
- case 'updateMultiPartTableData':
2337
- // clean up files
2338
- lodashEs.forEach(change.params.data, v => {
2339
- // @ts-ignore
2340
- if (lodashEs.isObject(v) && v.wmLocalPath) {
2341
- // @ts-ignore
2342
- this.deviceFileService.removeFile(v.wmLocalPath);
2343
- }
2344
- });
2345
- break;
2346
- }
2347
- }
2348
- }
2349
- transformParamsFromMap(change) {
2350
- if (change && change.service === 'DatabaseService') {
2351
- switch (change.operation) {
2352
- case 'insertMultiPartTableData':
2353
- case 'updateMultiPartTableData':
2354
- return this.localDBManagementService.getStore(change.params.dataModelName, change.params.entityName)
2355
- .then(store => {
2356
- // construct Form data
2357
- return store.deserialize(change.params.data).then(function (formData) {
2358
- change.params.data = formData;
2359
- });
2360
- });
2361
- }
2362
- }
2363
- }
2364
- transformParamsToMap(change) {
2365
- if (change && change.service === 'DatabaseService') {
2366
- switch (change.operation) {
2367
- case 'insertMultiPartTableData':
2368
- case 'updateMultiPartTableData':
2369
- return this.localDBManagementService.getStore(change.params.dataModelName, change.params.entityName)
2370
- .then(store => {
2371
- return store.serialize(change.params.data).then(function (map) {
2372
- change.params.data = map;
2373
- /**
2374
- * As save method called with FormData object, empty row is inserted.
2375
- * Since FormData is converted to map, update the record details now.
2376
- */
2377
- store.save(lodashEs.mapValues(map, function (v) {
2378
- // @ts-ignore
2379
- return (lodashEs.isObject(v) && v.wmLocalPath) || v;
2380
- }));
2381
- return map;
2382
- });
2383
- });
2384
- }
2385
- }
2386
- }
2387
- }
2388
-
2389
- const apiConfiguration = [{
2390
- 'name': 'insertTableData',
2391
- 'type': 'INSERT'
2392
- }, {
2393
- 'name': 'insertMultiPartTableData',
2394
- 'type': 'INSERT'
2395
- }, {
2396
- 'name': 'updateTableData',
2397
- 'type': 'UPDATE'
2398
- }, {
2399
- 'name': 'updateMultiPartTableData',
2400
- 'type': 'UPDATE'
2401
- }, {
2402
- 'name': 'deleteTableData',
2403
- 'type': 'DELETE'
2404
- }, {
2405
- 'name': 'readTableData',
2406
- 'type': 'READ',
2407
- 'saveResponse': true
2408
- }, {
2409
- 'name': 'searchTableData',
2410
- 'type': 'READ',
2411
- 'saveResponse': true
2412
- }, {
2413
- 'name': 'searchTableDataWithQuery',
2414
- 'type': 'READ',
2415
- 'saveResponse': true
2416
- }, {
2417
- 'name': 'getDistinctDataByFields',
2418
- 'type': 'READ',
2419
- 'saveResponse': false
2420
- }];
2421
- let isOfflineBehaviorAdded = false;
2422
- class LiveVariableOfflineBehaviour {
2423
- constructor(changeLogService, httpService, localDBManagementService, networkService, offlineDBService) {
2424
- this.changeLogService = changeLogService;
2425
- this.httpService = httpService;
2426
- this.localDBManagementService = localDBManagementService;
2427
- this.networkService = networkService;
2428
- this.offlineDBService = offlineDBService;
2429
- this.onlineDBService = variables$1.LVService;
2430
- }
2431
- add() {
2432
- if (!isOfflineBehaviorAdded) {
2433
- isOfflineBehaviorAdded = true;
2434
- const onlineHandler = this.httpService.sendCallAsObservable;
2435
- if (onlineHandler) {
2436
- this.httpService.sendCallAsObservable = (reqParams, params) => {
2437
- if (!params && lodashEs.get(reqParams, 'url')) {
2438
- params = { url: reqParams.url };
2439
- }
2440
- // reqParams will contain the full path of insert/update call which will be processed again in parseConfig method
2441
- // and will be appended again with '/services/./.' which will result in deployedUrl + '/service/./.' + '/service/./.' which is wrong.
2442
- // Hence passing url in params
2443
- const clonedParamsUrl = lodashEs.clone(params.url);
2444
- params = lodashEs.extend(params, reqParams);
2445
- const operation = lodashEs.find(apiConfiguration, { name: lodashEs.get(params, 'operation') });
2446
- if (this.networkService.isConnected() || params.onlyOnline || !operation || !params.dataModelName) {
2447
- return rxjs.from(this.remoteDBcall(operation, onlineHandler, params));
2448
- }
2449
- // converting promise to observable as LVService returns a observable
2450
- return rxjs.from(this.localDBManagementService.isOperationAllowed(params.dataModelName, params.entityName, operation.type)
2451
- .then(isAllowedInOffline => {
2452
- if (!isAllowedInOffline) {
2453
- return this.remoteDBcall(operation, onlineHandler, params);
2454
- }
2455
- else {
2456
- let cascader;
2457
- return Promise.resolve().then(() => {
2458
- if (!params.isCascadingStopped &&
2459
- (operation.name === 'insertTableData'
2460
- || operation.name === 'updateTableData')) {
2461
- return this.prepareToCascade(params).then(c => cascader = c);
2462
- }
2463
- }).then(() => {
2464
- return new Promise((resolve, reject) => {
2465
- this.localDBcall(operation, params, resolve, reject, clonedParamsUrl);
2466
- });
2467
- }).then((response) => {
2468
- if (cascader) {
2469
- return cascader.cascade().then(() => {
2470
- return this.getStore(params).then(store => {
2471
- return store.refresh(response.body);
2472
- }).then(data => {
2473
- // data includes parent and child data.
2474
- if (response && response.body) {
2475
- response.body = data;
2476
- }
2477
- return response;
2478
- });
2479
- });
2480
- }
2481
- return response;
2482
- });
2483
- }
2484
- }));
2485
- };
2486
- }
2487
- }
2488
- }
2489
- getStore(params) {
2490
- return this.localDBManagementService.getStore(params.dataModelName, params.entityName);
2491
- }
2492
- // set hasBlob flag on params when blob field is present
2493
- hasBlob(store) {
2494
- const blobColumns = lodashEs.filter(store.entitySchema.columns, {
2495
- 'sqlType': 'blob'
2496
- });
2497
- return !!blobColumns.length;
2498
- }
2499
- /*
2500
- * During offline, LocalDBService will answer to all the calls. All data modifications will be recorded
2501
- * and will be reported to DatabaseService when device goes online.
2502
- */
2503
- localDBcall(operation, params, successCallback, failureCallback, clonedParamsUrl) {
2504
- return new Promise((resolve, reject) => {
2505
- this.offlineDBService[operation.name](params, response => {
2506
- if (operation.type === 'READ') {
2507
- resolve(response);
2508
- }
2509
- else {
2510
- // add to change log
2511
- params.onlyOnline = true;
2512
- params.url = clonedParamsUrl;
2513
- return this.changeLogService.add('DatabaseService', operation.name, params)
2514
- .then(() => resolve(response));
2515
- }
2516
- });
2517
- }).then((response) => {
2518
- response = { body: response, type: WM_LOCAL_OFFLINE_CALL };
2519
- i1$1.triggerFn(successCallback, response);
2520
- return response;
2521
- }, failureCallback);
2522
- }
2523
- /*
2524
- * During online, all read operations data will be pushed to offline database. Similarly, Update and Delete
2525
- * operations are synced with the offline database.
2526
- */
2527
- remoteDBcall(operation, onlineHandler, params) {
2528
- return new Promise((resolve, reject) => {
2529
- onlineHandler.call(this.httpService, params).subscribe(response => {
2530
- if (response && response.type) {
2531
- if (!params.skipLocalDB) {
2532
- this.offlineDBService.getStore(params).then((store) => {
2533
- if (operation.type === 'READ' && operation.saveResponse) {
2534
- store.saveAll(response.body.content);
2535
- }
2536
- else if (operation.type === 'INSERT') {
2537
- params = lodashEs.clone(params);
2538
- params.data = lodashEs.clone(response.body);
2539
- this.offlineDBService[operation.name](params, i1$1.noop, i1$1.noop, {
2540
- resetPrimaryKey: false
2541
- });
2542
- }
2543
- else {
2544
- this.offlineDBService[operation.name](params, i1$1.noop, i1$1.noop);
2545
- }
2546
- }).catch(i1$1.noop);
2547
- }
2548
- resolve(response);
2549
- }
2550
- }, (err) => {
2551
- reject(err);
2552
- });
2553
- });
2554
- }
2555
- /**
2556
- * Finds out the nested objects to save and prepares a cloned params.
2557
- */
2558
- prepareToCascade(params) {
2559
- return this.getStore(params).then(store => {
2560
- const childObjectPromises = [];
2561
- lodashEs.forEach(params.data, (v, k) => {
2562
- let column, foreignRelation, childParams;
2563
- // NOTE: Save only one-to-one relations for cascade
2564
- if (lodashEs.isObject(v) && !lodashEs.isArray(v)) {
2565
- column = store.entitySchema.columns.find(c => {
2566
- if (c.primaryKey && c.foreignRelations) {
2567
- foreignRelation = c.foreignRelations.find(f => f.sourceFieldName === k);
2568
- }
2569
- return !!foreignRelation;
2570
- });
2571
- }
2572
- if (column) {
2573
- childParams = lodashEs.cloneDeep(params);
2574
- childParams.entityName = foreignRelation.targetEntity;
2575
- childParams.data = v;
2576
- const childPromise = this.getStore(childParams).then(childStore => {
2577
- const parent = params.data;
2578
- const targetColumns = childStore.entitySchema.columns.find(c => c.name === foreignRelation.targetColumn);
2579
- if (targetColumns && targetColumns.foreignRelations) {
2580
- const parentFieldName = targetColumns.foreignRelations.find(f => f.targetTable === store.entitySchema.name).sourceFieldName;
2581
- childParams.data[parentFieldName] = parent;
2582
- }
2583
- parent[k] = null;
2584
- childParams.onlyOnline = false;
2585
- childParams.isCascadingStopped = true;
2586
- childParams.hasBlob = this.hasBlob(childStore);
2587
- childParams.url = '';
2588
- return () => {
2589
- return Promise.resolve().then(() => {
2590
- const primaryKeyValue = childStore.getValue(childParams.data, childStore.primaryKeyField.fieldName);
2591
- return primaryKeyValue ? childStore.get(primaryKeyValue) : null;
2592
- }).then(object => {
2593
- let operation;
2594
- if (object) {
2595
- operation = childParams.hasBlob ? 'updateMultiPartTableData' : 'updateTableData';
2596
- }
2597
- else {
2598
- operation = childParams.hasBlob ? 'insertMultiPartTableData' : 'insertTableData';
2599
- }
2600
- return this.onlineDBService[operation](childParams).toPromise();
2601
- });
2602
- };
2603
- });
2604
- childObjectPromises.push(childPromise);
2605
- }
2606
- });
2607
- return Promise.all(childObjectPromises).then(result => {
2608
- return {
2609
- cascade: () => Promise.all(result.map(fn => fn()))
2610
- };
2611
- });
2612
- });
2613
- }
2614
- }
2615
-
2616
- let isOfflineBehaviourAdded$2 = false;
2617
- class FileUploadOfflineBehaviour {
2618
- constructor(changeLogService, deviceFileService, deviceFileUploadService, file, networkService, uploadDir) {
2619
- this.changeLogService = changeLogService;
2620
- this.deviceFileService = deviceFileService;
2621
- this.deviceFileUploadService = deviceFileUploadService;
2622
- this.file = file;
2623
- this.networkService = networkService;
2624
- this.uploadDir = uploadDir;
2625
- }
2626
- add() {
2627
- if (isOfflineBehaviourAdded$2) {
2628
- return;
2629
- }
2630
- isOfflineBehaviourAdded$2 = true;
2631
- const orig = this.deviceFileUploadService.upload;
2632
- this.deviceFileUploadService['uploadToServer'] = orig;
2633
- this.deviceFileUploadService.upload = (url, fileParamName, localPath, fileName, params, headers) => {
2634
- if (this.networkService.isConnected()) {
2635
- return orig.call(this.deviceFileUploadService, url, fileParamName, localPath, fileName, params, headers);
2636
- }
2637
- else {
2638
- return this.uploadLater(url, fileParamName, localPath, fileName, params, headers).then(response => {
2639
- return {
2640
- text: JSON.stringify(response),
2641
- headers: null,
2642
- response: response
2643
- };
2644
- });
2645
- }
2646
- };
2647
- }
2648
- uploadLater(url, fileParamName, localPath, fileName, params, headers) {
2649
- const i = localPath.lastIndexOf('/'), soureDir = localPath.substring(0, i), soureFile = localPath.substring(i + 1), destFile = this.deviceFileService.appendToFileName(soureFile), filePath = this.uploadDir + '/' + destFile;
2650
- return this.file.copyFile(soureDir, soureFile, this.uploadDir, destFile)
2651
- .then(() => {
2652
- return this.changeLogService.add('OfflineFileUploadService', 'uploadToServer', {
2653
- file: filePath,
2654
- ftOptions: {
2655
- fileKey: fileParamName,
2656
- fileName: fileName
2657
- },
2658
- params: params,
2659
- headers: headers,
2660
- serverUrl: url,
2661
- deleteOnUpload: true
2662
- });
2663
- }).then(() => {
2664
- return [{
2665
- fileName: soureFile,
2666
- path: filePath,
2667
- length: 0,
2668
- success: true,
2669
- inlinePath: filePath + '?inline'
2670
- }];
2671
- });
2672
- }
2673
- }
2674
-
2675
- const NUMBER_REGEX = /^\d+(\.\d+)?$/;
2676
- let isOfflineBehaviourAdded$1 = false;
2677
- class NamedQueryExecutionOfflineBehaviour {
2678
- constructor(changeLogService, httpService, localDBManagementService, networkService) {
2679
- this.changeLogService = changeLogService;
2680
- this.httpService = httpService;
2681
- this.localDBManagementService = localDBManagementService;
2682
- this.networkService = networkService;
2683
- }
2684
- add() {
2685
- if (isOfflineBehaviourAdded$1) {
2686
- return;
2687
- }
2688
- isOfflineBehaviourAdded$1 = true;
2689
- const orig = this.httpService.sendCallAsObservable;
2690
- this.httpService.sendCallAsObservable = (reqParams, params) => {
2691
- if (!params && lodashEs.get(reqParams, 'url')) {
2692
- params = { url: reqParams.url };
2693
- }
2694
- if (!this.networkService.isConnected() && params.url.indexOf('/queryExecutor/') > 0) {
2695
- return rxjs.from(this.executeLocally(params));
2696
- }
2697
- else {
2698
- return orig.call(this.httpService, reqParams, params);
2699
- }
2700
- };
2701
- }
2702
- executeLocally(params) {
2703
- const url = params.url, hasUrlParams = url.indexOf('?') > 0, dbName = this.substring(url, 'services/', '/queryExecutor'), queryName = this.substring(url, 'queries/', hasUrlParams ? '?' : undefined), urlParams = hasUrlParams ? this.getHttpParamMap(this.substring(url, '?', undefined)) : {}, dataParams = this.getHttpParamMap(params.dataParams), queryParams = lodashEs.extend(urlParams, dataParams);
2704
- return this.localDBManagementService.executeNamedQuery(dbName, queryName, queryParams)
2705
- .then(result => {
2706
- const rows = result.rows;
2707
- if (result.rowsAffected) {
2708
- return this.changeLogService.add('WebService', 'invokeJavaService', params)
2709
- .then(() => result.rowsAffected);
2710
- }
2711
- else {
2712
- return {
2713
- type: WM_LOCAL_OFFLINE_CALL,
2714
- body: {
2715
- totalPages: rows && rows.length > 0 ? 1 : 0,
2716
- totalElements: rows.length,
2717
- first: true,
2718
- sort: null,
2719
- numberOfElements: rows.length,
2720
- last: true,
2721
- size: params.size,
2722
- number: 0,
2723
- content: rows
2724
- }
2725
- };
2726
- }
2727
- });
2728
- }
2729
- substring(source, start, end) {
2730
- if (start) {
2731
- const startIndex = source.indexOf(start) + start.length, endIndex = end ? source.indexOf(end) : undefined;
2732
- return source.substring(startIndex, endIndex);
2733
- }
2734
- return undefined;
2735
- }
2736
- getHttpParamMap(str) {
2737
- const result = {};
2738
- if (str) {
2739
- str = decodeURIComponent(str);
2740
- str.split('&').forEach(c => {
2741
- const csplits = c.split('=');
2742
- if (lodashEs.isEmpty(lodashEs.trim(csplits[1])) || !NUMBER_REGEX.test(csplits[1])) {
2743
- result[csplits[0]] = csplits[1];
2744
- }
2745
- else {
2746
- result[csplits[0]] = parseInt(csplits[1], 10);
2747
- }
2748
- });
2749
- }
2750
- return result;
2751
- }
2752
- }
2753
-
2754
- const SECURITY_FILE = 'logged-in-user.info';
2755
- let isOfflineBehaviourAdded = false;
2756
- class SecurityOfflineBehaviour {
2757
- constructor(app, file, deviceService, networkService, securityService) {
2758
- this.app = app;
2759
- this.file = file;
2760
- this.deviceService = deviceService;
2761
- this.networkService = networkService;
2762
- this.securityService = securityService;
2763
- this.saveSecurityConfigLocally = lodashEs.debounce((config) => {
2764
- this._saveSecurityConfigLocally(config);
2765
- }, 1000);
2766
- }
2767
- add() {
2768
- if (isOfflineBehaviourAdded) {
2769
- return;
2770
- }
2771
- isOfflineBehaviourAdded = true;
2772
- const origLoad = this.securityService.load;
2773
- const origAppLogout = this.securityService.appLogout;
2774
- /**
2775
- * Add offline behaviour to SecurityService.getConfig. When offline, this funcation returns security
2776
- * config of last logged-in user will be returned, provided the user did not logout last time.
2777
- *
2778
- * @param successCallback
2779
- * @param failureCallback
2780
- */
2781
- this.securityService.load = (forceFlag) => {
2782
- return new Promise((resolve, reject) => {
2783
- if (this.networkService.isConnected()) {
2784
- origLoad.call(this.securityService, forceFlag).then(config => {
2785
- this.securityConfig = config;
2786
- this.saveSecurityConfigLocally(config);
2787
- resolve(this.securityConfig);
2788
- }, reject);
2789
- }
2790
- else {
2791
- this.readLocalSecurityConfig().then((config = {}) => {
2792
- this.securityConfig = config;
2793
- this.securityService.config = config;
2794
- return config;
2795
- }, () => origLoad.call(this.securityConfig)).then(resolve, reject);
2796
- }
2797
- });
2798
- };
2799
- /**
2800
- * When users logs out, local config will be removed. If the user is offline and logs out, then user
2801
- * will be logged out from the app and cookies are invalidated when app goes online next time.
2802
- *
2803
- * @param successCallback
2804
- * @param failureCallback
2805
- */
2806
- this.securityService.appLogout = (successCallback, failureCallback) => {
2807
- this.securityConfig = {
2808
- authenticated: false,
2809
- loggedOut: true,
2810
- securityEnabled: this.securityConfig && this.securityConfig.securityEnabled,
2811
- loggedOutOffline: !this.networkService.isConnected(),
2812
- loginConfig: this.securityConfig && this.securityConfig.loginConfig,
2813
- userInfo: null
2814
- };
2815
- this._saveSecurityConfigLocally(this.securityConfig).catch(i1$1.noop).then(() => {
2816
- if (this.networkService.isConnected()) {
2817
- origAppLogout.call(this.securityService, successCallback, failureCallback);
2818
- }
2819
- else {
2820
- location.assign(window.location.origin + window.location.pathname);
2821
- }
2822
- });
2823
- };
2824
- /**
2825
- * @param successCallback
2826
- */
2827
- this.securityService.isAuthenticated = successCallback => {
2828
- i1$1.triggerFn(successCallback, this.securityConfig.authenticated === true);
2829
- };
2830
- this.deviceService.whenReady().then(() => this.clearLastLoggedInUser());
2831
- /**
2832
- * If the user has chosen to logout while app is offline, then invalidation of cookies happens when
2833
- * app comes online next time.
2834
- */
2835
- this.app.subscribe('onNetworkStateChange', data => {
2836
- if (data.isConnected) {
2837
- this.clearLastLoggedInUser();
2838
- }
2839
- });
2840
- }
2841
- _saveSecurityConfigLocally(config) {
2842
- return this.file.writeFile(cordova.file.dataDirectory, SECURITY_FILE, JSON.stringify(config), { replace: true });
2843
- }
2844
- clearLastLoggedInUser() {
2845
- return this.readLocalSecurityConfig().then(config => {
2846
- if (config && config.loggedOutOffline) {
2847
- this.securityService.appLogout(null, null);
2848
- }
2849
- else if (!this.networkService.isConnected()) {
2850
- this.securityConfig = config || {};
2851
- }
2852
- });
2853
- }
2854
- readLocalSecurityConfig() {
2855
- // reading the security info from file in dataDirectory but when this file is not available then fetching the config from the app directory
2856
- return new Promise((resolve, reject) => {
2857
- const rootDir = cordova.file.dataDirectory;
2858
- this.file.checkFile(rootDir, SECURITY_FILE).then(() => {
2859
- return this.readFileAsTxt(rootDir, SECURITY_FILE).then(resolve, reject);
2860
- }, () => {
2861
- const folderPath = cordova.file.applicationDirectory + 'www/metadata/app', fileName = 'security-config.json';
2862
- return this.readFileAsTxt(folderPath, fileName).then(resolve, reject);
2863
- });
2864
- });
2865
- }
2866
- readFileAsTxt(folderPath, fileName) {
2867
- return this.file.readAsText(folderPath, fileName).then(JSON.parse).catch(i1$1.noop);
2868
- }
2869
- }
2870
-
2871
- class OfflineModule {
2872
- static { this.initialized = false; }
2873
- // Startup services have to be added only once in the app life-cycle.
2874
- static initialize(app, changeLogService, deviceService, deviceFileService, deviceFileUploadService, file, httpService, localDBManagementService, localDbService, networkService, securityService) {
2875
- if (this.initialized) {
2876
- return;
2877
- }
2878
- deviceService.addStartUpService({
2879
- getServiceName: () => 'OfflineStartupService',
2880
- start: () => {
2881
- if (window['SQLitePlugin']) {
2882
- localDBManagementService.setLogSQl((sessionStorage.getItem('wm.logSql') === 'true') || (sessionStorage.getItem('debugMode') === 'true'));
2883
- window.logSql = (flag = true) => {
2884
- localDBManagementService.setLogSQl(flag);
2885
- sessionStorage.setItem('wm.logSql', flag ? 'true' : 'false');
2886
- };
2887
- window.executeLocalSql = (dbName, query, params) => {
2888
- localDBManagementService.executeSQLQuery(dbName, query, params, true);
2889
- };
2890
- return localDBManagementService.loadDatabases().then(() => {
2891
- changeLogService.addWorker(new IdResolver(localDBManagementService));
2892
- changeLogService.addWorker(new ErrorBlocker(localDBManagementService));
2893
- changeLogService.addWorker(new FileHandler());
2894
- changeLogService.addWorker(new MultiPartParamTransformer(deviceFileService, localDBManagementService));
2895
- new LiveVariableOfflineBehaviour(changeLogService, httpService, localDBManagementService, networkService, localDbService).add();
2896
- new FileUploadOfflineBehaviour(changeLogService, deviceFileService, deviceFileUploadService, file, networkService, deviceFileService.getUploadDirectory()).add();
2897
- new NamedQueryExecutionOfflineBehaviour(changeLogService, httpService, localDBManagementService, networkService).add();
2898
- localDBManagementService.registerCallback(new UploadedFilesImportAndExportService(changeLogService, deviceFileService, localDBManagementService, file));
2899
- changeLogService.addWorker({
2900
- onAddCall: () => {
2901
- if (!networkService.isConnected()) {
2902
- networkService.disableAutoConnect();
2903
- }
2904
- },
2905
- postFlush: stats => {
2906
- if (stats.totalTaskCount > 0) {
2907
- localDBManagementService.close()
2908
- .catch(i1$1.noop)
2909
- .then(() => {
2910
- location.assign(window.location.origin + window.location.pathname);
2911
- });
2912
- }
2913
- }
2914
- });
2915
- });
2916
- }
2917
- return Promise.resolve();
2918
- }
2919
- });
2920
- new SecurityOfflineBehaviour(app, file, deviceService, networkService, securityService).add();
2921
- }
2922
- constructor(app, changeLogService, deviceService, deviceFileService, deviceFileUploadService, file, httpService, localDBManagementService, localDbService, networkService, securityService) {
2923
- if (i1$1.hasCordova()) {
2924
- OfflineModule.initialize(app, changeLogService, deviceService, deviceFileService, deviceFileUploadService, file, httpService, localDBManagementService, localDbService, networkService, securityService);
2925
- }
2926
- }
2927
- static { this.ɵfac = function OfflineModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || OfflineModule)(i0__namespace.ɵɵinject(i1$1__namespace.App), i0__namespace.ɵɵinject(ChangeLogService), i0__namespace.ɵɵinject(i3__namespace.DeviceService), i0__namespace.ɵɵinject(i3__namespace.DeviceFileService), i0__namespace.ɵɵinject(i3__namespace.DeviceFileUploadService), i0__namespace.ɵɵinject(i3$1__namespace.File), i0__namespace.ɵɵinject(i1$1__namespace.AbstractHttpService), i0__namespace.ɵɵinject(LocalDBManagementService), i0__namespace.ɵɵinject(LocalDbService), i0__namespace.ɵɵinject(i3__namespace.NetworkService), i0__namespace.ɵɵinject(i5__namespace.SecurityService)); }; }
2928
- static { this.ɵmod = /*@__PURE__*/ i0__namespace.ɵɵdefineNgModule({ type: OfflineModule }); }
2929
- static { this.ɵinj = /*@__PURE__*/ i0__namespace.ɵɵdefineInjector({ imports: [common.CommonModule] }); }
2930
- }
2931
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(OfflineModule, [{
2932
- type: i0.NgModule,
2933
- args: [{
2934
- imports: [
2935
- common.CommonModule
2936
- ],
2937
- declarations: [],
2938
- exports: [],
2939
- providers: [
2940
- // add providers to mobile-runtime module.
2941
- ]
2942
- }]
2943
- }], () => [{ type: i1$1__namespace.App }, { type: ChangeLogService }, { type: i3__namespace.DeviceService }, { type: i3__namespace.DeviceFileService }, { type: i3__namespace.DeviceFileUploadService }, { type: i3$1__namespace.File }, { type: i1$1__namespace.AbstractHttpService }, { type: LocalDBManagementService }, { type: LocalDbService }, { type: i3__namespace.NetworkService }, { type: i5__namespace.SecurityService }], null); })();
2944
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0__namespace.ɵɵsetNgModuleScope(OfflineModule, { imports: [common.CommonModule] }); })();
2945
-
2946
- class PushServiceImpl {
2947
- constructor(deviceFileUploadService) {
2948
- this.deviceFileUploadService = deviceFileUploadService;
2949
- }
2950
- // Returns a promise from the observable.
2951
- getPromiseFromObs(cb) {
2952
- return new Promise((resolve, reject) => {
2953
- cb.subscribe(response => {
2954
- if (response && response.type) {
2955
- resolve(response);
2956
- }
2957
- }, reject);
2958
- });
2959
- }
2960
- push(change) {
2961
- const params = change.params;
2962
- switch (change.service) {
2963
- case 'DatabaseService':
2964
- switch (change.operation) {
2965
- case 'insertTableData':
2966
- return this.getPromiseFromObs(variables$1.LVService.insertTableData(change.params, null, null));
2967
- case 'insertMultiPartTableData':
2968
- return this.getPromiseFromObs(variables$1.LVService.insertMultiPartTableData(change.params, null, null));
2969
- case 'updateTableData':
2970
- return this.getPromiseFromObs(variables$1.LVService.updateTableData(change.params, null, null));
2971
- case 'updateMultiPartTableData':
2972
- return this.getPromiseFromObs(variables$1.LVService.updateMultiPartTableData(change.params, null, null));
2973
- case 'deleteTableData':
2974
- return this.getPromiseFromObs(variables$1.LVService.deleteTableData(change.params, null, null));
2975
- }
2976
- case 'OfflineFileUploadService':
2977
- if (change.operation === 'uploadToServer') {
2978
- return this.deviceFileUploadService['uploadToServer'].call(this.deviceFileUploadService, params.serverUrl, params.ftOptions.fileKey, params.file, params.ftOptions.fileName, params.params, params.headers);
2979
- }
2980
- }
2981
- return Promise.reject(`${change.service} service with operation ${change.operation} is not supported for push.`);
2982
- }
2983
- static { this.ɵfac = function PushServiceImpl_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PushServiceImpl)(i0__namespace.ɵɵinject(i3__namespace.DeviceFileUploadService)); }; }
2984
- static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: PushServiceImpl, factory: PushServiceImpl.ɵfac }); }
2985
- }
2986
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(PushServiceImpl, [{
2987
- type: i0.Injectable
2988
- }], () => [{ type: i3__namespace.DeviceFileUploadService }], null); })();
2989
-
2990
- const LAST_PULL_INFO_KEY = 'localDBManager.lastPullInfo';
2991
- /**
2992
- * a utility api to abort pull process.
2993
- *
2994
- * @type {{start, add, remove, abort}}
2995
- */
2996
- const pullProcessManager = (() => {
2997
- const promises = {};
2998
- return {
2999
- start: promise => {
3000
- promise.$$pullProcessId = 'PULL_' + lodashEs.now();
3001
- },
3002
- add: (pullPromise, promise) => {
3003
- const pullProcessId = pullPromise.$$pullProcessId;
3004
- if (!promises[pullProcessId]) {
3005
- promises[pullProcessId] = [];
3006
- }
3007
- promises[pullProcessId].push(promise);
3008
- },
3009
- remove: (pullPromise, promise) => {
3010
- const pullProcessId = pullPromise.$$pullProcessId;
3011
- lodashEs.remove(promises[pullProcessId], promise);
3012
- if (lodashEs.isEmpty(promises[pullProcessId])) {
3013
- delete promises[pullProcessId];
3014
- }
3015
- },
3016
- abort: (pullPromise) => {
3017
- const pullProcessId = pullPromise.$$pullProcessId;
3018
- if (promises[pullProcessId]) {
3019
- lodashEs.forEach(promises[pullProcessId], function (p) {
3020
- if (p && p.abort) {
3021
- p.abort();
3022
- }
3023
- });
3024
- delete promises[pullProcessId];
3025
- }
3026
- pullPromise.$$isMarkedToAbort = true;
3027
- return pullPromise.catch(function () {
3028
- return 'cancelled';
3029
- });
3030
- }
3031
- };
3032
- })();
3033
- /**
3034
- * LocalDBDataPullService has API to pull data from remote Server to local Database.
3035
- */
3036
- class LocalDBDataPullService {
3037
- static { this.SERVICE_NAME = 'LocalDBDataPullService'; }
3038
- constructor(app, localDBManagementService, localKeyValueService, networkService) {
3039
- this.app = app;
3040
- this.localDBManagementService = localDBManagementService;
3041
- this.localKeyValueService = localKeyValueService;
3042
- this.networkService = networkService;
3043
- // Listen for db creation. When db is created, then initialize last pull info.
3044
- this.localDBManagementService.registerCallback({
3045
- onDbCreate: (info) => {
3046
- this.localKeyValueService.put(LAST_PULL_INFO_KEY, {
3047
- databases: [],
3048
- totalRecordsToPull: 0,
3049
- totalPulledRecordCount: 0,
3050
- startTime: new Date(0),
3051
- endTime: new Date(info.dbSeedCreatedOn)
3052
- });
3053
- }
3054
- });
3055
- }
3056
- /**
3057
- * If deltaFieldName is set,last pull time is greater than zero and query used in last pull is same as the
3058
- * query for the current pull, then delta criteria is attached to the query.
3059
- *
3060
- * @param db
3061
- * @param entityName
3062
- * @param query
3063
- * @returns {any}
3064
- */
3065
- addDeltaCriteria(db, entityName, query) {
3066
- const entitySchema = db.schema.entities[entityName], deltaFieldName = entitySchema.pullConfig.deltaFieldName, deltaField = lodashEs.find(entitySchema.columns, { 'fieldName': deltaFieldName }) || {};
3067
- let isBundledEntity;
3068
- if (!lodashEs.isEmpty(deltaFieldName)) {
3069
- return this.localDBManagementService.isBundled(db.schema.name, entityName)
3070
- .then(flag => isBundledEntity = flag)
3071
- .then(() => this.getLastPullInfo())
3072
- .then(lastPullInfo => {
3073
- let lastPullTime = (lastPullInfo && lastPullInfo.startTime && lastPullInfo.startTime.getTime());
3074
- const lastPullDBInfo = lodashEs.find(lastPullInfo && lastPullInfo.databases, { 'name': db.schema.name }), lastPullEntityInfo = lodashEs.find(lastPullDBInfo && lastPullDBInfo.entities, { 'entityName': entityName }) || {};
3075
- if (!lastPullTime && isBundledEntity) {
3076
- // For bundled entity when there is no last pull, fetch records that got modified after db creation.
3077
- lastPullTime = (lastPullInfo && lastPullInfo.endTime && lastPullInfo.endTime.getTime());
3078
- lastPullEntityInfo.query = query;
3079
- }
3080
- if (lastPullEntityInfo.query === query && lastPullTime > 0) {
3081
- if (lodashEs.isEmpty(query)) {
3082
- query = '';
3083
- }
3084
- else {
3085
- query += ' AND ';
3086
- }
3087
- if (deltaField.sqlType === 'datetime') {
3088
- query += deltaFieldName + ' > \'' + moment(lastPullTime).utc().format('YYYY-MM-DDTHH:mm:ss') + '\'';
3089
- }
3090
- else {
3091
- query += deltaFieldName + ' > ' + lastPullTime;
3092
- }
3093
- }
3094
- return query;
3095
- }, () => Promise.resolve(query));
3096
- }
3097
- return Promise.resolve(query);
3098
- }
3099
- /**
3100
- * copies the data from remote db to local db
3101
- * @param {DBInfo} db
3102
- * @param {string} entityName
3103
- * @param {boolean} clearDataBeforePull
3104
- * @param pullPromise
3105
- * @param {Observer<any>} progressObserver
3106
- * @returns {Promise<any>}
3107
- */
3108
- copyDataFromRemoteDBToLocalDB(db, entityName, clearDataBeforePull, pullPromise, progressObserver) {
3109
- const store = db.stores[entityName], entitySchema = db.schema.entities[entityName], result = {
3110
- entityName: entityName,
3111
- totalRecordsToPull: 0,
3112
- pulledRecordCount: 0
3113
- };
3114
- let inProgress = 0, pullComplete = false, filter;
3115
- return new Promise((resolve, reject) => {
3116
- this.prepareQuery(db, entityName)
3117
- .then(query => {
3118
- result.query = query;
3119
- return this.addDeltaCriteria(db, entityName, query);
3120
- }).then(query => {
3121
- // Clear if clearDataBeforePull is true and delta query is not used
3122
- if (clearDataBeforePull && result.query === query) {
3123
- return store.clear()
3124
- .then(() => {
3125
- return query;
3126
- });
3127
- }
3128
- return query;
3129
- }).then(query => {
3130
- filter = lodashEs.isEmpty(query) ? '' : 'q=' + query;
3131
- return this.getTotalRecordsToPull(db, entitySchema, filter, pullPromise);
3132
- }).then(maxNoOfRecords => {
3133
- const pageSize = entitySchema.pullConfig.size || 100, maxNoOfPages = Math.ceil(maxNoOfRecords / pageSize);
3134
- result.totalRecordsToPull = maxNoOfRecords;
3135
- let sort = entitySchema.pullConfig.orderBy;
3136
- sort = (lodashEs.isEmpty(sort) ? '' : sort + ',') + store.primaryKeyName;
3137
- progressObserver.next(result);
3138
- const _progressObserver = { next: data => {
3139
- inProgress++;
3140
- data = lodashEs.slice(data, 0, result.totalRecordsToPull - result.pulledRecordCount);
3141
- store.saveAll(data).then(() => {
3142
- result.pulledRecordCount += data ? data.length : 0;
3143
- progressObserver.next(result);
3144
- }).catch(i1$1.noop)
3145
- .then(() => {
3146
- inProgress--;
3147
- if (inProgress === 0 && pullComplete) {
3148
- resolve(result);
3149
- }
3150
- });
3151
- }, error: null, complete: null
3152
- };
3153
- return this._pullEntityData(db, entityName, filter, sort, maxNoOfPages, pageSize, 1, pullPromise, undefined, _progressObserver);
3154
- }).then(null, reject)
3155
- .catch(i1$1.noop)
3156
- .then(() => {
3157
- pullComplete = true;
3158
- if (inProgress === 0) {
3159
- resolve(result);
3160
- }
3161
- });
3162
- });
3163
- }
3164
- // If expression starts with 'bind:', then expression is evaluated and result is returned.
3165
- evalIfBind(expression) {
3166
- if (lodashEs.startsWith(expression, 'bind:')) {
3167
- expression = expression.replace(/\[\$\i\]/g, '[0]');
3168
- return i1$1.$parseExpr(expression.replace('bind:', ''))(this.app);
3169
- }
3170
- return expression;
3171
- }
3172
- /**
3173
- * Executes DatabaseService.countTableDataWithQuery as a promise API.
3174
- * @param params
3175
- * @returns Promise
3176
- */
3177
- executeDatabaseCountQuery(params) {
3178
- return new Promise((resolve, reject) => {
3179
- variables$1.LVService.countTableDataWithQuery(params, null, null).subscribe(response => resolve(response.body), reject);
3180
- });
3181
- }
3182
- /**
3183
- * Executes DatabaseService.searchTableDataWithQuery as a promise API.
3184
- * @param params
3185
- * @returns Promise
3186
- */
3187
- executeDatabaseSearchQuery(params) {
3188
- return new Promise((resolve, reject) => {
3189
- return variables$1.LVService.searchTableDataWithQuery(params, null, null).subscribe(response => resolve(response && response.body && response.body.content), reject);
3190
- });
3191
- }
3192
- /**
3193
- * Computes the maximum number of records to pull.
3194
- *
3195
- * @param db
3196
- * @param entitySchema
3197
- * @param filter
3198
- * @param pullPromise
3199
- * @returns {*}
3200
- */
3201
- getTotalRecordsToPull(db, entitySchema, filter, pullPromise) {
3202
- const params = {
3203
- dataModelName: db.schema.name,
3204
- entityName: entitySchema.entityName,
3205
- queryParams: filter
3206
- };
3207
- return this.retryIfNetworkFails(() => {
3208
- return this.executeDatabaseCountQuery(params).then(function (response) {
3209
- const totalRecordCount = response, maxRecordsToPull = parseInt(entitySchema.pullConfig.maxNumberOfRecords);
3210
- if (lodashEs.isNaN(maxRecordsToPull) || maxRecordsToPull <= 0 || totalRecordCount < maxRecordsToPull) {
3211
- return totalRecordCount;
3212
- }
3213
- return maxRecordsToPull;
3214
- });
3215
- }, pullPromise);
3216
- }
3217
- prepareQuery(db, entityName) {
3218
- let query;
3219
- const entitySchema = db.schema.entities[entityName];
3220
- return this.localDBManagementService.isBundled(db.schema.name, entityName)
3221
- .then(isBundledEntity => {
3222
- let hasNullAttributeValue = false;
3223
- if (isBundledEntity || lodashEs.isEmpty(entitySchema.pullConfig.query)) {
3224
- query = lodashEs.cloneDeep(entitySchema.pullConfig.filter);
3225
- query = lodashEs.map(query, v => {
3226
- v.attributeValue = this.evalIfBind(v.attributeValue);
3227
- hasNullAttributeValue = hasNullAttributeValue || lodashEs.isNil(v.attributeValue);
3228
- return v;
3229
- });
3230
- if (hasNullAttributeValue) {
3231
- return Promise.reject('Null criteria values are present');
3232
- }
3233
- query = lodashEs.sortBy(query, 'attributeName');
3234
- query = variables$1.LiveVariableUtils.getSearchQuery(query, ' AND ', true);
3235
- }
3236
- else {
3237
- query = this.evalIfBind(entitySchema.pullConfig.query);
3238
- }
3239
- if (lodashEs.isNil(query)) {
3240
- return Promise.resolve(null);
3241
- }
3242
- return Promise.resolve(encodeURIComponent(query));
3243
- });
3244
- }
3245
- /**
3246
- *
3247
- * @param db
3248
- * @param clearDataBeforePull
3249
- * @param pullPromise
3250
- * @param progressObserver
3251
- * @returns {*}
3252
- */
3253
- _pullDbData(db, clearDataBeforePull, pullPromise, progressObserver) {
3254
- const datamodelName = db.schema.name, result = {
3255
- name: db.schema.name,
3256
- entities: [],
3257
- totalRecordsToPull: 0,
3258
- pulledRecordCount: 0,
3259
- completedTaskCount: 0,
3260
- totalTaskCount: 0
3261
- };
3262
- const storePromises = [];
3263
- lodashEs.forEach(db.schema.entities, entity => {
3264
- // @ts-ignore
3265
- storePromises.push(this.localDBManagementService.getStore(datamodelName, entity.entityName));
3266
- });
3267
- return new Promise((resolve, reject) => {
3268
- Promise.all(storePromises)
3269
- .then((stores) => {
3270
- const entities = [];
3271
- stores.forEach(store => {
3272
- const pullConfig = store.entitySchema.pullConfig;
3273
- const pullType = pullConfig.pullType;
3274
- if (pullType === PullType.APP_START || (pullType === PullType.BUNDLED && pullConfig.deltaFieldName)) {
3275
- entities.push(store.entitySchema);
3276
- }
3277
- });
3278
- const pullPromises = lodashEs.chain(entities)
3279
- .map(entity => {
3280
- const _progressObserver = {
3281
- next: info => {
3282
- const i = lodashEs.findIndex(result.entities, { 'entityName': info.entityName });
3283
- if (i >= 0) {
3284
- result.entities[i] = info;
3285
- }
3286
- else {
3287
- result.entities.push(info);
3288
- }
3289
- result.pulledRecordCount = lodashEs.reduce(result.entities, function (sum, entityPullInfo) {
3290
- return sum + entityPullInfo.pulledRecordCount;
3291
- }, 0);
3292
- result.totalRecordsToPull = lodashEs.reduce(result.entities, function (sum, entityPullInfo) {
3293
- return sum + entityPullInfo.totalRecordsToPull;
3294
- }, 0);
3295
- progressObserver.next(result);
3296
- }, error: null, complete: null
3297
- };
3298
- return this.copyDataFromRemoteDBToLocalDB(db, entity.entityName, clearDataBeforePull, pullPromise, _progressObserver)
3299
- .then(function (info) {
3300
- result.completedTaskCount++;
3301
- progressObserver.next(result);
3302
- return info;
3303
- }, null);
3304
- }).value();
3305
- result.totalTaskCount = pullPromises.length;
3306
- progressObserver.next(result);
3307
- Promise.all(pullPromises).then(resolve, reject);
3308
- });
3309
- });
3310
- }
3311
- /**
3312
- * Pulls data of the given entity from remote server.
3313
- * @param db
3314
- * @param entityName
3315
- * @param sort
3316
- * @param maxNoOfPages
3317
- * @param pageSize
3318
- * @param currentPage
3319
- * @param filter
3320
- * @param pullPromise
3321
- * @param promise
3322
- * @returns {*}
3323
- */
3324
- _pullEntityData(db, entityName, filter, sort, maxNoOfPages, pageSize, currentPage, pullPromise, deferred, progressObserver) {
3325
- const dataModelName = db.schema.name;
3326
- if (!deferred) {
3327
- deferred = i1$1.defer();
3328
- }
3329
- if (currentPage > maxNoOfPages) {
3330
- return deferred.resolve();
3331
- }
3332
- const params = {
3333
- dataModelName: dataModelName,
3334
- entityName: entityName,
3335
- page: currentPage,
3336
- size: pageSize,
3337
- data: filter,
3338
- sort: sort,
3339
- onlyOnline: true,
3340
- skipLocalDB: true
3341
- };
3342
- this.retryIfNetworkFails(() => {
3343
- return this.executeDatabaseSearchQuery(params);
3344
- }, pullPromise).then(response => {
3345
- progressObserver.next(response);
3346
- this._pullEntityData(db, entityName, filter, sort, maxNoOfPages, pageSize, currentPage + 1, pullPromise, deferred, progressObserver);
3347
- }, deferred.reject);
3348
- return deferred.promise;
3349
- }
3350
- /**
3351
- * If fn fails and network is not there
3352
- * @param fn
3353
- * @param pullPromise
3354
- * @returns {*}
3355
- */
3356
- retryIfNetworkFails(fn, pullPromise) {
3357
- if (pullPromise.$$isMarkedToAbort) {
3358
- return Promise.reject('aborted');
3359
- }
3360
- const promise = this.networkService.retryIfNetworkFails(fn);
3361
- pullProcessManager.add(pullPromise, promise);
3362
- promise.catch(i1$1.noop)
3363
- .then(() => {
3364
- pullProcessManager.remove(pullPromise, promise);
3365
- });
3366
- return promise;
3367
- }
3368
- /**
3369
- * Tries to cancel the corresponding pull process that gave the given promise.
3370
- * @param promise
3371
- * @returns {any}
3372
- */
3373
- cancel(promise) {
3374
- return pullProcessManager.abort(promise);
3375
- }
3376
- /**
3377
- * fetches the database from the dbName.
3378
- * @param dbName
3379
- * @returns {Promise<any>}
3380
- */
3381
- getDb(dbName) {
3382
- return this.localDBManagementService.loadDatabases()
3383
- .then(databases => {
3384
- const db = lodashEs.find(databases, { 'name': dbName });
3385
- return db || Promise.reject('Local database (' + dbName + ') not found');
3386
- });
3387
- }
3388
- /**
3389
- * @returns {any} that has total no of records fetched, start and end timestamps of last successful pull
3390
- * of data from remote server.
3391
- */
3392
- getLastPullInfo() {
3393
- return this.localKeyValueService.get(LAST_PULL_INFO_KEY).then(info => {
3394
- if (lodashEs.isString(info.startTime)) {
3395
- info.startTime = new Date(info.startTime);
3396
- }
3397
- if (lodashEs.isString(info.endTime)) {
3398
- info.endTime = new Date(info.endTime);
3399
- }
3400
- return info;
3401
- });
3402
- }
3403
- /**
3404
- * Clears (based on parameter) and pulls data ('BUNDLED' data based on parameter) from server using the
3405
- * configured rules in offline configuration.
3406
- *
3407
- * @param clearDataBeforePull boolean
3408
- * @param {Observer<any>} progressObserver
3409
- * @returns {any}
3410
- */
3411
- pullAllDbData(clearDataBeforePull, progressObserver) {
3412
- const deferred = i1$1.getAbortableDefer(), pullInfo = {
3413
- completedTaskCount: 0,
3414
- totalTaskCount: 0,
3415
- inProgress: true,
3416
- databases: [],
3417
- totalRecordsToPull: 0,
3418
- totalPulledRecordCount: 0,
3419
- startTime: new Date(),
3420
- endTime: new Date()
3421
- };
3422
- this.localDBManagementService.loadDatabases()
3423
- .then(databases => {
3424
- const dataPullPromises = lodashEs.chain(databases).filter(function (db) {
3425
- return !db.schema.isInternal;
3426
- }).map(db => {
3427
- pullProcessManager.start(deferred.promise);
3428
- const _progressObserver = { next: data => {
3429
- const i = lodashEs.findIndex(pullInfo.databases, { 'name': data.name });
3430
- if (i >= 0) {
3431
- pullInfo.databases[i] = data;
3432
- }
3433
- else {
3434
- pullInfo.databases.push(data);
3435
- }
3436
- pullInfo.totalTaskCount = lodashEs.reduce(pullInfo.databases, function (sum, dbPullInfo) {
3437
- return sum + dbPullInfo.totalTaskCount;
3438
- }, 0);
3439
- pullInfo.completedTaskCount = lodashEs.reduce(pullInfo.databases, function (sum, dbPullInfo) {
3440
- return sum + dbPullInfo.completedTaskCount;
3441
- }, 0);
3442
- pullInfo.totalPulledRecordCount = lodashEs.reduce(pullInfo.databases, function (sum, dbPullInfo) {
3443
- return sum + dbPullInfo.pulledRecordCount;
3444
- }, 0);
3445
- pullInfo.totalRecordsToPull = lodashEs.reduce(pullInfo.databases, function (sum, dbPullInfo) {
3446
- return sum + dbPullInfo.totalRecordsToPull;
3447
- }, 0);
3448
- progressObserver.next(pullInfo);
3449
- }, error: null, complete: null
3450
- };
3451
- return this._pullDbData(db, clearDataBeforePull, deferred.promise, _progressObserver);
3452
- }).value();
3453
- return Promise.all(dataPullPromises);
3454
- }).then(() => {
3455
- pullInfo.endTime = new Date();
3456
- pullInfo.inProgress = false;
3457
- this.localKeyValueService.put(LAST_PULL_INFO_KEY, pullInfo);
3458
- deferred.resolve(pullInfo);
3459
- }, deferred.reject);
3460
- return deferred.promise;
3461
- }
3462
- /**
3463
- * Clears (based on parameter) and pulls data ('BUNDLED' data based on parameter) of the given database from server using
3464
- * the configured rules in offline configuration.
3465
- *
3466
- * @param {string} databaseName
3467
- * @param {boolean} clearDataBeforePull
3468
- * @param {Observer<any>} progressObserver
3469
- * @returns {Promise}
3470
- */
3471
- pullDbData(databaseName, clearDataBeforePull, progressObserver) {
3472
- const deferred = i1$1.getAbortableDefer();
3473
- this.getDb(databaseName).then(db => {
3474
- return this._pullDbData(db, clearDataBeforePull, deferred.promise, progressObserver);
3475
- }).then(deferred.resolve, deferred.reject);
3476
- return deferred.promise;
3477
- }
3478
- /**
3479
- * Clears (based on parameter) and pulls data of the given entity and database from
3480
- * server using the configured rules in offline configuration.
3481
- * @param databaseName, name of the database from which data has to be pulled.
3482
- * @param entityName, name of the entity from which data has to be pulled
3483
- * @param clearDataBeforePull, if set to true, then data of the entity will be deleted.
3484
- * @param progressObserver, observer the progress values
3485
- */
3486
- pullEntityData(databaseName, entityName, clearDataBeforePull, progressObserver) {
3487
- const deferred = i1$1.getAbortableDefer();
3488
- this.getDb(databaseName)
3489
- .then((db) => {
3490
- return this.copyDataFromRemoteDBToLocalDB(db, entityName, clearDataBeforePull, deferred.promise, progressObserver);
3491
- }).then(deferred.resolve, deferred.reject);
3492
- return deferred.promise;
3493
- }
3494
- static { this.ɵfac = function LocalDBDataPullService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LocalDBDataPullService)(i0__namespace.ɵɵinject(i1$1__namespace.App), i0__namespace.ɵɵinject(LocalDBManagementService), i0__namespace.ɵɵinject(LocalKeyValueService), i0__namespace.ɵɵinject(i3__namespace.NetworkService)); }; }
3495
- static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: LocalDBDataPullService, factory: LocalDBDataPullService.ɵfac, providedIn: 'root' }); }
3496
- }
3497
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(LocalDBDataPullService, [{
3498
- type: i0.Injectable,
3499
- args: [{ providedIn: 'root' }]
3500
- }], () => [{ type: i1$1__namespace.App }, { type: LocalDBManagementService }, { type: LocalKeyValueService }, { type: i3__namespace.NetworkService }], null); })();
3501
-
3502
- exports.CONTEXT_KEY = CONTEXT_KEY;
3503
- exports.ChangeLogService = ChangeLogService;
3504
- exports.LAST_PUSH_INFO_KEY = LAST_PUSH_INFO_KEY;
3505
- exports.LocalDBDataPullService = LocalDBDataPullService;
3506
- exports.LocalDBManagementService = LocalDBManagementService;
3507
- exports.LocalDbService = LocalDbService;
3508
- exports.OfflineModule = OfflineModule;
3509
- exports.PushService = PushService;
3510
- exports.PushServiceImpl = PushServiceImpl;
3511
-
3512
- }));