@hotmeshio/hotmesh 0.10.1 → 0.11.0
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 +1 -1
- package/build/modules/errors.d.ts +2 -0
- package/build/modules/errors.js +2 -0
- package/build/modules/key.js +3 -2
- package/build/package.json +3 -1
- package/build/services/activities/worker.js +10 -0
- package/build/services/dba/index.d.ts +54 -19
- package/build/services/dba/index.js +129 -31
- package/build/services/durable/client.js +6 -1
- package/build/services/durable/exporter.d.ts +75 -3
- package/build/services/durable/exporter.js +768 -2
- package/build/services/durable/handle.d.ts +12 -1
- package/build/services/durable/handle.js +13 -0
- package/build/services/durable/schemas/factory.d.ts +1 -1
- package/build/services/durable/schemas/factory.js +27 -4
- package/build/services/durable/worker.d.ts +2 -2
- package/build/services/durable/worker.js +15 -9
- package/build/services/durable/workflow/context.js +2 -0
- package/build/services/durable/workflow/execChild.js +5 -2
- package/build/services/durable/workflow/hook.js +6 -0
- package/build/services/durable/workflow/proxyActivities.js +3 -4
- package/build/services/engine/index.js +5 -3
- package/build/services/store/index.d.ts +40 -0
- package/build/services/store/providers/postgres/exporter-sql.d.ts +23 -0
- package/build/services/store/providers/postgres/exporter-sql.js +52 -0
- package/build/services/store/providers/postgres/kvtables.js +12 -1
- package/build/services/store/providers/postgres/postgres.d.ts +34 -0
- package/build/services/store/providers/postgres/postgres.js +99 -0
- package/build/services/stream/providers/postgres/kvtables.d.ts +1 -1
- package/build/services/stream/providers/postgres/kvtables.js +175 -82
- package/build/services/stream/providers/postgres/lifecycle.d.ts +4 -3
- package/build/services/stream/providers/postgres/lifecycle.js +6 -5
- package/build/services/stream/providers/postgres/messages.d.ts +9 -6
- package/build/services/stream/providers/postgres/messages.js +121 -75
- package/build/services/stream/providers/postgres/notifications.d.ts +5 -2
- package/build/services/stream/providers/postgres/notifications.js +39 -35
- package/build/services/stream/providers/postgres/postgres.d.ts +20 -118
- package/build/services/stream/providers/postgres/postgres.js +83 -140
- package/build/services/stream/registry.d.ts +62 -0
- package/build/services/stream/registry.js +198 -0
- package/build/services/worker/index.js +20 -6
- package/build/types/dba.d.ts +31 -5
- package/build/types/durable.d.ts +6 -1
- package/build/types/error.d.ts +2 -0
- package/build/types/exporter.d.ts +166 -0
- package/build/types/hotmesh.d.ts +7 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/stream.d.ts +2 -0
- package/package.json +3 -1
|
@@ -1,8 +1,46 @@
|
|
|
1
1
|
import { ILogger } from '../logger';
|
|
2
2
|
import { StoreService } from '../store';
|
|
3
|
-
import { ExportOptions, DurableJobExport, TimelineType, TransitionType, ExportFields } from '../../types/exporter';
|
|
3
|
+
import { ExportOptions, DurableJobExport, TimelineType, TransitionType, ExportFields, ExecutionExportOptions, WorkflowExecution, WorkflowExecutionStatus } from '../../types/exporter';
|
|
4
4
|
import { ProviderClient, ProviderTransaction } from '../../types/provider';
|
|
5
5
|
import { StringStringType, Symbols } from '../../types/serializer';
|
|
6
|
+
/**
|
|
7
|
+
* Parse a HotMesh compact timestamp (YYYYMMDDHHmmss.mmm) into ISO 8601.
|
|
8
|
+
* Also accepts ISO 8601 strings directly.
|
|
9
|
+
*/
|
|
10
|
+
declare function parseTimestamp(raw: string | undefined | null): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Compute duration in milliseconds between two HotMesh timestamps.
|
|
13
|
+
*/
|
|
14
|
+
declare function computeDuration(ac: string | undefined, au: string | undefined): number | null;
|
|
15
|
+
/**
|
|
16
|
+
* Extract the operation type (proxy, child, start, wait, sleep, hook)
|
|
17
|
+
* from a timeline key like `-proxy,0,0-1-`.
|
|
18
|
+
*/
|
|
19
|
+
declare function extractOperation(key: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Extract the activity name from a timeline entry value's job_id.
|
|
22
|
+
*
|
|
23
|
+
* Job ID format: `-{workflowId}-$${activityName}{dimension}-{execIndex}`
|
|
24
|
+
* Examples:
|
|
25
|
+
* `-wfId-$analyzeContent-5` → `'analyzeContent'`
|
|
26
|
+
* `-wfId-$processOrder,0,0-3` → `'processOrder'`
|
|
27
|
+
*/
|
|
28
|
+
declare function extractActivityName(value: Record<string, any> | null): string;
|
|
29
|
+
/**
|
|
30
|
+
* Check if an activity name is a system (interceptor) operation.
|
|
31
|
+
*/
|
|
32
|
+
declare function isSystemActivity(name: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Map HotMesh job state to a human-readable execution status.
|
|
35
|
+
*
|
|
36
|
+
* HotMesh semaphore: `0` = idle, `> 0` = pending activities,
|
|
37
|
+
* `< 0` = failed / interrupted.
|
|
38
|
+
*
|
|
39
|
+
* A workflow can be "done" (`state.data.done === true`) while the
|
|
40
|
+
* semaphore is still > 0 (cleanup activities pending). We check
|
|
41
|
+
* both the `done` flag and the semaphore to determine status.
|
|
42
|
+
*/
|
|
43
|
+
declare function mapStatus(rawStatus: number | undefined, isDone?: boolean, hasError?: boolean): WorkflowExecutionStatus;
|
|
6
44
|
declare class ExporterService {
|
|
7
45
|
appId: string;
|
|
8
46
|
logger: ILogger;
|
|
@@ -11,10 +49,44 @@ declare class ExporterService {
|
|
|
11
49
|
private static symbols;
|
|
12
50
|
constructor(appId: string, store: StoreService<ProviderClient, ProviderTransaction>, logger: ILogger);
|
|
13
51
|
/**
|
|
14
|
-
* Convert the job hash from its
|
|
52
|
+
* Convert the job hash from its compiled format into a DurableJobExport object with
|
|
15
53
|
* facets that describe the workflow in terms relevant to narrative storytelling.
|
|
16
54
|
*/
|
|
17
55
|
export(jobId: string, options?: ExportOptions): Promise<DurableJobExport>;
|
|
56
|
+
/**
|
|
57
|
+
* Export a workflow execution as a Temporal-compatible event history.
|
|
58
|
+
*
|
|
59
|
+
* **Sparse mode** (default): transforms the main workflow's timeline
|
|
60
|
+
* into a flat event list. No additional I/O beyond the initial export.
|
|
61
|
+
*
|
|
62
|
+
* **Verbose mode**: recursively fetches child workflow jobs and attaches
|
|
63
|
+
* their executions as nested `children`.
|
|
64
|
+
*/
|
|
65
|
+
exportExecution(jobId: string, workflowTopic: string, options?: ExecutionExportOptions): Promise<WorkflowExecution>;
|
|
66
|
+
/**
|
|
67
|
+
* Reconstruct a WorkflowExecution from raw database rows when the job
|
|
68
|
+
* handle has expired or been pruned. Only available if the store provider
|
|
69
|
+
* implements getJobByKeyDirect.
|
|
70
|
+
*/
|
|
71
|
+
private exportExecutionDirect;
|
|
72
|
+
/**
|
|
73
|
+
* Enrich execution events with activity and child workflow inputs.
|
|
74
|
+
* Queries the store for activity arguments and child workflow arguments.
|
|
75
|
+
*/
|
|
76
|
+
private enrichExecutionInputs;
|
|
77
|
+
/**
|
|
78
|
+
* Resolve a symbol field from stable JSON path using the symbol registry.
|
|
79
|
+
*/
|
|
80
|
+
private resolveSymbolField;
|
|
81
|
+
/**
|
|
82
|
+
* Pure transformation: convert a raw DurableJobExport into a
|
|
83
|
+
* Temporal-compatible WorkflowExecution event history.
|
|
84
|
+
*/
|
|
85
|
+
transformToExecution(raw: DurableJobExport, workflowId: string, workflowTopic: string, options: ExecutionExportOptions): WorkflowExecution;
|
|
86
|
+
/**
|
|
87
|
+
* Recursively fetch child workflow executions for verbose mode.
|
|
88
|
+
*/
|
|
89
|
+
private fetchChildren;
|
|
18
90
|
/**
|
|
19
91
|
* Inflates the job data into a DurableJobExport object
|
|
20
92
|
* @param jobHash - the job data
|
|
@@ -48,4 +120,4 @@ declare class ExporterService {
|
|
|
48
120
|
*/
|
|
49
121
|
sortParts(parts: TimelineType[]): TimelineType[];
|
|
50
122
|
}
|
|
51
|
-
export { ExporterService };
|
|
123
|
+
export { ExporterService, parseTimestamp, computeDuration, extractOperation, extractActivityName, isSystemActivity, mapStatus, };
|