@endge/core 1.0.0-dev → 1.0.0-dev.12

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 (68) hide show
  1. package/dist/core.js +57297 -45976
  2. package/dist/features/core/kernel/config/modules.config.d.ts +7 -7
  3. package/dist/features/core/kernel/endge.d.ts +9 -9
  4. package/dist/features/core/modules/auth/EndgeAuth_Module.d.ts +9 -1
  5. package/dist/features/core/modules/auth/domain/types/auth-profile.types.d.ts +17 -0
  6. package/dist/features/core/modules/auth/services/auth-facet-claims.d.ts +5 -0
  7. package/dist/features/core/modules/compiler/EndgeCompiler_Module.d.ts +9 -0
  8. package/dist/features/core/modules/computations/model/ComputationResource.d.ts +1 -0
  9. package/dist/features/core/modules/computations/model/ComputationResourceRegistry.d.ts +1 -0
  10. package/dist/features/core/modules/context/EndgeContext_Module.d.ts +1 -0
  11. package/dist/features/core/modules/context/domain/context-persistence.types.d.ts +1 -0
  12. package/dist/features/core/modules/document-import/services/parsers/GraphQLDocumentImportParser.d.ts +3 -2
  13. package/dist/features/core/modules/program/domain/types/program.types.d.ts +3 -1
  14. package/dist/features/core/modules/runtime/RuntimeHostBase.d.ts +5 -1
  15. package/dist/features/core/modules/runtime/adapters/QueryExecutor_Adapter.d.ts +42 -3
  16. package/dist/features/core/modules/runtime/domain/graphql-query-error.d.ts +73 -0
  17. package/dist/features/core/modules/runtime/domain/query-execution.types.d.ts +25 -1
  18. package/dist/features/core/modules/runtime/domain/runtime-host.types.d.ts +6 -5
  19. package/dist/features/core/modules/runtime/domain/stream-runtime.types.d.ts +8 -1
  20. package/dist/features/core/modules/runtime/execution/endge-data-view.d.ts +1 -1
  21. package/dist/features/core/modules/runtime/execution/endge-query.d.ts +19 -2
  22. package/dist/features/core/modules/runtime/helpers/raph-phases/runtime-boundary-update-phase.d.ts +5 -9
  23. package/dist/features/core/modules/runtime/hosts/ComponentSFCRuntimeHost.d.ts +0 -1
  24. package/dist/features/core/modules/runtime/hosts/CompositionRuntimeHost.d.ts +9 -0
  25. package/dist/features/core/modules/runtime/hosts/QueryRuntimeHost.d.ts +8 -1
  26. package/dist/features/core/modules/runtime/hosts/SimulationRuntimeHost.d.ts +1 -0
  27. package/dist/features/core/modules/runtime/hosts/StreamRuntimeHost.d.ts +30 -0
  28. package/dist/features/core/modules/runtime/services/simulation/prepare-simulation-overrides.d.ts +7 -5
  29. package/dist/features/core/modules/runtime/services/transports/BrowserGraphQLSseStreamTransportFactory.d.ts +24 -0
  30. package/dist/features/core/modules/runtime/services/transports/BrowserSseStreamTransportFactory.d.ts +13 -1
  31. package/dist/features/core/modules/source/EndgeSource_Module.d.ts +6 -0
  32. package/dist/features/core/modules/source/domain/types/composition-source.types.d.ts +4 -0
  33. package/dist/features/core/modules/source/domain/types/data-view-source.types.d.ts +5 -2
  34. package/dist/features/core/modules/source/domain/types/graphql-fragments.types.d.ts +17 -0
  35. package/dist/features/core/modules/source/domain/types/query-source.types.d.ts +4 -1
  36. package/dist/features/core/modules/source/domain/types/simulation-source.types.d.ts +8 -0
  37. package/dist/features/core/modules/source/domain/types/source-context.types.d.ts +6 -0
  38. package/dist/features/core/modules/source/domain/types/source-engine.types.d.ts +3 -0
  39. package/dist/features/core/modules/source/domain/types/source-expression.types.d.ts +3 -1
  40. package/dist/features/core/modules/source/domain/types/stream-source.types.d.ts +29 -1
  41. package/dist/features/core/modules/source/domain/types/type-source.types.d.ts +11 -6
  42. package/dist/features/core/modules/source/services/SimulationSourceResolver.d.ts +6 -0
  43. package/dist/features/core/modules/source/services/compilers/graphql-operation-compile.d.ts +52 -0
  44. package/dist/features/core/modules/source/services/compilers/source-expression-compile.d.ts +21 -0
  45. package/dist/features/core/modules/source/services/compilers/source-model-reference-compile.d.ts +11 -1
  46. package/dist/features/core/modules/source/services/composition-activation.d.ts +6 -1
  47. package/dist/features/core/modules/source/services/graphql-fragments.d.ts +23 -0
  48. package/dist/features/core/modules/source/services/graphql-schema.d.ts +37 -0
  49. package/dist/features/core/modules/source/services/simulation-response-contract.d.ts +23 -0
  50. package/dist/features/core/modules/source/services/source-context.d.ts +13 -0
  51. package/dist/features/core/modules/source/services/type-extends.d.ts +15 -0
  52. package/dist/features/core/modules/source/services/value-expression-language.d.ts +2 -0
  53. package/dist/features/core/modules/source/services/value-path.d.ts +14 -0
  54. package/dist/features/core/modules/ui/EndgeUIRegistry_Module.d.ts +5 -0
  55. package/dist/features/core/modules/ui/adapters/json/EndgeUIJsonRenderer.d.ts +57 -0
  56. package/dist/features/core/modules/ui/adapters/json/endge-ui-json-adapter.d.ts +16 -0
  57. package/dist/features/core/modules/ui/adapters/json/endge-ui-json-patch.d.ts +3 -0
  58. package/dist/features/core/modules/ui/adapters/json/endge-ui-json.schema.d.ts +371 -0
  59. package/dist/features/core/modules/ui/domain/types/endge-ui-json.types.d.ts +121 -0
  60. package/dist/features/core/modules/ui/registry/UIAdapterRegistry.d.ts +2 -0
  61. package/dist/features/federation/EndgeFederation.d.ts +1 -133
  62. package/dist/features/federation/EndgeModule.d.ts +1 -58
  63. package/dist/features/federation/constants/federation.constants.d.ts +1 -1
  64. package/dist/features/federation/tools/sort-endge-modules.d.ts +1 -9
  65. package/dist/features/federation/types/endge-modules.types.d.ts +1 -28
  66. package/dist/features/federation/types/federation.types.d.ts +1 -112
  67. package/dist/main.d.ts +10 -0
  68. package/package.json +6 -4
