@endge/core 1.2.7 → 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.
Files changed (99) hide show
  1. package/dist/core.cjs +330 -256
  2. package/dist/core.js +27169 -24015
  3. package/dist/domain/entities/reflect/RComputation.d.ts +0 -3
  4. package/dist/domain/entities/reflect/RStream.d.ts +8 -0
  5. package/dist/domain/entities/reflect/RType.d.ts +2 -9
  6. package/dist/domain/entities/reflect/RUpdate.d.ts +10 -0
  7. package/dist/domain/entities/runtime/RuntimeHostBase.d.ts +2 -0
  8. package/dist/domain/entities/runtime/hosts/ComponentSFCRuntimeHost.d.ts +10 -0
  9. package/dist/domain/entities/runtime/hosts/CompositionRuntimeHost.d.ts +18 -1
  10. package/dist/domain/entities/runtime/hosts/FilterViewRuntimeHost.d.ts +13 -0
  11. package/dist/domain/entities/runtime/hosts/StoreRuntimeHost.d.ts +16 -0
  12. package/dist/domain/entities/runtime/hosts/StreamRuntimeHost.d.ts +30 -0
  13. package/dist/domain/types/component/sfc/dependencies.types.d.ts +13 -0
  14. package/dist/domain/types/component/sfc/ir.types.d.ts +13 -0
  15. package/dist/domain/types/computation/computation-source.types.d.ts +3 -0
  16. package/dist/domain/types/document/document.types.d.ts +4 -2
  17. package/dist/domain/types/document/domain-export.type.d.ts +2 -0
  18. package/dist/domain/types/document/schema.types.d.ts +6 -0
  19. package/dist/domain/types/program/program.types.d.ts +5 -2
  20. package/dist/domain/types/runtime/action.types.d.ts +3 -0
  21. package/dist/domain/types/runtime/index.d.ts +1 -0
  22. package/dist/domain/types/runtime/runtime-entity-map.types.d.ts +3 -0
  23. package/dist/domain/types/runtime/runtime-host.types.d.ts +7 -0
  24. package/dist/domain/types/runtime/runtime-project-session.types.d.ts +3 -0
  25. package/dist/domain/types/runtime/runtime.types.d.ts +3 -2
  26. package/dist/domain/types/runtime/stream-runtime.types.d.ts +17 -0
  27. package/dist/domain/types/runtime/vocab-cache.types.d.ts +33 -0
  28. package/dist/domain/types/source/composition-source.types.d.ts +43 -1
  29. package/dist/domain/types/source/data-view-source.types.d.ts +6 -1
  30. package/dist/domain/types/source/filter-source.types.d.ts +47 -0
  31. package/dist/domain/types/source/index.d.ts +2 -0
  32. package/dist/domain/types/source/query-source.types.d.ts +2 -1
  33. package/dist/domain/types/source/source-engine.types.d.ts +2 -2
  34. package/dist/domain/types/source/source-expression.types.d.ts +4 -1
  35. package/dist/domain/types/source/store-source.types.d.ts +9 -0
  36. package/dist/domain/types/source/stream-source.types.d.ts +39 -0
  37. package/dist/domain/types/source/type-source.types.d.ts +6 -1
  38. package/dist/domain/types/source/update-source.types.d.ts +32 -0
  39. package/dist/main.d.ts +7 -0
  40. package/dist/model/db/repositories/Actions_Repository.d.ts +0 -7
  41. package/dist/model/db/repositories/Computations_Repository.d.ts +0 -2
  42. package/dist/model/db/repositories/PageTemplates_Repository.d.ts +1 -0
  43. package/dist/model/db/repositories/Pages_Repository.d.ts +1 -0
  44. package/dist/model/db/repositories/Streams_Repository.d.ts +27 -0
  45. package/dist/model/db/repositories/Types_Repository.d.ts +5 -8
  46. package/dist/model/db/repositories/Updates_Repository.d.ts +26 -0
  47. package/dist/model/endge/domain/endge-domain.d.ts +32 -0
  48. package/dist/model/endge/domain/endge-types.d.ts +12 -0
  49. package/dist/model/endge/domain/endge-vocabs.d.ts +24 -0
  50. package/dist/model/endge/kernel/endge.d.ts +3 -0
  51. package/dist/model/endge/program/endge-compiler.d.ts +13 -0
  52. package/dist/model/endge/program/endge-program.d.ts +6 -0
  53. package/dist/model/endge/runtime/core/endge-actions.d.ts +1 -0
  54. package/dist/model/endge/runtime/core/endge-bind.d.ts +1 -5
  55. package/dist/model/endge/runtime/execution/computation/EndgeComputation.d.ts +6 -0
  56. package/dist/model/services/compiler/component-sfc/component-sfc-expression.d.ts +2 -0
  57. package/dist/model/services/compiler/computation/computation-compile.d.ts +1 -3
  58. package/dist/model/services/compiler/type/type-program-validation.d.ts +5 -1
  59. package/dist/model/services/runtime/strategies/StreamRuntimeStrategy.d.ts +9 -0
  60. package/dist/model/services/runtime/transports/BrowserSseStreamTransportFactory.d.ts +5 -0
  61. package/dist/model/services/source-engine/compilers/source-field-compile.d.ts +4 -1
  62. package/dist/model/services/source-engine/compilers/stream-source-compile.d.ts +3 -0
  63. package/dist/model/services/source-engine/compilers/type-source-compile.d.ts +7 -1
  64. package/dist/model/services/source-engine/compilers/update-source-compile.d.ts +3 -0
  65. package/dist/model/services/source-engine/composition-source-patch.d.ts +6 -0
  66. package/dist/model/services/source-engine/filter-source-patch.d.ts +12 -0
  67. package/dist/model/services/source-engine/source-document-reference.d.ts +7 -0
  68. package/dist/model/services/source-engine/strategies/CompositionSourcePatchStrategy.d.ts +13 -0
  69. package/dist/model/services/source-engine/strategies/FilterSourcePatchStrategy.d.ts +10 -0
  70. package/dist/model/services/source-engine/strategies/StreamSourceEngineStrategy.d.ts +7 -0
  71. package/dist/model/services/source-engine/strategies/StreamSourceLanguageStrategy.d.ts +10 -0
  72. package/dist/model/services/source-engine/strategies/UpdateSourceEngineStrategy.d.ts +7 -0
  73. package/dist/model/services/source-engine/strategies/UpdateSourceLanguageStrategy.d.ts +10 -0
  74. package/dist/model/services/source-engine/templates/stream.default.source.d.ts +1 -0
  75. package/dist/model/services/source-engine/templates/update.default.source.d.ts +1 -0
  76. package/dist/test/component-sfc-table-visibility.test.d.ts +1 -0
  77. package/dist/test/domain/entities/runtime/ComponentSFCEventBoundary.test.d.ts +1 -0
  78. package/dist/test/domain/entity-meta.test.d.ts +1 -0
  79. package/dist/test/model/db/repositories/types-repository.test.d.ts +1 -0
  80. package/dist/test/model/endge/domain/type-identity-index.test.d.ts +1 -0
  81. package/dist/test/model/endge/program/endge-compiler-query-auth.test.d.ts +1 -0
  82. package/dist/test/model/endge/program/endge-compiler-type.test.d.ts +1 -0
  83. package/dist/test/model/endge/runtime/computation-source-preview.test.d.ts +1 -0
  84. package/dist/test/model/endge/schema/document-create.test.d.ts +1 -0
  85. package/dist/test/model/endge/schema/type-payload.test.d.ts +1 -0
  86. package/dist/test/model/services/compiler/computation/groundhandling-process-state.test.d.ts +1 -0
  87. package/dist/test/model/services/source-engine/component-sfc/component-sfc-metadata-source-patch.test.d.ts +1 -0
  88. package/dist/test/model/services/source-engine/component-sfc/component-sfc-ports-source-patch.test.d.ts +1 -0
  89. package/dist/test/model/services/source-engine/component-sfc/component-sfc-props-source-patch.test.d.ts +1 -0
  90. package/dist/test/model/services/source-engine/data-view-select-steps.test.d.ts +1 -0
  91. package/dist/test/model/services/source-engine/source-language-normalize.test.d.ts +1 -0
  92. package/dist/test/model/services/source-engine/type-source-compile.test.d.ts +1 -0
  93. package/dist/test/model/services/source-engine/typescript-type-source.test.d.ts +1 -0
  94. package/dist/test/model/services/source-engine/value-expression-operations.test.d.ts +1 -0
  95. package/dist/test/runtime/sfc-render-inspection-session.test.d.ts +1 -0
  96. package/dist/test/tools/type-import-source.test.d.ts +1 -0
  97. package/package.json +4 -3
  98. package/dist/model/seed/actions/console_log.d.ts +0 -3
  99. package/dist/model/seed/actions/load_vocabs.d.ts +0 -3
