import * as _dmno_configraph from '@dmno/configraph'; import { ConfigraphCachingProvider, ConfigraphEntity, ConfigraphNode, Configraph, ConfigraphDataTypesRegistry, SerializedConfigraphNode, ConfigraphDataTypeDefinition, SerializedConfigraphEntity, SerializedConfigraphPlugin, ConfigValueResolver, ConfigraphPlugin, SchemaError, ConfigraphDataTypeDefinitionOrShorthand, ConfigLoadError } from '@dmno/configraph'; import crypto from 'node:crypto'; /** * utility to unmask a secret/sensitive value when logging to the console * currently this only works on a single secret, not objects or aggregated strings * */ declare function unredact(secretStr: string): string; type RedactMode = 'show_first_2' | 'show_last_2' | 'show_first_last'; declare class DmnoConfigraphCachingProvider extends ConfigraphCachingProvider { cacheDirPath?: string; get cacheFilePath(): string; get cacheKeyFilePath(): string; encryptionKey?: crypto.webcrypto.CryptoKey; encryptionKeyName?: string; private getEncryptedValue; load(): Promise; save(): Promise; reset(): Promise; } type UseAtPhases = 'build' | 'boot'; type DmnoDataTypeMetadata = { /** whether this config is sensitive and must be kept secret */ sensitive?: boolean | { /** customize redact/masking behaviour rules (defaults to `show_first_2`) */ redactMode?: RedactMode; /** list of allowed domains this sensitive item is allowed be sent to */ allowedDomains?: Array; }; /** set if the item will be injected by a platform/framework */ fromVendor?: string; /** at what time is this value required */ useAt?: UseAtPhases | Array; /** opt in/out of build-type code replacements - default is false unless changed at the service level */ dynamic?: boolean; /** set to false to keep this item out of DMNO_CONFIG */ includeInDmnoConfig?: boolean; }; declare class DmnoDataTypesRegistry extends ConfigraphDataTypesRegistry { } declare const createDmnoDataType: >(dataTypeDef: _dmno_configraph.ConfigraphDataTypeDefinition | ((...args: InstanceSettingsArgs) => _dmno_configraph.ConfigraphDataTypeDefinition)) => _dmno_configraph.ConfigraphDataTypeFactoryFn; type DynamicConfigModes = 'public_static' | 'only_static' | 'only_dynamic' | 'default_static' | 'default_dynamic'; type DmnoServiceSettings = { /** default behaviour for "dynamic" vs "static" behaviour of config items */ dynamicConfig?: DynamicConfigModes; /** enable patching global logging methods to redact sensitive config (where possible) */ redactSensitiveLogs?: boolean; /** enable patching http to intercept sending sensitive to config to non allowed domains (where possible) */ interceptSensitiveLeakRequests?: boolean; /** enable scanning all code and data for leaks before sending to the client (where possible) */ preventClientLeaks?: boolean; /** default `useAt` value */ defaultUseAt?: DmnoDataTypeMetadata['useAt']; }; type DmnoServiceMeta = { path?: string; }; type DmnoEntityMetadata = DmnoServiceSettings & DmnoServiceMeta; declare class DmnoConfigraph extends Configraph { defaultDataTypeRegistry: DmnoDataTypesRegistry; cacheProvider: DmnoConfigraphCachingProvider; constructor(); } declare class DmnoConfigraphServiceEntity extends ConfigraphEntity { NodeClass: typeof DmnoConfigraphNode; get dynamicConfig(): DynamicConfigModes | undefined; get redactSensitiveLogs(): boolean | undefined; get interceptSensitiveLeakRequests(): boolean | undefined; get preventClientLeaks(): boolean | undefined; get defaultUseAt(): UseAtPhases | UseAtPhases[] | undefined; get settings(): { dynamicConfig: DynamicConfigModes | undefined; redactSensitiveLogs: boolean | undefined; interceptSensitiveLeakRequests: boolean | undefined; preventClientLeaks: boolean | undefined; defaultUseAt: UseAtPhases | UseAtPhases[] | undefined; }; toJSON(): { settings: { dynamicConfig: DynamicConfigModes | undefined; redactSensitiveLogs: boolean | undefined; interceptSensitiveLeakRequests: boolean | undefined; preventClientLeaks: boolean | undefined; defaultUseAt: UseAtPhases | UseAtPhases[] | undefined; }; configNodes: { [x: string]: SerializedConfigItem; }; id: string; parentId: string | undefined; isSchemaValid: boolean; isValid: boolean; isResolved: boolean; schemaErrors: { isWarning?: true | undefined; tip?: string | undefined; icon: string; type: string; name: string; message: string; isUnexpected: boolean; }[] | undefined; ownedPluginIds: string[]; injectedPluginIds: string[]; color: string | undefined; icon: string | undefined; }; getInjectedEnvJSON(): InjectedDmnoEnv; } declare class DmnoConfigraphNode extends ConfigraphNode { get isSensitive(): boolean; get includeInDmnoConfig(): boolean; get isDynamic(): boolean; get redactMode(): RedactMode | undefined; get useAt(): Array | undefined; toJSON(): SerializedConfigItem; /** this is the shape that gets injected into an serialized json env var by `dmno run` */ toInjectedJSON(): InjectedDmnoEnvItem; typeGen: { customLabel: () => "" | " 🔐 _sensitive_"; customSuffix: () => string; }; } type SerializedWorkspace = { services: Record; plugins: Record; }; type SerializedService = Pick & { configLoadError?: SerializedDmnoError; configNodes: Record; } & SerializedConfigraphEntity; type SerializedConfigItem = Omit & { dataType: SerializedDmnoDataType; children: Record; isDynamic: boolean; isSensitive: boolean; useAt?: Array; _resolvedValue?: string; _resolvedRawValue?: string; }; type SerializedResolver = Pick & { icon?: string; label?: string; resolvedValue?: any; createdByPluginInstanceName?: string; branches?: Array; resolutionError?: SerializedDmnoError; }; type SerializedResolverBranch = { label: string; isDefault: boolean; isActive: boolean | undefined; resolver: SerializedResolver; }; type SerializedDmnoDataType = Pick, 'summary' | 'description' | 'typeDescription' | 'required' | 'externalDocs' | 'ui' | 'sensitive' | 'useAt' | 'dynamic'>; type SerializedDmnoPlugin = Omit & { cliPath?: string; inputNodes: Record; }; /** shape of how we will serialize our errors when sending over the wire */ type SerializedDmnoError = { icon: string; type: string; name: string; message: string; isUnexpected: boolean; cleanedStack?: Array; tip?: string; }; declare class InjectedPluginDoesNotExistError extends SchemaError { } declare abstract class DmnoPlugin extends ConfigraphPlugin { static cliPath?: string; private getStaticProp; get cliPath(): string | undefined; EntityClass: typeof DmnoConfigraphServiceEntity; constructor(...args: ConstructorParameters>); static injectInstance(this: new (...args: Array) => T, instanceName: string): T; injectingEntityIds: Array; toJSON(): SerializedDmnoPlugin; } declare function beginWorkspaceLoadPlugins(workspace: DmnoWorkspace): void; declare function beginServiceLoadPlugins(): void; declare function finishServiceLoadPlugins(service: DmnoService): void; type NestedOverrideObj = { [key: string]: NestedOverrideObj | T; }; declare class OverrideSource { readonly type: string; readonly label: string | undefined; readonly icon: string; readonly values: NestedOverrideObj; readonly enabled: boolean; constructor(type: string, label: string | undefined, icon: string, values: NestedOverrideObj, enabled?: boolean); /** get an env var override value using a dot notation path */ getOverrideForPath(path: string): string | NestedOverrideObj; } type MaybePromise = T | Promise; type DmnoOverrideLoader = { load: (ctx: DmnoOverrideLoaderCtx) => MaybePromise>; }; type DmnoOverrideLoaderCtx = { serviceId: string; servicePath: string; }; declare function processEnvOverrideLoader(): DmnoOverrideLoader; declare function dotEnvFileOverrideLoader(): DmnoOverrideLoader; /** * options for defining a service's config schema * @category HelperMethods */ type DmnoServiceConfig = { /** service name - if empty, name from package.json will be used */ name?: string; /** settings for this service - each item will be inherited from parent(s) if unspecified */ settings?: DmnoServiceSettings; /** @deprecated No longer required - can be safely removed */ isRoot?: never; /** * @deprecated No longer supported - picked items can be defined within `schema` now using `PICKED_ITEM: { extends: pick('entity', 'path') }` * @see https://dmno.dev/docs/guides/schema/#pick * */ pick?: never; /** override loading plugins - if not specified, will default to loading process env vars and dotenv files */ overrides?: Array; /** the config schema itself */ schema: Record>; /** iconify icon name */ icon?: string; /** custom color for this entity */ color?: string; /** name of parent service (if applicable) - if empty this service will be a child of the root service */ parent?: string; /** optional array of "tags" for the service */ tags?: Array; }; type InjectedDmnoEnvItem = { value: any; dynamic?: boolean | 1 | '1'; sensitive?: boolean | 1 | '1'; redactMode?: RedactMode; allowedDomains?: Array; }; type InjectedDmnoEnv = Record & { $SETTINGS: DmnoServiceSettings; }; type SensitiveValueLookup = Record; }>; declare function defineDmnoService(opts: DmnoServiceConfig): DmnoServiceConfig; declare class DmnoWorkspace { private services; private servicesArray; private servicesByPackageName; private rootServiceName; get rootService(): DmnoService; get rootPath(): string; plugins: Record; addService(service: DmnoService): void; private servicesDag; initServicesDag(): void; readonly configraph: DmnoConfigraph; processConfig(): void; resolveConfig(opts?: { resolutionPhase?: UseAtPhases; }): Promise; get allServices(): DmnoService[]; getService(descriptor: string | { serviceName?: string; packageName?: string; }): DmnoService; toJSON(): SerializedWorkspace; } declare class DmnoService { /** name of service according to package.json file */ readonly packageName: string; /** name of service within dmno - pulled from config.ts but defaults to packageName if not provided */ readonly serviceName: string; /** true if service is root */ readonly isRoot: boolean; /** path to the service itself */ readonly path: string; /** unprocessed config schema pulled from config.ts */ readonly rawConfig?: DmnoServiceConfig; /** error encountered while _loading_ the config schema */ configLoadError?: ConfigLoadError | SchemaError; readonly workspace: DmnoWorkspace; configraphEntity: DmnoConfigraphServiceEntity; /** error within the schema itself */ get schemaErrors(): SchemaError[]; injectedPluginIds: Array; ownedPluginIds: Array; constructor(opts: { packageName: string; path: string; workspace: DmnoWorkspace; isRoot: boolean; rawConfig: DmnoServiceConfig | ConfigLoadError; }); get parentService(): DmnoService | undefined; get icon(): string; get config(): Record; overrideSources: Array; loadOverrides(): Promise; get isSchemaValid(): boolean; get isValid(): boolean; /** * key/value object of resolved config ready to be injected as actual environment variables (process.env) */ getInjectedProcessEnv(): Record; get settings(): DmnoServiceSettings; getInjectedEnvJSON(): InjectedDmnoEnv; toJSON(): SerializedService; } export { type SerializedResolver as A, type SerializedResolverBranch as B, type SerializedDmnoDataType as C, type DmnoDataTypeMetadata as D, type SerializedDmnoError as E, type InjectedDmnoEnv as I, OverrideSource as O, type RedactMode as R, type SerializedWorkspace as S, type UseAtPhases as U, type InjectedDmnoEnvItem as a, type SerializedDmnoPlugin as b, type SerializedService as c, type DmnoOverrideLoader as d, dotEnvFileOverrideLoader as e, type DmnoServiceConfig as f, type SensitiveValueLookup as g, defineDmnoService as h, DmnoWorkspace as i, DmnoService as j, createDmnoDataType as k, type DynamicConfigModes as l, type DmnoServiceSettings as m, type DmnoServiceMeta as n, type DmnoEntityMetadata as o, processEnvOverrideLoader as p, DmnoConfigraph as q, DmnoConfigraphServiceEntity as r, DmnoConfigraphNode as s, InjectedPluginDoesNotExistError as t, unredact as u, DmnoPlugin as v, beginWorkspaceLoadPlugins as w, beginServiceLoadPlugins as x, finishServiceLoadPlugins as y, type SerializedConfigItem as z };