@endge/core 2.0.4 → 3.0.2
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/core.cjs +346 -322
- package/dist/core.js +30478 -30384
- package/dist/domain/entities/reflect/RAction.d.ts +11 -29
- package/dist/domain/entities/runtime/hosts/ActionRuntimeHost.d.ts +1 -1
- package/dist/domain/entities/runtime/hosts/CompositionRuntimeHost.d.ts +2 -0
- package/dist/domain/types/component/sfc/table-events.types.d.ts +13 -0
- package/dist/domain/types/component/sfc/tag-attribute-contract.types.d.ts +7 -0
- package/dist/domain/types/component/sfc/visual-projection.types.d.ts +2 -1
- package/dist/domain/types/program/action-program.types.d.ts +8 -0
- package/dist/domain/types/program/program.types.d.ts +5 -21
- package/dist/domain/types/runtime/action.types.d.ts +6 -3
- package/dist/domain/types/runtime/context-persistence.types.d.ts +4 -0
- package/dist/domain/types/runtime/runtime-host.types.d.ts +2 -11
- package/dist/domain/types/source/action-source.types.d.ts +40 -0
- package/dist/domain/types/source/composition-source.types.d.ts +24 -3
- package/dist/domain/types/source/source-engine.types.d.ts +25 -2
- package/dist/domain/types/source/source-expression.types.d.ts +9 -0
- package/dist/main.d.ts +5 -7
- package/dist/model/kernel/endge.d.ts +4 -15
- package/dist/model/modules/context/endge-context.d.ts +3 -1
- package/dist/model/modules/program/endge-compiler.d.ts +2 -0
- package/dist/model/modules/program/endge-program.d.ts +3 -6
- package/dist/model/modules/program/endge-source.d.ts +2 -1
- package/dist/model/modules/runtime/core/endge-actions.d.ts +16 -12
- package/dist/model/modules/runtime/core/endge-runtime.d.ts +5 -5
- package/dist/model/modules/runtime/execution/action/action-program-executor.d.ts +13 -0
- package/dist/model/modules/runtime/execution/computation/EndgeComputation.d.ts +36 -1
- package/dist/model/modules/runtime/execution/endge-converters.d.ts +36 -0
- package/dist/model/modules/runtime/implementation/endge-implementations.d.ts +3 -0
- package/dist/model/modules/runtime/operation/endge-operations.d.ts +18 -0
- package/dist/model/modules/runtime/operation/operation-history.d.ts +54 -0
- package/dist/model/services/compiler/action/action-compile.d.ts +3 -2
- package/dist/model/services/compiler/component-sfc/component-sfc-ports.d.ts +2 -0
- package/dist/model/services/compiler/computation/computation-compile.d.ts +3 -0
- package/dist/model/services/source-engine/compilers/action-source-compile.d.ts +17 -0
- package/dist/model/services/source-engine/strategies/ActionSourceEngineStrategy.d.ts +7 -0
- package/dist/model/services/source-engine/strategies/ActionSourceLanguageStrategy.d.ts +23 -0
- package/dist/model/services/source-engine/templates/action.default.source.d.ts +1 -0
- package/dist/test/fixtures/action-source.d.ts +1 -0
- package/dist/test/model/modules/context/endge-context-theme-default.test.d.ts +1 -0
- package/dist/test/model/modules/runtime/action-runtime.test.d.ts +1 -0
- package/dist/test/model/modules/runtime/executable-implementations.test.d.ts +1 -0
- package/dist/test/model/modules/runtime/operation-history.test.d.ts +1 -0
- package/dist/test/model/services/compiler/component-sfc/component-sfc-action-reactions.test.d.ts +1 -0
- package/dist/test/model/services/source-engine/action-source-compile.test.d.ts +1 -0
- package/package.json +4 -4
- package/dist/domain/entities/action-flow/REndgeFlow.d.ts +0 -27
- package/dist/domain/types/flow/action.types.d.ts +0 -65
- package/dist/domain/types/flow/endge-flow-runtime.types.d.ts +0 -28
- package/dist/domain/types/flow/endge-flow.types.d.ts +0 -110
- package/dist/domain/types/flow/flow-condition.types.d.ts +0 -39
- package/dist/model/modules/runtime/core/endge-bind.d.ts +0 -39
- package/dist/model/modules/runtime/flow/endge-flow-registry.d.ts +0 -34
- package/dist/model/modules/runtime/flow/endge-flow.d.ts +0 -94
- /package/dist/test/{action-implementations.test.d.ts → domain/entities/runtime/composition-operation-history.integration.test.d.ts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RAction } from '../../../../domain/entities/reflect/RAction';
|
|
2
2
|
import { ActionDefinitionInput, ActionExecuteOptions, ImplementationBindingScope, ResolvedActionDescriptor, RuntimeAction, RuntimeActionContext, RuntimeActionId, RuntimeActionRegistrySnapshot } from '../../../../domain/types/runtime/action.types';
|
|
3
3
|
import { ImplementationProvider } from '../../../../domain/types/runtime/implementation.types';
|
|
4
|
+
import { EntityOrigin } from '../../../../domain/types/document/entity-management.type';
|
|
4
5
|
import { Subscribable } from '@endge/utils';
|
|
5
6
|
import { EndgeImplementations } from '../implementation/endge-implementations';
|
|
6
7
|
export interface CodeActionDefinition extends Omit<ActionDefinitionInput, 'owner'> {
|
|
@@ -11,14 +12,19 @@ export interface CodeActionDefinition extends Omit<ActionDefinitionInput, 'owner
|
|
|
11
12
|
canExecute?: ImplementationProvider['canExecute'];
|
|
12
13
|
}
|
|
13
14
|
export interface ActionOverrideInput {
|
|
14
|
-
|
|
15
|
-
providerKey
|
|
16
|
-
execute?: ImplementationProvider['execute'];
|
|
17
|
-
canExecute?: ImplementationProvider['canExecute'];
|
|
15
|
+
identity: string;
|
|
16
|
+
providerKey: string;
|
|
18
17
|
scope?: Exclude<ImplementationBindingScope, 'default' | 'invocation'>;
|
|
19
18
|
scopeIdentity?: string;
|
|
20
19
|
priority?: number;
|
|
21
20
|
}
|
|
21
|
+
export interface ActionDefinitionDescriptor extends ActionDefinitionInput {
|
|
22
|
+
origin: EntityOrigin;
|
|
23
|
+
catalogPath?: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
export interface ActionProviderDescriptor extends Omit<ImplementationProvider, 'contract'> {
|
|
26
|
+
identity: string;
|
|
27
|
+
}
|
|
22
28
|
/** Action-specific facade over semantic definitions and generic implementations. */
|
|
23
29
|
export declare class EndgeActions extends Subscribable {
|
|
24
30
|
private readonly _implementations;
|
|
@@ -27,15 +33,16 @@ export declare class EndgeActions extends Subscribable {
|
|
|
27
33
|
private readonly _codeActionDisposers;
|
|
28
34
|
private readonly _providerDisposers;
|
|
29
35
|
private _hasSynchronizedResolvedIndex;
|
|
36
|
+
private readonly _sourceExecutor;
|
|
30
37
|
constructor(_implementations: EndgeImplementations);
|
|
31
38
|
/** Rebuilds code-owned defaults. Local application code registers again after reset. */
|
|
32
39
|
reset(): void;
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
|
|
40
|
+
/** Installs a serializable code-owned semantic definition without executable code. */
|
|
41
|
+
define(definition: ActionDefinitionDescriptor): () => void;
|
|
42
|
+
/** Installs executable code separately from its semantic definition. */
|
|
43
|
+
provide(provider: ActionProviderDescriptor): () => void;
|
|
37
44
|
/** Binds local code over an existing Action without mutating its definition. */
|
|
38
|
-
override(
|
|
45
|
+
override(override: ActionOverrideInput): () => void;
|
|
39
46
|
/** Executes a resolved Action through the generic implementation pipeline. */
|
|
40
47
|
execute<TResult = unknown>(identity: RuntimeActionId, optionsOrContext?: ActionExecuteOptions | RuntimeActionContext, legacyPayload?: unknown): Promise<TResult | undefined>;
|
|
41
48
|
/** Returns effective definitions for palettes and the Domain Widget. */
|
|
@@ -51,9 +58,6 @@ export declare class EndgeActions extends Subscribable {
|
|
|
51
58
|
/** Returns the semantic definition regardless of storage origin. */
|
|
52
59
|
getDefinition(identity: string): RAction | null;
|
|
53
60
|
canExecute(id: RuntimeActionId, context: RuntimeActionContext, payload?: unknown): boolean;
|
|
54
|
-
/** @deprecated Use defineLocal(), defineBuiltin() or override(). */
|
|
55
|
-
register(action: RuntimeAction): () => void;
|
|
56
|
-
unregister(id: RuntimeActionId): void;
|
|
57
61
|
serialize(): RuntimeActionRegistrySnapshot;
|
|
58
62
|
private _defineCodeAction;
|
|
59
63
|
private _findAction;
|
|
@@ -15,19 +15,19 @@ import { EndgeProject } from '../execution/endge-project';
|
|
|
15
15
|
import { EndgeDataView } from '../execution/endge-data-view';
|
|
16
16
|
import { EndgeQuery } from '../execution/endge-query';
|
|
17
17
|
import { EndgeComputation } from '../execution/endge-computation';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { EndgeConverters } from '../execution/endge-converters';
|
|
19
|
+
import { EndgeOperations } from '../operation/endge-operations';
|
|
20
20
|
/** Модуль создания, регистрации и уничтожения runtime hosts и app scopes. */
|
|
21
21
|
export declare class EndgeRuntime extends EndgeModule {
|
|
22
|
+
readonly implementations: EndgeImplementations;
|
|
22
23
|
readonly computation: EndgeComputation;
|
|
24
|
+
readonly converters: EndgeConverters;
|
|
23
25
|
readonly query: EndgeQuery;
|
|
24
26
|
readonly dataView: EndgeDataView;
|
|
25
27
|
readonly composition: EndgeComposition;
|
|
26
28
|
readonly project: EndgeProject;
|
|
27
|
-
readonly flowRegistry: EndgeFlowRegistry;
|
|
28
|
-
readonly flow: EndgeFlow;
|
|
29
|
-
readonly implementations: EndgeImplementations;
|
|
30
29
|
readonly actions: EndgeActions;
|
|
30
|
+
readonly operations: EndgeOperations;
|
|
31
31
|
readonly scopes: RuntimeScopeRegistry;
|
|
32
32
|
private _hosts;
|
|
33
33
|
private _strategies;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RuntimeHost } from '../../../../../domain/types/runtime/runtime-host.types';
|
|
2
|
+
import { ActionProgramPayload } from '../../../../../domain/types/program/action-program.types';
|
|
3
|
+
/** Executes compiler-produced Action IR without interpreting Source. */
|
|
4
|
+
export declare class ActionProgramExecutor {
|
|
5
|
+
run(payload: ActionProgramPayload, input: unknown, parent: RuntimeHost<any, any> | null): Promise<unknown>;
|
|
6
|
+
private runBlock;
|
|
7
|
+
private runStep;
|
|
8
|
+
private runOperation;
|
|
9
|
+
private evaluate;
|
|
10
|
+
private findComposition;
|
|
11
|
+
private requireObject;
|
|
12
|
+
private optionalObject;
|
|
13
|
+
}
|
|
@@ -1,12 +1,45 @@
|
|
|
1
|
-
import { ComputationSandboxAdapter, ComputationSandboxRequest } from '../../../../../domain/types/computation/computation-runtime.types';
|
|
1
|
+
import { ComputationSandboxAdapter, ComputationSandboxRequest, ComputationOverride } from '../../../../../domain/types/computation/computation-runtime.types';
|
|
2
|
+
import { EntityOrigin } from '../../../../../domain/types/document/entity-management.type';
|
|
3
|
+
import { ImplementationBindingScope } from '../../../../../domain/types/runtime/action.types';
|
|
2
4
|
import { ComputationProgramPayload } from '../../../../../domain/types/computation/computation-program.types';
|
|
3
5
|
import { ProgramArtifact } from '../../../../../domain/types/program/program.types';
|
|
4
6
|
import { ComputationResourceState } from './ComputationResource';
|
|
7
|
+
import { EndgeImplementations } from '../../implementation/endge-implementations';
|
|
5
8
|
/** Executes compiled computation graphs and creates renderer-neutral resources. */
|
|
6
9
|
export declare class EndgeComputation {
|
|
10
|
+
private readonly implementations;
|
|
11
|
+
private readonly definitions;
|
|
12
|
+
private readonly providers;
|
|
13
|
+
private readonly providerDisposers;
|
|
14
|
+
private readonly definitionDisposers;
|
|
15
|
+
private readonly bindingDisposers;
|
|
7
16
|
private sandbox;
|
|
8
17
|
private readonly executor;
|
|
9
18
|
private readonly api;
|
|
19
|
+
constructor(implementations: EndgeImplementations);
|
|
20
|
+
hasDefinition(identity: string): boolean;
|
|
21
|
+
/** Installs a serializable code-owned Computation definition. */
|
|
22
|
+
define(definition: {
|
|
23
|
+
identity: string;
|
|
24
|
+
origin: EntityOrigin;
|
|
25
|
+
defaultProviderKey?: string;
|
|
26
|
+
execution?: 'sync' | 'async';
|
|
27
|
+
}): VoidFunction;
|
|
28
|
+
/** Installs executable code separately from a Computation definition. */
|
|
29
|
+
provide(provider: {
|
|
30
|
+
identity: string;
|
|
31
|
+
key: string;
|
|
32
|
+
origin?: EntityOrigin;
|
|
33
|
+
implementation: ComputationOverride;
|
|
34
|
+
}): VoidFunction;
|
|
35
|
+
/** Selects one previously provided implementation without redefining semantics. */
|
|
36
|
+
override(binding: {
|
|
37
|
+
identity: string;
|
|
38
|
+
providerKey: string;
|
|
39
|
+
scope?: Exclude<ImplementationBindingScope, 'default' | 'invocation'>;
|
|
40
|
+
scopeIdentity?: string;
|
|
41
|
+
priority?: number;
|
|
42
|
+
}): VoidFunction;
|
|
10
43
|
setSandboxAdapter(adapter: ComputationSandboxAdapter | null): void;
|
|
11
44
|
/** Executes an already compiler-validated function in the shared isolated sandbox. */
|
|
12
45
|
executeSandbox(request: ComputationSandboxRequest): Promise<unknown>;
|
|
@@ -29,4 +62,6 @@ export declare class EndgeComputation {
|
|
|
29
62
|
private _enterExecution;
|
|
30
63
|
private runOverrideSync;
|
|
31
64
|
private runOverride;
|
|
65
|
+
private resolveProvider;
|
|
66
|
+
reset(): void;
|
|
32
67
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EntityOrigin } from '../../../../domain/types/document/entity-management.type';
|
|
2
|
+
import { ImplementationBindingScope } from '../../../../domain/types/runtime/action.types';
|
|
3
|
+
import { EndgeImplementations } from '../implementation/endge-implementations';
|
|
4
|
+
type ConverterProvider = (value: unknown, options?: Record<string, unknown>) => unknown;
|
|
5
|
+
/** Synchronous Converter facade with separate definitions, providers and bindings. */
|
|
6
|
+
export declare class EndgeConverters {
|
|
7
|
+
private readonly implementations;
|
|
8
|
+
private readonly definitions;
|
|
9
|
+
private readonly providerDisposers;
|
|
10
|
+
private readonly definitionDisposers;
|
|
11
|
+
private started;
|
|
12
|
+
constructor(implementations: EndgeImplementations);
|
|
13
|
+
has(identity: string): boolean;
|
|
14
|
+
define(definition: {
|
|
15
|
+
identity: string;
|
|
16
|
+
origin: EntityOrigin;
|
|
17
|
+
defaultProviderKey?: string;
|
|
18
|
+
}): VoidFunction;
|
|
19
|
+
provide(provider: {
|
|
20
|
+
identity: string;
|
|
21
|
+
key: string;
|
|
22
|
+
origin: EntityOrigin;
|
|
23
|
+
convert: ConverterProvider;
|
|
24
|
+
}): VoidFunction;
|
|
25
|
+
override(binding: {
|
|
26
|
+
identity: string;
|
|
27
|
+
providerKey: string;
|
|
28
|
+
scope?: Exclude<ImplementationBindingScope, 'default' | 'invocation'>;
|
|
29
|
+
scopeIdentity?: string;
|
|
30
|
+
priority?: number;
|
|
31
|
+
}): VoidFunction;
|
|
32
|
+
execute(identity: string, value: unknown, options?: Record<string, unknown>): unknown;
|
|
33
|
+
start(): void;
|
|
34
|
+
reset(): void;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -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
|
|
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,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,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 @@
|
|
|
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 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})";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/test/model/services/compiler/component-sfc/component-sfc-action-reactions.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@endge/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
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.
|
|
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.
|
|
50
|
-
"@endge/utils": "^0.24.
|
|
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
|
-
}
|