@endge/core 1.2.13 → 2.0.1

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 (63) hide show
  1. package/dist/core.cjs +323 -295
  2. package/dist/core.js +30689 -26344
  3. package/dist/domain/entities/reflect/RAuthProfile.d.ts +3 -3
  4. package/dist/domain/entities/runtime/ComponentSFCEventBoundary.d.ts +2 -0
  5. package/dist/domain/entities/runtime/hosts/ComponentSFCRuntimeHost.d.ts +1 -1
  6. package/dist/domain/types/auth/auth-profile.types.d.ts +93 -28
  7. package/dist/domain/types/auth/auth-runtime.types.d.ts +0 -23
  8. package/dist/domain/types/component/sfc/ast.types.d.ts +2 -0
  9. package/dist/domain/types/component/sfc/intrinsic-events.types.d.ts +6 -0
  10. package/dist/domain/types/component/sfc/ir.types.d.ts +96 -1
  11. package/dist/domain/types/component/sfc/visual-projection.types.d.ts +130 -5
  12. package/dist/domain/types/configuration/configuration.type.d.ts +13 -7
  13. package/dist/domain/types/document/domain-export.type.d.ts +1 -0
  14. package/dist/domain/types/document/query.types.d.ts +1 -1
  15. package/dist/domain/types/document/workspace.types.d.ts +1 -3
  16. package/dist/domain/types/i18n.types.d.ts +2 -0
  17. package/dist/domain/types/kernel/bootstrap.types.d.ts +1 -1
  18. package/dist/domain/types/kernel/events.types.d.ts +0 -3
  19. package/dist/domain/types/runtime/action.types.d.ts +1 -0
  20. package/dist/domain/types/runtime/context-persistence.types.d.ts +1 -0
  21. package/dist/domain/types/source/source-engine.types.d.ts +26 -1
  22. package/dist/domain/types/source/stream-source.types.d.ts +2 -1
  23. package/dist/main.d.ts +4 -0
  24. package/dist/model/config/kernel.config.d.ts +0 -1
  25. package/dist/model/config/sfc-editing.config.d.ts +3 -0
  26. package/dist/model/config/ui-composition.config.d.ts +10 -10
  27. package/dist/model/kernel/endge.d.ts +0 -5
  28. package/dist/model/modules/context/endge-vars.d.ts +4 -2
  29. package/dist/model/modules/context/endge-workspace.d.ts +1 -3
  30. package/dist/model/modules/context/persistence/RuntimeStateController.d.ts +7 -4
  31. package/dist/model/modules/domain/endge-domain.d.ts +6 -0
  32. package/dist/model/modules/program/endge-source.d.ts +3 -1
  33. package/dist/model/modules/runtime/execution/computation/ComputationResourceRegistry.d.ts +2 -0
  34. package/dist/model/modules/security/auth/AuthInteractionRequiredError.d.ts +6 -0
  35. package/dist/model/modules/security/auth/AuthProfileRegistry.d.ts +4 -4
  36. package/dist/model/modules/security/auth/AuthRequestResolver.d.ts +6 -1
  37. package/dist/model/modules/security/auth/AuthSessionManager.d.ts +2 -6
  38. package/dist/model/modules/security/auth/adapters/BasicAuthAdapter.d.ts +10 -0
  39. package/dist/model/modules/security/auth/adapters/BearerAuthAdapter.d.ts +1 -1
  40. package/dist/model/modules/security/auth/adapters/OAuth2ClientCredentialsAuthAdapter.d.ts +8 -0
  41. package/dist/model/modules/security/auth/adapters/OAuth2PasswordAuthAdapter.d.ts +11 -0
  42. package/dist/model/modules/security/auth/adapters/OidcAuthAdapter.d.ts +8 -0
  43. package/dist/model/modules/security/endge-auth.d.ts +12 -2
  44. package/dist/model/services/auth/OidcBrowserSession_Service.d.ts +26 -0
  45. package/dist/model/services/compiler/component-sfc/component-sfc-compile.d.ts +3 -0
  46. package/dist/model/services/compiler/component-sfc/component-sfc-interactions.d.ts +12 -0
  47. package/dist/model/services/compiler/component-sfc/component-sfc-template.d.ts +3 -0
  48. package/dist/model/services/i18n/composition-i18n-catalog-projection.d.ts +19 -0
  49. package/dist/model/services/i18n/i18n-catalog.d.ts +3 -1
  50. package/dist/model/services/source-engine/component-sfc/component-sfc-table-source-patch.d.ts +2 -2
  51. package/dist/model/services/source-engine/composition-source-i18n-hints.d.ts +5 -0
  52. package/dist/model/services/source-engine/strategies/CompositionSourceLanguageStrategy.d.ts +1 -0
  53. package/dist/test/component-sfc-interactions.bench.d.ts +1 -0
  54. package/dist/test/component-sfc-interactions.test.d.ts +1 -0
  55. package/dist/test/security/auth-profile-serializer.test.d.ts +1 -0
  56. package/dist/test/security/auth-test-helpers.d.ts +0 -1
  57. package/dist/test/security/oidc-browser-session.test.d.ts +1 -0
  58. package/dist/test/tools/component-sfc-edit-trigger.test.d.ts +1 -0
  59. package/dist/tools/component-sfc-edit-trigger.d.ts +11 -0
  60. package/package.json +6 -4
  61. package/dist/model/modules/runtime/input/endge-sse.d.ts +0 -46
  62. package/dist/model/modules/security/auth/adapters/KeycloakAuthAdapter.d.ts +0 -25
  63. package/dist/model/services/auth/KeycloakAuthClient.d.ts +0 -21
