import { AppConfigJson, BundleManifestJson, BundleManifestJson3x, I18N, Filter, BundleId, Bundle, Framework, ServiceReference, ServiceInstance, ServiceProperties, ServiceRegistration, BundleEventListener, EventHandle, FrameworkEventListener, ServiceEventListener, ExecutionEnvironment, FrameworkEvent, ServiceEvent, BundleState, BundleContext } from './index.js'; import 'apprt-core/Types'; interface InternalServiceRegistration extends ServiceRegistration { _getService(bundle: Bundle): unknown; _getBundle(): Bundle; _getUsingBundles(): Bundle[]; _isServiceCreated(bundle: Bundle): boolean; _isServiceUsed(bundle: Bundle): boolean; _ungetService(bundle: Bundle): boolean; } interface InternalServiceReference extends ServiceReference { _getRegistration(): InternalServiceRegistration; _matches(objectClass: string, filter: Filter | undefined): boolean; } interface InternalBundleContext extends BundleContext { _setBundle(bundle: Bundle): void; requireBundleClass(clazzName: string): unknown | Promise; getStatistics(): Statistics | undefined; } interface InternalBundle extends Bundle { setState(state: BundleState): void; _cleanup(): void; loadI18n(): Promise; [key: symbol]: unknown; createSubstitutionFunction(locale?: string): (v: string | undefined) => string | undefined; } interface InternalFramework extends Framework { setState(state: BundleState): void; _cleanup(): void; loadI18n(): Promise; [key: symbol]: unknown; createSubstitutionFunction(locale?: string): (v: string | undefined) => string | undefined; setStartLevel(level: number): void; getStartLevel(): number; _prefetchHook?(bundle: Bundle, layerName: string | undefined): Promise; } interface InternalBundleController { _globalI18nInstance: I18N; createFilter(filter: string | Filter): Filter; getBundleById(id: BundleId): Bundle | undefined; filterBundles(filter: string | Filter | ((b: Bundle) => boolean)): Bundle[]; getBundles(): Bundle[]; getBundleByName(name: string): Bundle | undefined; getSystemBundle(): Framework; installBundle(location: string | undefined, manifest: BundleManifestJson): Bundle; installFramework(location: string | undefined, manifest: BundleManifestJson): Framework; startBundle(bundle: Bundle): Promise; stopBundle(bundle: Bundle): Promise; uninstallBundle(bundle: Bundle): Promise; isServiceCreated(bundle: Bundle, ref: ServiceReference): boolean; isServiceUsed(bundle: Bundle, ref: ServiceReference): boolean; getService(bundle: Bundle, ref: ServiceReference): T | undefined; ungetService(bundle: Bundle, ref: ServiceReference): boolean; getServiceReferences(bundle: Bundle, interfaceName?: string, filter?: string | Filter): ServiceReference[]; getServiceReferencesProvidedByRequiredBundles(bundle: Bundle, interfaceName?: string, filter?: string | Filter): ServiceReference[]; registerService(bundle: Bundle, clazzes: string | ReadonlyArray, service: ServiceInstance, properties?: ServiceProperties): ServiceRegistration; unregisterService(reg: ServiceRegistration): void; getRegisteredServices(bundle: Bundle): ServiceReference[]; getServicesInUse(bundle: Bundle): ServiceReference[]; addBundleListener(bundle: Bundle, cb: BundleEventListener, scope?: any): EventHandle; removeBundleListener(bundle: Bundle, handle: EventHandle): void; addFrameworkListener(bundle: Bundle, cb: FrameworkEventListener, scope?: any): EventHandle; removeFrameworkListener(bundle: Bundle, handle: EventHandle): void; addServiceListener(bundle: Bundle, filter: string, cb: ServiceEventListener, scope?: any): EventHandle; removeServiceListener(bundle: Bundle, handle: EventHandle): void; getExecutionEnvironment(): ExecutionEnvironment; getMaxStartLevel(): number; _requireBundleClass(bundle: Bundle, clazzName: string): unknown | Promise; fireFrameworkChanged(evt: FrameworkEvent): void; fireServiceChanged(evt: ServiceEvent): void; } interface StatisticsMetricItem { name: string; start: number; end: number | undefined; } type StatisticsMetrics = Record; type StatisticsCallback = (fnName: string, ...args: any[]) => string; type StatisticsNameCallback = StatisticsCallback; type StatisticsMarkerCallback = StatisticsCallback; interface StatisticsMeasureHandle { (arg?: any): any; error(err?: any): void; } interface Statistics { data(): StatisticsMetrics; apprtStartFinished(): void; get(name: string): readonly StatisticsMetricItem[] | undefined; measure(name: string, phase?: string): StatisticsMeasureHandle; surround(obj: any, methodName: string, nameFn: string | StatisticsNameCallback, phaseFn?: string | StatisticsMarkerCallback | undefined): void; print(): string; } interface InternalAppConfigJson extends AppConfigJson { appLocation?: string; preProccessBundle?: (bundle: T) => T; _preoptimized?: { "bundles.json": string; "layer.js": string; }; } interface AppLoadCtx { appName?: string; domId?: string; appConfig?: InternalAppConfigJson; queryParams?: Record; skipBundles?: string[]; start?: string[]; allowedBundles?: string[]; bundleLocations?: (string | Partial)[]; configLocation?: string; configFilePattern?: string; configOpts?: Record; toGzipBase64ParamValue?: (param: string) => Promise; rootNode?: HTMLElement; logNode?: HTMLElement; installedBundles?: BundleLoadSuccess[]; } interface PackageLocationDefinition { name: string; location: string; root: string; useJSONP: boolean; exclude: string[]; static?: boolean; prefetch?: string; noprefetch?: boolean; appendVersionToBundleLocation?: boolean; } interface BundleLocator { locate(opts: AppLoadCtx): Promise; } type BundleLoadResult = BundleLoadSuccess | BundleLoadError; interface BundleLoadSuccess { name: string; manifest: BundleManifestJson; location: string; locationroot: PackageLocationDefinition; error?: undefined; } interface BundleLoadError { error: Error; name?: string; location?: string; locationroot?: PackageLocationDefinition; url?: string; } interface ConfigLocator { locate(opts: AppLoadCtx): Promise; } export type { AppLoadCtx, BundleLoadError, BundleLoadResult, BundleLoadSuccess, BundleLocator, ConfigLocator, InternalAppConfigJson, InternalBundle, InternalBundleContext, InternalBundleController, InternalFramework, InternalServiceReference, InternalServiceRegistration, PackageLocationDefinition, Statistics, StatisticsMarkerCallback, StatisticsMeasureHandle, StatisticsMetricItem, StatisticsMetrics, StatisticsNameCallback };