@@ -2,12 +2,13 @@ import { ProgramDiagnostic } from '../program/program.types';
2
2
  import { ProgramMetadataMap } from '../program/program-metadata.types';
3
3
  import { RuntimeHost } from '../runtime/runtime-host.types';
4
4
  import { RuntimeScopeHandle } from '../runtime/runtime-scope.types';
5
+ import { VocabLoadPolicy } from '../runtime/vocab-cache.types';
5
6
  import { CompositionRuntimeHost } from '../../entities/runtime/hosts/CompositionRuntimeHost';
6
7
  import { SourceExpressionIR, SourceFieldDefinition } from './source-expression.types';
7
8
  import { FilterViewControlDefinition } from '../ui/filter-view.type';
8
9
  import { EndgeMockReference } from '../mock';
9
10
  import { I18nCompiledLocales } from '../i18n.types';
10
- export type CompositionRuntimeKind = 'filter' | 'query' | 'component' | 'composition' | 'filter-view';
11
+ export type CompositionRuntimeKind = 'filter' | 'query' | 'component' | 'composition' | 'stream' | 'filter-view';
11
12
  export type CompositionActivationMode = 'startup' | 'manual';
12
13
  export interface CompositionActivationDescriptor {
13
14
  mode: CompositionActivationMode;
@@ -36,6 +37,8 @@ export interface CompositionScopeDescriptor {
36
37
  parentPath: string | null;
37
38
  activationOverride: CompositionActivationDescriptor | null;
38
39
  effectiveActivation: CompositionActivationDescriptor;
40
+ /** Data dependencies, активируемые вместе с lifecycle scope. */
41
+ data?: string[];
39
42
  resources: string[];
40
43
  runtimes: string[];
41
44
  children: string[];
@@ -73,12 +76,18 @@ export type CompositionBindingValue = {
73
76
  };
74
77
  export interface CompositionDataDescriptor {
75
78
  name: string;
79
+ /** Полный data path. Для root data совпадает с name. */
80
+ path?: string;
81
+ /** Lifecycle scope, которому принадлежит dependency. */
82
+ scopePath?: string;
76
83
  kind: 'store' | 'vocab';
77
84
  identity: string;
78
85
  /** Политика разрешения Store; для Vocab не используется. */
79
86
  resolution?: 'contextual' | 'isolated' | 'injected';
80
87
  /** Provider slot для нескольких Store instances с одной identity. */
81
88
  slot?: string | null;
89
+ /** Нормализованная политика загрузки Vocab; для Store не используется. */
90
+ policy?: VocabLoadPolicy;
82
91
  }
83
92
  export interface CompositionStorePublication {
84
93
  data: string;
@@ -127,6 +136,13 @@ export interface CompositionRuntimeDescriptor {
127
136
  /** Локальный data alias child -> data alias owner Composition. */
128
137
  dataBindings?: Record<string, string>;
129
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
+ };
130
146
  }
131
147
  export interface CompositionRuntimeChildHandle {
132
148
  name: string;
@@ -188,6 +204,32 @@ export interface CompositionSourceDocument {
188
204
  hooks: CompositionHook[];
189
205
  outputs: CompositionOutputDescriptor[];
190
206
  }
207
+ /** Добавление data dependency в canonical Composition source. */
208
+ export interface CompositionSourceAddDataPatch {
209
+ type: 'add-data';
210
+ name: string;
211
+ kind: CompositionDataDescriptor['kind'];
212
+ identity: string;
213
+ }
214
+ /** Добавление owned resource в canonical Composition source. */
215
+ export interface CompositionSourceAddResourcePatch {
216
+ type: 'add-resource';
217
+ name: string;
218
+ kind: CompositionResourceDescriptor['kind'];
219
+ identity: string;
220
+ }
221
+ /** Добавление runtime dependency в canonical Composition source. */
222
+ export interface CompositionSourceAddRuntimePatch {
223
+ type: 'add-runtime';
224
+ name: string;
225
+ kind: Exclude<CompositionRuntimeKind, 'filter-view'>;
226
+ identity: string;
227
+ activation?: CompositionActivationMode;
228
+ }
229
+ /** Одна узкая source-preserving операция над Composition dependencies. */
230
+ export type CompositionSourcePatchOperation = CompositionSourceAddDataPatch | CompositionSourceAddResourcePatch | CompositionSourceAddRuntimePatch;
231
+ /** Composition source patch: одиночная операция или атомарная пачка. */
232
+ export type CompositionSourcePatch = CompositionSourcePatchOperation | CompositionSourcePatchOperation[];
191
233
  /** Нормализованная связь input runtime-ноды. */
192
234
  export interface CompositionRuntimeInputConnection {
193
235
  targetRuntime: 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. */
@@ -1,9 +1,10 @@
1
+ import { TypeSourceExpression } from './type-source.types';
1
2
  /** Type Registry identity used by Query/Filter field contracts. */
2
3
  export type SourceFieldType = 'String' | 'Number' | 'Boolean' | 'Date' | 'Time' | 'DateTime' | 'Object' | 'Any' | (string & {});
3
4
  /** Источник безопасного чтения значения внутри source expression. */
4
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';
5
6
  /** Whitelist операций статического expression IR. */
6
- 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';
7
8
  /**
8
9
  * Безопасное runtime-выражение, полученное из source callback.
9
10
  *
@@ -43,6 +44,8 @@ export interface SourceFieldVocab {
43
44
  export interface SourceFieldDefinition {
44
45
  key: string;
45
46
  type: SourceFieldType;
47
+ /** Точный inline-контракт для objectOf/recordOf; type сохраняет coarse runtime identity. */
48
+ typeExpression?: TypeSourceExpression;
46
49
  optional: boolean;
47
50
  array: boolean;
48
51
  defaultValue?: SourceExpressionIR;
@@ -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
+ }
@@ -31,10 +31,15 @@ export interface TypeSourceArrayDefinition {
31
31
  kind: 'array';
32
32
  items: TypeSourceExpression;
33
33
  }
34
+ /** Словарь с произвольными string-ключами и единым типом значений. */
35
+ export interface TypeSourceRecordDefinition {
36
+ kind: 'record';
37
+ values: TypeSourceExpression;
38
+ }
34
39
  /** Поддержанные корневые формы Type Source v1. */
35
40
  export type TypeSourceDefinition = TypeSourceObjectDefinition | TypeSourceEnumDefinition | TypeSourceUnionDefinition | TypeSourceArrayDefinition;
36
41
  /** Рекурсивное выражение типа: ссылка или анонимное inline-определение. */
37
- export type TypeSourceExpression = TypeSourceReference | TypeSourceDefinition;
42
+ export type TypeSourceExpression = TypeSourceReference | TypeSourceDefinition | TypeSourceRecordDefinition;
38
43
  /** Canonical authoring document Type Source v1. */
39
44
  export interface TypeSourceDocument {
40
45
  definition: TypeSourceDefinition;
@@ -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
+ }
package/dist/main.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './model/endge/kernel/endge';
2
2
  export * from './model/endge/domain/endge-domain';
3
+ export * from './model/endge/domain/endge-types';
3
4
  export * from './model/endge/domain/resolved/resolved-entity-index';
4
5
  export * from './model/endge/runtime/implementation/endge-implementations';
5
6
  export * from './model/endge/program/endge-program';
@@ -57,6 +58,8 @@ export * from './domain/entities/reflect/RQuery';
57
58
  export * from './domain/entities/reflect/RDataView';
58
59
  export * from './domain/entities/reflect/RComposition';
59
60
  export * from './domain/entities/reflect/RStore';
61
+ export * from './domain/entities/reflect/RStream';
62
+ export * from './domain/entities/reflect/RUpdate';
60
63
  export * from './domain/entities/reflect/RMock';
61
64
  export * from './domain/entities/reflect/RQueryFilter';
62
65
  export * from './domain/entities/reflect/RType';
@@ -140,6 +143,7 @@ export * from './model/services/compiler/component-sfc/component-sfc-forward';
140
143
  export * from './model/services/compiler/computation/computation-compile';
141
144
  export * from './model/services/style';
142
145
  export * from './model/services/source-engine/source-expression-evaluate';
146
+ export * from './model/services/source-engine/filter-source-patch';
143
147
  export * from './model/services/source-engine/type-source-serialize';
144
148
  export * from './model/services/source-engine/typescript-type-source';
145
149
  export * from './model/services/source-engine/component-sfc/component-sfc-visual-projection';
@@ -158,6 +162,9 @@ export * from './model/services/runtime/strategies/QueryRuntimeStrategy';
158
162
  export * from './model/services/runtime/strategies/FilterRuntimeStrategy';
159
163
  export * from './model/services/runtime/strategies/CompositionRuntimeStrategy';
160
164
  export * from './model/services/runtime/strategies/StoreRuntimeStrategy';
165
+ export * from './model/services/runtime/strategies/StreamRuntimeStrategy';
166
+ export * from './domain/entities/runtime/hosts/StreamRuntimeHost';
167
+ export * from './domain/types/runtime/stream-runtime.types';
161
168
  export * from './model/db/schema-database/PayloadSchemaAdapter';
162
169
  export * from './model/db/schema-database/BaseSchemaRepositoriy';
163
170
  export * from './model/db/schema-database/SchemaStorageAdapter';
@@ -1,17 +1,10 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ActionFlowDefinition } from '../../../domain/types/flow/endge-flow.types';
3
- export interface ActionRepositoryFieldContract {
4
- type: number | string | null;
5
- isArray?: boolean;
6
- optional?: boolean;
7
- }
8
3
  export interface ActionRepositoryPayload {
9
4
  identity: string;
10
5
  displayName: string;
11
6
  description?: string | null;
12
7
  definition: ActionFlowDefinition;
13
- input?: ActionRepositoryFieldContract | null;
14
- output?: ActionRepositoryFieldContract | null;
15
8
  target?: Array<{
16
9
  type: string;
17
10
  identity?: string;
@@ -6,8 +6,6 @@ export interface ComputationsPayloadFields {
6
6
  source: string;
7
7
  sourceVersion: number;
8
8
  contractVersion: number;
9
- input?: Record<string, unknown> | null;
10
- output?: Record<string, unknown> | null;
11
9
  folder?: string | number | null;
12
10
  meta?: Record<string, unknown>;
13
11
  author?: string | null;
@@ -58,4 +58,5 @@ export declare class PageTemplates_Repository {
58
58
  preview?: PageTemplatePreviewDoc | null;
59
59
  meta?: Record<string, unknown>;
60
60
  }): Promise<PageTemplateDoc>;
61
+ patchFolder(id: number | string, folder: number | string | null): Promise<PageTemplateDoc>;
61
62
  }
@@ -90,5 +90,6 @@ export declare class Pages_Repository {
90
90
  areas?: PageAreaDoc[];
91
91
  meta?: Record<string, unknown>;
92
92
  }): Promise<PageDoc>;
93
+ patchFolder(id: number | string, folder: number | string | null): Promise<PageDoc>;
93
94
  hardDelete(identity: string): Promise<void>;
94
95
  }
@@ -0,0 +1,27 @@
1
+ import { AxiosInstance } from 'axios';
2
+ export interface StreamsPayloadFields {
3
+ identity: string;
4
+ displayName: string;
5
+ description?: string | null;
6
+ source: string;
7
+ sourceVersion: number;
8
+ folder?: string | number | null;
9
+ meta?: Record<string, unknown>;
10
+ author?: string | null;
11
+ active?: boolean;
12
+ deletedAt?: string | null;
13
+ }
14
+ /** Репозиторий Payload-коллекции streams. */
15
+ export declare class Streams_Repository {
16
+ private readonly api;
17
+ constructor(api: AxiosInstance);
18
+ findByIdentity(identity: string): Promise<any>;
19
+ findAll(params?: Record<string, any>): Promise<any>;
20
+ create(data: StreamsPayloadFields): Promise<any>;
21
+ update(id: string | number, data: Partial<StreamsPayloadFields>): Promise<any>;
22
+ upsert(data: StreamsPayloadFields): Promise<any>;
23
+ patchFolder(id: string | number, folder: string | number | null): Promise<any>;
24
+ softDelete(identity: string, folder?: string | number): Promise<void>;
25
+ hardDelete(identity: string): Promise<void>;
26
+ restore(identity: string, folder: string | number): Promise<void>;
27
+ }
@@ -8,13 +8,12 @@ export declare class Types_Repository {
8
8
  create(data: {
9
9
  identity: string;
10
10
  displayName: string;
11
- schema: any;
12
- source?: string;
11
+ description?: string | null;
12
+ source: string;
13
13
  sourceVersion?: number;
14
14
  author?: string;
15
15
  folder?: number | string;
16
16
  active?: boolean;
17
- isPrimitive?: boolean;
18
17
  managedBy?: ManagedBy;
19
18
  managedById?: string | null;
20
19
  meta?: Record<string, unknown>;
@@ -23,13 +22,12 @@ export declare class Types_Repository {
23
22
  update(id: number | string, data: Partial<{
24
23
  identity: string;
25
24
  displayName: string;
26
- schema: any;
25
+ description: string | null;
27
26
  source: string;
28
27
  sourceVersion: number;
29
28
  author?: string;
30
29
  folder: number | string;
31
30
  active: boolean;
32
- isPrimitive: boolean;
33
31
  managedBy: ManagedBy;
34
32
  managedById: string | null;
35
33
  meta: Record<string, unknown>;
@@ -37,13 +35,12 @@ export declare class Types_Repository {
37
35
  upsert(data: {
38
36
  identity: string;
39
37
  displayName: string;
40
- schema: any;
41
- source?: string;
38
+ description?: string | null;
39
+ source: string;
42
40
  sourceVersion?: number;
43
41
  author?: string;
44
42
  folder?: number | string;
45
43
  active?: boolean;
46
- isPrimitive?: boolean;
47
44
  managedBy?: ManagedBy;
48
45
  managedById?: string | null;
49
46
  meta?: Record<string, unknown>;
@@ -0,0 +1,26 @@
1
+ import { AxiosInstance } from 'axios';
2
+ export interface UpdatesPayloadFields {
3
+ identity: string;
4
+ displayName: string;
5
+ description?: string | null;
6
+ store: string | number;
7
+ source: string;
8
+ sourceVersion: number;
9
+ meta?: Record<string, unknown>;
10
+ author?: string | null;
11
+ active?: boolean;
12
+ deletedAt?: string | null;
13
+ }
14
+ /** Репозиторий Store-owned Payload-коллекции updates. */
15
+ export declare class Updates_Repository {
16
+ private readonly api;
17
+ constructor(api: AxiosInstance);
18
+ findByIdentity(identity: string): Promise<any>;
19
+ findAll(params?: Record<string, any>): Promise<any>;
20
+ create(data: UpdatesPayloadFields): Promise<any>;
21
+ update(id: string | number, data: Partial<UpdatesPayloadFields>): Promise<any>;
22
+ upsert(data: UpdatesPayloadFields): Promise<any>;
23
+ softDelete(identity: string): Promise<void>;
24
+ hardDelete(identity: string): Promise<void>;
25
+ restore(identity: string): Promise<void>;
26
+ }
@@ -12,6 +12,8 @@ import { RConverter } from '../../../domain/entities/reflect/RConverter';
12
12
  import { RDataView } from '../../../domain/entities/reflect/RDataView';
13
13
  import { RComposition } from '../../../domain/entities/reflect/RComposition';
14
14
  import { RStore } from '../../../domain/entities/reflect/RStore';
15
+ import { RStream } from '../../../domain/entities/reflect/RStream';
16
+ import { RUpdate } from '../../../domain/entities/reflect/RUpdate';
15
17
  import { RMock } from '../../../domain/entities/reflect/RMock';
16
18
  import { RComputation } from '../../../domain/entities/reflect/RComputation';
17
19
  import { REnvironment } from '../../../domain/entities/reflect/REnvironment';
@@ -38,6 +40,10 @@ export declare function dataViewPayloadDocToPlain(doc: any): any;
38
40
  export declare function compositionPayloadDocToPlain(doc: any): any;
39
41
  /** Собирает plain-объект Store из документа Payload. */
40
42
  export declare function storePayloadDocToPlain(doc: any): any;
43
+ /** Собирает plain-объект Stream из документа Payload. */
44
+ export declare function streamPayloadDocToPlain(doc: any): any;
45
+ /** Собирает plain-объект Update и его persisted Store-owner из Payload. */
46
+ export declare function updatePayloadDocToPlain(doc: any): any;
41
47
  /** Собирает plain-объект Mock из документа Payload. */
42
48
  export declare function mockPayloadDocToPlain(doc: any): any;
43
49
  /** Собирает plain-объект Computation из документа Payload. */
@@ -59,6 +65,8 @@ export interface EndgeDomainParsed {
59
65
  dataViews: RDataView[];
60
66
  compositions: RComposition[];
61
67
  stores: RStore[];
68
+ streams: RStream[];
69
+ updates: RUpdate[];
62
70
  mocks: RMock[];
63
71
  computations: RComputation[];
64
72
  actions: RAction[];
@@ -94,6 +102,11 @@ export declare class EndgeDomain extends EndgeModule {
94
102
  private _compositionsByIdentity;
95
103
  private _storesById;
96
104
  private _storesByIdentity;
105
+ private _streamsById;
106
+ private _streamsByIdentity;
107
+ private _updatesById;
108
+ private _updatesByIdentity;
109
+ private _updatesByStoreIdentity;
97
110
  private _mocksById;
98
111
  private _mocksByIdentity;
99
112
  private _computationsById;
@@ -355,6 +368,25 @@ export declare class EndgeDomain extends EndgeModule {
355
368
  removeStoreByIdentity(identity: string): void;
356
369
  /** Удаляет Store по id или identity. */
357
370
  removeStore(idOrIdentity: string | number): void;
371
+ /** Возвращает все Stream-документы. */
372
+ getStreams(): RStream[];
373
+ getStreamById(id: string | number): RStream | null;
374
+ getStreamByIdentity(identity: string): RStream | null;
375
+ getStream(idOrIdentity: string | number): RStream | null;
376
+ addStream(stream: RStream): void;
377
+ removeStreamById(id: string | number): void;
378
+ removeStreamByIdentity(identity: string): void;
379
+ removeStream(idOrIdentity: string | number): void;
380
+ /** Возвращает все Update-документы независимо от Store-owner. */
381
+ getUpdates(): RUpdate[];
382
+ getUpdatesByStoreIdentity(storeIdentity: string): RUpdate[];
383
+ getUpdateById(id: string | number): RUpdate | null;
384
+ getUpdateByIdentity(identity: string): RUpdate | null;
385
+ getUpdate(idOrIdentity: string | number): RUpdate | null;
386
+ addUpdate(update: RUpdate): void;
387
+ removeUpdateById(id: string | number): void;
388
+ removeUpdateByIdentity(identity: string): void;
389
+ removeUpdate(idOrIdentity: string | number): void;
358
390
  /** Возвращает все Mock-документы. */
359
391
  getMocks(): RMock[];
360
392
  /** Возвращает Mock по Payload id. */
@@ -0,0 +1,12 @@
1
+ import { RType } from '../../../domain/entities/reflect/RType';
2
+ import { EndgeModule } from '../../../domain/entities/endge/EndgeModule';
3
+ /** Effective Type Registry: code-owned built-ins plus persisted user Types. */
4
+ export declare class EndgeTypes extends EndgeModule {
5
+ private readonly builtins;
6
+ constructor();
7
+ listBuiltins(): RType[];
8
+ listResolved(): RType[];
9
+ getCodeDefinition(identity: string): RType | null;
10
+ getDefinition(identity: string): RType | null;
11
+ private createBuiltin;
12
+ }