diff --git a/packages/sync-core/src/index.ts b/packages/sync-core/src/index.ts index 0e11545ea7..d9bfea85b7 100644 --- a/packages/sync-core/src/index.ts +++ b/packages/sync-core/src/index.ts @@ -111,8 +111,6 @@ export type { OperationApplyPort, RemoteApplyWindowPort, SyncActionLike, - SyncConfigPort, - SyncConfigSnapshot, } from './ports'; // Conflict-resolution helpers. diff --git a/packages/sync-core/src/ports.ts b/packages/sync-core/src/ports.ts index ceb2988b51..3aac4c98d3 100644 --- a/packages/sync-core/src/ports.ts +++ b/packages/sync-core/src/ports.ts @@ -57,29 +57,6 @@ export interface ArchiveSideEffectPort | void; } -/** - * Domain-free sync configuration snapshot. - * - * Provider IDs stay plain strings at the package boundary. Host applications can - * narrow them in their adapter layer. - */ -export interface SyncConfigSnapshot { - isEnabled: boolean; - syncProvider: TProviderId | null; - isEncryptionEnabled?: boolean; - isCompressionEnabled?: boolean; - isManualSyncOnly?: boolean; - syncInterval?: number; -} - -/** - * Port for reading host sync configuration without importing framework store - * selectors or host provider enums. - */ -export interface SyncConfigPort { - getSyncConfig(): Promise>; -} - export interface ConflictUiDialogRequest { conflictType: string; scenario?: string; @@ -89,20 +66,10 @@ export interface ConflictUiDialogRequest { meta?: SyncPortMeta; } -export type ConflictUiNotificationSeverity = 'info' | 'warning' | 'error'; - -export interface ConflictUiNotification { - severity: ConflictUiNotificationSeverity; - message: string; - reason?: string; - meta?: SyncPortMeta; -} - /** * Port for conflict dialogs/snacks. Resolutions are strings so the host owns * user-facing choices such as USE_LOCAL, USE_REMOTE, or CANCEL. */ export interface ConflictUiPort { showConflictDialog(request: ConflictUiDialogRequest): Promise; - notify?(notification: ConflictUiNotification): Promise | void; } diff --git a/src/app/features/config/global-config.service.spec.ts b/src/app/features/config/global-config.service.spec.ts deleted file mode 100644 index 98fed8e1e3..0000000000 --- a/src/app/features/config/global-config.service.spec.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { MockStore, provideMockStore } from '@ngrx/store/testing'; -import { SyncProviderId } from '../../op-log/sync-providers/provider.const'; -import { DEFAULT_GLOBAL_CONFIG } from './default-global-config.const'; -import { GlobalConfigService } from './global-config.service'; -import { selectSyncConfig } from './store/global-config.reducer'; -import type { SyncConfig } from './global-config.model'; - -describe('GlobalConfigService', () => { - it('should expose a sync-core config snapshot without private provider fields', async () => { - const syncConfig = { - ...DEFAULT_GLOBAL_CONFIG.sync, - isEnabled: true, - syncProvider: SyncProviderId.SuperSync, - isEncryptionEnabled: true, - isCompressionEnabled: true, - isManualSyncOnly: true, - syncInterval: 15, - encryptKey: 'private-key', - } as SyncConfig; - - TestBed.configureTestingModule({ - providers: [provideMockStore()], - }); - - // overrideSelector bypasses feature-state lookup and any cross-spec - // pollution of the underlying store state. - const store = TestBed.inject(MockStore); - store.overrideSelector(selectSyncConfig, syncConfig); - - const snapshot = await TestBed.inject(GlobalConfigService).getSyncConfig(); - - expect(snapshot).toEqual({ - isEnabled: true, - syncProvider: SyncProviderId.SuperSync, - isEncryptionEnabled: true, - isCompressionEnabled: true, - isManualSyncOnly: true, - syncInterval: 15, - }); - expect('encryptKey' in snapshot).toBeFalse(); - }); -}); diff --git a/src/app/features/config/global-config.service.ts b/src/app/features/config/global-config.service.ts index bbcc6f005a..8f821a986d 100644 --- a/src/app/features/config/global-config.service.ts +++ b/src/app/features/config/global-config.service.ts @@ -1,9 +1,8 @@ import { Injectable, inject, Signal } from '@angular/core'; import { select, Store } from '@ngrx/store'; -import type { SyncConfigPort, SyncConfigSnapshot } from '@sp/sync-core'; import { toSignal } from '@angular/core/rxjs-interop'; import { updateGlobalConfigSection } from './store/global-config.actions'; -import { firstValueFrom, Observable } from 'rxjs'; +import { Observable } from 'rxjs'; import { DEFAULT_GLOBAL_CONFIG } from './default-global-config.const'; import { AppFeaturesConfig, @@ -47,9 +46,7 @@ import { distinctUntilChangedObject } from '../../util/distinct-until-changed-ob @Injectable({ providedIn: 'root', }) -export class GlobalConfigService implements SyncConfigPort< - NonNullable -> { +export class GlobalConfigService { private readonly _store = inject>(Store); // Keep observables for backward compatibility @@ -195,26 +192,4 @@ export class GlobalConfigService implements SyncConfigPort< }), ); } - - async getSyncConfig(): Promise< - SyncConfigSnapshot> - > { - const { - isEnabled, - syncProvider, - isEncryptionEnabled, - isCompressionEnabled, - isManualSyncOnly, - syncInterval, - } = await firstValueFrom(this.sync$); - - return { - isEnabled, - syncProvider, - isEncryptionEnabled, - isCompressionEnabled, - isManualSyncOnly, - syncInterval, - }; - } }