monkey-front-core 0.0.150 → 0.0.151
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/esm2020/lib/core/interfaces/schedules/monkeyecx-request-schedule.mjs +1 -1
- package/esm2020/lib/core/services/logged/monkeyecx-logged-handling.service.mjs +12 -1
- package/esm2020/lib/core/services/schedules/monkeyecx-request-schedule.service.mjs +93 -22
- package/fesm2015/monkey-front-core.mjs +82 -16
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +103 -21
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/interfaces/schedules/monkeyecx-request-schedule.d.ts +2 -0
- package/lib/core/services/logged/monkeyecx-logged-handling.service.d.ts +3 -0
- package/lib/core/services/schedules/monkeyecx-request-schedule.service.d.ts +21 -3
- package/monkey-front-core-0.0.151.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.150.tgz +0 -0
|
@@ -4227,6 +4227,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
4227
4227
|
class MonkeyEcxLoggedHandlingService {
|
|
4228
4228
|
constructor() {
|
|
4229
4229
|
this.schedules = [];
|
|
4230
|
+
this.genericSchedules = [];
|
|
4230
4231
|
// not to do
|
|
4231
4232
|
}
|
|
4232
4233
|
destroySchedule() {
|
|
@@ -4235,11 +4236,21 @@ class MonkeyEcxLoggedHandlingService {
|
|
|
4235
4236
|
});
|
|
4236
4237
|
this.schedules = [];
|
|
4237
4238
|
}
|
|
4239
|
+
destroyGenericSchedule() {
|
|
4240
|
+
this.genericSchedules.forEach((sch) => {
|
|
4241
|
+
clearInterval(sch.interval);
|
|
4242
|
+
});
|
|
4243
|
+
this.genericSchedules = [];
|
|
4244
|
+
}
|
|
4238
4245
|
addSchedule(sch) {
|
|
4239
4246
|
this.schedules = sch;
|
|
4240
4247
|
}
|
|
4248
|
+
addGenericSchedule(sch) {
|
|
4249
|
+
this.genericSchedules = sch;
|
|
4250
|
+
}
|
|
4241
4251
|
destroy() {
|
|
4242
4252
|
this.destroySchedule();
|
|
4253
|
+
this.destroyGenericSchedule();
|
|
4243
4254
|
}
|
|
4244
4255
|
}
|
|
4245
4256
|
MonkeyEcxLoggedHandlingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxLoggedHandlingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -4446,15 +4457,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
4446
4457
|
}], ctorParameters: function () { return [{ type: i1$3.Router }]; } });
|
|
4447
4458
|
|
|
4448
4459
|
class MonkeyEcxRequestScheduleService {
|
|
4449
|
-
constructor(monkeyecxService,
|
|
4460
|
+
constructor(monkeyecxService, monkeyLoggedHandlingService) {
|
|
4450
4461
|
this.monkeyecxService = monkeyecxService;
|
|
4451
|
-
this.
|
|
4462
|
+
this.monkeyLoggedHandlingService = monkeyLoggedHandlingService;
|
|
4452
4463
|
this.schedule = [];
|
|
4464
|
+
this.genericSchedule = [];
|
|
4453
4465
|
// not to do
|
|
4454
4466
|
}
|
|
4455
4467
|
addToSchedule(q) {
|
|
4456
4468
|
this.schedule.push(q);
|
|
4457
|
-
this.
|
|
4469
|
+
this.monkeyLoggedHandlingService.addSchedule(this.schedule);
|
|
4470
|
+
}
|
|
4471
|
+
addToGenericSchedule(q) {
|
|
4472
|
+
this.genericSchedule.push(q);
|
|
4473
|
+
this.monkeyLoggedHandlingService.addGenericSchedule(this.genericSchedule);
|
|
4458
4474
|
}
|
|
4459
4475
|
removeFromSchedule(q) {
|
|
4460
4476
|
clearInterval(q.interval);
|
|
@@ -4462,66 +4478,121 @@ class MonkeyEcxRequestScheduleService {
|
|
|
4462
4478
|
this.schedule = [
|
|
4463
4479
|
...saved.map((sch) => {
|
|
4464
4480
|
const savedLocal = {
|
|
4465
|
-
...sch
|
|
4481
|
+
...sch
|
|
4466
4482
|
};
|
|
4467
4483
|
if (sch.id === q.id) {
|
|
4468
4484
|
return null;
|
|
4469
4485
|
}
|
|
4470
4486
|
return savedLocal;
|
|
4471
|
-
})
|
|
4487
|
+
})
|
|
4488
|
+
].filter((_) => {
|
|
4489
|
+
return _;
|
|
4490
|
+
});
|
|
4491
|
+
this.monkeyLoggedHandlingService.addSchedule(this.schedule);
|
|
4492
|
+
}
|
|
4493
|
+
removeFromGenericSchedule(q) {
|
|
4494
|
+
clearInterval(q.interval);
|
|
4495
|
+
const saved = [...this.genericSchedule];
|
|
4496
|
+
this.genericSchedule = [
|
|
4497
|
+
...saved.map((sch) => {
|
|
4498
|
+
const savedLocal = {
|
|
4499
|
+
...sch
|
|
4500
|
+
};
|
|
4501
|
+
if (sch.id === q.id) {
|
|
4502
|
+
return null;
|
|
4503
|
+
}
|
|
4504
|
+
return savedLocal;
|
|
4505
|
+
})
|
|
4472
4506
|
].filter((_) => {
|
|
4473
4507
|
return _;
|
|
4474
4508
|
});
|
|
4475
|
-
this.
|
|
4509
|
+
this.monkeyLoggedHandlingService.addGenericSchedule(this.genericSchedule);
|
|
4476
4510
|
}
|
|
4477
4511
|
removeFromScheduleById(id) {
|
|
4478
4512
|
const q = this.getScheduleById(id);
|
|
4479
|
-
clearInterval(q
|
|
4513
|
+
clearInterval(q?.interval);
|
|
4480
4514
|
const saved = [...this.schedule];
|
|
4481
4515
|
this.schedule = [
|
|
4482
4516
|
...saved.map((sch) => {
|
|
4483
4517
|
const savedLocal = {
|
|
4484
|
-
...sch
|
|
4518
|
+
...sch
|
|
4485
4519
|
};
|
|
4486
|
-
if (sch.id === q
|
|
4520
|
+
if (sch.id === q?.id) {
|
|
4487
4521
|
return null;
|
|
4488
4522
|
}
|
|
4489
4523
|
return savedLocal;
|
|
4490
|
-
})
|
|
4524
|
+
})
|
|
4491
4525
|
].filter((_) => {
|
|
4492
4526
|
return _;
|
|
4493
4527
|
});
|
|
4494
|
-
this.
|
|
4528
|
+
this.monkeyLoggedHandlingService.addSchedule(this.schedule);
|
|
4495
4529
|
}
|
|
4496
4530
|
doCall(sch) {
|
|
4497
|
-
const { url, method, params, data, action } = sch;
|
|
4531
|
+
const { url, method, params, data, action, errorAction } = sch;
|
|
4532
|
+
const errAction = errorAction || ((...args) => { });
|
|
4498
4533
|
this.monkeyecxService[method.toLowerCase()](`${url}`, params).subscribe((resp) => {
|
|
4499
4534
|
action({
|
|
4500
4535
|
...data,
|
|
4501
|
-
...resp
|
|
4536
|
+
...resp
|
|
4502
4537
|
}, sch);
|
|
4503
|
-
}, () => {
|
|
4538
|
+
}, (err) => {
|
|
4504
4539
|
this.removeFromSchedule(sch);
|
|
4540
|
+
errAction({
|
|
4541
|
+
...data
|
|
4542
|
+
}, sch, err);
|
|
4543
|
+
});
|
|
4544
|
+
}
|
|
4545
|
+
doGenericCall(sch) {
|
|
4546
|
+
const { url, method, params, data, action, errorAction } = sch;
|
|
4547
|
+
const errAction = errorAction || ((...args) => { });
|
|
4548
|
+
this.monkeyecxService[method.toLowerCase()](`${url}`, params).subscribe((resp) => {
|
|
4549
|
+
action({
|
|
4550
|
+
...data,
|
|
4551
|
+
...resp
|
|
4552
|
+
}, sch);
|
|
4553
|
+
}, (err) => {
|
|
4554
|
+
this.removeFromGenericSchedule(sch);
|
|
4555
|
+
errAction({
|
|
4556
|
+
...data
|
|
4557
|
+
}, sch, err);
|
|
4505
4558
|
});
|
|
4506
4559
|
}
|
|
4507
4560
|
setSchedule(q, delay = 3000) {
|
|
4508
4561
|
const interval = setInterval(() => {
|
|
4509
4562
|
this.doCall({
|
|
4510
4563
|
...q,
|
|
4511
|
-
interval
|
|
4564
|
+
interval
|
|
4512
4565
|
});
|
|
4513
4566
|
}, delay);
|
|
4514
4567
|
const sch = {
|
|
4515
4568
|
...q,
|
|
4516
4569
|
id: `${MonkeyEcxUtils.getRandomString(40)}`,
|
|
4517
|
-
interval
|
|
4570
|
+
interval
|
|
4518
4571
|
};
|
|
4519
4572
|
this.addToSchedule(sch);
|
|
4520
4573
|
return sch;
|
|
4521
4574
|
}
|
|
4575
|
+
setGenericSchedule(q, delay = 3000) {
|
|
4576
|
+
const interval = setInterval(() => {
|
|
4577
|
+
this.doGenericCall({
|
|
4578
|
+
...q,
|
|
4579
|
+
interval
|
|
4580
|
+
});
|
|
4581
|
+
}, delay);
|
|
4582
|
+
const sch = {
|
|
4583
|
+
...q,
|
|
4584
|
+
id: `${MonkeyEcxUtils.getRandomString(40)}`,
|
|
4585
|
+
interval
|
|
4586
|
+
};
|
|
4587
|
+
this.addToGenericSchedule(sch);
|
|
4588
|
+
return sch;
|
|
4589
|
+
}
|
|
4522
4590
|
removeSchedule(q) {
|
|
4523
4591
|
this.removeFromSchedule(q);
|
|
4524
4592
|
}
|
|
4593
|
+
removeGenericSchedule(q) {
|
|
4594
|
+
this.removeFromGenericSchedule(q);
|
|
4595
|
+
}
|
|
4525
4596
|
removeScheduleById(id) {
|
|
4526
4597
|
this.removeFromScheduleById(id);
|
|
4527
4598
|
}
|
|
@@ -4537,19 +4608,30 @@ MonkeyEcxRequestScheduleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion
|
|
|
4537
4608
|
__decorate([
|
|
4538
4609
|
MonkeyEcxCoreService({
|
|
4539
4610
|
httpResponse: {
|
|
4540
|
-
httpCodeIgnore: [400, 403, 404, 500, 503]
|
|
4611
|
+
httpCodeIgnore: [400, 403, 404, 500, 503]
|
|
4541
4612
|
},
|
|
4542
4613
|
requestInProgress: {
|
|
4543
|
-
showProgress: false
|
|
4544
|
-
}
|
|
4614
|
+
showProgress: false
|
|
4615
|
+
}
|
|
4545
4616
|
})
|
|
4546
4617
|
], MonkeyEcxRequestScheduleService.prototype, "doCall", null);
|
|
4618
|
+
__decorate([
|
|
4619
|
+
MonkeyEcxCoreService({
|
|
4620
|
+
httpResponse: {
|
|
4621
|
+
httpCodeIgnore: [400, 401, 403, 404, 500, 503],
|
|
4622
|
+
httpCodeIgnoreRedirect: [503]
|
|
4623
|
+
},
|
|
4624
|
+
requestInProgress: {
|
|
4625
|
+
showProgress: false
|
|
4626
|
+
}
|
|
4627
|
+
})
|
|
4628
|
+
], MonkeyEcxRequestScheduleService.prototype, "doGenericCall", null);
|
|
4547
4629
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxRequestScheduleService, decorators: [{
|
|
4548
4630
|
type: Injectable,
|
|
4549
4631
|
args: [{
|
|
4550
|
-
providedIn: 'root'
|
|
4632
|
+
providedIn: 'root'
|
|
4551
4633
|
}]
|
|
4552
|
-
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxLoggedHandlingService }]; }, propDecorators: { doCall: [] } });
|
|
4634
|
+
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxLoggedHandlingService }]; }, propDecorators: { doCall: [], doGenericCall: [] } });
|
|
4553
4635
|
|
|
4554
4636
|
/* eslint-disable no-unused-vars */
|
|
4555
4637
|
var OpSearch;
|