arvo-event-handler 3.0.7 → 3.0.8
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/dist/ArvoEventHandler/index.d.ts +1 -1
- package/dist/ArvoEventHandler/index.js +1 -1
- package/dist/ArvoMachine/createMachine.d.ts +1 -1
- package/dist/ArvoMachine/createMachine.js +1 -1
- package/dist/ArvoOrchestrationUtils/createEmitableEvent.d.ts +30 -0
- package/dist/ArvoOrchestrationUtils/createEmitableEvent.js +160 -0
- package/dist/ArvoOrchestrationUtils/error.d.ts +18 -0
- package/dist/{ArvoOrchestrator → ArvoOrchestrationUtils}/error.js +14 -9
- package/dist/ArvoOrchestrationUtils/handlerErrors.d.ts +35 -0
- package/dist/ArvoOrchestrationUtils/handlerErrors.js +184 -0
- package/dist/ArvoOrchestrationUtils/orchestrationExecutionState.d.ts +11 -0
- package/dist/ArvoOrchestrationUtils/orchestrationExecutionState.js +7 -0
- package/dist/ArvoOrchestrationUtils/orchestrationExecutionWrapper/acquireLockWithValidation.d.ts +8 -0
- package/dist/ArvoOrchestrationUtils/orchestrationExecutionWrapper/acquireLockWithValidation.js +69 -0
- package/dist/ArvoOrchestrationUtils/orchestrationExecutionWrapper/index.d.ts +40 -0
- package/dist/ArvoOrchestrationUtils/orchestrationExecutionWrapper/index.js +228 -0
- package/dist/ArvoOrchestrationUtils/orchestrationExecutionWrapper/validateAndParseSubject.d.ts +7 -0
- package/dist/ArvoOrchestrationUtils/orchestrationExecutionWrapper/validateAndParseSubject.js +25 -0
- package/dist/ArvoOrchestrationUtils/types.d.ts +1 -0
- package/dist/ArvoOrchestrationUtils/types.js +2 -0
- package/dist/ArvoOrchestrator/factory.js +13 -0
- package/dist/ArvoOrchestrator/index.d.ts +3 -19
- package/dist/ArvoOrchestrator/index.js +85 -477
- package/dist/ArvoOrchestrator/types.d.ts +3 -2
- package/dist/ArvoResumable/factory.d.ts +2 -2
- package/dist/ArvoResumable/factory.js +1 -1
- package/dist/ArvoResumable/index.d.ts +5 -19
- package/dist/ArvoResumable/index.js +76 -433
- package/dist/ArvoResumable/types.d.ts +5 -4
- package/dist/IArvoEventHandler/index.d.ts +0 -1
- package/dist/MachineExecutionEngine/index.d.ts +1 -1
- package/dist/MachineRegistry/index.d.ts +1 -1
- package/dist/SyncEventResource/index.d.ts +1 -1
- package/dist/SyncEventResource/index.js +1 -1
- package/dist/index.d.ts +12 -11
- package/dist/index.js +24 -21
- package/package.json +2 -2
- package/dist/ArvoOrchestrator/error.d.ts +0 -16
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ArvoEvent, InferArvoEvent } from 'arvo-core';
|
|
2
2
|
import type { Snapshot } from 'xstate';
|
|
3
3
|
import type ArvoMachine from '../ArvoMachine';
|
|
4
|
+
import type { OrchestrationExecutionMemoryRecord } from '../ArvoOrchestrationUtils/orchestrationExecutionState';
|
|
4
5
|
import type { IMachineExectionEngine } from '../MachineExecutionEngine/interface';
|
|
5
6
|
import type { IMachineMemory } from '../MachineMemory/interface';
|
|
6
7
|
import type { IMachineRegistry } from '../MachineRegistry/interface';
|
|
@@ -14,7 +15,7 @@ export type TryFunctionOutput<TData, TError extends Error> = {
|
|
|
14
15
|
/**
|
|
15
16
|
* Represents the state record stored in machine memory.
|
|
16
17
|
*/
|
|
17
|
-
export type MachineMemoryRecord = {
|
|
18
|
+
export type MachineMemoryRecord = OrchestrationExecutionMemoryRecord<{
|
|
18
19
|
/** Unique identifier for the machine instance */
|
|
19
20
|
subject: string;
|
|
20
21
|
/**
|
|
@@ -67,7 +68,7 @@ export type MachineMemoryRecord = {
|
|
|
67
68
|
};
|
|
68
69
|
/** Machine definition string */
|
|
69
70
|
machineDefinition: string | null;
|
|
70
|
-
}
|
|
71
|
+
}>;
|
|
71
72
|
/**
|
|
72
73
|
* Interface defining the core components of an Arvo orchestrator.
|
|
73
74
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ArvoOrchestratorContract, VersionedArvoContract } from 'arvo-core';
|
|
2
|
-
import type { ArvoResumableHandler, ArvoResumableState } from './types';
|
|
3
|
-
import type { IMachineMemory } from '../MachineMemory/interface';
|
|
4
2
|
import { ArvoResumable } from '.';
|
|
3
|
+
import type { IMachineMemory } from '../MachineMemory/interface';
|
|
4
|
+
import type { ArvoResumableHandler, ArvoResumableState } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* Factory function for creating ArvoResumable orchestrator instances
|
|
7
7
|
*
|
|
@@ -12,9 +12,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.createArvoResumable = void 0;
|
|
15
|
+
var uuid_1 = require("uuid");
|
|
15
16
|
var _1 = require(".");
|
|
16
17
|
var utils_1 = require("../ArvoMachine/utils");
|
|
17
|
-
var uuid_1 = require("uuid");
|
|
18
18
|
/**
|
|
19
19
|
* Factory function for creating ArvoResumable orchestrator instances
|
|
20
20
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import { type ArvoEvent, type ArvoOrchestratorContract, type VersionedArvoContract } from 'arvo-core';
|
|
2
3
|
import type { z } from 'zod';
|
|
3
|
-
import type
|
|
4
|
+
import type IArvoEventHandler from '../IArvoEventHandler';
|
|
4
5
|
import type { IMachineMemory } from '../MachineMemory/interface';
|
|
5
6
|
import { SyncEventResource } from '../SyncEventResource/index';
|
|
6
|
-
import type { EnqueueArvoEventActionParam } from '../ArvoMachine/types';
|
|
7
|
-
import IArvoEventHandler from '../IArvoEventHandler';
|
|
8
7
|
import type { ArvoEventHandlerOpenTelemetryOptions } from '../types';
|
|
8
|
+
import type { ArvoResumableHandler, ArvoResumableState } from './types';
|
|
9
9
|
/**
|
|
10
10
|
* ArvoResumable - A stateful orchestration handler for managing distributed workflows
|
|
11
11
|
*
|
|
@@ -61,23 +61,9 @@ export declare class ArvoResumable<TMemory extends Record<string, any> = Record<
|
|
|
61
61
|
handler: ArvoResumableHandler<ArvoResumableState<TMemory>, TSelfContract, TServiceContract>;
|
|
62
62
|
systemErrorDomain?: (string | null)[];
|
|
63
63
|
});
|
|
64
|
-
protected validateInput(event: ArvoEvent): {
|
|
64
|
+
protected validateInput(event: ArvoEvent, span: Span): {
|
|
65
65
|
contractType: 'self' | 'service';
|
|
66
66
|
};
|
|
67
|
-
/**
|
|
68
|
-
* Creates emittable event from execution result
|
|
69
|
-
* @param event - Source event to emit
|
|
70
|
-
* @param otelHeaders - OpenTelemetry headers
|
|
71
|
-
* @param orchestrationParentSubject - Parent orchestration subject
|
|
72
|
-
* @param sourceEvent - Original triggering event
|
|
73
|
-
* @param selfVersionedContract - The self versioned contract
|
|
74
|
-
* @param initEventId - The id of the event which initiated the orchestration in the first place
|
|
75
|
-
* @param _domain - The domain of the event.
|
|
76
|
-
*
|
|
77
|
-
* @throws {ContractViolation} On schema/contract mismatch
|
|
78
|
-
* @throws {ExecutionViolation} On invalid parentSubject$$ format
|
|
79
|
-
*/
|
|
80
|
-
protected createEmittableEvent(event: EnqueueArvoEventActionParam, otelHeaders: OpenTelemetryHeaders, orchestrationParentSubject: string | null, sourceEvent: ArvoEvent, selfVersionedContract: VersionedArvoContract<TSelfContract, ArvoSemanticVersion>, initEventId: string, _domain: string | null): ArvoEvent;
|
|
81
67
|
/**
|
|
82
68
|
* Executes the orchestration workflow for an incoming event
|
|
83
69
|
*
|