@endge/core 1.2.8 → 1.2.9
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 +326 -274
- package/dist/core.js +26108 -24155
- package/dist/domain/entities/reflect/RComputation.d.ts +0 -3
- package/dist/domain/entities/reflect/RStream.d.ts +8 -0
- package/dist/domain/entities/reflect/RType.d.ts +2 -9
- package/dist/domain/entities/reflect/RUpdate.d.ts +10 -0
- package/dist/domain/entities/runtime/hosts/CompositionRuntimeHost.d.ts +10 -0
- package/dist/domain/entities/runtime/hosts/StoreRuntimeHost.d.ts +16 -0
- package/dist/domain/entities/runtime/hosts/StreamRuntimeHost.d.ts +30 -0
- package/dist/domain/types/computation/computation-source.types.d.ts +3 -0
- package/dist/domain/types/document/document.types.d.ts +4 -2
- package/dist/domain/types/document/domain-export.type.d.ts +2 -0
- package/dist/domain/types/document/schema.types.d.ts +6 -0
- package/dist/domain/types/program/program.types.d.ts +5 -2
- package/dist/domain/types/runtime/runtime-entity-map.types.d.ts +3 -0
- package/dist/domain/types/runtime/runtime-host.types.d.ts +5 -0
- package/dist/domain/types/runtime/runtime.types.d.ts +3 -2
- package/dist/domain/types/runtime/stream-runtime.types.d.ts +17 -0
- package/dist/domain/types/source/composition-source.types.d.ts +8 -1
- package/dist/domain/types/source/data-view-source.types.d.ts +6 -1
- package/dist/domain/types/source/filter-source.types.d.ts +47 -0
- package/dist/domain/types/source/index.d.ts +2 -0
- package/dist/domain/types/source/query-source.types.d.ts +2 -1
- package/dist/domain/types/source/source-engine.types.d.ts +2 -2
- package/dist/domain/types/source/source-expression.types.d.ts +1 -1
- package/dist/domain/types/source/store-source.types.d.ts +9 -0
- package/dist/domain/types/source/stream-source.types.d.ts +39 -0
- package/dist/domain/types/source/update-source.types.d.ts +32 -0
- package/dist/main.d.ts +7 -0
- package/dist/model/db/repositories/Actions_Repository.d.ts +0 -7
- package/dist/model/db/repositories/Computations_Repository.d.ts +0 -2
- package/dist/model/db/repositories/Streams_Repository.d.ts +27 -0
- package/dist/model/db/repositories/Types_Repository.d.ts +5 -8
- package/dist/model/db/repositories/Updates_Repository.d.ts +26 -0
- package/dist/model/endge/domain/endge-domain.d.ts +32 -0
- package/dist/model/endge/domain/endge-types.d.ts +12 -0
- package/dist/model/endge/kernel/endge.d.ts +3 -0
- package/dist/model/endge/program/endge-compiler.d.ts +8 -0
- package/dist/model/endge/program/endge-program.d.ts +6 -0
- package/dist/model/endge/runtime/execution/computation/EndgeComputation.d.ts +6 -0
- package/dist/model/services/compiler/computation/computation-compile.d.ts +1 -3
- package/dist/model/services/runtime/strategies/StreamRuntimeStrategy.d.ts +9 -0
- package/dist/model/services/runtime/transports/BrowserSseStreamTransportFactory.d.ts +5 -0
- package/dist/model/services/source-engine/compilers/stream-source-compile.d.ts +3 -0
- package/dist/model/services/source-engine/compilers/update-source-compile.d.ts +3 -0
- package/dist/model/services/source-engine/filter-source-patch.d.ts +12 -0
- package/dist/model/services/source-engine/source-document-reference.d.ts +7 -0
- package/dist/model/services/source-engine/strategies/FilterSourcePatchStrategy.d.ts +10 -0
- package/dist/model/services/source-engine/strategies/StreamSourceEngineStrategy.d.ts +7 -0
- package/dist/model/services/source-engine/strategies/StreamSourceLanguageStrategy.d.ts +10 -0
- package/dist/model/services/source-engine/strategies/UpdateSourceEngineStrategy.d.ts +7 -0
- package/dist/model/services/source-engine/strategies/UpdateSourceLanguageStrategy.d.ts +10 -0
- package/dist/model/services/source-engine/templates/stream.default.source.d.ts +1 -0
- package/dist/model/services/source-engine/templates/update.default.source.d.ts +1 -0
- package/dist/test/model/endge/runtime/computation-source-preview.test.d.ts +1 -0
- package/dist/test/model/services/compiler/computation/groundhandling-process-state.test.d.ts +1 -0
- package/dist/test/model/services/source-engine/value-expression-operations.test.d.ts +1 -0
- package/package.json +4 -3
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DuplicateOptions, REntity } from './REntity';
|
|
2
2
|
import { DiagnosticsProblemInput } from '../../types/diagnostics';
|
|
3
|
-
import { RField } from './RField';
|
|
4
3
|
/** Persisted executable specification. Runtime execution is provided separately. */
|
|
5
4
|
export declare class RComputation extends REntity {
|
|
6
5
|
displayName: string;
|
|
@@ -8,8 +7,6 @@ export declare class RComputation extends REntity {
|
|
|
8
7
|
source: string;
|
|
9
8
|
sourceVersion: number;
|
|
10
9
|
contractVersion: number;
|
|
11
|
-
input: RField | null;
|
|
12
|
-
output: RField | null;
|
|
13
10
|
static fromPayload(json: any): RComputation;
|
|
14
11
|
static fromPlain(json: any, storageMeta?: any): RComputation;
|
|
15
12
|
toPlain(): Record<string, unknown>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DuplicateOptions, REntity } from './REntity';
|
|
2
|
+
/** Persisted source-first definition of a normalized event stream. */
|
|
3
|
+
export declare class RStream extends REntity {
|
|
4
|
+
readonly type: "stream";
|
|
5
|
+
source: string;
|
|
6
|
+
sourceVersion: number;
|
|
7
|
+
duplicate(options: DuplicateOptions): RStream;
|
|
8
|
+
}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { RField } from './RField';
|
|
2
1
|
import { REntity } from './REntity';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Содержит название и список полей.
|
|
3
|
+
* Source-first доменная сущность типа.
|
|
6
4
|
*/
|
|
7
5
|
export declare class RType extends REntity {
|
|
8
6
|
get id(): string;
|
|
9
7
|
name: string;
|
|
10
8
|
isPrimitive: boolean;
|
|
11
|
-
/**
|
|
9
|
+
/** Каноническое структурное определение типа. */
|
|
12
10
|
source: string;
|
|
13
11
|
sourceVersion: number;
|
|
14
|
-
fields: Map<string, RField>;
|
|
15
12
|
constructor(name: string);
|
|
16
|
-
addField(field: RField): void;
|
|
17
|
-
getField(fieldName: string | number): RField | null;
|
|
18
|
-
hasField(fieldName: string | number): boolean;
|
|
19
|
-
getFields(): string[];
|
|
20
13
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DuplicateOptions, REntity } from './REntity';
|
|
2
|
+
/** Persisted source-first Store-owned mutation definition. */
|
|
3
|
+
export declare class RUpdate extends REntity {
|
|
4
|
+
readonly type: "update";
|
|
5
|
+
/** Stable identity of the only Store that may execute this Update. */
|
|
6
|
+
storeIdentity: string;
|
|
7
|
+
source: string;
|
|
8
|
+
sourceVersion: number;
|
|
9
|
+
duplicate(options: DuplicateOptions): RUpdate;
|
|
10
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RComposition } from '../../reflect/RComposition';
|
|
2
2
|
import { FilterViewRuntimeHost } from './FilterViewRuntimeHost';
|
|
3
|
+
import { StoreMutationPlan } from '../../../types/source/update-source.types';
|
|
3
4
|
import { CompositionFilterFieldsSlice, CompositionProgramPayload, CompositionPublicOutputHandle, CompositionRuntimeActivationHandle, CompositionRuntimeChildHandle } from '../../../types/source/composition-source.types';
|
|
4
5
|
import { RuntimeArtifactReader, RuntimeHost, RuntimeHostContext, RuntimeHostInputSource, RuntimeHostUpdateContext } from '../../../types/runtime/runtime-host.types';
|
|
5
6
|
import { I18nRuntimeCatalog } from '../../../types/i18n.types';
|
|
@@ -29,6 +30,8 @@ export declare class CompositionRuntimeHost extends RuntimeHostBase<'composition
|
|
|
29
30
|
private _vocabCatalogs;
|
|
30
31
|
private _orchestratedQueries;
|
|
31
32
|
private _orchestratedSuccesses;
|
|
33
|
+
private _streamBatches;
|
|
34
|
+
private _streamBatchTimers;
|
|
32
35
|
private _mounted;
|
|
33
36
|
constructor(input: {
|
|
34
37
|
id: string;
|
|
@@ -62,6 +65,10 @@ export declare class CompositionRuntimeHost extends RuntimeHostBase<'composition
|
|
|
62
65
|
getDataSnapshot(): Readonly<Record<string, unknown>>;
|
|
63
66
|
/** Возвращает текущие значения публичных Composition props. */
|
|
64
67
|
getProps(): Readonly<Record<string, unknown>>;
|
|
68
|
+
/** Imperative local mutation for UI flows that do not need a persisted RUpdate. */
|
|
69
|
+
mutateStore(dataAlias: string, plan: StoreMutationPlan): void;
|
|
70
|
+
/** Explicitly invokes one named Store-owned RUpdate outside Stream dispatch. */
|
|
71
|
+
applyStoreUpdate(dataAlias: string, updateIdentity: string, payload: unknown): void;
|
|
65
72
|
/** Устанавливает literal/Raph-backed источник публичных Composition props. */
|
|
66
73
|
setInputSource(input: RuntimeHostInputSource | null | undefined): void;
|
|
67
74
|
/** Проверяет обязательные props до создания child runtime graph. */
|
|
@@ -94,9 +101,12 @@ export declare class CompositionRuntimeHost extends RuntimeHostBase<'composition
|
|
|
94
101
|
private _publishUpdates;
|
|
95
102
|
protected onUpdate(ctx: RuntimeHostUpdateContext): void;
|
|
96
103
|
private _requireDataPath;
|
|
104
|
+
private _requireStoreRuntime;
|
|
97
105
|
private _resolveDataReference;
|
|
98
106
|
private _createChild;
|
|
99
107
|
private _bindChild;
|
|
108
|
+
private _bindStreamDispatch;
|
|
109
|
+
private _flushStreamBatch;
|
|
100
110
|
private _makeOutputs;
|
|
101
111
|
/** Не допускает прямые и транзитивные циклы Composition runtime tree. */
|
|
102
112
|
private _assertCompositionCycle;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { RStore } from '../../reflect/RStore';
|
|
2
2
|
import { RuntimeArtifactReader, RuntimeHost, RuntimeHostContext } from '../../../types/runtime/runtime-host.types';
|
|
3
3
|
import { StoreDataDescriptor, StoreSourceArtifact } from '../../../types/source/store-source.types';
|
|
4
|
+
import { StoreMutationPlan } from '../../../types/source/update-source.types';
|
|
5
|
+
import { StreamEventEnvelope } from '../../../types/source/stream-source.types';
|
|
4
6
|
import { RuntimeHostBase } from '../RuntimeHostBase';
|
|
5
7
|
/** Runtime-владелец writable Store state и реактивных DataView projections. */
|
|
6
8
|
export declare class StoreRuntimeHost extends RuntimeHostBase<'store', RuntimeHostContext<'store'>, StoreSourceArtifact> {
|
|
@@ -31,8 +33,22 @@ export declare class StoreRuntimeHost extends RuntimeHostBase<'store', RuntimeHo
|
|
|
31
33
|
isWritable(path: string): boolean;
|
|
32
34
|
/** Записывает значение в writable Store field и запускает derived graph через Raph. */
|
|
33
35
|
set(path: string, value: unknown): void;
|
|
36
|
+
/**
|
|
37
|
+
* Маршрутизирует нормализованное событие по compile-time таблице Store.
|
|
38
|
+
* Возвращает false, если Store не объявляет Update для данного типа.
|
|
39
|
+
*/
|
|
40
|
+
dispatch(event: StreamEventEnvelope): boolean;
|
|
41
|
+
/** Применяет именованный дочерний Update к Store без привязки к транспорту. */
|
|
42
|
+
applyUpdate(updateIdentity: string, payload: unknown): void;
|
|
43
|
+
/**
|
|
44
|
+
* Применяет inline mutation из Composition/UI.
|
|
45
|
+
* Это escape hatch для локальных изменений, которым не нужен persisted RUpdate.
|
|
46
|
+
*/
|
|
47
|
+
applyMutation(plan: StoreMutationPlan): void;
|
|
34
48
|
/** Освобождает derived registrations до удаления Store state. */
|
|
35
49
|
destroy(): void;
|
|
36
50
|
/** Инициализирует writable fields и затем immediate derived graph. */
|
|
37
51
|
private _mount;
|
|
52
|
+
private _makeMutationPlans;
|
|
53
|
+
private _applyMutationPlan;
|
|
38
54
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RStream } from '../../reflect/RStream';
|
|
2
|
+
import { RuntimeArtifactReader, RuntimeHost, RuntimeHostContext } from '../../../types/runtime/runtime-host.types';
|
|
3
|
+
import { StreamTransportFactory } from '../../../types/runtime/stream-runtime.types';
|
|
4
|
+
import { StreamSourceArtifact } from '../../../types/source/stream-source.types';
|
|
5
|
+
import { RuntimeHostBase } from '../RuntimeHostBase';
|
|
6
|
+
/** Runtime lifecycle owner for one compiled Stream transport. */
|
|
7
|
+
export declare class StreamRuntimeHost extends RuntimeHostBase<'stream', RuntimeHostContext<'stream'>, StreamSourceArtifact> {
|
|
8
|
+
private _connection;
|
|
9
|
+
constructor(input: {
|
|
10
|
+
id: string;
|
|
11
|
+
model: RStream;
|
|
12
|
+
parent?: RuntimeHost<any, any> | null;
|
|
13
|
+
meta?: Record<string, unknown>;
|
|
14
|
+
artifactReader: RuntimeArtifactReader;
|
|
15
|
+
privateTransportFactory: StreamTransportFactory;
|
|
16
|
+
});
|
|
17
|
+
private readonly _transportFactory;
|
|
18
|
+
static createRuntime(input: {
|
|
19
|
+
id: string;
|
|
20
|
+
model: RStream;
|
|
21
|
+
meta?: Record<string, any>;
|
|
22
|
+
parent?: RuntimeHost<any, any> | null;
|
|
23
|
+
artifacts: RuntimeArtifactReader;
|
|
24
|
+
transportFactory: StreamTransportFactory;
|
|
25
|
+
}): StreamRuntimeHost | null;
|
|
26
|
+
start(): void;
|
|
27
|
+
stop(): void;
|
|
28
|
+
destroy(): void;
|
|
29
|
+
private _receive;
|
|
30
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SourceExpressionIR } from '../source/source-expression.types';
|
|
2
|
+
import { ComputationContractField } from './computation-program.types';
|
|
2
3
|
export interface ComputationSourceRange {
|
|
3
4
|
start: number;
|
|
4
5
|
end: number;
|
|
@@ -23,6 +24,8 @@ export type ComputationSourceNode = {
|
|
|
23
24
|
};
|
|
24
25
|
/** Canonical compiler-derived representation of defineComputation source. */
|
|
25
26
|
export interface ComputationSourceDocument {
|
|
27
|
+
input: ComputationContractField | null;
|
|
28
|
+
output: ComputationContractField | null;
|
|
26
29
|
outputs: ComputationSourceNode[];
|
|
27
30
|
result: SourceExpressionIR;
|
|
28
31
|
}
|
|
@@ -20,6 +20,8 @@ import { RWorkspace } from '../../entities/reflect/RWorkspace';
|
|
|
20
20
|
import { RComponent } from '../component/component.types';
|
|
21
21
|
import { RComposition } from '../../entities/reflect/RComposition';
|
|
22
22
|
import { RStore } from '../../entities/reflect/RStore';
|
|
23
|
+
import { RStream } from '../../entities/reflect/RStream';
|
|
24
|
+
import { RUpdate } from '../../entities/reflect/RUpdate';
|
|
23
25
|
import { RMock } from '../../entities/reflect/RMock';
|
|
24
26
|
import { RComputation } from '../../entities/reflect/RComputation';
|
|
25
27
|
/**
|
|
@@ -84,7 +86,7 @@ export declare enum DomainSectionType {
|
|
|
84
86
|
/**
|
|
85
87
|
* Все возможные типы документов
|
|
86
88
|
*/
|
|
87
|
-
export type DomainDocumentType = 'primitive' | 'type' | 'action' | 'converter' | 'computation' | 'data-view' | 'composition' | 'store' | 'mock' | 'integration' | 'page-template' | 'page' | 'navigation' | 'environment' | 'policy' | 'style' | 'vocabs' | 'i18n-bundles' | 'auth-profile' | 'tenant' | 'project' | 'workspace' | Exclude<ComponentType, ComponentType.Component | ComponentType.Html> | QueryType | ParameterType | FilterType;
|
|
89
|
+
export type DomainDocumentType = 'primitive' | 'type' | 'action' | 'converter' | 'computation' | 'data-view' | 'composition' | 'store' | 'stream' | 'update' | 'mock' | 'integration' | 'page-template' | 'page' | 'navigation' | 'environment' | 'policy' | 'style' | 'vocabs' | 'i18n-bundles' | 'auth-profile' | 'tenant' | 'project' | 'workspace' | Exclude<ComponentType, ComponentType.Component | ComponentType.Html> | QueryType | ParameterType | FilterType;
|
|
88
90
|
/**
|
|
89
91
|
* Описывает любой документ
|
|
90
92
|
*/
|
|
@@ -96,4 +98,4 @@ export interface Document {
|
|
|
96
98
|
/**
|
|
97
99
|
* Описывает любой документ рефлекцию
|
|
98
100
|
*/
|
|
99
|
-
export type RDocument = RComponent | RComponentSFC | RQuery | RDataView | RComposition | RStore | RMock | RAction | RConverter | RComputation | RIntegration | RParameter | RFilter | RPolicy | RStyle | RType | RVocabs | RI18nBundle | RAuthProfile | RWorkspace | RTenant | RPageTemplate | RPage | RNavigation;
|
|
101
|
+
export type RDocument = RComponent | RComponentSFC | RQuery | RDataView | RComposition | RStore | RStream | RUpdate | RMock | RAction | RConverter | RComputation | RIntegration | RParameter | RFilter | RPolicy | RStyle | RType | RVocabs | RI18nBundle | RAuthProfile | RWorkspace | RTenant | RPageTemplate | RPage | RNavigation;
|
|
@@ -24,6 +24,8 @@ import { Tenants_Repository } from '../../../model/db/repositories/Tenants_Repos
|
|
|
24
24
|
import { Workspaces_Repository } from '../../../model/db/repositories/Workspaces_Repository';
|
|
25
25
|
import { Compositions_Repository } from '../../../model/db/repositories/Compositions_Repository';
|
|
26
26
|
import { Stores_Repository } from '../../../model/db/repositories/Stores_Repository';
|
|
27
|
+
import { Streams_Repository } from '../../../model/db/repositories/Streams_Repository';
|
|
28
|
+
import { Updates_Repository } from '../../../model/db/repositories/Updates_Repository';
|
|
27
29
|
import { Mocks_Repository } from '../../../model/db/repositories/Mocks_Repository';
|
|
28
30
|
import { Computations_Repository } from '../../../model/db/repositories/Computations_Repository';
|
|
29
31
|
export interface EndgeSchemaDump {
|
|
@@ -35,6 +37,8 @@ export interface EndgeSchemaDump {
|
|
|
35
37
|
dataViews: any[];
|
|
36
38
|
compositions: any[];
|
|
37
39
|
stores: any[];
|
|
40
|
+
streams: any[];
|
|
41
|
+
updates: any[];
|
|
38
42
|
mocks: any[];
|
|
39
43
|
folders: any[];
|
|
40
44
|
components: any[];
|
|
@@ -73,6 +77,8 @@ export type RepositoriesBag = {
|
|
|
73
77
|
dataViews: DataViews_Repository;
|
|
74
78
|
compositions: Compositions_Repository;
|
|
75
79
|
stores: Stores_Repository;
|
|
80
|
+
streams: Streams_Repository;
|
|
81
|
+
updates: Updates_Repository;
|
|
76
82
|
mocks: Mocks_Repository;
|
|
77
83
|
folders: Folders_Repository;
|
|
78
84
|
components: Components_Repository;
|
|
@@ -2,13 +2,13 @@ import { ActionCompiledFlow } from '../flow/action.types';
|
|
|
2
2
|
import { RComponentContract, RComponentDependencies } from '../component/component-core.types';
|
|
3
3
|
import { DataViewManualTransform, DataViewPipelineStep, DataViewRef, DataViewSourceDocument } from '../source/data-view-source.types';
|
|
4
4
|
import { RComponentSFC_AST, RComponentSFC_IR, RComponentSFC_RuntimeDependencies, RComponentSFCSource_Parts } from '../component/sfc';
|
|
5
|
-
import { QueryProgramProp, SourceExpressionIR } from '../source/source-expression.types';
|
|
5
|
+
import { QueryProgramProp, SourceExpressionIR, SourceFieldDefinition } from '../source/source-expression.types';
|
|
6
6
|
import { ProgramMetadata } from './program-metadata.types';
|
|
7
7
|
import { ComputationProgramPayload } from '../computation';
|
|
8
8
|
import { EndgeStyleSheetArtifact } from '../style';
|
|
9
9
|
import { ActionImplementation, ActionTargetSelector } from '../runtime/action.types';
|
|
10
10
|
/** Тип доменной сущности, для которой compiler может построить program artifact. */
|
|
11
|
-
export type ProgramEntityType = 'type' | 'component-sfc' | 'computation' | 'action' | 'query' | 'data-view' | 'store' | 'filter' | 'composition' | 'style';
|
|
11
|
+
export type ProgramEntityType = 'type' | 'component-sfc' | 'computation' | 'action' | 'query' | 'data-view' | 'store' | 'stream' | 'update' | 'filter' | 'composition' | 'style';
|
|
12
12
|
/** Итоговый статус artifact после компиляции и валидации. */
|
|
13
13
|
export type ProgramArtifactStatus = 'valid' | 'warning' | 'error';
|
|
14
14
|
/** Возможность, которую artifact предоставляет runtime/render слоям. */
|
|
@@ -106,6 +106,7 @@ export interface QueryProgramOutput {
|
|
|
106
106
|
key: string;
|
|
107
107
|
source: QueryProgramOutputSource;
|
|
108
108
|
dataViews: DataViewRef[];
|
|
109
|
+
contract?: SourceFieldDefinition | null;
|
|
109
110
|
materialization: {
|
|
110
111
|
kind: 'source';
|
|
111
112
|
} | {
|
|
@@ -160,6 +161,8 @@ export interface DataViewProgramPayload {
|
|
|
160
161
|
materializationStrategy: import('../source/data-view-source.types').DataViewMaterializationStrategy;
|
|
161
162
|
/** Canonical source document для debug/preview UI. */
|
|
162
163
|
sourceDocument: DataViewSourceDocument | null;
|
|
164
|
+
/** Декларативный входной и выходной тип DataView. */
|
|
165
|
+
contract?: DataViewSourceDocument['contract'];
|
|
163
166
|
/** Compiled manual transform. Используется только в mode=manual. */
|
|
164
167
|
transform: DataViewManualTransform | null;
|
|
165
168
|
/** Compiled pipeline steps. Используется только в mode=pipeline. */
|
|
@@ -6,6 +6,7 @@ import { RQuery } from '../../entities/reflect/RQuery';
|
|
|
6
6
|
import { RFilter } from '../../entities/reflect/RFilter';
|
|
7
7
|
import { RComposition } from '../../entities/reflect/RComposition';
|
|
8
8
|
import { RStore } from '../../entities/reflect/RStore';
|
|
9
|
+
import { RStream } from '../../entities/reflect/RStream';
|
|
9
10
|
/**
|
|
10
11
|
* Канонический перечень сущностей, для которых может существовать runtime-host.
|
|
11
12
|
*/
|
|
@@ -24,6 +25,8 @@ export interface RuntimeEntityModelMap {
|
|
|
24
25
|
composition: RComposition;
|
|
25
26
|
/** Source-first reactive Store runtime. */
|
|
26
27
|
store: RStore;
|
|
28
|
+
/** External or emulated normalized event stream. */
|
|
29
|
+
stream: RStream;
|
|
27
30
|
/** Доменная модель action. */
|
|
28
31
|
action: RAction;
|
|
29
32
|
}
|
|
@@ -68,6 +68,10 @@ export interface StoreRuntimeHostContext extends RuntimeHostContextBase {
|
|
|
68
68
|
writableFields: string[];
|
|
69
69
|
derivedFields: string[];
|
|
70
70
|
}
|
|
71
|
+
export interface StreamRuntimeHostContext extends RuntimeHostContextBase {
|
|
72
|
+
lastEventAt: string | null;
|
|
73
|
+
receivedCount: number;
|
|
74
|
+
}
|
|
71
75
|
export interface ComponentSFCRuntimeHostContext extends RuntimeHostContextBase {
|
|
72
76
|
/** Target последней подготовки SFC. */
|
|
73
77
|
target: 'dom' | 'canvas' | null;
|
|
@@ -90,6 +94,7 @@ export interface RuntimeHostContextMap {
|
|
|
90
94
|
filter: FilterRuntimeHostContext;
|
|
91
95
|
composition: CompositionRuntimeHostContext;
|
|
92
96
|
store: StoreRuntimeHostContext;
|
|
97
|
+
stream: StreamRuntimeHostContext;
|
|
93
98
|
'component-sfc': ComponentSFCRuntimeHostContext;
|
|
94
99
|
page: PageRuntimeHostContext;
|
|
95
100
|
project: ProjectRuntimeHostContext;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RFilter } from '../../entities/reflect/RFilter';
|
|
2
2
|
import { RComposition } from '../../entities/reflect/RComposition';
|
|
3
3
|
import { RStore } from '../../entities/reflect/RStore';
|
|
4
|
+
import { RStream } from '../../entities/reflect/RStream';
|
|
4
5
|
import { RAction } from '../../entities/reflect/RAction';
|
|
5
6
|
import { RComponentSFC } from '../../entities/reflect/RComponentSFC';
|
|
6
7
|
import { RPage } from '../../entities/reflect/RPage';
|
|
@@ -10,8 +11,8 @@ import { RuntimeHostRegistrySnapshot } from './runtime-registry.types';
|
|
|
10
11
|
/**
|
|
11
12
|
* Runtime kinds
|
|
12
13
|
*/
|
|
13
|
-
export type RuntimeKind = 'query' | 'filter' | 'composition' | 'store' | 'action' | 'runtime';
|
|
14
|
-
export type RuntimeExecutableModel = RQuery | RAction | RProject | RPage | RComponentSFC | RFilter | RComposition | RStore;
|
|
14
|
+
export type RuntimeKind = 'query' | 'filter' | 'composition' | 'store' | 'stream' | 'action' | 'runtime';
|
|
15
|
+
export type RuntimeExecutableModel = RQuery | RAction | RProject | RPage | RComponentSFC | RFilter | RComposition | RStore | RStream;
|
|
15
16
|
export interface EndgeRuntimeSnapshot extends RuntimeHostRegistrySnapshot {
|
|
16
17
|
generatedAt: number;
|
|
17
18
|
scopes: import('./runtime-scope.types').RuntimeScopeSnapshot[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StreamSourceArtifact } from '../source/stream-source.types';
|
|
2
|
+
export interface StreamTransportMessage {
|
|
3
|
+
sourceEvent: string;
|
|
4
|
+
id: string | null;
|
|
5
|
+
data: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface StreamTransportConnection {
|
|
8
|
+
close: () => void;
|
|
9
|
+
}
|
|
10
|
+
/** Browser-neutral port used by StreamRuntimeHost. */
|
|
11
|
+
export interface StreamTransportFactory {
|
|
12
|
+
open: (artifact: StreamSourceArtifact, callbacks: {
|
|
13
|
+
message: (message: StreamTransportMessage) => void;
|
|
14
|
+
error: (error: unknown) => void;
|
|
15
|
+
open: () => void;
|
|
16
|
+
}) => StreamTransportConnection;
|
|
17
|
+
}
|
|
@@ -8,7 +8,7 @@ import { SourceExpressionIR, SourceFieldDefinition } from './source-expression.t
|
|
|
8
8
|
import { FilterViewControlDefinition } from '../ui/filter-view.type';
|
|
9
9
|
import { EndgeMockReference } from '../mock';
|
|
10
10
|
import { I18nCompiledLocales } from '../i18n.types';
|
|
11
|
-
export type CompositionRuntimeKind = 'filter' | 'query' | 'component' | 'composition' | 'filter-view';
|
|
11
|
+
export type CompositionRuntimeKind = 'filter' | 'query' | 'component' | 'composition' | 'stream' | 'filter-view';
|
|
12
12
|
export type CompositionActivationMode = 'startup' | 'manual';
|
|
13
13
|
export interface CompositionActivationDescriptor {
|
|
14
14
|
mode: CompositionActivationMode;
|
|
@@ -136,6 +136,13 @@ export interface CompositionRuntimeDescriptor {
|
|
|
136
136
|
/** Локальный data alias child -> data alias owner Composition. */
|
|
137
137
|
dataBindings?: Record<string, string>;
|
|
138
138
|
storeTo: CompositionStorePublication[];
|
|
139
|
+
/** Store data aliases receiving normalized Stream events. */
|
|
140
|
+
dispatchTo?: string[];
|
|
141
|
+
/** Optional Composition-owned event batching policy. */
|
|
142
|
+
batch?: {
|
|
143
|
+
maxItems: number;
|
|
144
|
+
maxWaitMs: number;
|
|
145
|
+
};
|
|
139
146
|
}
|
|
140
147
|
export interface CompositionRuntimeChildHandle {
|
|
141
148
|
name: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProgramDiagnostic } from '../program/program.types';
|
|
2
2
|
import { ProgramMetadataMap } from '../program/program-metadata.types';
|
|
3
|
-
import { SourceExpressionIR } from './source-expression.types';
|
|
3
|
+
import { SourceExpressionIR, SourceFieldDefinition } from './source-expression.types';
|
|
4
4
|
export type DataViewSourceMode = 'manual' | 'pipeline' | 'projection' | 'expression';
|
|
5
5
|
export type DataViewIncrementalRequest = {
|
|
6
6
|
mode: 'auto';
|
|
@@ -16,9 +16,14 @@ export type DataViewMaterializationStrategy = {
|
|
|
16
16
|
kind: 'collection-by-key';
|
|
17
17
|
key: string;
|
|
18
18
|
};
|
|
19
|
+
export interface DataViewSourceContract {
|
|
20
|
+
input: SourceFieldDefinition;
|
|
21
|
+
output: SourceFieldDefinition;
|
|
22
|
+
}
|
|
19
23
|
export interface DataViewSourceDocument {
|
|
20
24
|
mode: DataViewSourceMode;
|
|
21
25
|
incremental: DataViewIncrementalRequest;
|
|
26
|
+
contract?: DataViewSourceContract | null;
|
|
22
27
|
transform?: DataViewManualTransform;
|
|
23
28
|
steps?: DataViewPipelineStep[];
|
|
24
29
|
output?: Record<string, SourceExpressionIR>;
|
|
@@ -6,6 +6,53 @@ export interface FilterSourceDocument {
|
|
|
6
6
|
fields: SourceFieldDefinition[];
|
|
7
7
|
outputs: FilterProgramOutput[];
|
|
8
8
|
}
|
|
9
|
+
/** Абсолютный диапазон узла внутри Filter source. */
|
|
10
|
+
export interface FilterSourceRange {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
}
|
|
14
|
+
/** Source-backed поле для визуального редактора Filter. */
|
|
15
|
+
export interface FilterSourceEditorField extends SourceFieldDefinition {
|
|
16
|
+
sourceRange: FilterSourceRange;
|
|
17
|
+
keyRange: FilterSourceRange;
|
|
18
|
+
valueRange: FilterSourceRange;
|
|
19
|
+
valueSource: string;
|
|
20
|
+
defaultSource: string | null;
|
|
21
|
+
}
|
|
22
|
+
/** Source-backed output для навигации из визуального редактора. */
|
|
23
|
+
export interface FilterSourceEditorOutput {
|
|
24
|
+
key: string;
|
|
25
|
+
kind: FilterProgramOutput['kind'];
|
|
26
|
+
sourceRange: FilterSourceRange;
|
|
27
|
+
source: string;
|
|
28
|
+
}
|
|
29
|
+
/** Проекция Filter source, которая не хранится отдельно от source. */
|
|
30
|
+
export interface FilterSourceEditorDocument {
|
|
31
|
+
fields: FilterSourceEditorField[];
|
|
32
|
+
outputs: FilterSourceEditorOutput[];
|
|
33
|
+
}
|
|
34
|
+
/** Узкие операции визуального редактора над canonical Filter source. */
|
|
35
|
+
export type FilterSourcePatchOperation = {
|
|
36
|
+
type: 'add-field';
|
|
37
|
+
key: string;
|
|
38
|
+
expression: string;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'remove-field';
|
|
41
|
+
key: string;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'move-field';
|
|
44
|
+
key: string;
|
|
45
|
+
toIndex: number;
|
|
46
|
+
} | {
|
|
47
|
+
type: 'rename-field';
|
|
48
|
+
key: string;
|
|
49
|
+
nextKey: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'set-field';
|
|
52
|
+
key: string;
|
|
53
|
+
expression: string;
|
|
54
|
+
};
|
|
55
|
+
export type FilterSourcePatch = FilterSourcePatchOperation | FilterSourcePatchOperation[];
|
|
9
56
|
/** JSON-output фильтра. */
|
|
10
57
|
export interface FilterProgramJsonOutput {
|
|
11
58
|
key: string;
|
|
@@ -5,4 +5,6 @@ export * from './query-source.types';
|
|
|
5
5
|
export * from './source-engine.types';
|
|
6
6
|
export * from './source-expression.types';
|
|
7
7
|
export * from './store-source.types';
|
|
8
|
+
export * from './stream-source.types';
|
|
9
|
+
export * from './update-source.types';
|
|
8
10
|
export * from './type-source.types';
|
|
@@ -2,7 +2,7 @@ import { RQueryAuth } from '../document/query.types';
|
|
|
2
2
|
import { ProgramDiagnostic, QueryProgramPayload } from '../program/program.types';
|
|
3
3
|
import { DataViewRef } from './data-view-source.types';
|
|
4
4
|
import { ProgramMetadataMap } from '../program/program-metadata.types';
|
|
5
|
-
import { QueryProgramProp, SourceExpressionIR } from './source-expression.types';
|
|
5
|
+
import { QueryProgramProp, SourceExpressionIR, SourceFieldDefinition } from './source-expression.types';
|
|
6
6
|
/** Поддерживаемые kind query source v1. */
|
|
7
7
|
export type QuerySourceKind = 'rest';
|
|
8
8
|
/** Static request value or a safe expression evaluated from Query props at runtime. */
|
|
@@ -45,6 +45,7 @@ export interface QuerySourceOutput {
|
|
|
45
45
|
key: string;
|
|
46
46
|
source: QueryOutputSource;
|
|
47
47
|
dataViews: DataViewRef[];
|
|
48
|
+
contract?: SourceFieldDefinition | null;
|
|
48
49
|
}
|
|
49
50
|
export type QuerySourceOutputs = QuerySourceOutput[];
|
|
50
51
|
/** Canonical authoring-модель source-only Query v2. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Канонический тип source-документа, для которого выбирается source strategy. */
|
|
2
|
-
export type SourceKind = 'query' | 'data-view' | 'filter' | 'composition' | 'store' | 'computation' | 'style' | 'type';
|
|
2
|
+
export type SourceKind = 'query' | 'data-view' | 'filter' | 'composition' | 'store' | 'stream' | 'update' | 'computation' | 'style' | 'type';
|
|
3
3
|
/** Тип нейтральной source completion без привязки к Monaco или другому editor API. */
|
|
4
4
|
export type SourceLanguageCompletionKind = 'keyword' | 'function' | 'property' | 'value' | 'snippet';
|
|
5
5
|
/** Позиция курсора внутри source-документа. */
|
|
@@ -38,7 +38,7 @@ export interface SourceLanguageCompletion {
|
|
|
38
38
|
documentation?: string;
|
|
39
39
|
}
|
|
40
40
|
/** Логический тип внешнего доменного документа, на который ссылается source. */
|
|
41
|
-
export type SourceDocumentReferenceTarget = 'auth-profile' | 'component' | 'composition' | 'computation' | 'converter' | 'data-view' | 'filter' | 'mock' | 'query' | 'store' | 'style' | 'type' | 'vocabs';
|
|
41
|
+
export type SourceDocumentReferenceTarget = 'auth-profile' | 'component' | 'composition' | 'computation' | 'converter' | 'data-view' | 'filter' | 'mock' | 'query' | 'store' | 'stream' | 'update' | 'style' | 'type' | 'vocabs';
|
|
42
42
|
/** Семантическая ссылка из source на внешний доменный документ. */
|
|
43
43
|
export interface SourceDocumentReference {
|
|
44
44
|
/** Логический тип цели; UI может уточнить concrete document type через domain. */
|
|
@@ -4,7 +4,7 @@ export type SourceFieldType = 'String' | 'Number' | 'Boolean' | 'Date' | 'Time'
|
|
|
4
4
|
/** Источник безопасного чтения значения внутри source expression. */
|
|
5
5
|
export type SourceExpressionReadKind = 'env' | 'prop' | 'value' | 'row' | 'response' | 'store' | 'current' | 'scope' | 'composition-output' | 'composition-outputs' | 'composition-data' | 'composition-store' | 'composition-filter-fields' | 'composition-runtime-metadata' | 'metadata' | 'computation-output';
|
|
6
6
|
/** Whitelist операций статического expression IR. */
|
|
7
|
-
export type SourceExpressionOperation = 'merge' | 'compact' | 'get' | 'get-or' | 'has' | 'default-to' | 'pick' | 'omit' | 'defaults' | 'keys' | 'values' | 'entries' | 'map' | 'where' | 'reject' | 'find' | 'some' | 'every' | 'flat-map' | 'flatten' | 'uniq' | 'uniq-by' | 'concat' | 'take' | 'drop' | 'sort-by' | 'group-by' | 'key-by' | 'size' | 'sum' | 'sum-by' | 'min' | 'max' | 'min-by' | 'max-by' | 'trim' | 'lower-case' | 'upper-case' | 'split' | 'join' | 'match' | 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'includes' | 'or' | 'when' | 'not' | 'is-nil' | 'is-empty' | 'and' | 'between' | 'in-list' | 'in-array' | 'relative-date' | 'relative-date-time' | 'left-join' | 'full-join' | 'join-by' | 'join-by-any' | 'join-coalesce' | 'lookup-one' | 'lookup-many' | 'enrich';
|
|
7
|
+
export type SourceExpressionOperation = 'merge' | 'compact' | 'get' | 'get-or' | 'has' | 'default-to' | 'pick' | 'omit' | 'defaults' | 'keys' | 'values' | 'entries' | 'map' | 'where' | 'reject' | 'find' | 'some' | 'every' | 'flat-map' | 'flatten' | 'uniq' | 'uniq-by' | 'concat' | 'take' | 'drop' | 'sort-by' | 'group-by' | 'key-by' | 'size' | 'sum' | 'sum-by' | 'min' | 'max' | 'min-by' | 'max-by' | 'trim' | 'lower-case' | 'upper-case' | 'split' | 'join' | 'match' | 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'includes' | 'or' | 'when' | 'not' | 'is-nil' | 'is-empty' | 'and' | 'between' | 'in-list' | 'in-array' | 'relative-date' | 'relative-date-time' | 'left-join' | 'full-join' | 'join-by' | 'join-by-any' | 'join-coalesce' | 'lookup-one' | 'lookup-many' | 'enrich' | 'coalesce' | 'choose' | 'lookup-value' | 'to-string' | 'to-number' | 'to-boolean' | 'type-of' | 'is-string' | 'is-number' | 'is-boolean' | 'is-array' | 'is-object' | 'is-date-time' | 'is-duration' | 'add' | 'subtract' | 'multiply' | 'divide' | 'modulo' | 'abs' | 'negate' | 'round' | 'floor' | 'ceil' | 'clamp' | 'average' | 'average-by' | 'starts-with' | 'ends-with' | 'replace' | 'replace-all' | 'slice' | 'pad-start' | 'pad-end' | 'normalize-whitespace' | 'set' | 'unset' | 'rename' | 'get-key' | 'from-entries' | 'first' | 'last' | 'at' | 'reverse' | 'sort-by-desc' | 'order-by' | 'chunk' | 'union' | 'intersection' | 'difference' | 'count-by' | 'date-time' | 'duration' | 'date-time-add' | 'date-time-subtract' | 'date-time-difference' | 'date-time-start-of' | 'date-time-end-of' | 'date-time-part' | 'duration-add' | 'duration-subtract' | 'duration-total' | 'contains-all' | 'contains-any';
|
|
8
8
|
/**
|
|
9
9
|
* Безопасное runtime-выражение, полученное из source callback.
|
|
10
10
|
*
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ProgramDiagnostic } from '../program/program.types';
|
|
2
2
|
import { EndgeMockReference } from '../mock';
|
|
3
3
|
import { DataViewRef } from './data-view-source.types';
|
|
4
|
+
import { SourceFieldDefinition } from './source-expression.types';
|
|
4
5
|
export type StoreDataDescriptor = StoreValueDescriptor | StoreDerivedDescriptor;
|
|
5
6
|
export interface StoreValueDescriptor {
|
|
6
7
|
key: string;
|
|
7
8
|
kind: 'value';
|
|
8
9
|
initial: StoreValueInitializer;
|
|
10
|
+
contract?: SourceFieldDefinition | null;
|
|
9
11
|
}
|
|
10
12
|
export type StoreValueInitializer = {
|
|
11
13
|
kind: 'literal';
|
|
@@ -16,14 +18,21 @@ export interface StoreDerivedDescriptor {
|
|
|
16
18
|
kind: 'derived';
|
|
17
19
|
source: string;
|
|
18
20
|
dataViews: DataViewRef[];
|
|
21
|
+
contract?: SourceFieldDefinition | null;
|
|
19
22
|
}
|
|
20
23
|
export interface StoreSourceDocument {
|
|
21
24
|
data: StoreDataDescriptor[];
|
|
22
25
|
}
|
|
26
|
+
/** Скомпилированная таблица маршрутизации событий к дочерним Update. */
|
|
27
|
+
export interface StoreUpdateHandlerDescriptor {
|
|
28
|
+
identity: string;
|
|
29
|
+
eventTypes: string[];
|
|
30
|
+
}
|
|
23
31
|
/** Runtime-ready Store source artifact v1. */
|
|
24
32
|
export interface StoreSourceArtifact extends StoreSourceDocument {
|
|
25
33
|
type: 'store';
|
|
26
34
|
sourceVersion: number;
|
|
35
|
+
updateHandlers: StoreUpdateHandlerDescriptor[];
|
|
27
36
|
}
|
|
28
37
|
export interface StoreSourceCompileResult {
|
|
29
38
|
ast: unknown | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ProgramDiagnostic } from '../program/program.types';
|
|
2
|
+
export interface StreamSseTransportDescriptor {
|
|
3
|
+
kind: 'sse';
|
|
4
|
+
url: string;
|
|
5
|
+
withCredentials: boolean;
|
|
6
|
+
authMode: 'inherit' | 'none';
|
|
7
|
+
}
|
|
8
|
+
export type StreamTransportDescriptor = StreamSseTransportDescriptor;
|
|
9
|
+
export interface StreamEventDescriptor {
|
|
10
|
+
sourceEvent: string;
|
|
11
|
+
type: string | null;
|
|
12
|
+
typePath: string | null;
|
|
13
|
+
payloadPath: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface StreamSourceDocument {
|
|
16
|
+
transport: StreamTransportDescriptor;
|
|
17
|
+
events: StreamEventDescriptor[];
|
|
18
|
+
}
|
|
19
|
+
/** Runtime-ready Stream artifact. */
|
|
20
|
+
export interface StreamSourceArtifact extends StreamSourceDocument {
|
|
21
|
+
type: 'stream';
|
|
22
|
+
sourceVersion: number;
|
|
23
|
+
}
|
|
24
|
+
export interface StreamSourceCompileResult {
|
|
25
|
+
ast: unknown | null;
|
|
26
|
+
document: StreamSourceDocument | null;
|
|
27
|
+
artifact: StreamSourceArtifact | null;
|
|
28
|
+
diagnostics: Omit<ProgramDiagnostic, 'entityRef'>[];
|
|
29
|
+
}
|
|
30
|
+
export interface StreamEventEnvelope {
|
|
31
|
+
type: string;
|
|
32
|
+
payload: unknown;
|
|
33
|
+
meta: {
|
|
34
|
+
id: string | null;
|
|
35
|
+
source: string;
|
|
36
|
+
sourceEvent: string;
|
|
37
|
+
occurredAt: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ProgramDiagnostic } from '../program/program.types';
|
|
2
|
+
export type UpdateMutationStrategy = 'set' | 'merge' | 'replace' | 'append' | 'remove';
|
|
3
|
+
export interface UpdateMutationDescriptor {
|
|
4
|
+
strategy: UpdateMutationStrategy;
|
|
5
|
+
target: string;
|
|
6
|
+
forEach: string | null;
|
|
7
|
+
ifExists: string | null;
|
|
8
|
+
valueFrom: string | null;
|
|
9
|
+
vars: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
export interface UpdateSourceDocument {
|
|
12
|
+
handles: string[];
|
|
13
|
+
mutations: UpdateMutationDescriptor[];
|
|
14
|
+
}
|
|
15
|
+
/** Runtime-ready Update artifact, always scoped to its owner Store. */
|
|
16
|
+
export interface UpdateSourceArtifact extends UpdateSourceDocument {
|
|
17
|
+
type: 'update';
|
|
18
|
+
sourceVersion: number;
|
|
19
|
+
storeIdentity: string;
|
|
20
|
+
}
|
|
21
|
+
export interface UpdateSourceCompileResult {
|
|
22
|
+
ast: unknown | null;
|
|
23
|
+
document: UpdateSourceDocument | null;
|
|
24
|
+
artifact: Omit<UpdateSourceArtifact, 'storeIdentity'> | null;
|
|
25
|
+
diagnostics: Omit<ProgramDiagnostic, 'entityRef'>[];
|
|
26
|
+
}
|
|
27
|
+
export interface StoreMutationPlan {
|
|
28
|
+
strategy: UpdateMutationStrategy;
|
|
29
|
+
path: string;
|
|
30
|
+
value?: unknown;
|
|
31
|
+
vars?: Record<string, unknown>;
|
|
32
|
+
}
|