Skip to content

Introduction

Complete TypeScript type definitions for ee-core. All public interface and configuration types are centralized here, referenced by framework modules and business code for type safety. These types are also exported from the main ee-core entry point via export type.

Import

javascript
// ESM (type-only import)
import type { ElectronEggOptions, Config } from 'ee-core/types';
import type { ElectronEggOptions, Config } from 'ee-core';

// CJS (type-only, via ts-ignore for runtime)
// TypeScript types are not available at runtime in CJS
// Use JSDoc or .d.ts files for type annotations

App Types

ElectronEggOptions

Framework startup options, constructed during initialization. Values do not change throughout the application lifecycle.

FieldTypeDescription
envstringRuntime environment ('dev', 'prod', 'test')
baseDirstringProject root directory
electronDirstringElectron source directory
appNamestringApplication name from package.json
userHomestringUser home directory (os.homedir())
appDatastringSystem app data directory
appUserDatastringElectron user data directory (appData/appName)
appVersionstringApplication version from package.json
isPackagedbooleanWhether packaged as installer
execDirstringExecutable directory

AppInfo

Application metadata, passed as parameter to configuration functions.

FieldTypeDescription
namestringApplication name
baseDirstringProject root directory
electronDirstringElectron source directory
envstringRuntime environment
rootstringLog/data root directory (usually appUserData)

Example:

javascript
// config.default.js
module.exports = (appInfo) => {
  const config = {};
  config.logger.dir = path.join(appInfo.root, 'logs');
  return config;
};

See also: config


Config Types

Config

Main framework configuration interface. The type definition for the object exported by config.default.js.

FieldTypeDescription
[key: string]unknownDynamic properties for user-defined config
openDevToolsboolean | OpenDevToolsOptionsDevTools configuration
singleLockbooleanSingle instance lock
windowsOptionBrowserWindowConstructorOptionsBrowserWindow constructor options
loggerLoggerConfigLogger configuration
socketServerSocketServerConfigSocket.IO configuration
httpServerHttpServerConfigHTTP service configuration
remoteRemoteConfigRemote service configuration
mainServerMainServerConfigMain window service configuration
exceptionExceptionConfigException handling configuration
jobsJobsConfigBackground jobs configuration
crossCrossConfigCross-process configuration

See also: config

RemoteConfig

FieldTypeDescription
enablebooleanWhether to enable remote service
urlstringRemote service address

MainServerConfig

FieldTypeDescription
protocolstring'file://' for local file, 'http://'/'https://' for remote
indexPathstringEntry file/URL path
optionsRecord<string, unknown>Extra options for protocol handling
takeoverstringLoading strategy: 'start' or 'ready'
loadingPagestringPreload page path for splash screens
channelSeparatorstringIPC channel separator, default '/'

SocketServerConfig

FieldTypeDescription
enablebooleanWhether to enable Socket service
portnumberListening port
pathstringSocket.IO path
connectTimeoutnumberConnection timeout (ms)
pingTimeoutnumberHeartbeat timeout (ms)
pingIntervalnumberHeartbeat interval (ms)
maxHttpBufferSizenumberMax HTTP message body bytes
transports('polling' | 'websocket')[]Transport list
corsobjectCORS configuration
channelstringCustom communication channel name

HttpsConfig

FieldTypeDescription
enablebooleanWhether to enable HTTPS
keystringSSL private key file path
certstringSSL certificate file path

HttpServerConfig

FieldTypeDescription
enablebooleanWhether to enable HTTP service
httpsHttpsConfigHTTPS certificate config
protocolstring'http' or 'https'
hoststringListening host, default '127.0.0.1'
portnumberListening port
cors{ origin: string }CORS configuration
bodyobjectRequest body parsing config
filterRequest{ uris: string[], returnData: string }Request filter config
koaConfigKoaConfigKoa middleware extension

KoaConfig

FieldTypeDescription
preMiddlewareFunction[]Pre-middleware list
postMiddlewareFunction[]Post-middleware list
errorHandlerFunction | nullCustom error handler

LoggerConfig

FieldTypeDescription
dirstringLog file directory (default: appUserData/logs)
levelstringMinimum log level
prettyPrintbooleanEnable pino-pretty (dev only)
dateFormatstringTimestamp date format
appLogNamestringApplication log filename
coreLogNamestringCore log filename
errorLogNamestringError log filename
rotatorstringRotation period ('daily' or 'hourly')
redactstring[]Fields to redact
redactCensorstring | FunctionRedaction replacement
timestampbooleanInclude timestamps
timezonestringIANA timezone (default 'UTC')
namestringLogger name
maxSizenumber | stringMax single log file size
serializersobjectCustom serializers
customLevelsobjectCustom level mapping
depthLimitnumberObject serialization depth limit
safebooleanSafe mode (no exception on write failure)
enabledbooleanEnable/disable logging

ExceptionConfig

FieldTypeDescription
mainExitbooleanMain process exception exits app
childExitbooleanChild process exit terminates main
rendererExitbooleanRenderer process exit strategy

