@endge/core 6.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/core.js +19387 -18015
  2. package/dist/features/core/kernel/config/modules.config.d.ts +1 -1
  3. package/dist/features/core/kernel/endge.d.ts +10 -4
  4. package/dist/features/core/modules/EndgeRuntimeDebugger_Module.d.ts +2 -0
  5. package/dist/features/core/modules/auth/EndgeAuth_Module.d.ts +3 -1
  6. package/dist/features/core/modules/configuration/EndgeConfiguration_Module.d.ts +2 -0
  7. package/dist/features/core/modules/configuration/domain/types/configuration.type.d.ts +13 -1
  8. package/dist/features/core/modules/context/EndgeContext_Module.d.ts +13 -0
  9. package/dist/features/core/modules/context/domain/context-state.types.d.ts +12 -0
  10. package/dist/features/core/modules/context/persistence/context-state.d.ts +7 -0
  11. package/dist/features/core/modules/diagnostics/EndgeDiagnosticsSnapshots_Module.d.ts +55 -0
  12. package/dist/features/core/modules/diagnostics/EndgeDiagnostics_Module.d.ts +10 -16
  13. package/dist/features/core/modules/diagnostics/adapters/BrowserDiagnosticsSnapshot_Adapter.d.ts +9 -0
  14. package/dist/features/core/modules/diagnostics/domain/diagnostics-snapshot.d.ts +7 -0
  15. package/dist/features/core/modules/diagnostics/domain/types/diagnostics-snapshot-runtime-adapter.type.d.ts +15 -0
  16. package/dist/features/core/modules/diagnostics/domain/types/diagnostics.types.d.ts +60 -3
  17. package/dist/features/core/modules/domain/EndgeDomain_Module.d.ts +3 -3
  18. package/dist/features/core/modules/domain/component/component-sfc-edit-trigger.d.ts +32 -1
  19. package/dist/features/core/modules/domain/types/component/sfc/dependencies.types.d.ts +11 -1
  20. package/dist/features/core/modules/domain/types/component/sfc/ir.types.d.ts +31 -0
  21. package/dist/features/core/modules/implementations/EndgeImplementations_Module.d.ts +2 -0
  22. package/dist/features/core/modules/program/EndgeProgram_Module.d.ts +3 -3
  23. package/dist/features/core/modules/runtime/EndgeRuntime_Module.d.ts +13 -4
  24. package/dist/features/core/modules/runtime/domain/runtime-host.types.d.ts +6 -0
  25. package/dist/features/core/modules/runtime/domain/runtime.types.d.ts +12 -0
  26. package/dist/features/core/modules/runtime/hosts/ComponentSFCRuntimeHost.d.ts +10 -1
  27. package/dist/features/core/modules/runtime/hosts/CompositionRuntimeHost.d.ts +1 -0
  28. package/dist/features/core/modules/runtime/hosts/StoreRuntimeHost.d.ts +4 -0
  29. package/dist/features/core/modules/runtime/operation/EndgeOperations_Module.d.ts +2 -0
  30. package/dist/features/core/modules/source/domain/types/composition-source.types.d.ts +9 -0
  31. package/dist/features/core/modules/source/domain/types/source-expression.types.d.ts +1 -1
  32. package/dist/features/core/modules/source/domain/types/update-source.types.d.ts +7 -0
  33. package/dist/features/core/modules/ui/EndgeUI_Module.d.ts +10 -13
  34. package/dist/features/core/modules/ui/ui-composition.config.d.ts +10 -10
  35. package/dist/features/federation/EndgeFederation.d.ts +69 -41
  36. package/dist/features/federation/EndgeModule.d.ts +7 -0
  37. package/dist/features/federation/tools/sort-endge-modules.d.ts +7 -0
  38. package/dist/features/federation/types/endge-modules.types.d.ts +2 -5
  39. package/dist/features/federation/types/federation.types.d.ts +91 -2
  40. package/dist/main.d.ts +5 -0
  41. package/package.json +2 -2
@@ -2,7 +2,7 @@ import { RuntimeEntityType } from './domain/runtime-entity-map.types';
2
2
  import { RuntimeExecuteOptions } from './domain/runtime-execute.type';
3
3
  import { DestroyedRuntimeHostSnapshot, RuntimeHost, RuntimeInspectionLease } from './domain/runtime-host.types';
