@os1-platform/dispatch-mobile 2.0.8 → 2.1.0
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.
- package/dispatch-mobile.podspec +35 -0
- package/ios/DispatchSdk-Bridging-Header.h +3 -0
- package/ios/DispatchSdk.m +9 -0
- package/ios/DispatchSdk.swift +8 -0
- package/ios/DispatchSdk.xcodeproj/project.pbxproj +317 -0
- package/ios/EventEmitter.swift +21 -0
- package/ios/EventsConstant.swift +13 -0
- package/ios/RNEventEmitter.m +15 -0
- package/ios/RNEventEmitter.swift +24 -0
- package/lib/commonjs/components/dispatch/DispatchExecNavigator.js +3 -4
- package/lib/commonjs/components/dispatch/DispatchExecNavigator.js.map +1 -1
- package/lib/commonjs/components/executiontasks/cancellation/CancelET.js +13 -8
- package/lib/commonjs/components/executiontasks/cancellation/CancelET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js +3 -4
- package/lib/commonjs/components/executiontasks/captureInput/CaptureText.js.map +1 -1
- package/lib/commonjs/components/executiontasks/deliver/DeliverET.js +3 -4
- package/lib/commonjs/components/executiontasks/deliver/DeliverET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/deliver/DeliverETInput.js.map +1 -1
- package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js +97 -23
- package/lib/commonjs/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/display/DisplayModalET.js +7 -8
- package/lib/commonjs/components/executiontasks/display/DisplayModalET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js +36 -13
- package/lib/commonjs/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/dropCash/DropCashET.js +3 -4
- package/lib/commonjs/components/executiontasks/dropCash/DropCashET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js +6 -7
- package/lib/commonjs/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/FormGenerator.js +5 -6
- package/lib/commonjs/components/executiontasks/forms/FormGenerator.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js +4 -5
- package/lib/commonjs/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/DropdownWidget.js +3 -4
- package/lib/commonjs/components/executiontasks/forms/widgets/DropdownWidget.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js +3 -4
- package/lib/commonjs/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.js.map +1 -1
- package/lib/commonjs/components/executiontasks/forms/widgets/TimeRangeSelector.js +3 -4
- package/lib/commonjs/components/executiontasks/forms/widgets/TimeRangeSelector.js.map +1 -1
- package/lib/commonjs/components/executiontasks/httpRequest/HttpRequestET.js +3 -4
- package/lib/commonjs/components/executiontasks/httpRequest/HttpRequestET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js +136 -22
- package/lib/commonjs/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js +8 -8
- package/lib/commonjs/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/PaymentStyles.js +6 -7
- package/lib/commonjs/components/executiontasks/payments/PaymentStyles.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js +5 -6
- package/lib/commonjs/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js +3 -4
- package/lib/commonjs/components/executiontasks/payments/init/InitPaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js +3 -4
- package/lib/commonjs/components/executiontasks/payments/processPayment/ProcessPaymentET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/pickup/PickupET.js +3 -4
- package/lib/commonjs/components/executiontasks/pickup/PickupET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js +81 -13
- package/lib/commonjs/components/executiontasks/pickup/SLPickupET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/ScanET.js +14 -15
- package/lib/commonjs/components/executiontasks/scan/ScanET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/ScanSchema.js +1 -2
- package/lib/commonjs/components/executiontasks/scan/ScanSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/constants.js +6 -12
- package/lib/commonjs/components/executiontasks/scan/constants.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/interfaces.js +4 -8
- package/lib/commonjs/components/executiontasks/scan/interfaces.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js +4 -5
- package/lib/commonjs/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js +5 -6
- package/lib/commonjs/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/sub_components/SummaryPage.js +8 -9
- package/lib/commonjs/components/executiontasks/scan/sub_components/SummaryPage.js.map +1 -1
- package/lib/commonjs/components/executiontasks/scan/utils.js +2 -2
- package/lib/commonjs/components/executiontasks/scan/utils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js +8 -9
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js +1 -2
- package/lib/commonjs/components/executiontasks/validateOTP/ValidateOTPSchema.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/constants.js +6 -12
- package/lib/commonjs/components/executiontasks/validateOTP/constants.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js +5 -6
- package/lib/commonjs/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
- package/lib/commonjs/components/executiontasks/validateOTP/utils.js +2 -2
- package/lib/commonjs/components/executiontasks/validateOTP/utils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/verifyLocation/GeofenceUtils.js +2 -2
- package/lib/commonjs/components/executiontasks/verifyLocation/GeofenceUtils.js.map +1 -1
- package/lib/commonjs/components/executiontasks/verifyLocation/VerifyLocationET.js +3 -4
- package/lib/commonjs/components/executiontasks/verifyLocation/VerifyLocationET.js.map +1 -1
- package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js +3 -4
- package/lib/commonjs/components/executiontasks/verifyOtp/VerifyOtpET.js.map +1 -1
- package/lib/commonjs/components/widgets/AlertDisplay.js +14 -9
- package/lib/commonjs/components/widgets/AlertDisplay.js.map +1 -1
- package/lib/commonjs/components/widgets/CancelOrderDialog.js +5 -6
- package/lib/commonjs/components/widgets/CancelOrderDialog.js.map +1 -1
- package/lib/commonjs/components/widgets/Card.js +2 -3
- package/lib/commonjs/components/widgets/Card.js.map +1 -1
- package/lib/commonjs/components/widgets/GoBackModal.js +1 -2
- package/lib/commonjs/components/widgets/GoBackModal.js.map +1 -1
- package/lib/commonjs/components/widgets/IconButton.js +1 -2
- package/lib/commonjs/components/widgets/IconButton.js.map +1 -1
- package/lib/commonjs/components/widgets/ModalWidget.js +3 -4
- package/lib/commonjs/components/widgets/ModalWidget.js.map +1 -1
- package/lib/commonjs/components/widgets/ProgressDialog.js +2 -3
- package/lib/commonjs/components/widgets/ProgressDialog.js.map +1 -1
- package/lib/commonjs/components/widgets/SearchBar.js +1 -2
- package/lib/commonjs/components/widgets/SearchBar.js.map +1 -1
- package/lib/commonjs/components/widgets/SnackBarCustom.js +3 -5
- package/lib/commonjs/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/commonjs/components/widgets/SplitTextInput.js +3 -4
- package/lib/commonjs/components/widgets/SplitTextInput.js.map +1 -1
- package/lib/commonjs/components/widgets/TabsComponent.js +3 -4
- package/lib/commonjs/components/widgets/TabsComponent.js.map +1 -1
- package/lib/commonjs/config/DispatchSDKConfig.js +1 -2
- package/lib/commonjs/config/DispatchSDKConfig.js.map +1 -1
- package/lib/commonjs/constants/apiConstants.js +2 -4
- package/lib/commonjs/constants/apiConstants.js.map +1 -1
- package/lib/commonjs/constants/constants.js +11 -22
- package/lib/commonjs/constants/constants.js.map +1 -1
- package/lib/commonjs/constants/statuscode.js +1 -2
- package/lib/commonjs/constants/statuscode.js.map +1 -1
- package/lib/commonjs/errors/ErrorCodes.js +7 -14
- package/lib/commonjs/errors/ErrorCodes.js.map +1 -1
- package/lib/commonjs/events/EventDispatcher.js +5 -3
- package/lib/commonjs/events/EventDispatcher.js.map +1 -1
- package/lib/commonjs/events/EventListener.js +1 -2
- package/lib/commonjs/events/EventListener.js.map +1 -1
- package/lib/commonjs/events/constants.js +1 -2
- package/lib/commonjs/events/constants.js.map +1 -1
- package/lib/commonjs/events/index.js +1 -2
- package/lib/commonjs/events/index.js.map +1 -1
- package/lib/commonjs/icons/ScanIcon.js +1 -2
- package/lib/commonjs/icons/ScanIcon.js.map +1 -1
- package/lib/commonjs/icons/circleMark.svg +3 -0
- package/lib/commonjs/icons/file.js +1 -2
- package/lib/commonjs/icons/file.js.map +1 -1
- package/lib/commonjs/index.js +8 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/locale/Str.js +1 -2
- package/lib/commonjs/locale/Str.js.map +1 -1
- package/lib/commonjs/locale/i18n.js +2 -3
- package/lib/commonjs/locale/i18n.js.map +1 -1
- package/lib/commonjs/manager/dispatch/DispatchStateContainer.js +5 -3
- package/lib/commonjs/manager/dispatch/DispatchStateContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/EventCodeContainer.js +2 -0
- package/lib/commonjs/manager/dispatchCodes/EventCodeContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js +4 -2
- package/lib/commonjs/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js +4 -2
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js +4 -2
- package/lib/commonjs/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
- package/lib/commonjs/manager/location/LocationManager.js +7 -4
- package/lib/commonjs/manager/location/LocationManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js +4 -2
- package/lib/commonjs/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/commonjs/manager/sdk/DispatchSdkCache.js +2 -0
- package/lib/commonjs/manager/sdk/DispatchSdkCache.js.map +1 -1
- package/lib/commonjs/manager/sdk/callbacksHandler.js +1 -2
- package/lib/commonjs/manager/sdk/callbacksHandler.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/AppSyncManager.js +4 -2
- package/lib/commonjs/manager/syncmanager/AppSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/DBConfig.js +14 -26
- package/lib/commonjs/manager/syncmanager/DBConfig.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/NativeSyncManager.js +1 -2
- package/lib/commonjs/manager/syncmanager/NativeSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/constants.js +5 -10
- package/lib/commonjs/manager/syncmanager/constants.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/database.js +2 -2
- package/lib/commonjs/manager/syncmanager/database.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js +5 -4
- package/lib/commonjs/manager/syncmanager/document/DocumentHttpClient.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js +4 -2
- package/lib/commonjs/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js +4 -2
- package/lib/commonjs/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js +4 -2
- package/lib/commonjs/manager/syncmanager/events/ETEventsManager.js.map +1 -1
- package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js +4 -2
- package/lib/commonjs/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
- package/lib/commonjs/models/DispatchModels.js +1 -2
- package/lib/commonjs/models/DispatchModels.js.map +1 -1
- package/lib/commonjs/models/execTasks/ETConfig.js +6 -12
- package/lib/commonjs/models/execTasks/ETConfig.js.map +1 -1
- package/lib/commonjs/models/fcm.js.map +1 -1
- package/lib/commonjs/models/sdk.js +1 -2
- package/lib/commonjs/models/sdk.js.map +1 -1
- package/lib/commonjs/native/signature/SignatureCapture.js +1 -2
- package/lib/commonjs/native/signature/SignatureCapture.js.map +1 -1
- package/lib/commonjs/network/GraphQLClient.js +48 -4
- package/lib/commonjs/network/GraphQLClient.js.map +1 -1
- package/lib/commonjs/network/Queries.js +5 -10
- package/lib/commonjs/network/Queries.js.map +1 -1
- package/lib/commonjs/res/strings.js +1 -2
- package/lib/commonjs/res/strings.js.map +1 -1
- package/lib/commonjs/resources/Login.js +1 -2
- package/lib/commonjs/resources/Login.js.map +1 -1
- package/lib/commonjs/resources/network.js +1 -2
- package/lib/commonjs/resources/network.js.map +1 -1
- package/lib/commonjs/styles/SdkColors.js +2 -4
- package/lib/commonjs/styles/SdkColors.js.map +1 -1
- package/lib/commonjs/styles/executionTasks/CommonStyles.js +6 -10
- package/lib/commonjs/styles/executionTasks/CommonStyles.js.map +1 -1
- package/lib/commonjs/ui/screens/CancellationScreen.js +3 -4
- package/lib/commonjs/ui/screens/CancellationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CaptureInputScreen.js +5 -5
- package/lib/commonjs/ui/screens/CaptureInputScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CompleteObjectiveScreen.js +3 -4
- package/lib/commonjs/ui/screens/CompleteObjectiveScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DeliverScreen.js +9 -5
- package/lib/commonjs/ui/screens/DeliverScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DisplayScreen.js +3 -4
- package/lib/commonjs/ui/screens/DisplayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DoodleScreen.js +5 -5
- package/lib/commonjs/ui/screens/DoodleScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/DropCashScreen.js +5 -5
- package/lib/commonjs/ui/screens/DropCashScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FormsScreen.js +3 -4
- package/lib/commonjs/ui/screens/FormsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/GeofenceScreen.js +3 -4
- package/lib/commonjs/ui/screens/GeofenceScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HttpRequestScreen.js +1 -2
- package/lib/commonjs/ui/screens/HttpRequestScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ImageCaptureScreen.js +3 -4
- package/lib/commonjs/ui/screens/ImageCaptureScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentScreen.js +6 -6
- package/lib/commonjs/ui/screens/PaymentScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PickupScreen.js +4 -5
- package/lib/commonjs/ui/screens/PickupScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ScanScreen.js +3 -4
- package/lib/commonjs/ui/screens/ScanScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/StartWorkFlowScreen.js +8 -7
- package/lib/commonjs/ui/screens/StartWorkFlowScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ValidateOTPScreen.js +3 -4
- package/lib/commonjs/ui/screens/ValidateOTPScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WithBaseDispatchScreen.js +4 -4
- package/lib/commonjs/ui/screens/WithBaseDispatchScreen.js.map +1 -1
- package/lib/commonjs/ui/uiConfig/RouteParams.js +1 -2
- package/lib/commonjs/ui/uiConfig/RouteParams.js.map +1 -1
- package/lib/commonjs/utils/ApiUtils.js +2 -4
- package/lib/commonjs/utils/ApiUtils.js.map +1 -1
- package/lib/commonjs/utils/Logger.js +10 -9
- package/lib/commonjs/utils/Logger.js.map +1 -1
- package/lib/commonjs/utils/NetworkUtil.js +1 -2
- package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
- package/lib/commonjs/utils/SdkUtils.js +12 -8
- package/lib/commonjs/utils/SdkUtils.js.map +1 -1
- package/lib/commonjs/utils/SyncManagerUtils.js +2 -2
- package/lib/commonjs/utils/SyncManagerUtils.js.map +1 -1
- package/lib/commonjs/utils/fcm/FCM.js +3 -4
- package/lib/commonjs/utils/fcm/FCM.js.map +1 -1
- package/lib/commonjs/utils/fcm/FcmUtils.js +14 -2
- package/lib/commonjs/utils/fcm/FcmUtils.js.map +1 -1
- package/lib/commonjs/utils/helper.js +1 -2
- package/lib/commonjs/utils/helper.js.map +1 -1
- package/lib/commonjs/utils/hooks/useModal.js +3 -4
- package/lib/commonjs/utils/hooks/useModal.js.map +1 -1
- package/lib/commonjs/utils/hooks/useTimer.js +1 -2
- package/lib/commonjs/utils/hooks/useTimer.js.map +1 -1
- package/lib/commonjs/utils/loginHelper.js +1 -2
- package/lib/commonjs/utils/loginHelper.js.map +1 -1
- package/lib/commonjs/utils/storage.js +71 -13
- package/lib/commonjs/utils/storage.js.map +1 -1
- package/lib/module/components/dispatch/DispatchExecNavigator.js.map +1 -1
- package/lib/module/components/executiontasks/cancellation/CancelET.js +11 -5
- package/lib/module/components/executiontasks/cancellation/CancelET.js.map +1 -1
- package/lib/module/components/executiontasks/deliver/DeliverETInput.js.map +1 -1
- package/lib/module/components/executiontasks/deliver/SLDeliverET.js +96 -20
- package/lib/module/components/executiontasks/deliver/SLDeliverET.js.map +1 -1
- package/lib/module/components/executiontasks/display/DisplayModalET.js +5 -5
- package/lib/module/components/executiontasks/display/DisplayModalET.js.map +1 -1
- package/lib/module/components/executiontasks/doodle/SignatureET.js +34 -10
- package/lib/module/components/executiontasks/doodle/SignatureET.js.map +1 -1
- package/lib/module/components/executiontasks/dropCash/SLDropCash.js +4 -4
- package/lib/module/components/executiontasks/dropCash/SLDropCash.js.map +1 -1
- package/lib/module/components/executiontasks/forms/FormGenerator.js +3 -3
- package/lib/module/components/executiontasks/forms/FormGenerator.js.map +1 -1
- package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js +1 -1
- package/lib/module/components/executiontasks/forms/widgets/DateTimeWidget.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js +131 -18
- package/lib/module/components/executiontasks/imageCapture/CaptureUtils.js.map +1 -1
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js +3 -3
- package/lib/module/components/executiontasks/imageCapture/ImageCapture.js.map +1 -1
- package/lib/module/components/executiontasks/payments/PaymentStyles.js +6 -6
- package/lib/module/components/executiontasks/payments/PaymentStyles.js.map +1 -1
- package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js +3 -3
- package/lib/module/components/executiontasks/payments/completePayment/CompletePaymentET.js.map +1 -1
- package/lib/module/components/executiontasks/pickup/SLPickupET.js +79 -10
- package/lib/module/components/executiontasks/pickup/SLPickupET.js.map +1 -1
- package/lib/module/components/executiontasks/scan/ScanET.js +12 -12
- package/lib/module/components/executiontasks/scan/ScanET.js.map +1 -1
- package/lib/module/components/executiontasks/scan/sub_components/CScanner.js +2 -2
- package/lib/module/components/executiontasks/scan/sub_components/CScanner.js.map +1 -1
- package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js +3 -3
- package/lib/module/components/executiontasks/scan/sub_components/ERDropDown.js.map +1 -1
- package/lib/module/components/executiontasks/scan/sub_components/SummaryPage.js +6 -6
- package/lib/module/components/executiontasks/scan/sub_components/SummaryPage.js.map +1 -1
- package/lib/module/components/executiontasks/scan/utils.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js +6 -6
- package/lib/module/components/executiontasks/validateOTP/ValidateOTPET.js.map +1 -1
- package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js +3 -3
- package/lib/module/components/executiontasks/validateOTP/sub-components/OTPInput.js.map +1 -1
- package/lib/module/components/widgets/AlertDisplay.js +12 -7
- package/lib/module/components/widgets/AlertDisplay.js.map +1 -1
- package/lib/module/components/widgets/CancelOrderDialog.js +3 -3
- package/lib/module/components/widgets/CancelOrderDialog.js.map +1 -1
- package/lib/module/components/widgets/Card.js +1 -1
- package/lib/module/components/widgets/Card.js.map +1 -1
- package/lib/module/components/widgets/ModalWidget.js +3 -3
- package/lib/module/components/widgets/ModalWidget.js.map +1 -1
- package/lib/module/components/widgets/ProgressDialog.js +2 -2
- package/lib/module/components/widgets/ProgressDialog.js.map +1 -1
- package/lib/module/components/widgets/SnackBarCustom.js +2 -2
- package/lib/module/components/widgets/SnackBarCustom.js.map +1 -1
- package/lib/module/events/EventDispatcher.js +5 -2
- package/lib/module/events/EventDispatcher.js.map +1 -1
- package/lib/module/icons/circleMark.svg +3 -0
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/locale/i18n.js +1 -1
- package/lib/module/locale/i18n.js.map +1 -1
- package/lib/module/manager/dispatch/DispatchStateContainer.js +3 -1
- package/lib/module/manager/dispatch/DispatchStateContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/EventCodeContainer.js +2 -0
- package/lib/module/manager/dispatchCodes/EventCodeContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/EventCodeRepo.js +2 -0
- package/lib/module/manager/dispatchCodes/EventCodeRepo.js.map +1 -1
- package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js +2 -0
- package/lib/module/manager/dispatchCodes/ReasonCodeContainer.js.map +1 -1
- package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js +2 -0
- package/lib/module/manager/dispatchCodes/ReasonCodeRepo.js.map +1 -1
- package/lib/module/manager/location/LocationManager.js +2 -0
- package/lib/module/manager/location/LocationManager.js.map +1 -1
- package/lib/module/manager/sdk/DispatchSDKManager.js +2 -0
- package/lib/module/manager/sdk/DispatchSDKManager.js.map +1 -1
- package/lib/module/manager/sdk/DispatchSdkCache.js +2 -0
- package/lib/module/manager/sdk/DispatchSdkCache.js.map +1 -1
- package/lib/module/manager/syncmanager/AppSyncManager.js +2 -0
- package/lib/module/manager/syncmanager/AppSyncManager.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentManager.js +2 -0
- package/lib/module/manager/syncmanager/document/DocumentManager.js.map +1 -1
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js +2 -0
- package/lib/module/manager/syncmanager/document/DocumentSyncManager.js.map +1 -1
- package/lib/module/manager/syncmanager/events/ETEventsManager.js +2 -0
- package/lib/module/manager/syncmanager/events/ETEventsManager.js.map +1 -1
- package/lib/module/manager/syncmanager/events/EventsSyncManager.js +2 -0
- package/lib/module/manager/syncmanager/events/EventsSyncManager.js.map +1 -1
- package/lib/module/models/fcm.js.map +1 -1
- package/lib/module/network/GraphQLClient.js +48 -3
- package/lib/module/network/GraphQLClient.js.map +1 -1
- package/lib/module/ui/screens/CaptureInputScreen.js +2 -1
- package/lib/module/ui/screens/CaptureInputScreen.js.map +1 -1
- package/lib/module/ui/screens/DeliverScreen.js +6 -1
- package/lib/module/ui/screens/DeliverScreen.js.map +1 -1
- package/lib/module/ui/screens/DoodleScreen.js +2 -1
- package/lib/module/ui/screens/DoodleScreen.js.map +1 -1
- package/lib/module/ui/screens/DropCashScreen.js +2 -2
- package/lib/module/ui/screens/DropCashScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentScreen.js +3 -2
- package/lib/module/ui/screens/PaymentScreen.js.map +1 -1
- package/lib/module/ui/screens/PickupScreen.js +1 -1
- package/lib/module/ui/screens/PickupScreen.js.map +1 -1
- package/lib/module/ui/screens/StartWorkFlowScreen.js +6 -4
- package/lib/module/ui/screens/StartWorkFlowScreen.js.map +1 -1
- package/lib/module/ui/screens/WithBaseDispatchScreen.js +1 -0
- package/lib/module/ui/screens/WithBaseDispatchScreen.js.map +1 -1
- package/lib/module/utils/Logger.js +2 -0
- package/lib/module/utils/Logger.js.map +1 -1
- package/lib/module/utils/SdkUtils.js +11 -7
- package/lib/module/utils/SdkUtils.js.map +1 -1
- package/lib/module/utils/fcm/FcmUtils.js +11 -0
- package/lib/module/utils/fcm/FcmUtils.js.map +1 -1
- package/lib/module/utils/storage.js +69 -10
- package/lib/module/utils/storage.js.map +1 -1
- package/lib/typescript/components/executiontasks/deliver/DeliverETInput.d.ts +3 -0
- package/lib/typescript/components/executiontasks/payments/PaymentStyles.d.ts +4 -5
- package/lib/typescript/components/widgets/SnackBarCustom.d.ts +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/models/fcm.d.ts +3 -0
- package/lib/typescript/utils/fcm/FcmUtils.d.ts +2 -1
- package/lib/typescript/utils/storage.d.ts +3 -2
- package/package.json +23 -8
- package/src/@types/assets/index.d.ts +6 -0
- package/src/components/dispatch/DispatchExecNavigator.tsx +273 -0
- package/src/components/executiontasks/CompletedWFSchema.ts +24 -0
- package/src/components/executiontasks/ExecutionTasksIndex.ts +137 -0
- package/src/components/executiontasks/cancellation/CancelET.tsx +281 -0
- package/src/components/executiontasks/cancellation/CancellationSchema.ts +30 -0
- package/src/components/executiontasks/captureInput/CaptureInputSchema.ts +52 -0
- package/src/components/executiontasks/captureInput/CaptureText.tsx +172 -0
- package/src/components/executiontasks/captureInput/utils.ts +9 -0
- package/src/components/executiontasks/deliver/DeliverET.tsx +124 -0
- package/src/components/executiontasks/deliver/DeliverETInput.ts +50 -0
- package/src/components/executiontasks/deliver/SLDeliverET.tsx +512 -0
- package/src/components/executiontasks/display/DisplayModalET.tsx +174 -0
- package/src/components/executiontasks/display/DisplaySchema.ts +29 -0
- package/src/components/executiontasks/doodle/SignatureET.tsx +320 -0
- package/src/components/executiontasks/doodle/SignatureSchema.ts +51 -0
- package/src/components/executiontasks/dropCash/DropCashET.tsx +145 -0
- package/src/components/executiontasks/dropCash/DropCashSchema.ts +22 -0
- package/src/components/executiontasks/dropCash/SLDropCash.tsx +286 -0
- package/src/components/executiontasks/forms/FormGenerator.tsx +282 -0
- package/src/components/executiontasks/forms/FormSchema.ts +29 -0
- package/src/components/executiontasks/forms/widgets/DateTimeWidget.tsx +144 -0
- package/src/components/executiontasks/forms/widgets/DropdownWidget.tsx +52 -0
- package/src/components/executiontasks/forms/widgets/QRBarcodeScannerWidget.tsx +158 -0
- package/src/components/executiontasks/forms/widgets/TimeRangeSelector.tsx +38 -0
- package/src/components/executiontasks/httpRequest/HttpEtUtils.ts +49 -0
- package/src/components/executiontasks/httpRequest/HttpRequestET.tsx +59 -0
- package/src/components/executiontasks/httpRequest/HttpRequestETSchema.ts +42 -0
- package/src/components/executiontasks/imageCapture/CaptureSchema.ts +93 -0
- package/src/components/executiontasks/imageCapture/CaptureUtils.ts +326 -0
- package/src/components/executiontasks/imageCapture/ImageCapture.tsx +363 -0
- package/src/components/executiontasks/payments/PaymentStyles.ts +93 -0
- package/src/components/executiontasks/payments/PaymentUtils.ts +7 -0
- package/src/components/executiontasks/payments/completePayment/CompletePaymentET.tsx +237 -0
- package/src/components/executiontasks/payments/completePayment/CompletePaymentSchema.ts +23 -0
- package/src/components/executiontasks/payments/init/InitPaymentET.tsx +247 -0
- package/src/components/executiontasks/payments/init/InitPaymentSchema.ts +37 -0
- package/src/components/executiontasks/payments/processPayment/ProcessPaymentET.tsx +272 -0
- package/src/components/executiontasks/payments/processPayment/ProcessPaymentSchema.ts +38 -0
- package/src/components/executiontasks/pickup/PickpSchema.ts +28 -0
- package/src/components/executiontasks/pickup/PickupET.tsx +126 -0
- package/src/components/executiontasks/pickup/SLPickupET.tsx +367 -0
- package/src/components/executiontasks/scan/ScanET.tsx +1059 -0
- package/src/components/executiontasks/scan/ScanSchema.ts +121 -0
- package/src/components/executiontasks/scan/constants.ts +6 -0
- package/src/components/executiontasks/scan/interfaces.ts +109 -0
- package/src/components/executiontasks/scan/modalConstant.ts +120 -0
- package/src/components/executiontasks/scan/sub_components/CScanner.tsx +107 -0
- package/src/components/executiontasks/scan/sub_components/DropDownUtils.ts +119 -0
- package/src/components/executiontasks/scan/sub_components/ERDropDown.tsx +134 -0
- package/src/components/executiontasks/scan/sub_components/SummaryPage.tsx +1296 -0
- package/src/components/executiontasks/scan/utils.ts +1108 -0
- package/src/components/executiontasks/validateOTP/ValidateOTPET.tsx +436 -0
- package/src/components/executiontasks/validateOTP/ValidateOTPSchema.ts +68 -0
- package/src/components/executiontasks/validateOTP/constants.ts +24 -0
- package/src/components/executiontasks/validateOTP/sub-components/OTPInput.tsx +83 -0
- package/src/components/executiontasks/validateOTP/utils.ts +180 -0
- package/src/components/executiontasks/verifyInput/VerifyInputSchema.ts +49 -0
- package/src/components/executiontasks/verifyLocation/GeofenceUtils.ts +55 -0
- package/src/components/executiontasks/verifyLocation/VerifyLocSchema.ts +56 -0
- package/src/components/executiontasks/verifyLocation/VerifyLocationET.tsx +69 -0
- package/src/components/executiontasks/verifyOtp/VerifyOtpET.tsx +96 -0
- package/src/components/executiontasks/verifyOtp/VerifyOtpSchema.ts +27 -0
- package/src/components/utils/index.ts +18 -0
- package/src/components/widgets/AlertDisplay.tsx +38 -0
- package/src/components/widgets/CancelOrderDialog.tsx +112 -0
- package/src/components/widgets/Card.tsx +99 -0
- package/src/components/widgets/GoBackModal.tsx +49 -0
- package/src/components/widgets/IconButton.tsx +32 -0
- package/src/components/widgets/ModalWidget.tsx +157 -0
- package/src/components/widgets/ProgressDialog.tsx +54 -0
- package/src/components/widgets/SearchBar.tsx +71 -0
- package/src/components/widgets/SnackBarCustom.tsx +212 -0
- package/src/components/widgets/SplitTextInput.tsx +116 -0
- package/src/components/widgets/TabsComponent.tsx +84 -0
- package/src/components/widgets/Toaster.ts +8 -0
- package/src/config/DispatchSDKConfig.ts +4 -0
- package/src/constants/apiConstants.ts +11 -0
- package/src/constants/constants.ts +12 -0
- package/src/constants/statuscode.ts +8 -0
- package/src/errors/BaseError.ts +16 -0
- package/src/errors/ErrorCodes.ts +38 -0
- package/src/events/EventDispatcher.ts +22 -0
- package/src/events/EventListener.ts +14 -0
- package/src/events/constants.ts +7 -0
- package/src/events/index.ts +3 -0
- package/src/events/interface.ts +1 -0
- package/src/icons/ScanIcon.tsx +24 -0
- package/src/icons/circleMark.svg +3 -0
- package/src/icons/file.tsx +24 -0
- package/src/icons/interface.ts +5 -0
- package/src/index.tsx +80 -0
- package/src/locale/Str.ts +12 -0
- package/src/locale/en.json +6 -0
- package/src/locale/i18n.ts +17 -0
- package/src/locale/util.ts +20 -0
- package/src/manager/dispatch/DispatchStateContainer.tsx +842 -0
- package/src/manager/dispatchCodes/EventCodeContainer.ts +75 -0
- package/src/manager/dispatchCodes/EventCodeRepo.ts +82 -0
- package/src/manager/dispatchCodes/ReasonCodeContainer.ts +121 -0
- package/src/manager/dispatchCodes/ReasonCodeRepo.ts +90 -0
- package/src/manager/dispatchCodes/reasonCodes.json +137 -0
- package/src/manager/jobRemoval/JobRemovalManager.ts +21 -0
- package/src/manager/location/LocationManager.ts +77 -0
- package/src/manager/sdk/DispatchSDKManager.ts +99 -0
- package/src/manager/sdk/DispatchSdkCache.ts +47 -0
- package/src/manager/sdk/callbacksHandler.ts +25 -0
- package/src/manager/syncmanager/AppSyncManager.ts +187 -0
- package/src/manager/syncmanager/DBConfig.ts +180 -0
- package/src/manager/syncmanager/NativeSyncManager.ts +14 -0
- package/src/manager/syncmanager/constants.ts +5 -0
- package/src/manager/syncmanager/database.ts +93 -0
- package/src/manager/syncmanager/document/DocumentHttpClient.ts +111 -0
- package/src/manager/syncmanager/document/DocumentManager.ts +143 -0
- package/src/manager/syncmanager/document/DocumentSyncManager.ts +233 -0
- package/src/manager/syncmanager/document/models.ts +4 -0
- package/src/manager/syncmanager/events/ETEventsManager.ts +633 -0
- package/src/manager/syncmanager/events/EventsGraphQLClient.ts +0 -0
- package/src/manager/syncmanager/events/EventsSyncManager.ts +490 -0
- package/src/manager/syncmanager/events/SyncHttpClient.ts +202 -0
- package/src/models/DispatchModels.ts +97 -0
- package/src/models/ReasonCodes.ts +12 -0
- package/src/models/auth.ts +43 -0
- package/src/models/execTasks/ETBaseModels.ts +113 -0
- package/src/models/execTasks/ETConfig.ts +94 -0
- package/src/models/execution.ts +9 -0
- package/src/models/fcm.ts +6 -0
- package/src/models/sdk.ts +35 -0
- package/src/native/signature/SignatureCapture.tsx +110 -0
- package/src/network/GraphQLClient.ts +147 -0
- package/src/network/NetworkClient.ts +58 -0
- package/src/network/NetworkUtils.ts +41 -0
- package/src/network/Queries.ts +46 -0
- package/src/network/client.ts +61 -0
- package/src/res/strings.ts +1 -0
- package/src/resources/Login.ts +36 -0
- package/src/resources/network.ts +13 -0
- package/src/styles/SdkColors.ts +24 -0
- package/src/styles/executionTasks/CommonStyles.ts +188 -0
- package/src/ui/screens/CancellationScreen.tsx +144 -0
- package/src/ui/screens/CaptureInputScreen.tsx +79 -0
- package/src/ui/screens/CompleteObjectiveScreen.tsx +72 -0
- package/src/ui/screens/DeliverScreen.tsx +114 -0
- package/src/ui/screens/DisplayScreen.tsx +52 -0
- package/src/ui/screens/DoodleScreen.tsx +84 -0
- package/src/ui/screens/DropCashScreen.tsx +113 -0
- package/src/ui/screens/ETScreensIndex.ts +35 -0
- package/src/ui/screens/FormsScreen.tsx +164 -0
- package/src/ui/screens/GeofenceScreen.tsx +54 -0
- package/src/ui/screens/HttpRequestScreen.tsx +47 -0
- package/src/ui/screens/ImageCaptureScreen.tsx +77 -0
- package/src/ui/screens/PaymentScreen.tsx +191 -0
- package/src/ui/screens/PickupScreen.tsx +82 -0
- package/src/ui/screens/ScanScreen.tsx +159 -0
- package/src/ui/screens/StartWorkFlowScreen.tsx +233 -0
- package/src/ui/screens/ValidateOTPScreen.tsx +62 -0
- package/src/ui/screens/WithBaseDispatchScreen.tsx +33 -0
- package/src/ui/uiConfig/RouteParams.ts +28 -0
- package/src/utils/ApiUtils.ts +157 -0
- package/src/utils/ExecTaskUtils.ts +214 -0
- package/src/utils/Logger.ts +110 -0
- package/src/utils/NetworkUtil.ts +50 -0
- package/src/utils/SdkUtils.ts +155 -0
- package/src/utils/SyncManagerUtils.ts +223 -0
- package/src/utils/fcm/FCM.ts +118 -0
- package/src/utils/fcm/FcmUtils.ts +130 -0
- package/src/utils/helper.ts +24 -0
- package/src/utils/hooks/useModal.tsx +67 -0
- package/src/utils/hooks/useTimer.ts +44 -0
- package/src/utils/loginHelper.ts +51 -0
- package/src/utils/storage.ts +292 -0
- package/src/utils/test.json +17 -0
- package/src/utils/utils.ts +30 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -185
- package/android/gradlew.bat +0 -89
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
import { isEmptyOrBlank } from '../../../utils/utils';
|
|
2
|
+
import {
|
|
3
|
+
BulkEvent,
|
|
4
|
+
CustodyData,
|
|
5
|
+
DispatchSyncType,
|
|
6
|
+
EventETData,
|
|
7
|
+
EventRow,
|
|
8
|
+
EVENTS_COLUMNS,
|
|
9
|
+
EVENTS_TABLE,
|
|
10
|
+
SyncManagerPayload,
|
|
11
|
+
ExecEngineSyncType,
|
|
12
|
+
WFUpdateBulkEventData,
|
|
13
|
+
WIUpdateOutputPayload,
|
|
14
|
+
WORKFLOW_INSTANCE_COLUMNS,
|
|
15
|
+
WORKFLOW_INSTANCE_TABLE,
|
|
16
|
+
} from '../DBConfig';
|
|
17
|
+
import type { ExecQuery } from '../database';
|
|
18
|
+
import * as Database from '../database';
|
|
19
|
+
import { BaseError } from '../../../errors/BaseError';
|
|
20
|
+
import BaseErrorCodes, {
|
|
21
|
+
InvalidArgumentsError,
|
|
22
|
+
} from '../../../errors/ErrorCodes';
|
|
23
|
+
import Logger, { LOG_TYPE } from '../../../utils/Logger';
|
|
24
|
+
import { BULK_DATA_LIMIT } from '../constants';
|
|
25
|
+
import Storage from '../../../utils/storage';
|
|
26
|
+
|
|
27
|
+
// NEW CODE
|
|
28
|
+
import {
|
|
29
|
+
DispatchExecutor,
|
|
30
|
+
IDispatch,
|
|
31
|
+
} from '@os1-platform/platform-coreos-execution-engine-sdk';
|
|
32
|
+
const SyncType = IDispatch.SyncType;
|
|
33
|
+
|
|
34
|
+
export default class ETEventsManager {
|
|
35
|
+
private static instance: ETEventsManager;
|
|
36
|
+
private maxRetryCount: number = 3;
|
|
37
|
+
private _retries = 0;
|
|
38
|
+
|
|
39
|
+
private constructor() {}
|
|
40
|
+
|
|
41
|
+
public static async getInstance(): Promise<ETEventsManager> {
|
|
42
|
+
if (!ETEventsManager.instance) {
|
|
43
|
+
let manager = new ETEventsManager();
|
|
44
|
+
await ETEventsManager.init();
|
|
45
|
+
ETEventsManager.instance = manager;
|
|
46
|
+
}
|
|
47
|
+
return ETEventsManager.instance;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// NEED TO REMOVE SYNCED, CONFIG, OBJECTIVE_REF
|
|
51
|
+
private static async init(): Promise<void> {
|
|
52
|
+
await Database.executeQuery(
|
|
53
|
+
`CREATE TABLE IF NOT EXISTS ${EVENTS_TABLE} (\
|
|
54
|
+
${EVENTS_COLUMNS.ID} INTEGER PRIMARY KEY AUTOINCREMENT,\
|
|
55
|
+
${EVENTS_COLUMNS.DISPATCH_ID} TEXT NOT NULL,\
|
|
56
|
+
${EVENTS_COLUMNS.PAYLOAD} TEXT NOT NULL,\
|
|
57
|
+
${EVENTS_COLUMNS.CONFIG} TEXT,\
|
|
58
|
+
${EVENTS_COLUMNS.SYNC_TYPE} TEXT NOT NULL,\
|
|
59
|
+
${EVENTS_COLUMNS.DATA_LENGTH} INTEGER DEFAULT 0 NOT NULL,\
|
|
60
|
+
${EVENTS_COLUMNS.META} TEXT NOT NULL,\
|
|
61
|
+
${EVENTS_COLUMNS.SYNCED} INTEGER DEFAULT 0 NOT NULL,\
|
|
62
|
+
${EVENTS_COLUMNS.SYNC_ERROR} TEXT);`,
|
|
63
|
+
[]
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async insertEvent(
|
|
68
|
+
sequence: number,
|
|
69
|
+
payload: string,
|
|
70
|
+
dspID: string,
|
|
71
|
+
syncType: string,
|
|
72
|
+
objectiveRef: string,
|
|
73
|
+
config?: string
|
|
74
|
+
): Promise<void> {
|
|
75
|
+
await Database.executeQuery(
|
|
76
|
+
`INSERT INTO ${EVENTS_TABLE}(\
|
|
77
|
+
${EVENTS_COLUMNS.PAYLOAD},\
|
|
78
|
+
${EVENTS_COLUMNS.DISPATCH_ID},\
|
|
79
|
+
${EVENTS_COLUMNS.SEQUENCE},\
|
|
80
|
+
${EVENTS_COLUMNS.CONFIG},\
|
|
81
|
+
${EVENTS_COLUMNS.SYNC_TYPE},\
|
|
82
|
+
${EVENTS_COLUMNS.META}) \
|
|
83
|
+
values (?,?,?,?,?,?)`,
|
|
84
|
+
[payload, dspID, sequence, config ?? null, syncType, objectiveRef]
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private async getWFIPayload(
|
|
89
|
+
_bulkEventData: BulkEvent
|
|
90
|
+
): Promise<Array<WIUpdateOutputPayload>> {
|
|
91
|
+
const result: Array<WIUpdateOutputPayload> = [];
|
|
92
|
+
const dispatchId = _bulkEventData.dispatchId;
|
|
93
|
+
const { status, timestamp, code, attemptId, updatedBy, mergedObjectiveId } =
|
|
94
|
+
_bulkEventData.meta;
|
|
95
|
+
const outData: any = {};
|
|
96
|
+
const output: WFUpdateBulkEventData = _bulkEventData.data;
|
|
97
|
+
|
|
98
|
+
let offset = 0;
|
|
99
|
+
let jobMapping: Array<{ jobId: string; workflowInstanceId: string }> =
|
|
100
|
+
await DispatchExecutor.getJobMapping(
|
|
101
|
+
mergedObjectiveId,
|
|
102
|
+
BULK_DATA_LIMIT,
|
|
103
|
+
offset
|
|
104
|
+
);
|
|
105
|
+
do {
|
|
106
|
+
const __unmerged: Array<{ jobId: string; workflowInstanceId: string }> =
|
|
107
|
+
jobMapping;
|
|
108
|
+
|
|
109
|
+
Object.keys(output).forEach((customETName: string) => {
|
|
110
|
+
outData[customETName] = output[customETName];
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
result.push({
|
|
114
|
+
dispatchId,
|
|
115
|
+
updatedBy,
|
|
116
|
+
workflows: [
|
|
117
|
+
{
|
|
118
|
+
status,
|
|
119
|
+
attemptId,
|
|
120
|
+
timestamp,
|
|
121
|
+
code,
|
|
122
|
+
data: outData,
|
|
123
|
+
__unmerged,
|
|
124
|
+
meta: {},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
offset += BULK_DATA_LIMIT;
|
|
130
|
+
jobMapping = await DispatchExecutor.getJobMapping(
|
|
131
|
+
mergedObjectiveId,
|
|
132
|
+
BULK_DATA_LIMIT,
|
|
133
|
+
offset
|
|
134
|
+
);
|
|
135
|
+
} while (jobMapping.length > 0);
|
|
136
|
+
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
private getCustodyPayload(_bulkEventData: BulkEvent) {
|
|
141
|
+
const data: Array<CustodyData> = _bulkEventData.data;
|
|
142
|
+
return data;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private getJobRemovalPayload(_bulkEventData: BulkEvent) {
|
|
146
|
+
const data: any = _bulkEventData.data;
|
|
147
|
+
return data;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private getDispatchUpdatePayload(_bulkEventData: BulkEvent) {
|
|
151
|
+
const data: any = _bulkEventData.data;
|
|
152
|
+
const payload = data.payload;
|
|
153
|
+
return payload;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private async _modifyEventData(
|
|
157
|
+
_bulkEventData: BulkEvent
|
|
158
|
+
): Promise<Array<SyncManagerPayload>> {
|
|
159
|
+
const syncType: ExecEngineSyncType | DispatchSyncType =
|
|
160
|
+
_bulkEventData.syncType;
|
|
161
|
+
switch (syncType) {
|
|
162
|
+
case SyncType.CUSTODY_IN_SCAN: {
|
|
163
|
+
const custodyInScans = this.getCustodyPayload(_bulkEventData);
|
|
164
|
+
return [
|
|
165
|
+
{
|
|
166
|
+
data: {
|
|
167
|
+
action: SyncType.CUSTODY_IN_SCAN,
|
|
168
|
+
payload: { output: custodyInScans },
|
|
169
|
+
},
|
|
170
|
+
length: custodyInScans.length,
|
|
171
|
+
},
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
case SyncType.CUSTODY_OUT_SCAN: {
|
|
175
|
+
const custodyOutScans = this.getCustodyPayload(_bulkEventData);
|
|
176
|
+
|
|
177
|
+
return [
|
|
178
|
+
{
|
|
179
|
+
data: {
|
|
180
|
+
action: SyncType.CUSTODY_OUT_SCAN,
|
|
181
|
+
payload: { output: custodyOutScans },
|
|
182
|
+
},
|
|
183
|
+
length: custodyOutScans.length,
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
|
+
}
|
|
187
|
+
case SyncType.WORKFLOW: {
|
|
188
|
+
const payload = await this.getWFIPayload(_bulkEventData);
|
|
189
|
+
return payload.map((_payload) => ({
|
|
190
|
+
data: { action: SyncType.WORKFLOW, payload: _payload },
|
|
191
|
+
length: _payload.workflows[0].__unmerged?.length || 0,
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
case SyncType.JOB_REMOVAL: {
|
|
195
|
+
const jobRemoval = this.getJobRemovalPayload(_bulkEventData);
|
|
196
|
+
const length =
|
|
197
|
+
jobRemoval?.success?.length + jobRemoval?.failure?.length;
|
|
198
|
+
return [
|
|
199
|
+
{
|
|
200
|
+
data: {
|
|
201
|
+
action: SyncType.JOB_REMOVAL,
|
|
202
|
+
payload: jobRemoval,
|
|
203
|
+
},
|
|
204
|
+
length: length || 0,
|
|
205
|
+
},
|
|
206
|
+
];
|
|
207
|
+
}
|
|
208
|
+
case DispatchSyncType.DISPATCH_UPDATE: {
|
|
209
|
+
return [
|
|
210
|
+
{
|
|
211
|
+
data: {
|
|
212
|
+
action: DispatchSyncType.DISPATCH_UPDATE,
|
|
213
|
+
payload: this.getDispatchUpdatePayload(_bulkEventData),
|
|
214
|
+
},
|
|
215
|
+
length: 1,
|
|
216
|
+
},
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
default: {
|
|
220
|
+
return [
|
|
221
|
+
{
|
|
222
|
+
data: {
|
|
223
|
+
action: DispatchSyncType.DEFAULT,
|
|
224
|
+
payload: {},
|
|
225
|
+
},
|
|
226
|
+
length: 0,
|
|
227
|
+
},
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private splitData(data: any, chunkSize: number, splitKey: string): any[] {
|
|
234
|
+
const result: any = [];
|
|
235
|
+
const splitArray = data[splitKey];
|
|
236
|
+
|
|
237
|
+
if (!splitArray || !Array.isArray(splitArray)) {
|
|
238
|
+
return result;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
for (let i = 0; i < splitArray.length; i += chunkSize) {
|
|
242
|
+
const chunk: any = {};
|
|
243
|
+
|
|
244
|
+
for (const key in data) {
|
|
245
|
+
if (data.hasOwnProperty(key)) {
|
|
246
|
+
chunk[key] =
|
|
247
|
+
key === splitKey ? splitArray.slice(i, i + chunkSize) : data[key];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
result.push(chunk);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return result;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// NEW CODE
|
|
258
|
+
async insertQueueEvent(_eventData: BulkEvent): Promise<void> {
|
|
259
|
+
let args: any[] = [];
|
|
260
|
+
let values: any[] = [];
|
|
261
|
+
let queryData: ExecQuery[] = []; //final data to pass to db
|
|
262
|
+
try {
|
|
263
|
+
values.push(`(?,?,?,?)`);
|
|
264
|
+
const _meta = JSON.stringify(_eventData.meta);
|
|
265
|
+
args.push(
|
|
266
|
+
_eventData.data,
|
|
267
|
+
_eventData.dispatchId,
|
|
268
|
+
_eventData.syncType,
|
|
269
|
+
_meta
|
|
270
|
+
// ? _evData.meta.jobId + _evData.meta.objectiveReference
|
|
271
|
+
// : 'NO_REF_FOUND'
|
|
272
|
+
);
|
|
273
|
+
queryData.push({
|
|
274
|
+
query: `INSERT INTO ${EVENTS_TABLE}(\
|
|
275
|
+
${EVENTS_COLUMNS.PAYLOAD},\
|
|
276
|
+
${EVENTS_COLUMNS.DISPATCH_ID},\
|
|
277
|
+
${EVENTS_COLUMNS.SYNC_TYPE},\
|
|
278
|
+
${EVENTS_COLUMNS.META}) \
|
|
279
|
+
values ${values.join(',')};`,
|
|
280
|
+
args,
|
|
281
|
+
});
|
|
282
|
+
await Database.executeBulkQuery(queryData);
|
|
283
|
+
this._retries = 0;
|
|
284
|
+
} catch (err) {
|
|
285
|
+
if (this._retries < this.maxRetryCount) {
|
|
286
|
+
Logger.getInstance().logEvent(
|
|
287
|
+
'insertQueueEvent ',
|
|
288
|
+
this._retries.toString(),
|
|
289
|
+
LOG_TYPE.SDK_DEBUG
|
|
290
|
+
);
|
|
291
|
+
this._retries++;
|
|
292
|
+
await this.insertQueueEvent(_eventData);
|
|
293
|
+
} else {
|
|
294
|
+
this._retries = 0;
|
|
295
|
+
throw err;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// NEW CODE
|
|
301
|
+
async insertBulkEvent(_eventData: BulkEvent): Promise<void> {
|
|
302
|
+
try {
|
|
303
|
+
const output: Array<SyncManagerPayload> = await this._modifyEventData(
|
|
304
|
+
_eventData
|
|
305
|
+
);
|
|
306
|
+
let args: any[] = [];
|
|
307
|
+
let values: any[] = [];
|
|
308
|
+
let queryData: ExecQuery[] = []; //final data to pass to db
|
|
309
|
+
const _meta = JSON.stringify(_eventData.meta || {});
|
|
310
|
+
|
|
311
|
+
if (
|
|
312
|
+
_eventData.syncType === SyncType.WORKFLOW ||
|
|
313
|
+
_eventData.syncType === SyncType.CUSTODY_IN_SCAN ||
|
|
314
|
+
_eventData.syncType === SyncType.CUSTODY_OUT_SCAN ||
|
|
315
|
+
_eventData.syncType === DispatchSyncType.DISPATCH_UPDATE
|
|
316
|
+
) {
|
|
317
|
+
output.forEach(
|
|
318
|
+
(syncManagerPayload: SyncManagerPayload, index: number) => {
|
|
319
|
+
const _payload = JSON.stringify(syncManagerPayload.data);
|
|
320
|
+
if (
|
|
321
|
+
isEmptyOrBlank(syncManagerPayload.data.action) ||
|
|
322
|
+
isEmptyOrBlank(_payload)
|
|
323
|
+
) {
|
|
324
|
+
throw new BaseError(
|
|
325
|
+
BaseErrorCodes.InvalidArgumentError,
|
|
326
|
+
InvalidArgumentsError
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
values.push(`(?,?,?,?,?)`);
|
|
330
|
+
args.push(
|
|
331
|
+
_payload,
|
|
332
|
+
_eventData.dispatchId,
|
|
333
|
+
_eventData.syncType,
|
|
334
|
+
syncManagerPayload.length,
|
|
335
|
+
_meta
|
|
336
|
+
);
|
|
337
|
+
queryData.push({
|
|
338
|
+
query: `INSERT INTO ${EVENTS_TABLE}(\
|
|
339
|
+
${EVENTS_COLUMNS.PAYLOAD},\
|
|
340
|
+
${EVENTS_COLUMNS.DISPATCH_ID},\
|
|
341
|
+
${EVENTS_COLUMNS.SYNC_TYPE},\
|
|
342
|
+
${EVENTS_COLUMNS.DATA_LENGTH},\
|
|
343
|
+
${EVENTS_COLUMNS.META}) \
|
|
344
|
+
values ${values.join(',')};`,
|
|
345
|
+
args,
|
|
346
|
+
});
|
|
347
|
+
values = [];
|
|
348
|
+
args = [];
|
|
349
|
+
}
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
await Database.executeBulkQuery(queryData);
|
|
353
|
+
this._retries = 0;
|
|
354
|
+
}
|
|
355
|
+
// else if (
|
|
356
|
+
// _eventData.syncType === SyncType.CUSTODY_IN_SCAN ||
|
|
357
|
+
// _eventData.syncType === SyncType.CUSTODY_OUT_SCAN
|
|
358
|
+
// ) {
|
|
359
|
+
// output.forEach(
|
|
360
|
+
// (syncManagerPayload: SyncManagerPayload, index: number) => {
|
|
361
|
+
// const _payload = JSON.stringify(syncManagerPayload);
|
|
362
|
+
// if (
|
|
363
|
+
// isEmptyOrBlank(syncManagerPayload.action) ||
|
|
364
|
+
// isEmptyOrBlank(_payload)
|
|
365
|
+
// ) {
|
|
366
|
+
// throw new BaseError(
|
|
367
|
+
// BaseErrorCodes.InvalidArgumentError,
|
|
368
|
+
// InvalidArgumentsError
|
|
369
|
+
// );
|
|
370
|
+
// }
|
|
371
|
+
// values.push(`(?,?,?,?)`);
|
|
372
|
+
// args.push(
|
|
373
|
+
// _payload,
|
|
374
|
+
// _eventData.dispatchId,
|
|
375
|
+
// _eventData.syncType,
|
|
376
|
+
// _meta
|
|
377
|
+
// );
|
|
378
|
+
// queryData.push({
|
|
379
|
+
// query: `INSERT INTO ${EVENTS_TABLE}(\
|
|
380
|
+
// ${EVENTS_COLUMNS.PAYLOAD},\
|
|
381
|
+
// ${EVENTS_COLUMNS.DISPATCH_ID},\
|
|
382
|
+
// ${EVENTS_COLUMNS.SYNC_TYPE},\
|
|
383
|
+
// ${EVENTS_COLUMNS.OBJECTIVE_REF}) \
|
|
384
|
+
// values ${values.join(',')};`,
|
|
385
|
+
// args,
|
|
386
|
+
// });
|
|
387
|
+
// values = [];
|
|
388
|
+
// args = [];
|
|
389
|
+
// }
|
|
390
|
+
// );
|
|
391
|
+
|
|
392
|
+
// await Database.executeBulkQuery(queryData);
|
|
393
|
+
// this._retries = 0;
|
|
394
|
+
// } else if (_eventData.syncType === DispatchSyncType.DISPATCH_UPDATE) {
|
|
395
|
+
// }
|
|
396
|
+
else {
|
|
397
|
+
const chunkedData = this.splitData(output, BULK_DATA_LIMIT, 'payload');
|
|
398
|
+
|
|
399
|
+
chunkedData.forEach((_evData, index) => {
|
|
400
|
+
const _payload = JSON.stringify(_evData.payload);
|
|
401
|
+
if (isEmptyOrBlank(_evData.action) || isEmptyOrBlank(_payload))
|
|
402
|
+
throw new BaseError(
|
|
403
|
+
BaseErrorCodes.InvalidArgumentError,
|
|
404
|
+
InvalidArgumentsError
|
|
405
|
+
);
|
|
406
|
+
values.push(`(?,?,?,?,?)`);
|
|
407
|
+
args.push(_evData, _eventData.dispatchId, _eventData.syncType, _meta);
|
|
408
|
+
queryData.push({
|
|
409
|
+
query: `INSERT INTO ${EVENTS_TABLE}(\
|
|
410
|
+
${EVENTS_COLUMNS.PAYLOAD},\
|
|
411
|
+
${EVENTS_COLUMNS.DISPATCH_ID},\
|
|
412
|
+
${EVENTS_COLUMNS.SYNC_TYPE},\
|
|
413
|
+
${EVENTS_COLUMNS.DATA_LENGTH},\
|
|
414
|
+
${EVENTS_COLUMNS.META}) \
|
|
415
|
+
values ${values.join(',')};`,
|
|
416
|
+
args,
|
|
417
|
+
});
|
|
418
|
+
values = [];
|
|
419
|
+
args = [];
|
|
420
|
+
});
|
|
421
|
+
await Database.executeBulkQuery(queryData);
|
|
422
|
+
this._retries = 0;
|
|
423
|
+
}
|
|
424
|
+
} catch (err) {
|
|
425
|
+
if (this._retries < this.maxRetryCount) {
|
|
426
|
+
Logger.getInstance().logEvent(
|
|
427
|
+
'insertBulkEvent ',
|
|
428
|
+
this._retries.toString(),
|
|
429
|
+
LOG_TYPE.SDK_DEBUG
|
|
430
|
+
);
|
|
431
|
+
this._retries++;
|
|
432
|
+
await this.insertBulkEvent(_eventData);
|
|
433
|
+
} else {
|
|
434
|
+
this._retries = 0;
|
|
435
|
+
throw err;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// OLD CODE
|
|
441
|
+
// async insertBulkEvent(_eventData: BulkEvent[]): Promise<void> {
|
|
442
|
+
// try {
|
|
443
|
+
// let args: any[] = [];
|
|
444
|
+
// let values: any[] = [];
|
|
445
|
+
// let queryData: ExecQuery[] = []; //final data to pass to db
|
|
446
|
+
// let evIndex = 100;
|
|
447
|
+
|
|
448
|
+
// _eventData.forEach((_evData, index) => {
|
|
449
|
+
// if (
|
|
450
|
+
// !_evData.sequence ||
|
|
451
|
+
// isEmptyOrBlank(_evData.data) ||
|
|
452
|
+
// isEmptyOrBlank(_evData.dispatchId) ||
|
|
453
|
+
// isEmptyOrBlank(_evData.syncType)
|
|
454
|
+
// )
|
|
455
|
+
// throw new BaseError(
|
|
456
|
+
// BaseErrorCodes.InvalidArgumentError,
|
|
457
|
+
// InvalidArgumentsError
|
|
458
|
+
// );
|
|
459
|
+
|
|
460
|
+
// values.push(`(?,?,?,?,?)`);
|
|
461
|
+
// args.push(
|
|
462
|
+
// _evData.data,
|
|
463
|
+
// _evData.dispatchId,
|
|
464
|
+
// // _evData.sequence,
|
|
465
|
+
// _evData.config ? JSON.stringify(_evData.config) : null,
|
|
466
|
+
// _evData.syncType,
|
|
467
|
+
// _evData.meta
|
|
468
|
+
// ? _evData.meta.jobId + _evData.meta.objectiveReference
|
|
469
|
+
// : 'NO_REF_FOUND'
|
|
470
|
+
// );
|
|
471
|
+
// if (index === evIndex || index === _eventData.length - 1) {
|
|
472
|
+
// queryData.push({
|
|
473
|
+
// query: `INSERT INTO ${EVENTS_TABLE}(\
|
|
474
|
+
// ${EVENTS_COLUMNS.PAYLOAD},\
|
|
475
|
+
// ${EVENTS_COLUMNS.DISPATCH_ID},\
|
|
476
|
+
// ${EVENTS_COLUMNS.CONFIG},\
|
|
477
|
+
// ${EVENTS_COLUMNS.SYNC_TYPE},\
|
|
478
|
+
// ${EVENTS_COLUMNS.OBJECTIVE_REF}) \
|
|
479
|
+
// values ${values.join(',')};`,
|
|
480
|
+
// args,
|
|
481
|
+
// });
|
|
482
|
+
// values = [];
|
|
483
|
+
// args = [];
|
|
484
|
+
// evIndex = evIndex + evIndex;
|
|
485
|
+
// }
|
|
486
|
+
// });
|
|
487
|
+
|
|
488
|
+
// await Database.executeBulkQuery(queryData);
|
|
489
|
+
// this._retries = 0;
|
|
490
|
+
// } catch (err) {
|
|
491
|
+
// if (this._retries < this.maxRetryCount) {
|
|
492
|
+
// Logger.getInstance().logEvent(
|
|
493
|
+
// 'insertBulkEvent ',
|
|
494
|
+
// this._retries.toString(),
|
|
495
|
+
// LOG_TYPE.SDK_DEBUG
|
|
496
|
+
// );
|
|
497
|
+
// this._retries++;
|
|
498
|
+
// await this.insertBulkEvent(_eventData);
|
|
499
|
+
// } else {
|
|
500
|
+
// this._retries = 0;
|
|
501
|
+
// throw err;
|
|
502
|
+
// }
|
|
503
|
+
// }
|
|
504
|
+
// }
|
|
505
|
+
|
|
506
|
+
async getAllEvents(dispatchID?: string): Promise<EventRow[]> {
|
|
507
|
+
if (dispatchID) {
|
|
508
|
+
const resultSet = await Database.executeQuery(
|
|
509
|
+
`SELECT * FROM ${EVENTS_TABLE}\
|
|
510
|
+
WHERE ${EVENTS_COLUMNS.DISPATCH_ID} = ?;`,
|
|
511
|
+
[dispatchID]
|
|
512
|
+
);
|
|
513
|
+
return resultSet.rows._array;
|
|
514
|
+
} else {
|
|
515
|
+
const resultSet = await Database.executeQuery(
|
|
516
|
+
`SELECT * FROM ${EVENTS_TABLE};`,
|
|
517
|
+
[]
|
|
518
|
+
);
|
|
519
|
+
return resultSet.rows._array;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
async getAllUnsyncedEvents(): Promise<EventRow[]> {
|
|
524
|
+
let resultSet = await Database.executeQuery(
|
|
525
|
+
`SELECT * FROM ${EVENTS_TABLE} \
|
|
526
|
+
where ${EVENTS_COLUMNS.SYNCED} = 0;`,
|
|
527
|
+
[]
|
|
528
|
+
);
|
|
529
|
+
return resultSet.rows._array;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
public deleteAllEvents() {
|
|
533
|
+
const deleteEventsQuery = {
|
|
534
|
+
query: `DELETE FROM ${EVENTS_TABLE};`,
|
|
535
|
+
args: [],
|
|
536
|
+
};
|
|
537
|
+
const resetAutoIncrementSequence = {
|
|
538
|
+
query: `UPDATE sqlite_sequence SET seq = 0 WHERE name
|
|
539
|
+
= '${EVENTS_TABLE}';`,
|
|
540
|
+
args: [],
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
return Database.executeBulkQuery([
|
|
544
|
+
deleteEventsQuery,
|
|
545
|
+
resetAutoIncrementSequence,
|
|
546
|
+
]);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
async updateError(id: number, syncError: string): Promise<void> {
|
|
550
|
+
if (!id) throw new TypeError('Event ID cannot be null');
|
|
551
|
+
await Database.executeQuery(
|
|
552
|
+
`UPDATE ${EVENTS_TABLE} \
|
|
553
|
+
SET \
|
|
554
|
+
${EVENTS_COLUMNS.SYNC_ERROR} = ? WHERE ${EVENTS_COLUMNS.ID} = ?;`,
|
|
555
|
+
[syncError, id]
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
async markEventSynced(id: number): Promise<void> {
|
|
560
|
+
if (!id) throw new TypeError('Event ID cannot be null');
|
|
561
|
+
await Database.executeQuery(
|
|
562
|
+
`UPDATE ${EVENTS_TABLE} SET ${EVENTS_COLUMNS.SYNCED} = 1 WHERE ${EVENTS_COLUMNS.ID} = ?;`,
|
|
563
|
+
[id]
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
async getWorkflowUpdateEvents(syncType: string): Promise<EventRow[]> {
|
|
568
|
+
let sqlResultSet = await Database.executeQuery(
|
|
569
|
+
`SELECT * from ${EVENTS_TABLE}\
|
|
570
|
+
WHERE ${EVENTS_COLUMNS.SYNCED} = 0\
|
|
571
|
+
and ${EVENTS_COLUMNS.SYNC_TYPE} = ?\
|
|
572
|
+
ORDER BY ${EVENTS_COLUMNS.ID} ASC LIMIT 1;`,
|
|
573
|
+
[syncType]
|
|
574
|
+
);
|
|
575
|
+
return sqlResultSet.rows._array;
|
|
576
|
+
}
|
|
577
|
+
async getJobRemovalEvents(syncType: string): Promise<EventRow[]> {
|
|
578
|
+
let sqlResultSet = await Database.executeQuery(
|
|
579
|
+
`SELECT * from ${EVENTS_TABLE}\
|
|
580
|
+
WHERE ${EVENTS_COLUMNS.SYNCED} = 0\
|
|
581
|
+
and ${EVENTS_COLUMNS.SYNC_TYPE} = ?\
|
|
582
|
+
ORDER BY ${EVENTS_COLUMNS.ID} ASC LIMIT 1;`,
|
|
583
|
+
[syncType]
|
|
584
|
+
);
|
|
585
|
+
return sqlResultSet.rows._array;
|
|
586
|
+
}
|
|
587
|
+
async getCustodyBatch(dispatchID: string): Promise<EventRow[]> {
|
|
588
|
+
const sqlResult = await Database.executeQuery(
|
|
589
|
+
`SELECT * from ${EVENTS_TABLE}\
|
|
590
|
+
WHERE ${EVENTS_COLUMNS.SYNCED} = 0 and \
|
|
591
|
+
(${EVENTS_COLUMNS.SYNC_TYPE} = ? or ${EVENTS_COLUMNS.SYNC_TYPE} = ?) \
|
|
592
|
+
and ${EVENTS_COLUMNS.DISPATCH_ID} = ? \
|
|
593
|
+
ORDER BY ${EVENTS_COLUMNS.ID} ASC;`,
|
|
594
|
+
[SyncType.CUSTODY_IN_SCAN, SyncType.CUSTODY_OUT_SCAN, dispatchID]
|
|
595
|
+
);
|
|
596
|
+
return sqlResult.rows._array;
|
|
597
|
+
}
|
|
598
|
+
async getObjectiveDetails(objectiveRef: string): Promise<EventRow[]> {
|
|
599
|
+
let rs = await Database.executeQuery(
|
|
600
|
+
`SELECT * from ${EVENTS_TABLE} WHERE ${EVENTS_COLUMNS.META} = ?;`,
|
|
601
|
+
[objectiveRef]
|
|
602
|
+
);
|
|
603
|
+
return rs.rows._array;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
async getRowToSync(id: string, dispatchId: string): Promise<EventRow[]> {
|
|
607
|
+
const sqlResult = await Database.executeQuery(
|
|
608
|
+
`SELECT * from ${EVENTS_TABLE}\
|
|
609
|
+
WHERE ${EVENTS_COLUMNS.ID} = ? and \
|
|
610
|
+
${EVENTS_COLUMNS.DISPATCH_ID} = ? \
|
|
611
|
+
ORDER BY ${EVENTS_COLUMNS.ID} ASC;`,
|
|
612
|
+
[id, dispatchId]
|
|
613
|
+
);
|
|
614
|
+
return sqlResult.rows._array;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
async getBulkRowsToSync(id: string, dispatchId: string): Promise<EventRow[]> {
|
|
618
|
+
const query = `SELECT * FROM \
|
|
619
|
+
(SELECT *, \
|
|
620
|
+
(SELECT SUM(${EVENTS_COLUMNS.DATA_LENGTH}) \
|
|
621
|
+
FROM ${EVENTS_TABLE} \
|
|
622
|
+
WHERE id <= t.id and ${EVENTS_COLUMNS.ID} > ${id} and ${EVENTS_COLUMNS.DISPATCH_ID} \ = '${dispatchId}' and ${EVENTS_COLUMNS.DATA_LENGTH} > 0 \
|
|
623
|
+
) total \
|
|
624
|
+
FROM ${EVENTS_TABLE} t \
|
|
625
|
+
) q \
|
|
626
|
+
WHERE total <= ${BULK_DATA_LIMIT} \
|
|
627
|
+
ORDER BY ${EVENTS_COLUMNS.ID};`;
|
|
628
|
+
|
|
629
|
+
const sqlResult = await Database.executeQuery(query, []);
|
|
630
|
+
|
|
631
|
+
return sqlResult.rows._array;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
File without changes
|