@hotmeshio/hotmesh 0.3.19 → 0.3.21
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/README.md +72 -36
- package/build/index.d.ts +7 -1
- package/build/index.js +13 -1
- package/build/modules/key.js +1 -1
- package/build/modules/utils.d.ts +1 -3
- package/build/modules/utils.js +1 -1
- package/build/package.json +5 -4
- package/build/services/activities/activity.js +1 -1
- package/build/services/activities/await.js +1 -1
- package/build/services/activities/cycle.js +1 -1
- package/build/services/activities/hook.js +1 -1
- package/build/services/activities/index.js +1 -1
- package/build/services/activities/interrupt.js +1 -1
- package/build/services/activities/signal.js +1 -1
- package/build/services/activities/trigger.js +1 -1
- package/build/services/activities/worker.js +1 -1
- package/build/services/collator/index.js +1 -1
- package/build/services/compiler/deployer.js +1 -1
- package/build/services/compiler/index.js +1 -1
- package/build/services/compiler/validator.js +1 -1
- package/build/services/connector/factory.d.ts +1 -0
- package/build/services/connector/factory.js +35 -32
- package/build/services/connector/index.d.ts +4 -2
- package/build/services/connector/index.js +10 -5
- package/build/services/connector/providers/postgres.d.ts +13 -2
- package/build/services/connector/providers/postgres.js +54 -9
- package/build/services/engine/index.js +1 -1
- package/build/services/exporter/index.js +1 -1
- package/build/services/hotmesh/index.js +1 -6
- package/build/services/mapper/index.js +1 -1
- package/build/services/meshcall/index.js +3 -5
- package/build/services/meshdata/index.d.ts +3 -4
- package/build/services/meshdata/index.js +4 -9
- package/build/services/meshflow/client.js +1 -2
- package/build/services/meshflow/connection.js +1 -0
- package/build/services/meshflow/exporter.js +1 -1
- package/build/services/meshflow/worker.js +5 -8
- package/build/services/meshos/index.d.ts +2 -2
- package/build/services/meshos/index.js +6 -9
- package/build/services/pipe/functions/array.js +1 -1
- package/build/services/pipe/functions/bitwise.js +1 -1
- package/build/services/pipe/functions/conditional.js +1 -1
- package/build/services/pipe/functions/cron.js +1 -1
- package/build/services/pipe/functions/date.js +1 -1
- package/build/services/pipe/functions/index.js +1 -1
- package/build/services/pipe/functions/json.js +1 -1
- package/build/services/pipe/functions/logical.js +1 -1
- package/build/services/pipe/functions/math.js +1 -1
- package/build/services/pipe/functions/number.js +1 -1
- package/build/services/pipe/functions/object.js +1 -1
- package/build/services/pipe/functions/string.js +1 -1
- package/build/services/pipe/functions/symbol.js +1 -1
- package/build/services/pipe/functions/unary.js +1 -1
- package/build/services/pipe/index.js +1 -1
- package/build/services/quorum/index.js +1 -1
- package/build/services/reporter/index.js +1 -1
- package/build/services/router/index.js +1 -1
- package/build/services/search/providers/postgres/postgres.js +1 -1
- package/build/services/search/providers/redis/ioredis.js +1 -1
- package/build/services/search/providers/redis/redis.js +1 -1
- package/build/services/serializer/index.js +1 -1
- package/build/services/store/providers/postgres/kvsql.js +1 -1
- package/build/services/store/providers/postgres/kvtables.d.ts +2 -2
- package/build/services/store/providers/postgres/kvtables.js +1 -1
- package/build/services/store/providers/postgres/kvtransaction.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/hash.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/list.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/string.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/zset.js +1 -1
- package/build/services/store/providers/postgres/postgres.js +1 -1
- package/build/services/store/providers/redis/_base.js +1 -1
- package/build/services/store/providers/redis/ioredis.js +1 -1
- package/build/services/store/providers/redis/redis.js +1 -1
- package/build/services/store/providers/store-initializable.js +1 -1
- package/build/services/stream/providers/nats/nats.js +1 -1
- package/build/services/stream/providers/postgres/postgres.js +1 -1
- package/build/services/stream/providers/redis/ioredis.js +1 -1
- package/build/services/stream/providers/redis/redis.js +1 -1
- package/build/services/stream/providers/stream-initializable.js +1 -1
- package/build/services/sub/factory.d.ts +2 -2
- package/build/services/sub/factory.js +13 -8
- package/build/services/sub/providers/nats/nats.d.ts +19 -0
- package/build/services/sub/providers/nats/nats.js +1 -0
- package/build/services/sub/providers/postgres/postgres.d.ts +1 -0
- package/build/services/sub/providers/postgres/postgres.js +1 -1
- package/build/services/sub/providers/redis/ioredis.js +1 -1
- package/build/services/sub/providers/redis/redis.js +1 -1
- package/build/services/task/index.js +1 -1
- package/build/services/telemetry/index.js +1 -1
- package/build/services/worker/index.js +1 -1
- package/build/types/hotmesh.d.ts +3 -17
- package/build/types/manifest.d.ts +2 -10
- package/build/types/nats.d.ts +8 -0
- package/build/types/postgres.d.ts +10 -1
- package/build/types/provider.d.ts +1 -0
- package/index.ts +24 -5
- package/package.json +5 -4
- package/types/hotmesh.ts +17 -17
- package/types/manifest.ts +2 -10
- package/types/nats.ts +34 -0
- package/types/postgres.ts +13 -2
- package/types/provider.ts +4 -0
package/README.md
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
- **Serverless Orchestration**: Orchestrate
|
|
11
|
+
- **Serverless Orchestration**: Orchestrate without adding infrastructure
|
|
12
12
|
- **No Vendor Lock-in**: Use your preferred database: *Postgres*, *Redis*, ...
|
|
13
|
-
- **Linear Scalability**: Scale your database to scale your application
|
|
14
|
-
- **Process Analytics**: Gain process insights with optional analytics
|
|
13
|
+
- **Linear Scalability**: Scale your database to scale your application
|
|
14
|
+
- **Process Analytics**: Gain process insights with optional analytics
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
<br/>
|
|
@@ -22,13 +22,15 @@
|
|
|
22
22
|
npm install @hotmeshio/hotmesh
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
<br/>
|
|
26
|
+
|
|
25
27
|
## Learn
|
|
26
28
|
[🏠 Home](https://hotmesh.io/) | [📄 SDK Docs](https://hotmeshio.github.io/sdk-typescript/) | [💼 General Examples](https://github.com/hotmeshio/samples-typescript) | [💼 Temporal Examples](https://github.com/hotmeshio/temporal-patterns-typescript)
|
|
27
29
|
|
|
28
30
|
<br/>
|
|
29
31
|
|
|
30
|
-
## MeshCall |
|
|
31
|
-
[MeshCall](https://hotmeshio.github.io/sdk-typescript/classes/services_meshcall.MeshCall.html) connects
|
|
32
|
+
## MeshCall | Service-to-Service Function Calls
|
|
33
|
+
[MeshCall](https://hotmeshio.github.io/sdk-typescript/classes/services_meshcall.MeshCall.html) connects your functions to the mesh.
|
|
32
34
|
|
|
33
35
|
<details style="padding: .5em">
|
|
34
36
|
<summary style="font-size:1.25em;">Run an idempotent cron job <small>[more]</small></summary>
|
|
@@ -453,7 +455,7 @@ Use a standard `Promise` to collate and cache multiple signals. HotMesh will onl
|
|
|
453
455
|
### Cyclical Workflow
|
|
454
456
|
This example calls an activity and then sleeps for a week. It runs indefinitely until it's manually stopped. It takes advantage of durable execution and can safely sleep for months or years.
|
|
455
457
|
|
|
456
|
-
>Container restarts have no impact on actively executing workflows as all state is retained in
|
|
458
|
+
>Container restarts have no impact on actively executing workflows as all state is retained in the backend.
|
|
457
459
|
|
|
458
460
|
1. Define the **workflow** logic. This one calls a legacy `statusDiagnostic` function once a week.
|
|
459
461
|
|
|
@@ -554,7 +556,7 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
554
556
|
<br/>
|
|
555
557
|
|
|
556
558
|
## MeshData | Transactional Analytics
|
|
557
|
-
[MeshData](https://hotmeshio.github.io/sdk-typescript/classes/services_meshdata.MeshData.html) adds analytics to
|
|
559
|
+
[MeshData](https://hotmeshio.github.io/sdk-typescript/classes/services_meshdata.MeshData.html) adds analytics to transactional workflows.
|
|
558
560
|
|
|
559
561
|
<details style="padding: .5em">
|
|
560
562
|
<summary style="font-size:1.25em;">Create a search index <small>[more]</small></summary>
|
|
@@ -587,10 +589,11 @@ This example demonstrates how to define a schema and deploy an index for a 'user
|
|
|
587
589
|
import { Client as Postgres } from 'pg';
|
|
588
590
|
import { schema } from './schema';
|
|
589
591
|
|
|
590
|
-
const meshData = new MeshData(
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
592
|
+
const meshData = new MeshData({
|
|
593
|
+
class: Postgres,
|
|
594
|
+
options: {
|
|
595
|
+
connectionString: 'postgresql://usr:pwd@localhost:5432/db'
|
|
596
|
+
}
|
|
594
597
|
},
|
|
595
598
|
schema,
|
|
596
599
|
);
|
|
@@ -613,10 +616,11 @@ This example demonstrates how to create a 'user' workflow backed by the searchab
|
|
|
613
616
|
import { schema } from './schema';
|
|
614
617
|
|
|
615
618
|
export const connectUserWorker = async (): Promise<void> => {
|
|
616
|
-
const meshData = new MeshData(
|
|
617
|
-
Postgres,
|
|
619
|
+
const meshData = new MeshData({
|
|
620
|
+
class: Postgres,
|
|
618
621
|
options: {
|
|
619
|
-
|
|
622
|
+
connectionString: 'postgresql:// usr:pwd@localhost:5432/db'
|
|
623
|
+
}
|
|
620
624
|
},
|
|
621
625
|
schema,
|
|
622
626
|
);
|
|
@@ -649,10 +653,11 @@ This example demonstrates how to create a 'user' workflow backed by the searchab
|
|
|
649
653
|
import { MeshData } from '@hotmeshio/hotmesh';
|
|
650
654
|
import { Client as Postgres } from 'pg';
|
|
651
655
|
|
|
652
|
-
const meshData = new MeshData(
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
+
const meshData = new MeshData({
|
|
657
|
+
class: Postgres,
|
|
658
|
+
options: {
|
|
659
|
+
connectionString: 'postgresql://usr:pwd@localhost:5432/db'
|
|
660
|
+
}
|
|
656
661
|
},
|
|
657
662
|
schema,
|
|
658
663
|
);
|
|
@@ -696,10 +701,11 @@ This example demonstrates how to read data fields directly from a workflow.
|
|
|
696
701
|
import { Client as Postgres } from 'pg';
|
|
697
702
|
import { schema } from './schema';
|
|
698
703
|
|
|
699
|
-
const meshData = new MeshData(
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
704
|
+
const meshData = new MeshData({
|
|
705
|
+
class: Postgres,
|
|
706
|
+
options: {
|
|
707
|
+
connectionString: 'postgresql://usr:pwd@localhost:5432/db'
|
|
708
|
+
}
|
|
703
709
|
},
|
|
704
710
|
schema,
|
|
705
711
|
);
|
|
@@ -719,7 +725,7 @@ This example demonstrates how to read data fields directly from a workflow.
|
|
|
719
725
|
<summary style="font-size:1.25em;">Search record data <small>[more]</small></summary>
|
|
720
726
|
|
|
721
727
|
### Query Record Data
|
|
722
|
-
This example demonstrates how to search for those workflows where a given condition exists in the data. This one searches for active users. *NOTE: The native Redis FT.SEARCH syntax
|
|
728
|
+
This example demonstrates how to search for those workflows where a given condition exists in the data. This one searches for active users. *NOTE: The native Redis FT.SEARCH syntax and SQL are currently supported. The JSON abstraction shown here is a convenience method for straight-forward, one-dimensional queries.*
|
|
723
729
|
|
|
724
730
|
1. Search for active users (where the value of the `active` field is `yes`).
|
|
725
731
|
|
|
@@ -729,10 +735,11 @@ This example demonstrates how to search for those workflows where a given condit
|
|
|
729
735
|
import { Client as Postgres } from 'pg';
|
|
730
736
|
import { schema } from './schema';
|
|
731
737
|
|
|
732
|
-
const meshData = new MeshData(
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
738
|
+
const meshData = new MeshData({
|
|
739
|
+
class: Postgres,
|
|
740
|
+
options: {
|
|
741
|
+
connectionString: 'postgresql://usr:pwd@localhost:5432/db'
|
|
742
|
+
}
|
|
736
743
|
},
|
|
737
744
|
schema,
|
|
738
745
|
);
|
|
@@ -748,25 +755,49 @@ This example demonstrates how to search for those workflows where a given condit
|
|
|
748
755
|
<br/>
|
|
749
756
|
|
|
750
757
|
## Connect
|
|
751
|
-
HotMesh is pluggable and ships with support for Postgres (pg) and Redis (ioredis/redis)
|
|
758
|
+
HotMesh is pluggable and ships with support for Postgres (pg) and Redis (ioredis/redis). NATS is also supported for PubSub for extended patterns.
|
|
759
|
+
|
|
760
|
+
<details style="padding: .5em">
|
|
761
|
+
<summary style="font-size:1.25em;">Postgres <small>[more]</small></summary>
|
|
752
762
|
|
|
753
|
-
### Postgres
|
|
763
|
+
### Connect Postgres Client
|
|
754
764
|
```typescript
|
|
755
|
-
import { Client as
|
|
756
|
-
//OR `import { Pool as Postgres } from 'pg';`
|
|
765
|
+
import { Client as PostgresClient } from 'pg';
|
|
757
766
|
|
|
767
|
+
//provide these credentials to HotMesh
|
|
758
768
|
const connection = {
|
|
759
|
-
class:
|
|
769
|
+
class: PostgresClient,
|
|
760
770
|
options: {
|
|
761
771
|
connectionString: 'postgresql://usr:pwd@localhost:5432/db'
|
|
762
772
|
}
|
|
763
773
|
};
|
|
774
|
+
|
|
764
775
|
```
|
|
776
|
+
### Connect Postgres Pool
|
|
777
|
+
Pool connections are recommended for high-throughput applications. The pool will manage connections and automatically handle connection pooling.
|
|
778
|
+
```typescript
|
|
779
|
+
import { Pool as PostgresPool } from 'pg';
|
|
780
|
+
|
|
781
|
+
const PostgresPoolClient = new PostgresPool({
|
|
782
|
+
connectionString: 'postgresql://usr:pwd@localhost:5432/db'
|
|
783
|
+
});
|
|
765
784
|
|
|
766
|
-
|
|
785
|
+
//provide these credentials to HotMesh
|
|
786
|
+
const connection = {
|
|
787
|
+
class: PostgresPoolClient,
|
|
788
|
+
options: {}
|
|
789
|
+
};
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
</details>
|
|
793
|
+
|
|
794
|
+
<details style="padding: .5em">
|
|
795
|
+
<summary style="font-size:1.25em;">Redis <small>[more]</small></summary>
|
|
796
|
+
|
|
797
|
+
### Redis/IORedis
|
|
767
798
|
```typescript
|
|
768
799
|
import * as Redis from 'redis';
|
|
769
|
-
//OR `import
|
|
800
|
+
//OR `import Redis from 'ioredis';`
|
|
770
801
|
|
|
771
802
|
const connection = {
|
|
772
803
|
class: Redis,
|
|
@@ -775,9 +806,13 @@ const connection = {
|
|
|
775
806
|
}
|
|
776
807
|
};
|
|
777
808
|
```
|
|
809
|
+
</details>
|
|
810
|
+
|
|
811
|
+
<details style="padding: .5em">
|
|
812
|
+
<summary style="font-size:1.25em;">NATS <small>[more]</small></summary>
|
|
778
813
|
|
|
779
|
-
### NATS
|
|
780
|
-
Add NATS for improved
|
|
814
|
+
### NATS PubSub
|
|
815
|
+
Add NATS for improved PubSub support, including patterned subscriptions. Note the explicit channel subscription in the example below. *The NATS provider supports version 2.0 of the NATS client (the latest version). See ./package.json for details.*
|
|
781
816
|
|
|
782
817
|
```typescript
|
|
783
818
|
import { Client as Postgres } from 'pg';
|
|
@@ -802,6 +837,7 @@ const connection = {
|
|
|
802
837
|
},
|
|
803
838
|
};
|
|
804
839
|
```
|
|
840
|
+
</details>
|
|
805
841
|
|
|
806
842
|
<br/>
|
|
807
843
|
|
package/build/index.d.ts
CHANGED
|
@@ -7,7 +7,13 @@ import { MeshData } from './services/meshdata';
|
|
|
7
7
|
import { MeshOS } from './services/meshos';
|
|
8
8
|
import * as Errors from './modules/errors';
|
|
9
9
|
import * as Utils from './modules/utils';
|
|
10
|
+
import * as Enums from './modules/enums';
|
|
11
|
+
import * as KeyStore from './modules/key';
|
|
10
12
|
import { ConnectorService as Connector } from './services/connector/factory';
|
|
13
|
+
import { PostgresConnection as ConnectorPostgres } from './services/connector/providers/postgres';
|
|
14
|
+
import { RedisConnection as ConnectorIORedis } from './services/connector/providers/ioredis';
|
|
15
|
+
import { RedisConnection as ConnectorRedis } from './services/connector/providers/redis';
|
|
16
|
+
import { NatsConnection as ConnectorNATS } from './services/connector/providers/nats';
|
|
11
17
|
declare const Client: typeof import("./services/meshflow/client").ClientService, Connection: typeof import("./services/meshflow/connection").ConnectionService, Search: typeof import("./services/meshflow/search").Search, Worker: typeof import("./services/meshflow/worker").WorkerService, workflow: typeof import("./services/meshflow/workflow").WorkflowService;
|
|
12
|
-
export {
|
|
18
|
+
export { Connector, ConnectorIORedis, ConnectorNATS, ConnectorPostgres, ConnectorRedis, HotMesh, HotMeshConfig, MeshCall, MeshData, MeshFlow, MeshOS, Client, Connection, Search, Worker, workflow, WorkflowHandle, Enums, Errors, Utils, KeyStore, };
|
|
13
19
|
export * as Types from './types';
|
package/build/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Types = exports.WorkflowHandle = exports.workflow = exports.Worker = exports.
|
|
26
|
+
exports.Types = exports.KeyStore = exports.Utils = exports.Errors = exports.Enums = exports.WorkflowHandle = exports.workflow = exports.Worker = exports.Search = exports.Connection = exports.Client = exports.MeshOS = exports.MeshFlow = exports.MeshData = exports.MeshCall = exports.HotMesh = exports.ConnectorRedis = exports.ConnectorPostgres = exports.ConnectorNATS = exports.ConnectorIORedis = exports.Connector = void 0;
|
|
27
27
|
const hotmesh_1 = require("./services/hotmesh");
|
|
28
28
|
Object.defineProperty(exports, "HotMesh", { enumerable: true, get: function () { return hotmesh_1.HotMesh; } });
|
|
29
29
|
const meshcall_1 = require("./services/meshcall");
|
|
@@ -40,8 +40,20 @@ const Errors = __importStar(require("./modules/errors"));
|
|
|
40
40
|
exports.Errors = Errors;
|
|
41
41
|
const Utils = __importStar(require("./modules/utils"));
|
|
42
42
|
exports.Utils = Utils;
|
|
43
|
+
const Enums = __importStar(require("./modules/enums"));
|
|
44
|
+
exports.Enums = Enums;
|
|
45
|
+
const KeyStore = __importStar(require("./modules/key"));
|
|
46
|
+
exports.KeyStore = KeyStore;
|
|
43
47
|
const factory_1 = require("./services/connector/factory");
|
|
44
48
|
Object.defineProperty(exports, "Connector", { enumerable: true, get: function () { return factory_1.ConnectorService; } });
|
|
49
|
+
const postgres_1 = require("./services/connector/providers/postgres");
|
|
50
|
+
Object.defineProperty(exports, "ConnectorPostgres", { enumerable: true, get: function () { return postgres_1.PostgresConnection; } });
|
|
51
|
+
const ioredis_1 = require("./services/connector/providers/ioredis");
|
|
52
|
+
Object.defineProperty(exports, "ConnectorIORedis", { enumerable: true, get: function () { return ioredis_1.RedisConnection; } });
|
|
53
|
+
const redis_1 = require("./services/connector/providers/redis");
|
|
54
|
+
Object.defineProperty(exports, "ConnectorRedis", { enumerable: true, get: function () { return redis_1.RedisConnection; } });
|
|
55
|
+
const nats_1 = require("./services/connector/providers/nats");
|
|
56
|
+
Object.defineProperty(exports, "ConnectorNATS", { enumerable: true, get: function () { return nats_1.NatsConnection; } });
|
|
45
57
|
const { Client, Connection, Search, Worker, workflow } = meshflow_1.MeshFlow;
|
|
46
58
|
exports.Client = Client;
|
|
47
59
|
exports.Connection = Connection;
|
package/build/modules/key.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x5de672,_0x4076e2){const _0x445b9f=_0x5a6d,_0x42aeeb=_0x5de672();while(!![]){try{const _0x37a554=-parseInt(_0x445b9f(0x1c7))/0x1+-parseInt(_0x445b9f(0x1c8))/0x2*(parseInt(_0x445b9f(0x1ca))/0x3)+parseInt(_0x445b9f(0x1cc))/0x4+-parseInt(_0x445b9f(0x1cd))/0x5*(parseInt(_0x445b9f(0x1c9))/0x6)+-parseInt(_0x445b9f(0x1cb))/0x7*(parseInt(_0x445b9f(0x1d0))/0x8)+parseInt(_0x445b9f(0x1ce))/0x9+-parseInt(_0x445b9f(0x1d1))/0xa*(-parseInt(_0x445b9f(0x1cf))/0xb);if(_0x37a554===_0x4076e2)break;else _0x42aeeb['push'](_0x42aeeb['shift']());}catch(_0x258c05){_0x42aeeb['push'](_0x42aeeb['shift']());}}}(_0x41e0,0xeea5c));function _0x41e0(){const _0x49b5c3=['21732jtokyl','1731wtSrLU','905366oPIGPD','1817468JgEzyq','910ezDmCV','13365540UwjDUO','17299491fKFcHu','32ZUTLDz','10KAcILJ','463125nwjCVM','3102RJXYOM'];_0x41e0=function(){return _0x49b5c3;};return _0x41e0();}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['VALSEP']=exports['WEBSEP']=exports['TYPSEP']=exports['KEYSEP']=exports['HMNS']=exports['KeyType']=exports['KeyService']=void 0x0;const hotmesh_1=require('../types/hotmesh');Object['defineProperty'](exports,'KeyType',{'enumerable':!![],'get':function(){return hotmesh_1['KeyType'];}});const HMNS='hmsh';exports['HMNS']=HMNS;const KEYSEP=':';exports['KEYSEP']=KEYSEP;const VALSEP='::';exports['VALSEP']=VALSEP;const WEBSEP='::';exports['WEBSEP']=WEBSEP;const TYPSEP='::';exports['TYPSEP']=TYPSEP;function _0x5a6d(_0xd319f6,_0x5dbacf){const _0x41e0ad=_0x41e0();return _0x5a6d=function(_0x5a6da9,_0x371871){_0x5a6da9=_0x5a6da9-0x1c7;let _0xc2e3c7=_0x41e0ad[_0x5a6da9];return _0xc2e3c7;},_0x5a6d(_0xd319f6,_0x5dbacf);}class KeyService{static['mintKey'](_0x39fe19,_0x5738e9,_0x3eb716){switch(_0x5738e9){case hotmesh_1['KeyType']['HOTMESH']:return _0x39fe19;case hotmesh_1['KeyType']['THROTTLE_RATE']:return _0x39fe19+':'+_0x3eb716['appId']+':r:';case hotmesh_1['KeyType']['WORK_ITEMS']:return _0x39fe19+':'+_0x3eb716['appId']+':w:'+(_0x3eb716['scoutType']||'');case hotmesh_1['KeyType']['TIME_RANGE']:return _0x39fe19+':'+_0x3eb716['appId']+':t:'+(_0x3eb716['timeValue']||'');case hotmesh_1['KeyType']['APP']:return _0x39fe19+':a:'+(_0x3eb716['appId']||'');case hotmesh_1['KeyType']['QUORUM']:return _0x39fe19+':'+_0x3eb716['appId']+':q:'+(_0x3eb716['engineId']||'');case hotmesh_1['KeyType']['JOB_STATE']:return _0x39fe19+':'+_0x3eb716['appId']+':j:'+_0x3eb716['jobId'];case hotmesh_1['KeyType']['JOB_DEPENDENTS']:return _0x39fe19+':'+_0x3eb716['appId']+':d:'+_0x3eb716['jobId'];case hotmesh_1['KeyType']['JOB_STATS_GENERAL']:return _0x39fe19+':'+_0x3eb716['appId']+':s:'+_0x3eb716['jobKey']+':'+_0x3eb716['dateTime'];case hotmesh_1['KeyType']['JOB_STATS_MEDIAN']:return _0x39fe19+':'+_0x3eb716['appId']+':s:'+_0x3eb716['jobKey']+':'+_0x3eb716['dateTime']+':'+_0x3eb716['facet'];case hotmesh_1['KeyType']['JOB_STATS_INDEX']:return _0x39fe19+':'+_0x3eb716['appId']+':s:'+_0x3eb716['jobKey']+':'+_0x3eb716['dateTime']+':'+_0x3eb716['facet'];case hotmesh_1['KeyType']['SCHEMAS']:return _0x39fe19+':'+_0x3eb716['appId']+':v:'+_0x3eb716['appVersion']+':schemas';case hotmesh_1['KeyType']['SUBSCRIPTIONS']:return _0x39fe19+':'+_0x3eb716['appId']+':v:'+_0x3eb716['appVersion']+':subscriptions';case hotmesh_1['KeyType']['SUBSCRIPTION_PATTERNS']:return _0x39fe19+':'+_0x3eb716['appId']+':v:'+_0x3eb716['appVersion']+':transitions';case hotmesh_1['KeyType']['HOOKS']:return _0x39fe19+':'+_0x3eb716['appId']+':hooks';case hotmesh_1['KeyType']['SIGNALS']:return _0x39fe19+':'+_0x3eb716['appId']+':signals';case hotmesh_1['KeyType']['SYMKEYS']:return _0x39fe19+':'+_0x3eb716['appId']+':sym:keys:'+(_0x3eb716['activityId']||'');case hotmesh_1['KeyType']['SYMVALS']:return _0x39fe19+':'+_0x3eb716['appId']+':sym:vals:';case hotmesh_1['KeyType']['STREAMS']:return _0x39fe19+':'+(_0x3eb716['appId']||'')+':x:'+(_0x3eb716['topic']||'');default:throw new Error('Invalid\x20key\x20type.');}}static['parseKey'](_0x1c6f7d){const [_0x4d1c9b,_0x5f3d5d,_0x123d25,..._0x4eb36e]=_0x1c6f7d['split'](KEYSEP),_0x11620e=_0x4eb36e['join'](KEYSEP)||'';return{'namespace':_0x4d1c9b,'app':_0x123d25==='a'?_0x5f3d5d:undefined,'entity':_0x123d25,'id':_0x11620e};}static['reconstituteKey'](_0x18e46b){const {namespace:_0x303759,app:_0x5c4783,entity:_0x5eadcb,id:_0x43d11d}=_0x18e46b;return''+_0x303759+KEYSEP+_0x5c4783+KEYSEP+_0x5eadcb+KEYSEP+(_0x43d11d||'');}static['resolveEntityType'](_0x7d22c8,_0x51945f=''){switch(_0x7d22c8){case'a':return'applications';case'r':return'throttles';case'w':return _0x51945f===''?'task_priorities':'roles';case't':return _0x51945f===''?'task_schedules':'task_lists';case'q':return'events';case'j':return'jobs';case's':return'stats';case'v':return'versions';case'x':return _0x51945f===''?'streams':'stream_topics';case'hooks':return'signal_patterns';case'signals':return'signal_registry';case'sym':return'symbols';default:return'unknown_entity';}}static['resolveAbbreviation'](_0x3ec8de){switch(_0x3ec8de){case'applications':return'a';case'throttles':return'r';case'roles':return'w';case'task_schedules':return't';case'task_lists':return't';case'events':return'q';case'jobs':return'j';case'stats':return's';case'versions':return'v';case'streams':return'x';case'signal_patterns':return'hooks';case'signal_registry':return'signals';case'symbols':return'sym';default:return'unknown_entity';}}}exports['KeyService']=KeyService;
|
package/build/modules/utils.d.ts
CHANGED
|
@@ -21,13 +21,11 @@ export declare const polyfill: {
|
|
|
21
21
|
resolveActivityType(activityType: string): string;
|
|
22
22
|
providerConfig(obj: any): any;
|
|
23
23
|
meshDataConfig(obj: {
|
|
24
|
-
connection?: Partial<ProviderConfig>;
|
|
25
|
-
connections?: Partial<ProvidersConfig>;
|
|
24
|
+
connection?: Partial<ProviderConfig | ProvidersConfig>;
|
|
26
25
|
redisClass?: any;
|
|
27
26
|
redisOptions?: StringAnyType;
|
|
28
27
|
}): Partial<ProviderConfig> | Partial<ProvidersConfig>;
|
|
29
28
|
};
|
|
30
|
-
export declare function identifyRedisTypeFromClass(redisClass: any): 'redis' | 'ioredis' | null;
|
|
31
29
|
export declare function matchesStatusCode(code: StreamCode, pattern: string | RegExp): boolean;
|
|
32
30
|
export declare function matchesStatus(status: StreamStatus, targetStatus: StreamStatus): boolean;
|
|
33
31
|
export declare function findTopKey(obj: AppTransitions, input: string): string | null;
|
package/build/modules/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(_0x1cbe80,_0x432b2a){const _0x4b8976=_0x3e85,_0x526b32=_0x1cbe80();while(!![]){try{const _0x2231ec=parseInt(_0x4b8976(0xe1))/0x1+-parseInt(_0x4b8976(0xe4))/0x2+parseInt(_0x4b8976(0xe6))/0x3*(parseInt(_0x4b8976(0xe5))/0x4)+parseInt(_0x4b8976(0xe9))/0x5*(parseInt(_0x4b8976(0xe2))/0x6)+parseInt(_0x4b8976(0xe8))/0x7*(parseInt(_0x4b8976(0xe3))/0x8)+parseInt(_0x4b8976(0xe7))/0x9+-parseInt(_0x4b8976(0xe0))/0xa;if(_0x2231ec===_0x432b2a)break;else _0x526b32['push'](_0x526b32['shift']());}catch(_0x180d92){_0x526b32['push'](_0x526b32['shift']());}}}(_0x4c03,0xc06d6));var __importDefault=this&&this['__importDefault']||function(_0x20650b){return _0x20650b&&_0x20650b['__esModule']?_0x20650b:{'default':_0x20650b};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['arrayToHash']=exports['isStreamMessage']=exports['parseStreamMessage']=exports['s']=exports['isValidCron']=exports['restoreHierarchy']=exports['getValueByPath']=exports['getIndexedHash']=exports['getSymVal']=exports['getSymKey']=exports['formatISODate']=exports['getTimeSeries']=exports['getSubscriptionTopic']=exports['findSubscriptionForTrigger']=exports['findTopKey']=exports['matchesStatus']=exports['matchesStatusCode']=exports['identifyRedisTypeFromClass']=exports['polyfill']=exports['identifyProvider']=exports['XSleepFor']=exports['sleepImmediate']=exports['sleepFor']=exports['guid']=exports['deterministicRandom']=exports['deepCopy']=exports['getSystemHealth']=exports['hashOptions']=void 0x0;const os_1=__importDefault(require('os')),crypto_1=require('crypto'),nanoid_1=require('nanoid'),ms_1=__importDefault(require('ms')),logger_1=require('../services/logger'),enums_1=require('./enums'),logger=new logger_1['LoggerService']('hotmesh','utils'),hashOptions=_0x4d509b=>{const _0x9509f7=JSON['stringify'](_0x4d509b);return(0x0,crypto_1['createHash'])('sha256')['update'](_0x9509f7)['digest']('hex');};exports['hashOptions']=hashOptions;async function getSystemHealth(){const _0x2aad50=os_1['default']['totalmem'](),_0x3249ba=os_1['default']['freemem'](),_0x49afbd=_0x2aad50-_0x3249ba,_0x461295={'TotalMemoryGB':(_0x2aad50/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','FreeMemoryGB':(_0x3249ba/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','UsedMemoryGB':(_0x49afbd/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','CPULoad':[],'NetworkStats':[]};return _0x461295;}exports['getSystemHealth']=getSystemHealth;function deepCopy(_0x383b94){return JSON['parse'](JSON['stringify'](_0x383b94));}exports['deepCopy']=deepCopy;function deterministicRandom(_0x94d0c9){const _0x5bd3d8=Math['sin'](_0x94d0c9)*0x2710;return _0x5bd3d8-Math['floor'](_0x5bd3d8);}exports['deterministicRandom']=deterministicRandom;function guid(_0x1d98a9=enums_1['HMSH_GUID_SIZE']){return'H'+(0x0,nanoid_1['nanoid'])(_0x1d98a9);}exports['guid']=guid;async function sleepFor(_0x523968){return new Promise(_0x5d9613=>setTimeout(_0x5d9613,_0x523968));}exports['sleepFor']=sleepFor;function sleepImmediate(){return new Promise(_0x236336=>setImmediate(_0x236336));}exports['sleepImmediate']=sleepImmediate;function XSleepFor(_0x248639){let _0x5a4a1e;const _0x3377c5=new Promise(_0x3a8fdc=>{_0x5a4a1e=setTimeout(_0x3a8fdc,_0x248639);});return{'promise':_0x3377c5,'timerId':_0x5a4a1e};}exports['XSleepFor']=XSleepFor;function identifyProvider(_0x486349){const _0x4d7dd3=Object['getPrototypeOf'](_0x486349);if(_0x486349['Query']?.['prototype']||Object['keys'](_0x486349)['includes']('database'))return'postgres';else{if(_0x486349['constructor']&&_0x486349['constructor']['name']==='Client')return'nats';else{if('defineCommand'in _0x4d7dd3||Object['keys'](_0x4d7dd3)['includes']('multi'))return'ioredis';else{if(Object['keys'](_0x4d7dd3)['includes']('Multi'))return'redis';}}}if(_0x486349['constructor']){if(_0x486349['constructor']['name']==='Redis'||_0x486349['constructor']['name']==='EventEmitter'){if('hset'in _0x486349)return'ioredis';}else{if(_0x486349['constructor']['name']==='ProviderClient'||_0x486349['constructor']['name']==='Commander'){if('HSET'in _0x486349)return'redis';}}}let _0x5180ff=null;if(Object['keys'](_0x486349)['includes']('connection'))_0x5180ff='postgres';else{if(Object['keys'](_0x486349)['includes']('Pipeline'))_0x5180ff='ioredis';else{if(Object['keys'](_0x486349)['includes']('createClient'))_0x5180ff='redis';else Object['keys'](_0x486349)['includes']('jetstream')&&(_0x5180ff='nats');}}return _0x5180ff;}exports['identifyProvider']=identifyProvider,exports['polyfill']={'resolveActivityType'(_0x4dcb7f){return _0x4dcb7f==='activity'?'hook':_0x4dcb7f;},'providerConfig'(_0x1fa3d0){return _0x1fa3d0?.['connection']??_0x1fa3d0?.['redis']??_0x1fa3d0?.['connections'];},'meshDataConfig'(_0x5c6c4f){if(_0x5c6c4f?.['connections'])return _0x5c6c4f['connections'];return _0x5c6c4f?.['connection']??{'class':_0x5c6c4f?.['redisClass'],'options':_0x5c6c4f?.['redisOptions']};}};function _0x3e85(_0x2c51b2,_0x24c64b){const _0x4c03ea=_0x4c03();return _0x3e85=function(_0x3e852d,_0x9f289){_0x3e852d=_0x3e852d-0xe0;let _0x57bdc0=_0x4c03ea[_0x3e852d];return _0x57bdc0;},_0x3e85(_0x2c51b2,_0x24c64b);}function identifyRedisTypeFromClass(_0x4ae8c4){if(_0x4ae8c4&&_0x4ae8c4['name']==='Redis'||_0x4ae8c4['name']==='EventEmitter')return'ioredis';else{if(_0x4ae8c4&&'createClient'in _0x4ae8c4)return'redis';}return null;}exports['identifyRedisTypeFromClass']=identifyRedisTypeFromClass;function matchesStatusCode(_0x23c3b2,_0x5a8c83){if(typeof _0x5a8c83==='string'){const _0x1cfb7d='^'+_0x5a8c83['replace'](/\*/g,'\x5cd')+'$';return new RegExp(_0x1cfb7d)['test'](_0x23c3b2['toString']());}return _0x5a8c83['test'](_0x23c3b2['toString']());}exports['matchesStatusCode']=matchesStatusCode;function matchesStatus(_0x1ef0ce,_0x37e552){return _0x1ef0ce===_0x37e552;}exports['matchesStatus']=matchesStatus;function findTopKey(_0x549280,_0x266171){for(const [_0x4b5217,_0x2ba9d3]of Object['entries'](_0x549280)){if(_0x2ba9d3['hasOwnProperty'](_0x266171)){const _0x2576dd=findTopKey(_0x549280,_0x4b5217['replace'](/^\./,''));return(_0x2576dd||_0x4b5217)['replace'](/^\./,'');}}return null;}exports['findTopKey']=findTopKey;function findSubscriptionForTrigger(_0x50596a,_0x59117f){for(const [_0x40b03b,_0x1e92ac]of Object['entries'](_0x50596a)){if(_0x1e92ac===_0x59117f)return _0x40b03b;}return null;}exports['findSubscriptionForTrigger']=findSubscriptionForTrigger;async function getSubscriptionTopic(_0x28e87b,_0x6e7b88,_0x43a33a){const _0xe899c7=await _0x6e7b88['getTransitions'](_0x43a33a),_0x4b36a6=await _0x6e7b88['getSubscriptions'](_0x43a33a),_0x39c8d6=findTopKey(_0xe899c7,_0x28e87b),_0x3928ec=findSubscriptionForTrigger(_0x4b36a6,_0x39c8d6);return _0x3928ec;}exports['getSubscriptionTopic']=getSubscriptionTopic;function getTimeSeries(_0xd61acd){if(_0xd61acd['toString']()==='infinity')return'0';const _0x9ac252=new Date(),_0x7cf425=_0xd61acd['slice'](-0x1),_0xf9920a=parseInt(_0xd61acd['slice'](0x0,-0x1),0xa);if(_0x7cf425==='m'){const _0x3cf4cc=Math['floor'](_0x9ac252['getMinutes']()/_0xf9920a)*_0xf9920a;_0x9ac252['setUTCMinutes'](_0x3cf4cc,0x0,0x0);}else _0x7cf425==='h'&&_0x9ac252['setUTCMinutes'](0x0,0x0,0x0);return _0x9ac252['toISOString']()['replace'](/:\d\d\..+|-|T/g,'')['replace'](':','');}exports['getTimeSeries']=getTimeSeries;function formatISODate(_0x31b3b6){const _0x196d63=_0x31b3b6 instanceof Date?_0x31b3b6:new Date(_0x31b3b6);return _0x196d63['toISOString']()['replace'](/[:TZ-]/g,'');}exports['formatISODate']=formatISODate;function getSymKey(_0x5d20cc){const _0x334c0a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x5d5fae=_0x334c0a['length'];if(_0x5d20cc<0x0||_0x5d20cc>=Math['pow'](_0x5d5fae,0x3))throw new Error('Number\x20out\x20of\x20range');const [_0x23810d,_0x2e154e]=divmod(_0x5d20cc,_0x5d5fae),[_0x2df5f6,_0x590738]=divmod(_0x23810d,_0x5d5fae);return _0x334c0a[_0x2df5f6]+_0x334c0a[_0x2e154e]+_0x334c0a[_0x590738];}exports['getSymKey']=getSymKey;function getSymVal(_0x55aee6){const _0x18d4ca='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x11b7e3=_0x18d4ca['length'];if(_0x55aee6<0x0||_0x55aee6>=Math['pow'](_0x11b7e3,0x2))throw new Error('Number\x20out\x20of\x20range');const [_0x5a2761,_0x1528dc]=divmod(_0x55aee6,_0x11b7e3);return _0x18d4ca[_0x5a2761]+_0x18d4ca[_0x1528dc];}exports['getSymVal']=getSymVal;function divmod(_0x460794,_0x57f007){return[Math['floor'](_0x460794/_0x57f007),_0x460794%_0x57f007];}function getIndexedHash(_0x57b302,_0x3fbb52){const _0x457f56=_0x57b302[_0x3fbb52]||0x0,_0x2f4055={..._0x57b302};return delete _0x2f4055[_0x3fbb52],[_0x457f56,_0x2f4055];}exports['getIndexedHash']=getIndexedHash;function getValueByPath(_0x42a55c,_0x2d8de3){const _0x1e35f9=_0x2d8de3['split']('/');let _0x357d38=_0x42a55c;for(const _0x1610d5 of _0x1e35f9){if(_0x357d38[_0x1610d5]!==undefined)_0x357d38=_0x357d38[_0x1610d5];else return undefined;}return _0x357d38;}exports['getValueByPath']=getValueByPath;function restoreHierarchy(_0xa7620b){const _0xb5a501={};for(const _0x44fad7 in _0xa7620b){if(_0xa7620b[_0x44fad7]===undefined)continue;const _0x404c1d=_0x44fad7['split']('/');let _0x4c0f71=_0xb5a501;for(let _0x16743a=0x0;_0x16743a<_0x404c1d['length'];_0x16743a++){_0x16743a===_0x404c1d['length']-0x1?_0x4c0f71[_0x404c1d[_0x16743a]]=_0xa7620b[_0x44fad7]:(_0x4c0f71[_0x404c1d[_0x16743a]]=_0x4c0f71[_0x404c1d[_0x16743a]]||{},_0x4c0f71=_0x4c0f71[_0x404c1d[_0x16743a]]);}}return _0xb5a501;}exports['restoreHierarchy']=restoreHierarchy;function isValidCron(_0x4fd136){const _0x3efe28=/^(\*|([0-5]?\d)) (\*|([01]?\d|2[0-3])) (\*|([12]?\d|3[01])) (\*|([1-9]|1[0-2])) (\*|([0-6](?:-[0-6])?(?:,[0-6])?))$/;return _0x3efe28['test'](_0x4fd136);}exports['isValidCron']=isValidCron;const s=_0x15d3af=>{return(0x0,ms_1['default'])(_0x15d3af)/0x3e8;};exports['s']=s;const parseStreamMessage=_0x3e852b=>{try{return JSON['parse'](_0x3e852b);}catch(_0x1ab64e){logger['error']('Error\x20parsing\x20Stream\x20message',{..._0x1ab64e});throw _0x1ab64e;}};exports['parseStreamMessage']=parseStreamMessage;const isStreamMessage=_0x3e3d54=>{return Array['isArray'](_0x3e3d54)&&Array['isArray'](_0x3e3d54[0x0]);};exports['isStreamMessage']=isStreamMessage;const arrayToHash=_0x246d77=>{const _0x24cecb=[];let _0x37755a;for(let _0x28612f=0x1;_0x28612f<_0x246d77['length'];_0x28612f++){const _0x28f49c=_0x246d77[_0x28612f],_0x507fae={};if(Array['isArray'](_0x28f49c)){for(let _0x3f9fbd=0x0;_0x3f9fbd<_0x28f49c['length'];_0x3f9fbd+=0x2){const _0x564c2b=_0x28f49c[_0x3f9fbd],_0x5b730e=_0x28f49c[_0x3f9fbd+0x1];_0x507fae[_0x564c2b]=_0x5b730e;}_0x37755a&&(_0x507fae['$']=_0x37755a),_0x24cecb['push'](_0x507fae),_0x37755a=undefined;}else _0x37755a=_0x28f49c;}return _0x24cecb;};exports['arrayToHash']=arrayToHash;function _0x4c03(){const _0xf4c19c=['4623669kjIRmn','7BRNYer','125QCFNAV','30236290HLvmAl','589601TorDSR','261102LUEBsK','8656496wZdyGi','344612nMRgSi','710788nSbcQB','12WEzEoJ'];_0x4c03=function(){return _0xf4c19c;};return _0x4c03();}
|
|
1
|
+
'use strict';(function(_0x4f4094,_0x1268a3){const _0x12d838=_0x23e3,_0x29a595=_0x4f4094();while(!![]){try{const _0x3a17a9=-parseInt(_0x12d838(0xe5))/0x1*(-parseInt(_0x12d838(0xee))/0x2)+parseInt(_0x12d838(0xec))/0x3*(parseInt(_0x12d838(0xe6))/0x4)+parseInt(_0x12d838(0xe4))/0x5+-parseInt(_0x12d838(0xeb))/0x6+-parseInt(_0x12d838(0xe9))/0x7*(parseInt(_0x12d838(0xea))/0x8)+parseInt(_0x12d838(0xe7))/0x9*(parseInt(_0x12d838(0xe8))/0xa)+parseInt(_0x12d838(0xed))/0xb;if(_0x3a17a9===_0x1268a3)break;else _0x29a595['push'](_0x29a595['shift']());}catch(_0x26be96){_0x29a595['push'](_0x29a595['shift']());}}}(_0x2a33,0xb4422));var __importDefault=this&&this['__importDefault']||function(_0x5932c9){return _0x5932c9&&_0x5932c9['__esModule']?_0x5932c9:{'default':_0x5932c9};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['arrayToHash']=exports['isStreamMessage']=exports['parseStreamMessage']=exports['s']=exports['isValidCron']=exports['restoreHierarchy']=exports['getValueByPath']=exports['getIndexedHash']=exports['getSymVal']=exports['getSymKey']=exports['formatISODate']=exports['getTimeSeries']=exports['getSubscriptionTopic']=exports['findSubscriptionForTrigger']=exports['findTopKey']=exports['matchesStatus']=exports['matchesStatusCode']=exports['polyfill']=exports['identifyProvider']=exports['XSleepFor']=exports['sleepImmediate']=exports['sleepFor']=exports['guid']=exports['deterministicRandom']=exports['deepCopy']=exports['getSystemHealth']=exports['hashOptions']=void 0x0;const os_1=__importDefault(require('os')),crypto_1=require('crypto'),nanoid_1=require('nanoid'),ms_1=__importDefault(require('ms')),logger_1=require('../services/logger'),enums_1=require('./enums'),logger=new logger_1['LoggerService']('hotmesh','utils'),hashOptions=_0xfa883b=>{const _0x298cc7=JSON['stringify'](_0xfa883b);return(0x0,crypto_1['createHash'])('sha256')['update'](_0x298cc7)['digest']('hex');};exports['hashOptions']=hashOptions;async function getSystemHealth(){const _0xfde52=os_1['default']['totalmem'](),_0xf545fc=os_1['default']['freemem'](),_0x4f1eb8=_0xfde52-_0xf545fc,_0x4b4226={'TotalMemoryGB':(_0xfde52/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','FreeMemoryGB':(_0xf545fc/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','UsedMemoryGB':(_0x4f1eb8/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','CPULoad':[],'NetworkStats':[]};return _0x4b4226;}exports['getSystemHealth']=getSystemHealth;function deepCopy(_0x513957){return JSON['parse'](JSON['stringify'](_0x513957));}exports['deepCopy']=deepCopy;function deterministicRandom(_0x2096f0){const _0x3147fa=Math['sin'](_0x2096f0)*0x2710;return _0x3147fa-Math['floor'](_0x3147fa);}exports['deterministicRandom']=deterministicRandom;function guid(_0x3b5a22=enums_1['HMSH_GUID_SIZE']){return'H'+(0x0,nanoid_1['nanoid'])(_0x3b5a22);}exports['guid']=guid;function _0x23e3(_0x404109,_0x39e479){const _0x2a330a=_0x2a33();return _0x23e3=function(_0x23e39e,_0x4fdc2c){_0x23e39e=_0x23e39e-0xe4;let _0xfc91b3=_0x2a330a[_0x23e39e];return _0xfc91b3;},_0x23e3(_0x404109,_0x39e479);}async function sleepFor(_0x28e09a){return new Promise(_0x4b2673=>setTimeout(_0x4b2673,_0x28e09a));}exports['sleepFor']=sleepFor;function sleepImmediate(){return new Promise(_0x306390=>setImmediate(_0x306390));}exports['sleepImmediate']=sleepImmediate;function XSleepFor(_0x54bbd5){let _0x434833;const _0xc65ffa=new Promise(_0x47585a=>{_0x434833=setTimeout(_0x47585a,_0x54bbd5);});return{'promise':_0xc65ffa,'timerId':_0x434833};}exports['XSleepFor']=XSleepFor;function identifyProvider(_0x5e7d37){const _0x154123=Object['getPrototypeOf'](_0x5e7d37);if(_0x5e7d37['Query']?.['prototype']||Object['keys'](_0x5e7d37)['includes']('database')||_0x154123['name']==='Pool')return'postgres';else{if(_0x5e7d37['toString']()['toLowerCase']()['includes']('nats'))return'nats';else{if('defineCommand'in _0x154123||Object['keys'](_0x154123)['includes']('multi'))return'ioredis';else{if(Object['keys'](_0x154123)['includes']('Multi'))return'redis';}}}if(_0x5e7d37['constructor']){if(_0x5e7d37['constructor']['name']==='Redis'||_0x5e7d37['constructor']['name']==='EventEmitter'){if('hset'in _0x5e7d37)return'ioredis';}else{if(_0x5e7d37['constructor']['name']==='ProviderClient'||_0x5e7d37['constructor']['name']==='Commander'){if('HSET'in _0x5e7d37)return'redis';}}}let _0x1d3030=null;if(Object['keys'](_0x5e7d37)['includes']('connection')||!isNaN(_0x5e7d37['totalCount'])&&!isNaN(_0x5e7d37['idleCount']))_0x1d3030='postgres';else{if(Object['keys'](_0x5e7d37)['includes']('Pipeline'))_0x1d3030='ioredis';else{if(Object['keys'](_0x5e7d37)['includes']('createClient'))_0x1d3030='redis';else _0x154123['constructor']['toString']()['includes']('NatsConnectionImpl')&&(_0x1d3030='nats');}}return _0x1d3030;}exports['identifyProvider']=identifyProvider,exports['polyfill']={'resolveActivityType'(_0x5000bf){return _0x5000bf==='activity'?'hook':_0x5000bf;},'providerConfig'(_0x37d3dc){return _0x37d3dc?.['connection']??_0x37d3dc?.['redis']??_0x37d3dc?.['connections'];},'meshDataConfig'(_0x215a51){return{..._0x215a51['connection']};}};function matchesStatusCode(_0x1c2a12,_0x28017b){if(typeof _0x28017b==='string'){const _0x2db424='^'+_0x28017b['replace'](/\*/g,'\x5cd')+'$';return new RegExp(_0x2db424)['test'](_0x1c2a12['toString']());}return _0x28017b['test'](_0x1c2a12['toString']());}exports['matchesStatusCode']=matchesStatusCode;function matchesStatus(_0x1eeb17,_0x2daaef){return _0x1eeb17===_0x2daaef;}exports['matchesStatus']=matchesStatus;function findTopKey(_0x1c1286,_0x27b0b4){for(const [_0x48e854,_0x2db75c]of Object['entries'](_0x1c1286)){if(_0x2db75c['hasOwnProperty'](_0x27b0b4)){const _0xe0a66c=findTopKey(_0x1c1286,_0x48e854['replace'](/^\./,''));return(_0xe0a66c||_0x48e854)['replace'](/^\./,'');}}return null;}exports['findTopKey']=findTopKey;function findSubscriptionForTrigger(_0x4e2208,_0x3c77af){for(const [_0x7f30b2,_0x2c5b42]of Object['entries'](_0x4e2208)){if(_0x2c5b42===_0x3c77af)return _0x7f30b2;}return null;}exports['findSubscriptionForTrigger']=findSubscriptionForTrigger;async function getSubscriptionTopic(_0xf9c115,_0x2e0f34,_0x435418){const _0x214cee=await _0x2e0f34['getTransitions'](_0x435418),_0x5cc93f=await _0x2e0f34['getSubscriptions'](_0x435418),_0x3d4e56=findTopKey(_0x214cee,_0xf9c115),_0x179088=findSubscriptionForTrigger(_0x5cc93f,_0x3d4e56);return _0x179088;}exports['getSubscriptionTopic']=getSubscriptionTopic;function getTimeSeries(_0x5dd000){if(_0x5dd000['toString']()==='infinity')return'0';const _0x9cbbea=new Date(),_0x2e6241=_0x5dd000['slice'](-0x1),_0x153620=parseInt(_0x5dd000['slice'](0x0,-0x1),0xa);if(_0x2e6241==='m'){const _0x2317e8=Math['floor'](_0x9cbbea['getMinutes']()/_0x153620)*_0x153620;_0x9cbbea['setUTCMinutes'](_0x2317e8,0x0,0x0);}else _0x2e6241==='h'&&_0x9cbbea['setUTCMinutes'](0x0,0x0,0x0);return _0x9cbbea['toISOString']()['replace'](/:\d\d\..+|-|T/g,'')['replace'](':','');}exports['getTimeSeries']=getTimeSeries;function formatISODate(_0x20a282){const _0x27498a=_0x20a282 instanceof Date?_0x20a282:new Date(_0x20a282);return _0x27498a['toISOString']()['replace'](/[:TZ-]/g,'');}exports['formatISODate']=formatISODate;function getSymKey(_0xb56d2f){const _0x24bd3b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x268729=_0x24bd3b['length'];if(_0xb56d2f<0x0||_0xb56d2f>=Math['pow'](_0x268729,0x3))throw new Error('Number\x20out\x20of\x20range');const [_0x5eae73,_0x2d80a3]=divmod(_0xb56d2f,_0x268729),[_0x5d93af,_0x59d7e1]=divmod(_0x5eae73,_0x268729);return _0x24bd3b[_0x5d93af]+_0x24bd3b[_0x2d80a3]+_0x24bd3b[_0x59d7e1];}exports['getSymKey']=getSymKey;function getSymVal(_0x165c47){const _0x59fbfe='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x570ab8=_0x59fbfe['length'];if(_0x165c47<0x0||_0x165c47>=Math['pow'](_0x570ab8,0x2))throw new Error('Number\x20out\x20of\x20range');const [_0x40eb29,_0x32f259]=divmod(_0x165c47,_0x570ab8);return _0x59fbfe[_0x40eb29]+_0x59fbfe[_0x32f259];}exports['getSymVal']=getSymVal;function divmod(_0x473e06,_0x5a2fc4){return[Math['floor'](_0x473e06/_0x5a2fc4),_0x473e06%_0x5a2fc4];}function _0x2a33(){const _0x5e3d23=['21eUKyta','2952792CAyqsO','7268148iqNBMF','69603ykYyDq','1923064lHkKEY','1110Inehtl','4203855gHvvni','1307PLhijM','136JEPVDf','4744611ZzyTdi','10zQxXoR'];_0x2a33=function(){return _0x5e3d23;};return _0x2a33();}function getIndexedHash(_0x302685,_0x5e7290){const _0x1ea2af=_0x302685[_0x5e7290]||0x0,_0x1d5119={..._0x302685};return delete _0x1d5119[_0x5e7290],[_0x1ea2af,_0x1d5119];}exports['getIndexedHash']=getIndexedHash;function getValueByPath(_0xd08797,_0x384985){const _0x1f040d=_0x384985['split']('/');let _0x38dad0=_0xd08797;for(const _0x3ddd3b of _0x1f040d){if(_0x38dad0[_0x3ddd3b]!==undefined)_0x38dad0=_0x38dad0[_0x3ddd3b];else return undefined;}return _0x38dad0;}exports['getValueByPath']=getValueByPath;function restoreHierarchy(_0x1b3349){const _0x4102fe={};for(const _0x48cb78 in _0x1b3349){if(_0x1b3349[_0x48cb78]===undefined)continue;const _0x473a31=_0x48cb78['split']('/');let _0x42a948=_0x4102fe;for(let _0x475371=0x0;_0x475371<_0x473a31['length'];_0x475371++){_0x475371===_0x473a31['length']-0x1?_0x42a948[_0x473a31[_0x475371]]=_0x1b3349[_0x48cb78]:(_0x42a948[_0x473a31[_0x475371]]=_0x42a948[_0x473a31[_0x475371]]||{},_0x42a948=_0x42a948[_0x473a31[_0x475371]]);}}return _0x4102fe;}exports['restoreHierarchy']=restoreHierarchy;function isValidCron(_0x56b8cc){const _0x4d57b2=/^(\*|([0-5]?\d)) (\*|([01]?\d|2[0-3])) (\*|([12]?\d|3[01])) (\*|([1-9]|1[0-2])) (\*|([0-6](?:-[0-6])?(?:,[0-6])?))$/;return _0x4d57b2['test'](_0x56b8cc);}exports['isValidCron']=isValidCron;const s=_0x220334=>{return(0x0,ms_1['default'])(_0x220334)/0x3e8;};exports['s']=s;const parseStreamMessage=_0x3ab92d=>{try{return JSON['parse'](_0x3ab92d);}catch(_0x2671a7){logger['error']('Error\x20parsing\x20Stream\x20message',{..._0x2671a7});throw _0x2671a7;}};exports['parseStreamMessage']=parseStreamMessage;const isStreamMessage=_0x183851=>{return Array['isArray'](_0x183851)&&Array['isArray'](_0x183851[0x0]);};exports['isStreamMessage']=isStreamMessage;const arrayToHash=_0x51f227=>{const _0x1d1c52=[];let _0x42af49;for(let _0x59966e=0x1;_0x59966e<_0x51f227['length'];_0x59966e++){const _0x5b4d6d=_0x51f227[_0x59966e],_0x9e1bf5={};if(Array['isArray'](_0x5b4d6d)){for(let _0x3e5625=0x0;_0x3e5625<_0x5b4d6d['length'];_0x3e5625+=0x2){const _0x10f177=_0x5b4d6d[_0x3e5625],_0x3c6179=_0x5b4d6d[_0x3e5625+0x1];_0x9e1bf5[_0x10f177]=_0x3c6179;}_0x42af49&&(_0x9e1bf5['$']=_0x42af49),_0x1d1c52['push'](_0x9e1bf5),_0x42af49=undefined;}else _0x42af49=_0x5b4d6d;}return _0x1d1c52;};exports['arrayToHash']=arrayToHash;
|
package/build/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Serverless Workflow",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"test:connect:nats": "NODE_ENV=test jest ./tests/unit/services/connector/providers/nats.test.ts --detectOpenHandles --forceExit --verbose",
|
|
28
28
|
"test:cycle": "NODE_ENV=test jest ./tests/functional/cycle/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
29
29
|
"test:meshflow": "NODE_ENV=test jest ./tests/meshflow/*/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
30
|
-
"test:meshflow:basic": "NODE_ENV=test jest ./tests/meshflow/basic/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
30
|
+
"test:meshflow:basic": "HMSH_LOGLEVEL=info NODE_ENV=test jest ./tests/meshflow/basic/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
31
31
|
"test:meshflow:collision": "NODE_ENV=test jest ./tests/meshflow/collision/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
32
32
|
"test:meshflow:fatal": "NODE_ENV=test jest ./tests/meshflow/fatal/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
33
33
|
"test:meshflow:goodbye": "NODE_ENV=test jest ./tests/meshflow/goodbye/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
34
34
|
"test:meshflow:hello": "HMSH_LOGLEVEL=debug HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/meshflow/helloworld/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
35
35
|
"test:meshflow:hook": "NODE_ENV=test jest ./tests/meshflow/hook/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
36
36
|
"test:meshflow:interrupt": "NODE_ENV=test jest ./tests/meshflow/interrupt/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
37
|
-
"test:meshflow:loopactivity": "NODE_ENV=test jest ./tests/meshflow/loopactivity
|
|
37
|
+
"test:meshflow:loopactivity": "NODE_ENV=test jest ./tests/meshflow/loopactivity/I.test.ts --detectOpenHandles --forceExit --verbose",
|
|
38
38
|
"test:meshflow:nested": "NODE_ENV=test jest ./tests/meshflow/nested/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
39
39
|
"test:meshflow:retry": "NODE_ENV=test jest ./tests/meshflow/retry/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
40
40
|
"test:meshflow:sleep": "NODE_ENV=test jest ./tests/meshflow/sleep/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
@@ -68,8 +68,9 @@
|
|
|
68
68
|
"test:sub:ioredis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
69
69
|
"test:sub:redis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/redis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
70
70
|
"test:sub:postgres": "NODE_ENV=test jest ./tests/functional/sub/providers/postgres/postgres.test.ts --detectOpenHandles --forceExit --verbose",
|
|
71
|
+
"test:sub:nats": "NODE_ENV=test jest ./tests/functional/sub/providers/nats/nats.test.ts --detectOpenHandles --forceExit --verbose",
|
|
71
72
|
"test:trigger": "NODE_ENV=test jest ./tests/unit/services/activities/trigger.test.ts --detectOpenHandles --forceExit --verbose",
|
|
72
|
-
"test:meshdata": "NODE_ENV=test jest ./tests/meshdata
|
|
73
|
+
"test:meshdata": "NODE_ENV=test jest ./tests/meshdata/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
73
74
|
"test:meshos": "NODE_ENV=test HMSH_IS_CLUSTER=true jest ./tests/meshos/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
74
75
|
"test:meshcall": "NODE_ENV=test jest ./tests/meshcall/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
75
76
|
"test:unit": "NODE_ENV=test jest ./tests/unit/*/*/index.test.ts --detectOpenHandles --forceExit --verbose"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(_0x4ab29a,_0x3efde0){const _0x48711b=_0xa152,_0xcaefb7=_0x4ab29a();while(!![]){try{const _0x48bb84=parseInt(_0x48711b(0x189))/0x1*(-parseInt(_0x48711b(0x187))/0x2)+parseInt(_0x48711b(0x18a))/0x3+parseInt(_0x48711b(0x18b))/0x4*(-parseInt(_0x48711b(0x18d))/0x5)+parseInt(_0x48711b(0x188))/0x6*(-parseInt(_0x48711b(0x18f))/0x7)+-parseInt(_0x48711b(0x18e))/0x8*(parseInt(_0x48711b(0x185))/0x9)+parseInt(_0x48711b(0x18c))/0xa+parseInt(_0x48711b(0x186))/0xb;if(_0x48bb84===_0x3efde0)break;else _0xcaefb7['push'](_0xcaefb7['shift']());}catch(_0x27c6da){_0xcaefb7['push'](_0xcaefb7['shift']());}}}(_0x3f59,0x50922));function _0x3f59(){const _0x90ad2c=['232RBlSjV','204iZllts','1459OhTZYl','659250WJpCFr','4ryGbDc','1034100DLyzmc','1285945wUfujt','14688MeRizQ','123277JcVRuW','2961iylkMP','17997199gqXbyO'];_0x3f59=function(){return _0x90ad2c;};return _0x3f59();}function _0xa152(_0x29e366,_0x50a888){const _0x3f593b=_0x3f59();return _0xa152=function(_0xa1527a,_0x2d0611){_0xa1527a=_0xa1527a-0x185;let _0x4257ae=_0x3f593b[_0xa1527a];return _0x4257ae;},_0xa152(_0x29e366,_0x50a888);}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Activity']=void 0x0;const enums_1=require('../../modules/enums'),errors_1=require('../../modules/errors'),utils_1=require('../../modules/utils'),collator_1=require('../collator'),mapper_1=require('../mapper'),pipe_1=require('../pipe'),serializer_1=require('../serializer'),telemetry_1=require('../telemetry'),stream_1=require('../../types/stream');class Activity{constructor(_0x72cdd9,_0xf75cb,_0x30015b,_0x140327,_0x25be58,_0xd953fc){this['status']=stream_1['StreamStatus']['SUCCESS'],this['code']=0xc8,this['adjacentIndex']=0x0,this['config']=_0x72cdd9,this['data']=_0xf75cb,this['metadata']=_0x30015b,this['hook']=_0x140327,this['engine']=_0x25be58,this['context']=_0xd953fc||{'data':{},'metadata':{}},this['logger']=_0x25be58['logger'],this['store']=_0x25be58['store'];}['setLeg'](_0x234623){this['leg']=_0x234623;}['mapStatusThreshold'](){if(this['config']['statusThreshold']!==undefined){const _0x14ac3e=pipe_1['Pipe']['resolve'](this['config']['statusThreshold'],this['context']);if(_0x14ac3e!==undefined&&!isNaN(Number(_0x14ac3e)))return _0x14ac3e;}return 0x0;}async['verifyEntry'](){this['setLeg'](0x1),await this['getState']();const _0x1936a4=this['mapStatusThreshold']();try{collator_1['CollatorService']['assertJobActive'](this['context']['metadata']['js'],this['context']['metadata']['jid'],this['metadata']['aid'],_0x1936a4);}catch(_0x3017b6){await collator_1['CollatorService']['notarizeEntry'](this);if(_0x1936a4>0x0){if(this['context']['metadata']['js']===_0x1936a4){const _0x5a5301=await this['setStatus'](-_0x1936a4);Number(_0x5a5301)===0x0&&await this['engine']['runJobCompletionTasks'](this['context']);}}else throw _0x3017b6;return;}await collator_1['CollatorService']['notarizeEntry'](this);}async['verifyReentry'](){const _0x3ebca5=this['context']['metadata']['guid'];return this['setLeg'](0x2),await this['getState'](),collator_1['CollatorService']['assertJobActive'](this['context']['metadata']['js'],this['context']['metadata']['jid'],this['metadata']['aid']),await collator_1['CollatorService']['notarizeReentry'](this,_0x3ebca5);}async['processEvent'](_0x1c4043=stream_1['StreamStatus']['SUCCESS'],_0x177106=0xc8,_0x58c75f='output'){this['setLeg'](0x2);const _0x163724=this['context']['metadata']['jid'];if(!_0x163724){this['logger']['error']('activity-process-event-error',{'message':'job\x20id\x20is\x20undefined'});return;}const _0x3bfd1a=this['metadata']['aid'];this['status']=_0x1c4043,this['code']=_0x177106,this['logger']['debug']('activity-process-event',{'topic':this['config']['subtype'],'jid':_0x163724,'aid':_0x3bfd1a,'status':_0x1c4043,'code':_0x177106});let _0x53c987;try{const _0x1136dc=await this['verifyReentry']();this['adjacentIndex']=collator_1['CollatorService']['getDimensionalIndex'](_0x1136dc),_0x53c987=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x53c987['startActivitySpan'](this['leg']);let _0x37b5ba;if(_0x1c4043===stream_1['StreamStatus']['PENDING'])_0x37b5ba=await this['processPending'](_0x58c75f);else _0x1c4043===stream_1['StreamStatus']['SUCCESS']?_0x37b5ba=await this['processSuccess'](_0x58c75f):_0x37b5ba=await this['processError']();this['transitionAdjacent'](_0x37b5ba,_0x53c987);}catch(_0x199e89){if(_0x199e89 instanceof errors_1['CollationError']){this['logger']['info']('process-event-'+_0x199e89['fault']+'-error',{..._0x199e89});return;}else{if(_0x199e89 instanceof errors_1['InactiveJobError']){this['logger']['info']('process-event-inactive-job-error',{..._0x199e89});return;}else{if(_0x199e89 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x199e89});return;}else{if(_0x199e89 instanceof errors_1['GetStateError']){this['logger']['info']('process-event-get-job-error',{..._0x199e89});return;}}}}this['logger']['error']('activity-process-event-error',{..._0x199e89,'message':_0x199e89['message'],'stack':_0x199e89['stack'],'name':_0x199e89['name']}),_0x53c987?.['setActivityError'](_0x199e89['message']);throw _0x199e89;}finally{_0x53c987?.['endActivitySpan'](),this['logger']['debug']('activity-process-event-end',{'jid':_0x163724,'aid':_0x3bfd1a});}}async['processPending'](_0x40eee8){this['bindActivityData'](_0x40eee8),this['adjacencyList']=await this['filterAdjacent'](),this['mapJobData']();const _0x385ba2=this['store']['transact']();return await this['setState'](_0x385ba2),await collator_1['CollatorService']['notarizeContinuation'](this,_0x385ba2),await this['setStatus'](this['adjacencyList']['length'],_0x385ba2),await _0x385ba2['exec']();}async['processSuccess'](_0x1618cf){this['bindActivityData'](_0x1618cf),this['adjacencyList']=await this['filterAdjacent'](),this['mapJobData']();const _0x77765a=this['store']['transact']();return await this['setState'](_0x77765a),await collator_1['CollatorService']['notarizeCompletion'](this,_0x77765a),await this['setStatus'](this['adjacencyList']['length']-0x1,_0x77765a),await _0x77765a['exec']();}async['processError'](){this['bindActivityError'](this['data']),this['adjacencyList']=await this['filterAdjacent']();!this['adjacencyList']['length']&&this['bindJobError'](this['data']);this['mapJobData']();const _0x5afb91=this['store']['transact']();return await this['setState'](_0x5afb91),await collator_1['CollatorService']['notarizeCompletion'](this,_0x5afb91),await this['setStatus'](this['adjacencyList']['length']-0x1,_0x5afb91),await _0x5afb91['exec']();}async['transitionAdjacent'](_0x431f70,_0x664f0){_0x664f0['mapActivityAttributes']();const _0x4707dd=this['resolveStatus'](_0x431f70),_0x2cc242={'app.job.jss':_0x4707dd},_0x35bd95=await this['transition'](this['adjacencyList'],_0x4707dd);_0x35bd95?.['length']&&(_0x2cc242['app.activity.mids']=_0x35bd95['join'](',')),_0x664f0['setActivityAttributes'](_0x2cc242);}['resolveStatus'](_0x4a4795){const _0x4ce38b=_0x4a4795[_0x4a4795['length']-0x1];return Array['isArray'](_0x4ce38b)?Number(_0x4ce38b[0x1]):Number(_0x4ce38b);}['mapJobData'](){if(this['config']['job']?.['maps']){const _0x465d2c=new mapper_1['MapperService']((0x0,utils_1['deepCopy'])(this['config']['job']['maps']),this['context']),_0x384cee=_0x465d2c['mapRules']();if(_0x384cee)for(const _0x3d97ad in _0x384cee){const _0x1aebd0=_0x3d97ad['indexOf']('[');if(_0x1aebd0>-0x1){const _0x46c7f3=_0x3d97ad['substring'](_0x1aebd0+0x1)['split'](']')[0x0];if(!isNaN(Number(_0x46c7f3))){const _0x177e96=_0x3d97ad['substring'](0x0,_0x1aebd0);_0x384cee[_0x177e96]=_0x384cee[_0x3d97ad],delete _0x384cee[_0x3d97ad];}else{if(_0x46c7f3==='-'||_0x46c7f3==='_'){const _0x3c9f11=_0x384cee[_0x3d97ad];Object['keys'](_0x3c9f11)['forEach'](_0x53e4f9=>{_0x384cee[_0x53e4f9]=_0x3c9f11[_0x53e4f9];});}}}}this['context']['data']=_0x384cee;}}['mapInputData'](){if(this['config']['input']?.['maps']){const _0x17aaf5=new mapper_1['MapperService']((0x0,utils_1['deepCopy'])(this['config']['input']['maps']),this['context']);this['context']['data']=_0x17aaf5['mapRules']();}}['mapOutputData'](){if(this['config']['output']?.['maps']){const _0x1d0e30=new mapper_1['MapperService']((0x0,utils_1['deepCopy'])(this['config']['output']['maps']),this['context']),_0x85bb6b=_0x1d0e30['mapRules'](),_0x2aa761=this['metadata']['aid'],_0x26d243={...this['context'][_0x2aa761]['output'],..._0x85bb6b};this['context'][_0x2aa761]['output']['data']=_0x26d243;}}async['registerTimeout'](){}['bindActivityError'](_0x3c4b3f){const _0x1c8abe=this['context'][this['metadata']['aid']]['output']['metadata'];_0x1c8abe['err']=JSON['stringify'](this['data']),_0x1c8abe['$error']={..._0x3c4b3f,'is_stream_error':!![]};}['bindJobError'](_0x243af5){this['context']['metadata']['err']=JSON['stringify']({..._0x243af5,'is_stream_error':!![]});}async['getTriggerConfig'](){return await this['store']['getSchema'](this['config']['trigger'],await this['engine']['getVID']());}['getJobStatus'](){return null;}async['setStatus'](_0x4a52d3,_0x1be6f4){const {id:_0x422e13}=await this['engine']['getVID']();return await this['store']['setStatus'](_0x4a52d3,this['context']['metadata']['jid'],_0x422e13,_0x1be6f4);}['authorizeEntry'](_0x5a294d){return this['adjacencyList']?.['map'](_0x2cfbb9=>{const {metadata:{aid:_0x4443bf}}=_0x2cfbb9;return _0x5a294d[_0x4443bf+'/output/metadata/as']=collator_1['CollatorService']['getSeed'](),_0x4443bf;})??[];}['bindDimensionalAddress'](_0x4595c1){const _0x363b43=this['resolveDad']();_0x4595c1[this['metadata']['aid']+'/output/metadata/dad']=_0x363b43;}async['setState'](_0x199dd2){const _0x10bc52=this['context']['metadata']['jid'];this['bindJobMetadata'](),this['bindActivityMetadata']();const _0x1d155a={};await this['bindJobState'](_0x1d155a);const _0x2170f5=this['authorizeEntry'](_0x1d155a);this['bindDimensionalAddress'](_0x1d155a),this['bindActivityState'](_0x1d155a);const _0x3add3c=['$'+this['config']['subscribes'],this['metadata']['aid'],..._0x2170f5],_0x286f1d=collator_1['CollatorService']['getDimensionsById']([...this['config']['ancestors'],this['metadata']['aid']],this['resolveDad']());return await this['store']['setState'](_0x1d155a,this['getJobStatus'](),_0x10bc52,_0x3add3c,_0x286f1d,_0x199dd2);}['bindJobMetadata'](){this['context']['metadata']['ju']=(0x0,utils_1['formatISODate'])(new Date());}['bindActivityMetadata'](){const _0x56785e=this['context']['$self'];!_0x56785e['output']['metadata']&&(_0x56785e['output']['metadata']={});this['status']===stream_1['StreamStatus']['ERROR']&&(_0x56785e['output']['metadata']['err']=JSON['stringify'](this['data']));const _0x423cfe=(0x0,utils_1['formatISODate'])(new Date());_0x56785e['output']['metadata']['ac']=_0x423cfe,_0x56785e['output']['metadata']['au']=_0x423cfe,_0x56785e['output']['metadata']['atp']=this['config']['type'],this['config']['subtype']&&(_0x56785e['output']['metadata']['stp']=this['config']['subtype']),_0x56785e['output']['metadata']['aid']=this['metadata']['aid'];}async['bindJobState'](_0x597ad0){const _0x1e6516=await this['getTriggerConfig'](),_0x4b9df0=[..._0x1e6516['PRODUCES']||[],...this['bindJobMetadataPaths']()];for(const _0x43baa1 of _0x4b9df0){const _0x390b53=(0x0,utils_1['getValueByPath'])(this['context'],_0x43baa1);_0x390b53!==undefined&&(_0x597ad0[_0x43baa1]=_0x390b53);}for(const _0x241c8a in this['context']?.['data']??{}){(_0x241c8a['startsWith']('-')||_0x241c8a['startsWith']('_'))&&(_0x597ad0[_0x241c8a]=this['context']['data'][_0x241c8a]);}telemetry_1['TelemetryService']['bindJobTelemetryToState'](_0x597ad0,this['config'],this['context']);}['bindActivityState'](_0xfa3084){const _0x2f0873=[...this['config']['produces'],...this['bindActivityMetadataPaths']()];for(const _0x1cdd0e of _0x2f0873){const _0x2d1928=this['metadata']['aid']+'/'+_0x1cdd0e,_0x3d7622=(0x0,utils_1['getValueByPath'])(this['context'],_0x2d1928);_0x3d7622!==undefined&&(_0xfa3084[_0x2d1928]=_0x3d7622);}telemetry_1['TelemetryService']['bindActivityTelemetryToState'](_0xfa3084,this['config'],this['metadata'],this['context'],this['leg']);}['bindJobMetadataPaths'](){return serializer_1['MDATA_SYMBOLS']['JOB_UPDATE']['KEYS']['map'](_0x35a5d0=>'metadata/'+_0x35a5d0);}['bindActivityMetadataPaths'](){const _0x5a1dbc=this['leg']===0x1?'ACTIVITY':'ACTIVITY_UPDATE';return serializer_1['MDATA_SYMBOLS'][_0x5a1dbc]['KEYS']['map'](_0x2f2d73=>'output/metadata/'+_0x2f2d73);}async['getState'](){const _0x35848c=this['context']['metadata']['gid'],_0x448fbe='$'+this['config']['subscribes'],_0x576eac={[_0x448fbe]:serializer_1['MDATA_SYMBOLS']['JOB']['KEYS']['map'](_0x6c8306=>'metadata/'+_0x6c8306)};for(let [_0xb9f04,_0x3ac0c2]of Object['entries'](this['config']['consumes'])){if(_0xb9f04==='$job')for(const _0x4179ed of _0x3ac0c2){_0x576eac[_0x448fbe]['push'](_0x4179ed);}else{_0xb9f04==='$self'&&(_0xb9f04=this['metadata']['aid']);!_0x576eac[_0xb9f04]&&(_0x576eac[_0xb9f04]=[]);for(const _0x2599e3 of _0x3ac0c2){_0x576eac[_0xb9f04]['push'](_0xb9f04+'/'+_0x2599e3);}}}telemetry_1['TelemetryService']['addTargetTelemetryPaths'](_0x576eac,this['config'],this['metadata'],this['leg']);const {dad:_0x2c5104,jid:_0x12421a}=this['context']['metadata'],_0x59dd07=collator_1['CollatorService']['getDimensionsById']([...this['config']['ancestors'],this['metadata']['aid']],_0x2c5104||''),[_0x4bb766,_0x52a4e3]=await this['store']['getState'](_0x12421a,_0x576eac,_0x59dd07);this['context']=(0x0,utils_1['restoreHierarchy'])(_0x4bb766),this['assertGenerationalId'](this['context']?.['metadata']?.['gid'],_0x35848c),this['initDimensionalAddress'](_0x2c5104),this['initSelf'](this['context']),this['initPolicies'](this['context']);}['assertGenerationalId'](_0x504d07,_0x1aa77e){if(_0x1aa77e!==_0x504d07)throw new errors_1['GenerationalError'](_0x504d07,_0x1aa77e,this['context']?.['metadata']?.['jid']??'',this['context']?.['metadata']?.['aid']??'',this['context']?.['metadata']?.['dad']??'');}['initDimensionalAddress'](_0xdf30ee){this['metadata']['dad']=_0xdf30ee;}['initSelf'](_0x16bb85){const _0x5d6bbc=this['metadata']['aid'];!_0x16bb85[_0x5d6bbc]&&(_0x16bb85[_0x5d6bbc]={});const _0x61e5b3=_0x16bb85[_0x5d6bbc];return!_0x61e5b3['output']&&(_0x61e5b3['output']={}),!_0x61e5b3['input']&&(_0x61e5b3['input']={}),!_0x61e5b3['hook']&&(_0x61e5b3['hook']={}),!_0x61e5b3['output']['metadata']&&(_0x61e5b3['output']['metadata']={}),_0x61e5b3['output']['metadata']['au']=(0x0,utils_1['formatISODate'])(new Date()),_0x16bb85['$self']=_0x61e5b3,_0x16bb85['$job']=_0x16bb85,_0x16bb85;}['initPolicies'](_0x57a3e0){const _0x151aa2=pipe_1['Pipe']['resolve'](this['config']['expire']??enums_1['HMSH_EXPIRE_DURATION'],_0x57a3e0);_0x57a3e0['metadata']['expire']=_0x151aa2;if(this['config']['persistent']!=undefined){const _0xdafcea=pipe_1['Pipe']['resolve'](this['config']['persistent']??![],_0x57a3e0);_0x57a3e0['metadata']['persistent']=_0xdafcea;}}['bindActivityData'](_0x569893){this['context'][this['metadata']['aid']][_0x569893]['data']=this['data'];}['resolveDad'](){let _0x41875a=this['metadata']['dad'];return this['adjacentIndex']>0x0&&(_0x41875a=_0x41875a['substring'](0x0,_0x41875a['lastIndexOf'](','))+','+this['adjacentIndex']),_0x41875a;}['resolveAdjacentDad'](){return''+this['resolveDad']()+collator_1['CollatorService']['getDimensionalSeed'](0x0);}async['filterAdjacent'](){const _0x58863e=[],_0x2d8502=await this['store']['getTransitions'](await this['engine']['getVID']()),_0xd0a561=_0x2d8502['.'+this['metadata']['aid']],_0x42c0e2=this['resolveAdjacentDad']();if(_0xd0a561)for(const _0x3ebb81 in _0xd0a561){const _0x46b275=_0xd0a561[_0x3ebb81];mapper_1['MapperService']['evaluate'](_0x46b275,this['context'],this['code'])&&_0x58863e['push']({'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'dad':_0x42c0e2,'aid':_0x3ebb81,'spn':this['context']['$self']['output']['metadata']?.['l2s'],'trc':this['context']['metadata']['trc']},'type':stream_1['StreamDataType']['TRANSITION'],'data':{}});}return _0x58863e;}['isJobComplete'](_0x532f32){return _0x532f32<=0x0;}['shouldEmit'](){if(this['config']['emit'])return pipe_1['Pipe']['resolve'](this['config']['emit'],this['context'])===!![];return![];}['shouldPersistJob'](){if(this['config']['persist']!==undefined)return pipe_1['Pipe']['resolve'](this['config']['persist'],this['context'])===!![];return![];}async['transition'](_0x2e0f9f,_0x1039de){if(this['jobWasInterrupted'](_0x1039de))return;let _0x115f37=[];(this['shouldEmit']()||this['isJobComplete'](_0x1039de)||this['shouldPersistJob']())&&await this['engine']['runJobCompletionTasks'](this['context'],{'emit':!this['isJobComplete'](_0x1039de)&&!this['shouldPersistJob']()});if(_0x2e0f9f['length']&&!this['isJobComplete'](_0x1039de)){const _0x5a5a58=this['store']['transact']();for(const _0x173119 of _0x2e0f9f){await this['engine']['router']?.['publishMessage'](null,_0x173119,_0x5a5a58);}_0x115f37=await _0x5a5a58['exec']();}return _0x115f37;}['jobWasInterrupted'](_0x568989){return _0x568989<-0x5f5e100;}}exports['Activity']=Activity;
|
|
1
|
+
'use strict';(function(_0x7239e3,_0x211c3f){const _0x13831b=_0x2cf1,_0x5c3d3e=_0x7239e3();while(!![]){try{const _0x1f72c4=parseInt(_0x13831b(0x15d))/0x1+-parseInt(_0x13831b(0x15e))/0x2*(parseInt(_0x13831b(0x15f))/0x3)+parseInt(_0x13831b(0x160))/0x4+parseInt(_0x13831b(0x161))/0x5+-parseInt(_0x13831b(0x163))/0x6+parseInt(_0x13831b(0x162))/0x7+-parseInt(_0x13831b(0x164))/0x8;if(_0x1f72c4===_0x211c3f)break;else _0x5c3d3e['push'](_0x5c3d3e['shift']());}catch(_0x33b59d){_0x5c3d3e['push'](_0x5c3d3e['shift']());}}}(_0x1fe2,0x44669));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Activity']=void 0x0;const enums_1=require('../../modules/enums'),errors_1=require('../../modules/errors'),utils_1=require('../../modules/utils'),collator_1=require('../collator'),mapper_1=require('../mapper'),pipe_1=require('../pipe'),serializer_1=require('../serializer'),telemetry_1=require('../telemetry'),stream_1=require('../../types/stream');function _0x2cf1(_0x5dcbdd,_0x2ad6e0){const _0x1fe2d8=_0x1fe2();return _0x2cf1=function(_0x2cf1e7,_0xfd33ee){_0x2cf1e7=_0x2cf1e7-0x15d;let _0x5bea8e=_0x1fe2d8[_0x2cf1e7];return _0x5bea8e;},_0x2cf1(_0x5dcbdd,_0x2ad6e0);}class Activity{constructor(_0x55a9ce,_0x1fa7ef,_0x407e26,_0x41f0d0,_0x37a2bc,_0xdbea53){this['status']=stream_1['StreamStatus']['SUCCESS'],this['code']=0xc8,this['adjacentIndex']=0x0,this['config']=_0x55a9ce,this['data']=_0x1fa7ef,this['metadata']=_0x407e26,this['hook']=_0x41f0d0,this['engine']=_0x37a2bc,this['context']=_0xdbea53||{'data':{},'metadata':{}},this['logger']=_0x37a2bc['logger'],this['store']=_0x37a2bc['store'];}['setLeg'](_0x46be97){this['leg']=_0x46be97;}['mapStatusThreshold'](){if(this['config']['statusThreshold']!==undefined){const _0xadfad6=pipe_1['Pipe']['resolve'](this['config']['statusThreshold'],this['context']);if(_0xadfad6!==undefined&&!isNaN(Number(_0xadfad6)))return _0xadfad6;}return 0x0;}async['verifyEntry'](){this['setLeg'](0x1),await this['getState']();const _0x392696=this['mapStatusThreshold']();try{collator_1['CollatorService']['assertJobActive'](this['context']['metadata']['js'],this['context']['metadata']['jid'],this['metadata']['aid'],_0x392696);}catch(_0x1c2ed5){await collator_1['CollatorService']['notarizeEntry'](this);if(_0x392696>0x0){if(this['context']['metadata']['js']===_0x392696){const _0x5b4c9c=await this['setStatus'](-_0x392696);Number(_0x5b4c9c)===0x0&&await this['engine']['runJobCompletionTasks'](this['context']);}}else throw _0x1c2ed5;return;}await collator_1['CollatorService']['notarizeEntry'](this);}async['verifyReentry'](){const _0xde12fb=this['context']['metadata']['guid'];return this['setLeg'](0x2),await this['getState'](),collator_1['CollatorService']['assertJobActive'](this['context']['metadata']['js'],this['context']['metadata']['jid'],this['metadata']['aid']),await collator_1['CollatorService']['notarizeReentry'](this,_0xde12fb);}async['processEvent'](_0x5916bd=stream_1['StreamStatus']['SUCCESS'],_0x2a2d33=0xc8,_0x1e8a93='output'){this['setLeg'](0x2);const _0x2a02b9=this['context']['metadata']['jid'];if(!_0x2a02b9){this['logger']['error']('activity-process-event-error',{'message':'job\x20id\x20is\x20undefined'});return;}const _0x407eeb=this['metadata']['aid'];this['status']=_0x5916bd,this['code']=_0x2a2d33,this['logger']['debug']('activity-process-event',{'topic':this['config']['subtype'],'jid':_0x2a02b9,'aid':_0x407eeb,'status':_0x5916bd,'code':_0x2a2d33});let _0x3057f9;try{const _0x56fe50=await this['verifyReentry']();this['adjacentIndex']=collator_1['CollatorService']['getDimensionalIndex'](_0x56fe50),_0x3057f9=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x3057f9['startActivitySpan'](this['leg']);let _0x59dcfc;if(_0x5916bd===stream_1['StreamStatus']['PENDING'])_0x59dcfc=await this['processPending'](_0x1e8a93);else _0x5916bd===stream_1['StreamStatus']['SUCCESS']?_0x59dcfc=await this['processSuccess'](_0x1e8a93):_0x59dcfc=await this['processError']();this['transitionAdjacent'](_0x59dcfc,_0x3057f9);}catch(_0x3a5901){if(_0x3a5901 instanceof errors_1['CollationError']){this['logger']['info']('process-event-'+_0x3a5901['fault']+'-error',{..._0x3a5901});return;}else{if(_0x3a5901 instanceof errors_1['InactiveJobError']){this['logger']['info']('process-event-inactive-job-error',{..._0x3a5901});return;}else{if(_0x3a5901 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x3a5901});return;}else{if(_0x3a5901 instanceof errors_1['GetStateError']){this['logger']['info']('process-event-get-job-error',{..._0x3a5901});return;}}}}this['logger']['error']('activity-process-event-error',{..._0x3a5901,'message':_0x3a5901['message'],'stack':_0x3a5901['stack'],'name':_0x3a5901['name']}),_0x3057f9?.['setActivityError'](_0x3a5901['message']);throw _0x3a5901;}finally{_0x3057f9?.['endActivitySpan'](),this['logger']['debug']('activity-process-event-end',{'jid':_0x2a02b9,'aid':_0x407eeb});}}async['processPending'](_0x2a6270){this['bindActivityData'](_0x2a6270),this['adjacencyList']=await this['filterAdjacent'](),this['mapJobData']();const _0xa3e4c1=this['store']['transact']();return await this['setState'](_0xa3e4c1),await collator_1['CollatorService']['notarizeContinuation'](this,_0xa3e4c1),await this['setStatus'](this['adjacencyList']['length'],_0xa3e4c1),await _0xa3e4c1['exec']();}async['processSuccess'](_0x253cbd){this['bindActivityData'](_0x253cbd),this['adjacencyList']=await this['filterAdjacent'](),this['mapJobData']();const _0x459ca8=this['store']['transact']();return await this['setState'](_0x459ca8),await collator_1['CollatorService']['notarizeCompletion'](this,_0x459ca8),await this['setStatus'](this['adjacencyList']['length']-0x1,_0x459ca8),await _0x459ca8['exec']();}async['processError'](){this['bindActivityError'](this['data']),this['adjacencyList']=await this['filterAdjacent']();!this['adjacencyList']['length']&&this['bindJobError'](this['data']);this['mapJobData']();const _0x20ea1b=this['store']['transact']();return await this['setState'](_0x20ea1b),await collator_1['CollatorService']['notarizeCompletion'](this,_0x20ea1b),await this['setStatus'](this['adjacencyList']['length']-0x1,_0x20ea1b),await _0x20ea1b['exec']();}async['transitionAdjacent'](_0x54e023,_0x412b16){_0x412b16['mapActivityAttributes']();const _0x2a02e5=this['resolveStatus'](_0x54e023),_0x73ee30={'app.job.jss':_0x2a02e5},_0x208d5d=await this['transition'](this['adjacencyList'],_0x2a02e5);_0x208d5d?.['length']&&(_0x73ee30['app.activity.mids']=_0x208d5d['join'](',')),_0x412b16['setActivityAttributes'](_0x73ee30);}['resolveStatus'](_0x15cfc0){const _0x116d1f=_0x15cfc0[_0x15cfc0['length']-0x1];return Array['isArray'](_0x116d1f)?Number(_0x116d1f[0x1]):Number(_0x116d1f);}['mapJobData'](){if(this['config']['job']?.['maps']){const _0x247c49=new mapper_1['MapperService']((0x0,utils_1['deepCopy'])(this['config']['job']['maps']),this['context']),_0x32df9b=_0x247c49['mapRules']();if(_0x32df9b)for(const _0x1c478c in _0x32df9b){const _0x13f701=_0x1c478c['indexOf']('[');if(_0x13f701>-0x1){const _0x144b4b=_0x1c478c['substring'](_0x13f701+0x1)['split'](']')[0x0];if(!isNaN(Number(_0x144b4b))){const _0x12cbc1=_0x1c478c['substring'](0x0,_0x13f701);_0x32df9b[_0x12cbc1]=_0x32df9b[_0x1c478c],delete _0x32df9b[_0x1c478c];}else{if(_0x144b4b==='-'||_0x144b4b==='_'){const _0x500e7f=_0x32df9b[_0x1c478c];Object['keys'](_0x500e7f)['forEach'](_0x4a526e=>{_0x32df9b[_0x4a526e]=_0x500e7f[_0x4a526e];});}}}}this['context']['data']=_0x32df9b;}}['mapInputData'](){if(this['config']['input']?.['maps']){const _0x27e256=new mapper_1['MapperService']((0x0,utils_1['deepCopy'])(this['config']['input']['maps']),this['context']);this['context']['data']=_0x27e256['mapRules']();}}['mapOutputData'](){if(this['config']['output']?.['maps']){const _0x557300=new mapper_1['MapperService']((0x0,utils_1['deepCopy'])(this['config']['output']['maps']),this['context']),_0x4e2321=_0x557300['mapRules'](),_0x3c34ee=this['metadata']['aid'],_0xc440d0={...this['context'][_0x3c34ee]['output'],..._0x4e2321};this['context'][_0x3c34ee]['output']['data']=_0xc440d0;}}async['registerTimeout'](){}['bindActivityError'](_0xccf76d){const _0x12bf37=this['context'][this['metadata']['aid']]['output']['metadata'];_0x12bf37['err']=JSON['stringify'](this['data']),_0x12bf37['$error']={..._0xccf76d,'is_stream_error':!![]};}['bindJobError'](_0x39566b){this['context']['metadata']['err']=JSON['stringify']({..._0x39566b,'is_stream_error':!![]});}async['getTriggerConfig'](){return await this['store']['getSchema'](this['config']['trigger'],await this['engine']['getVID']());}['getJobStatus'](){return null;}async['setStatus'](_0x4a94b0,_0x245bf9){const {id:_0x37cab8}=await this['engine']['getVID']();return await this['store']['setStatus'](_0x4a94b0,this['context']['metadata']['jid'],_0x37cab8,_0x245bf9);}['authorizeEntry'](_0x376c43){return this['adjacencyList']?.['map'](_0x246a94=>{const {metadata:{aid:_0x43a665}}=_0x246a94;return _0x376c43[_0x43a665+'/output/metadata/as']=collator_1['CollatorService']['getSeed'](),_0x43a665;})??[];}['bindDimensionalAddress'](_0x44b3fe){const _0x1be944=this['resolveDad']();_0x44b3fe[this['metadata']['aid']+'/output/metadata/dad']=_0x1be944;}async['setState'](_0x1e38e4){const _0x4765b3=this['context']['metadata']['jid'];this['bindJobMetadata'](),this['bindActivityMetadata']();const _0x200454={};await this['bindJobState'](_0x200454);const _0x415abc=this['authorizeEntry'](_0x200454);this['bindDimensionalAddress'](_0x200454),this['bindActivityState'](_0x200454);const _0x301be0=['$'+this['config']['subscribes'],this['metadata']['aid'],..._0x415abc],_0x24bd65=collator_1['CollatorService']['getDimensionsById']([...this['config']['ancestors'],this['metadata']['aid']],this['resolveDad']());return await this['store']['setState'](_0x200454,this['getJobStatus'](),_0x4765b3,_0x301be0,_0x24bd65,_0x1e38e4);}['bindJobMetadata'](){this['context']['metadata']['ju']=(0x0,utils_1['formatISODate'])(new Date());}['bindActivityMetadata'](){const _0x24b394=this['context']['$self'];!_0x24b394['output']['metadata']&&(_0x24b394['output']['metadata']={});this['status']===stream_1['StreamStatus']['ERROR']&&(_0x24b394['output']['metadata']['err']=JSON['stringify'](this['data']));const _0x545af5=(0x0,utils_1['formatISODate'])(new Date());_0x24b394['output']['metadata']['ac']=_0x545af5,_0x24b394['output']['metadata']['au']=_0x545af5,_0x24b394['output']['metadata']['atp']=this['config']['type'],this['config']['subtype']&&(_0x24b394['output']['metadata']['stp']=this['config']['subtype']),_0x24b394['output']['metadata']['aid']=this['metadata']['aid'];}async['bindJobState'](_0x1ca533){const _0x2c4057=await this['getTriggerConfig'](),_0x73605a=[..._0x2c4057['PRODUCES']||[],...this['bindJobMetadataPaths']()];for(const _0x511349 of _0x73605a){const _0x36996a=(0x0,utils_1['getValueByPath'])(this['context'],_0x511349);_0x36996a!==undefined&&(_0x1ca533[_0x511349]=_0x36996a);}for(const _0x3d0e83 in this['context']?.['data']??{}){(_0x3d0e83['startsWith']('-')||_0x3d0e83['startsWith']('_'))&&(_0x1ca533[_0x3d0e83]=this['context']['data'][_0x3d0e83]);}telemetry_1['TelemetryService']['bindJobTelemetryToState'](_0x1ca533,this['config'],this['context']);}['bindActivityState'](_0x499c09){const _0x590fd6=[...this['config']['produces'],...this['bindActivityMetadataPaths']()];for(const _0x52bd4e of _0x590fd6){const _0x1aff3c=this['metadata']['aid']+'/'+_0x52bd4e,_0x469cc9=(0x0,utils_1['getValueByPath'])(this['context'],_0x1aff3c);_0x469cc9!==undefined&&(_0x499c09[_0x1aff3c]=_0x469cc9);}telemetry_1['TelemetryService']['bindActivityTelemetryToState'](_0x499c09,this['config'],this['metadata'],this['context'],this['leg']);}['bindJobMetadataPaths'](){return serializer_1['MDATA_SYMBOLS']['JOB_UPDATE']['KEYS']['map'](_0x102f2f=>'metadata/'+_0x102f2f);}['bindActivityMetadataPaths'](){const _0x249022=this['leg']===0x1?'ACTIVITY':'ACTIVITY_UPDATE';return serializer_1['MDATA_SYMBOLS'][_0x249022]['KEYS']['map'](_0xb0f9bf=>'output/metadata/'+_0xb0f9bf);}async['getState'](){const _0x52834a=this['context']['metadata']['gid'],_0x30482e='$'+this['config']['subscribes'],_0x2b0084={[_0x30482e]:serializer_1['MDATA_SYMBOLS']['JOB']['KEYS']['map'](_0x2b736f=>'metadata/'+_0x2b736f)};for(let [_0x2e9702,_0x1e8b2b]of Object['entries'](this['config']['consumes'])){if(_0x2e9702==='$job')for(const _0x2f5bc1 of _0x1e8b2b){_0x2b0084[_0x30482e]['push'](_0x2f5bc1);}else{_0x2e9702==='$self'&&(_0x2e9702=this['metadata']['aid']);!_0x2b0084[_0x2e9702]&&(_0x2b0084[_0x2e9702]=[]);for(const _0x26c1d0 of _0x1e8b2b){_0x2b0084[_0x2e9702]['push'](_0x2e9702+'/'+_0x26c1d0);}}}telemetry_1['TelemetryService']['addTargetTelemetryPaths'](_0x2b0084,this['config'],this['metadata'],this['leg']);const {dad:_0x57b330,jid:_0x5be784}=this['context']['metadata'],_0x3de790=collator_1['CollatorService']['getDimensionsById']([...this['config']['ancestors'],this['metadata']['aid']],_0x57b330||''),[_0x460152,_0x14fa86]=await this['store']['getState'](_0x5be784,_0x2b0084,_0x3de790);this['context']=(0x0,utils_1['restoreHierarchy'])(_0x460152),this['assertGenerationalId'](this['context']?.['metadata']?.['gid'],_0x52834a),this['initDimensionalAddress'](_0x57b330),this['initSelf'](this['context']),this['initPolicies'](this['context']);}['assertGenerationalId'](_0x1f6e80,_0x4171b0){if(_0x4171b0!==_0x1f6e80)throw new errors_1['GenerationalError'](_0x1f6e80,_0x4171b0,this['context']?.['metadata']?.['jid']??'',this['context']?.['metadata']?.['aid']??'',this['context']?.['metadata']?.['dad']??'');}['initDimensionalAddress'](_0x41bbea){this['metadata']['dad']=_0x41bbea;}['initSelf'](_0x53f038){const _0x34555b=this['metadata']['aid'];!_0x53f038[_0x34555b]&&(_0x53f038[_0x34555b]={});const _0x5e7298=_0x53f038[_0x34555b];return!_0x5e7298['output']&&(_0x5e7298['output']={}),!_0x5e7298['input']&&(_0x5e7298['input']={}),!_0x5e7298['hook']&&(_0x5e7298['hook']={}),!_0x5e7298['output']['metadata']&&(_0x5e7298['output']['metadata']={}),_0x5e7298['output']['metadata']['au']=(0x0,utils_1['formatISODate'])(new Date()),_0x53f038['$self']=_0x5e7298,_0x53f038['$job']=_0x53f038,_0x53f038;}['initPolicies'](_0x5f387){const _0x219603=pipe_1['Pipe']['resolve'](this['config']['expire']??enums_1['HMSH_EXPIRE_DURATION'],_0x5f387);_0x5f387['metadata']['expire']=_0x219603;if(this['config']['persistent']!=undefined){const _0x9629fb=pipe_1['Pipe']['resolve'](this['config']['persistent']??![],_0x5f387);_0x5f387['metadata']['persistent']=_0x9629fb;}}['bindActivityData'](_0x4499ff){this['context'][this['metadata']['aid']][_0x4499ff]['data']=this['data'];}['resolveDad'](){let _0x40e148=this['metadata']['dad'];return this['adjacentIndex']>0x0&&(_0x40e148=_0x40e148['substring'](0x0,_0x40e148['lastIndexOf'](','))+','+this['adjacentIndex']),_0x40e148;}['resolveAdjacentDad'](){return''+this['resolveDad']()+collator_1['CollatorService']['getDimensionalSeed'](0x0);}async['filterAdjacent'](){const _0x375176=[],_0x5262b0=await this['store']['getTransitions'](await this['engine']['getVID']()),_0x4fdbf3=_0x5262b0['.'+this['metadata']['aid']],_0xdc158f=this['resolveAdjacentDad']();if(_0x4fdbf3)for(const _0x3fe1d4 in _0x4fdbf3){const _0x177cc7=_0x4fdbf3[_0x3fe1d4];mapper_1['MapperService']['evaluate'](_0x177cc7,this['context'],this['code'])&&_0x375176['push']({'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'dad':_0xdc158f,'aid':_0x3fe1d4,'spn':this['context']['$self']['output']['metadata']?.['l2s'],'trc':this['context']['metadata']['trc']},'type':stream_1['StreamDataType']['TRANSITION'],'data':{}});}return _0x375176;}['isJobComplete'](_0x29c380){return _0x29c380<=0x0;}['shouldEmit'](){if(this['config']['emit'])return pipe_1['Pipe']['resolve'](this['config']['emit'],this['context'])===!![];return![];}['shouldPersistJob'](){if(this['config']['persist']!==undefined)return pipe_1['Pipe']['resolve'](this['config']['persist'],this['context'])===!![];return![];}async['transition'](_0x4ba0ef,_0x5d804a){if(this['jobWasInterrupted'](_0x5d804a))return;let _0x19f1ee=[];(this['shouldEmit']()||this['isJobComplete'](_0x5d804a)||this['shouldPersistJob']())&&await this['engine']['runJobCompletionTasks'](this['context'],{'emit':!this['isJobComplete'](_0x5d804a)&&!this['shouldPersistJob']()});if(_0x4ba0ef['length']&&!this['isJobComplete'](_0x5d804a)){const _0x46edf1=this['store']['transact']();for(const _0x38b12f of _0x4ba0ef){await this['engine']['router']?.['publishMessage'](null,_0x38b12f,_0x46edf1);}_0x19f1ee=await _0x46edf1['exec']();}return _0x19f1ee;}['jobWasInterrupted'](_0x17a152){return _0x17a152<-0x5f5e100;}}exports['Activity']=Activity;function _0x1fe2(){const _0x29c550=['5418904hYCziN','408110NpcxnZ','175004OEEodb','9bInBsi','1863468BegikN','1256255yLZNSD','1390158MFuVaW','622704DRUFCw'];_0x1fe2=function(){return _0x29c550;};return _0x1fe2();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';function _0x3861(){const _0x12665d=['215MqMCRw','33oDrRwt','659071UwMmut','219915iMIHMp','1638204mSsrqu','54sPIzWh','1409464RtmkSR','310OeFzzs','7522blypaj','119648zudDWu','114tBEJoC','72740aUkMpQ'];_0x3861=function(){return _0x12665d;};return _0x3861();}(function(_0x2bd614,_0x36372a){const _0xad1a51=_0x1e13,_0x21fa97=_0x2bd614();while(!![]){try{const _0x57fee4=-parseInt(_0xad1a51(0x173))/0x1*(-parseInt(_0xad1a51(0x16f))/0x2)+parseInt(_0xad1a51(0x16c))/0x3*(-parseInt(_0xad1a51(0x170))/0x4)+parseInt(_0xad1a51(0x172))/0x5*(-parseInt(_0xad1a51(0x171))/0x6)+parseInt(_0xad1a51(0x169))/0x7+parseInt(_0xad1a51(0x16d))/0x8+parseInt(_0xad1a51(0x16a))/0x9*(parseInt(_0xad1a51(0x16e))/0xa)+-parseInt(_0xad1a51(0x174))/0xb*(parseInt(_0xad1a51(0x16b))/0xc);if(_0x57fee4===_0x36372a)break;else _0x21fa97['push'](_0x21fa97['shift']());}catch(_0x3a91ff){_0x21fa97['push'](_0x21fa97['shift']());}}}(_0x3861,0x956d9));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Await']=void 0x0;function _0x1e13(_0x2cad04,_0x125010){const _0x386195=_0x3861();return _0x1e13=function(_0x1e1368,_0x13f7c8){_0x1e1368=_0x1e1368-0x169;let _0x32c44c=_0x386195[_0x1e1368];return _0x32c44c;},_0x1e13(_0x2cad04,_0x125010);}const errors_1=require('../../modules/errors'),utils_1=require('../../modules/utils'),collator_1=require('../collator'),pipe_1=require('../pipe'),telemetry_1=require('../telemetry'),stream_1=require('../../types/stream'),activity_1=require('./activity');class Await extends activity_1['Activity']{constructor(_0x52ccc4,_0x42e584,_0x304dac,_0x10ecbc,_0x5134ce,_0x10a7fa){super(_0x52ccc4,_0x42e584,_0x304dac,_0x10ecbc,_0x5134ce,_0x10a7fa);}async['process'](){this['logger']['debug']('await-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x5b3c86;try{await this['verifyEntry'](),_0x5b3c86=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x5b3c86['startActivitySpan'](this['leg']),this['mapInputData']();const _0x37f20=this['store']['transact'](),_0x5f54fe=await this['execActivity'](_0x37f20);await collator_1['CollatorService']['authorizeReentry'](this,_0x37f20),await this['setState'](_0x37f20),await this['setStatus'](0x0,_0x37f20);const _0x1cee65=await _0x37f20['exec']();_0x5b3c86['mapActivityAttributes']();const _0x3e2901=this['resolveStatus'](_0x1cee65);return _0x5b3c86['setActivityAttributes']({'app.activity.mid':_0x5f54fe,'app.job.jss':_0x3e2901}),this['context']['metadata']['aid'];}catch(_0x31ae97){if(_0x31ae97 instanceof errors_1['InactiveJobError']){this['logger']['error']('await-inactive-job-error',{..._0x31ae97});return;}else{if(_0x31ae97 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x31ae97});return;}else{if(_0x31ae97 instanceof errors_1['GetStateError']){this['logger']['error']('await-get-state-error',{..._0x31ae97});return;}else{if(_0x31ae97 instanceof errors_1['CollationError']){if(_0x31ae97['fault']==='duplicate'){this['logger']['info']('await-collation-overage',{'job_id':this['context']['metadata']['jid'],'guid':this['context']['metadata']['guid']});return;}this['logger']['error']('await-collation-error',{..._0x31ae97});}else this['logger']['error']('await-process-error',{..._0x31ae97});}}}_0x5b3c86?.['setActivityError'](_0x31ae97['message']);throw _0x31ae97;}finally{_0x5b3c86?.['endActivitySpan'](),this['logger']['debug']('await-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}async['execActivity'](_0x45d766){const _0x5d25ff=pipe_1['Pipe']['resolve'](this['config']['subtype'],this['context']),_0x466d67={'metadata':{'guid':(0x0,utils_1['guid'])(),'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'dad':this['metadata']['dad'],'aid':this['metadata']['aid'],'topic':_0x5d25ff,'spn':this['context']['$self']['output']['metadata']?.['l1s'],'trc':this['context']['metadata']['trc']},'type':stream_1['StreamDataType']['AWAIT'],'data':this['context']['data']};if(this['config']['await']!==!![]){const _0x4c3ea7=pipe_1['Pipe']['resolve'](this['config']['await'],this['context']);_0x4c3ea7===![]&&(_0x466d67['metadata']['await']=![]);}return this['config']['retry']&&(_0x466d67['policies']={'retry':this['config']['retry']}),await this['engine']['router']?.['publishMessage'](null,_0x466d67,_0x45d766);}}exports['Await']=Await;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x300dd5,_0x4a2908){const _0x40b652=_0x4fa0,_0x2d4618=_0x300dd5();while(!![]){try{const _0x196829=parseInt(_0x40b652(0x109))/0x1*(-parseInt(_0x40b652(0x10b))/0x2)+parseInt(_0x40b652(0x110))/0x3+-parseInt(_0x40b652(0x10d))/0x4*(parseInt(_0x40b652(0x10f))/0x5)+parseInt(_0x40b652(0x10c))/0x6*(parseInt(_0x40b652(0x108))/0x7)+parseInt(_0x40b652(0x10a))/0x8+-parseInt(_0x40b652(0x105))/0x9*(-parseInt(_0x40b652(0x10e))/0xa)+-parseInt(_0x40b652(0x107))/0xb*(-parseInt(_0x40b652(0x106))/0xc);if(_0x196829===_0x4a2908)break;else _0x2d4618['push'](_0x2d4618['shift']());}catch(_0x4e0825){_0x2d4618['push'](_0x2d4618['shift']());}}}(_0x3d22,0xf33ba));function _0x4fa0(_0x3360b1,_0x2111d1){const _0x3d225f=_0x3d22();return _0x4fa0=function(_0x4fa06b,_0x2d4d8c){_0x4fa06b=_0x4fa06b-0x105;let _0x39e805=_0x3d225f[_0x4fa06b];return _0x39e805;},_0x4fa0(_0x3360b1,_0x2111d1);}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(_0xb443b2,_0xe6e7ea,_0x54a512,_0xb8a949,_0x2c3d45,_0x4bc775){super(_0xb443b2,_0xe6e7ea,_0x54a512,_0xb8a949,_0x2c3d45,_0x4bc775);}async['process'](){this['logger']['debug']('cycle-process',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});let _0x3ff71a;try{await this['verifyEntry'](),_0x3ff71a=new telemetry_1['TelemetryService'](this['engine']['appId'],this['config'],this['metadata'],this['context']),_0x3ff71a['startActivitySpan'](this['leg']),this['mapInputData']();let _0x6ebd2b=this['store']['transact']();await this['setState'](_0x6ebd2b),await this['setStatus'](0x0,_0x6ebd2b);const _0x19047f=await _0x6ebd2b['exec']();_0x3ff71a['mapActivityAttributes']();const _0x45cc31=this['resolveStatus'](_0x19047f);_0x6ebd2b=this['store']['transact']();const _0x3db290=await this['cycleAncestorActivity'](_0x6ebd2b);return _0x3ff71a['setActivityAttributes']({'app.activity.mid':_0x3db290,'app.job.jss':_0x45cc31}),await collator_1['CollatorService']['notarizeEarlyExit'](this,_0x6ebd2b),await _0x6ebd2b['exec'](),this['context']['metadata']['aid'];}catch(_0x406623){if(_0x406623 instanceof errors_1['InactiveJobError']){this['logger']['error']('cycle-inactive-job-error',{..._0x406623});return;}else{if(_0x406623 instanceof errors_1['GenerationalError']){this['logger']['info']('process-event-generational-job-error',{..._0x406623});return;}else{if(_0x406623 instanceof errors_1['GetStateError']){this['logger']['error']('cycle-get-state-error',{..._0x406623});return;}else{if(_0x406623 instanceof errors_1['CollationError']){if(_0x406623['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',{..._0x406623});}else this['logger']['error']('cycle-process-error',{..._0x406623});}}}_0x3ff71a?.['setActivityError'](_0x406623['message']);throw _0x406623;}finally{_0x3ff71a?.['endActivitySpan'](),this['logger']['debug']('cycle-process-end',{'jid':this['context']['metadata']['jid'],'gid':this['context']['metadata']['gid'],'aid':this['metadata']['aid']});}}async['cycleAncestorActivity'](_0x5a9194){this['mapInputData']();const _0x441848={'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,_0x441848,_0x5a9194);}}function _0x3d22(){const _0x543ad5=['11kuuhyI','538456CaCfBQ','353806qhPcAx','2620740RvqFBQ','807204UbKxav','719410LqccEt','40sZqMJL','4849599clOMrB','117fXEJiy','60TouYVc','3301672LDHepZ','7EFGjhS'];_0x3d22=function(){return _0x543ad5;};return _0x3d22();}exports['Cycle']=Cycle;
|