@hotmeshio/hotmesh 0.3.6 → 0.3.7
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/build/index.d.ts +2 -1
- package/build/index.js +7 -1
- package/build/modules/key.js +1 -62
- package/build/modules/utils.js +1 -267
- package/build/package.json +12 -8
- package/build/services/activities/activity.js +1 -495
- package/build/services/activities/await.js +1 -109
- package/build/services/activities/cycle.js +1 -96
- package/build/services/activities/hook.js +1 -154
- package/build/services/activities/index.js +1 -20
- package/build/services/activities/interrupt.js +1 -149
- package/build/services/activities/signal.js +1 -118
- package/build/services/activities/trigger.js +1 -237
- package/build/services/activities/worker.js +1 -101
- package/build/services/collator/index.js +1 -197
- package/build/services/compiler/deployer.d.ts +3 -1
- package/build/services/compiler/deployer.js +1 -455
- package/build/services/compiler/index.d.ts +3 -1
- package/build/services/compiler/index.js +1 -91
- package/build/services/compiler/validator.js +1 -122
- package/build/services/engine/index.d.ts +5 -2
- package/build/services/engine/index.js +1 -562
- package/build/services/exporter/index.js +1 -93
- package/build/services/mapper/index.js +1 -67
- package/build/services/meshdata/index.d.ts +0 -1
- package/build/services/meshdata/index.js +16 -24
- package/build/services/meshflow/client.js +4 -8
- package/build/services/meshflow/exporter.js +1 -186
- package/build/services/meshflow/search.d.ts +4 -5
- package/build/services/meshflow/search.js +45 -35
- package/build/services/meshflow/workflow.d.ts +1 -1
- package/build/services/meshflow/workflow.js +3 -28
- package/build/services/pipe/functions/array.js +1 -74
- package/build/services/pipe/functions/bitwise.js +1 -24
- package/build/services/pipe/functions/conditional.js +1 -36
- package/build/services/pipe/functions/cron.js +1 -32
- package/build/services/pipe/functions/date.js +1 -164
- package/build/services/pipe/functions/index.js +1 -30
- package/build/services/pipe/functions/json.js +1 -12
- package/build/services/pipe/functions/logical.js +1 -12
- package/build/services/pipe/functions/math.js +1 -182
- package/build/services/pipe/functions/number.js +1 -60
- package/build/services/pipe/functions/object.js +1 -81
- package/build/services/pipe/functions/string.js +1 -69
- package/build/services/pipe/functions/symbol.js +1 -33
- package/build/services/pipe/functions/unary.js +1 -18
- package/build/services/pipe/index.js +1 -221
- package/build/services/quorum/index.d.ts +1 -1
- package/build/services/quorum/index.js +1 -219
- package/build/services/reporter/index.js +1 -331
- package/build/services/router/index.js +1 -420
- package/build/services/search/factory.d.ts +7 -0
- package/build/services/search/factory.js +20 -0
- package/build/services/search/index.d.ts +21 -0
- package/build/services/search/index.js +10 -0
- package/build/services/search/providers/redis/ioredis.d.ts +18 -0
- package/build/services/search/providers/redis/ioredis.js +1 -0
- package/build/services/search/providers/redis/redis.d.ts +18 -0
- package/build/services/search/providers/redis/redis.js +1 -0
- package/build/services/serializer/index.js +1 -265
- package/build/services/store/factory.d.ts +2 -1
- package/build/services/store/factory.js +2 -2
- package/build/services/store/index.d.ts +71 -97
- package/build/services/store/index.js +2 -939
- package/build/services/store/providers/postgres/postgres.d.ts +0 -0
- package/build/services/store/providers/postgres/postgres.js +0 -0
- package/build/services/store/providers/postgres/types/hash.d.ts +0 -0
- package/build/services/store/providers/postgres/types/hash.js +0 -0
- package/build/services/store/providers/postgres/types/list.d.ts +0 -0
- package/build/services/store/providers/postgres/types/list.js +0 -0
- package/build/services/store/providers/postgres/types/string.d.ts +0 -0
- package/build/services/store/providers/postgres/types/string.js +0 -0
- package/build/services/store/providers/postgres/types/zset.d.ts +0 -0
- package/build/services/store/providers/postgres/types/zset.js +0 -0
- package/build/services/store/providers/redis/_base.d.ts +98 -0
- package/build/services/store/providers/redis/_base.js +1 -0
- package/build/services/store/providers/redis/ioredis.d.ts +12 -0
- package/build/services/store/providers/redis/ioredis.js +1 -0
- package/build/services/store/providers/redis/redis.d.ts +13 -0
- package/build/services/store/providers/redis/redis.js +1 -0
- package/build/services/store/providers/store-initializable.d.ts +5 -0
- package/build/services/store/providers/store-initializable.js +1 -0
- package/build/services/stream/factory.d.ts +2 -1
- package/build/services/stream/factory.js +5 -5
- package/build/services/stream/index.d.ts +13 -14
- package/build/services/stream/index.js +3 -2
- package/build/services/stream/providers/postgres/_deploy.d.ts +4 -0
- package/build/services/stream/providers/postgres/_deploy.js +1 -0
- package/build/services/stream/providers/redis/ioredis.d.ts +21 -0
- package/build/services/stream/providers/redis/ioredis.js +1 -0
- package/build/services/stream/providers/redis/redis.d.ts +21 -0
- package/build/services/stream/providers/redis/redis.js +1 -0
- package/build/services/stream/providers/stream-initializable.d.ts +5 -0
- package/build/services/stream/providers/stream-initializable.js +1 -0
- package/build/services/sub/factory.d.ts +1 -1
- package/build/services/sub/factory.js +5 -5
- package/build/services/sub/index.d.ts +9 -7
- package/build/services/sub/index.js +3 -2
- package/build/services/sub/{clients → providers/redis}/ioredis.d.ts +7 -10
- package/build/services/sub/providers/redis/ioredis.js +1 -0
- package/build/services/sub/{clients → providers/redis}/redis.d.ts +7 -10
- package/build/services/sub/providers/redis/redis.js +1 -0
- package/build/services/task/index.js +1 -171
- package/build/services/telemetry/index.js +1 -225
- package/build/services/worker/index.d.ts +2 -2
- package/build/services/worker/index.js +1 -158
- package/build/types/redis.d.ts +5 -5
- package/index.ts +15 -1
- package/package.json +12 -8
- package/types/redis.ts +5 -5
- package/build/services/store/clients/ioredis.d.ts +0 -30
- package/build/services/store/clients/ioredis.js +0 -220
- package/build/services/store/clients/redis.d.ts +0 -32
- package/build/services/store/clients/redis.js +0 -319
- package/build/services/stream/clients/ioredis.d.ts +0 -24
- package/build/services/stream/clients/ioredis.js +0 -121
- package/build/services/stream/clients/redis.d.ts +0 -24
- package/build/services/stream/clients/redis.js +0 -161
- package/build/services/sub/clients/ioredis.js +0 -72
- package/build/services/sub/clients/redis.js +0 -63
|
@@ -1,96 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Cycle = void 0;
|
|
4
|
-
const errors_1 = require("../../modules/errors");
|
|
5
|
-
const utils_1 = require("../../modules/utils");
|
|
6
|
-
const collator_1 = require("../collator");
|
|
7
|
-
const telemetry_1 = require("../telemetry");
|
|
8
|
-
const activity_1 = require("./activity");
|
|
9
|
-
class Cycle extends activity_1.Activity {
|
|
10
|
-
constructor(config, data, metadata, hook, engine, context) {
|
|
11
|
-
super(config, data, metadata, hook, engine, context);
|
|
12
|
-
}
|
|
13
|
-
async process() {
|
|
14
|
-
this.logger.debug('cycle-process', {
|
|
15
|
-
jid: this.context.metadata.jid,
|
|
16
|
-
gid: this.context.metadata.gid,
|
|
17
|
-
aid: this.metadata.aid,
|
|
18
|
-
});
|
|
19
|
-
let telemetry;
|
|
20
|
-
try {
|
|
21
|
-
await this.verifyEntry();
|
|
22
|
-
telemetry = new telemetry_1.TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
|
|
23
|
-
telemetry.startActivitySpan(this.leg);
|
|
24
|
-
this.mapInputData();
|
|
25
|
-
let multi = this.store.getMulti();
|
|
26
|
-
await this.setState(multi);
|
|
27
|
-
await this.setStatus(0, multi);
|
|
28
|
-
const multiResponse = (await multi.exec());
|
|
29
|
-
telemetry.mapActivityAttributes();
|
|
30
|
-
const jobStatus = this.resolveStatus(multiResponse);
|
|
31
|
-
multi = this.store.getMulti();
|
|
32
|
-
const messageId = await this.cycleAncestorActivity(multi);
|
|
33
|
-
telemetry.setActivityAttributes({
|
|
34
|
-
'app.activity.mid': messageId,
|
|
35
|
-
'app.job.jss': jobStatus,
|
|
36
|
-
});
|
|
37
|
-
await collator_1.CollatorService.notarizeEarlyExit(this, multi);
|
|
38
|
-
(await multi.exec());
|
|
39
|
-
return this.context.metadata.aid;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
if (error instanceof errors_1.InactiveJobError) {
|
|
43
|
-
this.logger.error('cycle-inactive-job-error', { ...error });
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
else if (error instanceof errors_1.GenerationalError) {
|
|
47
|
-
this.logger.info('process-event-generational-job-error', { ...error });
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
else if (error instanceof errors_1.GetStateError) {
|
|
51
|
-
this.logger.error('cycle-get-state-error', { ...error });
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
else if (error instanceof errors_1.CollationError) {
|
|
55
|
-
if (error.fault === 'duplicate') {
|
|
56
|
-
this.logger.info('cycle-collation-overage', {
|
|
57
|
-
job_id: this.context.metadata.jid,
|
|
58
|
-
guid: this.context.metadata.guid,
|
|
59
|
-
});
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
this.logger.error('cycle-collation-error', { ...error });
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
this.logger.error('cycle-process-error', { ...error });
|
|
66
|
-
}
|
|
67
|
-
telemetry?.setActivityError(error.message);
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
70
|
-
finally {
|
|
71
|
-
telemetry?.endActivitySpan();
|
|
72
|
-
this.logger.debug('cycle-process-end', {
|
|
73
|
-
jid: this.context.metadata.jid,
|
|
74
|
-
gid: this.context.metadata.gid,
|
|
75
|
-
aid: this.metadata.aid,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async cycleAncestorActivity(multi) {
|
|
80
|
-
this.mapInputData();
|
|
81
|
-
const streamData = {
|
|
82
|
-
metadata: {
|
|
83
|
-
guid: (0, utils_1.guid)(),
|
|
84
|
-
jid: this.context.metadata.jid,
|
|
85
|
-
gid: this.context.metadata.gid,
|
|
86
|
-
dad: collator_1.CollatorService.resolveReentryDimension(this),
|
|
87
|
-
aid: this.config.ancestor,
|
|
88
|
-
spn: this.context['$self'].output.metadata?.l1s,
|
|
89
|
-
trc: this.context.metadata.trc,
|
|
90
|
-
},
|
|
91
|
-
data: this.context.data,
|
|
92
|
-
};
|
|
93
|
-
return (await this.engine.router?.publishMessage(null, streamData, multi));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.Cycle = Cycle;
|
|
1
|
+
'use strict';function _0x81fb(_0x27c728,_0x583cac){const _0x573c56=_0x573c();return _0x81fb=function(_0x81fbc2,_0x1c2b7f){_0x81fbc2=_0x81fbc2-0xdf;let _0x31bf2f=_0x573c56[_0x81fbc2];return _0x31bf2f;},_0x81fb(_0x27c728,_0x583cac);}(function(_0x246157,_0x51480b){const _0x10f83d=_0x81fb,_0x2b7467=_0x246157();while(!![]){try{const _0x39dc0d=parseInt(_0x10f83d(0xe7))/0x1+-parseInt(_0x10f83d(0xe8))/0x2*(-parseInt(_0x10f83d(0xdf))/0x3)+-parseInt(_0x10f83d(0xe0))/0x4+parseInt(_0x10f83d(0xe5))/0x5*(-parseInt(_0x10f83d(0xe2))/0x6)+parseInt(_0x10f83d(0xe4))/0x7*(-parseInt(_0x10f83d(0xe1))/0x8)+parseInt(_0x10f83d(0xe6))/0x9+parseInt(_0x10f83d(0xe3))/0xa;if(_0x39dc0d===_0x51480b)break;else _0x2b7467['push'](_0x2b7467['shift']());}catch(_0x3fda85){_0x2b7467['push'](_0x2b7467['shift']());}}}(_0x573c,0xeca73));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Cycle']=void 0x0;const errors_1=require('../../modules/errors'),utils_1=require('../../modules/utils'),collator_1=require('../collator'),telemetry_1=require('../telemetry'),activity_1=require('./activity');class Cycle extends activity_1['Activity']{constructor(_0x3e9d7a,_0x524338,_0xb3c2d7,_0xc4f57c,_0x8cb371,_0x46dcb2){super(_0x3e9d7a,_0x524338,_0xb3c2d7,_0xc4f57c,_0x8cb371,_0x46dcb2);}async['process'](){this['logger']['debug']('cycle-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0xa34e5c;try{await this['verifyEntry'](),_0xa34e5c=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0xa34e5c['startActivitySpan'](this['leg']),this['mapInputData']();let _0x3ab7e4=this['store']['getMulti']();await this['setState'](_0x3ab7e4),await this['setStatus'](0x0,_0x3ab7e4);const _0x3a027e=await _0x3ab7e4['exec']();_0xa34e5c['mapActivityAttributes']();const _0x16fce7=this['resolveStatus'](_0x3a027e);_0x3ab7e4=this['store']['getMulti']();const _0x4fbcac=await this['cycleAncestorActivity'](_0x3ab7e4);return _0xa34e5c['setActivityAttributes']({'app.activity.mid':_0x4fbcac,'app.job.jss':_0x16fce7}),await collator_1['CollatorService']['notarizeEarlyExit'](this,_0x3ab7e4),await _0x3ab7e4['exec'](),this['context']['metadata']['aid'];}catch(_0x2e87f2){if(_0x2e87f2 instanceof errors_1['InactiveJobError']){this['logger']['error']('cycle-inactive-job-error',{..._0x2e87f2});return;}else{if(_0x2e87f2 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x2e87f2});return;}else{if(_0x2e87f2 instanceof errors_1['GetStateError']){this['logger']['error']('cycle-get-state-error',{..._0x2e87f2});return;}else{if(_0x2e87f2 instanceof errors_1['CollationError']){if(_0x2e87f2['fault']==='duplicate'){this['logger']['info']('cycle-collation-overage',{'job_id':this['context']['metadata']['jid'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('cycle-collation-error',{..._0x2e87f2});}else this['logger']['error']('cycle-process-error',{..._0x2e87f2});}}}_0xa34e5c?.['setActivityError'](_0x2e87f2['message']);throw _0x2e87f2;}finally{_0xa34e5c?.['endActivitySpan'](),this['logger']['debug']('cycle-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}async['cycleAncestorActivity'](_0x3f1638){this['mapInputData']();const _0x4d87f4={'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'dad':collator_1['CollatorService']['resolveReentryDimension'](this),'aid':this['config']['ancestor'],'spn':this['context']['$self']['output']['metadata']?.['l1s'],'trc':this['context']['metadata']['trc']},'data':this['context']['data']};return await this['engine']['router']?.['publishMessage'](null,_0x4d87f4,_0x3f1638);}}exports['Cycle']=Cycle;function _0x573c(){const _0x487e65=['178478TBHtCd','59422LIqMGr','12EnOOES','534428fZrAuQ','8XQzyIL','1075680EzUUJF','37642770aIpTGR','12526185RmtXut','50rHWNUi','5612346yOqehG'];_0x573c=function(){return _0x487e65;};return _0x573c();}
|
|
@@ -1,154 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Hook = void 0;
|
|
4
|
-
const errors_1 = require("../../modules/errors");
|
|
5
|
-
const collator_1 = require("../collator");
|
|
6
|
-
const pipe_1 = require("../pipe");
|
|
7
|
-
const task_1 = require("../task");
|
|
8
|
-
const telemetry_1 = require("../telemetry");
|
|
9
|
-
const stream_1 = require("../../types/stream");
|
|
10
|
-
const enums_1 = require("../../modules/enums");
|
|
11
|
-
const activity_1 = require("./activity");
|
|
12
|
-
class Hook extends activity_1.Activity {
|
|
13
|
-
constructor(config, data, metadata, hook, engine, context) {
|
|
14
|
-
super(config, data, metadata, hook, engine, context);
|
|
15
|
-
}
|
|
16
|
-
async process() {
|
|
17
|
-
this.logger.debug('hook-process', {
|
|
18
|
-
jid: this.context.metadata.jid,
|
|
19
|
-
gid: this.context.metadata.gid,
|
|
20
|
-
aid: this.metadata.aid,
|
|
21
|
-
});
|
|
22
|
-
let telemetry;
|
|
23
|
-
try {
|
|
24
|
-
await this.verifyEntry();
|
|
25
|
-
telemetry = new telemetry_1.TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
|
|
26
|
-
telemetry.startActivitySpan(this.leg);
|
|
27
|
-
if (this.doesHook()) {
|
|
28
|
-
await this.doHook(telemetry);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
await this.doPassThrough(telemetry);
|
|
32
|
-
}
|
|
33
|
-
return this.context.metadata.aid;
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
if (error instanceof errors_1.InactiveJobError) {
|
|
37
|
-
this.logger.error('hook-inactive-job-error', { ...error });
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
else if (error instanceof errors_1.GenerationalError) {
|
|
41
|
-
this.logger.info('process-event-generational-job-error', { ...error });
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
else if (error instanceof errors_1.GetStateError) {
|
|
45
|
-
this.logger.error('hook-get-state-error', { ...error });
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
else if (error instanceof errors_1.CollationError) {
|
|
49
|
-
if (error.fault === 'duplicate') {
|
|
50
|
-
this.logger.info('hook-collation-overage', {
|
|
51
|
-
job_id: this.context.metadata.jid,
|
|
52
|
-
guid: this.context.metadata.guid,
|
|
53
|
-
});
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
this.logger.error('hook-collation-error', { ...error });
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
this.logger.error('hook-process-error', { ...error });
|
|
60
|
-
}
|
|
61
|
-
telemetry?.setActivityError(error.message);
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
finally {
|
|
65
|
-
telemetry?.endActivitySpan();
|
|
66
|
-
this.logger.debug('hook-process-end', {
|
|
67
|
-
jid: this.context.metadata.jid,
|
|
68
|
-
gid: this.context.metadata.gid,
|
|
69
|
-
aid: this.metadata.aid,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
doesHook() {
|
|
74
|
-
if (this.config.sleep) {
|
|
75
|
-
const duration = pipe_1.Pipe.resolve(this.config.sleep, this.context);
|
|
76
|
-
return !isNaN(duration) && Number(duration) > 0;
|
|
77
|
-
}
|
|
78
|
-
return !!this.config.hook?.topic;
|
|
79
|
-
}
|
|
80
|
-
async doHook(telemetry) {
|
|
81
|
-
const multi = this.store.getMulti();
|
|
82
|
-
await this.registerHook(enums_1.HMSH_IS_CLUSTER ? undefined : multi);
|
|
83
|
-
this.mapOutputData();
|
|
84
|
-
this.mapJobData();
|
|
85
|
-
await this.setState(multi);
|
|
86
|
-
await collator_1.CollatorService.authorizeReentry(this, multi);
|
|
87
|
-
await this.setStatus(0, multi);
|
|
88
|
-
await multi.exec();
|
|
89
|
-
telemetry.mapActivityAttributes();
|
|
90
|
-
}
|
|
91
|
-
async doPassThrough(telemetry) {
|
|
92
|
-
const multi = this.store.getMulti();
|
|
93
|
-
let multiResponse;
|
|
94
|
-
this.adjacencyList = await this.filterAdjacent();
|
|
95
|
-
this.mapOutputData();
|
|
96
|
-
this.mapJobData();
|
|
97
|
-
await this.setState(multi);
|
|
98
|
-
await collator_1.CollatorService.notarizeEarlyCompletion(this, multi);
|
|
99
|
-
await this.setStatus(this.adjacencyList.length - 1, multi);
|
|
100
|
-
multiResponse = (await multi.exec());
|
|
101
|
-
telemetry.mapActivityAttributes();
|
|
102
|
-
const jobStatus = this.resolveStatus(multiResponse);
|
|
103
|
-
const attrs = { 'app.job.jss': jobStatus };
|
|
104
|
-
const messageIds = await this.transition(this.adjacencyList, jobStatus);
|
|
105
|
-
if (messageIds.length) {
|
|
106
|
-
attrs['app.activity.mids'] = messageIds.join(',');
|
|
107
|
-
}
|
|
108
|
-
telemetry.setActivityAttributes(attrs);
|
|
109
|
-
}
|
|
110
|
-
async getHookRule(topic) {
|
|
111
|
-
const rules = await this.store.getHookRules();
|
|
112
|
-
return rules?.[topic]?.[0];
|
|
113
|
-
}
|
|
114
|
-
async registerHook(multi) {
|
|
115
|
-
if (this.config.hook?.topic) {
|
|
116
|
-
return await this.engine.taskService.registerWebHook(this.config.hook.topic, this.context, this.resolveDad(), this.context.metadata.expire, multi);
|
|
117
|
-
}
|
|
118
|
-
else if (this.config.sleep) {
|
|
119
|
-
const duration = pipe_1.Pipe.resolve(this.config.sleep, this.context);
|
|
120
|
-
await this.engine.taskService.registerTimeHook(this.context.metadata.jid, this.context.metadata.gid, `${this.metadata.aid}${this.metadata.dad || ''}`, 'sleep', duration, this.metadata.dad || '');
|
|
121
|
-
return this.context.metadata.jid;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
async processWebHookEvent(status = stream_1.StreamStatus.SUCCESS, code = 200) {
|
|
125
|
-
this.logger.debug('hook-process-web-hook-event', {
|
|
126
|
-
topic: this.config.hook.topic,
|
|
127
|
-
aid: this.metadata.aid,
|
|
128
|
-
status,
|
|
129
|
-
code,
|
|
130
|
-
});
|
|
131
|
-
const taskService = new task_1.TaskService(this.store, this.logger);
|
|
132
|
-
const data = { ...this.data };
|
|
133
|
-
const signal = await taskService.processWebHookSignal(this.config.hook.topic, data);
|
|
134
|
-
if (signal) {
|
|
135
|
-
const [jobId, _aid, dad, gId] = signal;
|
|
136
|
-
this.context.metadata.jid = jobId;
|
|
137
|
-
this.context.metadata.gid = gId;
|
|
138
|
-
this.context.metadata.dad = dad;
|
|
139
|
-
await this.processEvent(status, code, 'hook');
|
|
140
|
-
if (code === 200) {
|
|
141
|
-
await taskService.deleteWebHookSignal(this.config.hook.topic, data);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
async processTimeHookEvent(jobId) {
|
|
146
|
-
this.logger.debug('hook-process-time-hook-event', {
|
|
147
|
-
jid: jobId,
|
|
148
|
-
gid: this.context.metadata.gid,
|
|
149
|
-
aid: this.metadata.aid,
|
|
150
|
-
});
|
|
151
|
-
await this.processEvent(stream_1.StreamStatus.SUCCESS, 200, 'hook');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
exports.Hook = Hook;
|
|
1
|
+
'use strict';function _0x5420(_0x535041,_0x25e30a){const _0x3bb880=_0x3bb8();return _0x5420=function(_0x542041,_0x47b3a7){_0x542041=_0x542041-0x15c;let _0x5f1de6=_0x3bb880[_0x542041];return _0x5f1de6;},_0x5420(_0x535041,_0x25e30a);}(function(_0x2bc871,_0x2ab16c){const _0x1dbbf2=_0x5420,_0x128883=_0x2bc871();while(!![]){try{const _0x55cdc1=parseInt(_0x1dbbf2(0x161))/0x1+-parseInt(_0x1dbbf2(0x15d))/0x2*(-parseInt(_0x1dbbf2(0x15f))/0x3)+parseInt(_0x1dbbf2(0x165))/0x4*(-parseInt(_0x1dbbf2(0x160))/0x5)+parseInt(_0x1dbbf2(0x162))/0x6*(parseInt(_0x1dbbf2(0x163))/0x7)+parseInt(_0x1dbbf2(0x15c))/0x8+-parseInt(_0x1dbbf2(0x15e))/0x9*(parseInt(_0x1dbbf2(0x166))/0xa)+-parseInt(_0x1dbbf2(0x164))/0xb;if(_0x55cdc1===_0x2ab16c)break;else _0x128883['push'](_0x128883['shift']());}catch(_0x100dba){_0x128883['push'](_0x128883['shift']());}}}(_0x3bb8,0x3fffd));function _0x3bb8(){const _0x1fd74a=['954rDKKqc','744411OTQtUQ','790kLaNmb','5903lEAdzl','4422SwQLbh','1561KJZAFu','5424452MwzNKf','7416mHUIcP','12030URDZrO','4073560wFwSgR','4bLkeFo'];_0x3bb8=function(){return _0x1fd74a;};return _0x3bb8();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Hook']=void 0x0;const errors_1=require('../../modules/errors'),collator_1=require('../collator'),pipe_1=require('../pipe'),task_1=require('../task'),telemetry_1=require('../telemetry'),stream_1=require('../../types/stream'),enums_1=require('../../modules/enums'),activity_1=require('./activity');class Hook extends activity_1['Activity']{constructor(_0x3dd56d,_0x149c5c,_0x18992f,_0x5cdb28,_0x14c6ca,_0x42d42a){super(_0x3dd56d,_0x149c5c,_0x18992f,_0x5cdb28,_0x14c6ca,_0x42d42a);}async['process'](){this['logger']['debug']('hook-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x1755b8;try{return await this['verifyEntry'](),_0x1755b8=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x1755b8['startActivitySpan'](this['leg']),this['doesHook']()?await this['doHook'](_0x1755b8):await this['doPassThrough'](_0x1755b8),this['context']['metadata']['aid'];}catch(_0x4a94b7){if(_0x4a94b7 instanceof errors_1['InactiveJobError']){this['logger']['error']('hook-inactive-job-error',{..._0x4a94b7});return;}else{if(_0x4a94b7 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x4a94b7});return;}else{if(_0x4a94b7 instanceof errors_1['GetStateError']){this['logger']['error']('hook-get-state-error',{..._0x4a94b7});return;}else{if(_0x4a94b7 instanceof errors_1['CollationError']){if(_0x4a94b7['fault']==='duplicate'){this['logger']['info']('hook-collation-overage',{'job_id':this['context']['metadata']['jid'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('hook-collation-error',{..._0x4a94b7});}else this['logger']['error']('hook-process-error',{..._0x4a94b7});}}}_0x1755b8?.['setActivityError'](_0x4a94b7['message']);throw _0x4a94b7;}finally{_0x1755b8?.['endActivitySpan'](),this['logger']['debug']('hook-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}['doesHook'](){if(this['config']['sleep']){const _0x17af66=pipe_1['Pipe']['resolve'](this['config']['sleep'],this['context']);return!isNaN(_0x17af66)&&Number(_0x17af66)>0x0;}return!!this['config']['hook']?.['topic'];}async['doHook'](_0x3e9390){const _0x1c8ba2=this['store']['getMulti']();await this['registerHook'](enums_1['HMSH_IS_CLUSTER']?undefined:_0x1c8ba2),this['mapOutputData'](),this['mapJobData'](),await this['setState'](_0x1c8ba2),await collator_1['CollatorService']['authorizeReentry'](this,_0x1c8ba2),await this['setStatus'](0x0,_0x1c8ba2),await _0x1c8ba2['exec'](),_0x3e9390['mapActivityAttributes']();}async['doPassThrough'](_0x2c8c45){const _0x43ebff=this['store']['getMulti']();let _0x3c1d27;this['adjacencyList']=await this['filterAdjacent'](),this['mapOutputData'](),this['mapJobData'](),await this['setState'](_0x43ebff),await collator_1['CollatorService']['notarizeEarlyCompletion'](this,_0x43ebff),await this['setStatus'](this['adjacencyList']['length']-0x1,_0x43ebff),_0x3c1d27=await _0x43ebff['exec'](),_0x2c8c45['mapActivityAttributes']();const _0x165282=this['resolveStatus'](_0x3c1d27),_0x491e1f={'app.job.jss':_0x165282},_0x1f1ec7=await this['transition'](this['adjacencyList'],_0x165282);_0x1f1ec7['length']&&(_0x491e1f['app.activity.mids']=_0x1f1ec7['join'](',')),_0x2c8c45['setActivityAttributes'](_0x491e1f);}async['getHookRule'](_0x3d66ad){const _0x336b60=await this['store']['getHookRules']();return _0x336b60?.[_0x3d66ad]?.[0x0];}async['registerHook'](_0x1ab072){if(this['config']['hook']?.['topic'])return await this['engine']['taskService']['registerWebHook'](this['config']['hook']['topic'],this['context'],this['resolveDad'](),this['context']['metadata']['expire'],_0x1ab072);else{if(this['config']['sleep']){const _0x490302=pipe_1['Pipe']['resolve'](this['config']['sleep'],this['context']);return await this['engine']['taskService']['registerTimeHook'](this['context']['metadata']['jid'],this['context']['metadata']['gid'],''+this['metadata']['aid']+(this['metadata']['dad']||''),'sleep',_0x490302,this['metadata']['dad']||''),this['context']['metadata']['jid'];}}}async['processWebHookEvent'](_0x552b70=stream_1['StreamStatus']['SUCCESS'],_0x2fe7a1=0xc8){this['logger']['debug']('hook-process-web-hook-event',{'topic':this['config']['hook']['topic'],'aid':this['metadata']['aid'],'status':_0x552b70,'code':_0x2fe7a1});const _0x2426bb=new task_1['TaskService'](this['store'],this['logger']),_0x55dc82={...this['data']},_0x5da35f=await _0x2426bb['processWebHookSignal'](this['config']['hook']['topic'],_0x55dc82);if(_0x5da35f){const [_0x543a68,_0x550119,_0x58b8f2,_0x23b805]=_0x5da35f;this['context']['metadata']['jid']=_0x543a68,this['context']['metadata']['gid']=_0x23b805,this['context']['metadata']['dad']=_0x58b8f2,await this['processEvent'](_0x552b70,_0x2fe7a1,'hook'),_0x2fe7a1===0xc8&&await _0x2426bb['deleteWebHookSignal'](this['config']['hook']['topic'],_0x55dc82);}}async['processTimeHookEvent'](_0x58002f){this['logger']['debug']('hook-process-time-hook-event',{'jid':_0x58002f,'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']}),await this['processEvent'](stream_1['StreamStatus']['SUCCESS'],0xc8,'hook');}}exports['Hook']=Hook;
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const activity_1 = require("./activity");
|
|
4
|
-
const await_1 = require("./await");
|
|
5
|
-
const cycle_1 = require("./cycle");
|
|
6
|
-
const hook_1 = require("./hook");
|
|
7
|
-
const interrupt_1 = require("./interrupt");
|
|
8
|
-
const signal_1 = require("./signal");
|
|
9
|
-
const trigger_1 = require("./trigger");
|
|
10
|
-
const worker_1 = require("./worker");
|
|
11
|
-
exports.default = {
|
|
12
|
-
activity: activity_1.Activity,
|
|
13
|
-
await: await_1.Await,
|
|
14
|
-
cycle: cycle_1.Cycle,
|
|
15
|
-
hook: hook_1.Hook,
|
|
16
|
-
interrupt: interrupt_1.Interrupt,
|
|
17
|
-
signal: signal_1.Signal,
|
|
18
|
-
trigger: trigger_1.Trigger,
|
|
19
|
-
worker: worker_1.Worker,
|
|
20
|
-
};
|
|
1
|
+
'use strict';(function(_0x447765,_0x47861b){const _0x272d75=_0x1079,_0x4db7b8=_0x447765();while(!![]){try{const _0x4be681=parseInt(_0x272d75(0x87))/0x1*(parseInt(_0x272d75(0x8a))/0x2)+-parseInt(_0x272d75(0x82))/0x3+parseInt(_0x272d75(0x81))/0x4*(-parseInt(_0x272d75(0x83))/0x5)+-parseInt(_0x272d75(0x8b))/0x6*(parseInt(_0x272d75(0x80))/0x7)+parseInt(_0x272d75(0x89))/0x8+parseInt(_0x272d75(0x84))/0x9*(-parseInt(_0x272d75(0x85))/0xa)+-parseInt(_0x272d75(0x86))/0xb*(-parseInt(_0x272d75(0x88))/0xc);if(_0x4be681===_0x47861b)break;else _0x4db7b8['push'](_0x4db7b8['shift']());}catch(_0x5a0aed){_0x4db7b8['push'](_0x4db7b8['shift']());}}}(_0x27e1,0x9476c));Object['defineProperty'](exports,'__esModule',{'value':!![]});function _0x1079(_0x51719f,_0x1826e4){const _0x27e1ed=_0x27e1();return _0x1079=function(_0x1079fa,_0x466e53){_0x1079fa=_0x1079fa-0x80;let _0x461784=_0x27e1ed[_0x1079fa];return _0x461784;},_0x1079(_0x51719f,_0x1826e4);}const activity_1=require('./activity'),await_1=require('./await'),cycle_1=require('./cycle'),hook_1=require('./hook'),interrupt_1=require('./interrupt'),signal_1=require('./signal'),trigger_1=require('./trigger'),worker_1=require('./worker');exports['default']={'activity':activity_1['Activity'],'await':await_1['Await'],'cycle':cycle_1['Cycle'],'hook':hook_1['Hook'],'interrupt':interrupt_1['Interrupt'],'signal':signal_1['Signal'],'trigger':trigger_1['Trigger'],'worker':worker_1['Worker']};function _0x27e1(){const _0x5da83c=['2367HLMMdN','6920zIzDWF','11627UQviGw','1VtFrBi','19020tuPwTh','4811728tpBVvU','2271920fCHTVb','1542pBlzqV','28399acxhdV','9852TgbyIP','2405130ZPdrTd','1580YwsvJw'];_0x27e1=function(){return _0x5da83c;};return _0x27e1();}
|
|
@@ -1,149 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Interrupt = void 0;
|
|
4
|
-
const errors_1 = require("../../modules/errors");
|
|
5
|
-
const collator_1 = require("../collator");
|
|
6
|
-
const pipe_1 = require("../pipe");
|
|
7
|
-
const telemetry_1 = require("../telemetry");
|
|
8
|
-
const activity_1 = require("./activity");
|
|
9
|
-
class Interrupt extends activity_1.Activity {
|
|
10
|
-
constructor(config, data, metadata, hook, engine, context) {
|
|
11
|
-
super(config, data, metadata, hook, engine, context);
|
|
12
|
-
}
|
|
13
|
-
async process() {
|
|
14
|
-
this.logger.debug('interrupt-process', {
|
|
15
|
-
jid: this.context.metadata.jid,
|
|
16
|
-
gid: this.context.metadata.gid,
|
|
17
|
-
aid: this.metadata.aid,
|
|
18
|
-
});
|
|
19
|
-
let telemetry;
|
|
20
|
-
try {
|
|
21
|
-
await this.verifyEntry();
|
|
22
|
-
telemetry = new telemetry_1.TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
|
|
23
|
-
telemetry.startActivitySpan(this.leg);
|
|
24
|
-
if (this.isInterruptingSelf()) {
|
|
25
|
-
await this.interruptSelf(telemetry);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
await this.interruptAnother(telemetry);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
if (error instanceof errors_1.InactiveJobError) {
|
|
33
|
-
this.logger.error('interrupt-inactive-job-error', { ...error });
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
else if (error instanceof errors_1.GenerationalError) {
|
|
37
|
-
this.logger.info('process-event-generational-job-error', { ...error });
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
else if (error instanceof errors_1.GetStateError) {
|
|
41
|
-
this.logger.error('interrupt-get-state-error', { ...error });
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
else if (error instanceof errors_1.CollationError) {
|
|
45
|
-
if (error.fault === 'duplicate') {
|
|
46
|
-
this.logger.info('interrupt-collation-overage', {
|
|
47
|
-
job_id: this.context.metadata.jid,
|
|
48
|
-
guid: this.context.metadata.guid,
|
|
49
|
-
});
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
this.logger.error('interrupt-collation-error', { ...error });
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
this.logger.error('interrupt-process-error', { ...error });
|
|
56
|
-
}
|
|
57
|
-
telemetry?.setActivityError(error.message);
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
finally {
|
|
61
|
-
telemetry?.endActivitySpan();
|
|
62
|
-
this.logger.debug('interrupt-process-end', {
|
|
63
|
-
jid: this.context.metadata.jid,
|
|
64
|
-
gid: this.context.metadata.gid,
|
|
65
|
-
aid: this.metadata.aid,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async interruptSelf(telemetry) {
|
|
70
|
-
if (this.config.job?.maps) {
|
|
71
|
-
this.mapJobData();
|
|
72
|
-
await this.setState();
|
|
73
|
-
}
|
|
74
|
-
const messageId = await this.interrupt();
|
|
75
|
-
telemetry.mapActivityAttributes();
|
|
76
|
-
const multi = this.store.getMulti();
|
|
77
|
-
await collator_1.CollatorService.notarizeEarlyCompletion(this, multi);
|
|
78
|
-
await this.setStatus(-1, multi);
|
|
79
|
-
const multiResponse = (await multi.exec());
|
|
80
|
-
const jobStatus = this.resolveStatus(multiResponse);
|
|
81
|
-
telemetry.setActivityAttributes({
|
|
82
|
-
'app.activity.mid': messageId,
|
|
83
|
-
'app.job.jss': jobStatus,
|
|
84
|
-
});
|
|
85
|
-
return this.context.metadata.aid;
|
|
86
|
-
}
|
|
87
|
-
async interruptAnother(telemetry) {
|
|
88
|
-
const messageId = await this.interrupt();
|
|
89
|
-
const attrs = { 'app.activity.mid': messageId };
|
|
90
|
-
telemetry.mapActivityAttributes();
|
|
91
|
-
this.adjacencyList = await this.filterAdjacent();
|
|
92
|
-
if (this.config.job?.maps || this.config.output?.maps) {
|
|
93
|
-
this.mapOutputData();
|
|
94
|
-
this.mapJobData();
|
|
95
|
-
const multi = this.store.getMulti();
|
|
96
|
-
await this.setState(multi);
|
|
97
|
-
}
|
|
98
|
-
const multi = this.store.getMulti();
|
|
99
|
-
await collator_1.CollatorService.notarizeEarlyCompletion(this, multi);
|
|
100
|
-
await this.setStatus(this.adjacencyList.length - 1, multi);
|
|
101
|
-
const multiResponse = (await multi.exec());
|
|
102
|
-
const jobStatus = this.resolveStatus(multiResponse);
|
|
103
|
-
attrs['app.job.jss'] = jobStatus;
|
|
104
|
-
const messageIds = await this.transition(this.adjacencyList, jobStatus);
|
|
105
|
-
if (messageIds.length) {
|
|
106
|
-
attrs['app.activity.mids'] = messageIds.join(',');
|
|
107
|
-
}
|
|
108
|
-
telemetry.setActivityAttributes(attrs);
|
|
109
|
-
return this.context.metadata.aid;
|
|
110
|
-
}
|
|
111
|
-
isInterruptingSelf() {
|
|
112
|
-
if (!this.config.target) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
const resolvedJob = pipe_1.Pipe.resolve(this.config.target, this.context);
|
|
116
|
-
return resolvedJob == this.context.metadata.jid;
|
|
117
|
-
}
|
|
118
|
-
resolveInterruptOptions() {
|
|
119
|
-
return {
|
|
120
|
-
reason: this.config.reason !== undefined
|
|
121
|
-
? pipe_1.Pipe.resolve(this.config.reason, this.context)
|
|
122
|
-
: undefined,
|
|
123
|
-
throw: this.config.throw !== undefined
|
|
124
|
-
? pipe_1.Pipe.resolve(this.config.throw, this.context)
|
|
125
|
-
: undefined,
|
|
126
|
-
descend: this.config.descend !== undefined
|
|
127
|
-
? pipe_1.Pipe.resolve(this.config.descend, this.context)
|
|
128
|
-
: undefined,
|
|
129
|
-
code: this.config.code !== undefined
|
|
130
|
-
? pipe_1.Pipe.resolve(this.config.code, this.context)
|
|
131
|
-
: undefined,
|
|
132
|
-
expire: this.config.expire !== undefined
|
|
133
|
-
? pipe_1.Pipe.resolve(this.config.expire, this.context)
|
|
134
|
-
: undefined,
|
|
135
|
-
stack: this.config.stack !== undefined
|
|
136
|
-
? pipe_1.Pipe.resolve(this.config.stack, this.context)
|
|
137
|
-
: undefined,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
async interrupt() {
|
|
141
|
-
const options = this.resolveInterruptOptions();
|
|
142
|
-
return await this.engine.interrupt(this.config.topic !== undefined
|
|
143
|
-
? pipe_1.Pipe.resolve(this.config.topic, this.context)
|
|
144
|
-
: this.context.metadata.tpc, this.config.target !== undefined
|
|
145
|
-
? pipe_1.Pipe.resolve(this.config.target, this.context)
|
|
146
|
-
: this.context.metadata.jid, options);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
exports.Interrupt = Interrupt;
|
|
1
|
+
'use strict';(function(_0xb9856f,_0x5dcb43){const _0xf753ac=_0x15bd,_0x3f8e0a=_0xb9856f();while(!![]){try{const _0x3a6585=parseInt(_0xf753ac(0x72))/0x1+parseInt(_0xf753ac(0x6f))/0x2*(-parseInt(_0xf753ac(0x79))/0x3)+parseInt(_0xf753ac(0x73))/0x4*(-parseInt(_0xf753ac(0x77))/0x5)+parseInt(_0xf753ac(0x75))/0x6*(-parseInt(_0xf753ac(0x76))/0x7)+parseInt(_0xf753ac(0x74))/0x8*(parseInt(_0xf753ac(0x6e))/0x9)+parseInt(_0xf753ac(0x78))/0xa*(-parseInt(_0xf753ac(0x70))/0xb)+parseInt(_0xf753ac(0x6d))/0xc*(parseInt(_0xf753ac(0x71))/0xd);if(_0x3a6585===_0x5dcb43)break;else _0x3f8e0a['push'](_0x3f8e0a['shift']());}catch(_0x5a67a4){_0x3f8e0a['push'](_0x3f8e0a['shift']());}}}(_0xdd16,0x86ac7));function _0x15bd(_0x3480fe,_0x5e984e){const _0xdd1655=_0xdd16();return _0x15bd=function(_0x15bd60,_0x595b6e){_0x15bd60=_0x15bd60-0x6d;let _0x16e394=_0xdd1655[_0x15bd60];return _0x16e394;},_0x15bd(_0x3480fe,_0x5e984e);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Interrupt']=void 0x0;const errors_1=require('../../modules/errors'),collator_1=require('../collator'),pipe_1=require('../pipe'),telemetry_1=require('../telemetry'),activity_1=require('./activity');function _0xdd16(){const _0x5206f9=['7010gWPwxh','3183FiBZCm','12cVEAtK','19638Qlcfxq','1302qGBHhR','253sUuzHG','21229WEUtPv','714214xtNdao','112BwrehH','2312nFSdRC','121656ghbPvu','21WAMlNg','4850XoosOs'];_0xdd16=function(){return _0x5206f9;};return _0xdd16();}class Interrupt extends activity_1['Activity']{constructor(_0x2e72ea,_0x4fcfba,_0x5262d0,_0x946437,_0x363e6a,_0x1b575a){super(_0x2e72ea,_0x4fcfba,_0x5262d0,_0x946437,_0x363e6a,_0x1b575a);}async['process'](){this['logger']['debug']('interrupt-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x3e0667;try{await this['verifyEntry'](),_0x3e0667=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x3e0667['startActivitySpan'](this['leg']),this['isInterruptingSelf']()?await this['interruptSelf'](_0x3e0667):await this['interruptAnother'](_0x3e0667);}catch(_0x46b7e9){if(_0x46b7e9 instanceof errors_1['InactiveJobError']){this['logger']['error']('interrupt-inactive-job-error',{..._0x46b7e9});return;}else{if(_0x46b7e9 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x46b7e9});return;}else{if(_0x46b7e9 instanceof errors_1['GetStateError']){this['logger']['error']('interrupt-get-state-error',{..._0x46b7e9});return;}else{if(_0x46b7e9 instanceof errors_1['CollationError']){if(_0x46b7e9['fault']==='duplicate'){this['logger']['info']('interrupt-collation-overage',{'job_id':this['context']['metadata']['jid'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('interrupt-collation-error',{..._0x46b7e9});}else this['logger']['error']('interrupt-process-error',{..._0x46b7e9});}}}_0x3e0667?.['setActivityError'](_0x46b7e9['message']);throw _0x46b7e9;}finally{_0x3e0667?.['endActivitySpan'](),this['logger']['debug']('interrupt-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}async['interruptSelf'](_0x50bf35){this['config']['job']?.['maps']&&(this['mapJobData'](),await this['setState']());const _0x1fa45c=await this['interrupt']();_0x50bf35['mapActivityAttributes']();const _0x47d240=this['store']['getMulti']();await collator_1['CollatorService']['notarizeEarlyCompletion'](this,_0x47d240),await this['setStatus'](-0x1,_0x47d240);const _0x2d9bcc=await _0x47d240['exec'](),_0x53f2fb=this['resolveStatus'](_0x2d9bcc);return _0x50bf35['setActivityAttributes']({'app.activity.mid':_0x1fa45c,'app.job.jss':_0x53f2fb}),this['context']['metadata']['aid'];}async['interruptAnother'](_0x339d48){const _0x4ef9cd=await this['interrupt'](),_0x562fa9={'app.activity.mid':_0x4ef9cd};_0x339d48['mapActivityAttributes'](),this['adjacencyList']=await this['filterAdjacent']();if(this['config']['job']?.['maps']||this['config']['output']?.['maps']){this['mapOutputData'](),this['mapJobData']();const _0x3051b8=this['store']['getMulti']();await this['setState'](_0x3051b8);}const _0x14c23d=this['store']['getMulti']();await collator_1['CollatorService']['notarizeEarlyCompletion'](this,_0x14c23d),await this['setStatus'](this['adjacencyList']['length']-0x1,_0x14c23d);const _0x4b9e6f=await _0x14c23d['exec'](),_0x17c8bc=this['resolveStatus'](_0x4b9e6f);_0x562fa9['app.job.jss']=_0x17c8bc;const _0x2226ae=await this['transition'](this['adjacencyList'],_0x17c8bc);return _0x2226ae['length']&&(_0x562fa9['app.activity.mids']=_0x2226ae['join'](',')),_0x339d48['setActivityAttributes'](_0x562fa9),this['context']['metadata']['aid'];}['isInterruptingSelf'](){if(!this['config']['target'])return!![];const _0x2e1971=pipe_1['Pipe']['resolve'](this['config']['target'],this['context']);return _0x2e1971==this['context']['metadata']['jid'];}['resolveInterruptOptions'](){return{'reason':this['config']['reason']!==undefined?pipe_1['Pipe']['resolve'](this['config']['reason'],this['context']):undefined,'throw':this['config']['throw']!==undefined?pipe_1['Pipe']['resolve'](this['config']['throw'],this['context']):undefined,'descend':this['config']['descend']!==undefined?pipe_1['Pipe']['resolve'](this['config']['descend'],this['context']):undefined,'code':this['config']['code']!==undefined?pipe_1['Pipe']['resolve'](this['config']['code'],this['context']):undefined,'expire':this['config']['expire']!==undefined?pipe_1['Pipe']['resolve'](this['config']['expire'],this['context']):undefined,'stack':this['config']['stack']!==undefined?pipe_1['Pipe']['resolve'](this['config']['stack'],this['context']):undefined};}async['interrupt'](){const _0x189a53=this['resolveInterruptOptions']();return await this['engine']['interrupt'](this['config']['topic']!==undefined?pipe_1['Pipe']['resolve'](this['config']['topic'],this['context']):this['context']['metadata']['tpc'],this['config']['target']!==undefined?pipe_1['Pipe']['resolve'](this['config']['target'],this['context']):this['context']['metadata']['jid'],_0x189a53);}}exports['Interrupt']=Interrupt;
|
|
@@ -1,118 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Signal = void 0;
|
|
4
|
-
const errors_1 = require("../../modules/errors");
|
|
5
|
-
const collator_1 = require("../collator");
|
|
6
|
-
const mapper_1 = require("../mapper");
|
|
7
|
-
const pipe_1 = require("../pipe");
|
|
8
|
-
const telemetry_1 = require("../telemetry");
|
|
9
|
-
const activity_1 = require("./activity");
|
|
10
|
-
class Signal extends activity_1.Activity {
|
|
11
|
-
constructor(config, data, metadata, hook, engine, context) {
|
|
12
|
-
super(config, data, metadata, hook, engine, context);
|
|
13
|
-
}
|
|
14
|
-
async process() {
|
|
15
|
-
this.logger.debug('signal-process', {
|
|
16
|
-
jid: this.context.metadata.jid,
|
|
17
|
-
gid: this.context.metadata.gid,
|
|
18
|
-
aid: this.metadata.aid,
|
|
19
|
-
});
|
|
20
|
-
let telemetry;
|
|
21
|
-
try {
|
|
22
|
-
await this.verifyEntry();
|
|
23
|
-
telemetry = new telemetry_1.TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
|
|
24
|
-
telemetry.startActivitySpan(this.leg);
|
|
25
|
-
const multi = this.store.getMulti();
|
|
26
|
-
this.adjacencyList = await this.filterAdjacent();
|
|
27
|
-
this.mapOutputData();
|
|
28
|
-
this.mapJobData();
|
|
29
|
-
await this.setState(multi);
|
|
30
|
-
await collator_1.CollatorService.notarizeEarlyCompletion(this, multi);
|
|
31
|
-
await this.setStatus(this.adjacencyList.length - 1, multi);
|
|
32
|
-
const multiResponse = (await multi.exec());
|
|
33
|
-
if (this.config.subtype === 'all') {
|
|
34
|
-
await this.hookAll();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
await this.hookOne();
|
|
38
|
-
}
|
|
39
|
-
const jobStatus = this.resolveStatus(multiResponse);
|
|
40
|
-
const attrs = { 'app.job.jss': jobStatus };
|
|
41
|
-
const messageIds = await this.transition(this.adjacencyList, jobStatus);
|
|
42
|
-
if (messageIds.length) {
|
|
43
|
-
attrs['app.activity.mids'] = messageIds.join(',');
|
|
44
|
-
}
|
|
45
|
-
telemetry.mapActivityAttributes();
|
|
46
|
-
telemetry.setActivityAttributes(attrs);
|
|
47
|
-
return this.context.metadata.aid;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
if (error instanceof errors_1.InactiveJobError) {
|
|
51
|
-
this.logger.error('signal-inactive-job-error', { ...error });
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
else if (error instanceof errors_1.GenerationalError) {
|
|
55
|
-
this.logger.info('process-event-generational-job-error', { ...error });
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
else if (error instanceof errors_1.GetStateError) {
|
|
59
|
-
this.logger.error('signal-get-state-error', { ...error });
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
else if (error instanceof errors_1.CollationError) {
|
|
63
|
-
if (error.fault === 'duplicate') {
|
|
64
|
-
this.logger.info('signal-collation-overage', {
|
|
65
|
-
job_id: this.context.metadata.jid,
|
|
66
|
-
guid: this.context.metadata.guid,
|
|
67
|
-
});
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
this.logger.error('signal-collation-error', { ...error });
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.logger.error('signal-process-error', { ...error });
|
|
74
|
-
}
|
|
75
|
-
telemetry?.setActivityError(error.message);
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
finally {
|
|
79
|
-
telemetry?.endActivitySpan();
|
|
80
|
-
this.logger.debug('signal-process-end', {
|
|
81
|
-
jid: this.context.metadata.jid,
|
|
82
|
-
gid: this.context.metadata.gid,
|
|
83
|
-
aid: this.metadata.aid,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
mapSignalData() {
|
|
88
|
-
if (this.config.signal?.maps) {
|
|
89
|
-
const mapper = new mapper_1.MapperService(this.config.signal.maps, this.context);
|
|
90
|
-
return mapper.mapRules();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
mapResolverData() {
|
|
94
|
-
if (this.config.resolver?.maps) {
|
|
95
|
-
const mapper = new mapper_1.MapperService(this.config.resolver.maps, this.context);
|
|
96
|
-
return mapper.mapRules();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
async hookOne() {
|
|
100
|
-
const topic = pipe_1.Pipe.resolve(this.config.topic, this.context);
|
|
101
|
-
const signalInputData = this.mapSignalData();
|
|
102
|
-
const status = pipe_1.Pipe.resolve(this.config.status, this.context);
|
|
103
|
-
const code = pipe_1.Pipe.resolve(this.config.code, this.context);
|
|
104
|
-
return await this.engine.hook(topic, signalInputData, status, code);
|
|
105
|
-
}
|
|
106
|
-
async hookAll() {
|
|
107
|
-
const signalInputData = this.mapSignalData();
|
|
108
|
-
const keyResolverData = this.mapResolverData();
|
|
109
|
-
if (this.config.scrub) {
|
|
110
|
-
keyResolverData.scrub = true;
|
|
111
|
-
}
|
|
112
|
-
const key_name = pipe_1.Pipe.resolve(this.config.key_name, this.context);
|
|
113
|
-
const key_value = pipe_1.Pipe.resolve(this.config.key_value, this.context);
|
|
114
|
-
const indexQueryFacets = [`${key_name}:${key_value}`];
|
|
115
|
-
return await this.engine.hookAll(this.config.topic, signalInputData, keyResolverData, indexQueryFacets);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.Signal = Signal;
|
|
1
|
+
'use strict';(function(_0x4a07e2,_0x1a68d0){const _0x3f9e5e=_0x2338,_0x2f2a2d=_0x4a07e2();while(!![]){try{const _0x2f845c=parseInt(_0x3f9e5e(0xe3))/0x1*(parseInt(_0x3f9e5e(0xe9))/0x2)+-parseInt(_0x3f9e5e(0xe5))/0x3*(parseInt(_0x3f9e5e(0xe6))/0x4)+-parseInt(_0x3f9e5e(0xed))/0x5+-parseInt(_0x3f9e5e(0xec))/0x6*(-parseInt(_0x3f9e5e(0xeb))/0x7)+-parseInt(_0x3f9e5e(0xe7))/0x8+parseInt(_0x3f9e5e(0xe4))/0x9+-parseInt(_0x3f9e5e(0xea))/0xa*(-parseInt(_0x3f9e5e(0xe8))/0xb);if(_0x2f845c===_0x1a68d0)break;else _0x2f2a2d['push'](_0x2f2a2d['shift']());}catch(_0x306528){_0x2f2a2d['push'](_0x2f2a2d['shift']());}}}(_0x4c52,0xc3be2));function _0x4c52(){const _0x1110f2=['560514aQJKoi','5849930QPzNOF','9pfZDhu','7162956okPfJK','1544847ApukzD','8sjgAsj','365192MDzZVt','17692917FTyuRE','39082KqJQiK','10XyJmRz','35yuSJnm'];_0x4c52=function(){return _0x1110f2;};return _0x4c52();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Signal']=void 0x0;function _0x2338(_0x154925,_0x769286){const _0x4c52fc=_0x4c52();return _0x2338=function(_0x2338b9,_0x1551db){_0x2338b9=_0x2338b9-0xe3;let _0x433b5d=_0x4c52fc[_0x2338b9];return _0x433b5d;},_0x2338(_0x154925,_0x769286);}const errors_1=require('../../modules/errors'),collator_1=require('../collator'),mapper_1=require('../mapper'),pipe_1=require('../pipe'),telemetry_1=require('../telemetry'),activity_1=require('./activity');class Signal extends activity_1['Activity']{constructor(_0x3850e9,_0x476ec8,_0x5739b4,_0x2d7791,_0x4bb375,_0x486a6f){super(_0x3850e9,_0x476ec8,_0x5739b4,_0x2d7791,_0x4bb375,_0x486a6f);}async['process'](){this['logger']['debug']('signal-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x18b012;try{await this['verifyEntry'](),_0x18b012=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x18b012['startActivitySpan'](this['leg']);const _0x37c7fe=this['store']['getMulti']();this['adjacencyList']=await this['filterAdjacent'](),this['mapOutputData'](),this['mapJobData'](),await this['setState'](_0x37c7fe),await collator_1['CollatorService']['notarizeEarlyCompletion'](this,_0x37c7fe),await this['setStatus'](this['adjacencyList']['length']-0x1,_0x37c7fe);const _0x165dab=await _0x37c7fe['exec']();this['config']['subtype']==='all'?await this['hookAll']():await this['hookOne']();const _0x143a64=this['resolveStatus'](_0x165dab),_0x48aea9={'app.job.jss':_0x143a64},_0x5a863a=await this['transition'](this['adjacencyList'],_0x143a64);return _0x5a863a['length']&&(_0x48aea9['app.activity.mids']=_0x5a863a['join'](',')),_0x18b012['mapActivityAttributes'](),_0x18b012['setActivityAttributes'](_0x48aea9),this['context']['metadata']['aid'];}catch(_0xef2dc8){if(_0xef2dc8 instanceof errors_1['InactiveJobError']){this['logger']['error']('signal-inactive-job-error',{..._0xef2dc8});return;}else{if(_0xef2dc8 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0xef2dc8});return;}else{if(_0xef2dc8 instanceof errors_1['GetStateError']){this['logger']['error']('signal-get-state-error',{..._0xef2dc8});return;}else{if(_0xef2dc8 instanceof errors_1['CollationError']){if(_0xef2dc8['fault']==='duplicate'){this['logger']['info']('signal-collation-overage',{'job_id':this['context']['metadata']['jid'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('signal-collation-error',{..._0xef2dc8});}else this['logger']['error']('signal-process-error',{..._0xef2dc8});}}}_0x18b012?.['setActivityError'](_0xef2dc8['message']);throw _0xef2dc8;}finally{_0x18b012?.['endActivitySpan'](),this['logger']['debug']('signal-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}['mapSignalData'](){if(this['config']['signal']?.['maps']){const _0x32bdc5=new mapper_1['MapperService'](this['config']['signal']['maps'],this['context']);return _0x32bdc5['mapRules']();}}['mapResolverData'](){if(this['config']['resolver']?.['maps']){const _0xd64a3d=new mapper_1['MapperService'](this['config']['resolver']['maps'],this['context']);return _0xd64a3d['mapRules']();}}async['hookOne'](){const _0x5508e0=pipe_1['Pipe']['resolve'](this['config']['topic'],this['context']),_0x289522=this['mapSignalData'](),_0x2335f1=pipe_1['Pipe']['resolve'](this['config']['status'],this['context']),_0x2a745b=pipe_1['Pipe']['resolve'](this['config']['code'],this['context']);return await this['engine']['hook'](_0x5508e0,_0x289522,_0x2335f1,_0x2a745b);}async['hookAll'](){const _0x508c94=this['mapSignalData'](),_0x536d54=this['mapResolverData']();this['config']['scrub']&&(_0x536d54['scrub']=!![]);const _0x3dd879=pipe_1['Pipe']['resolve'](this['config']['key_name'],this['context']),_0xf7707d=pipe_1['Pipe']['resolve'](this['config']['key_value'],this['context']),_0x4886d1=[_0x3dd879+':'+_0xf7707d];return await this['engine']['hookAll'](this['config']['topic'],_0x508c94,_0x536d54,_0x4886d1);}}exports['Signal']=Signal;
|