@wavemaker/app-ng-runtime 11.8.0-next.24904 → 11.8.0-next.27301
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.
- app-ng-runtime/build-task/bundles/index.umd.js +5 -5
- app-ng-runtime/build-task/esm2022/basic/progress/progress-bar/progress-bar.build.mjs +1 -1
- app-ng-runtime/build-task/esm2022/page/page.build.mjs +3 -2
- app-ng-runtime/build-task/fesm2022/index.mjs +2 -1
- app-ng-runtime/build-task/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/advanced/carousel/bundles/index.umd.js +5 -5
- app-ng-runtime/components/advanced/carousel/esm2022/carousel.animator.mjs +3 -2
- app-ng-runtime/components/advanced/carousel/esm2022/carousel.directive.mjs +1 -1
- app-ng-runtime/components/advanced/carousel/fesm2022/index.mjs +2 -1
- app-ng-runtime/components/advanced/carousel/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/advanced/login/bundles/index.umd.js +6 -6
- app-ng-runtime/components/advanced/login/esm2022/login.component.mjs +4 -3
- app-ng-runtime/components/advanced/login/fesm2022/index.mjs +3 -2
- app-ng-runtime/components/advanced/login/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/base/bundles/index.umd.js +203 -171
- app-ng-runtime/components/base/esm2022/directives/show-in-device.directive.mjs +1 -1
- app-ng-runtime/components/base/esm2022/pipes/custom-pipes.mjs +12 -11
- app-ng-runtime/components/base/esm2022/pipes/wm-pipe.mjs +3 -2
- app-ng-runtime/components/base/esm2022/utils/data-utils.mjs +30 -29
- app-ng-runtime/components/base/esm2022/utils/form-utils.mjs +47 -41
- app-ng-runtime/components/base/esm2022/utils/live-utils.mjs +8 -7
- app-ng-runtime/components/base/esm2022/utils/widget-utils.mjs +28 -27
- app-ng-runtime/components/base/esm2022/widgets/common/base/base-container.component.mjs +4 -3
- app-ng-runtime/components/base/esm2022/widgets/common/base/base-field-validations.mjs +24 -21
- app-ng-runtime/components/base/esm2022/widgets/common/base/base.component.mjs +12 -11
- app-ng-runtime/components/base/esm2022/widgets/common/base/dataset-aware-nav.component.mjs +40 -14
- app-ng-runtime/components/base/esm2022/widgets/common/base/partial-container.directive.mjs +3 -2
- app-ng-runtime/components/base/esm2022/widgets/common/dialog/dialog.service.mjs +3 -2
- app-ng-runtime/components/base/esm2022/widgets/common/lazy-load/lazy-load.directive.mjs +1 -1
- app-ng-runtime/components/base/esm2022/widgets/common/partial/partial.directive.mjs +3 -2
- app-ng-runtime/components/base/esm2022/widgets/common/partial-param/partial-param.directive.mjs +3 -2
- app-ng-runtime/components/base/esm2022/widgets/common/smooth-scroll/smooth-scroll.directive.mjs +6 -5
- app-ng-runtime/components/base/esm2022/widgets/framework/deviceview.mjs +1 -1
- app-ng-runtime/components/base/esm2022/widgets/framework/property-change-handler.mjs +3 -2
- app-ng-runtime/components/base/esm2022/widgets/framework/widget-proxy-provider.mjs +4 -3
- app-ng-runtime/components/base/fesm2022/index.mjs +206 -173
- app-ng-runtime/components/base/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/base/pipes/custom-pipes.d.ts +1 -1
- app-ng-runtime/components/base/utils/data-utils.d.ts +0 -1
- app-ng-runtime/components/base/utils/widget-utils.d.ts +2 -2
- app-ng-runtime/components/base/widgets/common/base/base-field-validations.d.ts +1 -1
- app-ng-runtime/components/base/widgets/common/base/partial-container.directive.d.ts +1 -1
- app-ng-runtime/components/basic/default/bundles/index.umd.js +10 -10
- app-ng-runtime/components/basic/default/esm2022/label/label.directive.mjs +4 -3
- app-ng-runtime/components/basic/default/esm2022/spinner/spinner.component.mjs +6 -5
- app-ng-runtime/components/basic/default/fesm2022/index.mjs +7 -6
- app-ng-runtime/components/basic/default/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/basic/progress/bundles/index.umd.js +13 -13
- app-ng-runtime/components/basic/progress/esm2022/progress-bar/progress-bar.component.mjs +5 -4
- app-ng-runtime/components/basic/progress/esm2022/progress-circle/progress-circle.component.mjs +6 -5
- app-ng-runtime/components/basic/progress/esm2022/utils.mjs +3 -3
- app-ng-runtime/components/basic/progress/fesm2022/index.mjs +10 -9
- app-ng-runtime/components/basic/progress/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/basic/rich-text-editor/bundles/index.umd.js +15 -10
- app-ng-runtime/components/basic/rich-text-editor/esm2022/rich-text-editor.component.mjs +14 -8
- app-ng-runtime/components/basic/rich-text-editor/fesm2022/index.mjs +13 -7
- app-ng-runtime/components/basic/rich-text-editor/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/basic/rich-text-editor/rich-text-editor.component.d.ts +2 -2
- app-ng-runtime/components/basic/search/bundles/index.umd.js +67 -65
- app-ng-runtime/components/basic/search/esm2022/data-provider/data-provider.mjs +1 -1
- app-ng-runtime/components/basic/search/esm2022/data-provider/local-data-provider.mjs +26 -23
- app-ng-runtime/components/basic/search/esm2022/data-provider/remote-data-provider.mjs +12 -11
- app-ng-runtime/components/basic/search/esm2022/search.component.mjs +31 -30
- app-ng-runtime/components/basic/search/fesm2022/index.mjs +66 -63
- app-ng-runtime/components/basic/search/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/basic/tree/bundles/index.umd.js +9 -9
- app-ng-runtime/components/basic/tree/esm2022/tree.component.mjs +7 -6
- app-ng-runtime/components/basic/tree/fesm2022/index.mjs +6 -5
- app-ng-runtime/components/basic/tree/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/chart/bundles/index.umd.js +72 -63
- app-ng-runtime/components/chart/chart.component.d.ts +1 -1
- app-ng-runtime/components/chart/chart.utils.d.ts +3 -3
- app-ng-runtime/components/chart/esm2022/chart.component.mjs +58 -48
- app-ng-runtime/components/chart/esm2022/chart.utils.mjs +14 -13
- app-ng-runtime/components/chart/fesm2022/index.mjs +69 -59
- app-ng-runtime/components/chart/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/containers/accordion/bundles/index.umd.js +16 -16
- app-ng-runtime/components/containers/accordion/esm2022/accordion.directive.mjs +14 -13
- app-ng-runtime/components/containers/accordion/fesm2022/index.mjs +13 -12
- app-ng-runtime/components/containers/accordion/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/containers/panel/bundles/index.umd.js +5 -5
- app-ng-runtime/components/containers/panel/esm2022/panel.component.mjs +3 -2
- app-ng-runtime/components/containers/panel/fesm2022/index.mjs +2 -1
- app-ng-runtime/components/containers/panel/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/containers/panel/panel.component.d.ts +1 -1
- app-ng-runtime/components/containers/tabs/bundles/index.umd.js +17 -17
- app-ng-runtime/components/containers/tabs/esm2022/tabs.component.mjs +15 -14
- app-ng-runtime/components/containers/tabs/fesm2022/index.mjs +14 -13
- app-ng-runtime/components/containers/tabs/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/data/form/bundles/index.umd.js +75 -75
- app-ng-runtime/components/data/form/esm2022/form-action/form-action.directive.mjs +3 -2
- app-ng-runtime/components/data/form/esm2022/form-field/form-field.directive.mjs +10 -9
- app-ng-runtime/components/data/form/esm2022/form.component.mjs +54 -53
- app-ng-runtime/components/data/form/esm2022/live-filter/live-filter.directive.mjs +3 -2
- app-ng-runtime/components/data/form/esm2022/live-form/live-form.directive.mjs +11 -10
- app-ng-runtime/components/data/form/fesm2022/index.mjs +77 -76
- app-ng-runtime/components/data/form/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/data/form/form.component.d.ts +2 -2
- app-ng-runtime/components/data/form/live-form/live-form.directive.d.ts +1 -1
- app-ng-runtime/components/data/list/bundles/index.umd.js +692 -687
- app-ng-runtime/components/data/list/esm2022/list-item.directive.mjs +1 -1
- app-ng-runtime/components/data/list/esm2022/list.animator.mjs +5 -3
- app-ng-runtime/components/data/list/esm2022/list.component.mjs +687 -682
- app-ng-runtime/components/data/list/fesm2022/index.mjs +690 -684
- app-ng-runtime/components/data/list/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/data/list/list.component.d.ts +53 -53
- app-ng-runtime/components/data/live-table/bundles/index.umd.js +1 -1
- app-ng-runtime/components/data/live-table/esm2022/live-table.component.mjs +2 -2
- app-ng-runtime/components/data/live-table/fesm2022/index.mjs +1 -1
- app-ng-runtime/components/data/live-table/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/data/pagination/bundles/index.umd.js +14 -14
- app-ng-runtime/components/data/pagination/esm2022/pagination.component.mjs +12 -11
- app-ng-runtime/components/data/pagination/fesm2022/index.mjs +11 -10
- app-ng-runtime/components/data/pagination/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/data/table/bundles/index.umd.js +175 -172
- app-ng-runtime/components/data/table/esm2022/table-action/table-action.directive.mjs +3 -2
- app-ng-runtime/components/data/table/esm2022/table-column/table-column.directive.mjs +19 -18
- app-ng-runtime/components/data/table/esm2022/table-cud.directive.mjs +7 -6
- app-ng-runtime/components/data/table/esm2022/table-filter.directive.mjs +53 -55
- app-ng-runtime/components/data/table/esm2022/table-row-action/table-row-action.directive.mjs +3 -2
- app-ng-runtime/components/data/table/esm2022/table.component.mjs +98 -91
- app-ng-runtime/components/data/table/fesm2022/index.mjs +172 -168
- app-ng-runtime/components/data/table/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/data/table/table-column/table-column.directive.d.ts +6 -6
- app-ng-runtime/components/data/table/table.component.d.ts +2 -2
- app-ng-runtime/components/dialogs/default/bundles/index.umd.js +2 -2
- app-ng-runtime/components/dialogs/default/esm2022/base-dialog.mjs +3 -3
- app-ng-runtime/components/dialogs/default/esm2022/dialog-body/dialog-body.directive.mjs +1 -1
- app-ng-runtime/components/dialogs/default/fesm2022/index.mjs +1 -1
- app-ng-runtime/components/dialogs/default/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/input/calendar/bundles/index.umd.js +33 -31
- app-ng-runtime/components/input/calendar/esm2022/calendar.component.mjs +31 -28
- app-ng-runtime/components/input/calendar/fesm2022/index.mjs +30 -27
- app-ng-runtime/components/input/calendar/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/input/chips/bundles/index.umd.js +29 -28
- app-ng-runtime/components/input/chips/chips.component.d.ts +1 -1
- app-ng-runtime/components/input/chips/esm2022/chips.component.mjs +27 -25
- app-ng-runtime/components/input/chips/fesm2022/index.mjs +26 -24
- app-ng-runtime/components/input/chips/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/input/default/base-form.component.d.ts +3 -3
- app-ng-runtime/components/input/default/bundles/index.umd.js +75 -62
- app-ng-runtime/components/input/default/checkbox/checkbox.component.d.ts +1 -0
- app-ng-runtime/components/input/default/dataset-aware-form.component.d.ts +4 -4
- app-ng-runtime/components/input/default/esm2022/base-form.component.mjs +14 -8
- app-ng-runtime/components/input/default/esm2022/caption-position.directive.mjs +3 -2
- app-ng-runtime/components/input/default/esm2022/checkbox/checkbox.component.mjs +2 -2
- app-ng-runtime/components/input/default/esm2022/checkboxset/checkboxset.component.mjs +6 -4
- app-ng-runtime/components/input/default/esm2022/dataset-aware-form.component.mjs +29 -23
- app-ng-runtime/components/input/default/esm2022/radioset/radioset.component.mjs +4 -3
- app-ng-runtime/components/input/default/esm2022/select/select.component.mjs +4 -3
- app-ng-runtime/components/input/default/esm2022/switch/switch.component.mjs +6 -5
- app-ng-runtime/components/input/default/esm2022/text/base/base-input.mjs +4 -3
- app-ng-runtime/components/input/default/esm2022/text/locale/number-locale.mjs +20 -18
- app-ng-runtime/components/input/default/esm2022/text/text/input-text.component.mjs +2 -2
- app-ng-runtime/components/input/default/fesm2022/index.mjs +75 -62
- app-ng-runtime/components/input/default/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/input/epoch/base-date-time.component.d.ts +1 -1
- app-ng-runtime/components/input/epoch/bundles/index.umd.js +53 -51
- app-ng-runtime/components/input/epoch/esm2022/base-date-time.component.mjs +34 -31
- app-ng-runtime/components/input/epoch/esm2022/date/date.component.mjs +5 -4
- app-ng-runtime/components/input/epoch/esm2022/date-time/date-time-picker.component.mjs +5 -4
- app-ng-runtime/components/input/epoch/esm2022/date-time/date-time.component.mjs +7 -6
- app-ng-runtime/components/input/epoch/esm2022/picker/picker.component.mjs +1 -1
- app-ng-runtime/components/input/epoch/esm2022/time/time.component.mjs +6 -5
- app-ng-runtime/components/input/epoch/fesm2022/index.mjs +48 -45
- app-ng-runtime/components/input/epoch/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/input/file-upload/bundles/index.umd.js +15 -15
- app-ng-runtime/components/input/file-upload/esm2022/file-upload.component.mjs +13 -12
- app-ng-runtime/components/input/file-upload/fesm2022/index.mjs +12 -11
- app-ng-runtime/components/input/file-upload/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/input/rating/bundles/index.umd.js +12 -12
- app-ng-runtime/components/input/rating/esm2022/rating.component.mjs +10 -9
- app-ng-runtime/components/input/rating/fesm2022/index.mjs +9 -8
- app-ng-runtime/components/input/rating/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/navigation/breadcrumb/bundles/index.umd.js +1 -1
- app-ng-runtime/components/navigation/breadcrumb/esm2022/breadcrumb.component.mjs +2 -2
- app-ng-runtime/components/navigation/breadcrumb/fesm2022/index.mjs +1 -1
- app-ng-runtime/components/navigation/breadcrumb/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/navigation/menu/bundles/index.umd.js +23 -22
- app-ng-runtime/components/navigation/menu/esm2022/menu-adapator.component.mjs +3 -2
- app-ng-runtime/components/navigation/menu/esm2022/menu-dropdown-item/menu-dropdown-item.component.mjs +6 -5
- app-ng-runtime/components/navigation/menu/esm2022/menu.component.mjs +8 -7
- app-ng-runtime/components/navigation/menu/esm2022/nav/nav.component.mjs +10 -8
- app-ng-runtime/components/navigation/menu/fesm2022/index.mjs +20 -18
- app-ng-runtime/components/navigation/menu/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/navigation/menu/menu-dropdown-item/menu-dropdown-item.component.d.ts +12 -1
- app-ng-runtime/components/navigation/popover/esm2022/popover.component.mjs +1 -1
- app-ng-runtime/components/navigation/popover/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/components/prefab/bundles/index.umd.js +6 -6
- app-ng-runtime/components/prefab/esm2022/prefab-container/prefab-container.directive.mjs +3 -2
- app-ng-runtime/components/prefab/esm2022/prefab.directive.mjs +3 -2
- app-ng-runtime/components/prefab/fesm2022/index.mjs +3 -2
- app-ng-runtime/components/prefab/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/core/bundles/index.umd.js +119 -130
- app-ng-runtime/core/esm2022/public_api.mjs +2 -2
- app-ng-runtime/core/esm2022/services/field-type.service.mjs +3 -2
- app-ng-runtime/core/esm2022/services/field-widget.service.mjs +3 -2
- app-ng-runtime/core/esm2022/services/pagination.service.mjs +7 -6
- app-ng-runtime/core/esm2022/services/state-persistence.service.mjs +17 -16
- app-ng-runtime/core/esm2022/services/utils.service.mjs +3 -2
- app-ng-runtime/core/esm2022/services/viewport.service.mjs +3 -2
- app-ng-runtime/core/esm2022/utils/build-utils.mjs +5 -4
- app-ng-runtime/core/esm2022/utils/expression-parser.mjs +5 -4
- app-ng-runtime/core/esm2022/utils/lru-cache.mjs +3 -2
- app-ng-runtime/core/esm2022/utils/utils.mjs +79 -82
- app-ng-runtime/core/esm2022/utils/watcher.mjs +9 -7
- app-ng-runtime/core/fesm2022/index.mjs +117 -123
- app-ng-runtime/core/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/core/public_api.d.ts +1 -1
- app-ng-runtime/core/services/pagination.service.d.ts +1 -1
- app-ng-runtime/core/utils/utils.d.ts +5 -9
- app-ng-runtime/http/bundles/index.umd.js +7 -7
- app-ng-runtime/http/esm2022/http.service.mjs +5 -4
- app-ng-runtime/http/esm2022/wm-http-request.mjs +1 -1
- app-ng-runtime/http/esm2022/wm-http-response.mjs +1 -1
- app-ng-runtime/http/fesm2022/index.mjs +4 -3
- app-ng-runtime/http/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/components/basic/default/bundles/index.umd.js +24 -20
- app-ng-runtime/mobile/components/basic/default/esm2022/anchor/anchor.directive.mjs +5 -4
- app-ng-runtime/mobile/components/basic/default/esm2022/file-browser/file-browser.component.mjs +12 -8
- app-ng-runtime/mobile/components/basic/default/esm2022/file-browser/file-selector.service.mjs +5 -3
- app-ng-runtime/mobile/components/basic/default/esm2022/image-cache/image-cache.directive.mjs +3 -2
- app-ng-runtime/mobile/components/basic/default/esm2022/process-manager/process-manager.component.mjs +5 -4
- app-ng-runtime/mobile/components/basic/default/fesm2022/index.mjs +21 -16
- app-ng-runtime/mobile/components/basic/default/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/components/containers/segmented-control/bundles/index.umd.js +7 -7
- app-ng-runtime/mobile/components/containers/segmented-control/esm2022/segment-content/segment-content.component.mjs +2 -2
- app-ng-runtime/mobile/components/containers/segmented-control/esm2022/segmented-control.component.mjs +4 -3
- app-ng-runtime/mobile/components/containers/segmented-control/fesm2022/index.mjs +4 -3
- app-ng-runtime/mobile/components/containers/segmented-control/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/components/data/media-list/bundles/index.umd.js +8 -8
- app-ng-runtime/mobile/components/data/media-list/esm2022/media-list.component.mjs +4 -3
- app-ng-runtime/mobile/components/data/media-list/fesm2022/index.mjs +3 -2
- app-ng-runtime/mobile/components/data/media-list/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/components/page/default/bundles/index.umd.js +5 -5
- app-ng-runtime/mobile/components/page/default/esm2022/page.directive.mjs +3 -2
- app-ng-runtime/mobile/components/page/default/fesm2022/index.mjs +2 -1
- app-ng-runtime/mobile/components/page/default/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/components/page/tab-bar/bundles/index.umd.js +9 -9
- app-ng-runtime/mobile/components/page/tab-bar/esm2022/tabbar.component.mjs +7 -6
- app-ng-runtime/mobile/components/page/tab-bar/fesm2022/index.mjs +6 -5
- app-ng-runtime/mobile/components/page/tab-bar/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/core/bundles/index.umd.js +25 -25
- app-ng-runtime/mobile/core/esm2022/services/device-file-download.service.mjs +5 -4
- app-ng-runtime/mobile/core/esm2022/services/device-file-opener.service.mjs +3 -2
- app-ng-runtime/mobile/core/esm2022/services/device-file-upload.service.mjs +4 -3
- app-ng-runtime/mobile/core/esm2022/services/device-file.service.mjs +6 -5
- app-ng-runtime/mobile/core/esm2022/services/device.service.mjs +3 -2
- app-ng-runtime/mobile/core/esm2022/services/ext-app-message.service.mjs +5 -4
- app-ng-runtime/mobile/core/esm2022/services/network.service.mjs +9 -8
- app-ng-runtime/mobile/core/fesm2022/index.mjs +22 -21
- app-ng-runtime/mobile/core/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/core/services/ext-app-message.service.d.ts +1 -1
- app-ng-runtime/mobile/core/services/network.service.d.ts +7 -1
- app-ng-runtime/mobile/offline/bundles/index.umd.js +161 -144
- app-ng-runtime/mobile/offline/esm2022/models/local-db-store.mjs +23 -21
- app-ng-runtime/mobile/offline/esm2022/services/change-log.service.mjs +7 -6
- app-ng-runtime/mobile/offline/esm2022/services/local-db-data-pull.service.mjs +37 -35
- app-ng-runtime/mobile/offline/esm2022/services/local-db-management.service.mjs +54 -45
- app-ng-runtime/mobile/offline/esm2022/services/local-db.service.mjs +5 -4
- app-ng-runtime/mobile/offline/esm2022/services/workers/error-blocker.mjs +4 -3
- app-ng-runtime/mobile/offline/esm2022/services/workers/file-handler.mjs +18 -13
- app-ng-runtime/mobile/offline/esm2022/services/workers/multi-part-param-transformer.mjs +9 -5
- app-ng-runtime/mobile/offline/esm2022/utils/live-variable.utils.mjs +12 -11
- app-ng-runtime/mobile/offline/esm2022/utils/query-executor.utils.mjs +5 -4
- app-ng-runtime/mobile/offline/esm2022/utils/security.utils.mjs +3 -2
- app-ng-runtime/mobile/offline/fesm2022/index.mjs +156 -138
- app-ng-runtime/mobile/offline/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/runtime/bundles/index.umd.js +11 -8
- app-ng-runtime/mobile/runtime/esm2022/mobile-runtime.module.mjs +3 -2
- app-ng-runtime/mobile/runtime/esm2022/services/cookie.service.mjs +6 -2
- app-ng-runtime/mobile/runtime/esm2022/services/http-interceptor.service.mjs +4 -3
- app-ng-runtime/mobile/runtime/fesm2022/index.mjs +8 -4
- app-ng-runtime/mobile/runtime/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/runtime-dynamic/bundles/index.umd.js +2 -2
- app-ng-runtime/mobile/runtime-dynamic/esm2022/services/live-sync.service.mjs +3 -3
- app-ng-runtime/mobile/runtime-dynamic/fesm2022/index.mjs +2 -2
- app-ng-runtime/mobile/runtime-dynamic/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/mobile/variables/bundles/index.umd.js +23 -16
- app-ng-runtime/mobile/variables/esm2022/services/camera-service.mjs +2 -2
- app-ng-runtime/mobile/variables/esm2022/services/datasync-service.mjs +10 -9
- app-ng-runtime/mobile/variables/esm2022/services/file-service.mjs +11 -3
- app-ng-runtime/mobile/variables/fesm2022/index.mjs +19 -11
- app-ng-runtime/mobile/variables/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/oAuth/bundles/index.umd.js +12 -12
- app-ng-runtime/oAuth/esm2022/oAuth.service.mjs +4 -3
- app-ng-runtime/oAuth/esm2022/oAuth.utils.mjs +8 -7
- app-ng-runtime/oAuth/fesm2022/index.mjs +9 -8
- app-ng-runtime/oAuth/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/package.json +1 -1
- app-ng-runtime/runtime/base/bundles/index.umd.js +121 -120
- app-ng-runtime/runtime/base/esm2022/components/base-layout.component.mjs +4 -3
- app-ng-runtime/runtime/base/esm2022/components/base-page.component.mjs +14 -13
- app-ng-runtime/runtime/base/esm2022/components/base-partial.component.mjs +13 -12
- app-ng-runtime/runtime/base/esm2022/components/base-prefab.component.mjs +15 -14
- app-ng-runtime/runtime/base/esm2022/components/base-spa-page.component.mjs +14 -13
- app-ng-runtime/runtime/base/esm2022/components/custom-toaster.component.mjs +6 -5
- app-ng-runtime/runtime/base/esm2022/directives/accessroles.directive.mjs +11 -10
- app-ng-runtime/runtime/base/esm2022/guards/page-not-found.guard.mjs +1 -1
- app-ng-runtime/runtime/base/esm2022/guards/role.guard.mjs +3 -2
- app-ng-runtime/runtime/base/esm2022/services/app-defaults.service.mjs +1 -1
- app-ng-runtime/runtime/base/esm2022/services/app.manager.service.mjs +17 -14
- app-ng-runtime/runtime/base/esm2022/services/app.service.mjs +7 -6
- app-ng-runtime/runtime/base/esm2022/services/dynamic-component-ref-provider.service.mjs +3 -2
- app-ng-runtime/runtime/base/esm2022/services/http-interceptor.services.mjs +4 -3
- app-ng-runtime/runtime/base/esm2022/services/i18n.service.mjs +12 -10
- app-ng-runtime/runtime/base/esm2022/services/navigation.service.mjs +8 -7
- app-ng-runtime/runtime/base/esm2022/services/prefab-manager.service.mjs +3 -2
- app-ng-runtime/runtime/base/esm2022/services/spinner.service.mjs +7 -6
- app-ng-runtime/runtime/base/esm2022/services/toaster.service.mjs +6 -5
- app-ng-runtime/runtime/base/esm2022/util/wm-route-reuse-strategy.mjs +6 -7
- app-ng-runtime/runtime/base/fesm2022/index.mjs +119 -117
- app-ng-runtime/runtime/base/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/runtime/base/services/i18n.service.d.ts +1 -1
- app-ng-runtime/runtime/dynamic/bundles/index.umd.js +7 -7
- app-ng-runtime/runtime/dynamic/esm2022/app/services/component-ref-provider.service.mjs +4 -3
- app-ng-runtime/runtime/dynamic/esm2022/main.mjs +3 -2
- app-ng-runtime/runtime/dynamic/fesm2022/index.mjs +4 -3
- app-ng-runtime/runtime/dynamic/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/scripts/jquery-ui/ui/widgets/droppable.js +7 -7
- app-ng-runtime/scripts/jquery-ui/ui/widgets/resizable.js +13 -10
- app-ng-runtime/scripts/jquery-ui/ui/widgets/sortable.js +7 -7
- app-ng-runtime/security/bundles/index.umd.js +14 -14
- app-ng-runtime/security/esm2022/security.service.mjs +12 -11
- app-ng-runtime/security/fesm2022/index.mjs +11 -10
- app-ng-runtime/security/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/security/security.service.d.ts +1 -1
- app-ng-runtime/swipey/esm2022/swipe.animation.mjs +1 -1
- app-ng-runtime/swipey/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/transpiler/bundles/index.umd.js +10 -9
- app-ng-runtime/transpiler/esm2022/build.mjs +8 -6
- app-ng-runtime/transpiler/fesm2022/index.mjs +7 -5
- app-ng-runtime/transpiler/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/variables/bundles/index.umd.js +155 -145
- app-ng-runtime/variables/esm2022/manager/action/login-action.manager.mjs +15 -14
- app-ng-runtime/variables/esm2022/manager/action/notification-action.manager.mjs +9 -8
- app-ng-runtime/variables/esm2022/manager/variable/base-variable.manager.mjs +3 -2
- app-ng-runtime/variables/esm2022/manager/variable/web-socket-variable.manager.mjs +11 -10
- app-ng-runtime/variables/esm2022/service/variables.service.mjs +7 -6
- app-ng-runtime/variables/esm2022/util/action/navigation-action.utils.mjs +4 -4
- app-ng-runtime/variables/esm2022/util/variable/pagination.utils.mjs +30 -23
- app-ng-runtime/variables/esm2022/util/variable/service-variable.utils.mjs +29 -28
- app-ng-runtime/variables/esm2022/util/variable/variables.utils.mjs +75 -70
- app-ng-runtime/variables/fesm2022/index.mjs +169 -158
- app-ng-runtime/variables/fesm2022/index.mjs.map +1 -1
- app-ng-runtime/variables/util/variable/service-variable.utils.d.ts +1 -1
|
@@ -3,12 +3,13 @@ import { Injectable, NgModule } from '@angular/core';
|
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import * as i3$1 from '@awesome-cordova-plugins/file/ngx';
|
|
5
5
|
import * as i1$1 from '@wm/core';
|
|
6
|
-
import { isDefined, convertToBlob, toPromise, DataType, extractType, DEFAULT_FORMATS, isIos, noop, executePromiseChain, isAndroid, transformFileURI,
|
|
6
|
+
import { isDefined, convertToBlob, toPromise, DataType, extractType, DEFAULT_FORMATS, isIos, noop, executePromiseChain, isAndroid, transformFileURI, getAbortableDefer, triggerFn, hasCordova, $parseExpr, defer } from '@wm/core';
|
|
7
7
|
import * as i3 from '@wm/mobile/core';
|
|
8
8
|
import * as i5 from '@wm/security';
|
|
9
9
|
import * as i1 from '@awesome-cordova-plugins/app-version/ngx';
|
|
10
10
|
import * as i6 from '@awesome-cordova-plugins/sqlite/ngx';
|
|
11
11
|
import { SWAGGER_CONSTANTS, formatDate } from '@wm/variables';
|
|
12
|
+
import { forEach, find, isEmpty, isString, trim, map, 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';
|
|
12
13
|
import { from } from 'rxjs';
|
|
13
14
|
import { LVService, LiveVariableUtils } from '@wavemaker/variables';
|
|
14
15
|
|
|
@@ -107,7 +108,7 @@ const escapeName = (name) => {
|
|
|
107
108
|
|
|
108
109
|
const insertRecordSqlTemplate = (schema) => {
|
|
109
110
|
const columnNames = [], placeHolder = [];
|
|
110
|
-
|
|
111
|
+
forEach(schema.columns, col => {
|
|
111
112
|
columnNames.push(escapeName(col.name));
|
|
112
113
|
placeHolder.push('?');
|
|
113
114
|
});
|
|
@@ -115,14 +116,14 @@ const insertRecordSqlTemplate = (schema) => {
|
|
|
115
116
|
};
|
|
116
117
|
const replaceRecordSqlTemplate = (schema) => {
|
|
117
118
|
const columnNames = [], placeHolder = [];
|
|
118
|
-
|
|
119
|
+
forEach(schema.columns, col => {
|
|
119
120
|
columnNames.push(escapeName(col.name));
|
|
120
121
|
placeHolder.push('?');
|
|
121
122
|
});
|
|
122
123
|
return `REPLACE INTO ${escapeName(schema.name)} (${columnNames.join(',')}) VALUES (${placeHolder.join(',')})`;
|
|
123
124
|
};
|
|
124
125
|
const deleteRecordTemplate = (schema) => {
|
|
125
|
-
const primaryKeyField =
|
|
126
|
+
const primaryKeyField = find(schema.columns, 'primaryKey');
|
|
126
127
|
if (primaryKeyField) {
|
|
127
128
|
return `DELETE FROM ${escapeName(schema.name)} WHERE ${escapeName(primaryKeyField.name)} = ?`;
|
|
128
129
|
}
|
|
@@ -136,7 +137,7 @@ const selectSqlTemplate = (schema) => {
|
|
|
136
137
|
if (col.foreignRelations) {
|
|
137
138
|
col.foreignRelations.forEach(foreignRelation => {
|
|
138
139
|
childTableName = foreignRelation.sourceFieldName;
|
|
139
|
-
|
|
140
|
+
forEach(foreignRelation.dataMapper, (childCol, childFiledName) => {
|
|
140
141
|
columns.push(childTableName + '.' + escapeName(childCol.name) + ' as \'' + childFiledName + '\'');
|
|
141
142
|
});
|
|
142
143
|
joins.push(` LEFT JOIN ${escapeName(foreignRelation.targetTable)} ${childTableName}
|
|
@@ -163,7 +164,7 @@ const countQueryTemplate = (schema) => {
|
|
|
163
164
|
const generateWherClause = (store, filterCriteria) => {
|
|
164
165
|
let conditions;
|
|
165
166
|
const fieldToColumnMapping = store.fieldToColumnMapping, tableName = store.entitySchema.name;
|
|
166
|
-
if (!
|
|
167
|
+
if (!isEmpty(filterCriteria) && isString(filterCriteria)) {
|
|
167
168
|
return ' WHERE ' + filterCriteria;
|
|
168
169
|
}
|
|
169
170
|
if (filterCriteria) {
|
|
@@ -195,8 +196,8 @@ const generateWherClause = (store, filterCriteria) => {
|
|
|
195
196
|
};
|
|
196
197
|
const generateOrderByClause = (store, sort) => {
|
|
197
198
|
if (sort) {
|
|
198
|
-
return ' ORDER BY ' +
|
|
199
|
-
const splits =
|
|
199
|
+
return ' ORDER BY ' + map(sort.split(','), field => {
|
|
200
|
+
const splits = trim(field).split(' ');
|
|
200
201
|
splits[0] = escapeName(store.entitySchema.name) + '.' + escapeName(store.fieldToColumnMapping[splits[0]]);
|
|
201
202
|
return splits.join(' ');
|
|
202
203
|
}).join(',');
|
|
@@ -213,7 +214,7 @@ const mapRowDataToObj = (schema, dataObj) => {
|
|
|
213
214
|
if (col.foreignRelations) {
|
|
214
215
|
col.foreignRelations.forEach(foreignRelation => {
|
|
215
216
|
let childEntity = null;
|
|
216
|
-
|
|
217
|
+
forEach(foreignRelation.dataMapper, function (childCol, childFieldName) {
|
|
217
218
|
const fieldValue = dataObj[childFieldName];
|
|
218
219
|
if (isDefined(fieldValue) && fieldValue !== null && fieldValue !== '') {
|
|
219
220
|
childEntity = childEntity || {};
|
|
@@ -224,7 +225,7 @@ const mapRowDataToObj = (schema, dataObj) => {
|
|
|
224
225
|
dataObj[foreignRelation.sourceFieldName] = childEntity;
|
|
225
226
|
});
|
|
226
227
|
}
|
|
227
|
-
else if (col.sqlType === 'boolean' && !
|
|
228
|
+
else if (col.sqlType === 'boolean' && !isNil(val)) {
|
|
228
229
|
dataObj[col.fieldName] = (val === 1);
|
|
229
230
|
}
|
|
230
231
|
});
|
|
@@ -241,7 +242,7 @@ const getValue = (entity, col) => {
|
|
|
241
242
|
return false;
|
|
242
243
|
});
|
|
243
244
|
}
|
|
244
|
-
if (
|
|
245
|
+
if (isNil(value)) {
|
|
245
246
|
return col.defaultValue;
|
|
246
247
|
}
|
|
247
248
|
else if (col.sqlType === 'boolean') {
|
|
@@ -264,14 +265,14 @@ class LocalDBStore {
|
|
|
264
265
|
this.localDbManagementService = localDbManagementService;
|
|
265
266
|
this.sqliteObject = sqliteObject;
|
|
266
267
|
this.fieldToColumnMapping = {};
|
|
267
|
-
this.primaryKeyField =
|
|
268
|
+
this.primaryKeyField = find(this.entitySchema.columns, 'primaryKey');
|
|
268
269
|
this.primaryKeyName = this.primaryKeyField ? this.primaryKeyField.fieldName : undefined;
|
|
269
270
|
this.entitySchema.columns.forEach(c => {
|
|
270
271
|
this.fieldToColumnMapping[c.fieldName] = c.name;
|
|
271
272
|
if (c.foreignRelations) {
|
|
272
273
|
c.foreignRelations.forEach(foreignRelation => {
|
|
273
274
|
this.fieldToColumnMapping[foreignRelation.targetPath] = c.name;
|
|
274
|
-
|
|
275
|
+
forEach(foreignRelation.dataMapper, (childCol, childFieldName) => {
|
|
275
276
|
this.fieldToColumnMapping[childFieldName] = foreignRelation.sourceFieldName + '.' + childCol.name;
|
|
276
277
|
});
|
|
277
278
|
});
|
|
@@ -287,7 +288,7 @@ class LocalDBStore {
|
|
|
287
288
|
if (this.primaryKeyName) {
|
|
288
289
|
const idValue = entity[this.primaryKeyName];
|
|
289
290
|
if (this.primaryKeyField.sqlType === 'number'
|
|
290
|
-
&& (!isDefined(idValue) || (
|
|
291
|
+
&& (!isDefined(idValue) || (isString(idValue) && isEmpty(trim(idValue))))) {
|
|
291
292
|
if (this.primaryKeyField.generatorType === 'identity') {
|
|
292
293
|
// updating the id with the latest id obtained from nextId.
|
|
293
294
|
entity[this.primaryKeyName] = this.localDbManagementService.nextIdCount();
|
|
@@ -416,8 +417,8 @@ class LocalDBStore {
|
|
|
416
417
|
*/
|
|
417
418
|
saveAll(entities) {
|
|
418
419
|
// filtering the null entities
|
|
419
|
-
entities =
|
|
420
|
-
const queries =
|
|
420
|
+
entities = filter(entities, null);
|
|
421
|
+
const queries = map(entities, entity => {
|
|
421
422
|
const rowData = mapObjToRow(this, entity);
|
|
422
423
|
const params = this.entitySchema.columns.map(f => rowData[f.name]);
|
|
423
424
|
return [this.replaceRecordSqlTemplate, params];
|
|
@@ -456,13 +457,13 @@ class LocalDBStore {
|
|
|
456
457
|
* Converts form data object to map for storing request in local database..
|
|
457
458
|
*/
|
|
458
459
|
serializeFormDataToMap(formData) {
|
|
459
|
-
const blobColumns =
|
|
460
|
+
const blobColumns = filter(this.entitySchema.columns, {
|
|
460
461
|
'sqlType': 'blob'
|
|
461
462
|
}), promises = [];
|
|
462
463
|
let map = {};
|
|
463
464
|
if (formData && typeof formData.append === 'function' && formData.rowData) {
|
|
464
|
-
|
|
465
|
-
if (fieldData &&
|
|
465
|
+
forEach(formData.rowData, (fieldData, fieldName) => {
|
|
466
|
+
if (fieldData && find(blobColumns, { 'fieldName': fieldName })) {
|
|
466
467
|
promises.push(this.saveBlobToFile(fieldData).then(localFile => {
|
|
467
468
|
map[fieldName] = localFile;
|
|
468
469
|
}));
|
|
@@ -482,7 +483,7 @@ class LocalDBStore {
|
|
|
482
483
|
*/
|
|
483
484
|
deserializeMapToFormData(map) {
|
|
484
485
|
const formData = new FormData(), blobColumns = this.entitySchema.columns.filter(c => c.sqlType === 'blob'), promises = [];
|
|
485
|
-
|
|
486
|
+
forEach(blobColumns, column => {
|
|
486
487
|
const value = map[column.fieldName];
|
|
487
488
|
if (value && value.wmLocalPath) {
|
|
488
489
|
promises.push(convertToBlob(value.wmLocalPath)
|
|
@@ -496,7 +497,8 @@ class LocalDBStore {
|
|
|
496
497
|
return Promise.all(promises).then(() => formData);
|
|
497
498
|
}
|
|
498
499
|
createTableSql(schema) {
|
|
499
|
-
|
|
500
|
+
// @ts-ignore
|
|
501
|
+
const fieldStr = reduce(schema.columns, (result, f) => {
|
|
500
502
|
let str = escapeName(f.name);
|
|
501
503
|
if (f.primaryKey) {
|
|
502
504
|
if (f.sqlType === 'number' && f.generatorType === 'databaseIdentity') {
|
|
@@ -676,7 +678,8 @@ class LocalDBManagementService {
|
|
|
676
678
|
return new Promise((resolve, reject) => {
|
|
677
679
|
// Before closing databases, give some time for the pending transactions (if any).
|
|
678
680
|
setTimeout(() => {
|
|
679
|
-
|
|
681
|
+
// @ts-ignore
|
|
682
|
+
const closePromises = map(values(this.databases), db => db.sqliteObject.close());
|
|
680
683
|
Promise.all(closePromises).then(resolve, reject);
|
|
681
684
|
}, 1000);
|
|
682
685
|
});
|
|
@@ -700,14 +703,14 @@ class LocalDBManagementService {
|
|
|
700
703
|
return Promise.reject(`Query by name ' ${queryName} ' Not Found`);
|
|
701
704
|
}
|
|
702
705
|
queryData = this.databases[dbName].queries[queryName];
|
|
703
|
-
paramPromises =
|
|
706
|
+
paramPromises = chain(queryData.params)
|
|
704
707
|
.filter(p => p.variableType !== 'PROMPT')
|
|
705
708
|
.forEach(p => {
|
|
706
709
|
const paramValue = this.systemProperties[p.variableType].value(p.name, params);
|
|
707
710
|
return toPromise(paramValue).then(v => params[p.name] = v);
|
|
708
711
|
}).value();
|
|
709
712
|
return Promise.all(paramPromises).then(() => {
|
|
710
|
-
params =
|
|
713
|
+
params = map(queryData.params, p => {
|
|
711
714
|
// Sqlite will accept DateTime value as below format.
|
|
712
715
|
if (typeof params[p.name] !== 'string'
|
|
713
716
|
&& (p.type === DataType.DATETIME || p.type === DataType.LOCALDATETIME)) {
|
|
@@ -722,18 +725,18 @@ class LocalDBManagementService {
|
|
|
722
725
|
return this.executeSQLQuery(dbName, queryData.query, params)
|
|
723
726
|
.then(result => {
|
|
724
727
|
let firstRow, needTransform;
|
|
725
|
-
if (!
|
|
728
|
+
if (!isEmpty(result.rows)) {
|
|
726
729
|
firstRow = result.rows[0];
|
|
727
|
-
needTransform =
|
|
728
|
-
if (!
|
|
729
|
-
result.rows =
|
|
730
|
+
needTransform = find(queryData.response.properties, p => !firstRow.hasOwnProperty(p.fieldName));
|
|
731
|
+
if (!isUndefined(needTransform)) {
|
|
732
|
+
result.rows = map(result.rows, row => {
|
|
730
733
|
const transformedRow = {}, rowWithUpperKeys = {};
|
|
731
734
|
// This is to make search for data as case-insensitive
|
|
732
|
-
|
|
733
|
-
|
|
735
|
+
forEach(row, (v, k) => rowWithUpperKeys[k.toUpperCase()] = v);
|
|
736
|
+
forEach(queryData.response.properties, p => {
|
|
734
737
|
// format the value depending on the typeRef specified in properties.
|
|
735
738
|
const propType = extractType(p.fieldType.typeRef);
|
|
736
|
-
const formatValue = DEFAULT_FORMATS[
|
|
739
|
+
const formatValue = DEFAULT_FORMATS[toUpper(propType)];
|
|
737
740
|
const fieldVal = row[p.name];
|
|
738
741
|
if (fieldVal && typeof fieldVal !== 'string'
|
|
739
742
|
&& (propType === DataType.DATETIME || propType === DataType.LOCALDATETIME || propType === DataType.DATE)) {
|
|
@@ -767,7 +770,7 @@ class LocalDBManagementService {
|
|
|
767
770
|
*/
|
|
768
771
|
exportDB() {
|
|
769
772
|
return new Promise((resolve, reject) => {
|
|
770
|
-
const folderToExport = 'offline_temp_' +
|
|
773
|
+
const folderToExport = 'offline_temp_' + now(), folderToExportFullPath = cordova.file.cacheDirectory + folderToExport + '/', zipFileName = '_offline_data.zip', metaInfo = {
|
|
771
774
|
app: null,
|
|
772
775
|
OS: '',
|
|
773
776
|
createdOn: 0
|
|
@@ -797,7 +800,7 @@ class LocalDBManagementService {
|
|
|
797
800
|
else if (isAndroid()) {
|
|
798
801
|
metaInfo.OS = 'ANDROID';
|
|
799
802
|
}
|
|
800
|
-
metaInfo.createdOn =
|
|
803
|
+
metaInfo.createdOn = now();
|
|
801
804
|
return metaInfo;
|
|
802
805
|
}).then(() => executePromiseChain(this.getCallbacksFor('preExport'), [folderToExportFullPath, metaInfo]))
|
|
803
806
|
.then(() => {
|
|
@@ -850,7 +853,7 @@ class LocalDBManagementService {
|
|
|
850
853
|
*/
|
|
851
854
|
importDB(zipPath, revertIfFails) {
|
|
852
855
|
return new Promise((resolve, reject) => {
|
|
853
|
-
const importFolder = 'offline_temp_' +
|
|
856
|
+
const importFolder = 'offline_temp_' + now(), importFolderFullPath = cordova.file.cacheDirectory + importFolder + '/';
|
|
854
857
|
let zipMeta;
|
|
855
858
|
// Create a temporary folder to unzip the contents of the zip.
|
|
856
859
|
this.file.createDir(cordova.file.cacheDirectory, importFolder, false)
|
|
@@ -970,7 +973,7 @@ class LocalDBManagementService {
|
|
|
970
973
|
.then(metadata => this.loadNamedQueries(metadata))
|
|
971
974
|
.then(metadata => this.loadOfflineConfig(metadata))
|
|
972
975
|
.then(metadata => {
|
|
973
|
-
return Promise.all(
|
|
976
|
+
return Promise.all(map(metadata, dbMetadata => {
|
|
974
977
|
return this.openDatabase(dbMetadata)
|
|
975
978
|
.then(database => {
|
|
976
979
|
this.databases[dbMetadata.schema.name] = database;
|
|
@@ -989,9 +992,9 @@ class LocalDBManagementService {
|
|
|
989
992
|
.then(() => this.disableForeignKeys())
|
|
990
993
|
.then(() => this.deviceService.getAppBuildTime())
|
|
991
994
|
.then(dbSeedCreationTime => {
|
|
992
|
-
return executePromiseChain(
|
|
995
|
+
return executePromiseChain(map(this.callbacks, 'onDbCreate'), [{
|
|
993
996
|
'databases': this.databases,
|
|
994
|
-
'dbCreatedOn':
|
|
997
|
+
'dbCreatedOn': now(),
|
|
995
998
|
'dbSeedCreatedOn': dbSeedCreationTime
|
|
996
999
|
}]);
|
|
997
1000
|
}).then(() => this.databases);
|
|
@@ -1051,13 +1054,13 @@ class LocalDBManagementService {
|
|
|
1051
1054
|
let defaultValue = col.columnValue ? col.columnValue.defaultValue : '';
|
|
1052
1055
|
const type = col.sqlType;
|
|
1053
1056
|
if (type === 'number' && !col.primaryKey) {
|
|
1054
|
-
defaultValue =
|
|
1057
|
+
defaultValue = isEmpty(defaultValue) ? null : parseInt$1(defaultValue);
|
|
1055
1058
|
}
|
|
1056
1059
|
else if (type === 'boolean') {
|
|
1057
|
-
defaultValue =
|
|
1060
|
+
defaultValue = isEmpty(defaultValue) ? null : (defaultValue === 'true' ? 1 : 0);
|
|
1058
1061
|
}
|
|
1059
1062
|
else {
|
|
1060
|
-
defaultValue =
|
|
1063
|
+
defaultValue = isEmpty(defaultValue) ? null : defaultValue;
|
|
1061
1064
|
}
|
|
1062
1065
|
reqEntity.columns.push({
|
|
1063
1066
|
name: col['name'],
|
|
@@ -1068,10 +1071,10 @@ class LocalDBManagementService {
|
|
|
1068
1071
|
defaultValue: defaultValue
|
|
1069
1072
|
});
|
|
1070
1073
|
});
|
|
1071
|
-
|
|
1074
|
+
forEach(entity.relations, r => {
|
|
1072
1075
|
let targetEntitySchema, targetEntity, col, sourceColumn, mapping;
|
|
1073
1076
|
if (r.cardinality === 'ManyToOne' || r.cardinality === 'OneToOne') {
|
|
1074
|
-
targetEntity =
|
|
1077
|
+
targetEntity = find(schema.tables, t => t.name === r.targetTable);
|
|
1075
1078
|
mapping = r.mappings[0];
|
|
1076
1079
|
if (targetEntity) {
|
|
1077
1080
|
targetEntity = targetEntity.entityName;
|
|
@@ -1088,7 +1091,8 @@ class LocalDBManagementService {
|
|
|
1088
1091
|
targetFieldName: targetEntitySchema.columns.find(column => column.name === mapping.targetColumn).fieldName
|
|
1089
1092
|
};
|
|
1090
1093
|
foreignRelation.targetPath = foreignRelation.sourceFieldName + '.' + foreignRelation.targetFieldName;
|
|
1091
|
-
|
|
1094
|
+
// @ts-ignore
|
|
1095
|
+
foreignRelation.dataMapper = chain(targetEntitySchema.columns)
|
|
1092
1096
|
.keyBy(childCol => foreignRelation.sourceFieldName + '.' + childCol.fieldName)
|
|
1093
1097
|
.mapValues(childCol => new ColumnInfo(childCol.name, childCol.fieldName)).value();
|
|
1094
1098
|
col.foreignRelations = col.foreignRelations || [];
|
|
@@ -1101,25 +1105,25 @@ class LocalDBManagementService {
|
|
|
1101
1105
|
// Loads necessary details of queries
|
|
1102
1106
|
compactQueries(queriesByDB) {
|
|
1103
1107
|
const queries = new Map();
|
|
1104
|
-
|
|
1108
|
+
forEach(queriesByDB.queries, queryData => {
|
|
1105
1109
|
let query, params;
|
|
1106
1110
|
if (queryData.nativeSql && queryData.type === 'SELECT') {
|
|
1107
|
-
query =
|
|
1108
|
-
params =
|
|
1109
|
-
const paramObj =
|
|
1111
|
+
query = isEmpty(queryData.offlineQueryString) ? queryData.queryString : queryData.offlineQueryString;
|
|
1112
|
+
params = map(this.extractQueryParams(query), p => {
|
|
1113
|
+
const paramObj = find(queryData.parameters, { 'name': p });
|
|
1110
1114
|
return {
|
|
1111
1115
|
name: paramObj.name,
|
|
1112
1116
|
type: paramObj.type,
|
|
1113
1117
|
variableType: paramObj.variableType
|
|
1114
1118
|
};
|
|
1115
1119
|
});
|
|
1116
|
-
params.forEach(p => query =
|
|
1120
|
+
params.forEach(p => query = replace(query, ':' + p.name, '?'));
|
|
1117
1121
|
queries[queryData.name] = {
|
|
1118
1122
|
name: queryData.name,
|
|
1119
1123
|
query: query,
|
|
1120
1124
|
params: params,
|
|
1121
1125
|
response: {
|
|
1122
|
-
properties:
|
|
1126
|
+
properties: map(queryData.response.properties, p => {
|
|
1123
1127
|
p.nameInUpperCase = p.name.toUpperCase();
|
|
1124
1128
|
return p;
|
|
1125
1129
|
})
|
|
@@ -1145,7 +1149,7 @@ class LocalDBManagementService {
|
|
|
1145
1149
|
return dbInfo;
|
|
1146
1150
|
}
|
|
1147
1151
|
convertBoolToInt(bool) {
|
|
1148
|
-
return
|
|
1152
|
+
return toString(bool) === 'true' ? 1 : 0;
|
|
1149
1153
|
}
|
|
1150
1154
|
convertIntToBool(int) {
|
|
1151
1155
|
return int ? true : false;
|
|
@@ -1155,7 +1159,8 @@ class LocalDBManagementService {
|
|
|
1155
1159
|
* @returns {*}
|
|
1156
1160
|
*/
|
|
1157
1161
|
disableForeignKeys() {
|
|
1158
|
-
|
|
1162
|
+
// @ts-ignore
|
|
1163
|
+
return Promise.all(map(this.databases, db => this.executeSQLQuery(db.schema.name, 'PRAGMA foreign_keys = OFF')));
|
|
1159
1164
|
}
|
|
1160
1165
|
/**
|
|
1161
1166
|
* Executes SQL query;
|
|
@@ -1238,7 +1243,7 @@ class LocalDBManagementService {
|
|
|
1238
1243
|
getMetaInfo(fileNameRegex) {
|
|
1239
1244
|
const folder = cordova.file.applicationDirectory + META_LOCATION + '/';
|
|
1240
1245
|
return this.deviceFileService.listFiles(folder, fileNameRegex)
|
|
1241
|
-
.then(files => Promise.all(
|
|
1246
|
+
.then(files => Promise.all(map(files, f => {
|
|
1242
1247
|
return new Promise((resolve, reject) => {
|
|
1243
1248
|
// Cordova File reader has buffer issues with large files.
|
|
1244
1249
|
// so, using ajax to retrieve local json
|
|
@@ -1284,7 +1289,7 @@ class LocalDBManagementService {
|
|
|
1284
1289
|
loadNamedQueries(metadata) {
|
|
1285
1290
|
return this.getMetaInfo(/.+_query\.json$/)
|
|
1286
1291
|
.then((queriesByDBs) => {
|
|
1287
|
-
queriesByDBs =
|
|
1292
|
+
queriesByDBs = isArray(queriesByDBs) ? queriesByDBs : [queriesByDBs];
|
|
1288
1293
|
queriesByDBs.map(e => metadata[e.name].queries = this.compactQueries(e));
|
|
1289
1294
|
return metadata;
|
|
1290
1295
|
});
|
|
@@ -1298,10 +1303,12 @@ class LocalDBManagementService {
|
|
|
1298
1303
|
loadOfflineConfig(metadata) {
|
|
1299
1304
|
return this.getMetaInfo(/.+_offline\.json$/)
|
|
1300
1305
|
.then(configs => {
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
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);
|
|
1305
1312
|
});
|
|
1306
1313
|
});
|
|
1307
1314
|
return metadata;
|
|
@@ -1310,14 +1317,14 @@ class LocalDBManagementService {
|
|
|
1310
1317
|
logSql(sqliteObject) {
|
|
1311
1318
|
const logger = console, originalExecuteSql = sqliteObject.executeSql;
|
|
1312
1319
|
sqliteObject.executeSql = (sql, params, logOutput) => {
|
|
1313
|
-
const startTime =
|
|
1320
|
+
const startTime = now();
|
|
1314
1321
|
return originalExecuteSql.call(sqliteObject, sql, params).then(result => {
|
|
1315
1322
|
if (logOutput || this._logSql) {
|
|
1316
1323
|
const objArr = [], rowCount = result.rows.length;
|
|
1317
1324
|
for (let i = 0; i < rowCount; i++) {
|
|
1318
1325
|
objArr.push(result.rows.item(i));
|
|
1319
1326
|
}
|
|
1320
|
-
logger.debug('SQL "%s" with params %O took [%d ms]. And the result is %O', sql, params,
|
|
1327
|
+
logger.debug('SQL "%s" with params %O took [%d ms]. And the result is %O', sql, params, now() - startTime, objArr);
|
|
1321
1328
|
}
|
|
1322
1329
|
return result;
|
|
1323
1330
|
}, error => {
|
|
@@ -1345,10 +1352,12 @@ class LocalDBManagementService {
|
|
|
1345
1352
|
* @returns {*}
|
|
1346
1353
|
*/
|
|
1347
1354
|
normalizeData() {
|
|
1348
|
-
return Promise.all(
|
|
1349
|
-
|
|
1350
|
-
|
|
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 => {
|
|
1351
1359
|
if (column.sqlType === 'boolean') {
|
|
1360
|
+
// @ts-ignore
|
|
1352
1361
|
return this.normalizeBooleanData(database.schema.name, entitySchema.name, column.name);
|
|
1353
1362
|
}
|
|
1354
1363
|
}));
|
|
@@ -1362,12 +1371,13 @@ class LocalDBManagementService {
|
|
|
1362
1371
|
}).then(sqliteObject => {
|
|
1363
1372
|
database.sqliteObject = sqliteObject;
|
|
1364
1373
|
this.logSql(sqliteObject);
|
|
1365
|
-
const storePromises =
|
|
1374
|
+
const storePromises = map(database.schema.entities, entitySchema => {
|
|
1375
|
+
// @ts-ignore
|
|
1366
1376
|
const store = new LocalDBStore(this.deviceFileService, entitySchema, this.file, this, sqliteObject);
|
|
1367
1377
|
return store.create();
|
|
1368
1378
|
});
|
|
1369
1379
|
return Promise.all(storePromises).then(stores => {
|
|
1370
|
-
|
|
1380
|
+
forEach(stores, store => {
|
|
1371
1381
|
database.stores[store.entitySchema.entityName] = store;
|
|
1372
1382
|
});
|
|
1373
1383
|
return database;
|
|
@@ -1546,7 +1556,7 @@ class ChangeLogService {
|
|
|
1546
1556
|
* @returns {boolean} returns true, if a flush process is in progress. Otherwise, returns false.
|
|
1547
1557
|
*/
|
|
1548
1558
|
isFlushInProgress() {
|
|
1549
|
-
return !(
|
|
1559
|
+
return !(isUndefined(this.deferredFlush) || isNull(this.deferredFlush));
|
|
1550
1560
|
}
|
|
1551
1561
|
/**
|
|
1552
1562
|
* Stops the ongoing flush process.
|
|
@@ -1638,11 +1648,11 @@ class ChangeLogService {
|
|
|
1638
1648
|
.then(() => executePromiseChain(this.getWorkers('transformParamsFromMap'), [change]))
|
|
1639
1649
|
.then(() => this.pushService.push(change))
|
|
1640
1650
|
.then(function () {
|
|
1641
|
-
return executePromiseChain(
|
|
1651
|
+
return executePromiseChain(reverse(self.getWorkers('postCallSuccess')), [change, arguments])
|
|
1642
1652
|
.then(() => change);
|
|
1643
1653
|
}).catch(function () {
|
|
1644
1654
|
if (self.networkService.isConnected()) {
|
|
1645
|
-
return executePromiseChain(
|
|
1655
|
+
return executePromiseChain(reverse(self.getWorkers('postCallError')), [change, arguments])
|
|
1646
1656
|
.catch(noop).then(() => Promise.reject(change));
|
|
1647
1657
|
}
|
|
1648
1658
|
return Promise.reject(change);
|
|
@@ -1664,7 +1674,7 @@ class ChangeLogService {
|
|
|
1664
1674
|
});
|
|
1665
1675
|
}
|
|
1666
1676
|
getWorkers(type) {
|
|
1667
|
-
return
|
|
1677
|
+
return map(this.workers, w => w[type] && w[type].bind(w));
|
|
1668
1678
|
}
|
|
1669
1679
|
static { this.ɵfac = function ChangeLogService_Factory(t) { return new (t || ChangeLogService)(i0.ɵɵinject(LocalDBManagementService), i0.ɵɵinject(LocalKeyValueService), i0.ɵɵinject(PushService), i0.ɵɵinject(i3.NetworkService)); }; }
|
|
1670
1680
|
static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ChangeLogService, factory: ChangeLogService.ɵfac, providedIn: 'root' }); }
|
|
@@ -1749,7 +1759,7 @@ class LocalDbService {
|
|
|
1749
1759
|
insertTableData(params, successCallback, failureCallback, options = {}) {
|
|
1750
1760
|
this.getStore(params).then(store => {
|
|
1751
1761
|
const isPKAutoIncremented = (store.primaryKeyField && store.primaryKeyField.generatorType === 'identity');
|
|
1752
|
-
if (
|
|
1762
|
+
if (get(options, 'resetPrimaryKey') !== false && isPKAutoIncremented && params.data[store.primaryKeyName]) {
|
|
1753
1763
|
delete params.data[store.primaryKeyName];
|
|
1754
1764
|
}
|
|
1755
1765
|
return store.add(params.data).then(() => {
|
|
@@ -1890,7 +1900,7 @@ class LocalDbService {
|
|
|
1890
1900
|
return fieldName;
|
|
1891
1901
|
}
|
|
1892
1902
|
convertFieldNameToColumnName(store, filterGroup, options) {
|
|
1893
|
-
|
|
1903
|
+
forEach(filterGroup.rules, rule => {
|
|
1894
1904
|
if (rule.rules) {
|
|
1895
1905
|
this.convertFieldNameToColumnName(store, rule);
|
|
1896
1906
|
}
|
|
@@ -1900,7 +1910,7 @@ class LocalDbService {
|
|
|
1900
1910
|
});
|
|
1901
1911
|
// handling the scenario where variable options can have filterField. For example: search filter query
|
|
1902
1912
|
if (options && options.filterFields) {
|
|
1903
|
-
options.filterFields =
|
|
1913
|
+
options.filterFields = mapKeys(options.filterFields, (v, k) => {
|
|
1904
1914
|
return this.getColumnName(store, k);
|
|
1905
1915
|
});
|
|
1906
1916
|
}
|
|
@@ -1926,7 +1936,7 @@ class FileHandler {
|
|
|
1926
1936
|
*/
|
|
1927
1937
|
preCall(change) {
|
|
1928
1938
|
if (change.service === 'DatabaseService') {
|
|
1929
|
-
change.params.data =
|
|
1939
|
+
change.params.data = mapValues(change.params.data, v => {
|
|
1930
1940
|
const remoteUrl = this.fileStore[v];
|
|
1931
1941
|
if (remoteUrl) {
|
|
1932
1942
|
this.logger.debug('swapped file path from %s -> %s', v, remoteUrl);
|
|
@@ -1997,23 +2007,27 @@ class UploadedFilesImportAndExportService {
|
|
|
1997
2007
|
*/
|
|
1998
2008
|
updateDBChange(change, oldUploadDir, uploadDir) {
|
|
1999
2009
|
const modifiedProperties = {}, entityName = change.params.entityName, dataModelName = change.params.dataModelName;
|
|
2000
|
-
change.params.data =
|
|
2010
|
+
change.params.data = mapValues(change.params.data, function (v, k) {
|
|
2001
2011
|
let mv = v, isModified = false;
|
|
2002
|
-
if (
|
|
2003
|
-
mv =
|
|
2004
|
-
isModified = !
|
|
2005
|
-
}
|
|
2006
|
-
else
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
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
|
+
}
|
|
2010
2024
|
}
|
|
2011
2025
|
if (isModified) {
|
|
2012
2026
|
modifiedProperties[k] = mv;
|
|
2013
2027
|
}
|
|
2014
2028
|
return mv;
|
|
2015
2029
|
});
|
|
2016
|
-
if (!
|
|
2030
|
+
if (!isEmpty(modifiedProperties)) {
|
|
2017
2031
|
this.localDBManagementService.getStore(dataModelName, entityName)
|
|
2018
2032
|
.then(store => {
|
|
2019
2033
|
// If there is a primary for the entity, then update actual row with the modifications
|
|
@@ -2021,7 +2035,7 @@ class UploadedFilesImportAndExportService {
|
|
|
2021
2035
|
const primaryKeyName = store.primaryKeyName;
|
|
2022
2036
|
const primaryKey = change.params.data[primaryKeyName];
|
|
2023
2037
|
return store.get(primaryKey)
|
|
2024
|
-
.then(obj => store.save(
|
|
2038
|
+
.then(obj => store.save(assignIn(obj, modifiedProperties)));
|
|
2025
2039
|
}
|
|
2026
2040
|
}).then(() => {
|
|
2027
2041
|
change.params = JSON.stringify(change.params);
|
|
@@ -2040,7 +2054,7 @@ class UploadedFilesImportAndExportService {
|
|
|
2040
2054
|
change.params = JSON.parse(change.params);
|
|
2041
2055
|
if (change.service === 'OfflineFileUploadService'
|
|
2042
2056
|
&& change.operation === 'uploadToServer') {
|
|
2043
|
-
change.params.file =
|
|
2057
|
+
change.params.file = replace(change.params.file, metaInfo.uploadDir, this.uploadDir);
|
|
2044
2058
|
change.params = JSON.stringify(change.params);
|
|
2045
2059
|
return this.changeLogService.getStore().then(store => store.save(change));
|
|
2046
2060
|
}
|
|
@@ -2104,7 +2118,7 @@ class ErrorBlocker {
|
|
|
2104
2118
|
const dataModelName = change.params.dataModelName;
|
|
2105
2119
|
return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {
|
|
2106
2120
|
const id = change['dataLocalId'] || change.params.data[store.primaryKeyName];
|
|
2107
|
-
if (!(
|
|
2121
|
+
if (!(isUndefined(id) || isNull(id))) {
|
|
2108
2122
|
this.removeError(dataModelName, entityName, id);
|
|
2109
2123
|
}
|
|
2110
2124
|
});
|
|
@@ -2117,7 +2131,7 @@ class ErrorBlocker {
|
|
|
2117
2131
|
const dataModelName = change.params.dataModelName;
|
|
2118
2132
|
return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {
|
|
2119
2133
|
const id = change['dataLocalId'] || (change.params.data && change.params.data[store.primaryKeyName]) || change.params[store.primaryKeyName] || change.params.id;
|
|
2120
|
-
if (!(
|
|
2134
|
+
if (!(isUndefined(id) || isNull(id))) {
|
|
2121
2135
|
this.recordError(dataModelName, entityName, id);
|
|
2122
2136
|
}
|
|
2123
2137
|
});
|
|
@@ -2343,8 +2357,10 @@ class MultiPartParamTransformer {
|
|
|
2343
2357
|
case 'insertMultiPartTableData':
|
|
2344
2358
|
case 'updateMultiPartTableData':
|
|
2345
2359
|
// clean up files
|
|
2346
|
-
|
|
2347
|
-
|
|
2360
|
+
forEach(change.params.data, v => {
|
|
2361
|
+
// @ts-ignore
|
|
2362
|
+
if (isObject(v) && v.wmLocalPath) {
|
|
2363
|
+
// @ts-ignore
|
|
2348
2364
|
this.deviceFileService.removeFile(v.wmLocalPath);
|
|
2349
2365
|
}
|
|
2350
2366
|
});
|
|
@@ -2380,8 +2396,9 @@ class MultiPartParamTransformer {
|
|
|
2380
2396
|
* As save method called with FormData object, empty row is inserted.
|
|
2381
2397
|
* Since FormData is converted to map, update the record details now.
|
|
2382
2398
|
*/
|
|
2383
|
-
store.save(
|
|
2384
|
-
|
|
2399
|
+
store.save(mapValues(map, function (v) {
|
|
2400
|
+
// @ts-ignore
|
|
2401
|
+
return (isObject(v) && v.wmLocalPath) || v;
|
|
2385
2402
|
}));
|
|
2386
2403
|
return map;
|
|
2387
2404
|
});
|
|
@@ -2439,15 +2456,15 @@ class LiveVariableOfflineBehaviour {
|
|
|
2439
2456
|
const onlineHandler = this.httpService.sendCallAsObservable;
|
|
2440
2457
|
if (onlineHandler) {
|
|
2441
2458
|
this.httpService.sendCallAsObservable = (reqParams, params) => {
|
|
2442
|
-
if (!params &&
|
|
2459
|
+
if (!params && get(reqParams, 'url')) {
|
|
2443
2460
|
params = { url: reqParams.url };
|
|
2444
2461
|
}
|
|
2445
2462
|
// reqParams will contain the full path of insert/update call which will be processed again in parseConfig method
|
|
2446
2463
|
// and will be appended again with '/services/./.' which will result in deployedUrl + '/service/./.' + '/service/./.' which is wrong.
|
|
2447
2464
|
// Hence passing url in params
|
|
2448
|
-
const clonedParamsUrl =
|
|
2449
|
-
params =
|
|
2450
|
-
const operation =
|
|
2465
|
+
const clonedParamsUrl = clone(params.url);
|
|
2466
|
+
params = extend(params, reqParams);
|
|
2467
|
+
const operation = find(apiConfiguration, { name: get(params, 'operation') });
|
|
2451
2468
|
if (this.networkService.isConnected() || params.onlyOnline || !operation || !params.dataModelName) {
|
|
2452
2469
|
return from(this.remoteDBcall(operation, onlineHandler, params));
|
|
2453
2470
|
}
|
|
@@ -2496,7 +2513,7 @@ class LiveVariableOfflineBehaviour {
|
|
|
2496
2513
|
}
|
|
2497
2514
|
// set hasBlob flag on params when blob field is present
|
|
2498
2515
|
hasBlob(store) {
|
|
2499
|
-
const blobColumns =
|
|
2516
|
+
const blobColumns = filter(store.entitySchema.columns, {
|
|
2500
2517
|
'sqlType': 'blob'
|
|
2501
2518
|
});
|
|
2502
2519
|
return !!blobColumns.length;
|
|
@@ -2539,8 +2556,8 @@ class LiveVariableOfflineBehaviour {
|
|
|
2539
2556
|
store.saveAll(response.body.content);
|
|
2540
2557
|
}
|
|
2541
2558
|
else if (operation.type === 'INSERT') {
|
|
2542
|
-
params =
|
|
2543
|
-
params.data =
|
|
2559
|
+
params = clone(params);
|
|
2560
|
+
params.data = clone(response.body);
|
|
2544
2561
|
this.offlineDBService[operation.name](params, noop, noop, {
|
|
2545
2562
|
resetPrimaryKey: false
|
|
2546
2563
|
});
|
|
@@ -2563,10 +2580,10 @@ class LiveVariableOfflineBehaviour {
|
|
|
2563
2580
|
prepareToCascade(params) {
|
|
2564
2581
|
return this.getStore(params).then(store => {
|
|
2565
2582
|
const childObjectPromises = [];
|
|
2566
|
-
|
|
2583
|
+
forEach(params.data, (v, k) => {
|
|
2567
2584
|
let column, foreignRelation, childParams;
|
|
2568
2585
|
// NOTE: Save only one-to-one relations for cascade
|
|
2569
|
-
if (
|
|
2586
|
+
if (isObject(v) && !isArray(v)) {
|
|
2570
2587
|
column = store.entitySchema.columns.find(c => {
|
|
2571
2588
|
if (c.primaryKey && c.foreignRelations) {
|
|
2572
2589
|
foreignRelation = c.foreignRelations.find(f => f.sourceFieldName === k);
|
|
@@ -2575,7 +2592,7 @@ class LiveVariableOfflineBehaviour {
|
|
|
2575
2592
|
});
|
|
2576
2593
|
}
|
|
2577
2594
|
if (column) {
|
|
2578
|
-
childParams =
|
|
2595
|
+
childParams = cloneDeep(params);
|
|
2579
2596
|
childParams.entityName = foreignRelation.targetEntity;
|
|
2580
2597
|
childParams.data = v;
|
|
2581
2598
|
const childPromise = this.getStore(childParams).then(childStore => {
|
|
@@ -2693,7 +2710,7 @@ class NamedQueryExecutionOfflineBehaviour {
|
|
|
2693
2710
|
isOfflineBehaviourAdded$1 = true;
|
|
2694
2711
|
const orig = this.httpService.sendCallAsObservable;
|
|
2695
2712
|
this.httpService.sendCallAsObservable = (reqParams, params) => {
|
|
2696
|
-
if (!params &&
|
|
2713
|
+
if (!params && get(reqParams, 'url')) {
|
|
2697
2714
|
params = { url: reqParams.url };
|
|
2698
2715
|
}
|
|
2699
2716
|
if (!this.networkService.isConnected() && params.url.indexOf('/queryExecutor/') > 0) {
|
|
@@ -2705,7 +2722,7 @@ class NamedQueryExecutionOfflineBehaviour {
|
|
|
2705
2722
|
};
|
|
2706
2723
|
}
|
|
2707
2724
|
executeLocally(params) {
|
|
2708
|
-
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 =
|
|
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);
|
|
2709
2726
|
return this.localDBManagementService.executeNamedQuery(dbName, queryName, queryParams)
|
|
2710
2727
|
.then(result => {
|
|
2711
2728
|
const rows = result.rows;
|
|
@@ -2744,7 +2761,7 @@ class NamedQueryExecutionOfflineBehaviour {
|
|
|
2744
2761
|
str = decodeURIComponent(str);
|
|
2745
2762
|
str.split('&').forEach(c => {
|
|
2746
2763
|
const csplits = c.split('=');
|
|
2747
|
-
if (
|
|
2764
|
+
if (isEmpty(trim(csplits[1])) || !NUMBER_REGEX.test(csplits[1])) {
|
|
2748
2765
|
result[csplits[0]] = csplits[1];
|
|
2749
2766
|
}
|
|
2750
2767
|
else {
|
|
@@ -2765,7 +2782,7 @@ class SecurityOfflineBehaviour {
|
|
|
2765
2782
|
this.deviceService = deviceService;
|
|
2766
2783
|
this.networkService = networkService;
|
|
2767
2784
|
this.securityService = securityService;
|
|
2768
|
-
this.saveSecurityConfigLocally =
|
|
2785
|
+
this.saveSecurityConfigLocally = debounce((config) => {
|
|
2769
2786
|
this._saveSecurityConfigLocally(config);
|
|
2770
2787
|
}, 1000);
|
|
2771
2788
|
}
|
|
@@ -3002,7 +3019,7 @@ const pullProcessManager = (() => {
|
|
|
3002
3019
|
const promises = {};
|
|
3003
3020
|
return {
|
|
3004
3021
|
start: promise => {
|
|
3005
|
-
promise.$$pullProcessId = 'PULL_' +
|
|
3022
|
+
promise.$$pullProcessId = 'PULL_' + now();
|
|
3006
3023
|
},
|
|
3007
3024
|
add: (pullPromise, promise) => {
|
|
3008
3025
|
const pullProcessId = pullPromise.$$pullProcessId;
|
|
@@ -3013,15 +3030,15 @@ const pullProcessManager = (() => {
|
|
|
3013
3030
|
},
|
|
3014
3031
|
remove: (pullPromise, promise) => {
|
|
3015
3032
|
const pullProcessId = pullPromise.$$pullProcessId;
|
|
3016
|
-
|
|
3017
|
-
if (
|
|
3033
|
+
remove(promises[pullProcessId], promise);
|
|
3034
|
+
if (isEmpty(promises[pullProcessId])) {
|
|
3018
3035
|
delete promises[pullProcessId];
|
|
3019
3036
|
}
|
|
3020
3037
|
},
|
|
3021
3038
|
abort: (pullPromise) => {
|
|
3022
3039
|
const pullProcessId = pullPromise.$$pullProcessId;
|
|
3023
3040
|
if (promises[pullProcessId]) {
|
|
3024
|
-
|
|
3041
|
+
forEach(promises[pullProcessId], function (p) {
|
|
3025
3042
|
if (p && p.abort) {
|
|
3026
3043
|
p.abort();
|
|
3027
3044
|
}
|
|
@@ -3068,22 +3085,22 @@ class LocalDBDataPullService {
|
|
|
3068
3085
|
* @returns {any}
|
|
3069
3086
|
*/
|
|
3070
3087
|
addDeltaCriteria(db, entityName, query) {
|
|
3071
|
-
const entitySchema = db.schema.entities[entityName], deltaFieldName = entitySchema.pullConfig.deltaFieldName, deltaField =
|
|
3088
|
+
const entitySchema = db.schema.entities[entityName], deltaFieldName = entitySchema.pullConfig.deltaFieldName, deltaField = find(entitySchema.columns, { 'fieldName': deltaFieldName }) || {};
|
|
3072
3089
|
let isBundledEntity;
|
|
3073
|
-
if (!
|
|
3090
|
+
if (!isEmpty(deltaFieldName)) {
|
|
3074
3091
|
return this.localDBManagementService.isBundled(db.schema.name, entityName)
|
|
3075
3092
|
.then(flag => isBundledEntity = flag)
|
|
3076
3093
|
.then(() => this.getLastPullInfo())
|
|
3077
3094
|
.then(lastPullInfo => {
|
|
3078
3095
|
let lastPullTime = (lastPullInfo && lastPullInfo.startTime && lastPullInfo.startTime.getTime());
|
|
3079
|
-
const lastPullDBInfo =
|
|
3096
|
+
const lastPullDBInfo = find(lastPullInfo && lastPullInfo.databases, { 'name': db.schema.name }), lastPullEntityInfo = find(lastPullDBInfo && lastPullDBInfo.entities, { 'entityName': entityName }) || {};
|
|
3080
3097
|
if (!lastPullTime && isBundledEntity) {
|
|
3081
3098
|
// For bundled entity when there is no last pull, fetch records that got modified after db creation.
|
|
3082
3099
|
lastPullTime = (lastPullInfo && lastPullInfo.endTime && lastPullInfo.endTime.getTime());
|
|
3083
3100
|
lastPullEntityInfo.query = query;
|
|
3084
3101
|
}
|
|
3085
3102
|
if (lastPullEntityInfo.query === query && lastPullTime > 0) {
|
|
3086
|
-
if (
|
|
3103
|
+
if (isEmpty(query)) {
|
|
3087
3104
|
query = '';
|
|
3088
3105
|
}
|
|
3089
3106
|
else {
|
|
@@ -3132,17 +3149,17 @@ class LocalDBDataPullService {
|
|
|
3132
3149
|
}
|
|
3133
3150
|
return query;
|
|
3134
3151
|
}).then(query => {
|
|
3135
|
-
filter =
|
|
3152
|
+
filter = isEmpty(query) ? '' : 'q=' + query;
|
|
3136
3153
|
return this.getTotalRecordsToPull(db, entitySchema, filter, pullPromise);
|
|
3137
3154
|
}).then(maxNoOfRecords => {
|
|
3138
3155
|
const pageSize = entitySchema.pullConfig.size || 100, maxNoOfPages = Math.ceil(maxNoOfRecords / pageSize);
|
|
3139
3156
|
result.totalRecordsToPull = maxNoOfRecords;
|
|
3140
3157
|
let sort = entitySchema.pullConfig.orderBy;
|
|
3141
|
-
sort = (
|
|
3158
|
+
sort = (isEmpty(sort) ? '' : sort + ',') + store.primaryKeyName;
|
|
3142
3159
|
progressObserver.next(result);
|
|
3143
3160
|
const _progressObserver = { next: data => {
|
|
3144
3161
|
inProgress++;
|
|
3145
|
-
data =
|
|
3162
|
+
data = slice(data, 0, result.totalRecordsToPull - result.pulledRecordCount);
|
|
3146
3163
|
store.saveAll(data).then(() => {
|
|
3147
3164
|
result.pulledRecordCount += data ? data.length : 0;
|
|
3148
3165
|
progressObserver.next(result);
|
|
@@ -3168,7 +3185,7 @@ class LocalDBDataPullService {
|
|
|
3168
3185
|
}
|
|
3169
3186
|
// If expression starts with 'bind:', then expression is evaluated and result is returned.
|
|
3170
3187
|
evalIfBind(expression) {
|
|
3171
|
-
if (
|
|
3188
|
+
if (startsWith(expression, 'bind:')) {
|
|
3172
3189
|
expression = expression.replace(/\[\$\i\]/g, '[0]');
|
|
3173
3190
|
return $parseExpr(expression.replace('bind:', ''))(this.app);
|
|
3174
3191
|
}
|
|
@@ -3211,8 +3228,8 @@ class LocalDBDataPullService {
|
|
|
3211
3228
|
};
|
|
3212
3229
|
return this.retryIfNetworkFails(() => {
|
|
3213
3230
|
return this.executeDatabaseCountQuery(params).then(function (response) {
|
|
3214
|
-
const totalRecordCount = response, maxRecordsToPull =
|
|
3215
|
-
if (
|
|
3231
|
+
const totalRecordCount = response, maxRecordsToPull = parseInt(entitySchema.pullConfig.maxNumberOfRecords);
|
|
3232
|
+
if (isNaN(maxRecordsToPull) || maxRecordsToPull <= 0 || totalRecordCount < maxRecordsToPull) {
|
|
3216
3233
|
return totalRecordCount;
|
|
3217
3234
|
}
|
|
3218
3235
|
return maxRecordsToPull;
|
|
@@ -3225,23 +3242,23 @@ class LocalDBDataPullService {
|
|
|
3225
3242
|
return this.localDBManagementService.isBundled(db.schema.name, entityName)
|
|
3226
3243
|
.then(isBundledEntity => {
|
|
3227
3244
|
let hasNullAttributeValue = false;
|
|
3228
|
-
if (isBundledEntity ||
|
|
3229
|
-
query =
|
|
3230
|
-
query =
|
|
3245
|
+
if (isBundledEntity || isEmpty(entitySchema.pullConfig.query)) {
|
|
3246
|
+
query = cloneDeep(entitySchema.pullConfig.filter);
|
|
3247
|
+
query = map(query, v => {
|
|
3231
3248
|
v.attributeValue = this.evalIfBind(v.attributeValue);
|
|
3232
|
-
hasNullAttributeValue = hasNullAttributeValue ||
|
|
3249
|
+
hasNullAttributeValue = hasNullAttributeValue || isNil(v.attributeValue);
|
|
3233
3250
|
return v;
|
|
3234
3251
|
});
|
|
3235
3252
|
if (hasNullAttributeValue) {
|
|
3236
3253
|
return Promise.reject('Null criteria values are present');
|
|
3237
3254
|
}
|
|
3238
|
-
query =
|
|
3255
|
+
query = sortBy(query, 'attributeName');
|
|
3239
3256
|
query = LiveVariableUtils.getSearchQuery(query, ' AND ', true);
|
|
3240
3257
|
}
|
|
3241
3258
|
else {
|
|
3242
3259
|
query = this.evalIfBind(entitySchema.pullConfig.query);
|
|
3243
3260
|
}
|
|
3244
|
-
if (
|
|
3261
|
+
if (isNil(query)) {
|
|
3245
3262
|
return Promise.resolve(null);
|
|
3246
3263
|
}
|
|
3247
3264
|
return Promise.resolve(encodeURIComponent(query));
|
|
@@ -3265,7 +3282,8 @@ class LocalDBDataPullService {
|
|
|
3265
3282
|
totalTaskCount: 0
|
|
3266
3283
|
};
|
|
3267
3284
|
const storePromises = [];
|
|
3268
|
-
|
|
3285
|
+
forEach(db.schema.entities, entity => {
|
|
3286
|
+
// @ts-ignore
|
|
3269
3287
|
storePromises.push(this.localDBManagementService.getStore(datamodelName, entity.entityName));
|
|
3270
3288
|
});
|
|
3271
3289
|
return new Promise((resolve, reject) => {
|
|
@@ -3279,21 +3297,21 @@ class LocalDBDataPullService {
|
|
|
3279
3297
|
entities.push(store.entitySchema);
|
|
3280
3298
|
}
|
|
3281
3299
|
});
|
|
3282
|
-
const pullPromises =
|
|
3300
|
+
const pullPromises = chain(entities)
|
|
3283
3301
|
.map(entity => {
|
|
3284
3302
|
const _progressObserver = {
|
|
3285
3303
|
next: info => {
|
|
3286
|
-
const i =
|
|
3304
|
+
const i = findIndex(result.entities, { 'entityName': info.entityName });
|
|
3287
3305
|
if (i >= 0) {
|
|
3288
3306
|
result.entities[i] = info;
|
|
3289
3307
|
}
|
|
3290
3308
|
else {
|
|
3291
3309
|
result.entities.push(info);
|
|
3292
3310
|
}
|
|
3293
|
-
result.pulledRecordCount =
|
|
3311
|
+
result.pulledRecordCount = reduce(result.entities, function (sum, entityPullInfo) {
|
|
3294
3312
|
return sum + entityPullInfo.pulledRecordCount;
|
|
3295
3313
|
}, 0);
|
|
3296
|
-
result.totalRecordsToPull =
|
|
3314
|
+
result.totalRecordsToPull = reduce(result.entities, function (sum, entityPullInfo) {
|
|
3297
3315
|
return sum + entityPullInfo.totalRecordsToPull;
|
|
3298
3316
|
}, 0);
|
|
3299
3317
|
progressObserver.next(result);
|
|
@@ -3385,7 +3403,7 @@ class LocalDBDataPullService {
|
|
|
3385
3403
|
getDb(dbName) {
|
|
3386
3404
|
return this.localDBManagementService.loadDatabases()
|
|
3387
3405
|
.then(databases => {
|
|
3388
|
-
const db =
|
|
3406
|
+
const db = find(databases, { 'name': dbName });
|
|
3389
3407
|
return db || Promise.reject('Local database (' + dbName + ') not found');
|
|
3390
3408
|
});
|
|
3391
3409
|
}
|
|
@@ -3395,10 +3413,10 @@ class LocalDBDataPullService {
|
|
|
3395
3413
|
*/
|
|
3396
3414
|
getLastPullInfo() {
|
|
3397
3415
|
return this.localKeyValueService.get(LAST_PULL_INFO_KEY).then(info => {
|
|
3398
|
-
if (
|
|
3416
|
+
if (isString(info.startTime)) {
|
|
3399
3417
|
info.startTime = new Date(info.startTime);
|
|
3400
3418
|
}
|
|
3401
|
-
if (
|
|
3419
|
+
if (isString(info.endTime)) {
|
|
3402
3420
|
info.endTime = new Date(info.endTime);
|
|
3403
3421
|
}
|
|
3404
3422
|
return info;
|
|
@@ -3425,28 +3443,28 @@ class LocalDBDataPullService {
|
|
|
3425
3443
|
};
|
|
3426
3444
|
this.localDBManagementService.loadDatabases()
|
|
3427
3445
|
.then(databases => {
|
|
3428
|
-
const dataPullPromises =
|
|
3446
|
+
const dataPullPromises = chain(databases).filter(function (db) {
|
|
3429
3447
|
return !db.schema.isInternal;
|
|
3430
3448
|
}).map(db => {
|
|
3431
3449
|
pullProcessManager.start(deferred.promise);
|
|
3432
3450
|
const _progressObserver = { next: data => {
|
|
3433
|
-
const i =
|
|
3451
|
+
const i = findIndex(pullInfo.databases, { 'name': data.name });
|
|
3434
3452
|
if (i >= 0) {
|
|
3435
3453
|
pullInfo.databases[i] = data;
|
|
3436
3454
|
}
|
|
3437
3455
|
else {
|
|
3438
3456
|
pullInfo.databases.push(data);
|
|
3439
3457
|
}
|
|
3440
|
-
pullInfo.totalTaskCount =
|
|
3458
|
+
pullInfo.totalTaskCount = reduce(pullInfo.databases, function (sum, dbPullInfo) {
|
|
3441
3459
|
return sum + dbPullInfo.totalTaskCount;
|
|
3442
3460
|
}, 0);
|
|
3443
|
-
pullInfo.completedTaskCount =
|
|
3461
|
+
pullInfo.completedTaskCount = reduce(pullInfo.databases, function (sum, dbPullInfo) {
|
|
3444
3462
|
return sum + dbPullInfo.completedTaskCount;
|
|
3445
3463
|
}, 0);
|
|
3446
|
-
pullInfo.totalPulledRecordCount =
|
|
3464
|
+
pullInfo.totalPulledRecordCount = reduce(pullInfo.databases, function (sum, dbPullInfo) {
|
|
3447
3465
|
return sum + dbPullInfo.pulledRecordCount;
|
|
3448
3466
|
}, 0);
|
|
3449
|
-
pullInfo.totalRecordsToPull =
|
|
3467
|
+
pullInfo.totalRecordsToPull = reduce(pullInfo.databases, function (sum, dbPullInfo) {
|
|
3450
3468
|
return sum + dbPullInfo.totalRecordsToPull;
|
|
3451
3469
|
}, 0);
|
|
3452
3470
|
progressObserver.next(pullInfo);
|