JobsConfig

FieldTypeDescription
messageLogbooleanLog child process IPC messages

CrossTargetConfig

FieldTypeDescription
namestringTarget process identifier
enablebooleanWhether to enable
argsstring[]Command line arguments
cmdstringStartup command
directorystringWorking directory
windowsExtnamebooleanAuto-add .exe on Windows
stdiostring[]Child process stdio config
appExitbooleanExit main when child exits
portnumberChild process HTTP port
urlstringChild process service URL

CrossConfig

Dynamic key map where each value is CrossTargetConfig.

typescript
interface CrossConfig {
  [key: string]: CrossTargetConfig;
}

Jobs Types

JobChildOptions

FieldTypeDescription
namestringJob name identifier
scriptstringChild process entry script path
argsstring[]Command line arguments
envProcessEnvChild process environment variables
portnumberHTTP service port

ChildPoolOptions

FieldTypeDescription
weightsnumber[]Weight configuration for pool members

LoadBalancerTarget

FieldTypeDescription
idstring | numberTarget identifier
weightnumberWeight value

LoadBalancerOptions

FieldTypeDescription
targetsLoadBalancerTarget[]Target list
algorithmstringAlgorithm name

AlgorithmType

KeyValueDescription
polling'polling'Round-robin
weights'weights'Weighted round-robin
random'random'Random selection
specify'specify'Specified target
weightsPolling'weightsPolling'Smooth weighted round-robin
weightsRandom'weightsRandom'Weighted random
minimumConnection'minimumConnection'Least connections
weightsMinimumConnection'weightsMinimumConnection'Weighted least connections

JobProcessOptions

FieldTypeDescription
processArgsRecord<string, unknown>Arguments for child_process.fork
processOptionsForkOptionsFork options
[key: string]unknownCustom properties

Dev Types

DevConfig

FieldTypeDescription
frontendDevFrontendConfigFrontend dev config
electronDevElectronConfigElectron dev config

DevFrontendConfig

FieldTypeDescription
directorystringFrontend directory
cmdstringCommand
argsstring[]Arguments
protocolstringFrontend protocol
hostnamestringHostname
portnumberPort
indexPathstringIndex page
forcebooleanForce refresh
syncbooleanSync mode

DevElectronConfig

FieldTypeDescription
directorystringDirectory
cmdstringCommand
argsstring[]Arguments
loadingPagestringLoading page path
watchbooleanWatch mode
syncbooleanSync mode
delaynumberDebounce delay (ms)

Loader Types

FileLoaderOptions

FieldTypeDescription
caseStyle'lower' | 'upper' | 'camel' | FunctionProperty naming style. 'lower' = first letter lowercase (controllers)
directorystringDirectory path(s) to scan
initializerFunction | nullCustom initializer for file exports
callbooleanAuto-call function-type exports
overridebooleanOverride same-name properties
injectunknownInjection parameters for auto-called functions
matchstring | string[] | FunctionFile match pattern
ignorestring | string[] | FunctionFile ignore pattern
registryRegistryEntry[]Pre-registry entries (bundle mode)

RegistryEntry

FieldTypeDescription
fullpathstringFull file path
propertiesstring[]Property path array from file path
moduleunknownLazily loaded module

TimingItem

FieldTypeDescription
namestringStage name
startnumberStart time (ms)
endnumber | undefinedEnd time (ms)
durationnumber | undefinedDuration (ms)
pidnumberProcess PID
indexnumberExecution order index

Message Types

MessageData

FieldTypeDescription
channelstringCommunication channel identifier
eventstringEvent name
dataunknownMessage payload

ProcessExitEventData

FieldTypeDescription
pidnumber | undefinedPID of exited process

Utils Types

ExtendOptions

FieldTypeDescription
deepbooleanWhether to deep merge

JsonWriteOptions

FieldTypeDescription
spacenumberNumber of indent spaces (default: 2)
replacerFunctionJSON.stringify replacer

GetPortOptions

FieldTypeDescription
portnumber | number[]Preferred port or range
hoststringBound host address

Cross Types

CrossRunOptions

Partial<CrossTargetConfig> — Options when running a cross-process service.

CrossProcessOptions

FieldTypeDescription
targetConfCrossTargetConfigTarget configuration
portnumberAllocated port

CrossHost

FieldTypeDescription
emitterEventEmitter | undefinedEvent emitter

Log Types

EeLogger

Unified log interface (Pino-based).

typescript
interface EeLogger {
  trace(msg: string, ...args: unknown[]): void;
  debug(msg: string, ...args: unknown[]): void;
  info(msg: string, ...args: unknown[]): void;
  warn(msg: string, ...args: unknown[]): void;
  error(msg: string, ...args: unknown[]): void;
  fatal(msg: string, ...args: unknown[]): void;
  child(bindings: Record<string, unknown>): EeLogger;
}

PinoLoggers

FieldTypeDescription
loggerpino.LoggerApplication logger instance
coreLoggerpino.LoggerFramework core logger
errorLoggerpino.LoggerError-only logger