@hotmeshio/hotmesh 0.3.14 → 0.3.16
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 +64 -52
- package/build/modules/key.js +1 -1
- package/build/modules/utils.js +1 -1
- package/build/package.json +22 -21
- 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.js +2 -2
- package/build/services/connector/providers/nats.js +3 -1
- package/build/services/engine/index.js +1 -1
- package/build/services/exporter/index.js +1 -1
- package/build/services/hotmesh/index.js +2 -0
- package/build/services/mapper/index.js +1 -1
- package/build/services/meshcall/index.d.ts +5 -4
- package/build/services/meshcall/index.js +23 -9
- package/build/services/meshdata/index.js +3 -2
- package/build/services/meshflow/client.js +1 -1
- package/build/services/meshflow/connection.js +6 -4
- package/build/services/meshflow/exporter.js +1 -1
- package/build/services/meshflow/worker.js +1 -1
- 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/factory.d.ts +1 -1
- package/build/services/search/providers/postgres/postgres.d.ts +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.d.ts +68 -63
- package/build/services/store/providers/postgres/kvsql.js +1 -1
- package/build/services/store/providers/postgres/kvtables.d.ts +15 -0
- package/build/services/store/providers/postgres/kvtables.js +1 -0
- package/build/services/store/providers/postgres/kvtransaction.d.ts +36 -0
- package/build/services/store/providers/postgres/kvtransaction.js +1 -0
- package/build/services/store/providers/postgres/kvtypes/hash.d.ts +55 -0
- package/build/services/store/providers/postgres/kvtypes/hash.js +1 -0
- package/build/services/store/providers/postgres/kvtypes/list.d.ts +33 -0
- package/build/services/store/providers/postgres/kvtypes/list.js +1 -0
- package/build/services/store/providers/postgres/kvtypes/string.d.ts +20 -0
- package/build/services/store/providers/postgres/kvtypes/string.js +1 -0
- package/build/services/store/providers/postgres/kvtypes/zset.d.ts +41 -0
- package/build/services/store/providers/postgres/kvtypes/zset.js +1 -0
- package/build/services/store/providers/postgres/postgres.d.ts +3 -12
- 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/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/meshcall.d.ts +6 -6
- package/package.json +22 -21
- package/types/index.ts +3 -3
- package/types/manifest.ts +1 -1
- package/types/meshcall.ts +6 -6
- package/types/postgres.ts +8 -1
- package/types/provider.ts +7 -11
package/README.md
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
# HotMesh
|
|
2
2
|

