@hotmeshio/hotmesh 0.3.29 → 0.3.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +8 -2
- package/build/index.js +13 -7
- package/build/modules/enums.d.ts +65 -1
- package/build/modules/enums.js +79 -5
- package/build/modules/key.d.ts +52 -0
- package/build/modules/key.js +1 -1
- package/build/modules/utils.d.ts +73 -0
- package/build/modules/utils.js +1 -1
- package/build/package.json +6 -4
- package/build/services/activities/activity.d.ts +36 -0
- package/build/services/activities/activity.js +1 -1
- package/build/services/activities/await.js +1 -1
- package/build/services/activities/cycle.d.ts +7 -0
- package/build/services/activities/cycle.js +1 -1
- package/build/services/activities/hook.d.ts +6 -0
- 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.d.ts +6 -0
- package/build/services/activities/signal.js +1 -1
- package/build/services/activities/trigger.d.ts +7 -0
- package/build/services/activities/trigger.js +1 -1
- package/build/services/activities/worker.js +1 -1
- package/build/services/collator/index.d.ts +76 -0
- package/build/services/collator/index.js +1 -1
- package/build/services/compiler/deployer.js +1 -1
- package/build/services/compiler/index.d.ts +15 -0
- package/build/services/compiler/index.js +1 -1
- package/build/services/compiler/validator.d.ts +3 -0
- package/build/services/compiler/validator.js +1 -1
- package/build/services/connector/factory.d.ts +14 -0
- package/build/services/connector/factory.js +22 -2
- package/build/services/connector/index.d.ts +13 -1
- package/build/services/connector/index.js +13 -1
- package/build/services/connector/providers/postgres.js +7 -0
- package/build/services/engine/index.d.ts +162 -0
- package/build/services/engine/index.js +1 -1
- package/build/services/exporter/index.d.ts +27 -0
- package/build/services/exporter/index.js +1 -1
- package/build/services/hotmesh/index.d.ts +280 -0
- package/build/services/hotmesh/index.js +286 -0
- package/build/services/logger/index.js +1 -0
- package/build/services/mapper/index.d.ts +14 -0
- package/build/services/mapper/index.js +1 -1
- package/build/services/meshcall/index.d.ts +171 -0
- package/build/services/meshcall/index.js +190 -0
- package/build/services/meshcall/schemas/factory.d.ts +7 -0
- package/build/services/meshcall/schemas/factory.js +7 -0
- package/build/services/meshdata/index.d.ts +725 -3
- package/build/services/meshdata/index.js +689 -3
- package/build/services/meshflow/client.d.ts +89 -0
- package/build/services/meshflow/client.js +173 -4
- package/build/services/meshflow/connection.d.ts +17 -0
- package/build/services/meshflow/connection.js +17 -0
- package/build/services/meshflow/exporter.d.ts +22 -0
- package/build/services/meshflow/exporter.js +1 -1
- package/build/services/meshflow/handle.d.ts +68 -0
- package/build/services/meshflow/handle.js +75 -0
- package/build/services/meshflow/index.d.ts +92 -0
- package/build/services/meshflow/index.js +92 -0
- package/build/services/meshflow/schemas/factory.d.ts +25 -0
- package/build/services/meshflow/schemas/factory.js +26 -1
- package/build/services/meshflow/search.d.ts +120 -0
- package/build/services/meshflow/search.js +108 -0
- package/build/services/meshflow/worker.d.ts +97 -0
- package/build/services/meshflow/worker.js +116 -2
- package/build/services/meshflow/workflow/all.d.ts +6 -0
- package/build/services/meshflow/workflow/all.js +7 -0
- package/build/services/meshflow/workflow/context.d.ts +4 -0
- package/build/services/meshflow/workflow/context.js +4 -0
- package/build/services/meshflow/workflow/didRun.d.ts +6 -0
- package/build/services/meshflow/workflow/didRun.js +6 -0
- package/build/services/meshflow/workflow/emit.d.ts +7 -0
- package/build/services/meshflow/workflow/emit.js +7 -0
- package/build/services/meshflow/workflow/enrich.d.ts +7 -0
- package/build/services/meshflow/workflow/enrich.js +7 -0
- package/build/services/meshflow/workflow/execChild.d.ts +14 -0
- package/build/services/meshflow/workflow/execChild.js +18 -0
- package/build/services/meshflow/workflow/hook.d.ts +7 -0
- package/build/services/meshflow/workflow/hook.js +7 -0
- package/build/services/meshflow/workflow/index.d.ts +31 -0
- package/build/services/meshflow/workflow/index.js +31 -0
- package/build/services/meshflow/workflow/interrupt.d.ts +7 -0
- package/build/services/meshflow/workflow/interrupt.js +7 -0
- package/build/services/meshflow/workflow/isSideEffectAllowed.d.ts +8 -0
- package/build/services/meshflow/workflow/isSideEffectAllowed.js +8 -0
- package/build/services/meshflow/workflow/proxyActivities.d.ts +14 -0
- package/build/services/meshflow/workflow/proxyActivities.js +18 -3
- package/build/services/meshflow/workflow/random.d.ts +5 -0
- package/build/services/meshflow/workflow/random.js +5 -0
- package/build/services/meshflow/workflow/searchMethods.d.ts +4 -0
- package/build/services/meshflow/workflow/searchMethods.js +4 -0
- package/build/services/meshflow/workflow/signal.d.ts +6 -0
- package/build/services/meshflow/workflow/signal.js +6 -0
- package/build/services/meshflow/workflow/sleepFor.d.ts +7 -0
- package/build/services/meshflow/workflow/sleepFor.js +7 -0
- package/build/services/meshflow/workflow/trace.d.ts +10 -0
- package/build/services/meshflow/workflow/trace.js +10 -0
- package/build/services/meshflow/workflow/waitFor.d.ts +7 -0
- package/build/services/meshflow/workflow/waitFor.js +7 -0
- package/build/services/meshos/index.d.ts +213 -2
- package/build/services/meshos/index.js +221 -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.d.ts +6 -0
- package/build/services/pipe/functions/cron.js +1 -1
- package/build/services/pipe/functions/date.d.ts +7 -0
- 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.d.ts +15 -0
- package/build/services/pipe/index.js +1 -1
- package/build/services/quorum/index.d.ts +49 -0
- package/build/services/quorum/index.js +1 -1
- package/build/services/reporter/index.d.ts +5 -0
- package/build/services/reporter/index.js +1 -1
- package/build/services/router/index.d.ts +10 -0
- package/build/services/router/index.js +1 -1
- package/build/services/search/providers/postgres/postgres.d.ts +3 -0
- 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/cache.d.ts +19 -0
- package/build/services/store/cache.js +19 -0
- package/build/services/store/factory.js +1 -1
- package/build/services/store/providers/postgres/kvsql.d.ts +7 -0
- package/build/services/store/providers/postgres/kvsql.js +1 -1
- package/build/services/store/providers/postgres/kvtables.d.ts +4 -0
- package/build/services/store/providers/postgres/kvtables.js +1 -1
- package/build/services/store/providers/postgres/kvtransaction.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/hash.d.ts +4 -0
- package/build/services/store/providers/postgres/kvtypes/hash.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/list.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/string.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/zset.js +1 -1
- package/build/services/store/providers/postgres/postgres.d.ts +48 -1
- package/build/services/store/providers/postgres/postgres.js +1 -1
- package/build/services/store/providers/redis/_base.d.ts +42 -0
- package/build/services/store/providers/redis/_base.js +1 -1
- package/build/services/store/providers/redis/ioredis.d.ts +8 -0
- package/build/services/store/providers/redis/ioredis.js +1 -1
- package/build/services/store/providers/redis/redis.d.ts +6 -0
- package/build/services/store/providers/redis/redis.js +1 -1
- package/build/services/store/providers/store-initializable.js +1 -1
- package/build/services/stream/factory.js +2 -1
- package/build/services/stream/index.d.ts +4 -0
- package/build/services/stream/providers/nats/nats.js +1 -1
- package/build/services/stream/providers/postgres/kvtables.js +1 -1
- package/build/services/stream/providers/postgres/postgres.d.ts +21 -0
- 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/nats/nats.js +1 -1
- package/build/services/sub/providers/postgres/postgres.js +1 -1
- package/build/services/sub/providers/redis/ioredis.js +1 -1
- package/build/services/sub/providers/redis/redis.js +1 -1
- package/build/services/task/index.d.ts +9 -0
- package/build/services/task/index.js +1 -1
- package/build/services/telemetry/index.d.ts +7 -0
- package/build/services/telemetry/index.js +1 -1
- package/build/services/worker/index.d.ts +37 -0
- package/build/services/worker/index.js +1 -1
- package/build/types/activity.d.ts +81 -0
- package/build/types/exporter.d.ts +13 -0
- package/build/types/hotmesh.d.ts +144 -0
- package/build/types/hotmesh.js +3 -0
- package/build/types/job.d.ts +101 -0
- package/build/types/manifest.d.ts +8 -0
- package/build/types/meshcall.d.ts +148 -0
- package/build/types/meshdata.d.ts +193 -0
- package/build/types/meshflow.d.ts +297 -0
- package/build/types/nats.d.ts +55 -0
- package/build/types/pipe.d.ts +65 -0
- package/build/types/provider.d.ts +43 -0
- package/build/types/quorum.d.ts +12 -0
- package/build/types/redis.d.ts +6 -0
- package/build/types/stream.d.ts +65 -0
- package/build/types/stream.js +4 -0
- package/index.ts +8 -1
- package/package.json +6 -4
- package/types/manifest.ts +2 -2
- package/types/meshcall.ts +1 -2
- package/types/meshdata.ts +1 -1
package/build/types/pipe.d.ts
CHANGED
|
@@ -1,17 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a single cell value in a pipeline row
|
|
3
|
+
* If the value is a string, the value will be a literal OR mapping expression
|
|
4
|
+
*/
|
|
1
5
|
type PipeItem = string | boolean | number | null | object;
|
|
6
|
+
/**
|
|
7
|
+
* Array of `PipeItem` types.
|
|
8
|
+
*/
|
|
2
9
|
type PipeItems = PipeItem[];
|
|
10
|
+
/**
|
|
11
|
+
* Represents a new nested context in the pipeline.
|
|
12
|
+
* As the structure is recursive, the nested pipe may contain an
|
|
13
|
+
* array of `PipeItem[]`, `PipeObject`, OR `ReduceObject` items.
|
|
14
|
+
*/
|
|
3
15
|
type PipeObject = {
|
|
4
16
|
'@pipe': Array<PipeItem[] | PipeObject | ReduceObject>;
|
|
5
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Reduce is similar to Pipe in that it represents a new context
|
|
20
|
+
* and may include an array of `PipeItem[]`, `PipeObject`, or `ReduceObject`.
|
|
21
|
+
* But it also iterates and produces output. The context variables,
|
|
22
|
+
* `$input`, `$output`, `$item`, `$key`, and `$index` are available.
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* // Example of a reduce expression. The optional object is empty and
|
|
26
|
+
* // serves as the $output during iteration. The last step in the iteration
|
|
27
|
+
* // sets $output. if ther are no more iterations, the $output is returned
|
|
28
|
+
* // and provided to the next step in the pipeline.
|
|
29
|
+
*
|
|
30
|
+
* // If data is:
|
|
31
|
+
* // { response: ['a', 'b', 'c'] }
|
|
32
|
+
*
|
|
33
|
+
* // The reduced/transformed expression will be:
|
|
34
|
+
* // { 'a': 0, 'b': 1, 'c': 2 }
|
|
35
|
+
*
|
|
36
|
+
* // Arrays and objects may be iterated over and transformed.
|
|
37
|
+
*
|
|
38
|
+
* //YAML
|
|
39
|
+
* '@pipe':
|
|
40
|
+
* - ['{data.response}', {}]
|
|
41
|
+
* - '@reduce':
|
|
42
|
+
* - '@pipe':
|
|
43
|
+
* - ['{$output}']
|
|
44
|
+
* - '@pipe':
|
|
45
|
+
* - ['{$item}']
|
|
46
|
+
* - '@pipe':
|
|
47
|
+
* - ['{$index}']
|
|
48
|
+
* - ['{@object.set}']
|
|
49
|
+
*/
|
|
6
50
|
type ReduceObject = {
|
|
7
51
|
'@reduce': Array<PipeItem[] | PipeObject | ReduceObject>;
|
|
8
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Represents a sequence in the pipeline that can include arrays of `PipeItem`, `PipeObject`, or `ReduceObject`.
|
|
55
|
+
*/
|
|
9
56
|
type Pipe = (PipeItem[] | PipeObject | ReduceObject)[];
|
|
57
|
+
/**
|
|
58
|
+
* Defines the context of a pipeline operation.
|
|
59
|
+
*/
|
|
10
60
|
type PipeContext = {
|
|
61
|
+
/**
|
|
62
|
+
* Input of the current iteration.
|
|
63
|
+
*/
|
|
11
64
|
$input: unknown[];
|
|
65
|
+
/**
|
|
66
|
+
* Output of the current iteration and the final output for the reducer.
|
|
67
|
+
*/
|
|
12
68
|
$output: unknown;
|
|
69
|
+
/**
|
|
70
|
+
* Target item in the iterator.
|
|
71
|
+
*/
|
|
13
72
|
$item: unknown;
|
|
73
|
+
/**
|
|
74
|
+
* Array index as string or object key.
|
|
75
|
+
*/
|
|
14
76
|
$key: string;
|
|
77
|
+
/**
|
|
78
|
+
* Numeric index of the iterator.
|
|
79
|
+
*/
|
|
15
80
|
$index: number;
|
|
16
81
|
};
|
|
17
82
|
export { Pipe, PipeContext, PipeItem, PipeItems, PipeObject, ReduceObject };
|
|
@@ -1,29 +1,66 @@
|
|
|
1
1
|
import { KeyStoreParams } from '../modules/key';
|
|
2
2
|
import { StringAnyType } from './serializer';
|
|
3
|
+
/**
|
|
4
|
+
* Generic type for provider class
|
|
5
|
+
*/
|
|
3
6
|
export interface ProviderClass {
|
|
4
7
|
[key: string]: any;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Generic type for provider options
|
|
11
|
+
*/
|
|
6
12
|
export interface ProviderOptions {
|
|
7
13
|
[key: string]: any;
|
|
8
14
|
}
|
|
9
15
|
export type Providers = 'redis' | 'nats' | 'postgres' | 'ioredis';
|
|
16
|
+
/**
|
|
17
|
+
* A provider transaction is a set of operations that are executed
|
|
18
|
+
* atomically by the provider. The transaction is created by calling
|
|
19
|
+
* the `transact` method on the provider. The transaction object
|
|
20
|
+
* contains methods specific to the provider allowing it to optionally
|
|
21
|
+
* choose to execute a single command or collect all commands and
|
|
22
|
+
* execute as a single transaction.
|
|
23
|
+
*/
|
|
10
24
|
export interface ProviderTransaction {
|
|
11
25
|
exec(): Promise<any>;
|
|
12
26
|
[key: string]: ((...args: any[]) => Promise<any>) | undefined | any;
|
|
13
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* A provider native client is the raw client object provided by the
|
|
30
|
+
* connecter service. This object is passed to the ProviderClient
|
|
31
|
+
* (which wraps it), providing a standardized interface for all
|
|
32
|
+
* providers.
|
|
33
|
+
*/
|
|
14
34
|
export interface ProviderNativeClient {
|
|
15
35
|
[key: string]: any;
|
|
16
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Wrapped provider native client object that standardizes the
|
|
39
|
+
* interface for all providers.
|
|
40
|
+
*/
|
|
17
41
|
export interface ProviderClient {
|
|
42
|
+
/** The provider-specific transaction object */
|
|
18
43
|
transact(): ProviderTransaction;
|
|
44
|
+
/** Mint a provider-specific key */
|
|
19
45
|
mintKey(type: KeyType, params: KeyStoreParams): string;
|
|
46
|
+
/** The provider-specific client object */
|
|
20
47
|
[key: string]: any;
|
|
21
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* an array of outputs generic to all providers
|
|
51
|
+
* e.g., [3, 2, '0']
|
|
52
|
+
*/
|
|
22
53
|
export type TransactionResultList = (string | number)[];
|
|
23
54
|
export type ProviderConfig = {
|
|
24
55
|
class: any;
|
|
25
56
|
options: StringAnyType;
|
|
26
57
|
provider?: string;
|
|
58
|
+
/**
|
|
59
|
+
* If provided and if true, the engine router instance will
|
|
60
|
+
* be initialized as a readonly instance and will not consume
|
|
61
|
+
* messages from the stream channel. An engine in readonly mode
|
|
62
|
+
* can still read/write to the store and can still pub/sub events.
|
|
63
|
+
*/
|
|
27
64
|
readonly?: boolean;
|
|
28
65
|
};
|
|
29
66
|
export type ProvidersConfig = {
|
|
@@ -32,6 +69,12 @@ export type ProvidersConfig = {
|
|
|
32
69
|
stream: ProviderConfig;
|
|
33
70
|
pub?: ProviderConfig;
|
|
34
71
|
search?: ProviderConfig;
|
|
72
|
+
/**
|
|
73
|
+
* If provided and if true, the engine router instance will
|
|
74
|
+
* be initialized as a readonly instance and will not consume
|
|
75
|
+
* messages from the stream channel. An engine in readonly mode
|
|
76
|
+
* can still read/write to the store and can still pub/sub events.
|
|
77
|
+
*/
|
|
35
78
|
readonly?: boolean;
|
|
36
79
|
};
|
|
37
80
|
export interface SetOptions {
|
package/build/types/quorum.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ interface NetworkStat {
|
|
|
16
16
|
tx_sec: number;
|
|
17
17
|
ms: number;
|
|
18
18
|
}
|
|
19
|
+
/** reveals: memory, cpu, network */
|
|
19
20
|
export interface SystemHealth {
|
|
20
21
|
TotalMemoryGB: string;
|
|
21
22
|
FreeMemoryGB: string;
|
|
@@ -24,10 +25,15 @@ export interface SystemHealth {
|
|
|
24
25
|
NetworkStats: NetworkStat[];
|
|
25
26
|
}
|
|
26
27
|
export type ThrottleOptions = {
|
|
28
|
+
/** target an engine OR worker by GUID */
|
|
27
29
|
guid?: string;
|
|
30
|
+
/** target a worker quorum */
|
|
28
31
|
topic?: string;
|
|
32
|
+
/** entity/noun */
|
|
29
33
|
entity?: string;
|
|
34
|
+
/** in milliseconds; set to -1 for indefinite throttle */
|
|
30
35
|
throttle: number;
|
|
36
|
+
/** namespace */
|
|
31
37
|
namespace?: string;
|
|
32
38
|
};
|
|
33
39
|
export interface QuorumProfile {
|
|
@@ -121,5 +127,11 @@ export type RollCallOptions = {
|
|
|
121
127
|
export type SubscriptionOptions = {
|
|
122
128
|
namespace?: string;
|
|
123
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* The types in this file are used to define those messages that are sent
|
|
132
|
+
* to hotmesh client instances when a new version is about to be activated.
|
|
133
|
+
* These messages serve to coordinate the cache invalidation and switch-over
|
|
134
|
+
* to the new version without any downtime and a coordinating parent server.
|
|
135
|
+
*/
|
|
124
136
|
export type QuorumMessage = PingMessage | PongMessage | ActivateMessage | WorkMessage | JobMessage | ThrottleMessage | RollCallMessage | CronMessage | UserMessage;
|
|
125
137
|
export {};
|
package/build/types/redis.d.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { ProviderClient, ProviderConfig, ProviderTransaction } from './provider';
|
|
3
3
|
import { StringStringType } from './serializer';
|
|
4
4
|
import { ReclaimedMessageType } from './stream';
|
|
5
|
+
/**
|
|
6
|
+
* Redis types
|
|
7
|
+
*/
|
|
5
8
|
interface ConnectionOptions {
|
|
6
9
|
host?: string;
|
|
7
10
|
port?: number;
|
|
@@ -150,6 +153,9 @@ interface RedisRedisClientType extends ProviderClient {
|
|
|
150
153
|
interface RedisRedisClassType {
|
|
151
154
|
createClient(options: RedisRedisClientOptions): Partial<RedisRedisClientType>;
|
|
152
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* IORedis types
|
|
158
|
+
*/
|
|
153
159
|
interface IORedisClientOptions {
|
|
154
160
|
port?: number;
|
|
155
161
|
host?: string;
|
package/build/types/stream.d.ts
CHANGED
|
@@ -1,20 +1,39 @@
|
|
|
1
1
|
import { ProviderTransaction } from './provider';
|
|
2
|
+
/** Represents a policy for retrying stream operations based on error codes */
|
|
2
3
|
export interface StreamRetryPolicy {
|
|
4
|
+
/**
|
|
5
|
+
* Key is error code, value is the retry profile.
|
|
6
|
+
* Tuple contains: [max retry count, retry type].
|
|
7
|
+
* 'x' denotes exponential backoff (default). Only 10, 100, 1000, 10000 are allowed retry intervals.
|
|
8
|
+
*/
|
|
3
9
|
[key: string]: [number, 'x'?];
|
|
4
10
|
}
|
|
11
|
+
/** A 3-digit status code representing the outcome of a stream operation */
|
|
5
12
|
export type StreamCode = number;
|
|
13
|
+
/** Describes the structure of a stream error */
|
|
6
14
|
export type StreamError = {
|
|
15
|
+
/** Descriptive message of the error */
|
|
7
16
|
message: string;
|
|
17
|
+
/** Numeric code corresponding to the type of error */
|
|
8
18
|
code: number;
|
|
19
|
+
/** Optional job identifier, used when communicating errors externally */
|
|
9
20
|
job_id?: string;
|
|
21
|
+
/** Stack trace of the error if unhandled */
|
|
10
22
|
stack?: string;
|
|
23
|
+
/** Name of the error if unhandled */
|
|
11
24
|
name?: string;
|
|
25
|
+
/** Custom user-defined error details */
|
|
12
26
|
error?: Record<string, unknown>;
|
|
27
|
+
/** True if originating via a standard transition message with an `error` status */
|
|
13
28
|
is_stream_error?: boolean;
|
|
14
29
|
};
|
|
30
|
+
/** Enumerated status values for stream operations */
|
|
15
31
|
export declare enum StreamStatus {
|
|
32
|
+
/** Indicates successful completion of the stream operation */
|
|
16
33
|
SUCCESS = "success",
|
|
34
|
+
/** Indicates an error occurred during the stream operation */
|
|
17
35
|
ERROR = "error",
|
|
36
|
+
/** Indicates the stream operation is still pending */
|
|
18
37
|
PENDING = "pending"
|
|
19
38
|
}
|
|
20
39
|
export declare enum StreamDataType {
|
|
@@ -28,50 +47,91 @@ export declare enum StreamDataType {
|
|
|
28
47
|
SIGNAL = "signal",
|
|
29
48
|
INTERRUPT = "interrupt"
|
|
30
49
|
}
|
|
50
|
+
/** Defines the structure of stream data used when passing stream messages (transitions) */
|
|
31
51
|
export interface StreamData {
|
|
52
|
+
/** Metadata associated with the stream data */
|
|
32
53
|
metadata: {
|
|
54
|
+
/** Globally unique identifier for the StreamData message to distinguish `retries` from new 'reentry/cycles' */
|
|
33
55
|
guid: string;
|
|
56
|
+
/** Workflow/job topic */
|
|
34
57
|
topic?: string;
|
|
58
|
+
/** Workflow/job ID */
|
|
35
59
|
jid?: string;
|
|
60
|
+
/** Workflow Generational ID (internal GUID) */
|
|
36
61
|
gid?: string;
|
|
62
|
+
/** Dimensional address indicating the message routing specifics */
|
|
37
63
|
dad?: string;
|
|
64
|
+
/** Activity ID */
|
|
38
65
|
aid: string;
|
|
66
|
+
/** OpenTelemetry Trace identifier */
|
|
39
67
|
trc?: string;
|
|
68
|
+
/** OpenTelemetry Span identifier */
|
|
40
69
|
spn?: string;
|
|
70
|
+
/** Current try count, used for retry logic */
|
|
41
71
|
try?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Indicates if the message should wait for a response.
|
|
74
|
+
* If explicitly false, the connection is severed immediately
|
|
75
|
+
* upon verifying (and returning) the Job ID.
|
|
76
|
+
*/
|
|
42
77
|
await?: boolean;
|
|
43
78
|
};
|
|
79
|
+
/** Type of the data being streamed, optional */
|
|
44
80
|
type?: StreamDataType;
|
|
81
|
+
/** Actual data being transmitted as a record of key-value pairs */
|
|
45
82
|
data: Record<string, unknown>;
|
|
83
|
+
/** Policies related to retry logic, optional */
|
|
46
84
|
policies?: {
|
|
47
85
|
retry?: StreamRetryPolicy;
|
|
48
86
|
};
|
|
87
|
+
/** Status of the stream, default assumed as 'success' */
|
|
49
88
|
status?: StreamStatus;
|
|
89
|
+
/** HTTP-like status code for the stream, default assumed as 200 */
|
|
50
90
|
code?: number;
|
|
91
|
+
/** Error stack trace */
|
|
51
92
|
stack?: string;
|
|
52
93
|
}
|
|
94
|
+
/** Extends StreamData for responses, allowing for inheritance of the base properties */
|
|
53
95
|
export type StreamDataResponse = StreamData;
|
|
54
96
|
export declare enum StreamRole {
|
|
55
97
|
WORKER = "worker",
|
|
56
98
|
ENGINE = "engine",
|
|
57
99
|
SYSTEM = "system"
|
|
58
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Represents a type for messages that have been reclaimed from a stream.
|
|
103
|
+
* Each item is a tuple containing a messageId and its details.
|
|
104
|
+
*/
|
|
59
105
|
export type ReclaimedMessageType = [
|
|
106
|
+
/** The stream ID, typically formatted as `<timestamp>-<count>` */
|
|
60
107
|
messageId: string,
|
|
108
|
+
/** Details of the message, consisting of a key and its value */
|
|
61
109
|
details: [
|
|
110
|
+
/** Key is always 'message' */
|
|
62
111
|
key: string,
|
|
112
|
+
/** Value is a stringified representation of StreamData */
|
|
63
113
|
value: string
|
|
64
114
|
]
|
|
65
115
|
][];
|
|
116
|
+
/** Configuration parameters for a stream */
|
|
66
117
|
export type RouterConfig = {
|
|
118
|
+
/** Namespace under which the stream operates */
|
|
67
119
|
namespace: string;
|
|
120
|
+
/** Application identifier */
|
|
68
121
|
appId: string;
|
|
122
|
+
/** Globally unique identifier for the stream */
|
|
69
123
|
guid: string;
|
|
124
|
+
/** Role associated with the stream */
|
|
70
125
|
role: StreamRole;
|
|
126
|
+
/** Default throttle (read from KeyType.THROTTLE_RATE) */
|
|
71
127
|
throttle: number;
|
|
128
|
+
/** Optional topic for the stream */
|
|
72
129
|
topic?: string;
|
|
130
|
+
/** Delay before a message can be reclaimed, defaults to 60,000 milliseconds */
|
|
73
131
|
reclaimDelay?: number;
|
|
132
|
+
/** Maximum number of reclaims allowed, defaults to 3. Values greater throw an error */
|
|
74
133
|
reclaimCount?: number;
|
|
134
|
+
/** if true, will not process stream messages; default true */
|
|
75
135
|
readonly?: boolean;
|
|
76
136
|
};
|
|
77
137
|
export type StreamProviderType = 'redis' | 'ioredis' | 'postgres' | 'nats' | 'sqs';
|
|
@@ -134,6 +194,11 @@ export interface StreamStats {
|
|
|
134
194
|
lastErrorMessage?: string;
|
|
135
195
|
[key: string]: any;
|
|
136
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* When publishing a message to the stream, the configuration
|
|
199
|
+
* can include a transaction object to execute the operation
|
|
200
|
+
* atomically.
|
|
201
|
+
*/
|
|
137
202
|
export interface PublishMessageConfig {
|
|
138
203
|
transaction?: ProviderTransaction;
|
|
139
204
|
}
|
package/build/types/stream.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StreamRole = exports.StreamDataType = exports.StreamStatus = void 0;
|
|
4
|
+
/** Enumerated status values for stream operations */
|
|
4
5
|
var StreamStatus;
|
|
5
6
|
(function (StreamStatus) {
|
|
7
|
+
/** Indicates successful completion of the stream operation */
|
|
6
8
|
StreamStatus["SUCCESS"] = "success";
|
|
9
|
+
/** Indicates an error occurred during the stream operation */
|
|
7
10
|
StreamStatus["ERROR"] = "error";
|
|
11
|
+
/** Indicates the stream operation is still pending */
|
|
8
12
|
StreamStatus["PENDING"] = "pending";
|
|
9
13
|
})(StreamStatus = exports.StreamStatus || (exports.StreamStatus = {}));
|
|
10
14
|
var StreamDataType;
|
package/index.ts
CHANGED
|
@@ -2,7 +2,13 @@ import { HotMesh } from './services/hotmesh';
|
|
|
2
2
|
import { HotMeshConfig } from './types/hotmesh';
|
|
3
3
|
import { MeshCall } from './services/meshcall';
|
|
4
4
|
import { MeshFlow } from './services/meshflow';
|
|
5
|
+
import { ClientService as Client } from './services/meshflow/client';
|
|
6
|
+
import { ConnectionService as Connection } from './services/meshflow/connection';
|
|
7
|
+
import { Search } from './services/meshflow/search';
|
|
8
|
+
import { WorkerService as Worker } from './services/meshflow/worker';
|
|
9
|
+
import { WorkflowService as workflow } from './services/meshflow/workflow';
|
|
5
10
|
import { WorkflowHandleService as WorkflowHandle } from './services/meshflow/handle';
|
|
11
|
+
import { proxyActivities } from './services/meshflow/workflow/proxyActivities';
|
|
6
12
|
import { MeshData } from './services/meshdata';
|
|
7
13
|
import { MeshOS } from './services/meshos';
|
|
8
14
|
import * as Errors from './modules/errors';
|
|
@@ -15,7 +21,7 @@ import { RedisConnection as ConnectorIORedis } from './services/connector/provid
|
|
|
15
21
|
import { RedisConnection as ConnectorRedis } from './services/connector/providers/redis';
|
|
16
22
|
import { NatsConnection as ConnectorNATS } from './services/connector/providers/nats';
|
|
17
23
|
|
|
18
|
-
const { Client, Connection, Search, Worker, workflow } = MeshFlow;
|
|
24
|
+
//const { Client, Connection, Search, Worker, workflow } = MeshFlow;
|
|
19
25
|
|
|
20
26
|
export {
|
|
21
27
|
//Provider Connectors
|
|
@@ -36,6 +42,7 @@ export {
|
|
|
36
42
|
//MeshFlow Submodules
|
|
37
43
|
Client,
|
|
38
44
|
Connection,
|
|
45
|
+
proxyActivities,
|
|
39
46
|
Search,
|
|
40
47
|
Worker,
|
|
41
48
|
workflow,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.31",
|
|
4
4
|
"description": "Serverless Workflow",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"test:parallel": "NODE_ENV=test jest ./tests/functional/parallel/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
50
50
|
"test:pipe": "NODE_ENV=test jest ./tests/unit/services/pipe/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
51
51
|
"test:quorum": "HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/functional/quorum/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
52
|
-
"test:reclaim": "NODE_ENV=test jest ./tests/functional/reclaim
|
|
52
|
+
"test:reclaim": "NODE_ENV=test jest ./tests/functional/reclaim/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
53
53
|
"test:redeploy": "NODE_ENV=test jest ./tests/functional/redeploy/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
54
54
|
"test:reporter": "NODE_ENV=test jest ./tests/unit/services/reporter/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
55
55
|
"test:reentrant": "NODE_ENV=test jest ./tests/functional/reentrant/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
56
56
|
"test:retry": "NODE_ENV=test jest ./tests/functional/retry/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
57
|
-
"test:sequence": "NODE_ENV=test HMSH_LOGLEVEL=
|
|
57
|
+
"test:sequence": "NODE_ENV=test HMSH_LOGLEVEL=info jest ./tests/functional/sequence/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
58
58
|
"test:signal": "NODE_ENV=test jest ./tests/functional/signal/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
59
59
|
"test:status": "NODE_ENV=test jest ./tests/functional/status/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
60
60
|
"test:providers": "NODE_ENV=test jest ./tests/functional/*/providers/*/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"test:sub:nats": "NODE_ENV=test jest ./tests/functional/sub/providers/nats/nats.test.ts --detectOpenHandles --forceExit --verbose",
|
|
72
72
|
"test:trigger": "NODE_ENV=test jest ./tests/unit/services/activities/trigger.test.ts --detectOpenHandles --forceExit --verbose",
|
|
73
73
|
"test:meshdata": "NODE_ENV=test jest ./tests/meshdata/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
74
|
-
"test:meshos": "HMSH_LOGLEVEL=
|
|
74
|
+
"test:meshos": "HMSH_LOGLEVEL=info NODE_ENV=test HMSH_IS_CLUSTER=true jest ./tests/meshos/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
75
75
|
"test:meshcall": "NODE_ENV=test jest ./tests/meshcall/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
76
76
|
"test:unit": "NODE_ENV=test jest ./tests/unit/*/*/index.test.ts --detectOpenHandles --forceExit --verbose"
|
|
77
77
|
},
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"Serverless Workflow",
|
|
81
81
|
"Durable Workflow",
|
|
82
82
|
"Operational Data",
|
|
83
|
+
"Saasless Apps",
|
|
83
84
|
"Service Mesh",
|
|
84
85
|
"HotMesh",
|
|
85
86
|
"Postgres",
|
|
@@ -117,6 +118,7 @@
|
|
|
117
118
|
"pg": "^8.10.0",
|
|
118
119
|
"redis": "^4.6.13",
|
|
119
120
|
"rimraf": "^4.4.1",
|
|
121
|
+
"terser": "^5.37.0",
|
|
120
122
|
"ts-jest": "^29.0.5",
|
|
121
123
|
"ts-node": "^10.9.1",
|
|
122
124
|
"ts-node-dev": "^2.0.0",
|
package/types/manifest.ts
CHANGED
|
@@ -24,14 +24,14 @@ export type EntityInstanceTypes = MeshOS;
|
|
|
24
24
|
|
|
25
25
|
export type SubclassType<T extends MeshOS = MeshOS> = new (...args: any[]) => T;
|
|
26
26
|
export type Entity = {
|
|
27
|
-
name: string;
|
|
27
|
+
name: string; //can be set via static config
|
|
28
28
|
label: string;
|
|
29
29
|
/**
|
|
30
30
|
* A more-specific value for workers when targeting version-specifc
|
|
31
31
|
* or priority-specific task queues.
|
|
32
32
|
* @default default
|
|
33
33
|
*/
|
|
34
|
-
taskQueue?: string;
|
|
34
|
+
taskQueue?: string; //can be set via static config
|
|
35
35
|
schema: WorkflowSearchSchema; //can be st via static config
|
|
36
36
|
class: SubclassType;
|
|
37
37
|
};
|
package/types/meshcall.ts
CHANGED
|
@@ -150,8 +150,7 @@ interface MeshCallCronParams {
|
|
|
150
150
|
*/
|
|
151
151
|
guid?: string;
|
|
152
152
|
/**
|
|
153
|
-
* Namespace for grouping common cron functions.
|
|
154
|
-
* will be prefixed with this namespace. (e.g. `hmsh:[namespace]:j:*`)
|
|
153
|
+
* Namespace for grouping common cron functions. (e.g. `hmsh:[namespace]:j:*`)
|
|
155
154
|
*/
|
|
156
155
|
namespace?: string;
|
|
157
156
|
/**
|
package/types/meshdata.ts
CHANGED