@ductape/sdk 0.0.3-beta11 → 0.0.3-beta12
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/dist/apps/services/app.service.js +4 -1
- package/dist/apps/services/app.service.js.map +1 -1
- package/dist/apps/utils/objects.utils.d.ts +1 -1
- package/dist/apps/utils/objects.utils.js +5 -3
- package/dist/apps/utils/objects.utils.js.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/dist/logs/logs.service.js +0 -1
- package/dist/logs/logs.service.js.map +1 -1
- package/dist/logs/logs.types.d.ts +2 -0
- package/dist/logs/logs.types.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +7 -3
- package/dist/processor/services/processor.service.js +132 -77
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/processor/utils/storage.util.js +0 -1
- package/dist/processor/utils/storage.util.js.map +1 -1
- package/dist/products/services/products.service.d.ts +11 -4
- package/dist/products/services/products.service.js +169 -45
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/utils/functions.utils.d.ts +1 -0
- package/dist/products/utils/functions.utils.js +11 -0
- package/dist/products/utils/functions.utils.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productFallback.validator.js +7 -1
- package/dist/products/validators/joi-validators/create.productFallback.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productQuota.validator.js +8 -2
- package/dist/products/validators/joi-validators/create.productQuota.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productFallback.validator.js +7 -2
- package/dist/products/validators/joi-validators/update.productFallback.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productQuota.validator.js +5 -1
- package/dist/products/validators/joi-validators/update.productQuota.validator.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -56,6 +56,7 @@ const http_client_1 = __importDefault(require("../../clients/http.client"));
|
|
|
56
56
|
const processorApi_service_1 = require("../../api/services/processorApi.service");
|
|
57
57
|
const expo_client_1 = __importDefault(require("../../clients/expo.client"));
|
|
58
58
|
const handlebars_1 = require("handlebars");
|
|
59
|
+
const functions_utils_1 = require("../../products/utils/functions.utils");
|
|
59
60
|
const string_utils_1 = require("../../products/utils/string.utils");
|
|
60
61
|
const create_productFeature_validator_1 = require("../../products/validators/joi-validators/create.productFeature.validator");
|
|
61
62
|
const validators_1 = require("../../products/validators");
|
|
@@ -90,6 +91,7 @@ class ProcessorService {
|
|
|
90
91
|
this.public_key = public_key;
|
|
91
92
|
this.user_id = user_id;
|
|
92
93
|
this.token = token;
|
|
94
|
+
this.published = false;
|
|
93
95
|
this.productBuilderService = new products_service_1.default({
|
|
94
96
|
workspace_id,
|
|
95
97
|
public_key,
|
|
@@ -98,6 +100,8 @@ class ProcessorService {
|
|
|
98
100
|
env_type,
|
|
99
101
|
});
|
|
100
102
|
this.inputService = new inputs_service_1.default();
|
|
103
|
+
this.requestTime = 0;
|
|
104
|
+
this.totalRequests = 0;
|
|
101
105
|
this.processingOutput = {
|
|
102
106
|
success: [],
|
|
103
107
|
failure: [],
|
|
@@ -385,7 +389,6 @@ class ProcessorService {
|
|
|
385
389
|
name: 'Process feature',
|
|
386
390
|
type: types_1.LogEventTypes.FEATURE,
|
|
387
391
|
};
|
|
388
|
-
console.log(additional_logs);
|
|
389
392
|
await this.intializeProduct(additional_logs);
|
|
390
393
|
this.component = types_1.LogEventTypes.FEATURE;
|
|
391
394
|
const process_id = this.process_id || (0, processor_utils_1.generateObjectId)();
|
|
@@ -412,7 +415,7 @@ class ProcessorService {
|
|
|
412
415
|
// validate feature input and log failure
|
|
413
416
|
this.validateJSONFeatureInput(input, featureInput, additional_logs);
|
|
414
417
|
// split processes
|
|
415
|
-
this.sequenceLevels = this.splitSequenceIntoLevels(sequence, additional_logs);
|
|
418
|
+
this.sequenceLevels = await this.splitSequenceIntoLevels(sequence, additional_logs);
|
|
416
419
|
await this.processSequenceLevels(additional_logs);
|
|
417
420
|
return { process_id };
|
|
418
421
|
//return this.generateOutput(output as unknown as Record<string, IFeatureOutput>);
|
|
@@ -430,6 +433,7 @@ class ProcessorService {
|
|
|
430
433
|
}
|
|
431
434
|
}
|
|
432
435
|
else {
|
|
436
|
+
console.log("FAILING HERE TOOO");
|
|
433
437
|
throw e;
|
|
434
438
|
}
|
|
435
439
|
}
|
|
@@ -525,7 +529,7 @@ class ProcessorService {
|
|
|
525
529
|
throw e;
|
|
526
530
|
}
|
|
527
531
|
}
|
|
528
|
-
splitSequenceIntoLevels(data, additional_logs) {
|
|
532
|
+
async splitSequenceIntoLevels(data, additional_logs) {
|
|
529
533
|
try {
|
|
530
534
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Split sequence - initiated', data: {}, status: types_1.LogEventStatus.PROCESSING }));
|
|
531
535
|
const levels = {};
|
|
@@ -567,7 +571,7 @@ class ProcessorService {
|
|
|
567
571
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Process levels - initiated', data: { levels: this.sequenceLevels }, status: types_1.LogEventStatus.PROCESSING }));
|
|
568
572
|
const levelEvents = {};
|
|
569
573
|
Object.entries(this.sequenceLevels).forEach(([level, sequences]) => {
|
|
570
|
-
levelEvents[parseInt(level)] = this.fetchLevelEvents(sequences);
|
|
574
|
+
levelEvents[parseInt(level)] = this.fetchLevelEvents(sequences, parseInt(level));
|
|
571
575
|
});
|
|
572
576
|
let previousLevelComplete = true;
|
|
573
577
|
for (const level of Object.keys(levelEvents)
|
|
@@ -580,7 +584,8 @@ class ProcessorService {
|
|
|
580
584
|
break;
|
|
581
585
|
}
|
|
582
586
|
}
|
|
583
|
-
if (previousLevelComplete) {
|
|
587
|
+
if (previousLevelComplete && !this.published) {
|
|
588
|
+
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { successful_feature_execution: true, message: 'Process feature - success', data: {}, status: types_1.LogEventStatus.SUCCESS }));
|
|
584
589
|
this.logService.publish();
|
|
585
590
|
this.end = Date.now();
|
|
586
591
|
this.writeResult(types_1.LogEventStatus.SUCCESS);
|
|
@@ -588,50 +593,67 @@ class ProcessorService {
|
|
|
588
593
|
}
|
|
589
594
|
catch (e) {
|
|
590
595
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Process levels - failed', data: { e }, status: types_1.LogEventStatus.FAIL }));
|
|
596
|
+
console.log("SEQUENCE PROCESSING FAILED!!!");
|
|
591
597
|
throw e;
|
|
592
598
|
}
|
|
593
599
|
}
|
|
594
600
|
async processLevelEvents(events, additional_logs) {
|
|
595
|
-
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
601
|
+
try {
|
|
602
|
+
const promises = events.map((event) => {
|
|
603
|
+
const dependants = this.fetchActionRequestDependents(event.input, additional_logs);
|
|
604
|
+
const passed = this.checkDependentsSuccess(dependants);
|
|
605
|
+
if (passed) {
|
|
606
|
+
// TODO: comparison to see if all depending events are in success || dependants is empty
|
|
607
|
+
return this.processEvent(event);
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
this.addToWaitingOutput(event, dependants);
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
return Promise.all(promises);
|
|
614
|
+
}
|
|
615
|
+
catch (e) {
|
|
616
|
+
throw e;
|
|
617
|
+
}
|
|
606
618
|
}
|
|
607
619
|
async processFailedEvents(additional_logs) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
+
try {
|
|
621
|
+
const { failure } = this.processingOutput;
|
|
622
|
+
const promises = failure.map((failed) => {
|
|
623
|
+
if (failed.retries_left > 0 && new Date().getTime() > failed.retry_at) {
|
|
624
|
+
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Reprocess failed events - initiated', data: Object.assign({}, failed), status: types_1.LogEventStatus.PROCESSING }));
|
|
625
|
+
return this.processEvent(failed.event); // process events should also take care of this.processingOutput
|
|
626
|
+
}
|
|
627
|
+
if (failed.retries_left === 0 && !failed.allow_fail) {
|
|
628
|
+
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Reprocess failed events - failed', data: Object.assign(Object.assign({}, failed), { reason: 'Ran out of Retries' }), status: types_1.LogEventStatus.FAIL }));
|
|
629
|
+
throw new Error(`Event ${failed.event.event} failed in sequence ${failed.event.sequence_tag}, ran out of retries and the feature cannot run without it succeeding`);
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
Promise.all(promises);
|
|
633
|
+
}
|
|
634
|
+
catch (e) {
|
|
635
|
+
throw e;
|
|
636
|
+
}
|
|
620
637
|
}
|
|
621
638
|
async processWaitingEvents(additional_logs) {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
639
|
+
try {
|
|
640
|
+
const { waiting } = this.processingOutput;
|
|
641
|
+
const promises = waiting.map((waiting) => {
|
|
642
|
+
const { dependants } = waiting;
|
|
643
|
+
if (this.checkDependentsSuccess(dependants)) {
|
|
644
|
+
// TODO: comparison to see if all depending events are in success || dependants is empty
|
|
645
|
+
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Reprocess waiting events - initiated', data: Object.assign({}, waiting), status: types_1.LogEventStatus.PROCESSING }));
|
|
646
|
+
return this.processEvent(waiting.event);
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Reprocess waiting events - waiting', data: Object.assign({}, waiting), status: types_1.LogEventStatus.WAITING }));
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
return Promise.all(promises);
|
|
653
|
+
}
|
|
654
|
+
catch (e) {
|
|
655
|
+
throw e;
|
|
656
|
+
}
|
|
635
657
|
}
|
|
636
658
|
checkDependentsSuccess(dependants) {
|
|
637
659
|
let pass = true;
|
|
@@ -661,6 +683,12 @@ class ProcessorService {
|
|
|
661
683
|
if (input.data) {
|
|
662
684
|
dependents.push(...this.fetchDependents(input.data, additional_logs));
|
|
663
685
|
}
|
|
686
|
+
if (input.fileName) {
|
|
687
|
+
dependents.push(...this.valueStringDepsCheck(input.fileName));
|
|
688
|
+
}
|
|
689
|
+
if (input.buffer) {
|
|
690
|
+
dependents.push(...this.valueStringDepsCheck(input.buffer));
|
|
691
|
+
}
|
|
664
692
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Fetch request dependencies - success', data: { input: (0, processor_utils_1.anonymizeObject)(input), dependents }, status: types_1.LogEventStatus.SUCCESS }));
|
|
665
693
|
return dependents;
|
|
666
694
|
}
|
|
@@ -685,6 +713,20 @@ class ProcessorService {
|
|
|
685
713
|
event_tag: stages[1],
|
|
686
714
|
});
|
|
687
715
|
}
|
|
716
|
+
else if (values[i].startsWith('$')) {
|
|
717
|
+
const funcArgs = (0, functions_utils_1.extractFunctionAndArgs)(values[i]);
|
|
718
|
+
if (funcArgs.args.length) {
|
|
719
|
+
funcArgs.args.map((arg) => {
|
|
720
|
+
if (arg.startsWith('$Sequence')) {
|
|
721
|
+
const stages = this.productBuilderService.extractStages(arg);
|
|
722
|
+
dependants.push({
|
|
723
|
+
sequence_tag: stages[0],
|
|
724
|
+
event_tag: stages[1],
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
}
|
|
688
730
|
}
|
|
689
731
|
}
|
|
690
732
|
else {
|
|
@@ -692,10 +734,7 @@ class ProcessorService {
|
|
|
692
734
|
}
|
|
693
735
|
}
|
|
694
736
|
else if (typeof value === 'string') {
|
|
695
|
-
|
|
696
|
-
const stages = this.productBuilderService.extractStages(value);
|
|
697
|
-
dependants.push({ sequence_tag: stages[0], event_tag: stages[1] });
|
|
698
|
-
}
|
|
737
|
+
dependants.push(...this.valueStringDepsCheck(value.trim()));
|
|
699
738
|
}
|
|
700
739
|
}
|
|
701
740
|
return dependants;
|
|
@@ -705,6 +744,34 @@ class ProcessorService {
|
|
|
705
744
|
throw e;
|
|
706
745
|
}
|
|
707
746
|
}
|
|
747
|
+
valueStringDepsCheck(value) {
|
|
748
|
+
const dependants = [];
|
|
749
|
+
if (value.startsWith('$Sequence')) {
|
|
750
|
+
const stages = this.productBuilderService.extractStages(value);
|
|
751
|
+
dependants.push({ sequence_tag: stages[0], event_tag: stages[1] });
|
|
752
|
+
}
|
|
753
|
+
else if (value.startsWith('$')) {
|
|
754
|
+
const funcArgs = (0, functions_utils_1.extractFunctionAndArgs)(value);
|
|
755
|
+
if (funcArgs && funcArgs.args.length) {
|
|
756
|
+
funcArgs.args.map((arg) => {
|
|
757
|
+
if (arg.startsWith('$Sequence')) {
|
|
758
|
+
const stages = this.productBuilderService.extractStages(arg);
|
|
759
|
+
dependants.push({
|
|
760
|
+
sequence_tag: stages[0],
|
|
761
|
+
event_tag: stages[1],
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
const args = arg.split(',');
|
|
766
|
+
args.map((arg) => {
|
|
767
|
+
dependants.push(...this.valueStringDepsCheck(arg.trim()));
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
return dependants;
|
|
774
|
+
}
|
|
708
775
|
async constructJSONDataPayloads(object, additional_logs, samples, event, loopIndex = 0) {
|
|
709
776
|
try {
|
|
710
777
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Construct JSON payloads - initiated', data: { object, samples }, status: types_1.LogEventStatus.PROCESSING }));
|
|
@@ -1400,11 +1467,9 @@ class ProcessorService {
|
|
|
1400
1467
|
name: 'Process feature broker event',
|
|
1401
1468
|
};
|
|
1402
1469
|
try {
|
|
1403
|
-
console.log("GRENADYE ALASOOOO!");
|
|
1404
1470
|
return this.runBrokerPublish(event, additional_logs);
|
|
1405
1471
|
}
|
|
1406
1472
|
catch (e) {
|
|
1407
|
-
console.log("GRENADYE ALASOOOO!!!!");
|
|
1408
1473
|
}
|
|
1409
1474
|
}
|
|
1410
1475
|
if (event.type === types_1.FeatureEventTypes.JOB) {
|
|
@@ -1426,7 +1491,7 @@ class ProcessorService {
|
|
|
1426
1491
|
async processFailedAndWaiting() { }
|
|
1427
1492
|
async generateOutput(process_id) {
|
|
1428
1493
|
var _a, _b, _c, _d;
|
|
1429
|
-
const result =
|
|
1494
|
+
const result = await this.processorApiService.fetchResult(process_id, this.getUserAccess());
|
|
1430
1495
|
if (!result) {
|
|
1431
1496
|
throw new Error(`Invalid process id ${process_id}`);
|
|
1432
1497
|
}
|
|
@@ -1452,7 +1517,7 @@ class ProcessorService {
|
|
|
1452
1517
|
return { process_id, status: result.status, errors };
|
|
1453
1518
|
}
|
|
1454
1519
|
}
|
|
1455
|
-
else {
|
|
1520
|
+
else if (result) {
|
|
1456
1521
|
if ((_a = result.result.success[0]) === null || _a === void 0 ? void 0 : _a.output) {
|
|
1457
1522
|
return { process_id, status: result.status, data: (_b = result.result.success[0]) === null || _b === void 0 ? void 0 : _b.output };
|
|
1458
1523
|
}
|
|
@@ -1492,7 +1557,7 @@ class ProcessorService {
|
|
|
1492
1557
|
// validate feature input and log failure
|
|
1493
1558
|
this.validateJSONFeatureInput(result.input.input, featureInput, additional_logs);
|
|
1494
1559
|
// split processes
|
|
1495
|
-
this.sequenceLevels = this.splitSequenceIntoLevels(sequence, additional_logs);
|
|
1560
|
+
this.sequenceLevels = await this.splitSequenceIntoLevels(sequence, additional_logs);
|
|
1496
1561
|
await this.processSequenceLevels(additional_logs);
|
|
1497
1562
|
}
|
|
1498
1563
|
else {
|
|
@@ -1534,7 +1599,7 @@ class ProcessorService {
|
|
|
1534
1599
|
// validate feature input and log failure
|
|
1535
1600
|
this.validateJSONFeatureInput(result.input.input, featureInput, additional_logs);
|
|
1536
1601
|
// split processes
|
|
1537
|
-
this.sequenceLevels = this.splitSequenceIntoLevels(sequence, additional_logs);
|
|
1602
|
+
this.sequenceLevels = await this.splitSequenceIntoLevels(sequence, additional_logs);
|
|
1538
1603
|
await this.processSequenceLevels(additional_logs);
|
|
1539
1604
|
}
|
|
1540
1605
|
else {
|
|
@@ -1551,15 +1616,15 @@ class ProcessorService {
|
|
|
1551
1616
|
}
|
|
1552
1617
|
return { process_id };
|
|
1553
1618
|
}
|
|
1554
|
-
fetchLevelEvents(level) {
|
|
1619
|
+
fetchLevelEvents(sequence, level) {
|
|
1555
1620
|
const events = [];
|
|
1556
|
-
for (let i = 0; i <
|
|
1557
|
-
events.push(...this.appendSequenceDataToLevelEvents(
|
|
1621
|
+
for (let i = 0; i < sequence.length; i++) {
|
|
1622
|
+
events.push(...this.appendSequenceDataToLevelEvents(sequence[i], level));
|
|
1558
1623
|
}
|
|
1559
1624
|
return events;
|
|
1560
1625
|
}
|
|
1561
|
-
appendSequenceDataToLevelEvents(sequence) {
|
|
1562
|
-
const { events,
|
|
1626
|
+
appendSequenceDataToLevelEvents(sequence, level) {
|
|
1627
|
+
const { events, tag } = sequence;
|
|
1563
1628
|
for (let i = 0; i < events.length; i++) {
|
|
1564
1629
|
events[i].sequence_level = level;
|
|
1565
1630
|
events[i].sequence_tag = tag;
|
|
@@ -1690,13 +1755,11 @@ class ProcessorService {
|
|
|
1690
1755
|
}
|
|
1691
1756
|
async runAction(event, additional_logs, returnValue = false) {
|
|
1692
1757
|
try {
|
|
1693
|
-
console.log("RUNNING ACTION!!!!!");
|
|
1694
1758
|
const { event: action_tag, app: access_tag, condition, cache: cache_tag } = event;
|
|
1695
1759
|
let indexes = [];
|
|
1696
1760
|
if (condition &&
|
|
1697
1761
|
condition.type === types_1.Conditions.CHECK &&
|
|
1698
1762
|
(await this.processConditionalCheck(event, additional_logs))) {
|
|
1699
|
-
console.log("RUNNING ACTION SKIPPED!!!!!");
|
|
1700
1763
|
// if it fails, it would add to skipped queue
|
|
1701
1764
|
return;
|
|
1702
1765
|
}
|
|
@@ -1802,6 +1865,8 @@ class ProcessorService {
|
|
|
1802
1865
|
try {
|
|
1803
1866
|
const results = await this.sendActionRequest(request_base_url, resource, payloads, method, env.slug);
|
|
1804
1867
|
const end = Date.now();
|
|
1868
|
+
this.requestTime += end - start;
|
|
1869
|
+
this.totalRequests += 1;
|
|
1805
1870
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Process http request - success', successful_execution: true, data: { response: (0, processor_utils_1.anonymizeObject)(results) }, status: types_1.LogEventStatus.SUCCESS, app_id, action: event.event, start,
|
|
1806
1871
|
end }));
|
|
1807
1872
|
await this.addToSuccessOutput(event, results, additional_logs);
|
|
@@ -1814,6 +1879,8 @@ class ProcessorService {
|
|
|
1814
1879
|
}
|
|
1815
1880
|
catch (e) {
|
|
1816
1881
|
const end = Date.now();
|
|
1882
|
+
this.requestTime += end - start;
|
|
1883
|
+
this.totalRequests += 1;
|
|
1817
1884
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Process http request - failed', failed_execution: true, data: { e }, status: types_1.LogEventStatus.FAIL, app_id, action: event.event, start,
|
|
1818
1885
|
end }));
|
|
1819
1886
|
try {
|
|
@@ -1903,6 +1970,7 @@ class ProcessorService {
|
|
|
1903
1970
|
this.processingOutput.failure.push(output);
|
|
1904
1971
|
}
|
|
1905
1972
|
if (retries_left > 0) {
|
|
1973
|
+
//console.log("RETRY AT", retry_at)
|
|
1906
1974
|
setTimeout(() => {
|
|
1907
1975
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Retrying Request', data: Object.assign(Object.assign({}, output), { payload: (0, processor_utils_1.anonymizeObject)(output.payload) }), status: types_1.LogEventStatus.PROCESSING }));
|
|
1908
1976
|
if (event.type === types_1.FeatureEventTypes.ACTION) {
|
|
@@ -1917,11 +1985,17 @@ class ProcessorService {
|
|
|
1917
1985
|
}, retry_at);
|
|
1918
1986
|
}
|
|
1919
1987
|
if (allow_fail === false && retries_left === 0) {
|
|
1988
|
+
if (this.feature) {
|
|
1989
|
+
additional_logs.failed_feature_execution = true;
|
|
1990
|
+
}
|
|
1920
1991
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Ran out of retries - failed', data: Object.assign(Object.assign({}, output), { payload: (0, processor_utils_1.anonymizeObject)(output.payload) }), status: types_1.LogEventStatus.FAIL }));
|
|
1921
1992
|
//throw new Error("Run out of retries")
|
|
1993
|
+
console.log("REQUEST TIME", this.requestTime, this.totalRequests, this.end - this.start);
|
|
1922
1994
|
this.end = Date.now();
|
|
1923
1995
|
this.writeResult(types_1.LogEventStatus.FAIL);
|
|
1924
1996
|
this.logService.publish();
|
|
1997
|
+
this.published = true;
|
|
1998
|
+
//throw new Error("Terminate Process")
|
|
1925
1999
|
}
|
|
1926
2000
|
return output;
|
|
1927
2001
|
}
|
|
@@ -2118,7 +2192,6 @@ class ProcessorService {
|
|
|
2118
2192
|
};
|
|
2119
2193
|
try {
|
|
2120
2194
|
this.validateActionDataMappingInput(data.input, types_1.FeatureEventTypes.PUBLISH);
|
|
2121
|
-
console.log("JAPANESE MIRRORS", data.input);
|
|
2122
2195
|
this.start = Date.now();
|
|
2123
2196
|
// clone
|
|
2124
2197
|
this.clone = (0, processor_utils_1.structuredClone)(data.input);
|
|
@@ -2132,7 +2205,6 @@ class ProcessorService {
|
|
|
2132
2205
|
this.process_id = process_id;
|
|
2133
2206
|
const productEnv = this.fetchEnv(data.env, additional_logs);
|
|
2134
2207
|
this.processEnv = productEnv;
|
|
2135
|
-
console.log("JAPANESE MIRRORS 2", productEnv);
|
|
2136
2208
|
if (!productEnv.active) {
|
|
2137
2209
|
throw new Error(`Environment ${data.env} is not active`);
|
|
2138
2210
|
}
|
|
@@ -2154,7 +2226,6 @@ class ProcessorService {
|
|
|
2154
2226
|
return result;
|
|
2155
2227
|
}
|
|
2156
2228
|
catch (e) {
|
|
2157
|
-
console.log(e);
|
|
2158
2229
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Publishing to topic - failed', data: { e }, status: types_1.LogEventStatus.FAIL }));
|
|
2159
2230
|
this.end = Date.now();
|
|
2160
2231
|
this.logService.publish();
|
|
@@ -2170,7 +2241,6 @@ class ProcessorService {
|
|
|
2170
2241
|
body: payload.body,
|
|
2171
2242
|
data: (0, processor_utils_1.convertStringToObject)(payload.data),
|
|
2172
2243
|
};
|
|
2173
|
-
console.log("MESSAGE!!!", message);
|
|
2174
2244
|
try {
|
|
2175
2245
|
await (0, expo_client_1.default)().post('', message, (0, processor_utils_1.generateAxiosConfig)());
|
|
2176
2246
|
}
|
|
@@ -2189,7 +2259,6 @@ class ProcessorService {
|
|
|
2189
2259
|
try {
|
|
2190
2260
|
const admin = require('firebase-admin');
|
|
2191
2261
|
const serviceAccount = credentials;
|
|
2192
|
-
console.log("MESSAGE", message);
|
|
2193
2262
|
admin.initializeApp({
|
|
2194
2263
|
credential: admin.credential.cert(serviceAccount),
|
|
2195
2264
|
});
|
|
@@ -2320,11 +2389,6 @@ class ProcessorService {
|
|
|
2320
2389
|
const url = new URL(callbacks.url);
|
|
2321
2390
|
try {
|
|
2322
2391
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Send callback - initiated', data: {}, status: types_1.LogEventStatus.PROCESSING }));
|
|
2323
|
-
console.log("CALLBACK!!!!", {
|
|
2324
|
-
url,
|
|
2325
|
-
payload,
|
|
2326
|
-
method: callbacks.method
|
|
2327
|
-
});
|
|
2328
2392
|
await this.sendActionRequest(url.origin, url.pathname, payload, callbacks.method, '');
|
|
2329
2393
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { name: 'Send callback - success', data: {}, status: types_1.LogEventStatus.SUCCESS }));
|
|
2330
2394
|
}
|
|
@@ -2339,7 +2403,6 @@ class ProcessorService {
|
|
|
2339
2403
|
const SmsClient = await (0, sms_repo_1.loadSMSClient)();
|
|
2340
2404
|
const smsClient = new SmsClient(smses);
|
|
2341
2405
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { name: 'Send sms - initiated', data: { message: input.sms.body, config: (0, processor_utils_1.anonymizeObject)(smses) }, status: types_1.LogEventStatus.SUCCESS }));
|
|
2342
|
-
console.log("SMS!!!!", input.sms, smses);
|
|
2343
2406
|
const res = await smsClient.sendMessage(input.sms.body, input.sms.recipients);
|
|
2344
2407
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { name: 'Send sms - success', data: res, status: types_1.LogEventStatus.SUCCESS }));
|
|
2345
2408
|
}
|
|
@@ -2350,7 +2413,6 @@ class ProcessorService {
|
|
|
2350
2413
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { successful_execution: true, message: 'Attempt notification - success', data: notification, status: types_1.LogEventStatus.SUCCESS }));
|
|
2351
2414
|
}
|
|
2352
2415
|
catch (e) {
|
|
2353
|
-
console.log(e);
|
|
2354
2416
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { failed_execution: true, message: 'Attempt notification - failed', data: { e: e.toString() }, status: types_1.LogEventStatus.FAIL }));
|
|
2355
2417
|
//this.logService.publish();
|
|
2356
2418
|
throw e;
|
|
@@ -2431,7 +2493,6 @@ class ProcessorService {
|
|
|
2431
2493
|
}
|
|
2432
2494
|
}
|
|
2433
2495
|
catch (e) {
|
|
2434
|
-
console.log(e);
|
|
2435
2496
|
this.logService.add(Object.assign(Object.assign({}, this.baseLogs), { failed_execution: true, message: 'Attempt migration - failed', data: e, status: types_1.LogEventStatus.FAIL }));
|
|
2436
2497
|
this.logService.publish();
|
|
2437
2498
|
}
|
|
@@ -2566,7 +2627,6 @@ class ProcessorService {
|
|
|
2566
2627
|
input.buffer = input.buffer ? await this.generateStringValues(input.buffer, '', additional_logs, []) : undefined;
|
|
2567
2628
|
input.fileName = input.fileName ? await this.generateStringValues(input.fileName, '', additional_logs, []) : undefined;
|
|
2568
2629
|
input.mimeType = input.mimeType ? await this.generateStringValues(input.mimeType, '', additional_logs, []) : undefined;
|
|
2569
|
-
console.log("CHINYERE", input.buffer, input.fileName);
|
|
2570
2630
|
result = await this.processStorageRequest(data, input, storageEnv, additional_logs);
|
|
2571
2631
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { successful_execution: true, message: 'Store file - success', data: { result }, status: types_1.LogEventStatus.PROCESSING }));
|
|
2572
2632
|
if (cache_tag && this.redisClient) {
|
|
@@ -2589,7 +2649,6 @@ class ProcessorService {
|
|
|
2589
2649
|
return result;
|
|
2590
2650
|
}
|
|
2591
2651
|
catch (e) {
|
|
2592
|
-
console.log(e);
|
|
2593
2652
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { failed_execution: true, message: 'Attempt storage - failed', data: { e }, status: types_1.LogEventStatus.FAIL }));
|
|
2594
2653
|
throw e;
|
|
2595
2654
|
}
|
|
@@ -2668,8 +2727,6 @@ class ProcessorService {
|
|
|
2668
2727
|
if (!MongoDBHandler) {
|
|
2669
2728
|
throw new Error(`Running in browser, mongo handler not loaded.`);
|
|
2670
2729
|
}
|
|
2671
|
-
console.log("PRIVATE KEY!!!", this.productBuilderService.fetchProduct().private_key);
|
|
2672
|
-
console.log("AMAZONS", (0, processor_utils_1.decrypt)(databaseEnv.connection_url, this.productBuilderService.fetchProduct().private_key));
|
|
2673
2730
|
const mongoHandler = new MongoDBHandler((0, processor_utils_1.decrypt)(databaseEnv.connection_url, this.productBuilderService.fetchProduct().private_key));
|
|
2674
2731
|
if (databaseAction.type === types_1.DatabaseActionTypes.UPDATE) {
|
|
2675
2732
|
const filterTemplate = typeof databaseAction.filterTemplate === 'string'
|
|
@@ -2817,7 +2874,6 @@ class ProcessorService {
|
|
|
2817
2874
|
}
|
|
2818
2875
|
catch (e) {
|
|
2819
2876
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { failed_execution: true, message: 'Attempt publish to broker topic - failed', data: { e }, status: types_1.LogEventStatus.FAIL }));
|
|
2820
|
-
console.log("JERMOOOOO!!!");
|
|
2821
2877
|
throw e;
|
|
2822
2878
|
}
|
|
2823
2879
|
}
|
|
@@ -2962,7 +3018,6 @@ class ProcessorService {
|
|
|
2962
3018
|
retries: retries || 0,
|
|
2963
3019
|
allow_fail: false,
|
|
2964
3020
|
}, additional_logs, true);
|
|
2965
|
-
console.log("RESULT ===>>>>", result);
|
|
2966
3021
|
this.end = Date.now();
|
|
2967
3022
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Execute action - success', data: { input: (0, processor_utils_1.anonymizeObject)(input), result: (0, processor_utils_1.anonymizeObject)(result) }, status: types_1.LogEventStatus.SUCCESS }));
|
|
2968
3023
|
this.writeResult(types_1.LogEventStatus.SUCCESS);
|