All files / src/classes CoreClient.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                                                                                          1x      
import type {
  ICoreCache,
  ICoreClient,
  ICoreElement,
  ICoreKernel,
  ICoreKernelModule,
  ICorePresenter,
  IDataBase,
} from '../lib';
import CoreElement from './CoreElement';
 
/**
 * Abstract base class for client components in the Core framework.
 *
 * This class extends {@link CoreElement} and implements {@link ICoreElement}. It provides a
 * foundational constructor that generates a unique identifier by prefixing the supplied
 * channel name with `"client-"` and forwards that identifier along with the module instance
 * to the parent {@link CoreElement} constructor.
 *
 * @abstract
 * @class CoreClient
 * @template K - Kernel type extending {@link ICoreKernel}.
 * @template T - Database type or `null` extending {@link IDataBase}.
 * @template P - Parent client type or `null` extending {@link ICoreClient}.
 * @template C - Cache type or `null` extending {@link ICoreCache}.
 * @template E - Presenter type or `null` extending {@link ICorePresenter}.
 *
 * @extends CoreElement<K, T, P, C, E>
 * @implements ICoreElement<K, T, P, C, E>
 *
 * @param {string} channel - Identifier used to construct the client’s unique name.
 * @param {ICoreKernelModule<K, T, P, C, E>} module - Module instance providing kernel, database,
 * cache, presenter, and parent client information.
 */
export default abstract class CoreClient<
    K extends ICoreKernel<any> = ICoreKernel<any>,
    T extends IDataBase<any, any> | null = any,
    P extends ICoreClient | null = any,
    C extends ICoreCache | null = any,
    E extends ICorePresenter<any> | null = any,
  >
  extends CoreElement<K, T, P, C, E>
  implements ICoreElement<K, T, P, C, E>
{
  constructor(module: ICoreKernelModule<K, T, P, C, E>) {
    super(`client-${module.getName()}`, module);
  }
}