@endge/core 1.0.0-dev.5 → 1.2.0-dev.15
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/README.md +46 -0
- package/dist/core.js +60726 -47416
- package/dist/features/core/kernel/config/kernel.config.d.ts +1 -1
- package/dist/features/core/kernel/config/modules.config.d.ts +7 -7
- package/dist/features/core/kernel/endge.d.ts +9 -9
- package/dist/features/core/modules/actions/domain/action.types.d.ts +2 -0
- package/dist/features/core/modules/auth/EndgeAuth_Module.d.ts +9 -1
- package/dist/features/core/modules/auth/domain/types/auth-profile.types.d.ts +17 -0
- package/dist/features/core/modules/auth/services/auth-facet-claims.d.ts +5 -0
- package/dist/features/core/modules/compiler/EndgeCompiler_Module.d.ts +10 -0
- package/dist/features/core/modules/compiler/tools/select-type-context.d.ts +1 -0
- package/dist/features/core/modules/computations/model/ComputationResource.d.ts +1 -0
- package/dist/features/core/modules/context/domain/context-persistence.types.d.ts +1 -0
- package/dist/features/core/modules/document-import/services/parsers/GraphQLDocumentImportParser.d.ts +3 -2
- package/dist/features/core/modules/domain/types/component/component-core.types.d.ts +4 -0
- package/dist/features/core/modules/domain/types/component/sfc/table-events.types.d.ts +18 -0
- package/dist/features/core/modules/program/EndgeProgram_Module.d.ts +4 -0
- package/dist/features/core/modules/program/domain/types/execution-bundle.types.d.ts +7 -0
- package/dist/features/core/modules/program/domain/types/program.types.d.ts +5 -2
- package/dist/features/core/modules/program/tools/execution-bundle.d.ts +2 -1
- package/dist/features/core/modules/program/tools/startup-bundle.d.ts +2 -0
- package/dist/features/core/modules/runtime/EndgeControllers_Module.d.ts +26 -0
- package/dist/features/core/modules/runtime/EndgeRuntime_Module.d.ts +2 -0
- package/dist/features/core/modules/runtime/adapters/QueryExecutor_Adapter.d.ts +42 -3
- package/dist/features/core/modules/runtime/domain/controllers/controller.types.d.ts +121 -0
- package/dist/features/core/modules/runtime/domain/controllers/page-cache.types.d.ts +41 -0
- package/dist/features/core/modules/runtime/domain/graphql-query-error.d.ts +73 -0
- package/dist/features/core/modules/runtime/domain/query-execution.types.d.ts +25 -1
- package/dist/features/core/modules/runtime/domain/runtime-entity-map.types.d.ts +2 -0
- package/dist/features/core/modules/runtime/domain/runtime-host.types.d.ts +1 -0
- package/dist/features/core/modules/runtime/domain/runtime.types.d.ts +3 -2
- package/dist/features/core/modules/runtime/domain/stream-runtime.types.d.ts +8 -1
- package/dist/features/core/modules/runtime/execution/endge-data-view.d.ts +1 -1
- package/dist/features/core/modules/runtime/execution/endge-query.d.ts +21 -2
- package/dist/features/core/modules/runtime/hosts/CompositionRuntimeHost.d.ts +9 -0
- package/dist/features/core/modules/runtime/hosts/ControllerRuntimeHost.d.ts +64 -0
- package/dist/features/core/modules/runtime/hosts/QueryRuntimeHost.d.ts +9 -1
- package/dist/features/core/modules/runtime/hosts/SimulationRuntimeHost.d.ts +1 -0
- package/dist/features/core/modules/runtime/hosts/StoreRuntimeHost.d.ts +1 -0
- package/dist/features/core/modules/runtime/hosts/StreamRuntimeHost.d.ts +30 -0
- package/dist/features/core/modules/runtime/services/controllers/ControllerRegistry.d.ts +16 -0
- package/dist/features/core/modules/runtime/services/controllers/builtins/CollectionWindowController.d.ts +56 -0
- package/dist/features/core/modules/runtime/services/controllers/builtins/collection-window.definition.d.ts +2 -0
- package/dist/features/core/modules/runtime/services/controllers/cache/PageCacheService.d.ts +25 -0
- package/dist/features/core/modules/runtime/services/controllers/controller-values.d.ts +3 -0
- package/dist/features/core/modules/runtime/services/simulation/prepare-simulation-overrides.d.ts +7 -5
- package/dist/features/core/modules/runtime/services/strategies/ControllerRuntimeStrategy.d.ts +11 -0
- package/dist/features/core/modules/runtime/services/transports/BrowserGraphQLSseStreamTransportFactory.d.ts +24 -0
- package/dist/features/core/modules/runtime/services/transports/BrowserSseStreamTransportFactory.d.ts +13 -1
- package/dist/features/core/modules/source/EndgeSource_Module.d.ts +6 -0
- package/dist/features/core/modules/source/domain/types/composition-source.types.d.ts +13 -2
- package/dist/features/core/modules/source/domain/types/data-view-source.types.d.ts +5 -2
- package/dist/features/core/modules/source/domain/types/graphql-fragments.types.d.ts +17 -0
- package/dist/features/core/modules/source/domain/types/query-source.types.d.ts +4 -1
- package/dist/features/core/modules/source/domain/types/simulation-source.types.d.ts +8 -0
- package/dist/features/core/modules/source/domain/types/source-context.types.d.ts +6 -0
- package/dist/features/core/modules/source/domain/types/source-engine.types.d.ts +3 -0
- package/dist/features/core/modules/source/domain/types/source-expression.types.d.ts +3 -1
- package/dist/features/core/modules/source/domain/types/stream-source.types.d.ts +29 -1
- package/dist/features/core/modules/source/domain/types/type-source.types.d.ts +11 -6
- package/dist/features/core/modules/source/services/SimulationSourceResolver.d.ts +6 -0
- package/dist/features/core/modules/source/services/compilers/graphql-operation-compile.d.ts +52 -0
- package/dist/features/core/modules/source/services/compilers/source-expression-compile.d.ts +21 -0
- package/dist/features/core/modules/source/services/compilers/source-model-reference-compile.d.ts +11 -1
- package/dist/features/core/modules/source/services/composition-activation.d.ts +6 -1
- package/dist/features/core/modules/source/services/graphql-fragments.d.ts +23 -0
- package/dist/features/core/modules/source/services/graphql-schema.d.ts +37 -0
- package/dist/features/core/modules/source/services/simulation-response-contract.d.ts +23 -0
- package/dist/features/core/modules/source/services/source-context.d.ts +13 -0
- package/dist/features/core/modules/source/services/type-extends.d.ts +15 -0
- package/dist/features/core/modules/source/services/value-expression-language.d.ts +2 -0
- package/dist/features/core/modules/source/services/value-path.d.ts +14 -0
- package/dist/features/core/modules/ui/EndgeUIRegistry_Module.d.ts +5 -0
- package/dist/features/core/modules/ui/adapters/json/EndgeUIJsonRenderer.d.ts +57 -0
- package/dist/features/core/modules/ui/adapters/json/endge-ui-json-adapter.d.ts +16 -0
- package/dist/features/core/modules/ui/adapters/json/endge-ui-json-patch.d.ts +3 -0
- package/dist/features/core/modules/ui/adapters/json/endge-ui-json.schema.d.ts +371 -0
- package/dist/features/core/modules/ui/domain/types/endge-ui-json.types.d.ts +121 -0
- package/dist/features/core/modules/ui/registry/UIAdapterRegistry.d.ts +2 -0
- package/dist/features/federation/EndgeFederation.d.ts +1 -133
- package/dist/features/federation/EndgeModule.d.ts +1 -58
- package/dist/features/federation/constants/federation.constants.d.ts +1 -1
- package/dist/features/federation/tools/sort-endge-modules.d.ts +1 -9
- package/dist/features/federation/types/endge-modules.types.d.ts +1 -28
- package/dist/features/federation/types/federation.types.d.ts +1 -112
- package/dist/main.d.ts +15 -0
- package/package.json +9 -5
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { StoreRuntimeHost } from '../../hosts/StoreRuntimeHost';
|
|
2
|
+
import { RuntimeParentRef } from '../runtime-execute.type';
|
|
3
|
+
import { ControllerPageCache, PageCacheOptions } from './page-cache.types';
|
|
4
|
+
import { EntityOrigin } from '../../../domain/types/document/entity-management.type';
|
|
5
|
+
import { SourceFieldDefinition } from '../../../source/domain/types/source-expression.types';
|
|
6
|
+
export interface ControllerContract {
|
|
7
|
+
props: SourceFieldDefinition[];
|
|
8
|
+
outputs: SourceFieldDefinition[];
|
|
9
|
+
commands: Record<string, {
|
|
10
|
+
input?: SourceFieldDefinition;
|
|
11
|
+
output?: SourceFieldDefinition;
|
|
12
|
+
}>;
|
|
13
|
+
dependencies: Record<string, {
|
|
14
|
+
kind: 'store' | 'query';
|
|
15
|
+
optional?: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export interface ControllerDefinition {
|
|
19
|
+
identity: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
origin: EntityOrigin;
|
|
22
|
+
catalogPath?: string[];
|
|
23
|
+
contract: ControllerContract;
|
|
24
|
+
defaultProviderKey: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ControllerModel {
|
|
27
|
+
type: 'controller';
|
|
28
|
+
id: string;
|
|
29
|
+
identity: string;
|
|
30
|
+
name: string;
|
|
31
|
+
}
|
|
32
|
+
export type ControllerDependencyBinding = {
|
|
33
|
+
store: string;
|
|
34
|
+
path: string;
|
|
35
|
+
update: string;
|
|
36
|
+
} | {
|
|
37
|
+
query: string;
|
|
38
|
+
output: string;
|
|
39
|
+
cache?: PageCacheOptions;
|
|
40
|
+
};
|
|
41
|
+
export type ControllerDependencyBindings = Record<string, ControllerDependencyBinding>;
|
|
42
|
+
export interface ControllerStateDependency {
|
|
43
|
+
kind: 'store';
|
|
44
|
+
read: () => unknown;
|
|
45
|
+
commit: (next: Record<string, unknown>, expectedRevision: number) => void;
|
|
46
|
+
subscribe: (listener: () => void) => () => void;
|
|
47
|
+
}
|
|
48
|
+
export interface ControllerQueryDependency {
|
|
49
|
+
kind: 'query';
|
|
50
|
+
cache?: ControllerPageCache;
|
|
51
|
+
run: (input: Record<string, unknown>, signal: AbortSignal) => Promise<unknown>;
|
|
52
|
+
}
|
|
53
|
+
export type ControllerDependency = ControllerStateDependency | ControllerQueryDependency;
|
|
54
|
+
export interface ControllerContext {
|
|
55
|
+
readonly props: Readonly<Record<string, unknown>>;
|
|
56
|
+
readonly signal: AbortSignal;
|
|
57
|
+
readonly dependencies: Readonly<Record<string, ControllerDependency>>;
|
|
58
|
+
publish: (outputs: Record<string, unknown>) => void;
|
|
59
|
+
}
|
|
60
|
+
export interface ControllerInstance {
|
|
61
|
+
start?: (context: ControllerContext) => void | Promise<void>;
|
|
62
|
+
setProps?: (props: Readonly<Record<string, unknown>>, context: ControllerContext) => void | Promise<void>;
|
|
63
|
+
command: (name: string, input: unknown, context: ControllerContext) => unknown | Promise<unknown>;
|
|
64
|
+
pause?: () => void | Promise<void>;
|
|
65
|
+
resume?: (context: ControllerContext) => void | Promise<void>;
|
|
66
|
+
destroy?: () => void | Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
export interface ControllerProvider {
|
|
69
|
+
identity: string;
|
|
70
|
+
key: string;
|
|
71
|
+
create: (context: ControllerContext) => ControllerInstance;
|
|
72
|
+
}
|
|
73
|
+
export interface ControllerMountOptions {
|
|
74
|
+
owner: RuntimeParentRef;
|
|
75
|
+
props?: Record<string, unknown>;
|
|
76
|
+
dependencies?: Record<string, {
|
|
77
|
+
store: StoreRuntimeHost;
|
|
78
|
+
path: string;
|
|
79
|
+
update: string;
|
|
80
|
+
} | {
|
|
81
|
+
query: string;
|
|
82
|
+
output: string;
|
|
83
|
+
cache?: PageCacheOptions;
|
|
84
|
+
}>;
|
|
85
|
+
instanceId?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ControllerProgramPayload {
|
|
88
|
+
type: 'controller';
|
|
89
|
+
sourceVersion: 1;
|
|
90
|
+
definition: ControllerDefinition;
|
|
91
|
+
}
|
|
92
|
+
export interface CollectionWindowViewport {
|
|
93
|
+
rowsRevision: number;
|
|
94
|
+
firstVisible: {
|
|
95
|
+
key: string | number;
|
|
96
|
+
index: number;
|
|
97
|
+
} | null;
|
|
98
|
+
lastVisible: {
|
|
99
|
+
key: string | number;
|
|
100
|
+
index: number;
|
|
101
|
+
} | null;
|
|
102
|
+
rowCount: number;
|
|
103
|
+
reason?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface CollectionWindowBlock {
|
|
106
|
+
pageId?: string;
|
|
107
|
+
rows: Record<string, unknown>[];
|
|
108
|
+
startCursor?: string | null;
|
|
109
|
+
endCursor?: string | null;
|
|
110
|
+
offset?: number;
|
|
111
|
+
total?: number;
|
|
112
|
+
sourceCount?: number;
|
|
113
|
+
hasBefore: boolean;
|
|
114
|
+
hasAfter: boolean;
|
|
115
|
+
}
|
|
116
|
+
export interface CollectionWindowState {
|
|
117
|
+
revision: number;
|
|
118
|
+
rowsRevision: number;
|
|
119
|
+
blocks: CollectionWindowBlock[];
|
|
120
|
+
[key: string]: unknown;
|
|
121
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface PageCacheOptions {
|
|
2
|
+
key: string;
|
|
3
|
+
storage: 'memory' | 'indexeddb';
|
|
4
|
+
strategy?: 'cache-first' | 'network-first' | 'stale-while-revalidate';
|
|
5
|
+
maxAgeMs?: number;
|
|
6
|
+
maxStaleMs?: number;
|
|
7
|
+
onError?: 'fail' | 'use-cache';
|
|
8
|
+
maxEntries?: number;
|
|
9
|
+
maxBytes?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface PageCacheEntry {
|
|
12
|
+
version: 1;
|
|
13
|
+
value: unknown;
|
|
14
|
+
storedAt: number;
|
|
15
|
+
bytes: number;
|
|
16
|
+
epoch: number;
|
|
17
|
+
}
|
|
18
|
+
export interface PageCacheStatus {
|
|
19
|
+
source: 'memory' | 'indexeddb' | 'network' | null;
|
|
20
|
+
stale: boolean;
|
|
21
|
+
revalidating: boolean;
|
|
22
|
+
hits: number;
|
|
23
|
+
misses: number;
|
|
24
|
+
evictions: number;
|
|
25
|
+
entries: number;
|
|
26
|
+
bytes: number;
|
|
27
|
+
pendingWrites: number;
|
|
28
|
+
pendingBytes: number;
|
|
29
|
+
error: string | null;
|
|
30
|
+
invalidated: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface ControllerPageCache {
|
|
33
|
+
readonly options: Required<PageCacheOptions>;
|
|
34
|
+
select: (selection: Record<string, unknown>) => Promise<void>;
|
|
35
|
+
read: (request: Record<string, unknown>) => Promise<PageCacheEntry | undefined>;
|
|
36
|
+
write: (request: Record<string, unknown>, value: unknown, requestedAt?: number) => Promise<void>;
|
|
37
|
+
clear: (structuralChange?: boolean) => Promise<void>;
|
|
38
|
+
status: () => PageCacheStatus;
|
|
39
|
+
subscribe: (listener: () => void) => () => void;
|
|
40
|
+
}
|
|
41
|
+
export declare function normalizePageCacheOptions(value: unknown): Required<PageCacheOptions>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { QueryGraphQLErrorPolicy } from '../../source/domain/types/query-source.types';
|
|
2
|
+
export interface GraphQLResponseErrorLocation {
|
|
3
|
+
line: number;
|
|
4
|
+
column: number;
|
|
5
|
+
}
|
|
6
|
+
export interface GraphQLResponseError {
|
|
7
|
+
message: string;
|
|
8
|
+
path?: ReadonlyArray<string | number>;
|
|
9
|
+
locations?: ReadonlyArray<GraphQLResponseErrorLocation>;
|
|
10
|
+
extensions?: Record<string, unknown>;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface GraphQLQueryErrorRequest {
|
|
14
|
+
url: string;
|
|
15
|
+
operationName?: string;
|
|
16
|
+
status?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Ошибка GraphQL Query при errorPolicy: 'throw': ответ HTTP 2xx содержит errors.
|
|
20
|
+
* Хранит полные errors и частичные data ответа.
|
|
21
|
+
*/
|
|
22
|
+
export declare class GraphQLQueryError extends Error {
|
|
23
|
+
readonly code = "graphql_query_error";
|
|
24
|
+
readonly errors: readonly GraphQLResponseError[];
|
|
25
|
+
readonly data: unknown;
|
|
26
|
+
readonly url: string;
|
|
27
|
+
readonly operationName?: string;
|
|
28
|
+
readonly status?: number;
|
|
29
|
+
constructor(errors: readonly GraphQLResponseError[], data: unknown, request: GraphQLQueryErrorRequest);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Ответ GraphQL endpoint с HTTP 2xx не является JSON-объектом GraphQL response.
|
|
33
|
+
*/
|
|
34
|
+
export declare class GraphQLResponseFormatError extends Error {
|
|
35
|
+
readonly code = "graphql_response_format_error";
|
|
36
|
+
readonly reason: string;
|
|
37
|
+
readonly url: string;
|
|
38
|
+
readonly operationName?: string;
|
|
39
|
+
readonly status?: number;
|
|
40
|
+
readonly contentType?: string;
|
|
41
|
+
constructor(reason: string, request: GraphQLQueryErrorRequest & {
|
|
42
|
+
contentType?: string;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export declare function formatGraphQLResponseErrors(errors: readonly GraphQLResponseError[]): string;
|
|
46
|
+
export interface GraphQLExecutionResult {
|
|
47
|
+
data: unknown;
|
|
48
|
+
errors: GraphQLResponseError[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Проверяет оболочку GraphQL ExecutionResult (ответ Query или событие next подписки):
|
|
52
|
+
* JSON-объект с data и/или массивом errors. Иначе выбрасывает GraphQLResponseFormatError.
|
|
53
|
+
*/
|
|
54
|
+
export declare function readGraphQLExecutionResult(body: unknown, request: GraphQLQueryErrorRequest & {
|
|
55
|
+
contentType?: string;
|
|
56
|
+
}): GraphQLExecutionResult;
|
|
57
|
+
export declare function normalizeGraphQLResponseError(error: unknown): GraphQLResponseError;
|
|
58
|
+
export type GraphQLNextRouting = {
|
|
59
|
+
kind: 'publish';
|
|
60
|
+
data: unknown;
|
|
61
|
+
graphQLErrors?: GraphQLResponseError[];
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'error';
|
|
64
|
+
error: GraphQLQueryError;
|
|
65
|
+
} | {
|
|
66
|
+
kind: 'skip';
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* errorPolicy события next (транспорт graphqlSse и mockStream Simulation):
|
|
70
|
+
* без errors публикуется data; 'throw' — GraphQLQueryError с частичными data;
|
|
71
|
+
* 'ignore' — data без errors; 'all' — data и errors (без data — только errors для diagnostics).
|
|
72
|
+
*/
|
|
73
|
+
export declare function routeGraphQLNextResult(result: GraphQLExecutionResult, errorPolicy: QueryGraphQLErrorPolicy, request: GraphQLQueryErrorRequest): GraphQLNextRouting;
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import { QueryProgramPayload } from '../../program/domain/types/program.types';
|
|
2
|
-
|
|
2
|
+
import { GraphQLResponseError } from './graphql-query-error';
|
|
3
|
+
export interface QueryExecutionRequest {
|
|
4
|
+
protocol: 'REST' | 'GraphQL';
|
|
5
|
+
method: string;
|
|
6
|
+
url: string;
|
|
7
|
+
headers: Record<string, string>;
|
|
8
|
+
params: Record<string, unknown>;
|
|
9
|
+
body?: unknown;
|
|
10
|
+
operationName?: string;
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
authHeaders: string[];
|
|
13
|
+
authParams: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface QueryExecutionResponse {
|
|
16
|
+
status?: number;
|
|
17
|
+
statusText?: string;
|
|
18
|
+
headers: Record<string, string>;
|
|
19
|
+
data: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface QueryExecutionObserver {
|
|
22
|
+
onRequest?: (request: QueryExecutionRequest) => void;
|
|
23
|
+
onResponse?: (response: QueryExecutionResponse) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface QueryExecutionContext extends QueryExecutionObserver {
|
|
3
26
|
payload: QueryProgramPayload;
|
|
4
27
|
vars?: Record<string, unknown>;
|
|
5
28
|
signal?: AbortSignal;
|
|
29
|
+
onGraphQLErrors?: (errors: readonly GraphQLResponseError[]) => void;
|
|
6
30
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ControllerModel } from './controllers/controller.types';
|
|
1
2
|
import { RAction } from '../../domain/entities/RAction';
|
|
2
3
|
import { RComponentSFC } from '../../domain/entities/RComponentSFC';
|
|
3
4
|
import { RComposition } from '../../domain/entities/RComposition';
|
|
@@ -8,6 +9,7 @@ import { RSimulation } from '../../domain/entities/RSimulation';
|
|
|
8
9
|
import { RStore } from '../../domain/entities/RStore';
|
|
9
10
|
import { RStream } from '../../domain/entities/RStream';
|
|
10
11
|
export interface RuntimeEntityModelMap {
|
|
12
|
+
'controller': ControllerModel;
|
|
11
13
|
'simulation': RSimulation;
|
|
12
14
|
'page': RPage;
|
|
13
15
|
'component-sfc': RComponentSFC;
|
|
@@ -61,6 +61,7 @@ export interface PageRuntimeHostContext extends RuntimeHostContextBase {
|
|
|
61
61
|
lastRenderAt: string | null;
|
|
62
62
|
}
|
|
63
63
|
export interface RuntimeHostContextMap {
|
|
64
|
+
'controller': RuntimeHostContextBase;
|
|
64
65
|
'simulation': RuntimeHostContextBase;
|
|
65
66
|
'action': ActionRuntimeHostContext;
|
|
66
67
|
'query': QueryRuntimeHostContext;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ControllerModel } from './controllers/controller.types';
|
|
1
2
|
import { RAction } from '../../domain/entities/RAction';
|
|
2
3
|
import { RComponentSFC } from '../../domain/entities/RComponentSFC';
|
|
3
4
|
import { RComposition } from '../../domain/entities/RComposition';
|
|
@@ -8,8 +9,8 @@ import { RSimulation } from '../../domain/entities/RSimulation';
|
|
|
8
9
|
import { RStore } from '../../domain/entities/RStore';
|
|
9
10
|
import { RStream } from '../../domain/entities/RStream';
|
|
10
11
|
import { RuntimeHostRegistrySnapshot } from './runtime-registry.types';
|
|
11
|
-
export type RuntimeKind = 'query' | 'filter' | 'composition' | 'store' | 'stream' | 'action' | 'simulation' | 'runtime';
|
|
12
|
-
export type RuntimeExecutableModel = RQuery | RAction | RPage | RComponentSFC | RFilter | RComposition | RStore | RStream | RSimulation;
|
|
12
|
+
export type RuntimeKind = 'controller' | 'query' | 'filter' | 'composition' | 'store' | 'stream' | 'action' | 'simulation' | 'runtime';
|
|
13
|
+
export type RuntimeExecutableModel = ControllerModel | RQuery | RAction | RPage | RComponentSFC | RFilter | RComposition | RStore | RStream | RSimulation;
|
|
13
14
|
export interface EndgeRuntimeSnapshot extends RuntimeHostRegistrySnapshot {
|
|
14
15
|
generatedAt: number;
|
|
15
16
|
scopes: import('./runtime-scope.types').RuntimeScopeSnapshot[];
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
+
import { GraphQLResponseError } from './graphql-query-error';
|
|
1
2
|
import { StreamSourceArtifact } from '../../source/domain/types/stream-source.types';
|
|
2
3
|
export interface StreamTransportMessage {
|
|
3
4
|
sourceEvent: string;
|
|
4
5
|
id: string | null;
|
|
5
6
|
data: unknown;
|
|
7
|
+
graphQLErrors?: readonly GraphQLResponseError[];
|
|
6
8
|
}
|
|
7
9
|
export interface StreamTransportConnection {
|
|
8
10
|
close: () => void | Promise<void>;
|
|
9
11
|
pause?: () => Promise<void>;
|
|
10
12
|
resume?: () => Promise<void>;
|
|
11
13
|
}
|
|
14
|
+
export interface StreamTransportRequest {
|
|
15
|
+
variables?: Record<string, unknown>;
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
extensions?: Record<string, unknown>;
|
|
18
|
+
}
|
|
12
19
|
export interface StreamTransportFactory {
|
|
13
20
|
open: (artifact: StreamSourceArtifact, callbacks: {
|
|
14
21
|
message: (message: StreamTransportMessage) => void;
|
|
15
22
|
error: (error: unknown) => void;
|
|
16
23
|
open: () => void;
|
|
17
|
-
}) => StreamTransportConnection;
|
|
24
|
+
}, request?: StreamTransportRequest) => StreamTransportConnection;
|
|
18
25
|
}
|
|
@@ -97,7 +97,7 @@ export declare class EndgeDataView {
|
|
|
97
97
|
*/
|
|
98
98
|
convert(identity: string, value: unknown, options?: Record<string, unknown>): unknown;
|
|
99
99
|
/**
|
|
100
|
-
* Читает
|
|
100
|
+
* Читает путь value DSL (точечный или DataPath Raph) из object/array без выбрасывания ошибок.
|
|
101
101
|
*/
|
|
102
102
|
private _path;
|
|
103
103
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { RQuery } from '../../domain/entities/RQuery';
|
|
2
2
|
import { QueryProgramPayload } from '../../program/domain/types/program.types';
|
|
3
|
+
import { GraphQLResponseError } from '../domain/graphql-query-error';
|
|
4
|
+
import { QueryExecutionContext, QueryExecutionObserver } from '../domain/query-execution.types';
|
|
3
5
|
import { RuntimeParentRef } from '../domain/runtime-execute.type';
|
|
4
6
|
import { QueryExecutor_Adapter } from '../adapters/QueryExecutor_Adapter';
|
|
5
7
|
/**
|
|
@@ -13,8 +15,13 @@ export declare class EndgeQuery {
|
|
|
13
15
|
constructor(executor?: QueryExecutor_Adapter);
|
|
14
16
|
/**
|
|
15
17
|
* Выполняет query через compiled artifact и сохраняет результат в Raph.
|
|
18
|
+
* observer видит итоговый HTTP-запрос и ответ (например, для панели запуска в IDE).
|
|
16
19
|
*/
|
|
17
|
-
run(query: RQuery, params?: Record<string, unknown>, parent?: RuntimeParentRef | null
|
|
20
|
+
run(query: RQuery, params?: Record<string, unknown>, parent?: RuntimeParentRef | null, options?: {
|
|
21
|
+
observer?: QueryExecutionObserver;
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
artifactReader?: import('../domain/runtime-host.types').RuntimeArtifactReader;
|
|
24
|
+
}): Promise<any>;
|
|
18
25
|
/**
|
|
19
26
|
* Выполняет artifact для QueryRuntimeHost без преждевременной записи stores.
|
|
20
27
|
*/
|
|
@@ -22,9 +29,21 @@ export declare class EndgeQuery {
|
|
|
22
29
|
payload: QueryProgramPayload;
|
|
23
30
|
props: Record<string, unknown>;
|
|
24
31
|
signal?: AbortSignal;
|
|
32
|
+
onGraphQLErrors?: QueryExecutionContext['onGraphQLErrors'];
|
|
33
|
+
observer?: QueryExecutionObserver;
|
|
25
34
|
}): Promise<any>;
|
|
35
|
+
/**
|
|
36
|
+
* Ответ mockRequest Simulation для GraphQL Query: errors сценария по errorPolicy Query.
|
|
37
|
+
*/
|
|
38
|
+
applySimulatedGraphQLErrors(input: {
|
|
39
|
+
payload: QueryProgramPayload;
|
|
40
|
+
data: unknown;
|
|
41
|
+
errors: readonly unknown[] | undefined;
|
|
42
|
+
props: Record<string, unknown>;
|
|
43
|
+
onGraphQLErrors?: QueryExecutionContext['onGraphQLErrors'];
|
|
44
|
+
}): unknown;
|
|
26
45
|
/**
|
|
27
46
|
* Извлекает response-backed output для атомарного commit в QueryRuntimeHost.
|
|
28
47
|
*/
|
|
29
|
-
readResponseOutput(output: QueryProgramPayload['outputs'][number], response: unknown): unknown;
|
|
48
|
+
readResponseOutput(output: QueryProgramPayload['outputs'][number], response: unknown, graphQLErrors?: readonly GraphQLResponseError[]): unknown;
|
|
30
49
|
}
|
|
@@ -19,6 +19,7 @@ export declare class CompositionRuntimeHost extends RuntimeHostBase<'composition
|
|
|
19
19
|
private _publicOutputs;
|
|
20
20
|
private _scopes;
|
|
21
21
|
private _runtimeHandles;
|
|
22
|
+
private _conditionTransitions;
|
|
22
23
|
private _outputBridges;
|
|
23
24
|
private _updateSourcePaths;
|
|
24
25
|
private _outputBridgeDisposers;
|
|
@@ -113,6 +114,14 @@ export declare class CompositionRuntimeHost extends RuntimeHostBase<'composition
|
|
|
113
114
|
getDataPath(name: string, path?: string): string;
|
|
114
115
|
private _buildLifecycleScopes;
|
|
115
116
|
private _activateScope;
|
|
117
|
+
/**
|
|
118
|
+
* `.activateWhen(expr)`: runtime и дочерние scope этого scope активируются, когда условие истинно,
|
|
119
|
+
* и деактивируются, когда ложно. Переходы идут через handle runtime и RuntimeScope, поэтому
|
|
120
|
+
* сериализуются их очередями; подписки живут, пока активен владелец (scope).
|
|
121
|
+
*/
|
|
122
|
+
private _bindActivationConditions;
|
|
123
|
+
private _watchActivationCondition;
|
|
124
|
+
private _settleConditionTransitions;
|
|
116
125
|
private _forgetScopeRuntimes;
|
|
117
126
|
private _forgetRuntime;
|
|
118
127
|
private _createRuntimeHandle;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ControllerDefinition, ControllerDependency, ControllerModel, ControllerProgramPayload, ControllerProvider } from '../domain/controllers/controller.types';
|
|
2
|
+
import { RuntimeArtifactReader, RuntimeHost, RuntimeHostSnapshot } from '../domain/runtime-host.types';
|
|
3
|
+
import { TypeProgramCatalogEntry } from '../../source/domain/types/type-source.types';
|
|
4
|
+
import { RuntimeHostBase } from '../RuntimeHostBase';
|
|
5
|
+
export declare class ControllerRuntimeHost extends RuntimeHostBase<'controller', import('../domain/runtime-host.types').RuntimeHostContextBase, ControllerProgramPayload> {
|
|
6
|
+
private _props;
|
|
7
|
+
private _instance;
|
|
8
|
+
private _abort;
|
|
9
|
+
private readonly _cleanups;
|
|
10
|
+
private _dead;
|
|
11
|
+
private _readyDone;
|
|
12
|
+
private _startStarted;
|
|
13
|
+
private _resolveReady;
|
|
14
|
+
private _rejectReady;
|
|
15
|
+
private _ready;
|
|
16
|
+
private readonly _definition;
|
|
17
|
+
private readonly _disposeRuntime;
|
|
18
|
+
private readonly _catalog;
|
|
19
|
+
private readonly _omittedProviderOutputs;
|
|
20
|
+
private readonly _contextCurrent;
|
|
21
|
+
private _generation;
|
|
22
|
+
private readonly _dependencies;
|
|
23
|
+
private _destruction;
|
|
24
|
+
constructor(input: {
|
|
25
|
+
id: string;
|
|
26
|
+
model: ControllerModel;
|
|
27
|
+
parent: RuntimeHost<any, any> | null;
|
|
28
|
+
meta: Record<string, unknown>;
|
|
29
|
+
artifacts: RuntimeArtifactReader;
|
|
30
|
+
definition: ControllerDefinition;
|
|
31
|
+
provider: ControllerProvider;
|
|
32
|
+
dependencies: Record<string, ControllerDependency>;
|
|
33
|
+
cleanups: Array<() => void>;
|
|
34
|
+
catalog: readonly TypeProgramCatalogEntry[];
|
|
35
|
+
disposeRuntime: () => Promise<void>;
|
|
36
|
+
omittedProviderOutputs?: readonly string[];
|
|
37
|
+
contextCurrent: () => boolean;
|
|
38
|
+
subscribeContext: (listener: () => void) => () => void;
|
|
39
|
+
});
|
|
40
|
+
create(): void;
|
|
41
|
+
private _startOnce;
|
|
42
|
+
dispose(): Promise<void>;
|
|
43
|
+
whenReady(): Promise<void>;
|
|
44
|
+
snapshot(): RuntimeHostSnapshot;
|
|
45
|
+
getProps(): Readonly<Record<string, unknown>>;
|
|
46
|
+
getOutputs(): Readonly<Record<string, unknown>>;
|
|
47
|
+
getOutput(name: string): unknown;
|
|
48
|
+
outputPath(name: string): string;
|
|
49
|
+
setProps(patch: Record<string, unknown>): Promise<void>;
|
|
50
|
+
command(name: string, input?: unknown): Promise<unknown>;
|
|
51
|
+
subscribe(listener: () => void): () => void;
|
|
52
|
+
private _invalidate;
|
|
53
|
+
private _executionContext;
|
|
54
|
+
private _validateProps;
|
|
55
|
+
private _publish;
|
|
56
|
+
private _fail;
|
|
57
|
+
private _assertActive;
|
|
58
|
+
pause(): Promise<void>;
|
|
59
|
+
private _assertExecutionContext;
|
|
60
|
+
resume(): Promise<void>;
|
|
61
|
+
quiesce(): void;
|
|
62
|
+
stop(): void;
|
|
63
|
+
destroy(): Promise<void>;
|
|
64
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RQuery } from '../../domain/entities/RQuery';
|
|
2
2
|
import { QueryProgramPayload } from '../../program/domain/types/program.types';
|
|
3
|
+
import { QueryExecutionObserver } from '../domain/query-execution.types';
|
|
3
4
|
import { RuntimeArtifactReader, RuntimeHost, RuntimeHostContext, RuntimeHostUpdateContext } from '../domain/runtime-host.types';
|
|
4
5
|
import { RuntimeHostBase } from '../RuntimeHostBase';
|
|
5
6
|
/**
|
|
@@ -49,7 +50,14 @@ export declare class QueryRuntimeHost extends RuntimeHostBase<'query', RuntimeHo
|
|
|
49
50
|
setProps(patch: Record<string, unknown>): void;
|
|
50
51
|
getOutput(name: string): unknown;
|
|
51
52
|
getOutputs(): Readonly<Record<string, unknown>>;
|
|
52
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Ответ mockRequest: для GraphQL Query errors сценария (и пустые errors) проходят errorPolicy.
|
|
55
|
+
*/
|
|
56
|
+
private _readSimulatedResponse;
|
|
57
|
+
run(propsPatch?: Record<string, unknown>, options?: {
|
|
58
|
+
observer?: QueryExecutionObserver;
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
}): Promise<Record<string, unknown>>;
|
|
53
61
|
pause(): void;
|
|
54
62
|
stop(): void;
|
|
55
63
|
reconcile(): Promise<void>;
|
|
@@ -38,6 +38,7 @@ export declare class SimulationRuntimeHost extends RuntimeHostBase<'simulation',
|
|
|
38
38
|
*/
|
|
39
39
|
readResponse(host: RuntimeHost<any, any>): {
|
|
40
40
|
value: unknown;
|
|
41
|
+
errors?: readonly unknown[];
|
|
41
42
|
} | null;
|
|
42
43
|
streamOverride(host: RuntimeHost<any, any>): {
|
|
43
44
|
schema: Record<string, unknown>;
|
|
@@ -38,6 +38,7 @@ export declare class StoreRuntimeHost extends RuntimeHostBase<'store', RuntimeHo
|
|
|
38
38
|
/**
|
|
39
39
|
* Возвращает текущий снимок raw и derived Store fields.
|
|
40
40
|
*/
|
|
41
|
+
get(path: string): unknown;
|
|
41
42
|
getDataSnapshot(): Readonly<Record<string, unknown>>;
|
|
42
43
|
/**
|
|
43
44
|
* Проверяет, можно ли записывать в root field указанного Store path.
|
|
@@ -12,6 +12,8 @@ export declare class StreamRuntimeHost extends RuntimeHostBase<'stream', Runtime
|
|
|
12
12
|
private _closing;
|
|
13
13
|
private _contextOff;
|
|
14
14
|
private _dataMode;
|
|
15
|
+
private _props;
|
|
16
|
+
private _requestKey;
|
|
15
17
|
constructor(input: {
|
|
16
18
|
id: string;
|
|
17
19
|
model: RStream;
|
|
@@ -29,6 +31,14 @@ export declare class StreamRuntimeHost extends RuntimeHostBase<'stream', Runtime
|
|
|
29
31
|
artifacts: RuntimeArtifactReader;
|
|
30
32
|
transportFactory: StreamTransportFactory;
|
|
31
33
|
}): StreamRuntimeHost | null;
|
|
34
|
+
/**
|
|
35
|
+
* Текущие props Stream: literal defaults, поверх них значения владельца (Composition withProps).
|
|
36
|
+
*/
|
|
37
|
+
getProps(): Readonly<Record<string, unknown>>;
|
|
38
|
+
/**
|
|
39
|
+
* Обновляет props; активное live-соединение переоткрывается, если изменился вычисленный запрос.
|
|
40
|
+
*/
|
|
41
|
+
setProps(patch: Record<string, unknown>): void;
|
|
32
42
|
start(): void;
|
|
33
43
|
/**
|
|
34
44
|
* Generator сохраняет SSE на паузе; обычный transport закрывает соединение.
|
|
@@ -44,5 +54,25 @@ export declare class StreamRuntimeHost extends RuntimeHostBase<'stream', Runtime
|
|
|
44
54
|
private _closeConnection;
|
|
45
55
|
private _disposeConnection;
|
|
46
56
|
private _receive;
|
|
57
|
+
/**
|
|
58
|
+
* mockStream graphqlSse: каждый сгенерированный root — data события next (с errors сценария),
|
|
59
|
+
* дальше тот же путь, что у транспорта: errorPolicy, events.next (type/payloadFrom/eachFrom/match), Store.
|
|
60
|
+
*/
|
|
61
|
+
private _receiveSimulatedNext;
|
|
62
|
+
/**
|
|
63
|
+
* errorPolicy: 'all' — errors события next попадают в diagnostics, как у GraphQL Query.
|
|
64
|
+
*/
|
|
65
|
+
private _reportGraphQLErrors;
|
|
66
|
+
/**
|
|
67
|
+
* url транспорта: строка/token или выражение graphqlSse по текущим props.
|
|
68
|
+
*/
|
|
69
|
+
private _evaluateUrl;
|
|
70
|
+
/**
|
|
71
|
+
* Вычисляет variables, headers и extensions graphqlSse по props и env; другие transport запроса не имеют.
|
|
72
|
+
*/
|
|
73
|
+
private _evaluateRequest;
|
|
74
|
+
private _evaluate;
|
|
75
|
+
private _literalDefaults;
|
|
76
|
+
private _applyProps;
|
|
47
77
|
private _dispatch;
|
|
48
78
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ControllerDefinition, ControllerProvider } from '../../domain/controllers/controller.types';
|
|
2
|
+
/** Definitions are serializable; provider factories remain local executable code. */
|
|
3
|
+
export declare class ControllerRegistry {
|
|
4
|
+
private readonly _active;
|
|
5
|
+
private readonly _definitions;
|
|
6
|
+
private readonly _providers;
|
|
7
|
+
define(definition: ControllerDefinition): () => void;
|
|
8
|
+
provide(provider: ControllerProvider): () => void;
|
|
9
|
+
get(identity: string): ControllerDefinition | null;
|
|
10
|
+
provider(definition: ControllerDefinition): ControllerProvider;
|
|
11
|
+
acquire(definition: ControllerDefinition): {
|
|
12
|
+
provider: ControllerProvider;
|
|
13
|
+
release: () => void;
|
|
14
|
+
};
|
|
15
|
+
list(): ControllerDefinition[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ControllerContext, ControllerInstance } from '../../../domain/controllers/controller.types';
|
|
2
|
+
/** One instance owns demand and execution; all retained rows remain in Store. */
|
|
3
|
+
export declare class CollectionWindowController implements ControllerInstance {
|
|
4
|
+
private _context;
|
|
5
|
+
private _props;
|
|
6
|
+
private _state;
|
|
7
|
+
private _load;
|
|
8
|
+
private _generation;
|
|
9
|
+
private _active;
|
|
10
|
+
private _activeDirection;
|
|
11
|
+
private _pending;
|
|
12
|
+
private _viewport;
|
|
13
|
+
private readonly _retained;
|
|
14
|
+
private _initialized;
|
|
15
|
+
private _paused;
|
|
16
|
+
private _disposed;
|
|
17
|
+
private _refreshPending;
|
|
18
|
+
private _pageSequence;
|
|
19
|
+
private readonly _pages;
|
|
20
|
+
private _background;
|
|
21
|
+
private _backgroundPage;
|
|
22
|
+
private _cacheSource;
|
|
23
|
+
private _cacheStale;
|
|
24
|
+
private _cacheError;
|
|
25
|
+
private _snapshot;
|
|
26
|
+
private _publishedRowsRevision;
|
|
27
|
+
private _cacheUnsubscribe;
|
|
28
|
+
private _error;
|
|
29
|
+
private _unsubscribe;
|
|
30
|
+
constructor(_context: ControllerContext);
|
|
31
|
+
start(context: ControllerContext): void;
|
|
32
|
+
setProps(props: Readonly<Record<string, unknown>>, context: ControllerContext): Promise<void>;
|
|
33
|
+
command(name: string, input: unknown, context: ControllerContext): Promise<void>;
|
|
34
|
+
pause(): void;
|
|
35
|
+
resume(context: ControllerContext): void;
|
|
36
|
+
destroy(): void;
|
|
37
|
+
private _replaceContext;
|
|
38
|
+
private _cancel;
|
|
39
|
+
private _read;
|
|
40
|
+
private _rows;
|
|
41
|
+
private _key;
|
|
42
|
+
private _validateProps;
|
|
43
|
+
private _commit;
|
|
44
|
+
private _publish;
|
|
45
|
+
private _reset;
|
|
46
|
+
private _demand;
|
|
47
|
+
private _request;
|
|
48
|
+
private _normalize;
|
|
49
|
+
private _trim;
|
|
50
|
+
private _trimBlocks;
|
|
51
|
+
private _edgeSignature;
|
|
52
|
+
private _pageSignature;
|
|
53
|
+
private _selectCache;
|
|
54
|
+
private _loadPage;
|
|
55
|
+
private _revalidateVisible;
|
|
56
|
+
}
|