|
|
3
3
|
|
|
4
|
-
**HotMesh** offers the power of Temporal.io
|
|
4
|
+
**HotMesh** offers the power of Temporal.io in a fully serverless architecture.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
<br/>
|
|
5
8
|
|
|
6
9
|
## Features
|
|
7
10
|
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **Decentralized
|
|
11
|
+
- **Serverless Orchestration**: Orchestrate your microservices without adding infrastructure.
|
|
12
|
+
- **BYODB**: Bring your own database, and avoid lockin. Choose *Postgres* or *Redis*.
|
|
13
|
+
- **Decentralized Execution**: Centralized persistence with decentralized execution.
|
|
11
14
|
- **Linear Scalability**: Scale your database to scale your application.
|
|
12
|
-
- **
|
|
15
|
+
- **Process Analytics**: Gain process insights with real-time analytics.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<br/>
|
|
13
19
|
|
|
14
20
|
## Install
|
|
15
21
|
|
|
@@ -18,10 +24,13 @@ npm install @hotmeshio/hotmesh
|
|
|
18
24
|
```
|
|
19
25
|
|
|
20
26
|
## Learn
|
|
21
|
-
[
|
|
27
|
+
[🏠 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)
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
|
|
30
|
+
<br/>
|
|
31
|
+
|
|
32
|
+
## MeshCall | Fast, Simple, Inter-Service Calls
|
|
33
|
+
[MeshCall](https://hotmeshio.github.io/sdk-typescript/classes/services_meshcall.MeshCall.html) connects any function to the mesh.
|
|
25
34
|
|
|
26
35
|
<details style="padding: .5em">
|
|
27
36
|
<summary style="font-size:1.25em;">Run an idempotent cron job <small>[more]</small></summary>
|
|
@@ -140,7 +149,7 @@ npm install @hotmeshio/hotmesh
|
|
|
140
149
|
<summary style="font-size:1.25em;">Call and <b>cache</b> a function <small>[more]</small></summary>
|
|
141
150
|
|
|
142
151
|
### Cache a Function
|
|
143
|
-
|
|
152
|
+
This solution builds upon the previous example, caching the response. The linked function will only be re/called when the cached result expires. Everything remains the same, except the caller which specifies an `id` and `ttl`.
|
|
144
153
|
|
|
145
154
|
1. Make the call from another service (or even the same service). Include an `id` and `ttl` to cache the result for the specified duration.
|
|
146
155
|
|
|
@@ -176,8 +185,11 @@ npm install @hotmeshio/hotmesh
|
|
|
176
185
|
```
|
|
177
186
|
</details>
|
|
178
187
|
|
|
188
|
+
|
|
189
|
+
<br/>
|
|
190
|
+
|
|
179
191
|
## MeshFlow | Transactional Workflow
|
|
180
|
-
[MeshFlow](https://hotmeshio.github.io/sdk-typescript/classes/services_meshflow.MeshFlow.html) is a drop-in replacement for [Temporal.io](https://temporal.io).
|
|
192
|
+
[MeshFlow](https://hotmeshio.github.io/sdk-typescript/classes/services_meshflow.MeshFlow.html) is a drop-in, serverless replacement for [Temporal.io](https://temporal.io).
|
|
181
193
|
|
|
182
194
|
<details style="padding: .5em">
|
|
183
195
|
<summary style="font-size:1.25em;">Orchestrate unpredictable activities <small>[more]</small></summary>
|
|
@@ -204,10 +216,10 @@ When an endpoint is unpredictable, use `proxyActivities`. HotMesh will retry as
|
|
|
204
216
|
|
|
205
217
|
```typescript
|
|
206
218
|
//workflows.ts
|
|
207
|
-
import {
|
|
219
|
+
import { workflow } from '@hotmeshio/hotmesh';
|
|
208
220
|
import * as activities from './activities';
|
|
209
221
|
|
|
210
|
-
const { greet, saludar } =
|
|
222
|
+
const { greet, saludar } = workflow
|
|
211
223
|
.proxyActivities<typeof activities>({
|
|
212
224
|
activities
|
|
213
225
|
});
|
|
@@ -224,11 +236,11 @@ When an endpoint is unpredictable, use `proxyActivities`. HotMesh will retry as
|
|
|
224
236
|
|
|
225
237
|
```typescript
|
|
226
238
|
//client.ts
|
|
227
|
-
import {
|
|
239
|
+
import { Client, HotMesh } from '@hotmeshio/hotmesh';
|
|
228
240
|
import Redis from 'ioredis';
|
|
229
241
|
|
|
230
242
|
async function run(): Promise<string> {
|
|
231
|
-
const client = new
|
|
243
|
+
const client = new Client({
|
|
232
244
|
connection: {
|
|
233
245
|
class: Redis,
|
|
234
246
|
options: { host: 'redis', port: 6379 }
|
|
@@ -247,16 +259,16 @@ When an endpoint is unpredictable, use `proxyActivities`. HotMesh will retry as
|
|
|
247
259
|
}
|
|
248
260
|
```
|
|
249
261
|
|
|
250
|
-
4. Finally, create a **worker** and link the workflow function. Workers listen for tasks on their assigned
|
|
262
|
+
4. Finally, create a **worker** and link the workflow function. Workers listen for tasks on their assigned task queue and invoke the workflow function each time they receive an event.
|
|
251
263
|
|
|
252
264
|
```typescript
|
|
253
265
|
//worker.ts
|
|
254
|
-
import {
|
|
266
|
+
import { worker } from '@hotmeshio/hotmesh';
|
|
255
267
|
import Redis from 'ioredis';
|
|
256
268
|
import * as workflows from './workflows';
|
|
257
269
|
|
|
258
270
|
async function run() {
|
|
259
|
-
const worker = await
|
|
271
|
+
const worker = await Worker.create({
|
|
260
272
|
connection: {
|
|
261
273
|
class: Redis,
|
|
262
274
|
options: { host: 'redis', port: 6379 },
|
|
@@ -280,10 +292,10 @@ Pause a function and only awaken when a matching signal is received from the out
|
|
|
280
292
|
|
|
281
293
|
```typescript
|
|
282
294
|
//waitForWorkflow.ts
|
|
283
|
-
import {
|
|
295
|
+
import { workflow } from '@hotmeshio/hotmesh';
|
|
284
296
|
|
|
285
297
|
export async function waitForExample(): Promise<{hello: string}> {
|
|
286
|
-
return await
|
|
298
|
+
return await workflow.waitFor<{hello: string}>('my-sig-nal');
|
|
287
299
|
//continue processing, use the payload, etc...
|
|
288
300
|
}
|
|
289
301
|
```
|
|
@@ -292,11 +304,11 @@ Pause a function and only awaken when a matching signal is received from the out
|
|
|
292
304
|
|
|
293
305
|
```typescript
|
|
294
306
|
//client.ts
|
|
295
|
-
import {
|
|
307
|
+
import { Client, HotMesh } from '@hotmeshio/hotmesh';
|
|
296
308
|
import Redis from 'ioredis';
|
|
297
309
|
|
|
298
310
|
async function run(): Promise<string> {
|
|
299
|
-
const client = new
|
|
311
|
+
const client = new Client({
|
|
300
312
|
connection: {
|
|
301
313
|
class: Redis,
|
|
302
314
|
options: { host: 'redis', port: 6379 }
|
|
@@ -318,12 +330,12 @@ Pause a function and only awaken when a matching signal is received from the out
|
|
|
318
330
|
|
|
319
331
|
```typescript
|
|
320
332
|
//worker.ts
|
|
321
|
-
import {
|
|
333
|
+
import { Worker } from '@hotmeshio/hotmesh';
|
|
322
334
|
import Redis from 'ioredis';
|
|
323
335
|
import * as workflows from './waitForWorkflow';
|
|
324
336
|
|
|
325
337
|
async function run() {
|
|
326
|
-
const worker = await
|
|
338
|
+
const worker = await Worker.create({
|
|
327
339
|
connection: {
|
|
328
340
|
class: Redis,
|
|
329
341
|
options: { host: 'redis', port: 6379 },
|
|
@@ -339,10 +351,10 @@ Pause a function and only awaken when a matching signal is received from the out
|
|
|
339
351
|
4. Send a signal to awaken the paused function; await the function result.
|
|
340
352
|
|
|
341
353
|
```typescript
|
|
342
|
-
import {
|
|
354
|
+
import { Client } from '@hotmeshio/hotmesh';
|
|
343
355
|
import * as Redis from Redis;
|
|
344
356
|
|
|
345
|
-
const client = new
|
|
357
|
+
const client = new Client({
|
|
346
358
|
connection: {
|
|
347
359
|
class: Redis,
|
|
348
360
|
options: { host: 'redis', port: 6379 }
|
|
@@ -373,12 +385,12 @@ Use a standard `Promise` to collate and cache multiple signals. HotMesh will onl
|
|
|
373
385
|
|
|
374
386
|
```typescript
|
|
375
387
|
//waitForWorkflows.ts
|
|
376
|
-
import {
|
|
388
|
+
import { workflow } from '@hotmeshio/hotmesh';
|
|
377
389
|
|
|
378
390
|
export async function waitForExample(): Promise<[boolean, number]> {
|
|
379
391
|
const [s1, s2] = await Promise.all([
|
|
380
|
-
|
|
381
|
-
|
|
392
|
+
workflow.waitFor<boolean>('my-sig-nal-1'),
|
|
393
|
+
workflow.waitFor<number>('my-sig-nal-2')
|
|
382
394
|
]);
|
|
383
395
|
//do something with the signal payloads (s1, s2)
|
|
384
396
|
return [s1, s2];
|
|
@@ -388,10 +400,10 @@ Use a standard `Promise` to collate and cache multiple signals. HotMesh will onl
|
|
|
388
400
|
2. Send **two** signals to awaken the paused function.
|
|
389
401
|
|
|
390
402
|
```typescript
|
|
391
|
-
import {
|
|
403
|
+
import { Client } from '@hotmeshio/hotmesh';
|
|
392
404
|
import * as Redis from Redis;
|
|
393
405
|
|
|
394
|
-
const client = new
|
|
406
|
+
const client = new Client({
|
|
395
407
|
connection: {
|
|
396
408
|
class: Redis,
|
|
397
409
|
options: { host: 'redis', port: 6379 }
|
|
@@ -425,10 +437,10 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
425
437
|
|
|
426
438
|
```typescript
|
|
427
439
|
//recurringWorkflow.ts
|
|
428
|
-
import {
|
|
440
|
+
import { workflow } from '@hotmeshio/hotmesh';
|
|
429
441
|
import * as activities from './activities';
|
|
430
442
|
|
|
431
|
-
const { statusDiagnostic } =
|
|
443
|
+
const { statusDiagnostic } = workflow
|
|
432
444
|
.proxyActivities<typeof activities>({
|
|
433
445
|
activities
|
|
434
446
|
});
|
|
@@ -436,7 +448,7 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
436
448
|
export async function recurringExample(someValue: number): Promise<void> {
|
|
437
449
|
do {
|
|
438
450
|
await statusDiagnostic(someValue);
|
|
439
|
-
} while (await
|
|
451
|
+
} while (await workflow.sleepFor('1 week'));
|
|
440
452
|
}
|
|
441
453
|
```
|
|
442
454
|
|
|
@@ -444,11 +456,11 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
444
456
|
|
|
445
457
|
```typescript
|
|
446
458
|
//client.ts
|
|
447
|
-
import {
|
|
459
|
+
import { Client, HotMesh } from '@hotmeshio/hotmesh';
|
|
448
460
|
import Redis from 'ioredis';
|
|
449
461
|
|
|
450
462
|
async function run(): Promise<string> {
|
|
451
|
-
const client = new
|
|
463
|
+
const client = new Client({
|
|
452
464
|
connection: {
|
|
453
465
|
class: Redis,
|
|
454
466
|
options: { host: 'redis', port: 6379 }
|
|
@@ -470,12 +482,12 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
470
482
|
|
|
471
483
|
```typescript
|
|
472
484
|
//worker.ts
|
|
473
|
-
import {
|
|
485
|
+
import { Worker } from '@hotmeshio/hotmesh';
|
|
474
486
|
import Redis from 'ioredis';
|
|
475
487
|
import * as workflows from './recurringWorkflow';
|
|
476
488
|
|
|
477
489
|
async function run() {
|
|
478
|
-
const worker = await
|
|
490
|
+
const worker = await Worker.create({
|
|
479
491
|
connection: {
|
|
480
492
|
class: Redis,
|
|
481
493
|
options: { host: 'redis', port: 6379 },
|
|
@@ -491,10 +503,10 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
491
503
|
4. Cancel the recurring workflow (`myRecurring123`) by calling `interrupt`.
|
|
492
504
|
|
|
493
505
|
```typescript
|
|
494
|
-
import {
|
|
506
|
+
import { Client } from '@hotmeshio/hotmesh';
|
|
495
507
|
import * as Redis from Redis;
|
|
496
508
|
|
|
497
|
-
const client = new
|
|
509
|
+
const client = new Client({
|
|
498
510
|
connection: {
|
|
499
511
|
class: Redis,
|
|
500
512
|
options: { host: 'redis', port: 6379 }
|
|
@@ -511,12 +523,10 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
511
523
|
```
|
|
512
524
|
</details>
|
|
513
525
|
|
|
514
|
-
|
|
515
|
-
[MeshData](https://hotmeshio.github.io/sdk-typescript/classes/services_meshdata.MeshData.html) extends the **MeshFlow** service, combining data record concepts and transactional workflow principles into a single *Operational Data Layer*.
|
|
516
|
-
|
|
517
|
-
Deployments with the Redis `FT.SEARCH` module enabled can use the **MeshData** module to merge [OLTP](https://en.wikipedia.org/wiki/Online_transaction_processing) and [OLAP](https://en.wikipedia.org/wiki/Online_analytical_processing) operations into a hybrid transactional/analytics ([HTAP](https://en.wikipedia.org/wiki/Hybrid_transactional/analytical_processing)) system.
|
|
526
|
+
<br/>
|
|
518
527
|
|
|
519
|
-
|
|
528
|
+
## MeshData | Transactional Analytics
|
|
529
|
+
[MeshData](https://hotmeshio.github.io/sdk-typescript/classes/services_meshdata.MeshData.html) extends the **MeshFlow** service, surfacing transactional workflows as searchable data records.
|
|
520
530
|
|
|
521
531
|
<details style="padding: .5em">
|
|
522
532
|
<summary style="font-size:1.25em;">Create a search index <small>[more]</small></summary>
|
|
@@ -541,7 +551,7 @@ This example demonstrates how to define a schema and deploy an index for a 'user
|
|
|
541
551
|
};
|
|
542
552
|
```
|
|
543
553
|
|
|
544
|
-
2. Create the
|
|
554
|
+
2. Create the index upon server startup. This one initializes the 'user' index, using the schema defined in the previous step. It's OK to call `createSearchIndex` multiple times; it will only create the index if it doesn't already exist.
|
|
545
555
|
|
|
546
556
|
```typescript
|
|
547
557
|
//server.ts
|
|
@@ -697,19 +707,21 @@ This example demonstrates how to search for those workflows where a given condit
|
|
|
697
707
|
```
|
|
698
708
|
</details>
|
|
699
709
|
|
|
700
|
-
|
|
701
|
-
|
|
710
|
+
<br/>
|
|
711
|
+
|
|
712
|
+
## Metrics and Monitoring
|
|
713
|
+
HotMesh's **OpenTelemetry** output provides unmatched insight into long-running, cross-service transactions. Add an OpenTelemetry sink to any service where HotMesh is deployed and HotMesh will emit the full **OpenTelemetry** execution tree organized as a single, unified DAG.
|
|
702
714
|
|
|
703
|
-
|
|
704
|
-
The HotMesh dashboard provides a detailed overview of all running workflows. An LLM is included to simplify querying and analyzing workflow data for those deployments that include the Redis `FT.SEARCH` module.
|
|
715
|
+
The **HotMesh Dashboard** provides a detailed overview of all running workflows. It includes an LLM to simplify querying and analyzing workflow data. An example Web server with REST APIs and the Dashboard (a WebApp) is included in the [samples-typescript](https://github.com/hotmeshio/samples-typescript) Git repo.
|
|
705
716
|
|
|
706
|
-
|
|
707
|
-
View commands, streams, data, CPU, load, etc using the RedisInsight data browser.
|
|
717
|
+
<br/>
|
|
708
718
|
|
|
709
|
-
##
|
|
719
|
+
## Examples
|
|
710
720
|
Refer to the [hotmeshio/samples-typescript](https://github.com/hotmeshio/samples-typescript) Git repo for *tutorials* and instructions on deploying the *HotMesh Dashboard* for visualizing workflows and managing network health.
|
|
711
721
|
|
|
712
722
|
Refer to the [hotmeshio/temporal-patterns-typescript](https://github.com/hotmeshio/temporal-patterns-typescript) Git repo for examples of common Temporal.io patterns implemented using HotMesh.
|
|
713
723
|
|
|
724
|
+
<br/>
|
|
725
|
+
|
|
714
726
|
## Advanced
|
|
715
727
|
The theory that underlies the architecture is applicable to any number of data storage and streaming backends: [A Message-Oriented Approach to Decentralized Process Orchestration](https://zenodo.org/records/12168558).
|
package/build/modules/key.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x29bb14,_0x21925d){const _0x3647f4=_0x151e,_0xf45515=_0x29bb14();while(!![]){try{const _0x463fa0=parseInt(_0x3647f4(0x1d4))/0x1*(-parseInt(_0x3647f4(0x1d2))/0x2)+parseInt(_0x3647f4(0x1d3))/0x3*(-parseInt(_0x3647f4(0x1cd))/0x4)+-parseInt(_0x3647f4(0x1d0))/0x5+parseInt(_0x3647f4(0x1ca))/0x6*(parseInt(_0x3647f4(0x1d1))/0x7)+-parseInt(_0x3647f4(0x1c9))/0x8*(-parseInt(_0x3647f4(0x1cb))/0x9)+-parseInt(_0x3647f4(0x1cf))/0xa*(parseInt(_0x3647f4(0x1ce))/0xb)+parseInt(_0x3647f4(0x1cc))/0xc;if(_0x463fa0===_0x21925d)break;else _0xf45515['push'](_0xf45515['shift']());}catch(_0x39c202){_0xf45515['push'](_0xf45515['shift']());}}}(_0x92fa,0x6cee7));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');function _0x151e(_0x12bcbd,_0x7cc2b8){const _0x92fa1c=_0x92fa();return _0x151e=function(_0x151e6b,_0x1aab9a){_0x151e6b=_0x151e6b-0x1c9;let _0x1d3957=_0x92fa1c[_0x151e6b];return _0x1d3957;},_0x151e(_0x12bcbd,_0x7cc2b8);}Object['defineProperty'](exports,'KeyType',{'enumerable':!![],'get':function(){return hotmesh_1['KeyType'];}});const HMNS='hmsh';exports['HMNS']=HMNS;const KEYSEP=':';function _0x92fa(){const _0x3914b6=['6832600IILaeT','1215085zVsHig','21PTuWLF','1152362CAsIOL','3564LpjbZo','1gsnLjG','144472eGiDhs','1477716iqXHYb','45EOCQzo','17653632hUlOgN','1184CumJOo','11pOikvb'];_0x92fa=function(){return _0x3914b6;};return _0x92fa();}exports['KEYSEP']=KEYSEP;const VALSEP='::';exports['VALSEP']=VALSEP;const WEBSEP='::';exports['WEBSEP']=WEBSEP;const TYPSEP='::';exports['TYPSEP']=TYPSEP;class KeyService{static['mintKey'](_0x44dbf8,_0x2661fb,_0x43bcf6){switch(_0x2661fb){case hotmesh_1['KeyType']['HOTMESH']:return _0x44dbf8;case hotmesh_1['KeyType']['THROTTLE_RATE']:return _0x44dbf8+':'+_0x43bcf6['appId']+':r:';case hotmesh_1['KeyType']['WORK_ITEMS']:return _0x44dbf8+':'+_0x43bcf6['appId']+':w:'+(_0x43bcf6['scoutType']||'');case hotmesh_1['KeyType']['TIME_RANGE']:return _0x44dbf8+':'+_0x43bcf6['appId']+':t:'+(_0x43bcf6['timeValue']||'');case hotmesh_1['KeyType']['APP']:return _0x44dbf8+':a:'+(_0x43bcf6['appId']||'');case hotmesh_1['KeyType']['QUORUM']:return _0x44dbf8+':'+_0x43bcf6['appId']+':q:'+(_0x43bcf6['engineId']||'');case hotmesh_1['KeyType']['JOB_STATE']:return _0x44dbf8+':'+_0x43bcf6['appId']+':j:'+_0x43bcf6['jobId'];case hotmesh_1['KeyType']['JOB_DEPENDENTS']:return _0x44dbf8+':'+_0x43bcf6['appId']+':d:'+_0x43bcf6['jobId'];case hotmesh_1['KeyType']['JOB_STATS_GENERAL']:return _0x44dbf8+':'+_0x43bcf6['appId']+':s:'+_0x43bcf6['jobKey']+':'+_0x43bcf6['dateTime'];case hotmesh_1['KeyType']['JOB_STATS_MEDIAN']:return _0x44dbf8+':'+_0x43bcf6['appId']+':s:'+_0x43bcf6['jobKey']+':'+_0x43bcf6['dateTime']+':'+_0x43bcf6['facet'];case hotmesh_1['KeyType']['JOB_STATS_INDEX']:return _0x44dbf8+':'+_0x43bcf6['appId']+':s:'+_0x43bcf6['jobKey']+':'+_0x43bcf6['dateTime']+':'+_0x43bcf6['facet'];case hotmesh_1['KeyType']['SCHEMAS']:return _0x44dbf8+':'+_0x43bcf6['appId']+':v:'+_0x43bcf6['appVersion']+':schemas';case hotmesh_1['KeyType']['SUBSCRIPTIONS']:return _0x44dbf8+':'+_0x43bcf6['appId']+':v:'+_0x43bcf6['appVersion']+':subscriptions';case hotmesh_1['KeyType']['SUBSCRIPTION_PATTERNS']:return _0x44dbf8+':'+_0x43bcf6['appId']+':v:'+_0x43bcf6['appVersion']+':transitions';case hotmesh_1['KeyType']['HOOKS']:return _0x44dbf8+':'+_0x43bcf6['appId']+':hooks';case hotmesh_1['KeyType']['SIGNALS']:return _0x44dbf8+':'+_0x43bcf6['appId']+':signals';case hotmesh_1['KeyType']['SYMKEYS']:return _0x44dbf8+':'+_0x43bcf6['appId']+':sym:keys:'+(_0x43bcf6['activityId']||'');case hotmesh_1['KeyType']['SYMVALS']:return _0x44dbf8+':'+_0x43bcf6['appId']+':sym:vals:';case hotmesh_1['KeyType']['STREAMS']:return _0x44dbf8+':'+(_0x43bcf6['appId']||'')+':x:'+(_0x43bcf6['topic']||'');default:throw new Error('Invalid\x20key\x20type.');}}static['parseKey'](_0x438124){const [_0x1c12fc,_0x32b252,_0x1b5401,..._0x22b4f0]=_0x438124['split'](KEYSEP),_0x51737a=_0x22b4f0['join'](KEYSEP)||'';return{'namespace':_0x1c12fc,'app':_0x1b5401==='a'?_0x32b252:undefined,'entity':_0x1b5401,'id':_0x51737a};}static['reconstituteKey'](_0x2fa318){const {namespace:_0x5db64f,app:_0x52bf7a,entity:_0x1f73b2,id:_0x3a454f}=_0x2fa318;return''+_0x5db64f+KEYSEP+_0x52bf7a+KEYSEP+_0x1f73b2+KEYSEP+(_0x3a454f||'');}static['resolveEntityType'](_0x4e9dbf,_0x2eb091=''){switch(_0x4e9dbf){case'a':return'applications';case'r':return'throttles';case'w':return _0x2eb091===''?'task_priorities':'roles';case't':return _0x2eb091===''?'task_schedules':'task_lists';case'q':return'events';case'j':return'jobs';case's':return'stats';case'v':return'versions';case'x':return _0x2eb091===''?'streams':'stream_topics';case'hooks':return'signal_patterns';case'signals':return'signal_registry';case'sym':return'symbols';default:return'unknown_entity';}}static['resolveAbbreviation'](_0x10a586){switch(_0x10a586){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.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(_0x523214,_0x471cec){const _0x341c7a=_0x3534,_0x5ec630=_0x523214();while(!![]){try{const _0x399951=-parseInt(_0x341c7a(0x1e0))/0x1*(-parseInt(_0x341c7a(0x1de))/0x2)+parseInt(_0x341c7a(0x1df))/0x3+parseInt(_0x341c7a(0x1e1))/0x4+parseInt(_0x341c7a(0x1e3))/0x5+-parseInt(_0x341c7a(0x1e4))/0x6*(parseInt(_0x341c7a(0x1e2))/0x7)+parseInt(_0x341c7a(0x1e5))/0x8+-parseInt(_0x341c7a(0x1dd))/0x9;if(_0x399951===_0x471cec)break;else _0x5ec630['push'](_0x5ec630['shift']());}catch(_0x445908){_0x5ec630['push'](_0x5ec630['shift']());}}}(_0x4198,0xc4c58));var __importDefault=this&&this['__importDefault']||function(_0xf0c1ff){return _0xf0c1ff&&_0xf0c1ff['__esModule']?_0xf0c1ff:{'default':_0xf0c1ff};};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=_0xfe144c=>{const _0x3c5f4d=JSON['stringify'](_0xfe144c);return(0x0,crypto_1['createHash'])('sha256')['update'](_0x3c5f4d)['digest']('hex');};exports['hashOptions']=hashOptions;async function getSystemHealth(){const _0x1201a9=os_1['default']['totalmem'](),_0x1c6e73=os_1['default']['freemem'](),_0x2ffcc1=_0x1201a9-_0x1c6e73,_0x4b5501={'TotalMemoryGB':(_0x1201a9/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','FreeMemoryGB':(_0x1c6e73/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','UsedMemoryGB':(_0x2ffcc1/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','CPULoad':[],'NetworkStats':[]};return _0x4b5501;}exports['getSystemHealth']=getSystemHealth;function deepCopy(_0x427af1){return JSON['parse'](JSON['stringify'](_0x427af1));}exports['deepCopy']=deepCopy;function deterministicRandom(_0x5f5bef){const _0x4bd316=Math['sin'](_0x5f5bef)*0x2710;return _0x4bd316-Math['floor'](_0x4bd316);}exports['deterministicRandom']=deterministicRandom;function guid(_0x1ab5c8=enums_1['HMSH_GUID_SIZE']){return'H'+(0x0,nanoid_1['nanoid'])(_0x1ab5c8);}exports['guid']=guid;async function sleepFor(_0xd17f08){return new Promise(_0x2eaf57=>setTimeout(_0x2eaf57,_0xd17f08));}exports['sleepFor']=sleepFor;function sleepImmediate(){return new Promise(_0x24a324=>setImmediate(_0x24a324));}exports['sleepImmediate']=sleepImmediate;function XSleepFor(_0x571543){let _0x4d502c;const _0x4b4e2f=new Promise(_0x25e82a=>{_0x4d502c=setTimeout(_0x25e82a,_0x571543);});return{'promise':_0x4b4e2f,'timerId':_0x4d502c};}exports['XSleepFor']=XSleepFor;function identifyProvider(_0x5b7b38){const _0x5a7414=Object['getPrototypeOf'](_0x5b7b38);if(_0x5b7b38['Query']?.['prototype']||Object['keys'](_0x5b7b38)['includes']('database'))return'postgres';else{if(_0x5b7b38['constructor']&&_0x5b7b38['constructor']['name']==='Client')return'nats';else{if('defineCommand'in _0x5a7414||Object['keys'](_0x5a7414)['includes']('multi'))return'ioredis';else{if(Object['keys'](_0x5a7414)['includes']('Multi'))return'redis';}}}if(_0x5b7b38['constructor']){if(_0x5b7b38['constructor']['name']==='Redis'||_0x5b7b38['constructor']['name']==='EventEmitter'){if('hset'in _0x5b7b38)return'ioredis';}else{if(_0x5b7b38['constructor']['name']==='ProviderClient'||_0x5b7b38['constructor']['name']==='Commander'){if('HSET'in _0x5b7b38)return'redis';}}}let _0x1b00d3=null;if(Object['keys'](_0x5b7b38)['includes']('connection'))_0x1b00d3='postgres';else{if(Object['keys'](_0x5b7b38)['includes']('Pipeline'))_0x1b00d3='ioredis';else{if(Object['keys'](_0x5b7b38)['includes']('createClient'))_0x1b00d3='redis';else Object['keys'](_0x5b7b38)['includes']('jetstream')&&(_0x1b00d3='nats');}}return _0x1b00d3;}exports['identifyProvider']=identifyProvider,exports['polyfill']={'resolveActivityType'(_0x31fa1d){return _0x31fa1d==='activity'?'hook':_0x31fa1d;},'providerConfig'(_0x45fc7b){return _0x45fc7b?.['connection']??_0x45fc7b?.['redis'];},'meshDataConfig'(_0x4aa3ac){if(_0x4aa3ac?.['connections'])return _0x4aa3ac['connections'];return _0x4aa3ac?.['connection']??{'class':_0x4aa3ac?.['redisClass'],'options':_0x4aa3ac?.['redisOptions']};}};function identifyRedisTypeFromClass(_0x27a2f1){if(_0x27a2f1&&_0x27a2f1['name']==='Redis'||_0x27a2f1['name']==='EventEmitter')return'ioredis';else{if(_0x27a2f1&&'createClient'in _0x27a2f1)return'redis';}return null;}exports['identifyRedisTypeFromClass']=identifyRedisTypeFromClass;function matchesStatusCode(_0x3c6d44,_0x41f49c){if(typeof _0x41f49c==='string'){const _0x5a0b11='^'+_0x41f49c['replace'](/\*/g,'\x5cd')+'$';return new RegExp(_0x5a0b11)['test'](_0x3c6d44['toString']());}return _0x41f49c['test'](_0x3c6d44['toString']());}exports['matchesStatusCode']=matchesStatusCode;function matchesStatus(_0x1d8437,_0xf14824){return _0x1d8437===_0xf14824;}exports['matchesStatus']=matchesStatus;function findTopKey(_0x14efdd,_0x377082){for(const [_0x5d6512,_0x3ba5b5]of Object['entries'](_0x14efdd)){if(_0x3ba5b5['hasOwnProperty'](_0x377082)){const _0x5df9bd=findTopKey(_0x14efdd,_0x5d6512['replace'](/^\./,''));return(_0x5df9bd||_0x5d6512)['replace'](/^\./,'');}}return null;}exports['findTopKey']=findTopKey;function findSubscriptionForTrigger(_0x67b2ed,_0x4234b5){for(const [_0x420ebf,_0x4777fe]of Object['entries'](_0x67b2ed)){if(_0x4777fe===_0x4234b5)return _0x420ebf;}return null;}exports['findSubscriptionForTrigger']=findSubscriptionForTrigger;async function getSubscriptionTopic(_0x4b937b,_0x3cd2a8,_0x5f4192){const _0x5af105=await _0x3cd2a8['getTransitions'](_0x5f4192),_0x31d0a5=await _0x3cd2a8['getSubscriptions'](_0x5f4192),_0x4ba13b=findTopKey(_0x5af105,_0x4b937b),_0x40c928=findSubscriptionForTrigger(_0x31d0a5,_0x4ba13b);return _0x40c928;}exports['getSubscriptionTopic']=getSubscriptionTopic;function getTimeSeries(_0x480a3b){if(_0x480a3b['toString']()==='infinity')return'0';const _0xcfc02e=new Date(),_0x278ada=_0x480a3b['slice'](-0x1),_0x30da6c=parseInt(_0x480a3b['slice'](0x0,-0x1),0xa);if(_0x278ada==='m'){const _0x3932e7=Math['floor'](_0xcfc02e['getMinutes']()/_0x30da6c)*_0x30da6c;_0xcfc02e['setUTCMinutes'](_0x3932e7,0x0,0x0);}else _0x278ada==='h'&&_0xcfc02e['setUTCMinutes'](0x0,0x0,0x0);return _0xcfc02e['toISOString']()['replace'](/:\d\d\..+|-|T/g,'')['replace'](':','');}exports['getTimeSeries']=getTimeSeries;function formatISODate(_0x212e20){const _0x297372=_0x212e20 instanceof Date?_0x212e20:new Date(_0x212e20);return _0x297372['toISOString']()['replace'](/[:TZ-]/g,'');}exports['formatISODate']=formatISODate;function getSymKey(_0x13e242){const _0x2f52a7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x2699b8=_0x2f52a7['length'];if(_0x13e242<0x0||_0x13e242>=Math['pow'](_0x2699b8,0x3))throw new Error('Number\x20out\x20of\x20range');const [_0x553ca9,_0x1bfb37]=divmod(_0x13e242,_0x2699b8),[_0x487271,_0x4faefb]=divmod(_0x553ca9,_0x2699b8);return _0x2f52a7[_0x487271]+_0x2f52a7[_0x1bfb37]+_0x2f52a7[_0x4faefb];}exports['getSymKey']=getSymKey;function getSymVal(_0x4067a4){const _0x40d60d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x7fb2ef=_0x40d60d['length'];if(_0x4067a4<0x0||_0x4067a4>=Math['pow'](_0x7fb2ef,0x2))throw new Error('Number\x20out\x20of\x20range');const [_0x2cce6d,_0x229a39]=divmod(_0x4067a4,_0x7fb2ef);return _0x40d60d[_0x2cce6d]+_0x40d60d[_0x229a39];}exports['getSymVal']=getSymVal;function _0x3534(_0x32d8a8,_0x3ab450){const _0x41980e=_0x4198();return _0x3534=function(_0x353460,_0x535ab0){_0x353460=_0x353460-0x1dd;let _0x1f54fb=_0x41980e[_0x353460];return _0x1f54fb;},_0x3534(_0x32d8a8,_0x3ab450);}function divmod(_0x54a59a,_0x1e6603){return[Math['floor'](_0x54a59a/_0x1e6603),_0x54a59a%_0x1e6603];}function getIndexedHash(_0x3d969d,_0x26d580){const _0x1abaa9=_0x3d969d[_0x26d580]||0x0,_0x15a016={..._0x3d969d};return delete _0x15a016[_0x26d580],[_0x1abaa9,_0x15a016];}exports['getIndexedHash']=getIndexedHash;function getValueByPath(_0x2b101f,_0x167f3a){const _0x1eeeaf=_0x167f3a['split']('/');let _0x48acf0=_0x2b101f;for(const _0x3fc089 of _0x1eeeaf){if(_0x48acf0[_0x3fc089]!==undefined)_0x48acf0=_0x48acf0[_0x3fc089];else return undefined;}return _0x48acf0;}exports['getValueByPath']=getValueByPath;function restoreHierarchy(_0x707c65){const _0x4dc7e5={};for(const _0x1f9200 in _0x707c65){if(_0x707c65[_0x1f9200]===undefined)continue;const _0x4ff9cb=_0x1f9200['split']('/');let _0x25382e=_0x4dc7e5;for(let _0x2994df=0x0;_0x2994df<_0x4ff9cb['length'];_0x2994df++){_0x2994df===_0x4ff9cb['length']-0x1?_0x25382e[_0x4ff9cb[_0x2994df]]=_0x707c65[_0x1f9200]:(_0x25382e[_0x4ff9cb[_0x2994df]]=_0x25382e[_0x4ff9cb[_0x2994df]]||{},_0x25382e=_0x25382e[_0x4ff9cb[_0x2994df]]);}}return _0x4dc7e5;}exports['restoreHierarchy']=restoreHierarchy;function isValidCron(_0x4ff2be){const _0x1f5689=/^(\*|([0-5]?\d)) (\*|([01]?\d|2[0-3])) (\*|([12]?\d|3[01])) (\*|([1-9]|1[0-2])) (\*|([0-6](?:-[0-6])?(?:,[0-6])?))$/;return _0x1f5689['test'](_0x4ff2be);}exports['isValidCron']=isValidCron;const s=_0x39773e=>{return(0x0,ms_1['default'])(_0x39773e)/0x3e8;};exports['s']=s;const parseStreamMessage=_0x4c6c91=>{try{return JSON['parse'](_0x4c6c91);}catch(_0x18fce4){logger['error']('Error\x20parsing\x20Stream\x20message',{..._0x18fce4});throw _0x18fce4;}};exports['parseStreamMessage']=parseStreamMessage;function _0x4198(){const _0x4b03a3=['6UqzQPh','6167832zcqEYe','5704497BsNnsa','276elOUxp','2178606NxsvCl','2621yZJjoc','2116208ROSRZw','10036929hFwskA','2428625EvjgfC'];_0x4198=function(){return _0x4b03a3;};return _0x4198();}const isStreamMessage=_0x2b4c19=>{return Array['isArray'](_0x2b4c19)&&Array['isArray'](_0x2b4c19[0x0]);};exports['isStreamMessage']=isStreamMessage;const arrayToHash=_0x37965e=>{const _0xcfa42e=[];let _0x30886c;for(let _0x56f95b=0x1;_0x56f95b<_0x37965e['length'];_0x56f95b++){const _0xc1bf0c=_0x37965e[_0x56f95b],_0x436793={};if(Array['isArray'](_0xc1bf0c)){for(let _0xb3c49a=0x0;_0xb3c49a<_0xc1bf0c['length'];_0xb3c49a+=0x2){const _0x2a9df2=_0xc1bf0c[_0xb3c49a],_0x13e5ef=_0xc1bf0c[_0xb3c49a+0x1];_0x436793[_0x2a9df2]=_0x13e5ef;}_0x30886c&&(_0x436793['$']=_0x30886c),_0xcfa42e['push'](_0x436793),_0x30886c=undefined;}else _0x30886c=_0xc1bf0c;}return _0xcfa42e;};exports['arrayToHash']=arrayToHash;
|
|
1
|
+
'use strict';(function(_0x1f8b74,_0x4ed473){const _0x5c6dcf=_0x10cf,_0x421192=_0x1f8b74();while(!![]){try{const _0x49033b=parseInt(_0x5c6dcf(0x6b))/0x1+parseInt(_0x5c6dcf(0x6a))/0x2+-parseInt(_0x5c6dcf(0x6f))/0x3*(parseInt(_0x5c6dcf(0x6e))/0x4)+parseInt(_0x5c6dcf(0x6d))/0x5+parseInt(_0x5c6dcf(0x68))/0x6+parseInt(_0x5c6dcf(0x67))/0x7+-parseInt(_0x5c6dcf(0x6c))/0x8*(parseInt(_0x5c6dcf(0x69))/0x9);if(_0x49033b===_0x4ed473)break;else _0x421192['push'](_0x421192['shift']());}catch(_0x30dd14){_0x421192['push'](_0x421192['shift']());}}}(_0x2940,0xedcc2));var __importDefault=this&&this['__importDefault']||function(_0x1e1ca5){return _0x1e1ca5&&_0x1e1ca5['__esModule']?_0x1e1ca5:{'default':_0x1e1ca5};};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=_0x35069e=>{const _0x32b1a6=JSON['stringify'](_0x35069e);return(0x0,crypto_1['createHash'])('sha256')['update'](_0x32b1a6)['digest']('hex');};exports['hashOptions']=hashOptions;async function getSystemHealth(){const _0xe21a68=os_1['default']['totalmem'](),_0x256ef0=os_1['default']['freemem'](),_0x2a0fe6=_0xe21a68-_0x256ef0,_0x50adb3={'TotalMemoryGB':(_0xe21a68/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','FreeMemoryGB':(_0x256ef0/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','UsedMemoryGB':(_0x2a0fe6/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','CPULoad':[],'NetworkStats':[]};return _0x50adb3;}function _0x10cf(_0x2c41b4,_0x11f0e0){const _0x2940e7=_0x2940();return _0x10cf=function(_0x10cfda,_0x5db4ce){_0x10cfda=_0x10cfda-0x67;let _0xe8bd99=_0x2940e7[_0x10cfda];return _0xe8bd99;},_0x10cf(_0x2c41b4,_0x11f0e0);}exports['getSystemHealth']=getSystemHealth;function deepCopy(_0x2ef356){return JSON['parse'](JSON['stringify'](_0x2ef356));}exports['deepCopy']=deepCopy;function deterministicRandom(_0x4a2b91){const _0x3a9569=Math['sin'](_0x4a2b91)*0x2710;return _0x3a9569-Math['floor'](_0x3a9569);}exports['deterministicRandom']=deterministicRandom;function guid(_0x41589d=enums_1['HMSH_GUID_SIZE']){return'H'+(0x0,nanoid_1['nanoid'])(_0x41589d);}exports['guid']=guid;async function sleepFor(_0x959cd3){return new Promise(_0x59511d=>setTimeout(_0x59511d,_0x959cd3));}exports['sleepFor']=sleepFor;function sleepImmediate(){return new Promise(_0x1cdc0c=>setImmediate(_0x1cdc0c));}exports['sleepImmediate']=sleepImmediate;function XSleepFor(_0x354dad){let _0x1259fd;const _0x4a8f3d=new Promise(_0x23887f=>{_0x1259fd=setTimeout(_0x23887f,_0x354dad);});return{'promise':_0x4a8f3d,'timerId':_0x1259fd};}exports['XSleepFor']=XSleepFor;function identifyProvider(_0x4b6795){const _0x57a301=Object['getPrototypeOf'](_0x4b6795);if(_0x4b6795['Query']?.['prototype']||Object['keys'](_0x4b6795)['includes']('database'))return'postgres';else{if(_0x4b6795['constructor']&&_0x4b6795['constructor']['name']==='Client')return'nats';else{if('defineCommand'in _0x57a301||Object['keys'](_0x57a301)['includes']('multi'))return'ioredis';else{if(Object['keys'](_0x57a301)['includes']('Multi'))return'redis';}}}if(_0x4b6795['constructor']){if(_0x4b6795['constructor']['name']==='Redis'||_0x4b6795['constructor']['name']==='EventEmitter'){if('hset'in _0x4b6795)return'ioredis';}else{if(_0x4b6795['constructor']['name']==='ProviderClient'||_0x4b6795['constructor']['name']==='Commander'){if('HSET'in _0x4b6795)return'redis';}}}let _0x1f9580=null;if(Object['keys'](_0x4b6795)['includes']('connection'))_0x1f9580='postgres';else{if(Object['keys'](_0x4b6795)['includes']('Pipeline'))_0x1f9580='ioredis';else{if(Object['keys'](_0x4b6795)['includes']('createClient'))_0x1f9580='redis';else Object['keys'](_0x4b6795)['includes']('jetstream')&&(_0x1f9580='nats');}}return _0x1f9580;}exports['identifyProvider']=identifyProvider,exports['polyfill']={'resolveActivityType'(_0x38afda){return _0x38afda==='activity'?'hook':_0x38afda;},'providerConfig'(_0x460c56){return _0x460c56?.['connection']??_0x460c56?.['redis']??_0x460c56?.['connections'];},'meshDataConfig'(_0x242657){if(_0x242657?.['connections'])return _0x242657['connections'];return _0x242657?.['connection']??{'class':_0x242657?.['redisClass'],'options':_0x242657?.['redisOptions']};}};function identifyRedisTypeFromClass(_0x5dc712){if(_0x5dc712&&_0x5dc712['name']==='Redis'||_0x5dc712['name']==='EventEmitter')return'ioredis';else{if(_0x5dc712&&'createClient'in _0x5dc712)return'redis';}return null;}exports['identifyRedisTypeFromClass']=identifyRedisTypeFromClass;function matchesStatusCode(_0x403263,_0x155d04){if(typeof _0x155d04==='string'){const _0x3d337f='^'+_0x155d04['replace'](/\*/g,'\x5cd')+'$';return new RegExp(_0x3d337f)['test'](_0x403263['toString']());}return _0x155d04['test'](_0x403263['toString']());}exports['matchesStatusCode']=matchesStatusCode;function matchesStatus(_0x4a36c2,_0x1406d6){return _0x4a36c2===_0x1406d6;}exports['matchesStatus']=matchesStatus;function findTopKey(_0x21e7fe,_0x1c4389){for(const [_0x101850,_0x6c30cf]of Object['entries'](_0x21e7fe)){if(_0x6c30cf['hasOwnProperty'](_0x1c4389)){const _0x5a4fbc=findTopKey(_0x21e7fe,_0x101850['replace'](/^\./,''));return(_0x5a4fbc||_0x101850)['replace'](/^\./,'');}}return null;}exports['findTopKey']=findTopKey;function findSubscriptionForTrigger(_0x34b3db,_0x150f7){for(const [_0x23b76e,_0x2fb8ff]of Object['entries'](_0x34b3db)){if(_0x2fb8ff===_0x150f7)return _0x23b76e;}return null;}exports['findSubscriptionForTrigger']=findSubscriptionForTrigger;async function getSubscriptionTopic(_0x1ba39a,_0x1f2fb8,_0x2187b2){const _0x2e359a=await _0x1f2fb8['getTransitions'](_0x2187b2),_0x2a0ec7=await _0x1f2fb8['getSubscriptions'](_0x2187b2),_0x491ca3=findTopKey(_0x2e359a,_0x1ba39a),_0x207555=findSubscriptionForTrigger(_0x2a0ec7,_0x491ca3);return _0x207555;}exports['getSubscriptionTopic']=getSubscriptionTopic;function _0x2940(){const _0x26f952=['4683903hSTJpi','5892798mSXIZV','2924838wqbvhu','571326orCBoQ','1054245jnhCqx','48wLwmxA','6230325XZfrau','60bDNqWr','262665KTLYEb'];_0x2940=function(){return _0x26f952;};return _0x2940();}function getTimeSeries(_0x2ac3d7){if(_0x2ac3d7['toString']()==='infinity')return'0';const _0x2c3e76=new Date(),_0x1e46c1=_0x2ac3d7['slice'](-0x1),_0x11e778=parseInt(_0x2ac3d7['slice'](0x0,-0x1),0xa);if(_0x1e46c1==='m'){const _0x563f74=Math['floor'](_0x2c3e76['getMinutes']()/_0x11e778)*_0x11e778;_0x2c3e76['setUTCMinutes'](_0x563f74,0x0,0x0);}else _0x1e46c1==='h'&&_0x2c3e76['setUTCMinutes'](0x0,0x0,0x0);return _0x2c3e76['toISOString']()['replace'](/:\d\d\..+|-|T/g,'')['replace'](':','');}exports['getTimeSeries']=getTimeSeries;function formatISODate(_0x45c550){const _0x4eb390=_0x45c550 instanceof Date?_0x45c550:new Date(_0x45c550);return _0x4eb390['toISOString']()['replace'](/[:TZ-]/g,'');}exports['formatISODate']=formatISODate;function getSymKey(_0x160b58){const _0x559366='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x16e9fc=_0x559366['length'];if(_0x160b58<0x0||_0x160b58>=Math['pow'](_0x16e9fc,0x3))throw new Error('Number\x20out\x20of\x20range');const [_0x5d6647,_0x33629c]=divmod(_0x160b58,_0x16e9fc),[_0x112fed,_0x36f767]=divmod(_0x5d6647,_0x16e9fc);return _0x559366[_0x112fed]+_0x559366[_0x33629c]+_0x559366[_0x36f767];}exports['getSymKey']=getSymKey;function getSymVal(_0x8ebcd){const _0x548d93='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x1b5395=_0x548d93['length'];if(_0x8ebcd<0x0||_0x8ebcd>=Math['pow'](_0x1b5395,0x2))throw new Error('Number\x20out\x20of\x20range');const [_0x54af93,_0x5439ad]=divmod(_0x8ebcd,_0x1b5395);return _0x548d93[_0x54af93]+_0x548d93[_0x5439ad];}exports['getSymVal']=getSymVal;function divmod(_0xeacae,_0x1b627e){return[Math['floor'](_0xeacae/_0x1b627e),_0xeacae%_0x1b627e];}function getIndexedHash(_0x108e34,_0x1cd8eb){const _0x552c04=_0x108e34[_0x1cd8eb]||0x0,_0x8cfdf5={..._0x108e34};return delete _0x8cfdf5[_0x1cd8eb],[_0x552c04,_0x8cfdf5];}exports['getIndexedHash']=getIndexedHash;function getValueByPath(_0x538bb7,_0x43c508){const _0x38bd62=_0x43c508['split']('/');let _0x71c1dd=_0x538bb7;for(const _0x40adc5 of _0x38bd62){if(_0x71c1dd[_0x40adc5]!==undefined)_0x71c1dd=_0x71c1dd[_0x40adc5];else return undefined;}return _0x71c1dd;}exports['getValueByPath']=getValueByPath;function restoreHierarchy(_0x4a6f29){const _0x172556={};for(const _0x51531a in _0x4a6f29){if(_0x4a6f29[_0x51531a]===undefined)continue;const _0x41b182=_0x51531a['split']('/');let _0x549449=_0x172556;for(let _0x3fd7cb=0x0;_0x3fd7cb<_0x41b182['length'];_0x3fd7cb++){_0x3fd7cb===_0x41b182['length']-0x1?_0x549449[_0x41b182[_0x3fd7cb]]=_0x4a6f29[_0x51531a]:(_0x549449[_0x41b182[_0x3fd7cb]]=_0x549449[_0x41b182[_0x3fd7cb]]||{},_0x549449=_0x549449[_0x41b182[_0x3fd7cb]]);}}return _0x172556;}exports['restoreHierarchy']=restoreHierarchy;function isValidCron(_0x3551bf){const _0x1de96c=/^(\*|([0-5]?\d)) (\*|([01]?\d|2[0-3])) (\*|([12]?\d|3[01])) (\*|([1-9]|1[0-2])) (\*|([0-6](?:-[0-6])?(?:,[0-6])?))$/;return _0x1de96c['test'](_0x3551bf);}exports['isValidCron']=isValidCron;const s=_0xe18acf=>{return(0x0,ms_1['default'])(_0xe18acf)/0x3e8;};exports['s']=s;const parseStreamMessage=_0x4d8b82=>{try{return JSON['parse'](_0x4d8b82);}catch(_0x3c6ce1){logger['error']('Error\x20parsing\x20Stream\x20message',{..._0x3c6ce1});throw _0x3c6ce1;}};exports['parseStreamMessage']=parseStreamMessage;const isStreamMessage=_0x2b8013=>{return Array['isArray'](_0x2b8013)&&Array['isArray'](_0x2b8013[0x0]);};exports['isStreamMessage']=isStreamMessage;const arrayToHash=_0x3cad2c=>{const _0x2d7c51=[];let _0x10b407;for(let _0x4d0ba5=0x1;_0x4d0ba5<_0x3cad2c['length'];_0x4d0ba5++){const _0x199c20=_0x3cad2c[_0x4d0ba5],_0xa9afd6={};if(Array['isArray'](_0x199c20)){for(let _0x59c246=0x0;_0x59c246<_0x199c20['length'];_0x59c246+=0x2){const _0x4b010e=_0x199c20[_0x59c246],_0x77ac96=_0x199c20[_0x59c246+0x1];_0xa9afd6[_0x4b010e]=_0x77ac96;}_0x10b407&&(_0xa9afd6['$']=_0x10b407),_0x2d7c51['push'](_0xa9afd6),_0x10b407=undefined;}else _0x10b407=_0x199c20;}return _0x2d7c51;};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.16",
|
|
4
4
|
"description": "Unbreakable Workflows",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/hotmeshio/sdk-typescript.git"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://
|
|
11
|
+
"homepage": "https://hotmesh.io/",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
@@ -31,25 +31,25 @@
|
|
|
31
31
|
"test:connect:nats": "NODE_ENV=test jest ./tests/unit/services/connector/providers/nats.test.ts --detectOpenHandles --forceExit --verbose",
|
|
32
32
|
"test:cycle": "NODE_ENV=test jest ./tests/functional/cycle/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
33
33
|
"test:meshflow": "NODE_ENV=test jest ./tests/meshflow/*/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
34
|
-
"test:meshflow:basic": "NODE_ENV=test jest ./tests/meshflow/basic
|
|
35
|
-
"test:meshflow:collision": "NODE_ENV=test
|
|
36
|
-
"test:meshflow:fatal": "NODE_ENV=test jest ./tests/meshflow/fatal
|
|
34
|
+
"test:meshflow:basic": "NODE_ENV=test jest ./tests/meshflow/basic/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
35
|
+
"test:meshflow:collision": "NODE_ENV=test jest ./tests/meshflow/collision/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
36
|
+
"test:meshflow:fatal": "NODE_ENV=test jest ./tests/meshflow/fatal/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
37
37
|
"test:meshflow:goodbye": "NODE_ENV=test jest ./tests/meshflow/goodbye/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
38
38
|
"test:meshflow:hello": "HMSH_LOGLEVEL=debug HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/meshflow/helloworld/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
39
|
-
"test:meshflow:hook": "NODE_ENV=test jest ./tests/meshflow/hook
|
|
40
|
-
"test:meshflow:interrupt": "NODE_ENV=test jest ./tests/meshflow/interrupt
|
|
41
|
-
"test:meshflow:loopactivity": "NODE_ENV=test jest ./tests/meshflow/loopactivity
|
|
42
|
-
"test:meshflow:nested": "NODE_ENV=test jest ./tests/meshflow/nested
|
|
43
|
-
"test:meshflow:retry": "NODE_ENV=test jest ./tests/meshflow/retry
|
|
44
|
-
"test:meshflow:sleep": "NODE_ENV=test jest ./tests/meshflow/sleep
|
|
45
|
-
"test:meshflow:signal": "NODE_ENV=test jest ./tests/meshflow/signal
|
|
46
|
-
"test:meshflow:unknown": "NODE_ENV=test jest ./tests/meshflow/unknown
|
|
39
|
+
"test:meshflow:hook": "NODE_ENV=test jest ./tests/meshflow/hook/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
40
|
+
"test:meshflow:interrupt": "NODE_ENV=test jest ./tests/meshflow/interrupt/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
41
|
+
"test:meshflow:loopactivity": "NODE_ENV=test jest ./tests/meshflow/loopactivity/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
42
|
+
"test:meshflow:nested": "NODE_ENV=test jest ./tests/meshflow/nested/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
43
|
+
"test:meshflow:retry": "NODE_ENV=test jest ./tests/meshflow/retry/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
44
|
+
"test:meshflow:sleep": "NODE_ENV=test jest ./tests/meshflow/sleep/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
45
|
+
"test:meshflow:signal": "NODE_ENV=test jest ./tests/meshflow/signal/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
46
|
+
"test:meshflow:unknown": "NODE_ENV=test jest ./tests/meshflow/unknown/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
47
47
|
"test:emit": "NODE_ENV=test jest ./tests/functional/emit/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
48
48
|
"test:pending": "NODE_ENV=test jest ./tests/functional/pending/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
49
49
|
"test:functional": "NODE_ENV=test jest ./tests/functional/* --detectOpenHandles --forceExit --verbose",
|
|
50
50
|
"test:hmsh": "NODE_ENV=test jest ./tests/functional/*.test.ts --detectOpenHandles --verbose --forceExit",
|
|
51
51
|
"test:hook": "NODE_ENV=test jest ./tests/functional/hook/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
52
|
-
"test:interrupt": "NODE_ENV=test jest ./tests/functional/interrupt
|
|
52
|
+
"test:interrupt": "NODE_ENV=test jest ./tests/functional/interrupt/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
53
53
|
"test:parallel": "NODE_ENV=test jest ./tests/functional/parallel/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
54
54
|
"test:pipe": "NODE_ENV=test jest ./tests/unit/services/pipe/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
55
55
|
"test:quorum": "HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/functional/quorum/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"test:redeploy": "NODE_ENV=test jest ./tests/functional/redeploy/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
58
58
|
"test:reporter": "NODE_ENV=test jest ./tests/unit/services/reporter/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
59
59
|
"test:reentrant": "NODE_ENV=test jest ./tests/functional/reentrant/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
60
|
-
"test:retry": "NODE_ENV=test jest ./tests/functional/retry
|
|
60
|
+
"test:retry": "NODE_ENV=test jest ./tests/functional/retry/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
61
61
|
"test:sequence": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/functional/sequence/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
62
62
|
"test:signal": "NODE_ENV=test jest ./tests/functional/signal/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
63
63
|
"test:status": "NODE_ENV=test jest ./tests/functional/status/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
@@ -71,17 +71,18 @@
|
|
|
71
71
|
"test:sub:ioredis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
72
72
|
"test:sub:redis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/redis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
73
73
|
"test:trigger": "NODE_ENV=test jest ./tests/unit/services/activities/trigger.test.ts --detectOpenHandles --forceExit --verbose",
|
|
74
|
-
"test:meshdata": "NODE_ENV=test
|
|
74
|
+
"test:meshdata": "NODE_ENV=test jest ./tests/meshdata/postgres.test.ts --forceExit --verbose --detectOpenHandles",
|
|
75
75
|
"test:meshos": "NODE_ENV=test HMSH_IS_CLUSTER=true jest ./tests/meshos/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
76
|
-
"test:meshcall": "NODE_ENV=test jest ./tests/meshcall
|
|
76
|
+
"test:meshcall": "NODE_ENV=test jest ./tests/meshcall/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
77
77
|
"test:unit": "NODE_ENV=test jest ./tests/unit/*/*/index.test.ts --detectOpenHandles --forceExit --verbose"
|
|
78
78
|
},
|
|
79
79
|
"keywords": [
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
80
|
+
"Serverless Orchestration",
|
|
81
|
+
"Durable Workflow",
|
|
82
|
+
"Operational Data",
|
|
83
|
+
"Service Mesh",
|
|
84
84
|
"HotMesh",
|
|
85
|
+
"Postgres",
|
|
85
86
|
"Redis",
|
|
86
87
|
"OLAP",
|
|
87
88
|
"OLTP",
|