@endge/core 2.0.3 → 3.0.1

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.
Files changed (75) hide show
  1. package/ReadMe.md +23 -0
  2. package/dist/core.cjs +381 -333
  3. package/dist/core.js +35196 -34321
  4. package/dist/domain/entities/reflect/RAction.d.ts +11 -29
  5. package/dist/domain/entities/reflect/RConverter.d.ts +3 -3
  6. package/dist/domain/entities/reflect/RVocabs.d.ts +10 -2
  7. package/dist/domain/entities/runtime/hosts/ActionRuntimeHost.d.ts +1 -1
  8. package/dist/domain/entities/runtime/hosts/CompositionRuntimeHost.d.ts +2 -0
  9. package/dist/domain/types/component/sfc/ir.types.d.ts +12 -2
  10. package/dist/domain/types/component/sfc/ports.types.d.ts +4 -0
  11. package/dist/domain/types/component/sfc/table-events.types.d.ts +13 -0
  12. package/dist/domain/types/component/sfc/tag-attribute-contract.types.d.ts +7 -0
  13. package/dist/domain/types/component/sfc/visual-projection.types.d.ts +13 -3
  14. package/dist/domain/types/program/action-program.types.d.ts +8 -0
  15. package/dist/domain/types/program/program.types.d.ts +12 -22
  16. package/dist/domain/types/runtime/action.types.d.ts +33 -4
  17. package/dist/domain/types/runtime/context-persistence.types.d.ts +4 -0
  18. package/dist/domain/types/runtime/runtime-host.types.d.ts +2 -11
  19. package/dist/domain/types/source/action-source.types.d.ts +40 -0
  20. package/dist/domain/types/source/composition-source.types.d.ts +24 -3
  21. package/dist/domain/types/source/query-source.types.d.ts +4 -0
  22. package/dist/domain/types/source/response-output.types.d.ts +10 -0
  23. package/dist/domain/types/source/source-engine.types.d.ts +23 -2
  24. package/dist/domain/types/source/source-expression.types.d.ts +9 -0
  25. package/dist/domain/types/source/vocab-source.types.d.ts +37 -0
  26. package/dist/domain/types/ui/context-menu.types.d.ts +1 -0
  27. package/dist/main.d.ts +10 -7
  28. package/dist/model/kernel/endge.d.ts +4 -15
  29. package/dist/model/modules/context/endge-context.d.ts +3 -1
  30. package/dist/model/modules/domain/endge-vocabs.d.ts +20 -1
  31. package/dist/model/modules/program/endge-compiler.d.ts +7 -1
  32. package/dist/model/modules/program/endge-program.d.ts +6 -6
  33. package/dist/model/modules/program/endge-source.d.ts +2 -1
  34. package/dist/model/modules/runtime/core/endge-actions.d.ts +16 -12
  35. package/dist/model/modules/runtime/core/endge-runtime.d.ts +5 -5
  36. package/dist/model/modules/runtime/execution/action/action-program-executor.d.ts +13 -0
  37. package/dist/model/modules/runtime/execution/computation/EndgeComputation.d.ts +36 -1
  38. package/dist/model/modules/runtime/execution/endge-converters.d.ts +36 -0
  39. package/dist/model/modules/runtime/execution/endge-data-view.d.ts +2 -0
  40. package/dist/model/modules/runtime/execution/endge-response-output.d.ts +5 -0
  41. package/dist/model/modules/runtime/implementation/endge-implementations.d.ts +3 -0
  42. package/dist/model/modules/runtime/operation/endge-operations.d.ts +18 -0
  43. package/dist/model/modules/runtime/operation/operation-history.d.ts +54 -0
  44. package/dist/model/services/compiler/action/action-compile.d.ts +3 -2
  45. package/dist/model/services/compiler/component-sfc/component-sfc-ports.d.ts +2 -0
  46. package/dist/model/services/compiler/component-sfc/component-sfc-table-menu.d.ts +6 -2
  47. package/dist/model/services/compiler/computation/computation-compile.d.ts +3 -0
  48. package/dist/model/services/source-engine/compilers/action-source-compile.d.ts +17 -0
  49. package/dist/model/services/source-engine/compilers/vocab-source-compile.d.ts +2 -0
  50. package/dist/model/services/source-engine/strategies/ActionSourceEngineStrategy.d.ts +7 -0
  51. package/dist/model/services/source-engine/strategies/ActionSourceLanguageStrategy.d.ts +23 -0
  52. package/dist/model/services/source-engine/strategies/VocabSourceEngineStrategy.d.ts +8 -0
  53. package/dist/model/services/source-engine/strategies/VocabSourceLanguageStrategy.d.ts +11 -0
  54. package/dist/model/services/source-engine/strategies/VocabSourcePatchStrategy.d.ts +9 -0
  55. package/dist/model/services/source-engine/templates/action.default.source.d.ts +1 -0
  56. package/dist/model/services/source-engine/templates/vocab.default.source.d.ts +1 -0
  57. package/dist/model/services/source-engine/vocab-source-patch.d.ts +10 -0
  58. package/dist/test/fixtures/action-source.d.ts +1 -0
  59. package/dist/test/model/modules/context/endge-context-theme-default.test.d.ts +1 -0
  60. package/dist/test/model/modules/domain/endge-vocabs-source.test.d.ts +1 -0
  61. package/dist/test/model/modules/runtime/action-runtime.test.d.ts +1 -0
  62. package/dist/test/model/modules/runtime/executable-implementations.test.d.ts +1 -0
  63. package/dist/test/model/modules/runtime/operation-history.test.d.ts +1 -0
  64. package/dist/test/model/services/compiler/component-sfc/component-sfc-action-reactions.test.d.ts +1 -0
  65. package/dist/test/model/services/source-engine/action-source-compile.test.d.ts +1 -0
  66. package/package.json +4 -4
  67. package/dist/domain/entities/action-flow/REndgeFlow.d.ts +0 -27
  68. package/dist/domain/types/flow/action.types.d.ts +0 -65
  69. package/dist/domain/types/flow/endge-flow-runtime.types.d.ts +0 -28
  70. package/dist/domain/types/flow/endge-flow.types.d.ts +0 -110
  71. package/dist/domain/types/flow/flow-condition.types.d.ts +0 -39
  72. package/dist/model/modules/runtime/core/endge-bind.d.ts +0 -39
  73. package/dist/model/modules/runtime/flow/endge-flow-registry.d.ts +0 -34
  74. package/dist/model/modules/runtime/flow/endge-flow.d.ts +0 -94
  75. /package/dist/test/{action-implementations.test.d.ts → domain/entities/runtime/composition-operation-history.integration.test.d.ts} +0 -0
