jsm-core
Version:
Core library for JSM project
32 lines (31 loc) • 1.67 kB
TypeScript
import { type JsmCoreSdk } from "jsm-sdk";
import config from '../app/config';
import { CacheManager } from "../app";
import { JsmCoreCache } from "../app/managers/cache-manager/core-cache";
declare class Registry<Sdk extends JsmCoreSdk = JsmCoreSdk, Cache extends CacheManager = CacheManager, Config extends typeof config = typeof config> {
private context;
private _sdk;
private _sdk_initiator;
private _cache;
private _cache_initiator;
constructor();
set<T>(key: string, value: T): this;
get<T>(key: string): T | undefined;
has(key: string): boolean;
get cwd(): string;
get sdk(): Sdk;
setSdkInitiator(initiator: () => Sdk): this;
get cache(): Cache;
setCache(cache: Cache): void;
setCacheInitiator(initiator: () => Cache): this;
config(_config: Config): this;
/**
*
* @param path wether to get the whole config object or a specific path
* @returns {object} the config object or a specific path
*/
getConfig<P extends (Jsm.Core.Utils.DocumentProperties<Config> | true)>(path: P | true, defaultValue?: P extends Jsm.Core.Utils.DocumentProperties<Config> ? Jsm.Core.Utils.GetPropertyByPath<Config, P> : never): P extends Jsm.Core.Utils.DocumentProperties<Config> ? Jsm.Core.Utils.GetPropertyByPath<Config, P> | undefined : Config;
setConfig<P extends Jsm.Core.Utils.DocumentProperties<Config>>(path: P, value: Jsm.Core.Utils.GetPropertyByPath<Config, P>): this;
}
export declare function getRegistry<Sdk extends JsmCoreSdk = JsmCoreSdk, Cache extends JsmCoreCache = JsmCoreCache, Config extends typeof config = typeof config>(): Registry<Sdk, Cache, Config>;
export {};