4
4
  import { AnyRuntimeHost, AnyRuntimeStrategy } from './domain/runtime-strategy.types';
5
- import { EndgeRuntimeSnapshot, RuntimeExecutableModel } from './domain/runtime.types';
5
+ import { EndgeRuntimeRaphSnapshot, EndgeRuntimeSnapshot, RuntimeExecutableModel } from './domain/runtime.types';
6
6
  import { RuntimeAppScopeOptions, RuntimeAppScope } from './RuntimeAppScope';
7
7
  import { EndgeDataMode } from '../workspace/domain/workspace.types';
8
8
  import { EndgeRuntimeScopes_Module } from './EndgeRuntimeScopes_Module';
@@ -94,10 +94,17 @@ export declare class EndgeRuntime_Module extends EndgeModule {
94
94
  * Возвращает runtime-host по доменной сущности.
95
95
  */
96
96
  getRuntimeHostsByEntity(entityType: RuntimeEntityType, entityIdentity: string, appScopeId?: string): AnyRuntimeHost[];
97
- /**
98
- * Возвращает общий snapshot runtime-состояния.
99
- */
97
+ /** Включает hosts, scopes и operation histories в диагностическое дерево Module. */
98
+ createDiagnosticsSnapshot(): EndgeRuntimeSnapshot & {
99
+ operations: unknown;
100
+ };
101
+ /** Возвращает общий snapshot runtime-состояния. */
100
102
  snapshot(): EndgeRuntimeSnapshot;
103
+ /** Формирует принадлежащую runtime-модулю диагностическую проекцию Raph. */
104
+ snapshotRaph(options: {
105
+ includeData: boolean;
106
+ includeGraph: boolean;
107
+ }): EndgeRuntimeRaphSnapshot;
101
108
  /**
102
109
  * Корректно разрушает runtime-host по runtime-id.
103
110
  */
@@ -116,6 +123,8 @@ export declare class EndgeRuntime_Module extends EndgeModule {
116
123
  private _syncWorkspaceVariablesToRaph;
117
124
  /** Восстанавливает сохранённые значения runtime-фильтров независимо от переменных workspace. */
118
125
  private _hydrateRuntimeFilters;
126
+ /** Однократно переносит прежний глобальный storage runtime-фильтров. */
127
+ private _migrateLegacyRuntimeFilters;
119
128
  /**
120
129
  * Внутренний destroy для host с контролем уведомления подписчиков.
121
130
  */
@@ -211,6 +211,12 @@ export interface RuntimeHostLocalInputSource {
211
211
  export interface RuntimeHostRaphInputBinding {
212
212
  path: string;
213
213
  wildcardDynamic?: boolean;
214
+ /** Необязательный исходный DataPath для Meta, если value был преобразован. */
215
+ metaSource?: {
216
+ path: string;
217
+ key?: string;
218
+ fields?: Record<string, string>;
219
+ };
214
220
  }
215
221
  /** Raph-backed input source runtime-host-а. */
216
222
  export interface RuntimeHostRaphInputSource {
@@ -17,6 +17,18 @@ export interface EndgeRuntimeSnapshot extends RuntimeHostRegistrySnapshot {
17
17
  generatedAt: number;
18
18
  scopes: import('./runtime-scope.types').RuntimeScopeSnapshot[];
19
19
  }
20
+ /** Опциональные данные и graph-состояние Raph для диагностического snapshot. */
21
+ export interface EndgeRuntimeRaphSnapshot {
22
+ data?: unknown;
23
+ graph?: {
24
+ runtimeId: string;
25
+ loopEnabled: boolean;
26
+ frame: unknown;
27
+ nodes: unknown[];
28
+ tree: unknown[];
29
+ derived: unknown;
30
+ };
31
+ }
20
32
  /**
21
33
  * Событие для query: изменение фильтра
22
34
  */
@@ -2,7 +2,7 @@ import { RComponentSFC } from '../../domain/entities/RComponentSFC';
2
2
  import { RComponentContract, RComponentDependencies, RComponentRenderTarget } from '../../domain/types/component/component-core.types';
3
3
  import { RComponentSFC_AST } from '../../domain/types/component/sfc/ast.types';
4
4
  import { RComponentSFC_RuntimeDependencies } from '../../domain/types/component/sfc/dependencies.types';
5
- import { ComponentSFCEditedEventPayload, RComponentSFC_IR } from '../../domain/types/component/sfc/ir.types';
5
+ import { ComponentSFCEditedEventPayload, RComponentSFC_IR, RComponentSFC_IR_DataMetaReference } from '../../domain/types/component/sfc/ir.types';
6
6
  import { ComponentSFCEventOccurrence, ComponentSFCEventPort, ComponentSFCEventRuntimeSource } from '../../domain/types/component/sfc/ports.types';
7
7
  import { RComponentSFCSource_Parts } from '../../domain/types/component/sfc/source.types';
8
8
  import { ComputationResource } from '../../domain/types/computation/computation-runtime.types';
@@ -100,6 +100,11 @@ export declare class ComponentSFCRuntimeHost extends RuntimeHostBase<'component-
100
100
  setInputSource(input: RuntimeHostInputSource | null | undefined): void;
101
101
  /** Возвращает текущий input source host-а. */
102
102
  getInputSource(): RuntimeHostInputSource | null;
103
+ /** Читает Meta-plane по compiler-known ссылке, не раскрывая SFC физический DataPath. */
104
+ readDataMeta(reference: RComponentSFC_IR_DataMetaReference & {
105
+ boundaryId?: string;
106
+ rowKey?: unknown;
107
+ }, namespace?: string): unknown;
103
108
  /**
104
109
  * Получает runtime update от universal boundary phase.
105
110
  *
@@ -128,6 +133,10 @@ export declare class ComponentSFCRuntimeHost extends RuntimeHostBase<'component-
128
133
  private _createRuntimeBoundaryNodes;
129
134
  private _createTableColumnBoundaryNode;
130
135
  private _bindRaphInputSource;
136
+ private _bindRaphMetaInputSource;
137
+ private _resolveDataMetaObservedPath;
138
+ private _resolveDataMetaPath;
139
+ private _mapMetaField;
131
140
  /** Зависимости контекста основаны на Raph и не зависят от вида входных props компонента. */
132
141
  private _bindRaphContextSources;
133
142
  private _observeContextPath;
@@ -126,6 +126,7 @@ export declare class CompositionRuntimeHost extends RuntimeHostBase<'composition
126
126
  private _compiledInputs;
127
127
  /** Материализует authored bindings в единый runtime input source child Composition. */
128
128
  private _makeInputSource;
129
+ private _makeMetaSourceInputBinding;
129
130
  private _subscribeBinding;
130
131
  private _bindingPath;
131
132
  private _materializeBinding;
@@ -31,6 +31,8 @@ export declare class StoreRuntimeHost extends RuntimeHostBase<'store', RuntimeHo
31
31
  getDataSnapshot(): Readonly<Record<string, unknown>>;
32
32
  /** Проверяет, можно ли записывать в root field указанного Store path. */
33
33
  isWritable(path: string): boolean;
34
+ /** Проверяет принадлежность root field этому Store, включая derived field. */
35
+ isDeclared(path: string): boolean;
34
36
  /** Записывает значение в writable Store field и запускает derived graph через Raph. */
35
37
  set(path: string, value: unknown): void;
36
38
  /**
@@ -51,4 +53,6 @@ export declare class StoreRuntimeHost extends RuntimeHostBase<'store', RuntimeHo
51
53
  private _mount;
52
54
  private _makeMutationPlans;
53
55
  private _applyMutationPlan;
56
+ private _validateMetaPlan;
57
+ private _validateMutationPlans;
54
58
  }
@@ -19,6 +19,8 @@ export declare class EndgeOperations_Module extends EndgeModule {
19
19
  redo(): Promise<unknown>;
20
20
  canUndo(): boolean;
21
21
  canRedo(): boolean;
22
+ /** Возвращает безопасное summary зарегистрированных operation histories. */
23
+ createDiagnosticsSnapshot(): unknown;
22
24
  /** Освобождает histories и глобальный keyboard listener текущего Runtime. */
23
25
  reset(): void;
24
26
  /**
@@ -86,6 +86,7 @@ export type CompositionBindingValue = {
86
86
  kind: 'data';
87
87
  data: string;
88
88
  path: string;
89
+ metaSource?: CompositionMetaSourceBinding;
89
90
  } | {
90
91
  kind: 'runtime-metadata';
91
92
  runtime: string;
@@ -100,10 +101,18 @@ export type CompositionBindingValue = {
100
101
  path: string;
101
102
  identity: string;
102
103
  props: Record<string, CompositionBindingValue>;
104
+ metaSource?: CompositionMetaSourceBinding;
103
105
  } | {
104
106
  kind: 'expression';
105
107
  expression: SourceExpressionIR;
106
108
  };
109
+ /** Явная provenance-ссылка Meta-plane для преобразованного входного значения. */
110
+ export interface CompositionMetaSourceBinding {
111
+ data: string;
112
+ path: string;
113
+ key?: string;
114
+ fields?: Record<string, string>;
115
+ }
107
116
  export interface CompositionDataDescriptor {
108
117
  name: string;
109
118
  /** Полный data path. Для root data совпадает с name. */
@@ -3,7 +3,7 @@ import { TypeSourceExpression } from './type-source.types';
3
3
  /** Identity Type Registry для контрактов полей Query и Filter. */
4
4
  export type SourceFieldType = 'String' | 'Number' | 'Boolean' | 'Date' | 'Time' | 'DateTime' | 'Object' | 'Any' | (string & {});
5
5
  /** Источник безопасного чтения значения внутри source expression. */
6
- 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
+ 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' | 'update-input' | 'update-item' | 'update-parent' | 'update-data' | 'update-meta' | 'update-has-data' | 'update-has-meta';
7
7
  /** Whitelist операций статического expression IR. */
8
8
  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';
9
9
  /**
@@ -1,11 +1,16 @@
1
1
  import { ProgramDiagnostic } from '../../../program/domain/types/program.types';
2
+ import { SourceExpressionIR } from './source-expression.types';
2
3
  export type UpdateMutationStrategy = 'set' | 'merge' | 'replace' | 'append' | 'remove';
3
4
  export interface UpdateMutationDescriptor {
4
5
  strategy: UpdateMutationStrategy;
5
6
  target: string;
7
+ plane?: 'data' | 'meta';
8
+ namespace?: string | null;
6
9
  forEach: string | null;
7
10
  ifExists: string | null;
8
11
  valueFrom: string | null;
12
+ value?: SourceExpressionIR | null;
13
+ when?: SourceExpressionIR | null;
9
14
  vars: Record<string, string>;
10
15
  }
11
16
  export interface UpdateSourceDocument {
@@ -25,8 +30,10 @@ export interface UpdateSourceCompileResult {
25
30
  diagnostics: Omit<ProgramDiagnostic, 'entityRef'>[];
26
31
  }
27
32
  export interface StoreMutationPlan {
33
+ plane?: 'data' | 'meta';
28
34
  strategy: UpdateMutationStrategy;
29
35
  path: string;
36
+ namespace?: string;
30
37
  value?: unknown;
31
38
  vars?: Record<string, unknown>;
32
39
  }
@@ -5,25 +5,27 @@ import { EndgeModule } from '../../../federation/EndgeModule';
5
5
  */
6
6
  export declare class EndgeUI_Module extends EndgeModule {
7
7
  private _offContext;
8
+ private _offZoomState;
8
9
  private _offWorkspace;
9
10
  private readonly _MIN_ZOOM;
10
11
  private readonly _MAX_ZOOM;
11
12
  private readonly _STEP_ZOOM;
12
13
  private readonly _DEFAULT_ZOOM;
13
- private readonly _LS_KEY_ZOOM;
14
+ private readonly _ZOOM_STATE_KEY;
15
+ private readonly _LEGACY_LS_KEY_ZOOM;
14
16
  private _zoom;
15
17
  private _theme;
16
18
  /**
17
- * Восстанавливает UI-настройки из localStorage и применяет тему к document.
19
+ * Создаёт UI-модуль с безопасными bootstrap defaults и применяет тему к document.
18
20
  */
19
21
  constructor();
20
22
  /** Подключает UI projection к пользовательскому контексту после загрузки workspace. */
21
23
  start(): void;
22
24
  /** Отключает runtime subscription; пользовательское значение остаётся в EndgeContext_Module. */
23
25
  reset(): void;
24
- /**
25
- * Возвращает полный snapshot UI-настроек.
26
- */
26
+ /** Включает текущие UI-настройки в диагностическое дерево. */
27
+ createDiagnosticsSnapshot(): EndgeUISnapshot;
28
+ /** Возвращает полный snapshot UI-настроек. */
27
29
  get snapshot(): EndgeUISnapshot;
28
30
  /**
29
31
  * Возвращает текущий процент zoom.
@@ -53,14 +55,9 @@ export declare class EndgeUI_Module extends EndgeModule {
53
55
  * Внутренний helper модуля: clamp Zoom.
54
56
  */
55
57
  private _clampZoom;
56
- /**
57
- * Считывает Zoom From LS.
58
- */
59
- private _readZoomFromLS;
60
- /**
61
- * Записывает Zoom To LS.
62
- */
63
- private _writeZoomToLS;
58
+ private _syncZoomFromContext;
59
+ /** Однократно переносит прежний глобальный zoom в user-scoped context state. */
60
+ private _migrateLegacyZoom;
64
61
  /**
65
62
  * Возвращает текущую тему.
66
63
  */
@@ -33,7 +33,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
33
33
  roles: {
34
34
  role: string;
35
35
  description: string;
36
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
36
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
37
37
  }[];
38
38
  };
39
39
  defaultLayout?: undefined;
@@ -78,7 +78,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
78
78
  roles: {
79
79
  role: string;
80
80
  description: string;
81
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
81
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
82
82
  defaultRendererRefs: {
83
83
  admin: string;
84
84
  runtime: string;
@@ -126,7 +126,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
126
126
  roles: {
127
127
  role: string;
128
128
  description: string;
129
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
129
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
130
130
  defaultRendererRefs: {
131
131
  admin: string;
132
132
  runtime: string;
@@ -174,7 +174,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
174
174
  roles: {
175
175
  role: string;
176
176
  description: string;
177
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
177
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
178
178
  defaultRendererRefs: {
179
179
  admin: string;
180
180
  runtime: string;
@@ -222,7 +222,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
222
222
  roles: {
223
223
  role: string;
224
224
  description: string;
225
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
225
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
226
226
  defaultRendererRefs: {
227
227
  admin: string;
228
228
  runtime: string;
@@ -270,7 +270,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
270
270
  roles: {
271
271
  role: string;
272
272
  description: string;
273
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
273
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
274
274
  defaultRendererRefs: {
275
275
  admin: string;
276
276
  runtime: string;
@@ -319,7 +319,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
319
319
  roles: ({
320
320
  role: string;
321
321
  description: string;
322
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
322
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
323
323
  defaultRendererRefs: {
324
324
  admin: string;
325
325
  runtime: string;
@@ -375,7 +375,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
375
375
  roles: {
376
376
  role: string;
377
377
  description: string;
378
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
378
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
379
379
  defaultRendererRefs: {
380
380
  admin: string;
381
381
  runtime: string;
@@ -423,7 +423,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
423
423
  roles: ({
424
424
  role: string;
425
425
  description: string;
426
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
426
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
427
427
  defaultRendererRefs: {
428
428
  admin: string;
429
429
  runtime: string;
@@ -481,7 +481,7 @@ export declare const ENDGE_UI_DEFAULT_DEFINITIONS: ({
481
481
  roles: {
482
482
  role: string;
483
483
  description: string;
484
- supportedSurfaces: ("runtime" | "canvas" | "admin")[];
484
+ supportedSurfaces: ("canvas" | "runtime" | "admin")[];
485
485
  defaultRendererRefs: {
486
486
  admin: string;
487
487
  runtime: string;
@@ -1,80 +1,108 @@
1
- import { AnyEndgeModule, EndgeFederationContextOf, EndgeFederationModuleAccessors, EndgeModuleDefinitions, EndgeModuleDescriptor, EndgePlugin } from './types/endge-modules.types';
2
- import { EndgeFederationContext, EndgeFederationDefinition, EndgeFederationHost, EndgeFederationState } from './types/federation.types';
1
+ import { AnyEndgeModule, EndgeFederationContextOf, EndgeFederationModuleAccessors, EndgeModuleDefinition, EndgeModuleDefinitions, EndgeModuleDescriptor } from './types/endge-modules.types';
2
+ import { AnyEndgeFederation, EndgeChildFederationDefinition, EndgeChildFederationDefinitions, EndgeFederationContext, EndgeFederationDefinition, EndgeFederationDiagnosticsSnapshot, EndgeFederationDiagnosticsSnapshotOptions, EndgeFederationHost, EndgeFederationState, EndgeLifecycleNodeDescriptor, EndgePlugin } from './types/federation.types';
3
+ type EndgeFederationPhase = 'setup' | 'load' | 'build' | 'start';
4
+ declare const ENDGE_FEDERATION_CONTROL_KEY: unique symbol;
5
+ type UnionToIntersection<TValue> = (TValue extends unknown ? (value: TValue) => void : never) extends ((value: infer TResult) => void) ? TResult : never;
6
+ type EndgeChildFederationContext<TFederation> = TFederation extends {
7
+ boot: (ctx: infer TContext) => Promise<void>;
8
+ } ? TContext : EndgeFederationContext;
9
+ type EndgeChildFederationsContext<TDefinitions extends EndgeChildFederationDefinitions> = [TDefinitions[number]] extends [never] ? EndgeFederationContext : UnionToIntersection<EndgeChildFederationContext<TDefinitions[number]['federation']>> extends infer TContext extends EndgeFederationContext ? TContext : EndgeFederationContext;
3
10
  type EndgeFederationConstructor = abstract new (...args: any[]) => EndgeFederation;
4
11
  type EndgeFederationStatics = Omit<typeof EndgeFederation, 'prototype' | 'boot' | 'build'>;
5
- export type DefinedEndgeFederation<TDefinitions extends EndgeModuleDefinitions, TContext extends EndgeFederationContext = EndgeFederationContextOf<TDefinitions>> = EndgeFederationConstructor & EndgeFederationStatics & EndgeFederationModuleAccessors<TDefinitions> & {
12
+ type EndgeFederationAccessors<TDefinitions extends EndgeChildFederationDefinitions> = {
13
+ readonly [TDefinition in TDefinitions[number] as TDefinition['key']]: TDefinition['federation'];
14
+ };
15
+ export type DefinedEndgeFederation<TDefinitions extends EndgeModuleDefinitions, TFederations extends EndgeChildFederationDefinitions = readonly [], TContext extends EndgeFederationContext = EndgeFederationContextOf<TDefinitions> & EndgeChildFederationsContext<TFederations>> = EndgeFederationConstructor & EndgeFederationStatics & EndgeFederationModuleAccessors<TDefinitions> & EndgeFederationAccessors<TFederations> & {
6
16
  readonly prototype: EndgeFederation;
7
17
  boot: (ctx: TContext) => Promise<void>;
8
18
  build: (ctx?: TContext) => Promise<void>;
9
19
  };
20
+ interface EndgeFederationControl {
21
+ readonly id: string;
22
+ attach: (parentFederationId: string) => void;
23
+ createDiagnosticsSnapshot: (path: string[], options: EndgeFederationDiagnosticsSnapshotOptions) => EndgeFederationDiagnosticsSnapshot;
24
+ configure: () => void;
25
+ runPhase: (phase: EndgeFederationPhase, ctx: EndgeFederationContext) => Promise<void>;
26
+ reset: () => Promise<void>;
27
+ }
10
28
  /**
11
- * Общая статическая федерация модулей.
12
- * Хост федерации живёт в `globalThis`, поэтому один и тот же класс
29
+ * Общая статическая федерация lifecycle-узлов.
30
+ * Хост федерации живёт в `globalThis`, поэтому один и тот же id
13
31
  * остаётся singleton даже при загрузке из разных пакетов/бандлов.
14
32
  */
15
33
  export declare abstract class EndgeFederation {
16
34
  protected static readonly federationId: string;
17
- /**
18
- * Создаёт статическую федерацию с ленивыми модулями и типизированными readonly accessors.
19
- * Для дополнительного поведения возвращённый class-like facade можно наследовать.
20
- */
21
- static define<const TDefinitions extends EndgeModuleDefinitions>(definition: EndgeFederationDefinition<TDefinitions>): DefinedEndgeFederation<TDefinitions, EndgeFederationContextOf<TDefinitions>>;
35
+ protected static readonly federationDefinitionSignature: string | null;
36
+ /** Стабильная runtime identity Federation. */
37
+ static get id(): string;
38
+ /** Создаёт Federation с ленивыми Modules и дочерними Federations. */
39
+ static define<const TDefinitions extends EndgeModuleDefinitions, const TFederations extends EndgeChildFederationDefinitions = readonly []>(definition: EndgeFederationDefinition<TDefinitions, TFederations>): DefinedEndgeFederation<TDefinitions, TFederations>;
22
40
  static get isInitialized(): boolean;
23
41
  static get isConfigured(): boolean;
24
42
  static get state(): EndgeFederationState;
25
43
  static get lastError(): unknown | null;
26
- /**
27
- * Хук для одноразовой регистрации модулей в порядке вызова.
28
- */
44
+ /** Рекурсивно снимает диагностическое состояние явного Federation graph. */
45
+ static createDiagnosticsSnapshot(options?: EndgeFederationDiagnosticsSnapshotOptions): EndgeFederationDiagnosticsSnapshot;
46
+ /** Хук одноразовой декларации собственных lifecycle-узлов Federation. */
29
47
  protected static configureFederation(): void;
30
- /**
31
- * Запускает федерацию по полному lifecycle pipeline: `setup -> load -> build -> start`.
32
- */
48
+ /** Запускает всё дерево Federation по pipeline `setup -> load -> build -> start`. */
33
49
  static boot(ctx: EndgeFederationContext): Promise<void>;
34
50
  private static _runBoot;
35
- /**
36
- * Добавляет plugin в список расширений федерации.
37
- * Plugin устанавливается во время конфигурации федерации, до boot.
38
- */
51
+ /** Регистрирует декларативное расширение до configuration Federation. */
39
52
  static use(plugin: EndgePlugin): void;
40
- /**
41
- * Декларирует модуль федерации.
42
- * Итоговый порядок строится после установки plugin-модулей.
43
- */
53
+ /** Декларирует уже созданный Module во время custom configuration. */
44
54
  static defineModule<T extends AnyEndgeModule>(descriptor: EndgeModuleDescriptor<T>): T;
45
- /**
46
- * Декларирует модули федерации.
47
- * Итоговый порядок строится после установки plugin-модулей.
48
- */
49
- static defineModules(descriptors: EndgeModuleDescriptor[]): void;
50
- /**
51
- * Выполняет `setup()` для всех модулей один раз до первого `start()`.
52
- */
53
- protected static setup(ctx?: EndgeFederationContext, touchedModules?: Set<AnyEndgeModule>): Promise<void>;
54
- protected static load(ctx?: EndgeFederationContext, touchedModules?: Set<AnyEndgeModule>): Promise<void>;
55
+ static defineModules(descriptors: readonly EndgeModuleDescriptor[]): void;
56
+ /** Декларирует лениво создаваемые Modules во время configuration. */
57
+ protected static defineModuleDefinitions(definitions: readonly EndgeModuleDefinition[]): void;
58
+ /** Декларирует дочернюю Federation как composite lifecycle-узел. */
59
+ static defineFederation(definition: EndgeChildFederationDefinition): void;
60
+ static defineFederations(definitions: readonly EndgeChildFederationDefinition[]): void;
61
+ protected static setup(ctx?: EndgeFederationContext, touchedNodes?: Set<EndgeLifecycleNodeDescriptor>): Promise<void>;
62
+ protected static load(ctx?: EndgeFederationContext, touchedNodes?: Set<EndgeLifecycleNodeDescriptor>): Promise<void>;
55
63
  static build(ctx?: EndgeFederationContext): Promise<void>;
56
- protected static start(ctx?: EndgeFederationContext, touchedModules?: Set<AnyEndgeModule>): Promise<void>;
57
- /**
58
- * Выполняет `reset()` в обратном dependency order и сбрасывает состояние федерации.
59
- */
64
+ protected static start(ctx?: EndgeFederationContext, touchedNodes?: Set<EndgeLifecycleNodeDescriptor>): Promise<void>;
65
+ /** Сбрасывает всё дерево в обратном dependency order. */
60
66
  static reset(): Promise<void>;
61
67
  private static _runReset;
62
68
  private static _buildPhase;
63
69
  private static _runPhase;
64
- private static _resetModules;
70
+ private static _resetNodes;
65
71
  private static _finishBuild;
72
+ private static _finishReset;
66
73
  static getModule<T extends AnyEndgeModule = AnyEndgeModule>(key: string): T;
67
74
  static tryGetModule<T extends AnyEndgeModule = AnyEndgeModule>(key: string): T | null;
68
75
  static hasModule(key: string): boolean;
76
+ static getFederation<T extends AnyEndgeFederation = AnyEndgeFederation>(key: string): T;
77
+ static tryGetFederation<T extends AnyEndgeFederation = AnyEndgeFederation>(key: string): T | null;
78
+ static hasFederation(key: string): boolean;
69
79
  protected static get host(): EndgeFederationHost;
80
+ private static _ensureConfigured;
70
81
  private static _getFederationId;
71
82
  private static _createHost;
72
83
  private static _getOrCreateHost;
73
84
  private static _normalizeHost;
74
- private static _normalizeDefinitions;
85
+ private static _normalizeModuleDefinitions;
86
+ private static _normalizeFederationDefinitions;
87
+ private static _normalizeNodeKey;
75
88
  private static _requireBootContext;
89
+ private static _requireConfiguringHost;
90
+ private static _assertNodeKeyAvailable;
91
+ private static _validatePluginKeys;
76
92
  private static _installPlugins;
77
- private static _finalizeModules;
93
+ private static _finalizeNodes;
94
+ private static _defineAccessors;
95
+ private static _defineHostAccessors;
96
+ private static _assertAccessorAvailable;
97
+ private static _defineAccessor;
98
+ private static _createDefinitionSignature;
99
+ private static _createPluginSignature;
100
+ private static _getFederationControl;
101
+ protected static [ENDGE_FEDERATION_CONTROL_KEY](): EndgeFederationControl;
102
+ private static _createDiagnosticsSnapshot;
103
+ private static _attachToParent;
104
+ private static _runAttachedPhase;
105
+ private static _resetAttached;
78
106
  private static _registry;
79
107
  }
80
108
  export {};
@@ -37,6 +37,13 @@ export declare abstract class EndgeModule<TContext extends EndgeFederationContex
37
37
  * Метод можно не переопределять.
38
38
  */
39
39
  reset(): void | Promise<void>;
40
+ /**
41
+ * Возвращает состояние Module для общего диагностического snapshot.
42
+ * По умолчанию используется persistence-проекция `serialize()`; Module может
43
+ * переопределить метод более подробным или безопасным диагностическим представлением.
44
+ * Снимки принадлежащих Module submodules явно включает их родитель.
45
+ */
46
+ createDiagnosticsSnapshot(): unknown;
40
47
  /**
41
48
  * Возвращает сериализуемый snapshot состояния модуля.
42
49
  * Конкретный persistent Module сам определяет storage contract и момент сохранения.
@@ -1,2 +1,9 @@
1
1
  import { EndgeModuleDescriptor } from '../types/endge-modules.types';
2
+ interface EndgeOrderedDescriptor {
3
+ readonly key: string;
4
+ readonly before?: string | readonly string[];
5
+ readonly after?: string | readonly string[];
6
+ }
7
+ export declare function sortEndgeOrderedDescriptors<TDescriptor extends EndgeOrderedDescriptor>(descriptors: readonly TDescriptor[]): TDescriptor[];
2
8
  export declare function sortEndgeModuleDescriptors(descriptors: EndgeModuleDescriptor[]): EndgeModuleDescriptor[];
9
+ export {};
@@ -1,10 +1,11 @@
1
1
  import { EndgeModule } from '../EndgeModule';
2
- import { EndgeFederationContext } from './federation.types';
2
+ import { EndgeFederationContext, EndgeFederationDiagnosticsSnapshot, EndgeFederationDiagnosticsSnapshotOptions } from './federation.types';
3
3
  export type AnyEndgeModule = EndgeModule<any>;
4
4
  export type EndgeModuleOrder = string | readonly string[];
5
5
  /** Доступ к уже объявленным модулям во время создания graph dependencies. */
6
6
  export interface EndgeModuleFactoryContext {
7
7
  getModule: <T extends AnyEndgeModule = AnyEndgeModule>(key: string) => T;
8
+ createDiagnosticsSnapshot: (options?: EndgeFederationDiagnosticsSnapshotOptions) => EndgeFederationDiagnosticsSnapshot;
8
9
  }
9
10
  /** Декларативное описание лениво создаваемого модуля федерации. */
10
11
  export interface EndgeModuleDefinition<TKey extends string = string, TModule extends AnyEndgeModule = AnyEndgeModule> {
@@ -29,8 +30,4 @@ export type EndgeFederationContextOf<TDefinitions extends EndgeModuleDefinitions
29
30
  export type EndgeFederationModuleAccessors<TDefinitions extends EndgeModuleDefinitions> = {
30
31
  readonly [TDefinition in TDefinitions[number] as TDefinition['key']]: ReturnType<TDefinition['create']>;
31
32
  };
32
- export interface EndgePlugin {
33
- id: string;
34
- install: () => void;
35
- }
36
33
  export {};