@unlaxer/tramli-plugins 3.0.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/dist/cjs/api/plugin-registry.d.ts +19 -0
- package/dist/cjs/api/plugin-registry.js +55 -0
- package/dist/cjs/api/types.d.ts +51 -0
- package/dist/cjs/api/types.js +23 -0
- package/dist/cjs/audit/audit-store-plugin.d.ts +7 -0
- package/dist/cjs/audit/audit-store-plugin.js +14 -0
- package/dist/cjs/audit/auditing-flow-store.d.ts +24 -0
- package/dist/cjs/audit/auditing-flow-store.js +33 -0
- package/dist/cjs/diagram/diagram-generation-plugin.d.ts +9 -0
- package/dist/cjs/diagram/diagram-generation-plugin.js +19 -0
- package/dist/cjs/diagram/diagram-plugin.d.ts +5 -0
- package/dist/cjs/diagram/diagram-plugin.js +16 -0
- package/dist/cjs/diagram/types.d.ts +5 -0
- package/dist/cjs/diagram/types.js +2 -0
- package/dist/cjs/docs/documentation-plugin.d.ts +7 -0
- package/dist/cjs/docs/documentation-plugin.js +33 -0
- package/dist/cjs/docs/flow-documentation-plugin.d.ts +8 -0
- package/dist/cjs/docs/flow-documentation-plugin.js +19 -0
- package/dist/cjs/eventstore/compensation-service.d.ts +11 -0
- package/dist/cjs/eventstore/compensation-service.js +22 -0
- package/dist/cjs/eventstore/event-log-store-decorator.d.ts +24 -0
- package/dist/cjs/eventstore/event-log-store-decorator.js +50 -0
- package/dist/cjs/eventstore/event-log-store-plugin.d.ts +7 -0
- package/dist/cjs/eventstore/event-log-store-plugin.js +14 -0
- package/dist/cjs/eventstore/replay-service.d.ts +14 -0
- package/dist/cjs/eventstore/replay-service.js +33 -0
- package/dist/cjs/eventstore/types.d.ts +19 -0
- package/dist/cjs/eventstore/types.js +2 -0
- package/dist/cjs/hierarchy/entry-exit-compiler.d.ts +8 -0
- package/dist/cjs/hierarchy/entry-exit-compiler.js +39 -0
- package/dist/cjs/hierarchy/hierarchy-code-generator.d.ts +10 -0
- package/dist/cjs/hierarchy/hierarchy-code-generator.js +48 -0
- package/dist/cjs/hierarchy/hierarchy-generation-plugin.d.ts +8 -0
- package/dist/cjs/hierarchy/hierarchy-generation-plugin.js +22 -0
- package/dist/cjs/hierarchy/types.d.ts +27 -0
- package/dist/cjs/hierarchy/types.js +21 -0
- package/dist/cjs/idempotency/idempotency-runtime-plugin.d.ts +11 -0
- package/dist/cjs/idempotency/idempotency-runtime-plugin.js +22 -0
- package/dist/cjs/idempotency/idempotent-rich-resume-executor.d.ts +9 -0
- package/dist/cjs/idempotency/idempotent-rich-resume-executor.js +22 -0
- package/dist/cjs/idempotency/in-memory-idempotency-registry.d.ts +5 -0
- package/dist/cjs/idempotency/in-memory-idempotency-registry.js +14 -0
- package/dist/cjs/idempotency/types.d.ts +13 -0
- package/dist/cjs/idempotency/types.js +2 -0
- package/dist/cjs/index.d.ts +36 -0
- package/dist/cjs/index.js +72 -0
- package/dist/cjs/lint/default-flow-policies.d.ts +2 -0
- package/dist/cjs/lint/default-flow-policies.js +41 -0
- package/dist/cjs/lint/policy-lint-plugin.d.ts +11 -0
- package/dist/cjs/lint/policy-lint-plugin.js +27 -0
- package/dist/cjs/lint/types.d.ts +5 -0
- package/dist/cjs/lint/types.js +2 -0
- package/dist/cjs/observability/observability-plugin.d.ts +25 -0
- package/dist/cjs/observability/observability-plugin.js +36 -0
- package/dist/cjs/resume/rich-resume.d.ts +21 -0
- package/dist/cjs/resume/rich-resume.js +47 -0
- package/dist/cjs/subflow/guaranteed-subflow-validator.d.ts +8 -0
- package/dist/cjs/subflow/guaranteed-subflow-validator.js +31 -0
- package/dist/cjs/testing/scenario-generation-plugin.d.ts +9 -0
- package/dist/cjs/testing/scenario-generation-plugin.js +19 -0
- package/dist/cjs/testing/scenario-test-plugin.d.ts +8 -0
- package/dist/cjs/testing/scenario-test-plugin.js +28 -0
- package/dist/cjs/testing/types.d.ts +7 -0
- package/dist/cjs/testing/types.js +2 -0
- package/dist/esm/api/plugin-registry.d.ts +19 -0
- package/dist/esm/api/plugin-registry.js +51 -0
- package/dist/esm/api/types.d.ts +51 -0
- package/dist/esm/api/types.js +19 -0
- package/dist/esm/audit/audit-store-plugin.d.ts +7 -0
- package/dist/esm/audit/audit-store-plugin.js +10 -0
- package/dist/esm/audit/auditing-flow-store.d.ts +24 -0
- package/dist/esm/audit/auditing-flow-store.js +29 -0
- package/dist/esm/diagram/diagram-generation-plugin.d.ts +9 -0
- package/dist/esm/diagram/diagram-generation-plugin.js +15 -0
- package/dist/esm/diagram/diagram-plugin.d.ts +5 -0
- package/dist/esm/diagram/diagram-plugin.js +12 -0
- package/dist/esm/diagram/types.d.ts +5 -0
- package/dist/esm/diagram/types.js +1 -0
- package/dist/esm/docs/documentation-plugin.d.ts +7 -0
- package/dist/esm/docs/documentation-plugin.js +29 -0
- package/dist/esm/docs/flow-documentation-plugin.d.ts +8 -0
- package/dist/esm/docs/flow-documentation-plugin.js +15 -0
- package/dist/esm/eventstore/compensation-service.d.ts +11 -0
- package/dist/esm/eventstore/compensation-service.js +18 -0
- package/dist/esm/eventstore/event-log-store-decorator.d.ts +24 -0
- package/dist/esm/eventstore/event-log-store-decorator.js +46 -0
- package/dist/esm/eventstore/event-log-store-plugin.d.ts +7 -0
- package/dist/esm/eventstore/event-log-store-plugin.js +10 -0
- package/dist/esm/eventstore/replay-service.d.ts +14 -0
- package/dist/esm/eventstore/replay-service.js +28 -0
- package/dist/esm/eventstore/types.d.ts +19 -0
- package/dist/esm/eventstore/types.js +1 -0
- package/dist/esm/hierarchy/entry-exit-compiler.d.ts +8 -0
- package/dist/esm/hierarchy/entry-exit-compiler.js +35 -0
- package/dist/esm/hierarchy/hierarchy-code-generator.d.ts +10 -0
- package/dist/esm/hierarchy/hierarchy-code-generator.js +44 -0
- package/dist/esm/hierarchy/hierarchy-generation-plugin.d.ts +8 -0
- package/dist/esm/hierarchy/hierarchy-generation-plugin.js +18 -0
- package/dist/esm/hierarchy/types.d.ts +27 -0
- package/dist/esm/hierarchy/types.js +16 -0
- package/dist/esm/idempotency/idempotency-runtime-plugin.d.ts +11 -0
- package/dist/esm/idempotency/idempotency-runtime-plugin.js +18 -0
- package/dist/esm/idempotency/idempotent-rich-resume-executor.d.ts +9 -0
- package/dist/esm/idempotency/idempotent-rich-resume-executor.js +18 -0
- package/dist/esm/idempotency/in-memory-idempotency-registry.d.ts +5 -0
- package/dist/esm/idempotency/in-memory-idempotency-registry.js +10 -0
- package/dist/esm/idempotency/types.d.ts +13 -0
- package/dist/esm/idempotency/types.js +1 -0
- package/dist/esm/index.d.ts +36 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/lint/default-flow-policies.d.ts +2 -0
- package/dist/esm/lint/default-flow-policies.js +38 -0
- package/dist/esm/lint/policy-lint-plugin.d.ts +11 -0
- package/dist/esm/lint/policy-lint-plugin.js +23 -0
- package/dist/esm/lint/types.d.ts +5 -0
- package/dist/esm/lint/types.js +1 -0
- package/dist/esm/observability/observability-plugin.d.ts +25 -0
- package/dist/esm/observability/observability-plugin.js +31 -0
- package/dist/esm/resume/rich-resume.d.ts +21 -0
- package/dist/esm/resume/rich-resume.js +42 -0
- package/dist/esm/subflow/guaranteed-subflow-validator.d.ts +8 -0
- package/dist/esm/subflow/guaranteed-subflow-validator.js +27 -0
- package/dist/esm/testing/scenario-generation-plugin.d.ts +9 -0
- package/dist/esm/testing/scenario-generation-plugin.js +15 -0
- package/dist/esm/testing/scenario-test-plugin.d.ts +8 -0
- package/dist/esm/testing/scenario-test-plugin.js +24 -0
- package/dist/esm/testing/types.d.ts +7 -0
- package/dist/esm/testing/types.js +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HierarchyCodeGenerator = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generates TypeScript source from a hierarchical flow spec.
|
|
6
|
+
* Flattens the hierarchy into a flat state config + builder skeleton.
|
|
7
|
+
*/
|
|
8
|
+
class HierarchyCodeGenerator {
|
|
9
|
+
generateStateConfig(spec) {
|
|
10
|
+
const flatStates = [];
|
|
11
|
+
this.flatten(spec.rootStates, '', flatStates);
|
|
12
|
+
const lines = [];
|
|
13
|
+
lines.push(`// Generated state config for ${spec.flowName}`);
|
|
14
|
+
lines.push(`import { Tramli } from '@unlaxer/tramli';`);
|
|
15
|
+
lines.push('');
|
|
16
|
+
lines.push(`export const ${spec.enumName} = {`);
|
|
17
|
+
for (const s of flatStates) {
|
|
18
|
+
lines.push(` ${s.enumName}: { terminal: ${s.terminal}, initial: ${s.initial} },`);
|
|
19
|
+
}
|
|
20
|
+
lines.push('} as const;');
|
|
21
|
+
lines.push('');
|
|
22
|
+
lines.push(`export type ${spec.enumName}State = keyof typeof ${spec.enumName};`);
|
|
23
|
+
return lines.join('\n');
|
|
24
|
+
}
|
|
25
|
+
generateBuilderSkeleton(spec) {
|
|
26
|
+
const lines = [];
|
|
27
|
+
lines.push(`// Generated builder skeleton for ${spec.flowName}`);
|
|
28
|
+
lines.push(`import { Tramli } from '@unlaxer/tramli';`);
|
|
29
|
+
lines.push(`import { ${spec.enumName} } from './${spec.enumName}.js';`);
|
|
30
|
+
lines.push('');
|
|
31
|
+
lines.push(`export function build${spec.flowName}() {`);
|
|
32
|
+
lines.push(` const b = Tramli.define('${spec.flowName}', ${spec.enumName});`);
|
|
33
|
+
for (const t of spec.transitions) {
|
|
34
|
+
lines.push(` // ${t.trigger}: ${t.from} -> ${t.to} requires [${t.requires.join(', ')}] produces [${t.produces.join(', ')}]`);
|
|
35
|
+
}
|
|
36
|
+
lines.push(' return b.build();');
|
|
37
|
+
lines.push('}');
|
|
38
|
+
return lines.join('\n');
|
|
39
|
+
}
|
|
40
|
+
flatten(states, prefix, out) {
|
|
41
|
+
for (const state of states) {
|
|
42
|
+
const flat = (prefix ? `${prefix}_${state.name}` : state.name).toUpperCase();
|
|
43
|
+
out.push({ enumName: flat, terminal: state.terminal, initial: state.initial });
|
|
44
|
+
this.flatten(state.children, flat, out);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.HierarchyCodeGenerator = HierarchyCodeGenerator;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GenerationPlugin, PluginDescriptor } from '../api/types.js';
|
|
2
|
+
import type { HierarchicalFlowSpec } from './types.js';
|
|
3
|
+
export declare class HierarchyGenerationPlugin implements GenerationPlugin<HierarchicalFlowSpec, Map<string, string>> {
|
|
4
|
+
private readonly generator;
|
|
5
|
+
descriptor(): PluginDescriptor;
|
|
6
|
+
kind(): "GENERATION";
|
|
7
|
+
generate(input: HierarchicalFlowSpec): Map<string, string>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HierarchyGenerationPlugin = void 0;
|
|
4
|
+
const hierarchy_code_generator_js_1 = require("./hierarchy-code-generator.js");
|
|
5
|
+
class HierarchyGenerationPlugin {
|
|
6
|
+
generator = new hierarchy_code_generator_js_1.HierarchyCodeGenerator();
|
|
7
|
+
descriptor() {
|
|
8
|
+
return {
|
|
9
|
+
id: 'hierarchy',
|
|
10
|
+
displayName: 'Hierarchy Generator',
|
|
11
|
+
description: 'Compiles hierarchical authoring specs into flat TypeScript state config and builder skeleton.',
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
kind() { return 'GENERATION'; }
|
|
15
|
+
generate(input) {
|
|
16
|
+
return new Map([
|
|
17
|
+
[`${input.enumName}.ts`, this.generator.generateStateConfig(input)],
|
|
18
|
+
[`${input.flowName}Generated.ts`, this.generator.generateBuilderSkeleton(input)],
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.HierarchyGenerationPlugin = HierarchyGenerationPlugin;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface HierarchicalStateSpec {
|
|
2
|
+
name: string;
|
|
3
|
+
initial: boolean;
|
|
4
|
+
terminal: boolean;
|
|
5
|
+
entryProduces: string[];
|
|
6
|
+
exitProduces: string[];
|
|
7
|
+
children: HierarchicalStateSpec[];
|
|
8
|
+
}
|
|
9
|
+
export interface HierarchicalTransitionSpec {
|
|
10
|
+
from: string;
|
|
11
|
+
to: string;
|
|
12
|
+
trigger: string;
|
|
13
|
+
requires: string[];
|
|
14
|
+
produces: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface HierarchicalFlowSpec {
|
|
17
|
+
flowName: string;
|
|
18
|
+
enumName: string;
|
|
19
|
+
rootStates: HierarchicalStateSpec[];
|
|
20
|
+
transitions: HierarchicalTransitionSpec[];
|
|
21
|
+
}
|
|
22
|
+
export declare function stateSpec(name: string, opts?: {
|
|
23
|
+
initial?: boolean;
|
|
24
|
+
terminal?: boolean;
|
|
25
|
+
}): HierarchicalStateSpec;
|
|
26
|
+
export declare function transitionSpec(from: string, to: string, trigger: string): HierarchicalTransitionSpec;
|
|
27
|
+
export declare function flowSpec(flowName: string, enumName: string): HierarchicalFlowSpec;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stateSpec = stateSpec;
|
|
4
|
+
exports.transitionSpec = transitionSpec;
|
|
5
|
+
exports.flowSpec = flowSpec;
|
|
6
|
+
function stateSpec(name, opts) {
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
initial: opts?.initial ?? false,
|
|
10
|
+
terminal: opts?.terminal ?? false,
|
|
11
|
+
entryProduces: [],
|
|
12
|
+
exitProduces: [],
|
|
13
|
+
children: [],
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function transitionSpec(from, to, trigger) {
|
|
17
|
+
return { from, to, trigger, requires: [], produces: [] };
|
|
18
|
+
}
|
|
19
|
+
function flowSpec(flowName, enumName) {
|
|
20
|
+
return { flowName, enumName, rootStates: [], transitions: [] };
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FlowEngine } from '@unlaxer/tramli';
|
|
2
|
+
import type { RuntimeAdapterPlugin, PluginDescriptor } from '../api/types.js';
|
|
3
|
+
import type { IdempotencyRegistry } from './types.js';
|
|
4
|
+
import { IdempotentRichResumeExecutor } from './idempotent-rich-resume-executor.js';
|
|
5
|
+
export declare class IdempotencyRuntimePlugin implements RuntimeAdapterPlugin<IdempotentRichResumeExecutor> {
|
|
6
|
+
private readonly registry;
|
|
7
|
+
constructor(registry: IdempotencyRegistry);
|
|
8
|
+
descriptor(): PluginDescriptor;
|
|
9
|
+
kind(): "RUNTIME_ADAPTER";
|
|
10
|
+
bind(engine: FlowEngine): IdempotentRichResumeExecutor;
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdempotencyRuntimePlugin = void 0;
|
|
4
|
+
const idempotent_rich_resume_executor_js_1 = require("./idempotent-rich-resume-executor.js");
|
|
5
|
+
class IdempotencyRuntimePlugin {
|
|
6
|
+
registry;
|
|
7
|
+
constructor(registry) {
|
|
8
|
+
this.registry = registry;
|
|
9
|
+
}
|
|
10
|
+
descriptor() {
|
|
11
|
+
return {
|
|
12
|
+
id: 'idempotency',
|
|
13
|
+
displayName: 'Idempotency',
|
|
14
|
+
description: 'Binds a FlowEngine to duplicate-suppression helpers.',
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
kind() { return 'RUNTIME_ADAPTER'; }
|
|
18
|
+
bind(engine) {
|
|
19
|
+
return new idempotent_rich_resume_executor_js_1.IdempotentRichResumeExecutor(engine, this.registry);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.IdempotencyRuntimePlugin = IdempotencyRuntimePlugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FlowEngine, FlowDefinition } from '@unlaxer/tramli';
|
|
2
|
+
import type { IdempotencyRegistry, CommandEnvelope } from './types.js';
|
|
3
|
+
import { type RichResumeResult } from '../resume/rich-resume.js';
|
|
4
|
+
export declare class IdempotentRichResumeExecutor {
|
|
5
|
+
private readonly registry;
|
|
6
|
+
private readonly delegate;
|
|
7
|
+
constructor(engine: FlowEngine, registry: IdempotencyRegistry);
|
|
8
|
+
resume<S extends string>(flowId: string, definition: FlowDefinition<S>, envelope: CommandEnvelope, knownBeforeState: S): Promise<RichResumeResult<S>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdempotentRichResumeExecutor = void 0;
|
|
4
|
+
const rich_resume_js_1 = require("../resume/rich-resume.js");
|
|
5
|
+
class IdempotentRichResumeExecutor {
|
|
6
|
+
registry;
|
|
7
|
+
delegate;
|
|
8
|
+
constructor(engine, registry) {
|
|
9
|
+
this.registry = registry;
|
|
10
|
+
this.delegate = new rich_resume_js_1.RichResumeExecutor(engine);
|
|
11
|
+
}
|
|
12
|
+
async resume(flowId, definition, envelope, knownBeforeState) {
|
|
13
|
+
if (!this.registry.markIfFirstSeen(flowId, envelope.commandId)) {
|
|
14
|
+
return {
|
|
15
|
+
status: 'ALREADY_COMPLETE',
|
|
16
|
+
error: new Error(`duplicate commandId ${envelope.commandId}`),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return this.delegate.resume(flowId, definition, envelope.externalData, knownBeforeState);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.IdempotentRichResumeExecutor = IdempotentRichResumeExecutor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemoryIdempotencyRegistry = void 0;
|
|
4
|
+
class InMemoryIdempotencyRegistry {
|
|
5
|
+
seen = new Set();
|
|
6
|
+
markIfFirstSeen(flowId, commandId) {
|
|
7
|
+
const key = `${flowId}::${commandId}`;
|
|
8
|
+
if (this.seen.has(key))
|
|
9
|
+
return false;
|
|
10
|
+
this.seen.add(key);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.InMemoryIdempotencyRegistry = InMemoryIdempotencyRegistry;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command envelope — wraps external data with a unique command ID for dedup.
|
|
3
|
+
*/
|
|
4
|
+
export interface CommandEnvelope {
|
|
5
|
+
commandId: string;
|
|
6
|
+
externalData: Map<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Idempotency registry — tracks which commands have already been processed.
|
|
10
|
+
*/
|
|
11
|
+
export interface IdempotencyRegistry {
|
|
12
|
+
markIfFirstSeen(flowId: string, commandId: string): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export { PluginReport } from './api/types.js';
|
|
2
|
+
export type { PluginKind, PluginDescriptor, FlowPlugin, AnalysisPlugin, StorePlugin, EnginePlugin, RuntimeAdapterPlugin, GenerationPlugin, DocumentationPlugin as DocumentationPluginSPI, } from './api/types.js';
|
|
3
|
+
export { PluginRegistry } from './api/plugin-registry.js';
|
|
4
|
+
export { AuditStorePlugin } from './audit/audit-store-plugin.js';
|
|
5
|
+
export { AuditingFlowStore } from './audit/auditing-flow-store.js';
|
|
6
|
+
export type { AuditedTransitionRecord } from './audit/auditing-flow-store.js';
|
|
7
|
+
export { EventLogStorePlugin } from './eventstore/event-log-store-plugin.js';
|
|
8
|
+
export { EventLogStoreDecorator } from './eventstore/event-log-store-decorator.js';
|
|
9
|
+
export { ReplayService, ProjectionReplayService } from './eventstore/replay-service.js';
|
|
10
|
+
export { CompensationService } from './eventstore/compensation-service.js';
|
|
11
|
+
export type { VersionedTransitionEvent, CompensationPlan, CompensationResolver, ProjectionReducer, } from './eventstore/types.js';
|
|
12
|
+
export { ObservabilityEnginePlugin, InMemoryTelemetrySink } from './observability/observability-plugin.js';
|
|
13
|
+
export type { TelemetryEvent, TelemetrySink } from './observability/observability-plugin.js';
|
|
14
|
+
export { RichResumeExecutor, RichResumeRuntimePlugin } from './resume/rich-resume.js';
|
|
15
|
+
export type { RichResumeStatus, RichResumeResult } from './resume/rich-resume.js';
|
|
16
|
+
export { InMemoryIdempotencyRegistry } from './idempotency/in-memory-idempotency-registry.js';
|
|
17
|
+
export { IdempotentRichResumeExecutor } from './idempotency/idempotent-rich-resume-executor.js';
|
|
18
|
+
export { IdempotencyRuntimePlugin } from './idempotency/idempotency-runtime-plugin.js';
|
|
19
|
+
export type { CommandEnvelope, IdempotencyRegistry } from './idempotency/types.js';
|
|
20
|
+
export { EntryExitCompiler } from './hierarchy/entry-exit-compiler.js';
|
|
21
|
+
export { HierarchyCodeGenerator } from './hierarchy/hierarchy-code-generator.js';
|
|
22
|
+
export { HierarchyGenerationPlugin } from './hierarchy/hierarchy-generation-plugin.js';
|
|
23
|
+
export type { HierarchicalStateSpec, HierarchicalTransitionSpec, HierarchicalFlowSpec, } from './hierarchy/types.js';
|
|
24
|
+
export { stateSpec, transitionSpec, flowSpec } from './hierarchy/types.js';
|
|
25
|
+
export { DiagramPlugin } from './diagram/diagram-plugin.js';
|
|
26
|
+
export { DiagramGenerationPlugin } from './diagram/diagram-generation-plugin.js';
|
|
27
|
+
export type { DiagramBundle } from './diagram/types.js';
|
|
28
|
+
export { DocumentationPlugin } from './docs/documentation-plugin.js';
|
|
29
|
+
export { FlowDocumentationPlugin } from './docs/flow-documentation-plugin.js';
|
|
30
|
+
export { PolicyLintPlugin } from './lint/policy-lint-plugin.js';
|
|
31
|
+
export { allDefaultPolicies } from './lint/default-flow-policies.js';
|
|
32
|
+
export type { FlowPolicy } from './lint/types.js';
|
|
33
|
+
export { ScenarioTestPlugin } from './testing/scenario-test-plugin.js';
|
|
34
|
+
export { ScenarioGenerationPlugin } from './testing/scenario-generation-plugin.js';
|
|
35
|
+
export type { FlowScenario, FlowTestPlan } from './testing/types.js';
|
|
36
|
+
export { GuaranteedSubflowValidator } from './subflow/guaranteed-subflow-validator.js';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuaranteedSubflowValidator = exports.ScenarioGenerationPlugin = exports.ScenarioTestPlugin = exports.allDefaultPolicies = exports.PolicyLintPlugin = exports.FlowDocumentationPlugin = exports.DocumentationPlugin = exports.DiagramGenerationPlugin = exports.DiagramPlugin = exports.flowSpec = exports.transitionSpec = exports.stateSpec = exports.HierarchyGenerationPlugin = exports.HierarchyCodeGenerator = exports.EntryExitCompiler = exports.IdempotencyRuntimePlugin = exports.IdempotentRichResumeExecutor = exports.InMemoryIdempotencyRegistry = exports.RichResumeRuntimePlugin = exports.RichResumeExecutor = exports.InMemoryTelemetrySink = exports.ObservabilityEnginePlugin = exports.CompensationService = exports.ProjectionReplayService = exports.ReplayService = exports.EventLogStoreDecorator = exports.EventLogStorePlugin = exports.AuditingFlowStore = exports.AuditStorePlugin = exports.PluginRegistry = exports.PluginReport = void 0;
|
|
4
|
+
// ── API framework ──
|
|
5
|
+
var types_js_1 = require("./api/types.js");
|
|
6
|
+
Object.defineProperty(exports, "PluginReport", { enumerable: true, get: function () { return types_js_1.PluginReport; } });
|
|
7
|
+
var plugin_registry_js_1 = require("./api/plugin-registry.js");
|
|
8
|
+
Object.defineProperty(exports, "PluginRegistry", { enumerable: true, get: function () { return plugin_registry_js_1.PluginRegistry; } });
|
|
9
|
+
// ── Audit ──
|
|
10
|
+
var audit_store_plugin_js_1 = require("./audit/audit-store-plugin.js");
|
|
11
|
+
Object.defineProperty(exports, "AuditStorePlugin", { enumerable: true, get: function () { return audit_store_plugin_js_1.AuditStorePlugin; } });
|
|
12
|
+
var auditing_flow_store_js_1 = require("./audit/auditing-flow-store.js");
|
|
13
|
+
Object.defineProperty(exports, "AuditingFlowStore", { enumerable: true, get: function () { return auditing_flow_store_js_1.AuditingFlowStore; } });
|
|
14
|
+
// ── Event Store ──
|
|
15
|
+
var event_log_store_plugin_js_1 = require("./eventstore/event-log-store-plugin.js");
|
|
16
|
+
Object.defineProperty(exports, "EventLogStorePlugin", { enumerable: true, get: function () { return event_log_store_plugin_js_1.EventLogStorePlugin; } });
|
|
17
|
+
var event_log_store_decorator_js_1 = require("./eventstore/event-log-store-decorator.js");
|
|
18
|
+
Object.defineProperty(exports, "EventLogStoreDecorator", { enumerable: true, get: function () { return event_log_store_decorator_js_1.EventLogStoreDecorator; } });
|
|
19
|
+
var replay_service_js_1 = require("./eventstore/replay-service.js");
|
|
20
|
+
Object.defineProperty(exports, "ReplayService", { enumerable: true, get: function () { return replay_service_js_1.ReplayService; } });
|
|
21
|
+
Object.defineProperty(exports, "ProjectionReplayService", { enumerable: true, get: function () { return replay_service_js_1.ProjectionReplayService; } });
|
|
22
|
+
var compensation_service_js_1 = require("./eventstore/compensation-service.js");
|
|
23
|
+
Object.defineProperty(exports, "CompensationService", { enumerable: true, get: function () { return compensation_service_js_1.CompensationService; } });
|
|
24
|
+
// ── Observability ──
|
|
25
|
+
var observability_plugin_js_1 = require("./observability/observability-plugin.js");
|
|
26
|
+
Object.defineProperty(exports, "ObservabilityEnginePlugin", { enumerable: true, get: function () { return observability_plugin_js_1.ObservabilityEnginePlugin; } });
|
|
27
|
+
Object.defineProperty(exports, "InMemoryTelemetrySink", { enumerable: true, get: function () { return observability_plugin_js_1.InMemoryTelemetrySink; } });
|
|
28
|
+
// ── Rich Resume ──
|
|
29
|
+
var rich_resume_js_1 = require("./resume/rich-resume.js");
|
|
30
|
+
Object.defineProperty(exports, "RichResumeExecutor", { enumerable: true, get: function () { return rich_resume_js_1.RichResumeExecutor; } });
|
|
31
|
+
Object.defineProperty(exports, "RichResumeRuntimePlugin", { enumerable: true, get: function () { return rich_resume_js_1.RichResumeRuntimePlugin; } });
|
|
32
|
+
// ── Idempotency ──
|
|
33
|
+
var in_memory_idempotency_registry_js_1 = require("./idempotency/in-memory-idempotency-registry.js");
|
|
34
|
+
Object.defineProperty(exports, "InMemoryIdempotencyRegistry", { enumerable: true, get: function () { return in_memory_idempotency_registry_js_1.InMemoryIdempotencyRegistry; } });
|
|
35
|
+
var idempotent_rich_resume_executor_js_1 = require("./idempotency/idempotent-rich-resume-executor.js");
|
|
36
|
+
Object.defineProperty(exports, "IdempotentRichResumeExecutor", { enumerable: true, get: function () { return idempotent_rich_resume_executor_js_1.IdempotentRichResumeExecutor; } });
|
|
37
|
+
var idempotency_runtime_plugin_js_1 = require("./idempotency/idempotency-runtime-plugin.js");
|
|
38
|
+
Object.defineProperty(exports, "IdempotencyRuntimePlugin", { enumerable: true, get: function () { return idempotency_runtime_plugin_js_1.IdempotencyRuntimePlugin; } });
|
|
39
|
+
// ── Hierarchy ──
|
|
40
|
+
var entry_exit_compiler_js_1 = require("./hierarchy/entry-exit-compiler.js");
|
|
41
|
+
Object.defineProperty(exports, "EntryExitCompiler", { enumerable: true, get: function () { return entry_exit_compiler_js_1.EntryExitCompiler; } });
|
|
42
|
+
var hierarchy_code_generator_js_1 = require("./hierarchy/hierarchy-code-generator.js");
|
|
43
|
+
Object.defineProperty(exports, "HierarchyCodeGenerator", { enumerable: true, get: function () { return hierarchy_code_generator_js_1.HierarchyCodeGenerator; } });
|
|
44
|
+
var hierarchy_generation_plugin_js_1 = require("./hierarchy/hierarchy-generation-plugin.js");
|
|
45
|
+
Object.defineProperty(exports, "HierarchyGenerationPlugin", { enumerable: true, get: function () { return hierarchy_generation_plugin_js_1.HierarchyGenerationPlugin; } });
|
|
46
|
+
var types_js_2 = require("./hierarchy/types.js");
|
|
47
|
+
Object.defineProperty(exports, "stateSpec", { enumerable: true, get: function () { return types_js_2.stateSpec; } });
|
|
48
|
+
Object.defineProperty(exports, "transitionSpec", { enumerable: true, get: function () { return types_js_2.transitionSpec; } });
|
|
49
|
+
Object.defineProperty(exports, "flowSpec", { enumerable: true, get: function () { return types_js_2.flowSpec; } });
|
|
50
|
+
// ── Diagram ──
|
|
51
|
+
var diagram_plugin_js_1 = require("./diagram/diagram-plugin.js");
|
|
52
|
+
Object.defineProperty(exports, "DiagramPlugin", { enumerable: true, get: function () { return diagram_plugin_js_1.DiagramPlugin; } });
|
|
53
|
+
var diagram_generation_plugin_js_1 = require("./diagram/diagram-generation-plugin.js");
|
|
54
|
+
Object.defineProperty(exports, "DiagramGenerationPlugin", { enumerable: true, get: function () { return diagram_generation_plugin_js_1.DiagramGenerationPlugin; } });
|
|
55
|
+
// ── Documentation ──
|
|
56
|
+
var documentation_plugin_js_1 = require("./docs/documentation-plugin.js");
|
|
57
|
+
Object.defineProperty(exports, "DocumentationPlugin", { enumerable: true, get: function () { return documentation_plugin_js_1.DocumentationPlugin; } });
|
|
58
|
+
var flow_documentation_plugin_js_1 = require("./docs/flow-documentation-plugin.js");
|
|
59
|
+
Object.defineProperty(exports, "FlowDocumentationPlugin", { enumerable: true, get: function () { return flow_documentation_plugin_js_1.FlowDocumentationPlugin; } });
|
|
60
|
+
// ── Lint ──
|
|
61
|
+
var policy_lint_plugin_js_1 = require("./lint/policy-lint-plugin.js");
|
|
62
|
+
Object.defineProperty(exports, "PolicyLintPlugin", { enumerable: true, get: function () { return policy_lint_plugin_js_1.PolicyLintPlugin; } });
|
|
63
|
+
var default_flow_policies_js_1 = require("./lint/default-flow-policies.js");
|
|
64
|
+
Object.defineProperty(exports, "allDefaultPolicies", { enumerable: true, get: function () { return default_flow_policies_js_1.allDefaultPolicies; } });
|
|
65
|
+
// ── Testing ──
|
|
66
|
+
var scenario_test_plugin_js_1 = require("./testing/scenario-test-plugin.js");
|
|
67
|
+
Object.defineProperty(exports, "ScenarioTestPlugin", { enumerable: true, get: function () { return scenario_test_plugin_js_1.ScenarioTestPlugin; } });
|
|
68
|
+
var scenario_generation_plugin_js_1 = require("./testing/scenario-generation-plugin.js");
|
|
69
|
+
Object.defineProperty(exports, "ScenarioGenerationPlugin", { enumerable: true, get: function () { return scenario_generation_plugin_js_1.ScenarioGenerationPlugin; } });
|
|
70
|
+
// ── SubFlow ──
|
|
71
|
+
var guaranteed_subflow_validator_js_1 = require("./subflow/guaranteed-subflow-validator.js");
|
|
72
|
+
Object.defineProperty(exports, "GuaranteedSubflowValidator", { enumerable: true, get: function () { return guaranteed_subflow_validator_js_1.GuaranteedSubflowValidator; } });
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.allDefaultPolicies = allDefaultPolicies;
|
|
4
|
+
function warnTerminalWithOutgoing(def, report) {
|
|
5
|
+
for (const state of def.terminalStates) {
|
|
6
|
+
if (def.transitionsFrom(state).length > 0) {
|
|
7
|
+
report.warn('policy/terminal-outgoing', `terminal state ${state} has outgoing transitions`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function warnTooManyExternals(def, report) {
|
|
12
|
+
for (const state of def.allStates()) {
|
|
13
|
+
const externals = def.transitionsFrom(state).filter(t => t.type === 'external');
|
|
14
|
+
if (externals.length > 3) {
|
|
15
|
+
report.warn('policy/external-count', `state ${state} has ${externals.length} external transitions`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function warnDeadProducedData(def, report) {
|
|
20
|
+
if (!def.dataFlowGraph)
|
|
21
|
+
return;
|
|
22
|
+
const dead = def.dataFlowGraph.deadData();
|
|
23
|
+
for (const key of dead) {
|
|
24
|
+
report.warn('policy/dead-data', `produced but never consumed: ${key}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function warnOverwideProcessors(def, report) {
|
|
28
|
+
for (const t of def.transitions) {
|
|
29
|
+
if (t.processor && t.processor.produces.length > 3) {
|
|
30
|
+
report.warn('policy/overwide-processor', `${t.processor.name} produces ${t.processor.produces.length} types; consider splitting it`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function allDefaultPolicies() {
|
|
35
|
+
return [
|
|
36
|
+
warnTerminalWithOutgoing,
|
|
37
|
+
warnTooManyExternals,
|
|
38
|
+
warnDeadProducedData,
|
|
39
|
+
warnOverwideProcessors,
|
|
40
|
+
];
|
|
41
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FlowDefinition } from '@unlaxer/tramli';
|
|
2
|
+
import type { AnalysisPlugin, PluginDescriptor, PluginReport } from '../api/types.js';
|
|
3
|
+
import type { FlowPolicy } from './types.js';
|
|
4
|
+
export declare class PolicyLintPlugin<S extends string> implements AnalysisPlugin<S> {
|
|
5
|
+
private readonly policies;
|
|
6
|
+
constructor(policies: FlowPolicy<S>[]);
|
|
7
|
+
static defaults<S extends string>(): PolicyLintPlugin<S>;
|
|
8
|
+
descriptor(): PluginDescriptor;
|
|
9
|
+
kind(): "ANALYSIS";
|
|
10
|
+
analyze(definition: FlowDefinition<S>, report: PluginReport): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyLintPlugin = void 0;
|
|
4
|
+
const default_flow_policies_js_1 = require("./default-flow-policies.js");
|
|
5
|
+
class PolicyLintPlugin {
|
|
6
|
+
policies;
|
|
7
|
+
constructor(policies) {
|
|
8
|
+
this.policies = policies;
|
|
9
|
+
}
|
|
10
|
+
static defaults() {
|
|
11
|
+
return new PolicyLintPlugin((0, default_flow_policies_js_1.allDefaultPolicies)());
|
|
12
|
+
}
|
|
13
|
+
descriptor() {
|
|
14
|
+
return {
|
|
15
|
+
id: 'policy-lint',
|
|
16
|
+
displayName: 'Policy Lint',
|
|
17
|
+
description: 'Applies design-time lint policies to a flow definition.',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
kind() { return 'ANALYSIS'; }
|
|
21
|
+
analyze(definition, report) {
|
|
22
|
+
for (const policy of this.policies) {
|
|
23
|
+
policy(definition, report);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.PolicyLintPlugin = PolicyLintPlugin;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FlowEngine } from '@unlaxer/tramli';
|
|
2
|
+
import type { EnginePlugin, PluginDescriptor } from '../api/types.js';
|
|
3
|
+
export interface TelemetryEvent {
|
|
4
|
+
type: 'transition' | 'guard' | 'error' | 'state';
|
|
5
|
+
flowId: string;
|
|
6
|
+
flowName: string;
|
|
7
|
+
data: Record<string, unknown>;
|
|
8
|
+
timestamp: Date;
|
|
9
|
+
}
|
|
10
|
+
export interface TelemetrySink {
|
|
11
|
+
emit(event: TelemetryEvent): void;
|
|
12
|
+
events(): readonly TelemetryEvent[];
|
|
13
|
+
}
|
|
14
|
+
export declare class InMemoryTelemetrySink implements TelemetrySink {
|
|
15
|
+
private log;
|
|
16
|
+
emit(event: TelemetryEvent): void;
|
|
17
|
+
events(): readonly TelemetryEvent[];
|
|
18
|
+
}
|
|
19
|
+
export declare class ObservabilityEnginePlugin implements EnginePlugin {
|
|
20
|
+
private readonly sink;
|
|
21
|
+
constructor(sink: TelemetrySink);
|
|
22
|
+
descriptor(): PluginDescriptor;
|
|
23
|
+
kind(): "ENGINE";
|
|
24
|
+
install(engine: FlowEngine): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservabilityEnginePlugin = exports.InMemoryTelemetrySink = void 0;
|
|
4
|
+
class InMemoryTelemetrySink {
|
|
5
|
+
log = [];
|
|
6
|
+
emit(event) { this.log.push(event); }
|
|
7
|
+
events() { return this.log; }
|
|
8
|
+
}
|
|
9
|
+
exports.InMemoryTelemetrySink = InMemoryTelemetrySink;
|
|
10
|
+
class ObservabilityEnginePlugin {
|
|
11
|
+
sink;
|
|
12
|
+
constructor(sink) {
|
|
13
|
+
this.sink = sink;
|
|
14
|
+
}
|
|
15
|
+
descriptor() {
|
|
16
|
+
return { id: 'observability', displayName: 'Observability', description: 'Telemetry via engine logger hooks' };
|
|
17
|
+
}
|
|
18
|
+
kind() { return 'ENGINE'; }
|
|
19
|
+
install(engine) {
|
|
20
|
+
engine.setTransitionLogger(entry => {
|
|
21
|
+
this.sink.emit({
|
|
22
|
+
type: 'transition', flowId: entry.flowId, flowName: '',
|
|
23
|
+
data: { from: entry.from, to: entry.to, trigger: entry.trigger },
|
|
24
|
+
timestamp: new Date(),
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
engine.setErrorLogger(entry => {
|
|
28
|
+
this.sink.emit({
|
|
29
|
+
type: 'error', flowId: entry.flowId, flowName: '',
|
|
30
|
+
data: { from: entry.from, to: entry.to, trigger: entry.trigger, cause: entry.cause?.message },
|
|
31
|
+
timestamp: new Date(),
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ObservabilityEnginePlugin = ObservabilityEnginePlugin;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FlowEngine, FlowDefinition, FlowInstance } from '@unlaxer/tramli';
|
|
2
|
+
import type { RuntimeAdapterPlugin, PluginDescriptor } from '../api/types.js';
|
|
3
|
+
export type RichResumeStatus = 'TRANSITIONED' | 'ALREADY_COMPLETE' | 'NO_APPLICABLE_TRANSITION' | 'REJECTED' | 'EXCEPTION_ROUTED';
|
|
4
|
+
export interface RichResumeResult<S extends string> {
|
|
5
|
+
status: RichResumeStatus;
|
|
6
|
+
flow?: FlowInstance<S>;
|
|
7
|
+
error?: Error;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Enhanced resumeAndExecute with explicit status classification.
|
|
11
|
+
*/
|
|
12
|
+
export declare class RichResumeExecutor {
|
|
13
|
+
private readonly engine;
|
|
14
|
+
constructor(engine: FlowEngine);
|
|
15
|
+
resume<S extends string>(flowId: string, definition: FlowDefinition<S>, externalData: Map<string, unknown>, previousState: S): Promise<RichResumeResult<S>>;
|
|
16
|
+
}
|
|
17
|
+
export declare class RichResumeRuntimePlugin implements RuntimeAdapterPlugin<RichResumeExecutor> {
|
|
18
|
+
descriptor(): PluginDescriptor;
|
|
19
|
+
kind(): "RUNTIME_ADAPTER";
|
|
20
|
+
bind(engine: FlowEngine): RichResumeExecutor;
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RichResumeRuntimePlugin = exports.RichResumeExecutor = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Enhanced resumeAndExecute with explicit status classification.
|
|
6
|
+
*/
|
|
7
|
+
class RichResumeExecutor {
|
|
8
|
+
engine;
|
|
9
|
+
constructor(engine) {
|
|
10
|
+
this.engine = engine;
|
|
11
|
+
}
|
|
12
|
+
async resume(flowId, definition, externalData, previousState) {
|
|
13
|
+
try {
|
|
14
|
+
const flow = await this.engine.resumeAndExecute(flowId, definition, externalData);
|
|
15
|
+
if (flow.isCompleted && flow.currentState === previousState) {
|
|
16
|
+
return { status: 'ALREADY_COMPLETE', flow };
|
|
17
|
+
}
|
|
18
|
+
if (flow.currentState === previousState && !flow.isCompleted) {
|
|
19
|
+
return { status: 'REJECTED', flow };
|
|
20
|
+
}
|
|
21
|
+
return { status: 'TRANSITIONED', flow };
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
if (e.code === 'FLOW_ALREADY_COMPLETED') {
|
|
25
|
+
return { status: 'ALREADY_COMPLETE', error: e };
|
|
26
|
+
}
|
|
27
|
+
if (e.code === 'FLOW_NOT_FOUND') {
|
|
28
|
+
return { status: 'NO_APPLICABLE_TRANSITION', error: e };
|
|
29
|
+
}
|
|
30
|
+
if (e.code === 'INVALID_TRANSITION') {
|
|
31
|
+
return { status: 'NO_APPLICABLE_TRANSITION', error: e };
|
|
32
|
+
}
|
|
33
|
+
return { status: 'EXCEPTION_ROUTED', error: e };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.RichResumeExecutor = RichResumeExecutor;
|
|
38
|
+
class RichResumeRuntimePlugin {
|
|
39
|
+
descriptor() {
|
|
40
|
+
return { id: 'rich-resume', displayName: 'Rich Resume', description: 'Enhanced resume with status classification' };
|
|
41
|
+
}
|
|
42
|
+
kind() { return 'RUNTIME_ADAPTER'; }
|
|
43
|
+
bind(engine) {
|
|
44
|
+
return new RichResumeExecutor(engine);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.RichResumeRuntimePlugin = RichResumeRuntimePlugin;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FlowDefinition } from '@unlaxer/tramli';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that a subflow's entry requirements are satisfied
|
|
4
|
+
* by the parent flow's available data at a given state plus any guaranteed types.
|
|
5
|
+
*/
|
|
6
|
+
export declare class GuaranteedSubflowValidator {
|
|
7
|
+
validate<S extends string, T extends string>(parent: FlowDefinition<S>, parentState: S, subflow: FlowDefinition<T>, guaranteedTypes: Set<string>): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuaranteedSubflowValidator = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Validates that a subflow's entry requirements are satisfied
|
|
6
|
+
* by the parent flow's available data at a given state plus any guaranteed types.
|
|
7
|
+
*/
|
|
8
|
+
class GuaranteedSubflowValidator {
|
|
9
|
+
validate(parent, parentState, subflow, guaranteedTypes) {
|
|
10
|
+
if (!parent.dataFlowGraph || !subflow.dataFlowGraph) {
|
|
11
|
+
throw new Error('DataFlowGraph is required for subflow validation');
|
|
12
|
+
}
|
|
13
|
+
const available = new Set(parent.dataFlowGraph.availableAt(parentState));
|
|
14
|
+
for (const t of guaranteedTypes)
|
|
15
|
+
available.add(t);
|
|
16
|
+
const initialState = subflow.initialState;
|
|
17
|
+
if (initialState == null) {
|
|
18
|
+
throw new Error(`Subflow ${subflow.name} has no initial state`);
|
|
19
|
+
}
|
|
20
|
+
const requiredAtEntry = subflow.dataFlowGraph.availableAt(initialState);
|
|
21
|
+
const missing = [];
|
|
22
|
+
for (const req of requiredAtEntry) {
|
|
23
|
+
if (!available.has(req))
|
|
24
|
+
missing.push(req);
|
|
25
|
+
}
|
|
26
|
+
if (missing.length > 0) {
|
|
27
|
+
throw new Error(`Subflow ${subflow.name} is missing guaranteed types at entry: [${missing.join(', ')}]`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.GuaranteedSubflowValidator = GuaranteedSubflowValidator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FlowDefinition } from '@unlaxer/tramli';
|
|
2
|
+
import type { GenerationPlugin, PluginDescriptor } from '../api/types.js';
|
|
3
|
+
import type { FlowTestPlan } from './types.js';
|
|
4
|
+
export declare class ScenarioGenerationPlugin<S extends string> implements GenerationPlugin<FlowDefinition<S>, FlowTestPlan> {
|
|
5
|
+
private readonly delegate;
|
|
6
|
+
descriptor(): PluginDescriptor;
|
|
7
|
+
kind(): "GENERATION";
|
|
8
|
+
generate(input: FlowDefinition<S>): FlowTestPlan;
|
|
9
|
+
}
|