@@ -33,7 +33,7 @@ export declare const ENDGE_CORE_MODULES: readonly [{
33
33
  readonly after: "events";
34
34
  }, {
35
35
  readonly key: "commands";
36
- readonly create: ({ getModule }: import('../../../federation/types/endge-modules.types').EndgeModuleFactoryContext) => EndgeCommands_Module;
36
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => EndgeCommands_Module;
37
37
  readonly after: readonly ["context", "runtime"];
38
38
  }, {
39
39
  readonly key: "mock";
@@ -62,7 +62,7 @@ export declare const ENDGE_CORE_MODULES: readonly [{
62
62
  }, {
63
63
  readonly key: "configuration";
64
64
  readonly create: () => EndgeConfiguration_Module;
65
- readonly after: readonly ["workspace", "domain", "context", "configurationSchema"];
65
+ readonly after: readonly ["workspace", "domain", "context", "configurationSchema", "auth"];
66
66
  }, {
67
67
  readonly key: "diagnostics";
68
68
  readonly create: () => EndgeDiagnostics_Module;
@@ -85,15 +85,15 @@ export declare const ENDGE_CORE_MODULES: readonly [{
85
85
  readonly after: "context";
86
86
  }, {
87
87
  readonly key: "actions";
88
- readonly create: ({ getModule }: import('../../../federation/types/endge-modules.types').EndgeModuleFactoryContext) => EndgeActions_Module;
88
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => EndgeActions_Module;
89
89
  readonly after: readonly ["domain", "implementations"];
90
90
  }, {
91
91
  readonly key: "computations";
92
- readonly create: ({ getModule }: import('../../../federation/types/endge-modules.types').EndgeModuleFactoryContext) => EndgeComputations_Module;
92
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => EndgeComputations_Module;
93
93
  readonly after: readonly ["domain", "program", "implementations"];
94
94
  }, {
95
95
  readonly key: "converters";
96
- readonly create: ({ getModule }: import('../../../federation/types/endge-modules.types').EndgeModuleFactoryContext) => EndgeConverters_Module;
96
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => EndgeConverters_Module;
97
97
  readonly after: readonly ["domain", "implementations"];
98
98
  }, {
99
99
  readonly key: "compiler";
@@ -102,7 +102,7 @@ export declare const ENDGE_CORE_MODULES: readonly [{
102
102
  }, {
103
103
  readonly key: "auth";
104
104
  readonly create: () => EndgeAuth_Module;
105
- readonly after: readonly ["configuration", "domain"];
105
+ readonly after: readonly ["workspace", "domain", "context"];
106
106
  }, {
107
107
  readonly key: "vocabs";
108
108
  readonly create: () => EndgeVocabs_Module;
@@ -120,7 +120,7 @@ export declare const ENDGE_CORE_MODULES: readonly [{
120
120
  readonly after: readonly ["compiler", "workspace", "context"];
121
121
  }, {
122
122
  readonly key: "inspection";
123
- readonly create: ({ getModule }: import('../../../federation/types/endge-modules.types').EndgeModuleFactoryContext) => EndgeInspection_Module;
123
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => EndgeInspection_Module;
124
124
  readonly after: readonly ["runtime", "program", "events", "context"];
125
125
  }, {
126
126
  readonly key: "updates";
@@ -1,13 +1,13 @@
1
1
  import { EndgeBootMode } from './types/bootstrap.types';
2
2
  import { DiagnosticsSnapshot } from '../modules/diagnostics/domain/types/diagnostics.types';
3
3
  import { EndgeLiveDomainSnapshot } from '../modules/domain/types/document/domain-snapshot.type';
4
- declare const EndgeCore_base: import('../../federation/EndgeFederation').DefinedEndgeFederation<readonly [{
4
+ declare const EndgeCore_base: import('@typedworks/federation').DefinedEndgeFederation<readonly [{
5
5
  readonly key: "context";
6
6
  readonly create: () => import('../modules/context/EndgeContext_Module').EndgeContext_Module;
7
7
  readonly after: "events";
8
8
  }, {
9
9
  readonly key: "commands";
10
- readonly create: ({ getModule }: import('../../../main').EndgeModuleFactoryContext) => import('../modules/commands/EndgeCommands_Module').EndgeCommands_Module;
10
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => import('../modules/commands/EndgeCommands_Module').EndgeCommands_Module;
11
11
  readonly after: readonly ["context", "runtime"];
12
12
  }, {
13
13
  readonly key: "mock";
@@ -36,7 +36,7 @@ declare const EndgeCore_base: import('../../federation/EndgeFederation').Defined
36
36
  }, {
37
37
  readonly key: "configuration";
38
38
  readonly create: () => import('../modules/configuration/EndgeConfiguration_Module').EndgeConfiguration_Module;
39
- readonly after: readonly ["workspace", "domain", "context", "configurationSchema"];
39
+ readonly after: readonly ["workspace", "domain", "context", "configurationSchema", "auth"];
40
40
  }, {
41
41
  readonly key: "diagnostics";
42
42
  readonly create: () => import('../modules/diagnostics/EndgeDiagnostics_Module').EndgeDiagnostics_Module;
@@ -59,15 +59,15 @@ declare const EndgeCore_base: import('../../federation/EndgeFederation').Defined
59
59
  readonly after: "context";
60
60
  }, {
61
61
  readonly key: "actions";
62
- readonly create: ({ getModule }: import('../../../main').EndgeModuleFactoryContext) => import('../modules/actions/EndgeActions_Module').EndgeActions_Module;
62
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => import('../modules/actions/EndgeActions_Module').EndgeActions_Module;
63
63
  readonly after: readonly ["domain", "implementations"];
64
64
  }, {
65
65
  readonly key: "computations";
66
- readonly create: ({ getModule }: import('../../../main').EndgeModuleFactoryContext) => import('../modules/computations/EndgeComputations_Module').EndgeComputations_Module;
66
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => import('../modules/computations/EndgeComputations_Module').EndgeComputations_Module;
67
67
  readonly after: readonly ["domain", "program", "implementations"];
68
68
  }, {
69
69
  readonly key: "converters";
70
- readonly create: ({ getModule }: import('../../../main').EndgeModuleFactoryContext) => import('../modules/converters/EndgeConverters_Module').EndgeConverters_Module;
70
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => import('../modules/converters/EndgeConverters_Module').EndgeConverters_Module;
71
71
  readonly after: readonly ["domain", "implementations"];
72
72
  }, {
73
73
  readonly key: "compiler";
@@ -76,7 +76,7 @@ declare const EndgeCore_base: import('../../federation/EndgeFederation').Defined
76
76
  }, {
77
77
  readonly key: "auth";
78
78
  readonly create: () => import('../modules/auth/EndgeAuth_Module').EndgeAuth_Module;
79
- readonly after: readonly ["configuration", "domain"];
79
+ readonly after: readonly ["workspace", "domain", "context"];
80
80
  }, {
81
81
  readonly key: "vocabs";
82
82
  readonly create: () => import('../modules/EndgeVocabs_Module').EndgeVocabs_Module;
@@ -94,7 +94,7 @@ declare const EndgeCore_base: import('../../federation/EndgeFederation').Defined
94
94
  readonly after: readonly ["compiler", "workspace", "context"];
95
95
  }, {
96
96
  readonly key: "inspection";
97
- readonly create: ({ getModule }: import('../../../main').EndgeModuleFactoryContext) => import('../modules/inspection/EndgeInspection_Module').EndgeInspection_Module;
97
+ readonly create: ({ getModule }: import('@typedworks/federation').EndgeModuleFactoryContext) => import('../modules/inspection/EndgeInspection_Module').EndgeInspection_Module;
98
98
  readonly after: readonly ["runtime", "program", "events", "context"];
99
99
  }, {
100
100
  readonly key: "updates";
@@ -116,7 +116,7 @@ declare const EndgeCore_base: import('../../federation/EndgeFederation').Defined
116
116
  readonly key: "styles";
117
117
  readonly create: () => import('../modules/styles/EndgeStyles_Module').EndgeStyles_Module;
118
118
  readonly after: readonly ["ui", "domain", "program", "compiler"];
119
- }], readonly [], import('../../../main').EndgeFederationContext & import('./types/bootstrap.types').EndgeBootContext>;
119
+ }], readonly [], import('./types/bootstrap.types').EndgeBootContext & import('@typedworks/federation').EndgeFederationContext>;
120
120
  /**
121
121
  * Единая статическая федерация Endge Core.
122
122
  * Lifecycle context и readonly accessors выводятся из деклараций её graph.
@@ -1,6 +1,6 @@
1
1
  import { EndgeBootContext } from '../../kernel/types/bootstrap.types';
2
2
  import { AuthInteractionRequiredError } from './domain/AuthInteractionRequiredError';
3
- import { AuthProfileSchema, EndgeAuthContext, OidcBrowserSessionOptions } from './domain/types/auth-profile.types';
3
+ import { AuthProfileSchema, EndgeAuthContext, EndgeFacetClaimResolution, OidcBrowserSessionOptions } from './domain/types/auth-profile.types';
4
4
  import { OidcBrowserSession_Adapter } from './adapters/OidcBrowserSession_Adapter';
5
5
  import { AuthAdapterRegistry } from './services/AuthAdapterRegistry';
6
6
  import { AuthProfileRegistry } from './services/AuthProfileRegistry';
@@ -21,6 +21,8 @@ export declare class EndgeAuth_Module extends EndgeModule<EndgeBootContext> {
21
21
  private _abortController;
22
22
  private _detachHostAbort;
23
23
  private _unregisterDiagnosticsContext;
24
+ private _facetClaims;
25
+ private _reportedFacetClaimIssues;
24
26
  private readonly _store;
25
27
  private readonly _interactionRequiredListeners;
26
28
  /**
@@ -39,6 +41,11 @@ export declare class EndgeAuth_Module extends EndgeModule<EndgeBootContext> {
39
41
  * Подключает storage namespace и безопасные context providers.
40
42
  */
41
43
  setup(ctx: EndgeBootContext): void;
44
+ /**
45
+ * Сопоставляет claims авторизованной default session фасетам по опции boot auth.facetClaims.
46
+ * Claims используются только для выбора structural context, не для authorization decisions.
47
+ */
48
+ facetClaimResolution(): EndgeFacetClaimResolution;
42
49
  /**
43
50
  * Валидирует Domain profiles и восстанавливает session default runtime profile.
44
51
  */
@@ -51,6 +58,7 @@ export declare class EndgeAuth_Module extends EndgeModule<EndgeBootContext> {
51
58
  * Создаёт OIDC browser source из resolved persisted profile.
52
59
  */
53
60
  createOidcSessionSource(profileInput: AuthProfileSchema | string, options: Pick<OidcBrowserSessionOptions, 'redirectUri' | 'popupRedirectUri' | 'postLogoutRedirectUri' | 'flow'>): OidcBrowserSession_Adapter;
61
+ private _reportFacetClaimIssues;
54
62
  private _resolvePublicValue;
55
63
  private _diagnosticsAttributes;
56
64
  private _publishInteractionRequired;
@@ -137,6 +137,23 @@ export interface EndgeAuthContext {
137
137
  }
138
138
  export interface EndgeAuthBootOptions {
139
139
  storageNamespace?: string;
140
+ facetClaims?: Readonly<Record<string, EndgeFacetClaimMapping>>;
141
+ }
142
+ export interface EndgeFacetClaimMapping {
143
+ claim: string;
144
+ map?: Readonly<Record<string, string>>;
145
+ missing?: 'default' | 'error';
146
+ }
147
+ export type EndgeFacetClaimIssueReason = 'missing' | 'unmapped' | 'invalid';
148
+ export interface EndgeFacetClaimResolution {
149
+ selections: Readonly<Record<string, string>>;
150
+ issues: readonly EndgeFacetClaimIssue[];
151
+ }
152
+ export interface EndgeFacetClaimIssue {
153
+ facet: string;
154
+ claim: string;
155
+ reason: EndgeFacetClaimIssueReason;
156
+ missing: 'default' | 'error';
140
157
  }
141
158
  export interface AuthAdapterContext {
142
159
  profile: AuthProfileSchema;
@@ -0,0 +1,5 @@
1
+ import { EndgeFacetClaimIssue, EndgeFacetClaimMapping, EndgeFacetClaimResolution } from '../domain/types/auth-profile.types';
2
+ export declare function normalizeFacetClaimMappings(input: Readonly<Record<string, EndgeFacetClaimMapping>> | null | undefined): Readonly<Record<string, Required<Pick<EndgeFacetClaimMapping, 'claim' | 'missing'>> & Pick<EndgeFacetClaimMapping, 'map'>>>;
3
+ export declare function resolveFacetSelectionsFromClaims(mappings: ReturnType<typeof normalizeFacetClaimMappings>, claims: Readonly<Record<string, unknown>>, authenticated: boolean): EndgeFacetClaimResolution;
4
+ export declare function readClaim(claims: Readonly<Record<string, unknown>>, claim: string): unknown;
5
+ export declare function describeFacetClaimIssue(issue: EndgeFacetClaimIssue): string;
@@ -135,6 +135,11 @@ export declare class EndgeCompiler_Module extends EndgeModule<EndgeBootContext>
135
135
  * Сейчас используется только для встроенной SFC-регистрации.
136
136
  */
137
137
  private _registerHandler;
138
+ /**
139
+ * Компилирует сущность в контексте сборки: facet()/config()/context()/contextSwitch выражений Source
140
+ * подставляются по immutable build context этой compile session.
141
+ */
142
+ private _runHandler;
138
143
  /**
139
144
  * Создаёт единый immutable context для полного и точечного compiler entry points.
140
145
  */
@@ -221,6 +226,10 @@ export declare class EndgeCompiler_Module extends EndgeModule<EndgeBootContext>
221
226
  * Вычисляет Type Source независимо от порядка компиляции типов и компонентов.
222
227
  */
223
228
  private _resolveTypeDefinition;
229
+ /**
230
+ * Authored definition Type для разворачивания extends: undefined — Type не найден или с ошибками Source.
231
+ */
232
+ private _authoredTypeDefinition;
224
233
  /**
225
234
  * Материализует итоговые предоставленные и проброшенные порты SFC Action как производные дескрипторы.
226
235
  */
@@ -15,6 +15,7 @@ export declare class ComputationResourceState<T = unknown> implements Computatio
15
15
  private _revision;
16
16
  private _disposed;
17
17
  private _input;
18
+ private _inputSignature;
18
19
  constructor(input: unknown, _asyncRunner: AsyncRunner<T>, _syncRunner?: SyncRunner<T> | null, _identity?: string);
19
20
  get status(): import('../../domain/types/computation/computation-runtime.types').ComputationResourceStatus;
20
21
  get loading(): boolean;
@@ -5,6 +5,7 @@ import { ComputationResource as ComputationResourceContract } from '../../domain
5
5
  */
6
6
  export declare class ComputationResourceRegistry {
7
7
  private readonly _resources;
8
+ private readonly _scopeIndex;
8
9
  private readonly _disposers;
9
10
  private readonly _updatingInputs;
10
11
  getOrCreate(key: string, input: unknown, create: () => ComputationResourceState, onChange?: VoidFunction): ComputationResourceContract;
@@ -35,6 +35,7 @@ export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
35
35
  private _eventContext;
36
36
  private _publishingContextChanges;
37
37
  private _executionContextLocked;
38
+ private _raphProjectionActive;
38
39
  private _bootMode;
39
40
  private _beforeInspection;
40
41
  get bootMode(): EndgeBootMode;
@@ -51,6 +51,7 @@ export type EndgePersistenceScopeResolver = () => EndgePersistenceScope;
51
51
  export interface EndgeSessionIdentity {
52
52
  userId?: string | null;
53
53
  facetSelections?: Readonly<Record<string, string>>;
54
+ facetErrors?: readonly string[];
54
55
  }
55
56
  export interface EndgeSessionIdentityProvider {
56
57
  getCurrentIdentity: () => EndgeSessionIdentity | null;
@@ -1,11 +1,12 @@
1
1
  import { DocumentImportParser, DocumentImportParserResult } from './DocumentImportParser';
2
2
  /**
3
- * Преобразует GraphQL SDL в черновики Type Source без изменения Domain.
3
+ * Преобразует GraphQL SDL или JSON introspection в черновики Type Source без изменения Domain.
4
4
  */
5
5
  export declare class GraphQLDocumentImportParser implements DocumentImportParser {
6
6
  readonly format: "graphql";
7
7
  /**
8
- * Возвращает поддержанные object/enum types и нормализует scalar aliases.
8
+ * Возвращает поддержанные object/interface/input/enum/union types и нормализует scalar aliases.
9
+ * Текст, начинающийся с `{`, читается как результат introspection и печатается в SDL.
9
10
  */
10
11
  parse(source: string): DocumentImportParserResult;
11
12
  }
@@ -6,6 +6,7 @@ import { RComponentSFCSource_Parts } from '../../../domain/types/component/sfc/s
6
6
  import { ComputationProgramPayload } from '../../../domain/types/computation/computation-program.types';
7
7
  import { ProgramMetadata } from './program-metadata.types';
8
8
  import { DataViewManualTransform, DataViewPipelineStep, DataViewRef, DataViewSourceDocument } from '../../../source/domain/types/data-view-source.types';
9
+ import { QueryGraphQLErrorPolicy } from '../../../source/domain/types/query-source.types';
9
10
  import { ResponseOutputTransform } from '../../../source/domain/types/response-output.types';
10
11
  import { QueryProgramProp, SourceExpressionIR, SourceFieldDefinition } from '../../../source/domain/types/source-expression.types';
11
12
  import { VocabProgramPayload } from '../../../source/domain/types/vocab-source.types';
@@ -83,7 +84,7 @@ export interface QueryProgramPayload {
83
84
  endpoint: QueryProgramRequestValue<string>;
84
85
  query: QueryProgramRequestValue<string>;
85
86
  operationName?: string;
86
- errorPolicy?: 'throw' | 'ignore';
87
+ errorPolicy?: QueryGraphQLErrorPolicy;
87
88
  headers?: QueryProgramRequestValue<Record<string, string>>;
88
89
  auth?: QueryProgramRequestValue<unknown>;
89
90
  timeoutMs?: QueryProgramRequestValue<number>;
@@ -93,6 +94,7 @@ export interface QueryProgramPayload {
93
94
  requestVariables?: SourceExpressionIR | null;
94
95
  mockDataEnabled?: boolean;
95
96
  mockData?: unknown;
97
+ mockErrors?: unknown[];
96
98
  outputs: QueryProgramOutput[];
97
99
  }
98
100
  export type { VocabProgramPayload };
@@ -1,4 +1,4 @@
1
- import { RaphNode } from '@raphy-js/raph';
1
+ import { RaphNode, RaphPhaseEffect } from '@raphy-js/raph';
2
2
  import { RuntimeStateControllerLike } from '../context/domain/context-persistence.types';
3
3
  import { ProgramArtifact } from '../program/domain/types/program.types';
4
4
  import { RuntimeEntityModelMap, RuntimeEntityType } from './domain/runtime-entity-map.types';
@@ -85,6 +85,10 @@ export declare abstract class RuntimeHostBase<TType extends RuntimeEntityType, T
85
85
  readInput(name: string): unknown;
86
86
  readInputs(): Readonly<Record<string, unknown>>;
87
87
  bindUpdate(binding: RuntimeHostUpdateBinding): () => void;
88
+ /**
89
+ * Создаёт одну persistent binding для набора явных PathHandle sources.
90
+ */
91
+ protected watchRuntimePaths(paths: string | readonly string[], callback: RaphPhaseEffect, phase?: string): () => void;
88
92
  private _unbindUpdate;
89
93
  setStatus(status: RuntimeHostStatus): void;
90
94
  /**
@@ -1,11 +1,17 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { AuthRequestPolicy, AuthResolvedSession, AuthResolveOptions } from '../../auth/domain/types/auth-profile.types';
3
- import { QueryProgramOutput } from '../../program/domain/types/program.types';
3
+ import { QueryProgramOutput, QueryProgramPayload } from '../../program/domain/types/program.types';
4
+ import { GraphQLResponseError } from '../domain/graphql-query-error';
4
5
  import { QueryExecutionContext } from '../domain/query-execution.types';
5
6
  export interface QueryExecutorDependencies {
6
7
  resolveVariable: (source: string) => string;
7
8
  resolveAuth: (policy: AuthRequestPolicy, options?: AuthResolveOptions) => Promise<AuthResolvedSession>;
8
9
  reportWarning: (message: string, data?: unknown) => void;
10
+ reportGraphQLErrors?: (input: {
11
+ url: string;
12
+ operationName?: string;
13
+ errors: readonly GraphQLResponseError[];
14
+ }) => void;
9
15
  }
10
16
  /**
11
17
  * Выполняет source-only compiled query artifact.
@@ -20,20 +26,53 @@ export declare class QueryExecutor_Adapter {
20
26
  execute(context: QueryExecutionContext): Promise<any>;
21
27
  /**
22
28
  * Извлекает response-backed source output без запуска DataView.
29
+ * graphQLErrors питают reader errors(path?) GraphQL Query.
23
30
  */
24
- readResponseOutput(output: QueryProgramOutput, response: unknown): unknown;
31
+ readResponseOutput(output: QueryProgramOutput, response: unknown, graphQLErrors?: readonly GraphQLResponseError[]): unknown;
25
32
  /**
26
33
  * Выбирает protocol executor по compiled artifact type.
27
34
  */
28
35
  private _executeByProtocol;
29
36
  /**
30
37
  * Выполняет GraphQL operation и возвращает ее data, отделяя transport errors от GraphQL errors.
38
+ * errorPolicy 'throw' превращает errors в GraphQLQueryError с частичными data;
39
+ * 'ignore' возвращает data и скрывает errors (onGraphQLErrors получает пустой массив);
40
+ * 'all' возвращает data, передаёт errors в onGraphQLErrors и в diagnostics.
31
41
  */
32
42
  private _runGraphQL;
43
+ /**
44
+ * Mock GraphQL Query: mock.data — data операции, mock.errors — errors ответа.
45
+ * Errors проходят тот же errorPolicy, что ответ сервера; transport и console.error не задействуются.
46
+ */
47
+ private _readGraphQLMock;
48
+ /**
49
+ * Ответ без transport (mock Query или mockRequest Simulation): errors проходят тот же
50
+ * errorPolicy, что ответ сервера; url ошибки — вычисленный endpoint Query.
51
+ */
52
+ applySimulatedGraphQLErrors(payload: QueryProgramPayload, data: unknown, rawErrors: readonly unknown[] | undefined, vars: Record<string, unknown>, onGraphQLErrors?: QueryExecutionContext['onGraphQLErrors']): unknown;
53
+ /**
54
+ * errorPolicy GraphQL-ответа: 'throw' — GraphQLQueryError с частичными data;
55
+ * 'ignore' — data без errors (как в Apollo); 'all' — data, errors в reader errors() и в diagnostics.
56
+ */
57
+ private _applyGraphQLErrorPolicy;
58
+ /**
59
+ * Проверяет оболочку GraphQL response: JSON-объект с data и/или массивом errors.
60
+ */
61
+ private _readGraphQLEnvelope;
62
+ private _readContentType;
33
63
  /**
34
64
  * Выполняет REST artifact.
35
65
  */
36
66
  private _runRest;
67
+ /**
68
+ * Передаёт наблюдателю снимок итогового запроса; изменения снимка не влияют на отправку.
69
+ */
70
+ private _notifyRequest;
71
+ /**
72
+ * Передаёт наблюдателю HTTP-ответ транспорта, включая ответы с кодом ошибки.
73
+ */
74
+ private _notifyResponse;
75
+ private _plainHeaders;
37
76
  private _throwHttpError;
38
77
  /**
39
78
  * Пишет краткую transport-индикацию без request body, headers и response payload.
@@ -56,7 +95,7 @@ export declare class QueryExecutor_Adapter {
56
95
  */
57
96
  private _readMockData;
58
97
  /**
59
- * Читает dot-path из backend response без исключений.
98
+ * Читает путь value DSL (точечный или DataPath Raph) из backend response без исключений.
60
99
  */
61
100
  private _path;
62
101
  /**
@@ -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
- export interface QueryExecutionContext {
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,4 +1,4 @@
1
- import { PhaseEvent, PhaseName, RaphFrameContext, RaphNode } from '@raphy-js/raph';
1
+ import { PathEvent, PhaseName, RaphFrameContext, RaphNode } from '@raphy-js/raph';
2
2
  import { RuntimeStateControllerLike } from '../../context/domain/context-persistence.types';
3
3
  import { ProgramArtifact, ProgramEntityType } from '../../program/domain/types/program.types';
4
4
  import { RuntimeEntityModelMap, RuntimeEntityType } from './runtime-entity-map.types';
@@ -133,6 +133,7 @@ export interface RuntimeHostArtifactRef {
133
133
  }
134
134
  export declare const RUNTIME_BOUNDARY_UPDATE_PHASE_NAME: PhaseName;
135
135
  export declare const RUNTIME_NODE_UPDATE_PHASE_NAME: PhaseName;
136
+ export type RuntimePhaseEvent = PathEvent;
136
137
  export type RuntimeHostInputBinding = {
137
138
  kind: 'literal';
138
139
  value: unknown;
@@ -179,11 +180,11 @@ export type RuntimeHostInputSource = RuntimeHostLocalInputSource | RuntimeHostRa
179
180
  export interface RuntimeDirtyBoundary {
180
181
  boundary: RaphNode;
181
182
  dirtyNodes: RaphNode[];
182
- events: PhaseEvent[];
183
+ events: RuntimePhaseEvent[];
183
184
  }
184
185
  export interface RuntimeHostUpdateContext {
185
186
  node: RaphNode;
186
- events: PhaseEvent[];
187
+ events: RuntimePhaseEvent[];
187
188
  boundaries: RuntimeDirtyBoundary[];
188
189
  frame: RaphFrameContext;
189
190
  updates?: RuntimeHostResolvedUpdate[];
@@ -203,7 +204,7 @@ export interface RuntimeCollectionProjectionUpdatePatch {
203
204
  itemSnapshot: unknown;
204
205
  changedPaths: string[][];
205
206
  affectedProjections: RuntimeCollectionProjectionPatch[];
206
- events: PhaseEvent[];
207
+ events: RuntimePhaseEvent[];
207
208
  node: RaphNode;
208
209
  }
209
210
  export interface RuntimeCollectionItemPatch {
@@ -219,7 +220,7 @@ export interface RuntimeCollectionProjectionBatchPatch {
219
220
  sourcePath: string;
220
221
  items: RuntimeCollectionItemPatch[];
221
222
  affectedProjections: RuntimeCollectionProjectionPatch[];
222
- events: PhaseEvent[];
223
+ events: RuntimePhaseEvent[];
223
224
  node: RaphNode;
224
225
  }
225
226
  export type RuntimeBoundaryPatch = RuntimeCollectionProjectionUpdatePatch | RuntimeCollectionProjectionBatchPatch;
@@ -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
- * Читает dot-path из object/array без выбрасывания ошибок.
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,11 @@ 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): Promise<any>;
20
+ run(query: RQuery, params?: Record<string, unknown>, parent?: RuntimeParentRef | null, options?: {
21
+ observer?: QueryExecutionObserver;
22
+ }): Promise<any>;
18
23
  /**
19
24
  * Выполняет artifact для QueryRuntimeHost без преждевременной записи stores.
20
25
  */
@@ -22,9 +27,21 @@ export declare class EndgeQuery {
22
27
  payload: QueryProgramPayload;
23
28
  props: Record<string, unknown>;
24
29
  signal?: AbortSignal;
30
+ onGraphQLErrors?: QueryExecutionContext['onGraphQLErrors'];
31
+ observer?: QueryExecutionObserver;
25
32
  }): Promise<any>;
33
+ /**
34
+ * Ответ mockRequest Simulation для GraphQL Query: errors сценария по errorPolicy Query.
35
+ */
36
+ applySimulatedGraphQLErrors(input: {
37
+ payload: QueryProgramPayload;
38
+ data: unknown;
39
+ errors: readonly unknown[] | undefined;
40
+ props: Record<string, unknown>;
41
+ onGraphQLErrors?: QueryExecutionContext['onGraphQLErrors'];
42
+ }): unknown;
26
43
  /**
27
44
  * Извлекает response-backed output для атомарного commit в QueryRuntimeHost.
28
45
  */
29
- readResponseOutput(output: QueryProgramPayload['outputs'][number], response: unknown): unknown;
46
+ readResponseOutput(output: QueryProgramPayload['outputs'][number], response: unknown, graphQLErrors?: readonly GraphQLResponseError[]): unknown;
30
47
  }