@@ -5,10 +5,13 @@ export declare class EndgeImplementations {
5
5
  private readonly _bindings;
6
6
  /** Registers local executable code and returns its disposer. */
7
7
  registerProvider(provider: ImplementationProvider): () => void;
8
+ hasProvider(key: string): boolean;
8
9
  /** Registers an explicit binding and returns its disposer. */
9
10
  bind(binding: ImplementationBinding): () => void;
10
11
  /** Resolves the effective provider by scope and priority. */
11
12
  resolve(request: ImplementationResolutionRequest): ResolvedImplementation;
13
+ /** Returns null only when neither a binding nor a default provider is declared. */
14
+ resolveOptional(request: ImplementationResolutionRequest): ResolvedImplementation | null;
12
15
  /** Resolves and executes one invocation through its effective provider. */
13
16
  execute<TResult = unknown>(request: ImplementationResolutionRequest, invocation: ImplementationInvocation): Promise<TResult>;
14
17
  /** Returns a serializable inspection snapshot without functions. */
@@ -0,0 +1,18 @@
1
+ import { RuntimeHost } from '../../../../domain/types/runtime/runtime-host.types';
2
+ import { RuntimeScope } from '../../../../domain/entities/runtime/RuntimeScope';
3
+ import { OperationHistory } from './operation-history';
4
+ /** Resolves the nearest active Operation History along runtime-scope ancestry. */
5
+ export declare class EndgeOperations {
6
+ private readonly histories;
7
+ private latestScopeId;
8
+ private keydownDisposer;
9
+ register(scope: RuntimeScope, history: OperationHistory): () => void;
10
+ resolveForHost(host: RuntimeHost<any, any> | null | undefined): OperationHistory | null;
11
+ getActiveHistory(): OperationHistory | null;
12
+ undo(): Promise<unknown>;
13
+ redo(): Promise<unknown>;
14
+ canUndo(): boolean;
15
+ canRedo(): boolean;
16
+ private ensureShortcuts;
17
+ private disposeShortcuts;
18
+ }
@@ -0,0 +1,54 @@
1
+ import { RuntimeOwnedResource } from '../../../../domain/types/runtime/runtime-resource.types';
2
+ import { ComponentSFCInteractionTrigger } from '../../../../domain/types/component/sfc/ir.types';
3
+ export interface OperationHistoryShortcutBinding {
4
+ command: 'undo' | 'redo';
5
+ triggers: ComponentSFCInteractionTrigger[];
6
+ }
7
+ export interface OperationHistoryEntry {
8
+ id: string;
9
+ input: unknown;
10
+ runOutput: unknown;
11
+ undo: () => Promise<unknown>;
12
+ redo: () => Promise<unknown>;
13
+ undoOutput?: unknown;
14
+ }
15
+ export interface OperationHistoryOptions {
16
+ id: string;
17
+ limit?: number;
18
+ shortcuts?: OperationHistoryShortcutBinding[] | null;
19
+ onChange?: () => void;
20
+ }
21
+ /** Runtime-memory undo/redo cursor. Transitions are serialized and failures keep the cursor stable. */
22
+ export declare class OperationHistory implements RuntimeOwnedResource {
23
+ private readonly options;
24
+ readonly kind = "operation-history";
25
+ readonly id: string;
26
+ private entries;
27
+ private cursor;
28
+ private paused;
29
+ private disposed;
30
+ private queue;
31
+ private _limit;
32
+ constructor(options: OperationHistoryOptions);
33
+ get limit(): number;
34
+ get shortcuts(): OperationHistoryShortcutBinding[];
35
+ get active(): boolean;
36
+ canUndo(): boolean;
37
+ canRedo(): boolean;
38
+ setLimit(value: number): void;
39
+ commit(entry: OperationHistoryEntry): void;
40
+ undo(): Promise<unknown>;
41
+ redo(): Promise<unknown>;
42
+ pause(): void;
43
+ resume(): void;
44
+ dispose(): void;
45
+ snapshot(): {
46
+ limit: number;
47
+ cursor: number;
48
+ size: number;
49
+ paused: boolean;
50
+ };
51
+ private enqueue;
52
+ private trim;
53
+ }
54
+ export declare function defaultOperationHistoryShortcuts(): OperationHistoryShortcutBinding[];
@@ -1,8 +1,9 @@
1
1
  import { RAction } from '../../../../domain/entities/reflect/RAction';
2
- import { ActionProgramPayload, ProgramDiagnostic } from '../../../../domain/types/program/program.types';
2
+ import { ActionProgramPayload, ProgramDependency, ProgramDiagnostic } from '../../../../domain/types/program/program.types';
3
3
  export interface ActionCompileResult {
4
4
  payload: ActionProgramPayload;
5
5
  diagnostics: Omit<ProgramDiagnostic, 'entityRef'>[];
6
+ dependencies: ProgramDependency[];
6
7
  }
7
- /** Compiles persisted Flow source and the semantic Action contract into Program. */
8
+ /** Compiles persisted Action Source into Program. */
8
9
  export declare function compileAction(entity: RAction): ActionCompileResult;
@@ -6,6 +6,8 @@ export interface ComponentSFCPortAnalysisOptions {
6
6
  resolveProvider?: (identity: string, expectedKind: 'computation' | 'component' | 'action' | 'query') => ComponentSFCPortProviderDescriptor | null;
7
7
  resolveTypeDefinition?: (identity: string) => TypeSourceDefinition | null;
8
8
  }
9
+ /** Compiles one direct reaction or a non-empty ordered reaction array. */
10
+ export declare function compileComponentSFCLocalEventActions(eventName: string, source: string, sourceOffset: number, dependencies: RComponentDependencies, diagnostics: RComponentDiagnostic[], ownerPorts?: ComponentSFCPortManifest | null): ComponentSFCEventAction[];
9
11
  /** Compiles the safe reaction grammar used by local `@event` template bindings. */
10
12
  export declare function compileComponentSFCLocalEventAction(eventName: string, source: string, sourceOffset: number, dependencies: RComponentDependencies, diagnostics: RComponentDiagnostic[], ownerPorts?: ComponentSFCPortManifest | null): ComponentSFCEventAction | null;
11
13
  export interface ComponentSFCPortAnalysisResult {
@@ -1,7 +1,7 @@
1
- import { ComponentSFCTableColumnMenuDescriptor, ComponentSFCTableRowMenuDescriptor, RComponentSFC_IR_ElementNode } from '../../../../domain/types/component/sfc/ir.types';
1
+ import { ComponentSFCTableColumnMenuDescriptor, ComponentSFCTableCellMenuDescriptor, ComponentSFCTableRowMenuDescriptor, RComponentSFC_IR_ElementNode } from '../../../../domain/types/component/sfc/ir.types';
2
2
  import { ComponentSFCActionPort } from '../../../../domain/types/component/sfc/ports.types';
3
3
  export declare const SFC_TABLE_COLUMN_MENU_MODES: readonly ["default", "disabled"];
4
- export type { ComponentSFCTableColumnMenuDescriptor, ComponentSFCTableColumnMenuMode, ComponentSFCTableMenuDescriptor, ComponentSFCTableMenuItemDescriptor, ComponentSFCTableMenuNodeDescriptor, ComponentSFCTableMenuSeparatorDescriptor, ComponentSFCTableRowMenuDescriptor, ComponentSFCTableRowMenuMode, } from '../../../../domain/types/component/sfc/ir.types';
4
+ export type { ComponentSFCTableCellMenuDescriptor, ComponentSFCTableCellMenuMode, ComponentSFCTableColumnMenuDescriptor, ComponentSFCTableColumnMenuMode, ComponentSFCTableMenuDescriptor, ComponentSFCTableMenuItemDescriptor, ComponentSFCTableMenuNodeDescriptor, ComponentSFCTableMenuSeparatorDescriptor, ComponentSFCTableRowMenuDescriptor, ComponentSFCTableRowMenuMode, } from '../../../../domain/types/component/sfc/ir.types';
5
5
  interface NormalizeMenuOptions {
6
6
  availableActions?: ComponentSFCActionPort[];
7
7
  }
@@ -9,6 +9,10 @@ interface NormalizeMenuOptions {
9
9
  export declare function normalizeComponentSFCTableColumnMenu(tableNode: RComponentSFC_IR_ElementNode, actionsOrOptions?: ComponentSFCActionPort[] | NormalizeMenuOptions): ComponentSFCTableColumnMenuDescriptor;
10
10
  /** Normalizes one optional row menu. Cell-aware values remain expressions until a right click occurs. */
11
11
  export declare function normalizeComponentSFCTableRowMenu(tableNode: RComponentSFC_IR_ElementNode, actionsOrOptions?: ComponentSFCActionPort[] | NormalizeMenuOptions): ComponentSFCTableRowMenuDescriptor;
12
+ /** Normalizes the canonical Table > CellMenu, falling back to legacy Table > RowMenu. */
13
+ export declare function normalizeComponentSFCTableCellMenu(tableNode: RComponentSFC_IR_ElementNode, actionsOrOptions?: ComponentSFCActionPort[] | NormalizeMenuOptions): ComponentSFCTableCellMenuDescriptor;
14
+ /** Normalizes an optional Column > CellMenu override; `cell-menu="none"` disables the default. */
15
+ export declare function normalizeComponentSFCColumnCellMenu(tableNode: RComponentSFC_IR_ElementNode, columnNode: RComponentSFC_IR_ElementNode, actionsOrOptions?: ComponentSFCActionPort[] | NormalizeMenuOptions): ComponentSFCTableCellMenuDescriptor | undefined;
12
16
  /** Reads a compile-time MenuItem reference to one Action port. */
13
17
  export declare function readComponentSFCTableMenuActionPortReference(source: string): {
14
18
  name: string;
@@ -1,5 +1,6 @@
1
1
  import { ComputationProgramPayload } from '../../../../domain/types/computation/computation-program.types';
2
2
  import { ProgramDiagnostic } from '../../../../domain/types/program/program.types';
3
+ import * as t from '@babel/types';
3
4
  type DiagnosticDraft = Omit<ProgramDiagnostic, 'entityRef'>;
4
5
  export interface ComputationCompileInput {
5
6
  source: string;
@@ -10,4 +11,6 @@ export interface ComputationCompileResult {
10
11
  }
11
12
  /** Compiles defineComputation source into a deterministic output graph. */
12
13
  export declare function compileComputation(input: ComputationCompileInput): ComputationCompileResult;
14
+ export declare function validateSandboxBody(node: t.Node, diagnostics: DiagnosticDraft[], sourcePath: string): void;
15
+ export declare function functionSource(node: t.ObjectMethod | t.FunctionExpression | t.ArrowFunctionExpression, source: string): string;
13
16
  export {};
@@ -0,0 +1,17 @@
1
+ import { ActionProgramPayload } from '../../../../domain/types/program/action-program.types';
2
+ import { ProgramDependency, ProgramDiagnostic } from '../../../../domain/types/program/program.types';
3
+ import { ActionTargetSelector } from '../../../../domain/types/runtime/action.types';
4
+ type DiagnosticDraft = Omit<ProgramDiagnostic, 'entityRef'>;
5
+ export interface ActionSourceCompileInput {
6
+ source: string;
7
+ sourceVersion?: number;
8
+ target?: ActionTargetSelector[] | null;
9
+ }
10
+ export interface ActionSourceCompileResult {
11
+ payload: ActionProgramPayload;
12
+ diagnostics: DiagnosticDraft[];
13
+ dependencies: ProgramDependency[];
14
+ }
15
+ /** Compiles one canonical defineAction source into deterministic sequential IR. */
16
+ export declare function compileActionSource(input: ActionSourceCompileInput): ActionSourceCompileResult;
17
+ export {};
@@ -0,0 +1,2 @@
1
+ import { VocabSourceCompileResult } from '../../../../domain/types/source/vocab-source.types';
2
+ export declare function compileVocabSource(source: string): VocabSourceCompileResult;
@@ -0,0 +1,7 @@
1
+ import { SourceEngineCompileResult, SourceEngineStrategy, SourceKind } from '../../../../domain/types/source/source-engine.types';
2
+ export declare class ActionSourceEngineStrategy implements SourceEngineStrategy {
3
+ readonly id = "source:action";
4
+ readonly sourceKind: SourceKind;
5
+ supports(sourceKind: SourceKind | string): boolean;
6
+ compile(source: string): SourceEngineCompileResult;
7
+ }
@@ -0,0 +1,23 @@
1
+ import { SourceKind, SourceLanguageCompletion, SourceLanguageContext, SourceLanguageStrategy, SourceLanguageValidationResult } from '../../../../domain/types/source/source-engine.types';
2
+ export declare class ActionSourceLanguageStrategy implements SourceLanguageStrategy {
3
+ readonly id = "source-language:action";
4
+ readonly sourceKind: SourceKind;
5
+ readonly syntax: import('../../../../domain/types/source/source-engine.types').SourceLanguageSyntaxDefinition;
6
+ supports(sourceKind: SourceKind | string): boolean;
7
+ createDefaultSource(): string;
8
+ validate(source: string): SourceLanguageValidationResult;
9
+ completions(_context: SourceLanguageContext): SourceLanguageCompletion[];
10
+ resolveReference(context: SourceLanguageContext): import('../../../../domain/types/source/source-engine.types').SourceDocumentReference | null;
11
+ signatureHelp(context: SourceLanguageContext): {
12
+ activeSignature: number;
13
+ activeParameter: number;
14
+ signatures: {
15
+ label: string;
16
+ documentation: string;
17
+ parameters: {
18
+ label: string;
19
+ }[];
20
+ }[];
21
+ } | null;
22
+ semanticHighlights(context: SourceLanguageContext): import('../../../../domain/types/source/source-engine.types').SourceLanguageSemanticHighlight[];
23
+ }
@@ -0,0 +1,8 @@
1
+ import { SourceEngineCompileResult, SourceEngineOperation, SourceEngineResult, SourceEngineStrategy, SourceKind } from '../../../../domain/types/source/source-engine.types';
2
+ export declare class VocabSourceEngineStrategy implements SourceEngineStrategy {
3
+ readonly id = "source:vocab";
4
+ readonly sourceKind: SourceKind;
5
+ supports(sourceKind: SourceKind | string): boolean;
6
+ execute(_operation: SourceEngineOperation): SourceEngineResult;
7
+ compile(source: string): SourceEngineCompileResult;
8
+ }
@@ -0,0 +1,11 @@
1
+ import { SourceKind, SourceLanguageCompletion, SourceLanguageContext, SourceLanguageStrategy, SourceLanguageValidationResult } from '../../../../domain/types/source/source-engine.types';
2
+ export declare class VocabSourceLanguageStrategy implements SourceLanguageStrategy {
3
+ readonly id = "source-language:vocab";
4
+ readonly sourceKind: SourceKind;
5
+ readonly syntax: import('../../../../domain/types/source/source-engine.types').SourceLanguageSyntaxDefinition;
6
+ supports(sourceKind: SourceKind | string): boolean;
7
+ createDefaultSource(): string;
8
+ validate(source: string): SourceLanguageValidationResult;
9
+ completions(_context: SourceLanguageContext): SourceLanguageCompletion[];
10
+ resolveReference(context: SourceLanguageContext): import('../../../../domain/types/source/source-engine.types').SourceDocumentReference | null;
11
+ }
@@ -0,0 +1,9 @@
1
+ import { VocabSourceDocument, VocabSourcePatch } from '../../../../domain/types/source/vocab-source.types';
2
+ import { SourceKind, SourceParseResult, SourcePatchResult, SourcePatchStrategy } from '../../../../domain/types/source/source-engine.types';
3
+ export declare class VocabSourcePatchStrategy implements SourcePatchStrategy<VocabSourcePatch, VocabSourceDocument> {
4
+ readonly id = "source-patch:vocab";
5
+ readonly sourceKind: SourceKind;
6
+ supports(sourceKind: SourceKind | string): boolean;
7
+ parse(source: string): SourceParseResult<VocabSourceDocument>;
8
+ patch(source: string, patch: VocabSourcePatch): SourcePatchResult<VocabSourceDocument>;
9
+ }
@@ -0,0 +1 @@
1
+ export declare const ACTION_DEFAULT_SOURCE = "defineAction({\n contract: {\n input: field('Object'),\n output: field('Object'),\n },\n\n steps: {\n result: input(),\n },\n\n output: output('result'),\n})\n";
@@ -0,0 +1 @@
1
+ export declare const VOCAB_DEFAULT_SOURCE = "defineVocab({\n outputs: {\n items: output()\n .from(response()),\n },\n})\n";
@@ -0,0 +1,10 @@
1
+ import { VocabSourceDocument, VocabSourcePatch } from '../../../domain/types/source/vocab-source.types';
2
+ import { SourcePatchResult } from '../../../domain/types/source/source-engine.types';
3
+ export declare function parseVocabSource(source: string): {
4
+ ok: boolean;
5
+ ast: {} | undefined;
6
+ document: VocabSourceDocument | undefined;
7
+ diagnostics: Omit<import('../../../main').ProgramDiagnostic, "entityRef">[];
8
+ message: string | undefined;
9
+ };
10
+ export declare function patchVocabSource(source: string, patch: VocabSourcePatch): SourcePatchResult<VocabSourceDocument>;
@@ -0,0 +1 @@
1
+ export declare const ACTION_SOURCE_WITH_OPERATION = "defineAction({\n contract: {\n input: field('Object'),\n output: field('Object'),\n },\n steps: {\n normalized: input('value').convert('string-trim').upperCase(),\n validation: computation('schedule.validate-carrier', {\n value: output('normalized'),\n }),\n edit: operation({\n input: {\n id: input('id'),\n value: output('normalized'),\n previousValue: input('previousValue'),\n },\n run: {\n steps: {\n remote: query({ identity: 'schedule-update', input: input() }),\n },\n output: output('remote'),\n },\n undo: {\n steps: {\n remote: query({ identity: 'schedule-update', input: input() }),\n },\n output: output('remote'),\n },\n }),\n },\n output: {\n value: output('normalized'),\n validation: output('validation'),\n request: output('edit'),\n },\n})";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endge/core",
3
- "version": "2.0.3",
3
+ "version": "3.0.1",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@babel/parser": "^7.27.2",
31
31
  "@babel/types": "^7.27.1",
32
- "@endge/utils": "^0.24.12",
32
+ "@endge/utils": "^0.24.13",
33
33
  "@vue/compiler-dom": "^3.5.24",
34
34
  "@vue/compiler-sfc": "^3.5.24",
35
35
  "axios": "^1.13.2",
@@ -46,8 +46,8 @@
46
46
  "yaml": "^2.8.1"
47
47
  },
48
48
  "peerDependencies": {
49
- "@endge/raph": "^3.0.10",
50
- "@endge/utils": "^0.24.12",
49
+ "@endge/raph": "^3.0.11",
50
+ "@endge/utils": "^0.24.13",
51
51
  "@primevue/themes": "^4.0.0-rc.1",
52
52
  "class-transformer": "^0.5.1",
53
53
  "class-validator": "^0.14.1",
@@ -1,27 +0,0 @@
1
- import { EndgeFlowDefinition, EndgeFlowNodeDefinition } from '../../types/flow/endge-flow.types';
2
- declare class REndgeFlowNode {
3
- id: string;
4
- title: string;
5
- blockId: string;
6
- kind: EndgeFlowNodeDefinition['kind'];
7
- params: Record<string, unknown>;
8
- meta: Record<string, unknown>;
9
- }
10
- declare class REndgeFlowEdge {
11
- id: string;
12
- sourceNodeId: string;
13
- sourcePortId: string;
14
- targetNodeId: string;
15
- targetPortId: string;
16
- label: string | null;
17
- }
18
- export declare class REndgeFlow {
19
- version: number;
20
- entrypoint: string;
21
- nodes: REndgeFlowNode[];
22
- edges: REndgeFlowEdge[];
23
- static createDefault(): REndgeFlow;
24
- static fromPlain(json: Partial<EndgeFlowDefinition>): REndgeFlow;
25
- toPlain(): EndgeFlowDefinition;
26
- }
27
- export {};
@@ -1,65 +0,0 @@
1
- import { ActionRuntimeHostContext } from '../runtime/runtime-host.types';
2
- import { FlowExecutionState } from './endge-flow-runtime.types';
3
- import { ActionFlowDefinition } from './endge-flow.types';
4
- /**
5
- * Каноническое определение action как flow-графа.
6
- */
7
- export type ActionDefinition = ActionFlowDefinition;
8
- /**
9
- * Контекст, который получают custom handlers и runtime-step handlers action-flow.
10
- */
11
- export interface FlowHandlerContext {
12
- /** Каноническое runtime-state текущего запуска flow. */
13
- state: FlowExecutionState;
14
- /** Идентификатор node внутри flow, если handler вызван из конкретного шага. */
15
- nodeId?: string | null;
16
- /** Идентификатор block-spec исполненного шага. */
17
- blockId?: string | null;
18
- /** Identity или id action, с которым связан текущий handler-вызов. */
19
- actionId?: string | null;
20
- /** runtime-id host или runtime-step, если он известен во время вызова. */
21
- runtimeId?: string | null;
22
- }
23
- /**
24
- * Результат работы custom/step handler.
25
- */
26
- export type FlowHandlerResult = void | Promise<void>;
27
- /**
28
- * Сигнатура обработчика шага runtime-action: получает полный контекст host'а (input, parent, flowState и т.д.),
29
- * сам извлекает вход из context.input; опционально — flowContext (nodeId, state шага).
30
- */
31
- export type ActionStepHandler = (context: ActionRuntimeHostContext, flowContext?: FlowHandlerContext) => FlowHandlerResult;
32
- /**
33
- * Проблема, найденная при валидации или исполнении action-flow.
34
- */
35
- export interface FlowValidationIssue {
36
- /** Машинно-стабильный код проблемы. */
37
- code: string;
38
- /** Человекочитаемое описание проблемы. */
39
- message: string;
40
- /** Идентификатор node, если проблема относится к конкретному шагу. */
41
- nodeId?: string;
42
- /** Идентификатор edge, если проблема относится к конкретной связи. */
43
- edgeId?: string;
44
- }
45
- /**
46
- * Скомпилированное action-flow definition с индексами для быстрого исполнения.
47
- */
48
- export interface ActionCompiledFlow {
49
- /** Нормализованное flow-описание action. */
50
- flow: ActionFlowDefinition;
51
- /** Индекс node по id. */
52
- nodesById: Map<string, ActionFlowDefinition['nodes'][number]>;
53
- /** Индекс первого node-id по blockId. */
54
- nodeIdByBlockId: Map<string, string>;
55
- /** Индекс исходящих ребер по source node id. */
56
- outgoingByNodeId: Map<string, ActionFlowDefinition['edges']>;
57
- /** Индекс входящих ребер по target node id (для передачи данных с портов). */
58
- incomingByNodeId: Map<string, ActionFlowDefinition['edges']>;
59
- /** Индекс runtime-step по runtime-id. */
60
- runtimeNodeIdByRuntimeId: Map<string, string>;
61
- /** Список достижимых node от entrypoint. */
62
- reachableNodeIds: string[];
63
- /** Validation issues, найденные во время компиляции. */
64
- issues: FlowValidationIssue[];
65
- }
@@ -1,28 +0,0 @@
1
- import { FlowValidationIssue } from './action.types';
2
- /**
3
- * Состояние выполнения action-flow.
4
- * Это единственный runtime-state flow, который разделяют executor, handlers и runtime-host.
5
- */
6
- export interface FlowExecutionState {
7
- /** Нормализованный input, с которым был запущен flow. */
8
- input: Record<string, unknown>;
9
- /** Снимки исполнения шагов, индексированные по node-id. */
10
- steps: Record<string, Record<string, unknown>>;
11
- /** Локальное изменяемое хранилище flow. */
12
- locals: Record<string, unknown>;
13
- /** Глобальные runtime-метаданные текущего запуска flow. */
14
- globals: Record<string, unknown>;
15
- /** Снимок последнего исполненного шага. */
16
- lastStep: Record<string, unknown> | null;
17
- }
18
- /**
19
- * Результат исполнения action-flow.
20
- */
21
- export interface FlowExecutionResult {
22
- /** Удалось ли выполнить flow без validation/runtime issues. */
23
- ok: boolean;
24
- /** Итоговое состояние выполнения flow. */
25
- state: FlowExecutionState;
26
- /** Список validation/runtime проблем, обнаруженных при исполнении flow. */
27
- issues: FlowValidationIssue[];
28
- }
@@ -1,110 +0,0 @@
1
- /**
2
- * Канонический тип шага внутри action-flow.
3
- * Описывает поведение шага на уровне UX/runtime, а не форму graph-node.
4
- */
5
- export type ActionFlowStepKind = 'builtin' | 'action' | 'runtime' | 'flow-ref';
6
- /**
7
- * Тип graph-node внутри action-flow.
8
- * Определяет, какой блок должен быть исполнен рантаймом flow.
9
- */
10
- export type EndgeFlowNodeKind = 'start' | 'watch' | 'eventSubscribe' | 'delay' | 'timer' | 'intervalTimer' | 'action' | 'query' | 'runtimeAction' | 'switch' | 'forEach' | 'while' | 'parallel';
11
- /**
12
- * Направление порта graph-node.
13
- */
14
- export type EndgeFlowPortDirection = 'input' | 'output';
15
- /**
16
- * Режим сериализации значения параметра node.
17
- */
18
- export type EndgeFlowBindingMode = 'literal' | 'context' | 'block-output';
19
- /**
20
- * Декларативная ссылка на значение, которое должно быть подставлено в параметр node.
21
- */
22
- export interface EndgeFlowBinding {
23
- /** Способ получения значения. */
24
- mode: EndgeFlowBindingMode;
25
- /** Буквальное значение для режима `literal`. */
26
- value?: unknown;
27
- /** Путь внутри execution-state для режима `context`. */
28
- path?: string | null;
29
- /** Источник значения в другом node для режима `block-output`. */
30
- nodeId?: string | null;
31
- /** Порт источника значения в другом node. */
32
- portId?: string | null;
33
- }
34
- /**
35
- * Сериализованные параметры graph-node.
36
- * В editor-слое сюда могут попадать как structured bindings, так и уже развернутые plain values.
37
- */
38
- export type EndgeFlowNodeParams = Record<string, EndgeFlowBinding | unknown>;
39
- /**
40
- * Описание входного или выходного порта flow-блока.
41
- */
42
- export interface EndgeFlowPortDefinition {
43
- /** Уникальный идентификатор порта внутри блока. */
44
- id: string;
45
- /** Название порта для UI и debug. */
46
- label: string;
47
- /** Направление порта. */
48
- direction: EndgeFlowPortDirection;
49
- /** Может ли порт иметь несколько подключений одновременно. */
50
- multiple?: boolean;
51
- /** Обязателен ли порт для корректного исполнения блока. */
52
- required?: boolean;
53
- /** Человекочитаемый тип значения, проходящего через порт. */
54
- valueType?: string | null;
55
- }
56
- /**
57
- * Описание graph-node внутри action-flow definition.
58
- */
59
- export interface EndgeFlowNodeDefinition {
60
- /** Уникальный идентификатор node внутри flow. */
61
- id: string;
62
- /** Название шага для UI и debug. */
63
- title: string;
64
- /** Идентификатор block-spec, который должен быть исполнен. */
65
- blockId: string;
66
- /** Технический вид node в графе. */
67
- kind: EndgeFlowNodeKind;
68
- /** Параметры node в сериализованном виде. */
69
- params?: EndgeFlowNodeParams;
70
- /** Свободные метаданные node для editor/runtime. */
71
- meta?: Record<string, unknown>;
72
- }
73
- /**
74
- * Описание связи между двумя node в action-flow.
75
- */
76
- export interface EndgeFlowEdgeDefinition {
77
- /** Уникальный идентификатор ребра. */
78
- id: string;
79
- /** Node-источник. Для входа в граф допускается ссылка на entrypoint. */
80
- sourceNodeId: string;
81
- /** Порт источника. */
82
- sourcePortId: string;
83
- /** Node-получатель. */
84
- targetNodeId: string;
85
- /** Порт получателя. */
86
- targetPortId: string;
87
- /** Пользовательская подпись ребра. */
88
- label?: string | null;
89
- }
90
- /**
91
- * Каноническое декларативное описание action как flow-графа.
92
- */
93
- export interface EndgeFlowDefinition {
94
- /** Версия формата сериализации flow. */
95
- version: number;
96
- /** Идентификатор стартовой точки графа. Каноническое значение: `flow-entry`. */
97
- entrypoint: string;
98
- /** Список node action-flow. */
99
- nodes: EndgeFlowNodeDefinition[];
100
- /** Список ориентированных связей между node. */
101
- edges: EndgeFlowEdgeDefinition[];
102
- }
103
- /**
104
- * Контракт action-definition в формате flow.
105
- * Отдельные alias добавлены для ясности в action-контексте.
106
- */
107
- export type ActionFlowNodeKind = EndgeFlowNodeKind;
108
- export type ActionFlowNodeDefinition = EndgeFlowNodeDefinition;
109
- export type ActionFlowEdgeDefinition = EndgeFlowEdgeDefinition;
110
- export type ActionFlowDefinition = EndgeFlowDefinition;
@@ -1,39 +0,0 @@
1
- import { FlowHandlerContext } from './action.types';
2
- export type { FlowHandlerContext };
3
- /**
4
- * Параметр входа условия из реестра (для UI и валидации).
5
- */
6
- export interface FlowConditionInputParam {
7
- name: string;
8
- label: string;
9
- valueType: string;
10
- optional?: boolean;
11
- /** Секции домена, с которых разрешён выбор сущности (например vocabs). */
12
- acceptSectionTypes?: string[];
13
- }
14
- /**
15
- * Спека условия для реестра (метаданные + evaluator).
16
- */
17
- export interface FlowConditionSpec {
18
- id: string;
19
- title: string;
20
- description: string | null;
21
- inputParams: FlowConditionInputParam[];
22
- evaluate(ctx: FlowHandlerContext, params: Record<string, unknown>): boolean | Promise<boolean>;
23
- }
24
- /**
25
- * Конфиг одной ветки switch в режиме реестра.
26
- */
27
- export interface FlowSwitchBranchConfig {
28
- conditionId: string;
29
- params: Record<string, unknown>;
30
- portId: string;
31
- }
32
- /**
33
- * Параметры узла switch в flow.
34
- */
35
- export interface FlowSwitchParams {
36
- conditionMode?: 'script' | 'registry';
37
- scriptExpression?: string;
38
- branches?: FlowSwitchBranchConfig[];
39
- }
@@ -1,39 +0,0 @@
1
- import { ActionStepHandler } from '../../../../domain/types/flow/action.types';
2
- import { ComputationOverride } from '../../../../domain/types/computation/computation-runtime.types';
3
- import { EndgeModule } from '../../../../domain/entities/endge/EndgeModule';
4
- import { RAction } from '../../../../domain/entities/reflect/RAction';
5
- /**
6
- * Привязка кастомного кода к существующим сущностям ядра.
7
- * Не связана с declarative bindings и event contracts.
8
- */
9
- export declare class EndgeBind extends EndgeModule {
10
- private readonly computationOverrides;
11
- /**
12
- * Регистрирует built-in converters после загрузки домена.
13
- */
14
- start(): void;
15
- /**
16
- * Регистрирует Default Converters.
17
- */
18
- private registerDefaultConverters;
19
- /**
20
- * Находит конвертер по identity и ставит кастомный обработчик (setCustom).
21
- * @param identity - id конвертера в домене
22
- * @param handler - функция (value) => convertedValue
23
- * @returns true, если конвертер найден и обработчик установлен
24
- */
25
- converter(identity: string, handler: (v: any) => any): boolean;
26
- /**
27
- * Привязывает обработчик runtime-step в контексте конкретного action.
28
- * @deprecated Для полного Action используйте Endge.actions.override(); этот API оставлен только для legacy runtimeAction nodes.
29
- * @param actionOrId - действие или его id/identity
30
- * @param runtimeId - id runtime-step внутри переданного action
31
- * @param handler - обработчик шага
32
- * @returns true, если action и runtime-step найдены, и обработчик установлен
33
- */
34
- action(actionOrId: RAction | string | number, runtimeId: string, handler: ActionStepHandler): boolean;
35
- /** Registers a local full replacement for a persisted computation graph. */
36
- computation(identity: string, override: ComputationOverride): VoidFunction;
37
- /** Runtime-only lookup used by EndgeComputation. */
38
- getComputation(identity: string): ComputationOverride | null;
39
- }