@hotmeshio/hotmesh 0.3.15 → 0.3.17
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 +69 -52
- package/build/modules/key.js +1 -1
- package/build/modules/utils.js +1 -1
- package/build/package.json +24 -22
- 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 +24 -22
- 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,20 @@
|
|
|
1
1
|
# HotMesh
|
|
2
2
|

|
|
3
3
|
|
|
4
|
-
**HotMesh** offers the power of Temporal.io
|
|
4
|
+
**HotMesh** offers the power of [Temporal.io](https://temporal.io) in a fully serverless architecture.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
<br/>
|
|
5
8
|
|
|
6
9
|
## Features
|
|
7
10
|
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **Decentralized Orchestration**: Centralized data with decentralized execution.
|
|
11
|
+
- **Serverless Orchestration**: Orchestrate your microservices without adding infrastructure.
|
|
12
|
+
- **No Vendor Lock-in**: Use your preferred database: *Postgres*, *Redis*, ...
|
|
11
13
|
- **Linear Scalability**: Scale your database to scale your application.
|
|
12
|
-
- **
|
|
14
|
+
- **Process Analytics**: Gain process insights with optional analytics.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<br/>
|
|
13
18
|
|
|
14
19
|
## Install
|
|
15
20
|
|
|
@@ -18,10 +23,13 @@ npm install @hotmeshio/hotmesh
|
|
|
18
23
|
```
|
|
19
24
|
|
|
20
25
|
## Learn
|
|
21
|
-
[
|
|
26
|
+
[🏠 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
27
|
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
|
|
29
|
+
<br/>
|
|
30
|
+
|
|
31
|
+
## MeshCall | Fast, Simple, Inter-Service Calls
|
|
32
|
+
[MeshCall](https://hotmeshio.github.io/sdk-typescript/classes/services_meshcall.MeshCall.html) connects any function to the mesh.
|
|
25
33
|
|
|
26
34
|
<details style="padding: .5em">
|
|
27
35
|
<summary style="font-size:1.25em;">Run an idempotent cron job <small>[more]</small></summary>
|
|
@@ -140,7 +148,7 @@ npm install @hotmeshio/hotmesh
|
|
|
140
148
|
<summary style="font-size:1.25em;">Call and <b>cache</b> a function <small>[more]</small></summary>
|
|
141
149
|
|
|
142
150
|
### Cache a Function
|
|
143
|
-
|
|
151
|
+
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
152
|
|
|
145
153
|
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
154
|
|
|
@@ -176,8 +184,11 @@ npm install @hotmeshio/hotmesh
|
|
|
176
184
|
```
|
|
177
185
|
</details>
|
|
178
186
|
|
|
187
|
+
|
|
188
|
+
<br/>
|
|
189
|
+
|
|
179
190
|
## 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).
|
|
191
|
+
[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
192
|
|
|
182
193
|
<details style="padding: .5em">
|
|
183
194
|
<summary style="font-size:1.25em;">Orchestrate unpredictable activities <small>[more]</small></summary>
|
|
@@ -204,10 +215,10 @@ When an endpoint is unpredictable, use `proxyActivities`. HotMesh will retry as
|
|
|
204
215
|
|
|
205
216
|
```typescript
|
|
206
217
|
//workflows.ts
|
|
207
|
-
import {
|
|
218
|
+
import { workflow } from '@hotmeshio/hotmesh';
|
|
208
219
|
import * as activities from './activities';
|
|
209
220
|
|
|
210
|
-
const { greet, saludar } =
|
|
221
|
+
const { greet, saludar } = workflow
|
|
211
222
|
.proxyActivities<typeof activities>({
|
|
212
223
|
activities
|
|
213
224
|
});
|
|
@@ -224,11 +235,11 @@ When an endpoint is unpredictable, use `proxyActivities`. HotMesh will retry as
|
|
|
224
235
|
|
|
225
236
|
```typescript
|
|
226
237
|
//client.ts
|
|
227
|
-
import {
|
|
238
|
+
import { Client, HotMesh } from '@hotmeshio/hotmesh';
|
|
228
239
|
import Redis from 'ioredis';
|
|
229
240
|
|
|
230
241
|
async function run(): Promise<string> {
|
|
231
|
-
const client = new
|
|
242
|
+
const client = new Client({
|
|
232
243
|
connection: {
|
|
233
244
|
class: Redis,
|
|
234
245
|
options: { host: 'redis', port: 6379 }
|
|
@@ -247,16 +258,16 @@ When an endpoint is unpredictable, use `proxyActivities`. HotMesh will retry as
|
|
|
247
258
|
}
|
|
248
259
|
```
|
|
249
260
|
|
|
250
|
-
4. Finally, create a **worker** and link the workflow function. Workers listen for tasks on their assigned
|
|
261
|
+
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
262
|
|
|
252
263
|
```typescript
|
|
253
264
|
//worker.ts
|
|
254
|
-
import {
|
|
265
|
+
import { worker } from '@hotmeshio/hotmesh';
|
|
255
266
|
import Redis from 'ioredis';
|
|
256
267
|
import * as workflows from './workflows';
|
|
257
268
|
|
|
258
269
|
async function run() {
|
|
259
|
-
const worker = await
|
|
270
|
+
const worker = await Worker.create({
|
|
260
271
|
connection: {
|
|
261
272
|
class: Redis,
|
|
262
273
|
options: { host: 'redis', port: 6379 },
|
|
@@ -280,10 +291,10 @@ Pause a function and only awaken when a matching signal is received from the out
|
|
|
280
291
|
|
|
281
292
|
```typescript
|
|
282
293
|
//waitForWorkflow.ts
|
|
283
|
-
import {
|
|
294
|
+
import { workflow } from '@hotmeshio/hotmesh';
|
|
284
295
|
|
|
285
296
|
export async function waitForExample(): Promise<{hello: string}> {
|
|
286
|
-
return await
|
|
297
|
+
return await workflow.waitFor<{hello: string}>('my-sig-nal');
|
|
287
298
|
//continue processing, use the payload, etc...
|
|
288
299
|
}
|
|
289
300
|
```
|
|
@@ -292,11 +303,11 @@ Pause a function and only awaken when a matching signal is received from the out
|
|
|
292
303
|
|
|
293
304
|
```typescript
|
|
294
305
|
//client.ts
|
|
295
|
-
import {
|
|
306
|
+
import { Client, HotMesh } from '@hotmeshio/hotmesh';
|
|
296
307
|
import Redis from 'ioredis';
|
|
297
308
|
|
|
298
309
|
async function run(): Promise<string> {
|
|
299
|
-
const client = new
|
|
310
|
+
const client = new Client({
|
|
300
311
|
connection: {
|
|
301
312
|
class: Redis,
|
|
302
313
|
options: { host: 'redis', port: 6379 }
|
|
@@ -318,12 +329,12 @@ Pause a function and only awaken when a matching signal is received from the out
|
|
|
318
329
|
|
|
319
330
|
```typescript
|
|
320
331
|
//worker.ts
|
|
321
|
-
import {
|
|
332
|
+
import { Worker } from '@hotmeshio/hotmesh';
|
|
322
333
|
import Redis from 'ioredis';
|
|
323
334
|
import * as workflows from './waitForWorkflow';
|
|
324
335
|
|
|
325
336
|
async function run() {
|
|
326
|
-
const worker = await
|
|
337
|
+
const worker = await Worker.create({
|
|
327
338
|
connection: {
|
|
328
339
|
class: Redis,
|
|
329
340
|
options: { host: 'redis', port: 6379 },
|
|
@@ -339,10 +350,10 @@ Pause a function and only awaken when a matching signal is received from the out
|
|
|
339
350
|
4. Send a signal to awaken the paused function; await the function result.
|
|
340
351
|
|
|
341
352
|
```typescript
|
|
342
|
-
import {
|
|
353
|
+
import { Client } from '@hotmeshio/hotmesh';
|
|
343
354
|
import * as Redis from Redis;
|
|
344
355
|
|
|
345
|
-
const client = new
|
|
356
|
+
const client = new Client({
|
|
346
357
|
connection: {
|
|
347
358
|
class: Redis,
|
|
348
359
|
options: { host: 'redis', port: 6379 }
|
|
@@ -373,12 +384,12 @@ Use a standard `Promise` to collate and cache multiple signals. HotMesh will onl
|
|
|
373
384
|
|
|
374
385
|
```typescript
|
|
375
386
|
//waitForWorkflows.ts
|
|
376
|
-
import {
|
|
387
|
+
import { workflow } from '@hotmeshio/hotmesh';
|
|
377
388
|
|
|
378
389
|
export async function waitForExample(): Promise<[boolean, number]> {
|
|
379
390
|
const [s1, s2] = await Promise.all([
|
|
380
|
-
|
|
381
|
-
|
|
391
|
+
workflow.waitFor<boolean>('my-sig-nal-1'),
|
|
392
|
+
workflow.waitFor<number>('my-sig-nal-2')
|
|
382
393
|
]);
|
|
383
394
|
//do something with the signal payloads (s1, s2)
|
|
384
395
|
return [s1, s2];
|
|
@@ -388,10 +399,10 @@ Use a standard `Promise` to collate and cache multiple signals. HotMesh will onl
|
|
|
388
399
|
2. Send **two** signals to awaken the paused function.
|
|
389
400
|
|
|
390
401
|
```typescript
|
|
391
|
-
import {
|
|
402
|
+
import { Client } from '@hotmeshio/hotmesh';
|
|
392
403
|
import * as Redis from Redis;
|
|
393
404
|
|
|
394
|
-
const client = new
|
|
405
|
+
const client = new Client({
|
|
395
406
|
connection: {
|
|
396
407
|
class: Redis,
|
|
397
408
|
options: { host: 'redis', port: 6379 }
|
|
@@ -425,10 +436,10 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
425
436
|
|
|
426
437
|
```typescript
|
|
427
438
|
//recurringWorkflow.ts
|
|
428
|
-
import {
|
|
439
|
+
import { workflow } from '@hotmeshio/hotmesh';
|
|
429
440
|
import * as activities from './activities';
|
|
430
441
|
|
|
431
|
-
const { statusDiagnostic } =
|
|
442
|
+
const { statusDiagnostic } = workflow
|
|
432
443
|
.proxyActivities<typeof activities>({
|
|
433
444
|
activities
|
|
434
445
|
});
|
|
@@ -436,7 +447,7 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
436
447
|
export async function recurringExample(someValue: number): Promise<void> {
|
|
437
448
|
do {
|
|
438
449
|
await statusDiagnostic(someValue);
|
|
439
|
-
} while (await
|
|
450
|
+
} while (await workflow.sleepFor('1 week'));
|
|
440
451
|
}
|
|
441
452
|
```
|
|
442
453
|
|
|
@@ -444,11 +455,11 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
444
455
|
|
|
445
456
|
```typescript
|
|
446
457
|
//client.ts
|
|
447
|
-
import {
|
|
458
|
+
import { Client, HotMesh } from '@hotmeshio/hotmesh';
|
|
448
459
|
import Redis from 'ioredis';
|
|
449
460
|
|
|
450
461
|
async function run(): Promise<string> {
|
|
451
|
-
const client = new
|
|
462
|
+
const client = new Client({
|
|
452
463
|
connection: {
|
|
453
464
|
class: Redis,
|
|
454
465
|
options: { host: 'redis', port: 6379 }
|
|
@@ -470,12 +481,12 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
470
481
|
|
|
471
482
|
```typescript
|
|
472
483
|
//worker.ts
|
|
473
|
-
import {
|
|
484
|
+
import { Worker } from '@hotmeshio/hotmesh';
|
|
474
485
|
import Redis from 'ioredis';
|
|
475
486
|
import * as workflows from './recurringWorkflow';
|
|
476
487
|
|
|
477
488
|
async function run() {
|
|
478
|
-
const worker = await
|
|
489
|
+
const worker = await Worker.create({
|
|
479
490
|
connection: {
|
|
480
491
|
class: Redis,
|
|
481
492
|
options: { host: 'redis', port: 6379 },
|
|
@@ -491,10 +502,10 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
491
502
|
4. Cancel the recurring workflow (`myRecurring123`) by calling `interrupt`.
|
|
492
503
|
|
|
493
504
|
```typescript
|
|
494
|
-
import {
|
|
505
|
+
import { Client } from '@hotmeshio/hotmesh';
|
|
495
506
|
import * as Redis from Redis;
|
|
496
507
|
|
|
497
|
-
const client = new
|
|
508
|
+
const client = new Client({
|
|
498
509
|
connection: {
|
|
499
510
|
class: Redis,
|
|
500
511
|
options: { host: 'redis', port: 6379 }
|
|
@@ -511,12 +522,10 @@ This example calls an activity and then sleeps for a week. It runs indefinitely
|
|
|
511
522
|
```
|
|
512
523
|
</details>
|
|
513
524
|
|
|
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.
|
|
525
|
+
<br/>
|
|
518
526
|
|
|
519
|
-
|
|
527
|
+
## MeshData | Transactional Analytics
|
|
528
|
+
[MeshData](https://hotmeshio.github.io/sdk-typescript/classes/services_meshdata.MeshData.html) extends the **MeshFlow** service, surfacing transactional workflows as searchable data records.
|
|
520
529
|
|
|
521
530
|
<details style="padding: .5em">
|
|
522
531
|
<summary style="font-size:1.25em;">Create a search index <small>[more]</small></summary>
|
|
@@ -541,7 +550,7 @@ This example demonstrates how to define a schema and deploy an index for a 'user
|
|
|
541
550
|
};
|
|
542
551
|
```
|
|
543
552
|
|
|
544
|
-
2. Create the
|
|
553
|
+
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
554
|
|
|
546
555
|
```typescript
|
|
547
556
|
//server.ts
|
|
@@ -697,19 +706,27 @@ This example demonstrates how to search for those workflows where a given condit
|
|
|
697
706
|
```
|
|
698
707
|
</details>
|
|
699
708
|
|
|
700
|
-
|
|
701
|
-
|
|
709
|
+
<br/>
|
|
710
|
+
|
|
711
|
+
## Metrics and Monitoring
|
|
712
|
+
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
713
|
|
|
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.
|
|
714
|
+
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
715
|
|
|
706
|
-
|
|
707
|
-
View commands, streams, data, CPU, load, etc using the RedisInsight data browser.
|
|
716
|
+
<br/>
|
|
708
717
|
|
|
709
|
-
##
|
|
718
|
+
## Examples
|
|
710
719
|
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
720
|
|
|
712
721
|
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
722
|
|
|
723
|
+
<br/>
|
|
724
|
+
|
|
714
725
|
## Advanced
|
|
715
726
|
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).
|
|
727
|
+
|
|
728
|
+
<br/>
|
|
729
|
+
|
|
730
|
+
## Disclaimer
|
|
731
|
+
|
|
732
|
+
This project is not affiliated with, endorsed by, or sponsored by Temporal Technologies, Inc. Temporal is a trademark of Temporal Technologies, Inc., and all references to Temporal and related technologies are for educational and demonstration purposes only.
|
package/build/modules/key.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x217fb8,_0x4697cd){const _0x61fecb=_0x5d64,_0x4e02ca=_0x217fb8();while(!![]){try{const _0x223be5=-parseInt(_0x61fecb(0xba))/0x1*(-parseInt(_0x61fecb(0xc1))/0x2)+parseInt(_0x61fecb(0xbc))/0x3+-parseInt(_0x61fecb(0xbe))/0x4+-parseInt(_0x61fecb(0xc2))/0x5+parseInt(_0x61fecb(0xbf))/0x6*(-parseInt(_0x61fecb(0xbd))/0x7)+parseInt(_0x61fecb(0xc0))/0x8+parseInt(_0x61fecb(0xbb))/0x9;if(_0x223be5===_0x4697cd)break;else _0x4e02ca['push'](_0x4e02ca['shift']());}catch(_0x126415){_0x4e02ca['push'](_0x4e02ca['shift']());}}}(_0x294e,0xd3f92));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'];}});function _0x294e(){const _0x2e8a7a=['226635OQZRJC','287kKHKfG','763268isTUIn','192576kNCbQF','3007816kLlnqf','2QbMZJm','2145925tGRmUH','606493aMLVmV','15715485cpUprW'];_0x294e=function(){return _0x2e8a7a;};return _0x294e();}function _0x5d64(_0x3c16a2,_0x118b0a){const _0x294ec0=_0x294e();return _0x5d64=function(_0x5d6409,_0x5be7eb){_0x5d6409=_0x5d6409-0xba;let _0xfff89d=_0x294ec0[_0x5d6409];return _0xfff89d;},_0x5d64(_0x3c16a2,_0x118b0a);}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;class KeyService{static['mintKey'](_0x367ba0,_0x4a058d,_0x57077e){switch(_0x4a058d){case hotmesh_1['KeyType']['HOTMESH']:return _0x367ba0;case hotmesh_1['KeyType']['THROTTLE_RATE']:return _0x367ba0+':'+_0x57077e['appId']+':r:';case hotmesh_1['KeyType']['WORK_ITEMS']:return _0x367ba0+':'+_0x57077e['appId']+':w:'+(_0x57077e['scoutType']||'');case hotmesh_1['KeyType']['TIME_RANGE']:return _0x367ba0+':'+_0x57077e['appId']+':t:'+(_0x57077e['timeValue']||'');case hotmesh_1['KeyType']['APP']:return _0x367ba0+':a:'+(_0x57077e['appId']||'');case hotmesh_1['KeyType']['QUORUM']:return _0x367ba0+':'+_0x57077e['appId']+':q:'+(_0x57077e['engineId']||'');case hotmesh_1['KeyType']['JOB_STATE']:return _0x367ba0+':'+_0x57077e['appId']+':j:'+_0x57077e['jobId'];case hotmesh_1['KeyType']['JOB_DEPENDENTS']:return _0x367ba0+':'+_0x57077e['appId']+':d:'+_0x57077e['jobId'];case hotmesh_1['KeyType']['JOB_STATS_GENERAL']:return _0x367ba0+':'+_0x57077e['appId']+':s:'+_0x57077e['jobKey']+':'+_0x57077e['dateTime'];case hotmesh_1['KeyType']['JOB_STATS_MEDIAN']:return _0x367ba0+':'+_0x57077e['appId']+':s:'+_0x57077e['jobKey']+':'+_0x57077e['dateTime']+':'+_0x57077e['facet'];case hotmesh_1['KeyType']['JOB_STATS_INDEX']:return _0x367ba0+':'+_0x57077e['appId']+':s:'+_0x57077e['jobKey']+':'+_0x57077e['dateTime']+':'+_0x57077e['facet'];case hotmesh_1['KeyType']['SCHEMAS']:return _0x367ba0+':'+_0x57077e['appId']+':v:'+_0x57077e['appVersion']+':schemas';case hotmesh_1['KeyType']['SUBSCRIPTIONS']:return _0x367ba0+':'+_0x57077e['appId']+':v:'+_0x57077e['appVersion']+':subscriptions';case hotmesh_1['KeyType']['SUBSCRIPTION_PATTERNS']:return _0x367ba0+':'+_0x57077e['appId']+':v:'+_0x57077e['appVersion']+':transitions';case hotmesh_1['KeyType']['HOOKS']:return _0x367ba0+':'+_0x57077e['appId']+':hooks';case hotmesh_1['KeyType']['SIGNALS']:return _0x367ba0+':'+_0x57077e['appId']+':signals';case hotmesh_1['KeyType']['SYMKEYS']:return _0x367ba0+':'+_0x57077e['appId']+':sym:keys:'+(_0x57077e['activityId']||'');case hotmesh_1['KeyType']['SYMVALS']:return _0x367ba0+':'+_0x57077e['appId']+':sym:vals:';case hotmesh_1['KeyType']['STREAMS']:return _0x367ba0+':'+(_0x57077e['appId']||'')+':x:'+(_0x57077e['topic']||'');default:throw new Error('Invalid\x20key\x20type.');}}static['parseKey'](_0x7c6d8a){const [_0x590fa7,_0x330bb9,_0x3efee2,..._0xaf31dd]=_0x7c6d8a['split'](KEYSEP),_0x2171db=_0xaf31dd['join'](KEYSEP)||'';return{'namespace':_0x590fa7,'app':_0x3efee2==='a'?_0x330bb9:undefined,'entity':_0x3efee2,'id':_0x2171db};}static['reconstituteKey'](_0x4f6509){const {namespace:_0x2c3209,app:_0x449667,entity:_0xabb5a1,id:_0x15bc46}=_0x4f6509;return''+_0x2c3209+KEYSEP+_0x449667+KEYSEP+_0xabb5a1+KEYSEP+(_0x15bc46||'');}static['resolveEntityType'](_0x3d1b66,_0x486ca4=''){switch(_0x3d1b66){case'a':return'applications';case'r':return'throttles';case'w':return _0x486ca4===''?'task_priorities':'roles';case't':return _0x486ca4===''?'task_schedules':'task_lists';case'q':return'events';case'j':return'jobs';case's':return'stats';case'v':return'versions';case'x':return _0x486ca4===''?'streams':'stream_topics';case'hooks':return'signal_patterns';case'signals':return'signal_registry';case'sym':return'symbols';default:return'unknown_entity';}}static['resolveAbbreviation'](_0x33b75a){switch(_0x33b75a){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(_0x353704,_0x1a2b40){const _0x5c5fea=_0x4f67,_0x385401=_0x353704();while(!![]){try{const _0x249f6c=-parseInt(_0x5c5fea(0x9b))/0x1+parseInt(_0x5c5fea(0x9d))/0x2*(parseInt(_0x5c5fea(0x9c))/0x3)+-parseInt(_0x5c5fea(0x9a))/0x4*(-parseInt(_0x5c5fea(0xa0))/0x5)+-parseInt(_0x5c5fea(0xa3))/0x6+-parseInt(_0x5c5fea(0x9e))/0x7*(-parseInt(_0x5c5fea(0x99))/0x8)+-parseInt(_0x5c5fea(0xa2))/0x9+parseInt(_0x5c5fea(0x9f))/0xa*(parseInt(_0x5c5fea(0xa1))/0xb);if(_0x249f6c===_0x1a2b40)break;else _0x385401['push'](_0x385401['shift']());}catch(_0x512fcd){_0x385401['push'](_0x385401['shift']());}}}(_0x4628,0xd67bd));var __importDefault=this&&this['__importDefault']||function(_0xf415df){return _0xf415df&&_0xf415df['__esModule']?_0xf415df:{'default':_0xf415df};};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=_0x55bf5d=>{const _0x30337c=JSON['stringify'](_0x55bf5d);return(0x0,crypto_1['createHash'])('sha256')['update'](_0x30337c)['digest']('hex');};exports['hashOptions']=hashOptions;async function getSystemHealth(){const _0x15ddf0=os_1['default']['totalmem'](),_0x123c57=os_1['default']['freemem'](),_0x4d1cb5=_0x15ddf0-_0x123c57,_0x53627b={'TotalMemoryGB':(_0x15ddf0/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','FreeMemoryGB':(_0x123c57/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','UsedMemoryGB':(_0x4d1cb5/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','CPULoad':[],'NetworkStats':[]};return _0x53627b;}exports['getSystemHealth']=getSystemHealth;function deepCopy(_0x317cf9){return JSON['parse'](JSON['stringify'](_0x317cf9));}exports['deepCopy']=deepCopy;function deterministicRandom(_0x37f417){const _0x236d0e=Math['sin'](_0x37f417)*0x2710;return _0x236d0e-Math['floor'](_0x236d0e);}exports['deterministicRandom']=deterministicRandom;function guid(_0xcbab7f=enums_1['HMSH_GUID_SIZE']){return'H'+(0x0,nanoid_1['nanoid'])(_0xcbab7f);}exports['guid']=guid;async function sleepFor(_0x12fc9e){return new Promise(_0x5da2c3=>setTimeout(_0x5da2c3,_0x12fc9e));}exports['sleepFor']=sleepFor;function sleepImmediate(){return new Promise(_0x3f236d=>setImmediate(_0x3f236d));}exports['sleepImmediate']=sleepImmediate;function XSleepFor(_0x510fc0){let _0x3091f8;const _0xc0facc=new Promise(_0x255f4b=>{_0x3091f8=setTimeout(_0x255f4b,_0x510fc0);});return{'promise':_0xc0facc,'timerId':_0x3091f8};}exports['XSleepFor']=XSleepFor;function identifyProvider(_0x292a38){const _0x493904=Object['getPrototypeOf'](_0x292a38);if(_0x292a38['Query']?.['prototype']||Object['keys'](_0x292a38)['includes']('database'))return'postgres';else{if(_0x292a38['constructor']&&_0x292a38['constructor']['name']==='Client')return'nats';else{if('defineCommand'in _0x493904||Object['keys'](_0x493904)['includes']('multi'))return'ioredis';else{if(Object['keys'](_0x493904)['includes']('Multi'))return'redis';}}}if(_0x292a38['constructor']){if(_0x292a38['constructor']['name']==='Redis'||_0x292a38['constructor']['name']==='EventEmitter'){if('hset'in _0x292a38)return'ioredis';}else{if(_0x292a38['constructor']['name']==='ProviderClient'||_0x292a38['constructor']['name']==='Commander'){if('HSET'in _0x292a38)return'redis';}}}let _0x19b330=null;if(Object['keys'](_0x292a38)['includes']('connection'))_0x19b330='postgres';else{if(Object['keys'](_0x292a38)['includes']('Pipeline'))_0x19b330='ioredis';else{if(Object['keys'](_0x292a38)['includes']('createClient'))_0x19b330='redis';else Object['keys'](_0x292a38)['includes']('jetstream')&&(_0x19b330='nats');}}return _0x19b330;}exports['identifyProvider']=identifyProvider,exports['polyfill']={'resolveActivityType'(_0x403e08){return _0x403e08==='activity'?'hook':_0x403e08;},'providerConfig'(_0x33c1e9){return _0x33c1e9?.['connection']??_0x33c1e9?.['redis'];},'meshDataConfig'(_0xf10d7d){if(_0xf10d7d?.['connections'])return _0xf10d7d['connections'];return _0xf10d7d?.['connection']??{'class':_0xf10d7d?.['redisClass'],'options':_0xf10d7d?.['redisOptions']};}};function identifyRedisTypeFromClass(_0x4fc0f5){if(_0x4fc0f5&&_0x4fc0f5['name']==='Redis'||_0x4fc0f5['name']==='EventEmitter')return'ioredis';else{if(_0x4fc0f5&&'createClient'in _0x4fc0f5)return'redis';}return null;}exports['identifyRedisTypeFromClass']=identifyRedisTypeFromClass;function matchesStatusCode(_0x166e70,_0x2f9ec9){if(typeof _0x2f9ec9==='string'){const _0x349b73='^'+_0x2f9ec9['replace'](/\*/g,'\x5cd')+'$';return new RegExp(_0x349b73)['test'](_0x166e70['toString']());}return _0x2f9ec9['test'](_0x166e70['toString']());}exports['matchesStatusCode']=matchesStatusCode;function matchesStatus(_0x5b4c8e,_0x3d1a20){return _0x5b4c8e===_0x3d1a20;}exports['matchesStatus']=matchesStatus;function findTopKey(_0x4256c4,_0x5afdc3){for(const [_0x365628,_0x48e200]of Object['entries'](_0x4256c4)){if(_0x48e200['hasOwnProperty'](_0x5afdc3)){const _0x322112=findTopKey(_0x4256c4,_0x365628['replace'](/^\./,''));return(_0x322112||_0x365628)['replace'](/^\./,'');}}return null;}exports['findTopKey']=findTopKey;function findSubscriptionForTrigger(_0x4947de,_0x304596){for(const [_0x81295a,_0x44167c]of Object['entries'](_0x4947de)){if(_0x44167c===_0x304596)return _0x81295a;}return null;}exports['findSubscriptionForTrigger']=findSubscriptionForTrigger;function _0x4628(){const _0xe459bb=['156874aWxRXN','623OqVPkM','58350ZMBbGi','51775mTOoHC','1441QZbpAT','3145959ZfHnEq','3382800HKzBMN','141704Ihicuc','60fUdrZL','939602ZVORtC','9KmNazl'];_0x4628=function(){return _0xe459bb;};return _0x4628();}async function getSubscriptionTopic(_0x42f57c,_0x314a25,_0x24e796){const _0x1b5e70=await _0x314a25['getTransitions'](_0x24e796),_0x9d6fc2=await _0x314a25['getSubscriptions'](_0x24e796),_0x3c0f8b=findTopKey(_0x1b5e70,_0x42f57c),_0x14ad7f=findSubscriptionForTrigger(_0x9d6fc2,_0x3c0f8b);return _0x14ad7f;}exports['getSubscriptionTopic']=getSubscriptionTopic;function getTimeSeries(_0x3b68f3){if(_0x3b68f3['toString']()==='infinity')return'0';const _0x6d1db8=new Date(),_0x5835c9=_0x3b68f3['slice'](-0x1),_0x34975a=parseInt(_0x3b68f3['slice'](0x0,-0x1),0xa);if(_0x5835c9==='m'){const _0x25f766=Math['floor'](_0x6d1db8['getMinutes']()/_0x34975a)*_0x34975a;_0x6d1db8['setUTCMinutes'](_0x25f766,0x0,0x0);}else _0x5835c9==='h'&&_0x6d1db8['setUTCMinutes'](0x0,0x0,0x0);return _0x6d1db8['toISOString']()['replace'](/:\d\d\..+|-|T/g,'')['replace'](':','');}exports['getTimeSeries']=getTimeSeries;function formatISODate(_0x4c558e){const _0x4a68be=_0x4c558e instanceof Date?_0x4c558e:new Date(_0x4c558e);return _0x4a68be['toISOString']()['replace'](/[:TZ-]/g,'');}exports['formatISODate']=formatISODate;function getSymKey(_0x2493b1){const _0x21b4f3='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x2a7794=_0x21b4f3['length'];if(_0x2493b1<0x0||_0x2493b1>=Math['pow'](_0x2a7794,0x3))throw new Error('Number\x20out\x20of\x20range');const [_0x171141,_0x42bbae]=divmod(_0x2493b1,_0x2a7794),[_0x133a90,_0x291411]=divmod(_0x171141,_0x2a7794);return _0x21b4f3[_0x133a90]+_0x21b4f3[_0x42bbae]+_0x21b4f3[_0x291411];}exports['getSymKey']=getSymKey;function getSymVal(_0x12b9fc){const _0x18b48f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x321903=_0x18b48f['length'];if(_0x12b9fc<0x0||_0x12b9fc>=Math['pow'](_0x321903,0x2))throw new Error('Number\x20out\x20of\x20range');const [_0x48f914,_0x7fa42e]=divmod(_0x12b9fc,_0x321903);return _0x18b48f[_0x48f914]+_0x18b48f[_0x7fa42e];}exports['getSymVal']=getSymVal;function divmod(_0x539f11,_0x3c0be8){return[Math['floor'](_0x539f11/_0x3c0be8),_0x539f11%_0x3c0be8];}function getIndexedHash(_0x17fb91,_0x4c9d19){const _0x16ab54=_0x17fb91[_0x4c9d19]||0x0,_0x318bc9={..._0x17fb91};return delete _0x318bc9[_0x4c9d19],[_0x16ab54,_0x318bc9];}exports['getIndexedHash']=getIndexedHash;function getValueByPath(_0x44fdfa,_0x1266e4){const _0x5ada40=_0x1266e4['split']('/');let _0xb2c1ae=_0x44fdfa;for(const _0x326324 of _0x5ada40){if(_0xb2c1ae[_0x326324]!==undefined)_0xb2c1ae=_0xb2c1ae[_0x326324];else return undefined;}return _0xb2c1ae;}exports['getValueByPath']=getValueByPath;function restoreHierarchy(_0x9b9222){const _0x2fda33={};for(const _0x5d4f79 in _0x9b9222){if(_0x9b9222[_0x5d4f79]===undefined)continue;const _0x34832e=_0x5d4f79['split']('/');let _0x157093=_0x2fda33;for(let _0x16a19=0x0;_0x16a19<_0x34832e['length'];_0x16a19++){_0x16a19===_0x34832e['length']-0x1?_0x157093[_0x34832e[_0x16a19]]=_0x9b9222[_0x5d4f79]:(_0x157093[_0x34832e[_0x16a19]]=_0x157093[_0x34832e[_0x16a19]]||{},_0x157093=_0x157093[_0x34832e[_0x16a19]]);}}return _0x2fda33;}exports['restoreHierarchy']=restoreHierarchy;function isValidCron(_0x2a7fb2){const _0x133db8=/^(\*|([0-5]?\d)) (\*|([01]?\d|2[0-3])) (\*|([12]?\d|3[01])) (\*|([1-9]|1[0-2])) (\*|([0-6](?:-[0-6])?(?:,[0-6])?))$/;return _0x133db8['test'](_0x2a7fb2);}exports['isValidCron']=isValidCron;const s=_0x560bcd=>{return(0x0,ms_1['default'])(_0x560bcd)/0x3e8;};function _0x4f67(_0x14c0a9,_0x36e33e){const _0x462876=_0x4628();return _0x4f67=function(_0x4f67be,_0x433d07){_0x4f67be=_0x4f67be-0x99;let _0x4f8f35=_0x462876[_0x4f67be];return _0x4f8f35;},_0x4f67(_0x14c0a9,_0x36e33e);}exports['s']=s;const parseStreamMessage=_0x39c31d=>{try{return JSON['parse'](_0x39c31d);}catch(_0x47969c){logger['error']('Error\x20parsing\x20Stream\x20message',{..._0x47969c});throw _0x47969c;}};exports['parseStreamMessage']=parseStreamMessage;const isStreamMessage=_0x2c1706=>{return Array['isArray'](_0x2c1706)&&Array['isArray'](_0x2c1706[0x0]);};exports['isStreamMessage']=isStreamMessage;const arrayToHash=_0x2fb71e=>{const _0x43614e=[];let _0x4ebe9b;for(let _0xaf9a46=0x1;_0xaf9a46<_0x2fb71e['length'];_0xaf9a46++){const _0x49f880=_0x2fb71e[_0xaf9a46],_0x4e2c74={};if(Array['isArray'](_0x49f880)){for(let _0x53041c=0x0;_0x53041c<_0x49f880['length'];_0x53041c+=0x2){const _0x5ccd0e=_0x49f880[_0x53041c],_0x31700f=_0x49f880[_0x53041c+0x1];_0x4e2c74[_0x5ccd0e]=_0x31700f;}_0x4ebe9b&&(_0x4e2c74['$']=_0x4ebe9b),_0x43614e['push'](_0x4e2c74),_0x4ebe9b=undefined;}else _0x4ebe9b=_0x49f880;}return _0x43614e;};exports['arrayToHash']=arrayToHash;
|
|
1
|
+
'use strict';(function(_0x39a741,_0x4f06aa){const _0x2f4c6b=_0x3b19,_0x32d838=_0x39a741();while(!![]){try{const _0x216418=parseInt(_0x2f4c6b(0x1c2))/0x1*(parseInt(_0x2f4c6b(0x1c9))/0x2)+-parseInt(_0x2f4c6b(0x1c7))/0x3*(parseInt(_0x2f4c6b(0x1be))/0x4)+parseInt(_0x2f4c6b(0x1c6))/0x5*(-parseInt(_0x2f4c6b(0x1c0))/0x6)+parseInt(_0x2f4c6b(0x1c4))/0x7*(-parseInt(_0x2f4c6b(0x1bd))/0x8)+-parseInt(_0x2f4c6b(0x1c5))/0x9+-parseInt(_0x2f4c6b(0x1c1))/0xa*(parseInt(_0x2f4c6b(0x1c8))/0xb)+parseInt(_0x2f4c6b(0x1bf))/0xc*(parseInt(_0x2f4c6b(0x1c3))/0xd);if(_0x216418===_0x4f06aa)break;else _0x32d838['push'](_0x32d838['shift']());}catch(_0x1bb3d4){_0x32d838['push'](_0x32d838['shift']());}}}(_0x5e93,0x5f617));var __importDefault=this&&this['__importDefault']||function(_0x45c4e6){return _0x45c4e6&&_0x45c4e6['__esModule']?_0x45c4e6:{'default':_0x45c4e6};};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=_0x3d74b5=>{const _0x57d5f4=JSON['stringify'](_0x3d74b5);return(0x0,crypto_1['createHash'])('sha256')['update'](_0x57d5f4)['digest']('hex');};exports['hashOptions']=hashOptions;async function getSystemHealth(){const _0x46870c=os_1['default']['totalmem'](),_0xecf354=os_1['default']['freemem'](),_0x23fddb=_0x46870c-_0xecf354,_0x33f834={'TotalMemoryGB':(_0x46870c/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','FreeMemoryGB':(_0xecf354/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','UsedMemoryGB':(_0x23fddb/0x400/0x400/0x400)['toFixed'](0x2)+'\x20GB','CPULoad':[],'NetworkStats':[]};return _0x33f834;}exports['getSystemHealth']=getSystemHealth;function deepCopy(_0x291d68){return JSON['parse'](JSON['stringify'](_0x291d68));}exports['deepCopy']=deepCopy;function deterministicRandom(_0xd5cb12){const _0x446ca9=Math['sin'](_0xd5cb12)*0x2710;return _0x446ca9-Math['floor'](_0x446ca9);}exports['deterministicRandom']=deterministicRandom;function guid(_0x3a6c8f=enums_1['HMSH_GUID_SIZE']){return'H'+(0x0,nanoid_1['nanoid'])(_0x3a6c8f);}exports['guid']=guid;async function sleepFor(_0x182d8a){return new Promise(_0x41e55d=>setTimeout(_0x41e55d,_0x182d8a));}exports['sleepFor']=sleepFor;function sleepImmediate(){return new Promise(_0x56a76f=>setImmediate(_0x56a76f));}exports['sleepImmediate']=sleepImmediate;function _0x5e93(){const _0x433b8d=['15942Bgyvxj','231JchcFS','8eQHGLD','349208ZiiuIe','284XXHZNh','1539852LvgNyq','282YnTggY','203760OohNRS','74740dvKxlD','169BHvAVF','21CujXIB','2806029mFiivs','34950thfAkx'];_0x5e93=function(){return _0x433b8d;};return _0x5e93();}function XSleepFor(_0x3a1dfd){let _0x41a38a;const _0x581ccc=new Promise(_0x225723=>{_0x41a38a=setTimeout(_0x225723,_0x3a1dfd);});return{'promise':_0x581ccc,'timerId':_0x41a38a};}exports['XSleepFor']=XSleepFor;function identifyProvider(_0x45958d){const _0xc8f55f=Object['getPrototypeOf'](_0x45958d);if(_0x45958d['Query']?.['prototype']||Object['keys'](_0x45958d)['includes']('database'))return'postgres';else{if(_0x45958d['constructor']&&_0x45958d['constructor']['name']==='Client')return'nats';else{if('defineCommand'in _0xc8f55f||Object['keys'](_0xc8f55f)['includes']('multi'))return'ioredis';else{if(Object['keys'](_0xc8f55f)['includes']('Multi'))return'redis';}}}if(_0x45958d['constructor']){if(_0x45958d['constructor']['name']==='Redis'||_0x45958d['constructor']['name']==='EventEmitter'){if('hset'in _0x45958d)return'ioredis';}else{if(_0x45958d['constructor']['name']==='ProviderClient'||_0x45958d['constructor']['name']==='Commander'){if('HSET'in _0x45958d)return'redis';}}}let _0x44ccef=null;if(Object['keys'](_0x45958d)['includes']('connection'))_0x44ccef='postgres';else{if(Object['keys'](_0x45958d)['includes']('Pipeline'))_0x44ccef='ioredis';else{if(Object['keys'](_0x45958d)['includes']('createClient'))_0x44ccef='redis';else Object['keys'](_0x45958d)['includes']('jetstream')&&(_0x44ccef='nats');}}return _0x44ccef;}exports['identifyProvider']=identifyProvider,exports['polyfill']={'resolveActivityType'(_0x1a7829){return _0x1a7829==='activity'?'hook':_0x1a7829;},'providerConfig'(_0x5db966){return _0x5db966?.['connection']??_0x5db966?.['redis']??_0x5db966?.['connections'];},'meshDataConfig'(_0x5d6232){if(_0x5d6232?.['connections'])return _0x5d6232['connections'];return _0x5d6232?.['connection']??{'class':_0x5d6232?.['redisClass'],'options':_0x5d6232?.['redisOptions']};}};function identifyRedisTypeFromClass(_0x2758e2){if(_0x2758e2&&_0x2758e2['name']==='Redis'||_0x2758e2['name']==='EventEmitter')return'ioredis';else{if(_0x2758e2&&'createClient'in _0x2758e2)return'redis';}return null;}exports['identifyRedisTypeFromClass']=identifyRedisTypeFromClass;function matchesStatusCode(_0x1fcb6e,_0x2819dc){if(typeof _0x2819dc==='string'){const _0x365d14='^'+_0x2819dc['replace'](/\*/g,'\x5cd')+'$';return new RegExp(_0x365d14)['test'](_0x1fcb6e['toString']());}return _0x2819dc['test'](_0x1fcb6e['toString']());}exports['matchesStatusCode']=matchesStatusCode;function matchesStatus(_0x7901b0,_0x11961d){return _0x7901b0===_0x11961d;}exports['matchesStatus']=matchesStatus;function findTopKey(_0x51f169,_0x46bd8a){for(const [_0x3f0a7d,_0x224512]of Object['entries'](_0x51f169)){if(_0x224512['hasOwnProperty'](_0x46bd8a)){const _0x5bf32d=findTopKey(_0x51f169,_0x3f0a7d['replace'](/^\./,''));return(_0x5bf32d||_0x3f0a7d)['replace'](/^\./,'');}}return null;}exports['findTopKey']=findTopKey;function findSubscriptionForTrigger(_0x12e7c5,_0x37034f){for(const [_0x1aeb58,_0x452f46]of Object['entries'](_0x12e7c5)){if(_0x452f46===_0x37034f)return _0x1aeb58;}return null;}exports['findSubscriptionForTrigger']=findSubscriptionForTrigger;async function getSubscriptionTopic(_0x1e0e5c,_0xecf942,_0x7fa2b1){const _0x44564d=await _0xecf942['getTransitions'](_0x7fa2b1),_0x53ccf5=await _0xecf942['getSubscriptions'](_0x7fa2b1),_0x53946d=findTopKey(_0x44564d,_0x1e0e5c),_0x10295c=findSubscriptionForTrigger(_0x53ccf5,_0x53946d);return _0x10295c;}function _0x3b19(_0x4c4a1b,_0x29cc26){const _0x5e936e=_0x5e93();return _0x3b19=function(_0x3b1996,_0x22240e){_0x3b1996=_0x3b1996-0x1bd;let _0x1e0a97=_0x5e936e[_0x3b1996];return _0x1e0a97;},_0x3b19(_0x4c4a1b,_0x29cc26);}exports['getSubscriptionTopic']=getSubscriptionTopic;function getTimeSeries(_0x2ced0d){if(_0x2ced0d['toString']()==='infinity')return'0';const _0x4f4493=new Date(),_0x1526f6=_0x2ced0d['slice'](-0x1),_0x462e74=parseInt(_0x2ced0d['slice'](0x0,-0x1),0xa);if(_0x1526f6==='m'){const _0x521c0f=Math['floor'](_0x4f4493['getMinutes']()/_0x462e74)*_0x462e74;_0x4f4493['setUTCMinutes'](_0x521c0f,0x0,0x0);}else _0x1526f6==='h'&&_0x4f4493['setUTCMinutes'](0x0,0x0,0x0);return _0x4f4493['toISOString']()['replace'](/:\d\d\..+|-|T/g,'')['replace'](':','');}exports['getTimeSeries']=getTimeSeries;function formatISODate(_0x2aac6f){const _0x2f11ed=_0x2aac6f instanceof Date?_0x2aac6f:new Date(_0x2aac6f);return _0x2f11ed['toISOString']()['replace'](/[:TZ-]/g,'');}exports['formatISODate']=formatISODate;function getSymKey(_0x952196){const _0x8943a6='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x5596e2=_0x8943a6['length'];if(_0x952196<0x0||_0x952196>=Math['pow'](_0x5596e2,0x3))throw new Error('Number\x20out\x20of\x20range');const [_0x3f0a3d,_0x54dce7]=divmod(_0x952196,_0x5596e2),[_0x433f1e,_0x16833f]=divmod(_0x3f0a3d,_0x5596e2);return _0x8943a6[_0x433f1e]+_0x8943a6[_0x54dce7]+_0x8943a6[_0x16833f];}exports['getSymKey']=getSymKey;function getSymVal(_0x51fb2d){const _0x1bcd29='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',_0x46252c=_0x1bcd29['length'];if(_0x51fb2d<0x0||_0x51fb2d>=Math['pow'](_0x46252c,0x2))throw new Error('Number\x20out\x20of\x20range');const [_0x12f932,_0x15c0b2]=divmod(_0x51fb2d,_0x46252c);return _0x1bcd29[_0x12f932]+_0x1bcd29[_0x15c0b2];}exports['getSymVal']=getSymVal;function divmod(_0x11b10d,_0x6c533d){return[Math['floor'](_0x11b10d/_0x6c533d),_0x11b10d%_0x6c533d];}function getIndexedHash(_0x53cd32,_0x32298c){const _0x37d287=_0x53cd32[_0x32298c]||0x0,_0x190b60={..._0x53cd32};return delete _0x190b60[_0x32298c],[_0x37d287,_0x190b60];}exports['getIndexedHash']=getIndexedHash;function getValueByPath(_0x5386bc,_0x4487b3){const _0xede79d=_0x4487b3['split']('/');let _0x16b2cf=_0x5386bc;for(const _0x4cb641 of _0xede79d){if(_0x16b2cf[_0x4cb641]!==undefined)_0x16b2cf=_0x16b2cf[_0x4cb641];else return undefined;}return _0x16b2cf;}exports['getValueByPath']=getValueByPath;function restoreHierarchy(_0x2b4797){const _0x907b2a={};for(const _0x11c70f in _0x2b4797){if(_0x2b4797[_0x11c70f]===undefined)continue;const _0x24f8e7=_0x11c70f['split']('/');let _0x342927=_0x907b2a;for(let _0x2ef784=0x0;_0x2ef784<_0x24f8e7['length'];_0x2ef784++){_0x2ef784===_0x24f8e7['length']-0x1?_0x342927[_0x24f8e7[_0x2ef784]]=_0x2b4797[_0x11c70f]:(_0x342927[_0x24f8e7[_0x2ef784]]=_0x342927[_0x24f8e7[_0x2ef784]]||{},_0x342927=_0x342927[_0x24f8e7[_0x2ef784]]);}}return _0x907b2a;}exports['restoreHierarchy']=restoreHierarchy;function isValidCron(_0x366863){const _0x1d56c2=/^(\*|([0-5]?\d)) (\*|([01]?\d|2[0-3])) (\*|([12]?\d|3[01])) (\*|([1-9]|1[0-2])) (\*|([0-6](?:-[0-6])?(?:,[0-6])?))$/;return _0x1d56c2['test'](_0x366863);}exports['isValidCron']=isValidCron;const s=_0x16ebc3=>{return(0x0,ms_1['default'])(_0x16ebc3)/0x3e8;};exports['s']=s;const parseStreamMessage=_0x23f23f=>{try{return JSON['parse'](_0x23f23f);}catch(_0x5a97eb){logger['error']('Error\x20parsing\x20Stream\x20message',{..._0x5a97eb});throw _0x5a97eb;}};exports['parseStreamMessage']=parseStreamMessage;const isStreamMessage=_0x168efb=>{return Array['isArray'](_0x168efb)&&Array['isArray'](_0x168efb[0x0]);};exports['isStreamMessage']=isStreamMessage;const arrayToHash=_0x22d796=>{const _0x34c4df=[];let _0xf3e0f0;for(let _0x272a56=0x1;_0x272a56<_0x22d796['length'];_0x272a56++){const _0x101841=_0x22d796[_0x272a56],_0x21a062={};if(Array['isArray'](_0x101841)){for(let _0x342a81=0x0;_0x342a81<_0x101841['length'];_0x342a81+=0x2){const _0x28ef01=_0x101841[_0x342a81],_0x21b610=_0x101841[_0x342a81+0x1];_0x21a062[_0x28ef01]=_0x21b610;}_0xf3e0f0&&(_0x21a062['$']=_0xf3e0f0),_0x34c4df['push'](_0x21a062),_0xf3e0f0=undefined;}else _0xf3e0f0=_0x101841;}return _0x34c4df;};exports['arrayToHash']=arrayToHash;
|
package/build/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.17",
|
|
4
|
+
"description": "Serverless Workflow",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
7
7
|
"repository": {
|
|
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,19 @@
|
|
|
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
|
+
"Serverless Workflow",
|
|
82
|
+
"Durable Workflow",
|
|
83
|
+
"Operational Data",
|
|
84
|
+
"Service Mesh",
|
|
84
85
|
"HotMesh",
|
|
86
|
+
"Postgres",
|
|
85
87
|
"Redis",
|
|
86
88
|
"OLAP",
|
|
87
89
|
"OLTP",
|