@@ -7,6 +7,7 @@ import { RComponentSFC_RuntimeDependencies } from '../../../../domain/types/comp
7
7
  import { ComponentSFCPortManifest, ComponentSFCPortProviderDescriptor } from '../../../../domain/types/component/sfc/ports.types';
8
8
  import { ProgramMetadata } from '../../../../domain/types/program/program-metadata.types';
9
9
  import { TypeSourceDefinition } from '../../../../domain/types/source/type-source.types';
10
+ import { EndgeSFCEditingConfiguration } from '../../../../domain/types/configuration/configuration.type';
10
11
  /** Результат полного SFC compiler pipeline в core. */
11
12
  export interface ComponentSFCCompileResult {
12
13
  /** Разложенный canonical source. */
@@ -48,6 +49,8 @@ export interface ComponentSFCCompileOptions {
48
49
  resolveComponentVariants?: (identity: string) => string[] | null;
49
50
  /** Resolves an external Type Registry definition used by a named SFC contract. */
50
51
  resolveTypeDefinition?: (identity: string) => TypeSourceDefinition | null;
52
+ /** Effective edit-session defaults из immutable build context. */
53
+ sfcEditing?: EndgeSFCEditingConfiguration;
51
54
  }
52
55
  /** Компилирует Endge SFC source до target-neutral artifact для Endge.program. */
53
56
  export declare function compileComponentSFC(source: string, options?: ComponentSFCCompileOptions): ComponentSFCCompileResult;
@@ -0,0 +1,12 @@
1
+ import { RComponentDependencies, RComponentDiagnostic } from '../../../../domain/types/component/component-core.types';
2
+ import { RComponentSFC_AST_Attribute } from '../../../../domain/types/component/sfc/ast.types';
3
+ import { RComponentSFC_IR_EventModifier, RComponentSFC_IR_InteractionGroup } from '../../../../domain/types/component/sfc/ir.types';
4
+ import { ComponentSFCPortManifest } from '../../../../domain/types/component/sfc/ports.types';
5
+ export interface ComponentSFCInteractionCompileContext {
6
+ props: string[];
7
+ locals: string[];
8
+ }
9
+ /** Detects statically invalid passive/prevent combinations in shared trigger descriptors. */
10
+ export declare function hasComponentSFCPassivePreventConflict(source: string, suffixes?: readonly RComponentSFC_IR_EventModifier[]): boolean;
11
+ /** Compiles one source-owned `:on` annotation into renderer-neutral rules. */
12
+ export declare function compileComponentSFCInteractionAnnotation(attribute: RComponentSFC_AST_Attribute, manifest: ComponentSFCPortManifest | null, context: ComponentSFCInteractionCompileContext, dependencies: RComponentDependencies, diagnostics: RComponentDiagnostic[]): RComponentSFC_IR_InteractionGroup | null;
@@ -3,6 +3,7 @@ import { RComponentSFC_AST_Template } from '../../../../domain/types/component/s
3
3
  import { RComponentSFC_IR_Template } from '../../../../domain/types/component/sfc/ir.types';
4
4
  import { ComponentSFCComponentPort, ComponentSFCPortManifest } from '../../../../domain/types/component/sfc/ports.types';
5
5
  import { ProgramNodeMetadata } from '../../../../domain/types/program/program-metadata.types';
6
+ import { EndgeSFCEditingConfiguration } from '../../../../domain/types/configuration/configuration.type';
6
7
  /** Контекст компиляции template в IR. */
7
8
  export interface ComponentSFCTemplateCompileContext {
8
9
  /** Имена props для классификации expression reads. */
@@ -19,6 +20,8 @@ export interface ComponentSFCTemplateCompileContext {
19
20
  resolveComponentPortManifest?: (identity: string) => ComponentSFCPortManifest | null;
20
21
  /** Resolves explicit root Variant names of a nested custom component. */
21
22
  resolveComponentVariants?: (identity: string) => string[] | null;
23
+ /** Effective defaults завершения edit session для текущего build context. */
24
+ sfcEditing?: EndgeSFCEditingConfiguration;
22
25
  }
23
26
  /** Результат компиляции template в IR. */
24
27
  export interface ComponentSFCTemplateCompileResult {
@@ -0,0 +1,19 @@
1
+ import { I18nCatalogProvenance, I18nRuntimeCatalog } from '../../../domain/types/i18n.types';
2
+ import { RuntimeArtifactReader } from '../../../domain/types/runtime/runtime-host.types';
3
+ export interface CompositionI18nCatalogProjectionOccurrence {
4
+ id: string;
5
+ rootIdentity: string;
6
+ invocationPath: string[];
7
+ catalogsByScope: Readonly<Record<string, I18nRuntimeCatalog>>;
8
+ provenanceByScope: Readonly<Record<string, I18nCatalogProvenance>>;
9
+ }
10
+ export interface CompositionI18nCatalogProjectionInput {
11
+ artifacts: RuntimeArtifactReader;
12
+ rootIdentities: readonly string[];
13
+ targetIdentity: string;
14
+ }
15
+ /**
16
+ * Projects effective i18n catalogs from compiled Composition artifacts only.
17
+ * No RuntimeHost, lifecycle hook or authored runtime source is executed.
18
+ */
19
+ export declare function projectCompositionI18nCatalogs(input: CompositionI18nCatalogProjectionInput): CompositionI18nCatalogProjectionOccurrence[];
@@ -1,10 +1,12 @@
1
1
  import { I18nCompiledLocales, I18nLocales, I18nRuntimeCatalog } from '../../../domain/types/i18n.types';
2
- import { CompositionI18nResourceArtifact } from '../../../domain/types/source/composition-source.types';
2
+ import { CompositionI18nResourceArtifact, CompositionProgramPayload } from '../../../domain/types/source/composition-source.types';
3
3
  /** Материализует authored locale trees в плоские dot-path индексы. */
4
4
  export declare function compileI18nLocales(locales: I18nLocales): I18nCompiledLocales;
5
5
  /** Возвращает все логические message keys независимо от локали. */
6
6
  export declare function collectI18nMessageKeys(messages: I18nCompiledLocales): Set<string>;
7
7
  /** Добавляет локальные ресурсы scope к унаследованному runtime catalog. */
8
8
  export declare function extendI18nRuntimeCatalog(inherited: I18nRuntimeCatalog, resources: readonly CompositionI18nResourceArtifact[]): I18nRuntimeCatalog;
9
+ /** Строит effective translation catalogs всех lifecycle scopes Composition. */
10
+ export declare function buildCompositionI18nCatalogs(payload: CompositionProgramPayload, inherited?: I18nRuntimeCatalog): Map<string, I18nRuntimeCatalog>;
9
11
  /** Создаёт независимый snapshot runtime catalog для передачи дочернему host. */
10
12
  export declare function cloneI18nRuntimeCatalog(catalog: I18nRuntimeCatalog): I18nRuntimeCatalog;
@@ -1,3 +1,3 @@
1
- import { ComponentSFCTableSourcePatch, ComponentSFCTableSourcePatchResult } from '../../../../domain/types/component/sfc/visual-projection.types';
1
+ import { ComponentSFCTableSourcePatch, ComponentSFCTableSourcePatchResult, ComponentSFCVisualInspectionOptions } from '../../../../domain/types/component/sfc/visual-projection.types';
2
2
  /** Применяет одну узкую visual-editor операцию, не перепечатывая остальной SFC source. */
3
- export declare function patchComponentSFCTableSource(source: string, patch: ComponentSFCTableSourcePatch): ComponentSFCTableSourcePatchResult;
3
+ export declare function patchComponentSFCTableSource(source: string, patch: ComponentSFCTableSourcePatch, options?: ComponentSFCVisualInspectionOptions): ComponentSFCTableSourcePatchResult;
@@ -0,0 +1,5 @@
1
+ import { SourceDocumentReference, SourceLanguageContext, SourceLanguageInlineHint } from '../../../domain/types/source/source-engine.types';
2
+ /** Resolves translation inline hints from current source and projected catalogs. */
3
+ export declare function compositionSourceI18nHints(context: SourceLanguageContext): SourceLanguageInlineHint[];
4
+ /** Resolves an `alias:key` literal to one physical i18n document when unambiguous. */
5
+ export declare function compositionSourceI18nReferenceAt(context: SourceLanguageContext): SourceDocumentReference | null;
@@ -10,4 +10,5 @@ export declare class CompositionSourceLanguageStrategy implements SourceLanguage
10
10
  completions(_context: SourceLanguageContext): SourceLanguageCompletion[];
11
11
  resolveReference(context: SourceLanguageContext): import('../../../../domain/types/source/source-engine.types').SourceDocumentReference | null;
12
12
  semanticHighlights(context: SourceLanguageContext): import('../../../../domain/types/source/source-engine.types').SourceLanguageSemanticHighlight[];
13
+ inlineHints(context: SourceLanguageContext): import('../../../../domain/types/source/source-engine.types').SourceLanguageInlineHint[];
13
14
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -10,4 +10,3 @@ export declare class MemoryStorage implements Storage {
10
10
  }
11
11
  export declare function authProfile(overrides?: Partial<AuthProfileSchema>): AuthProfileSchema;
12
12
  export declare function tokenSet(overrides?: Partial<AuthTokenSet>): AuthTokenSet;
13
- export declare function jwt(claims: Record<string, unknown>): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { ComponentSFCInteractionTrigger, ComponentSFCInteractionTriggerEvent, ComponentSFCInteractionTriggerPlatform } from '../domain/types/component/sfc/ir.types';
2
+ /** Normalizes the shared `edit-on` / `on` trigger value. */
3
+ export declare function normalizeComponentSFCInteractionTriggers(value: unknown): ComponentSFCInteractionTrigger[];
4
+ /** Проверяет один нормализованный trigger без зависимости от DOM и конкретного renderer-а. */
5
+ export declare function matchesComponentSFCInteractionTrigger(trigger: ComponentSFCInteractionTrigger, event: ComponentSFCInteractionTriggerEvent, platform: ComponentSFCInteractionTriggerPlatform): boolean;
6
+ /** Приводит browser platform label к стабильным значениям edit-on контракта. */
7
+ export declare function resolveComponentSFCInteractionTriggerPlatform(value: unknown): ComponentSFCInteractionTriggerPlatform;
8
+ /** Backward-compatible editable wrappers. */
9
+ export declare const normalizeComponentSFCEditTriggers: typeof normalizeComponentSFCInteractionTriggers;
10
+ export declare const matchesComponentSFCEditTrigger: typeof matchesComponentSFCInteractionTrigger;
11
+ export declare const resolveComponentSFCEditTriggerPlatform: typeof resolveComponentSFCInteractionTriggerPlatform;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endge/core",
3
- "version": "1.2.13",
3
+ "version": "2.0.1",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -23,12 +23,13 @@
23
23
  "build": "vite build",
24
24
  "preview": "vite preview",
25
25
  "test": "vitest",
26
+ "bench:interactions": "vitest bench src/test/component-sfc-interactions.bench.ts",
26
27
  "typecheck": "vue-tsc --noEmit"
27
28
  },
28
29
  "dependencies": {
29
30
  "@babel/parser": "^7.27.2",
30
31
  "@babel/types": "^7.27.1",
31
- "@endge/utils": "^0.24.8",
32
+ "@endge/utils": "^0.24.10",
32
33
  "@vue/compiler-dom": "^3.5.24",
33
34
  "@vue/compiler-sfc": "^3.5.24",
34
35
  "axios": "^1.13.2",
@@ -36,6 +37,7 @@
36
37
  "graphql": "^16.12.0",
37
38
  "lodash": "^4.17.21",
38
39
  "mitt": "^3.0.1",
40
+ "oidc-client-ts": "^3.5.0",
39
41
  "postcss": "^8.5.6",
40
42
  "postcss-scss": "^4.0.9",
41
43
  "postcss-selector-parser": "^7.1.0",
@@ -44,8 +46,8 @@
44
46
  "yaml": "^2.8.1"
45
47
  },
46
48
  "peerDependencies": {
47
- "@endge/raph": "^3.0.6",
48
- "@endge/utils": "^0.24.8",
49
+ "@endge/raph": "^3.0.8",
50
+ "@endge/utils": "^0.24.10",
49
51
  "@primevue/themes": "^4.0.0-rc.1",
50
52
  "class-transformer": "^0.5.1",
51
53
  "class-validator": "^0.14.1",
@@ -1,46 +0,0 @@
1
- import { EndgeModule } from '../../../../domain/entities/endge/EndgeModule';
2
- /**
3
- * Модуль подключения к SSE-каналу и трансляции сообщений в Endge events.
4
- */
5
- export declare class EndgeSSE extends EndgeModule {
6
- private _sseManager;
7
- private readonly _delayExecutor;
8
- private readonly _upsMeter;
9
- private _forceRefreshOnReconnect;
10
- /**
11
- * Создает SSE-модуль и delayed executor для пакетного уведомления подписчиков.
12
- */
13
- constructor();
14
- /**
15
- * Предметный запуск SSE-подключения из внешнего кода.
16
- */
17
- init(): Promise<void>;
18
- /**
19
- * Сбрасывает SSE-подключение, delayed tasks и счетчик сообщений.
20
- */
21
- reset(): void;
22
- /**
23
- * Запускает SSE-подключение по настройкам из домена.
24
- */
25
- startSSE(): Promise<void>;
26
- /**
27
- * Публикует входящее SSE-сообщение в `Endge.events`.
28
- */
29
- emitCustomSSEEvent(message: unknown): void;
30
- /**
31
- * Останавливает активное SSE-подключение и очистку token-cache.
32
- */
33
- stopSSE(): void;
34
- /**
35
- * Переключает SSE-подключение между active и stopped.
36
- */
37
- toggleSSE(): void;
38
- /**
39
- * Возвращает текущую скорость входящих SSE-сообщений.
40
- */
41
- get sseRate(): number;
42
- /**
43
- * Показывает, активно ли SSE-подключение.
44
- */
45
- get isSSEActive(): boolean;
46
- }
@@ -1,25 +0,0 @@
1
- import { AuthAdapterContext, AuthProfileAdapter, AuthProfileSchema, AuthTokenSet } from '../../../../../domain/types/auth/auth-profile.types';
2
- import { KeycloakAuthTransportFactory } from '../../../../../domain/types/auth/auth-runtime.types';
3
- /** Keycloak password-grant adapter без владения storage или application state. */
4
- export declare class KeycloakAuthAdapter implements AuthProfileAdapter {
5
- private readonly _resolvePublicValue;
6
- private readonly _createTransport;
7
- private readonly _now;
8
- readonly id = "keycloak";
9
- readonly label = "Keycloak";
10
- constructor(_resolvePublicValue: (raw: unknown) => string, _createTransport?: KeycloakAuthTransportFactory, _now?: () => number);
11
- /** Проверяет строгий persisted contract Keycloak profile. */
12
- validate(profile: AuthProfileSchema): void;
13
- /** Выполняет interactive или service password grant. */
14
- authenticate(context: AuthAdapterContext): Promise<AuthTokenSet>;
15
- /** Обновляет Keycloak session. */
16
- refresh(context: AuthAdapterContext): Promise<AuthTokenSet>;
17
- /** Завершает Keycloak session при наличии refresh token. */
18
- logout(context: AuthAdapterContext): Promise<void>;
19
- /** Загружает OIDC userinfo. */
20
- loadUserInfo(context: AuthAdapterContext): Promise<Record<string, unknown> | null>;
21
- /** Собирает resolved public config без чтения credential material. */
22
- private _config;
23
- private _transport;
24
- private _requireToken;
25
- }
@@ -1,21 +0,0 @@
1
- import { AuthTokenSet } from '../../../domain/types/auth/auth-profile.types';
2
- import { KeycloakAuthTransport, KeycloakTokenResponse, KeycloakTransportConfig } from '../../../domain/types/auth/auth-runtime.types';
3
- import { AxiosInstance } from 'axios';
4
- /** Преобразует transport response Keycloak в runtime token set. */
5
- export declare function mapKeycloakTokenResponse(data: KeycloakTokenResponse, now?: number, previous?: AuthTokenSet): AuthTokenSet;
6
- /** Axios transport для стандартных Keycloak OIDC endpoints. */
7
- export declare class KeycloakAuthClient implements KeycloakAuthTransport {
8
- private readonly _http;
9
- private readonly _tokenPath;
10
- private readonly _logoutPath;
11
- private readonly _userinfoPath;
12
- constructor(config: KeycloakTransportConfig, http?: AxiosInstance);
13
- /** Выполняет password grant. */
14
- passwordGrant(payload: Record<string, string>, signal?: AbortSignal): Promise<KeycloakTokenResponse>;
15
- /** Обновляет access token через refresh token. */
16
- refreshGrant(payload: Record<string, string>, signal?: AbortSignal): Promise<KeycloakTokenResponse>;
17
- /** Завершает Keycloak session. */
18
- logout(payload: Record<string, string>, signal?: AbortSignal): Promise<void>;
19
- /** Загружает OIDC userinfo текущей session. */
20
- getUserInfo(accessToken: string, signal?: AbortSignal): Promise<Record<string, unknown>>;
21
- }