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

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