@hmcts/ccd-case-ui-toolkit 6.19.0-RetryCaseRetrievals.1 → 6.19.0-RetryCaseRetrievals.3
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/bundles/hmcts-ccd-case-ui-toolkit.umd.js +94 -79
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
- package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
- package/esm2015/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.js +12 -1
- package/esm2015/lib/shared/components/case-editor/services/cases.service.js +7 -9
- package/esm2015/lib/shared/services/index.js +2 -1
- package/esm2015/lib/shared/services/utils/retry/index.js +2 -0
- package/esm2015/lib/shared/services/utils/retry/retry-util.service.js +76 -0
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js +90 -76
- package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +1 -0
- package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
- package/lib/shared/components/case-editor/services/cases.service.d.ts +3 -4
- package/lib/shared/components/case-editor/services/cases.service.d.ts.map +1 -1
- package/lib/shared/services/index.d.ts +1 -0
- package/lib/shared/services/index.d.ts.map +1 -1
- package/lib/shared/services/utils/retry/index.d.ts +2 -0
- package/lib/shared/services/utils/retry/index.d.ts.map +1 -0
- package/lib/shared/services/utils/{rxjs-utils.service.d.ts → retry/retry-util.service.d.ts} +5 -4
- package/lib/shared/services/utils/retry/retry-util.service.d.ts.map +1 -0
- package/package.json +1 -1
- package/esm2015/lib/shared/services/utils/rxjs-utils.service.js +0 -73
- package/lib/shared/services/utils/rxjs-utils.service.d.ts.map +0 -1
|
@@ -8086,6 +8086,83 @@
|
|
|
8086
8086
|
}], null, null);
|
|
8087
8087
|
})();
|
|
8088
8088
|
|
|
8089
|
+
var RetryUtil = /** @class */ (function () {
|
|
8090
|
+
function RetryUtil() {
|
|
8091
|
+
this.artificialDelayOn = true;
|
|
8092
|
+
this.artificialDelayPeriod = this.pickARandomValue();
|
|
8093
|
+
}
|
|
8094
|
+
RetryUtil.prototype.switchArtificialDelays = function (status) {
|
|
8095
|
+
this.artificialDelayOn = status;
|
|
8096
|
+
this.artificialDelayPeriod = this.pickARandomValue();
|
|
8097
|
+
};
|
|
8098
|
+
RetryUtil.prototype.switchOnArtificialDelays = function () {
|
|
8099
|
+
this.switchArtificialDelays(true);
|
|
8100
|
+
};
|
|
8101
|
+
RetryUtil.prototype.switchOffArtificialDelays = function () {
|
|
8102
|
+
this.switchArtificialDelays(false);
|
|
8103
|
+
};
|
|
8104
|
+
RetryUtil.prototype.getArtificialDelayTime = function () {
|
|
8105
|
+
return this.artificialDelayOn ? this.artificialDelayPeriod : 0;
|
|
8106
|
+
};
|
|
8107
|
+
RetryUtil.prototype.pipeTimeoutMechanismOn = function (in$, environment, timeoutPeriods) {
|
|
8108
|
+
this.switchOnArtificialDelays();
|
|
8109
|
+
var out$ = in$;
|
|
8110
|
+
if (environment === 'aat') {
|
|
8111
|
+
out$ = this.pipeArtificialDelayOn(out$);
|
|
8112
|
+
}
|
|
8113
|
+
out$ = this.pipeTimeOutControlOn(out$, timeoutPeriods);
|
|
8114
|
+
out$ = this.pipeRetryMechanismOn(out$);
|
|
8115
|
+
return out$;
|
|
8116
|
+
};
|
|
8117
|
+
RetryUtil.prototype.pipeTimeOutControlOn = function (in$, timeoutPeriods) {
|
|
8118
|
+
var timeOutAfterSeconds = timeoutPeriods[0];
|
|
8119
|
+
var out$ = in$.pipe(operators.timeout(timeOutAfterSeconds * 1000));
|
|
8120
|
+
return out$;
|
|
8121
|
+
};
|
|
8122
|
+
RetryUtil.prototype.pipeRetryMechanismOn = function (in$) {
|
|
8123
|
+
var _this = this;
|
|
8124
|
+
var retryStrategy = function (errors) {
|
|
8125
|
+
return errors.pipe(operators.mergeMap(function (error, i) {
|
|
8126
|
+
console.error("Mapping error " + (error === null || error === void 0 ? void 0 : error.name) + ", " + i);
|
|
8127
|
+
console.error(error);
|
|
8128
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === 'TimeoutError' && i === 0) {
|
|
8129
|
+
_this.switchOffArtificialDelays();
|
|
8130
|
+
console.info('Will retry, after a timeout error.');
|
|
8131
|
+
}
|
|
8132
|
+
else {
|
|
8133
|
+
console.error('Will NOT retry.');
|
|
8134
|
+
rxjs.throwError(error);
|
|
8135
|
+
}
|
|
8136
|
+
return rxjs.timer(0);
|
|
8137
|
+
}), operators.finalize(function () { return console.log('We are done!'); }));
|
|
8138
|
+
};
|
|
8139
|
+
var out$ = in$.pipe(operators.retryWhen(retryStrategy));
|
|
8140
|
+
return out$;
|
|
8141
|
+
};
|
|
8142
|
+
RetryUtil.prototype.pipeArtificialDelayOn = function (in$) {
|
|
8143
|
+
var _this = this;
|
|
8144
|
+
var out$ = in$.pipe(operators.tap(function () {
|
|
8145
|
+
console.log("Artificially delaying for " + _this.getArtificialDelayTime() + " seconds..");
|
|
8146
|
+
}));
|
|
8147
|
+
out$ = out$.pipe(operators.delayWhen(function () { return rxjs.timer(_this.getArtificialDelayTime() * 1000); }));
|
|
8148
|
+
out$ = out$.pipe(operators.tap(function () {
|
|
8149
|
+
console.log("Artificially delayed for " + _this.getArtificialDelayTime() + " seconds..");
|
|
8150
|
+
}));
|
|
8151
|
+
return out$;
|
|
8152
|
+
};
|
|
8153
|
+
RetryUtil.prototype.pickARandomValue = function () {
|
|
8154
|
+
return Date.now() % 2 == 0 ? 60 : 3;
|
|
8155
|
+
};
|
|
8156
|
+
return RetryUtil;
|
|
8157
|
+
}());
|
|
8158
|
+
RetryUtil.ɵfac = function RetryUtil_Factory(t) { return new (t || RetryUtil)(); };
|
|
8159
|
+
RetryUtil.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: RetryUtil, factory: RetryUtil.ɵfac });
|
|
8160
|
+
(function () {
|
|
8161
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(RetryUtil, [{
|
|
8162
|
+
type: i0.Injectable
|
|
8163
|
+
}], null, null);
|
|
8164
|
+
})();
|
|
8165
|
+
|
|
8089
8166
|
var WindowService = /** @class */ (function () {
|
|
8090
8167
|
function WindowService() {
|
|
8091
8168
|
}
|
|
@@ -8636,82 +8713,8 @@
|
|
|
8636
8713
|
}], null, null);
|
|
8637
8714
|
})();
|
|
8638
8715
|
|
|
8639
|
-
var RxjsUtils = /** @class */ (function () {
|
|
8640
|
-
function RxjsUtils() {
|
|
8641
|
-
this.artificialDelayOn = true;
|
|
8642
|
-
this.artificialDelayPeriod = Math.random() > 0.5 ? 60 : 3;
|
|
8643
|
-
}
|
|
8644
|
-
RxjsUtils.prototype.switchArtificialDelays = function (status) {
|
|
8645
|
-
this.artificialDelayOn = status;
|
|
8646
|
-
this.artificialDelayPeriod = Math.random() > 0.5 ? 60 : 2;
|
|
8647
|
-
};
|
|
8648
|
-
RxjsUtils.prototype.switchOnArtificialDelays = function () {
|
|
8649
|
-
this.switchArtificialDelays(true);
|
|
8650
|
-
};
|
|
8651
|
-
RxjsUtils.prototype.switchOffArtificialDelays = function () {
|
|
8652
|
-
this.switchArtificialDelays(false);
|
|
8653
|
-
};
|
|
8654
|
-
RxjsUtils.prototype.getArtificialDelayTime = function () {
|
|
8655
|
-
return this.artificialDelayOn ? this.artificialDelayPeriod : 0;
|
|
8656
|
-
};
|
|
8657
|
-
RxjsUtils.prototype.pipeTimeoutMechanismOn = function (in$, environment, timeoutPeriods) {
|
|
8658
|
-
this.switchOnArtificialDelays();
|
|
8659
|
-
var out$ = in$;
|
|
8660
|
-
if (environment === 'aat') {
|
|
8661
|
-
out$ = this.pipeArtificialDelayOn(out$);
|
|
8662
|
-
}
|
|
8663
|
-
out$ = this.pipeTimeOutControlOn(out$, timeoutPeriods);
|
|
8664
|
-
out$ = this.pipeRetryMechanismOn(out$);
|
|
8665
|
-
return out$;
|
|
8666
|
-
};
|
|
8667
|
-
RxjsUtils.prototype.pipeTimeOutControlOn = function (in$, timeoutPeriods) {
|
|
8668
|
-
var timeOutAfterSeconds = timeoutPeriods[0];
|
|
8669
|
-
var out$ = in$.pipe(operators.timeout(timeOutAfterSeconds * 1000));
|
|
8670
|
-
return out$;
|
|
8671
|
-
};
|
|
8672
|
-
RxjsUtils.prototype.pipeRetryMechanismOn = function (in$) {
|
|
8673
|
-
var _this = this;
|
|
8674
|
-
var retryStrategy = function (errors) {
|
|
8675
|
-
return errors.pipe(operators.mergeMap(function (error, i) {
|
|
8676
|
-
console.error("Mapping error " + (error === null || error === void 0 ? void 0 : error.name) + ", " + i);
|
|
8677
|
-
console.error(error);
|
|
8678
|
-
if ((error === null || error === void 0 ? void 0 : error.name) === 'TimeoutError' && i === 0) {
|
|
8679
|
-
_this.switchOffArtificialDelays();
|
|
8680
|
-
console.info('Will retry, after a timeout error.');
|
|
8681
|
-
}
|
|
8682
|
-
else {
|
|
8683
|
-
console.error('Will NOT retry.');
|
|
8684
|
-
rxjs.throwError(error);
|
|
8685
|
-
}
|
|
8686
|
-
return rxjs.timer(0);
|
|
8687
|
-
}), operators.finalize(function () { return console.log('We are done!'); }));
|
|
8688
|
-
};
|
|
8689
|
-
var out$ = in$.pipe(operators.retryWhen(retryStrategy));
|
|
8690
|
-
return out$;
|
|
8691
|
-
};
|
|
8692
|
-
RxjsUtils.prototype.pipeArtificialDelayOn = function (in$) {
|
|
8693
|
-
var _this = this;
|
|
8694
|
-
var out$ = in$.pipe(operators.tap(function () {
|
|
8695
|
-
console.log("Artificially delaying for " + _this.getArtificialDelayTime() + " seconds..");
|
|
8696
|
-
}));
|
|
8697
|
-
out$ = out$.pipe(operators.delayWhen(function () { return rxjs.timer(_this.getArtificialDelayTime() * 1000); }));
|
|
8698
|
-
out$ = out$.pipe(operators.tap(function () {
|
|
8699
|
-
console.log("Artificially delayed for " + _this.getArtificialDelayTime() + " seconds..");
|
|
8700
|
-
}));
|
|
8701
|
-
return out$;
|
|
8702
|
-
};
|
|
8703
|
-
return RxjsUtils;
|
|
8704
|
-
}());
|
|
8705
|
-
RxjsUtils.ɵfac = function RxjsUtils_Factory(t) { return new (t || RxjsUtils)(); };
|
|
8706
|
-
RxjsUtils.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: RxjsUtils, factory: RxjsUtils.ɵfac });
|
|
8707
|
-
(function () {
|
|
8708
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(RxjsUtils, [{
|
|
8709
|
-
type: i0.Injectable
|
|
8710
|
-
}], null, null);
|
|
8711
|
-
})();
|
|
8712
|
-
|
|
8713
8716
|
var CasesService = /** @class */ (function () {
|
|
8714
|
-
function CasesService(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, loadingService, sessionStorageService,
|
|
8717
|
+
function CasesService(http, appConfig, orderService, errorService, wizardPageFieldToCaseFieldMapper, loadingService, sessionStorageService, retryUtil) {
|
|
8715
8718
|
this.http = http;
|
|
8716
8719
|
this.appConfig = appConfig;
|
|
8717
8720
|
this.orderService = orderService;
|
|
@@ -8719,7 +8722,7 @@
|
|
|
8719
8722
|
this.wizardPageFieldToCaseFieldMapper = wizardPageFieldToCaseFieldMapper;
|
|
8720
8723
|
this.loadingService = loadingService;
|
|
8721
8724
|
this.sessionStorageService = sessionStorageService;
|
|
8722
|
-
this.
|
|
8725
|
+
this.retryUtil = retryUtil;
|
|
8723
8726
|
this.get = this.getCaseView;
|
|
8724
8727
|
}
|
|
8725
8728
|
CasesService.updateChallengedAccessRequestAttributes = function (httpClient, caseId, attributesToUpdate) {
|
|
@@ -8754,7 +8757,7 @@
|
|
|
8754
8757
|
.set('Content-Type', 'application/json');
|
|
8755
8758
|
var loadingToken = this.loadingService.register();
|
|
8756
8759
|
var http$ = this.http.get(url, { headers: headers, observe: 'body' });
|
|
8757
|
-
this.
|
|
8760
|
+
this.retryUtil.pipeTimeoutMechanismOn(http$, this.appConfig.getEnvironment(), this.appConfig.getCaseRetrievalTimeouts());
|
|
8758
8761
|
http$ = this.pipeErrorProcessor(http$);
|
|
8759
8762
|
http$ = http$.pipe(operators.finalize(function () { return _this.finalizeGetCaseViewWith(caseId, loadingToken); }));
|
|
8760
8763
|
return http$;
|
|
@@ -8965,12 +8968,12 @@
|
|
|
8965
8968
|
CasesService.V2_MEDIATYPE_CREATE_EVENT = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-event.v2+json;charset=UTF-8';
|
|
8966
8969
|
CasesService.V2_MEDIATYPE_CREATE_CASE = 'application/vnd.uk.gov.hmcts.ccd-data-store-api.create-case.v2+json;charset=UTF-8';
|
|
8967
8970
|
CasesService.PUI_CASE_MANAGER = 'pui-case-manager';
|
|
8968
|
-
CasesService.ɵfac = function CasesService_Factory(t) { return new (t || CasesService)(i0__namespace.ɵɵinject(HttpService), i0__namespace.ɵɵinject(AbstractAppConfig), i0__namespace.ɵɵinject(OrderService), i0__namespace.ɵɵinject(HttpErrorService), i0__namespace.ɵɵinject(WizardPageFieldToCaseFieldMapper), i0__namespace.ɵɵinject(LoadingService), i0__namespace.ɵɵinject(SessionStorageService), i0__namespace.ɵɵinject(
|
|
8971
|
+
CasesService.ɵfac = function CasesService_Factory(t) { return new (t || CasesService)(i0__namespace.ɵɵinject(HttpService), i0__namespace.ɵɵinject(AbstractAppConfig), i0__namespace.ɵɵinject(OrderService), i0__namespace.ɵɵinject(HttpErrorService), i0__namespace.ɵɵinject(WizardPageFieldToCaseFieldMapper), i0__namespace.ɵɵinject(LoadingService), i0__namespace.ɵɵinject(SessionStorageService), i0__namespace.ɵɵinject(RetryUtil)); };
|
|
8969
8972
|
CasesService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: CasesService, factory: CasesService.ɵfac });
|
|
8970
8973
|
(function () {
|
|
8971
8974
|
(typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CasesService, [{
|
|
8972
8975
|
type: i0.Injectable
|
|
8973
|
-
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: LoadingService }, { type: SessionStorageService }, { type:
|
|
8976
|
+
}], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: OrderService }, { type: HttpErrorService }, { type: WizardPageFieldToCaseFieldMapper }, { type: LoadingService }, { type: SessionStorageService }, { type: RetryUtil }]; }, null);
|
|
8974
8977
|
})();
|
|
8975
8978
|
|
|
8976
8979
|
var EventTriggerService = /** @class */ (function () {
|
|
@@ -11176,6 +11179,10 @@
|
|
|
11176
11179
|
_this.handleError(error);
|
|
11177
11180
|
});
|
|
11178
11181
|
CaseEditPageComponent.scrollToTop();
|
|
11182
|
+
// Remove all JudicialUser FormControls with the ID suffix "_judicialUserControl" because these are not
|
|
11183
|
+
// intended to be present in the Case Event data (they are added only for value selection and validation
|
|
11184
|
+
// purposes)
|
|
11185
|
+
this.removeAllJudicialUserFormControls(this.currentPage, this.editForm);
|
|
11179
11186
|
}
|
|
11180
11187
|
CaseEditPageComponent.setFocusToTop();
|
|
11181
11188
|
};
|
|
@@ -11447,6 +11454,13 @@
|
|
|
11447
11454
|
submit: this.caseEdit.submit,
|
|
11448
11455
|
});
|
|
11449
11456
|
};
|
|
11457
|
+
CaseEditPageComponent.prototype.removeAllJudicialUserFormControls = function (page, editForm) {
|
|
11458
|
+
page.case_fields.forEach(function (caseField) {
|
|
11459
|
+
if (FieldsUtils.isCaseFieldOfType(caseField, ['JudicialUser'])) {
|
|
11460
|
+
editForm.controls['data'].removeControl(caseField.id + "_judicialUserControl");
|
|
11461
|
+
}
|
|
11462
|
+
});
|
|
11463
|
+
};
|
|
11450
11464
|
return CaseEditPageComponent;
|
|
11451
11465
|
}());
|
|
11452
11466
|
CaseEditPageComponent.RESUMED_FORM_DISCARD = 'RESUMED_FORM_DISCARD';
|
|
@@ -37687,6 +37701,7 @@
|
|
|
37687
37701
|
exports.ReadYesNoFieldComponent = ReadYesNoFieldComponent;
|
|
37688
37702
|
exports.RemoveDialogComponent = RemoveDialogComponent;
|
|
37689
37703
|
exports.RequestOptionsBuilder = RequestOptionsBuilder;
|
|
37704
|
+
exports.RetryUtil = RetryUtil;
|
|
37690
37705
|
exports.RouterHelperService = RouterHelperService;
|
|
37691
37706
|
exports.SaveOrDiscardDialogComponent = SaveOrDiscardDialogComponent;
|
|
37692
37707
|
exports.SearchFiltersComponent = SearchFiltersComponent;
|