import { Operation as JsonPatchOperation } from 'fast-json-patch'; import { AsyncParallelHook } from 'tapable'; import { ConfigSettingsArgs } from '../types'; import { ConfigNodeBase } from './ConfigNodeBase'; import { FileConfigNodeFileResourceService } from './FileConfigNodeFileResource'; export { JsonPatchOperation }; export type ConfigNodeValue = string | number | boolean; export type ConfigNodeValueArg = ConfigSettingsArgs | ConfigNodeValue; export type ConfigNodePropertyPath = string | string[]; export interface ConfigNodeInheritedNodeOptionsArg { node: ConfigNodeBase; propertyPath: ConfigNodePropertyPath; includeRootProperty?: boolean; } export type ConfigNodeInheritedNodesArg = | ConfigNodeInheritedNodeOptionsArg | ConfigNodeBase | Array; export interface ConfigNodeOptions { shouldInheritParent?: boolean; } export interface ProfileConfigNodeOptions extends ConfigNodeOptions { profilePropertyName?: string; profilesPropertyName?: string; extendsPropertyName?: string; } export interface ProfileFileConfigNodeOptions extends ProfileConfigNodeOptions { profilesDirBaseName?: string; settingsBaseName?: string; resourceOptions?: FileConfigNodeFileResourceServiceOptions; // root path to use to resolve $ref references in initialValue initialValueRefRootDir?: string; } export interface ConfigNodeHooks = ConfigNodeBase> { valueChanged: AsyncParallelHook; propertyAdded: AsyncParallelHook; } export interface IFileConfigNode extends ConfigNodeBase { path: string; fileResources: FileConfigNodeFileResourceService; } export interface FileConfigNodeFileResourceServiceOptions { dirBaseName?: string; } export interface ConfigNodeArgs< TOptions extends ConfigNodeOptions = ConfigNodeOptions, TArgs extends ConfigPropertyNodeFactoryArgs = ConfigPropertyNodeFactoryArgs > { initialValue?: ConfigNodeValueArg; inheritedNodes?: ConfigNodeInheritedNodesArg; options?: TOptions; propertyNodeFactories?: Array>; } export interface ConfigPropertyNodeFactoryArgs extends ConfigNodeArgs { propertyName: string; parentNode: ConfigNodeBase; } export interface FileConfigNodeArgs extends ConfigNodeArgs { path: string; } export interface FileConfigPropertyNodeFactoryArgs extends FileConfigNodeArgs, ConfigPropertyNodeFactoryArgs {} export type ConfigNodePropertyFactory = ( args: TArg ) => Promise; export interface PropertyNodeFactoryOption { propertyPath: ConfigNodePropertyPath; factory: ConfigNodePropertyFactory; }