import { Handle, EventSource } from 'apprt-core/Types'; /** * Defines important 'manifest.json' properties of map.apps versions prior to 4.x . */ interface BundleManifestJson3x { /** Any additional properties. The 'manifest.json' is extensible and can also have other keys. */ [key: string]: unknown; /** * The symbolic name (unique ID) of the bundle. */ "Bundle-SymbolicName"?: string; /** * The version of the bundle. */ "Bundle-Version"?: string; /** * The title of the bundle, used as display name. */ "Bundle-Name"?: string; /** * The description of the bundle. */ "Bundle-Description"?: string; /** * The vendor of the bundle. */ "Bundle-Vendor"?: string; /** * A list of keywords/categories for the bundle. */ "Bundle-Category"?: string[]; /** * A contact address for the vendor. */ "Bundle-ContactAddress"?: unknown; /** * The copyright notice of the bundle. */ "Bundle-Copyright"?: string; /** * A link to the documentation. */ "Bundle-DocURL"?: string; /** * The main entry point of the bundle. Default: main.js */ "Bundle-Main"?: string; /** * The icon of the bundle. This field is not exactly specified. */ "Bundle-Icon"?: unknown; /** * The namespace of the bundle. */ "Bundle-Namespace"?: string; /** * The layer file of the bundle. Default: module.js */ "Bundle-Layer"?: string; /** * The start level of the bundle. The default is 50. Smaller numbers will start earlier. */ "Bundle-StartLevel"?: number; /** * Defines, if the bundle starts automatically. Default is 'yes'. */ "Bundle-AutoStartPolicy"?: boolean | AUTOSTART_POLICY_YES | AUTOSTART_POLICY_NO; /** * Activator implementation class of the bundle. */ "Bundle-Activator"?: string; /** * The i18n files of the bundle. */ "Bundle-Localization"?: string[]; /** * Browsers and devices that are supported by the bundle. */ "Bundle-RequiredExecutionEnvironment"?: string[]; /** * Browsers and devices that are not supported by the bundle. */ "Bundle-ExcludedExecutionEnvironment"?: string[]; /** * Components provided by the bundle. */ "Components"?: unknown; /** * The product name associated with the bundle. */ "Product-Name"?: string; /** * The license of the bundle. */ "Bundle-License"?: { name: string; }; /** * Dependencies of the bundle. */ "Require-Bundle"?: RequiredBundleJson[]; } /** * Describes a required bundle / dependency of a bundle. */ interface RequiredBundleJson { /** * The symbolic name (unique ID) of a required bundle. */ name: string; /** * The version or version range expression that should be matched by the required bundle. */ version: string; /** * Defines, if the required bundle is an optional or mandatory dependency. Default is 'mandatory'. */ policy?: "optional" | "mandatory"; } /** * Describes the dependency of a bundle. */ interface BundleDependency { /** * The symbolic name (unique ID) of the dependency. */ readonly name: string; /** * The version range expression that should be matched by the dependency. */ readonly version: SemVerRange; /** * Defines, if the dependency is an optional or mandatory dependency. Default is 'mandatory'. */ readonly policy: "optional" | "mandatory"; } /** * Autostart policy value 'yes'. Defines, if the bundle starts automatically. */ type AUTOSTART_POLICY_YES = "yes"; /** * Autostart policy value 'no'. Defines, if the bundle starts automatically. */ type AUTOSTART_POLICY_NO = "no"; /** * Well known 'manifest.json' properties for map.apps */ interface WellknownBundleManifestJsonEntries { /** The symbolic name (unique ID) of the bundle. */ "name": string; /** The version of the bundle. */ "version"?: string; /** The title of the bundle, used as display name. */ "title"?: string; /** The description of the bundle.*/ "description"?: string; /** * Indicates, if this JavaScript package is a 'bundle'. * If true, the default value for the field: * - 'main' is "main" * - 'i18n' is ["bundle"] * - 'layer' is "module" * If false, the default values do not apply and the fields are considered 'empty'. */ "bundle"?: boolean; /** * The main entry point of the bundle. * Typically, it is no longer required. */ "main"?: string; /** * The i18n files of the bundle. * If used, the value should be `["bundle"]`, pointing to the i18n files located at `/nls/bundle.js`. */ "i18n"?: string[]; /** * This key is only valid, if the bundle is an i18n extension bundle. * In this case, it extends or overwrites the global i18n keys of other bundles. * Example value: '["bundle"]'. */ "i18n-extension"?: string[]; /** * The layer file of the bundle. It contains compressed JavaScript resources. * This file is fetched by the loading system, if the bundle is required by an app. */ "layer"?: string; /** * The start level of the bundle. * The start level is a number between 1 and 100. * It can be used to start a bundle earlier or later than other bundles. * The default start level is 50. * Smaller numbers will start earlier. */ "startLevel"?: number; /** * Activator implementation class of the bundle. */ "activator"?: string; /** * Defines, if the bundle starts automatically. Default is 'yes'. */ "autoStartPolicy"?: boolean | AUTOSTART_POLICY_YES | AUTOSTART_POLICY_NO; /** * The namespace of the bundle. The namespace is used to register the bundle in the AMD loader. * @deprecated This property is obsolete and should not be used anymore. */ "namespace"?: string; /** * Browsers and devices that are supported by the bundle. */ "requiredExecutionEnvironment"?: string[]; /** * Browsers and devices that are not supported by the bundle. */ "excludedExecutionEnvironment"?: string[]; /** * Dependencies of the bundle. * e.g. { apprt-core: "~4.2.3" } */ "dependencies"?: Record; /** * Optional Dependencies of the bundle. * e.g. { apprt-core: "~4.2.3" } */ "optionalDependencies"?: Record; /** * The declarative components provided by the bundle. */ "components"?: Record[]; /** * Indicates, if the 'resolve' phase of the bundle start should be skipped. */ "skipResolve"?: boolean; /** * The product name associated with the bundle. */ "productName"?: string; /** * The vendor of the bundle. */ "vendor"?: string; /** * A list of keywords for the bundle. */ "keywords"?: string[]; /** * The copyright notice of the bundle. */ "copyright"?: string; /** * The URL of the bundle. Points e.g. to the bundle's code. */ "url"?: string; /** * A contact address for the vendor. */ "contactAddress"?: string; /** * The icon of the bundle. This field is not exactly specified. */ "icon"?: unknown; /** * The licenses of the bundle. */ "licenses"?: { type: string; }[]; /** * The location of the bundle. It is calculated by the JS registry backend. */ "location"?: string; } /** * Defines 'manifest.json' properties of map.apps */ interface BundleManifestJson extends WellknownBundleManifestJsonEntries { /** Any additional properties. The 'manifest.json' is extensible and can also have other keys. */ [key: string]: unknown; } /** * Helper to access the parsed header information of the 'manifest.json' of the bundle. */ interface WellknownBundleManifestEntries extends Omit { /** * The version of the bundle. */ readonly "version": SemVer; /** * The dependencies of the bundle. */ readonly "Require-Bundle": BundleDependency[]; /** * Defines, if the bundle starts automatically. Default is 'yes'. */ readonly "autoStartPolicy": AUTOSTART_POLICY_YES | AUTOSTART_POLICY_NO; /** * The start level of the bundle. The default start level is 50. * Smaller numbers will start earlier. */ readonly "startLevel": number; } /** * Helper to access the parsed header information of the 'manifest.json' of the bundle. */ interface BundleManifestEntries extends WellknownBundleManifestEntries { /** * The bundle header information may also have additional properties * */ readonly [key: string]: unknown; } /** * A version number following semantic versioning. * See */ interface SemVer { /** * The version as text. */ readonly version: string; /** * The major part of the version e.g. `1` from `1.2.3` */ readonly major: number; /** * The minor part of the version e.g. `2` from `1.2.3` */ readonly minor: number; /** * The patch part of the version e.g. `3` from `1.2.3` */ readonly patch: number; /** * The hot fix part of the version e.g. `4` from `1.2.3.4` * @deprecated This should not be used anymore. */ readonly hotfix: number; /** * The parts of the pre-release string of the version e.g. [`RC`, `1`] from `1.2.3-RC-1` */ readonly prerelease: ReadonlyArray; /** * The build number part of the version. * e.g. `20240122001` from 1.2.3+20240122001 */ readonly build: string; /** * Indicates that the version is a pre-release version. */ readonly isPrerelease: boolean; /** * Compares this version to another version. * @param other The other version. * @returns x < 0: this version lower, x > 0:this version greater, x = 0: both versions are equal */ compare(other: SemVer): number; /** * Check, if this version equals another version. * @param other The other version. * @returns true if the versions are equal. */ equals(other: SemVer): boolean; /** * Creates a new version without the build part. * @returns A new version without the build part or the same version, if it has no build part. */ stripBuild(): SemVer; /** * Creates new version without pre-release information. * @returns A new version without the pre-release part or the same version if it has no pre-release part. */ stripPreRelease(): SemVer; /** * Creates the lowest pre-release version of this version. * The lowest pre-release version is a version with the pre-release `-0` post fix. * e.g. `1.2.3-0` * @returns The lowest pre-release version. */ lowestPreRelease(): SemVer; /** * String representation of the version. * @returns The version as String. */ toString(): string; } /** * Visitor of a semantic version range. */ interface SemVerRangeVisitor { /** * Pre-visits an 'or' expression. */ preVisitOr(): void; /** * Pre-visits an 'and' expression. */ preVisitAnd(): void; /** * Visits a range expression. * @param low the lower version * @param lowIsInclusive indicate if the lower version should be included * @param up the upper version * @param upIsInclusive indicate if the upper version should be included */ visitRange(low: SemVer | undefined, lowIsInclusive: boolean, up: SemVer | undefined, upIsInclusive: boolean): void; /** * Post-visits an 'or' expression. */ postVisitOr(): void; /** * post-visits an 'and' expression. */ postVisitAnd(): void; } /** * A semantic version range. */ interface SemVerRange { /** * String representation of the version range. */ readonly expression: string; /** * Check if the version range matches any version * @returns true if the range matches */ isAny(): boolean; /** * Check if a version is included in the range. * @param v the version to test * @returns true if the version is included. */ contains(v: SemVer): boolean; /** * A given visitor can navigate over the range. * @param visitor the visitor */ visit(visitor: SemVerRangeVisitor): void; /** * Creates a string representation of the range. */ toString(): string; } /** * A handle to remove a registered event. */ type EventHandle = Handle; /** * The BundleEvent type `INSTALLED`. */ type BundleEvent_INSTALLED = 1; /** * The BundleEvent type `STARTED`. */ type BundleEvent_STARTED = 2; /** * The BundleEvent type `STOPPED`. */ type BundleEvent_STOPPED = 4; /** * The BundleEvent type `UNINSTALLED`. */ type BundleEvent_UNINSTALLED = 16; /** * The BundleEvent type `RESOLVING`. */ type BundleEvent_RESOLVING = 24; /** * The BundleEvent type `RESOLVED`. */ type BundleEvent_RESOLVED = 32; /** * The BundleEvent type `UNRESOLVED`. */ type BundleEvent_UNRESOLVED = 64; /** * The BundleEvent type `STARTING`. */ type BundleEvent_STARTING = 128; /** * The BundleEvent type `STOPPING`. */ type BundleEvent_STOPPING = 256; /** * All possible BundleEvent types. */ type BundleEventTypes = BundleEvent_INSTALLED | BundleEvent_STARTED | BundleEvent_STOPPED | BundleEvent_UNINSTALLED | BundleEvent_RESOLVING | BundleEvent_RESOLVED | BundleEvent_UNRESOLVED | BundleEvent_STARTING | BundleEvent_STOPPING; /** * All BundleEvent names. */ type BundleEventNames = "INSTALLED" | "STARTED" | "STOPPED" | "UNINSTALLED" | "RESOLVING" | "RESOLVED" | "UNRESOLVED" | "STARTING" | "STOPPING"; /** * A bundle event. */ interface BundleEvent { /** * Get the event type as number. * @returns the type of the event as number constant. */ getType(): BundleEventTypes; /** * Get the name of the event type. * @returns the name of the event as string. */ getTypeName(): BundleEventNames; /** * Get the bundle that was changed * @returns the bundle */ getBundle(): Bundle; /** * Get the source bundle that was throwing the event. * @returns the source bundle. */ getSource(): Bundle; } /** * A BundleEvent listener method. */ interface BundleEventListener { /** * EventListener that receives a BundleEvent. * @param evt the event to handle */ (evt: BundleEvent): void; } /** * The FrameworkEvent type `STARTED`. */ type FrameworkEvent_STARTED = 1; /** * The FrameworkEvent type `ERROR`. */ type FrameworkEvent_ERROR = 2; /** * The FrameworkEvent type `STARTLEVEL_CHANGED`. */ type FrameworkEvent_STARTLEVEL_CHANGED = 8; /** * The FrameworkEvent type `WARNING`. */ type FrameworkEvent_WARNING = 16; /** * The FrameworkEvent type `STOPPED`. */ type FrameworkEvent_STOPPED = 64; /** * All possible FrameworkEvent types. */ type FrameworkEventTypes = FrameworkEvent_STARTED | FrameworkEvent_ERROR | FrameworkEvent_STARTLEVEL_CHANGED | FrameworkEvent_WARNING | FrameworkEvent_STOPPED; /** * All FrameworkEvent names. */ type FrameworkEventNames = "STARTED" | "ERROR" | "STARTLEVEL_CHANGED" | "WARNING" | "STOPPED"; /** * A framework event. */ interface FrameworkEvent { /** * Get the event type as number. * @returns the type of the event as number constant. */ getType(): FrameworkEventTypes; /** * Get the name of the event type. * @returns the name of the event as string. */ getTypeName(): FrameworkEventNames; /** * Get the bundle associated with the event. * @returns the bundle */ getBundle(): Bundle; /** * Get the source bundle that was throwing the event. * @returns the source bundle. */ getSource(): Bundle; /** * Get the error if the event is of type `ERROR`. * @returns the error or 'undefined' */ getError(): Error | undefined; } /** * A FrameworkEvent listener method. */ interface FrameworkEventListener { /** * EventListener that receives a FrameworkEvent. * @param evt the event to handle */ (evt: FrameworkEvent): void; } /** * The ServiceEvent type `REGISTERED`. */ type ServiceEvent_REGISTERED = 1; /** * The ServiceEvent type `MODIFIED`. */ type ServiceEvent_MODIFIED = 2; /** * The ServiceEvent type `UNREGISTERING`. */ type ServiceEvent_UNREGISTERING = 4; /** * The ServiceEvent type `LAZY_GET`. */ type ServiceEvent_LAZY_GET = 8; /** * The ServiceEvent type `LAZY_UNGET`. */ type ServiceEvent_LAZY_UNGET = 9; /** * All possible ServiceEvent types. */ type ServiceEventTypes = ServiceEvent_REGISTERED | ServiceEvent_MODIFIED | ServiceEvent_UNREGISTERING | ServiceEvent_LAZY_GET | ServiceEvent_LAZY_UNGET; /** * All ServiceEvent names. */ type ServiceEventNames = "REGISTERED" | "MODIFIED" | "UNREGISTERING" | "LAZY_GET" | "LAZY_UNGET"; /** * A service event. */ interface ServiceEvent { /** * Get the event type as number. * @returns the type of the event as number constant. */ getType(): ServiceEventTypes; /** * Get the name of the event type. * @returns the name of the event as string. */ getTypeName(): ServiceEventNames; /** * Get the bundle providing the changed service. * @returns the bundle */ getBundle(): Bundle; /** * Get the source bundle that was throwing the event. * @returns the source bundle. */ getSource(): ServiceReference; /** * Get the reference to the changed service. * @returns the service reference */ getServiceReference(): ServiceReference; } /** * A service event listener method. */ interface ServiceEventListener { /** * EventListener that receives a ServiceEvent. * @param evt the event to handle */ (evt: ServiceEvent): void; } /** * All possible states of a bundle. */ interface BundleStates { /** * Bundle is no longer installed. */ readonly UNINSTALLED: 1; /** * Bundle is installed. */ readonly INSTALLED: 2; /** * Bundle is resolved (The JavaScript files are loaded). */ readonly RESOLVED: 4; /** * Bundle is starting. */ readonly STARTING: 8; /** * Bundle is stopping. */ readonly STOPPING: 16; /** * Bundle is active (started). */ readonly ACTIVE: 32; /** * Bundle is currently resolving (The JavaScript files are loading). */ readonly RESOLVING: 64; } /** * All possible bundle state names as strings. */ type BundleStateName = keyof BundleStates; /** * All possible bundle state values as numbers. */ type BundleState = BundleStates["UNINSTALLED"] | BundleStates["INSTALLED"] | BundleStates["RESOLVED"] | BundleStates["STARTING"] | BundleStates["STOPPING"] | BundleStates["ACTIVE"] | BundleStates["RESOLVING"]; /** * The bundle headers provide access to the bundle manifest metadata keys. */ interface BundleHeaders { /** * Get the value for a metadata key. * @param key the metadata key. See {@link WellknownBundleManifestEntries} for possible key names. * @returns the value */ get(key: string): T; /** * Provides the complete header information of a bundle as a flat object. * @returns all bundle manifest entries */ asMap(): BundleManifestEntries; /** * Provides direct access to the header information of a bundle as flat object. * This field is read only. * Please do not change the entries as a side effect! */ readonly entries: BundleManifestEntries; } /** * A data structure to store i18n values. */ interface I18NData { /** * An i18n key */ readonly [key: string]: I18NValue; } /** * An i18n value. */ type I18NValue = I18NData | string | number | undefined; /** * The i18n information of a bundle. */ interface I18N { /** * Loads the i18n data. * This method is used during the 'resolve' phase of a bundle. * @param locale e.g. de, en. (optional) * @returns a promise resolving to the i18n data. */ load(locale?: string): Promise>; /** * Get all i18n entries of the bundle. * @param locale e.g. de or en (optional) * @returns the i18n data */ get(locale?: string): ExpectedType; /** * Look up an i18n value for a given key. * Note, that this method supports chained keys, e.g. "a.b" * This will return `1` from the i18n data structure `{ 'a': { 'b': '1' }}` * @param key the i18n key. * @param locale e.g. de or en (optional) * @return the i18n value */ loc(key: string, locale?: string): ExpectedType; } /** * Represents a bundle ID. */ type BundleId = number; /** * Represents a service ID. */ type ServiceId = number; /** * A Bundle (a.k.a. a JavaScript Package). */ interface Bundle { /** * Check if the bundle equals another bundle * @param other the other bundle * @returns true if the bundle is equal to the other bundle. */ equals(other: Bundle): boolean; /** * Get the current state value of this bundle. * @returns the current bundle state as number */ getState(): BundleState; /** * Get the current bundle state name. * @returns the current bundle state as string */ getStateTitle(): BundleStateName; /** * Get the ID of the bundle. * @returns the bundle ID. */ getId(): BundleId; /** * Get the ID of the bundle. * @deprecated Use getId() instead. * @returns the bundle ID. */ getBundleId(): BundleId; /** * Get the symbolic name (unique ID) of the bundle. * @returns the name */ getSymbolicName(): string; /** * Get the version of the bundle. * @returns the semantic version */ getVersion(): SemVer; /** * Get the location of the bundle. * The location is the path in the JS Registry backend * @returns the location */ getLocation(): string; /** * Get the namespace of the bundle. * Typically, it is the same as the symbolic name. * @returns the namespace */ getNamespace(): string; /** * Get the bundle context. * @returns the bundle context */ getBundleContext(): BundleContext; /** * Provides access to the manifest metadata. * @param locale e.g. de, en (optional) * @returns the bundle header metadata. */ getHeaders(locale?: string): BundleHeaders; /** * Set a property in the bundle manifest. * This method is for internal use only! Please never change the bundle's manifest data. * @param name manifest key * @param value new value. * @return the bundle */ setHeader(name: string, value: unknown): this; /** * Provides access to the i18n data of the bundle. * @returns the i18n data */ getI18N(): I18N; /** * Provides access to the i18n data of the bundle. * @deprecated Use get getI18N() (with a capital N) instead. */ getI18n(): I18N; /** * Creates a URL to a given path, located in this or another bundle. * @param path resource path * @param otherBundleName name of another bundle (optional). * @returns resolved URL to given path. */ getResourceURL(path: string, otherBundleName?: string): string; /** * Provides access to all services registered by this bundle. * @returns an array of service references */ getRegisteredServices(): ServiceReference[]; /** * Provides access to all services used (consumed) by this bundle. * @returns an array of service references */ getServicesInUse(): ServiceReference[]; /** * Starts the bundle. * @returns a promise resolving to the bundle. */ start(): Promise; /** * Stops the bundle. * @returns a promise resolving to the bundle. */ stop(): Promise; /** * Uninstalls the bundle. * @returns a promise resolving to the bundle or the bundle itself. */ uninstall(): Promise | Bundle; /** * Lookup all installed dependencies of the bundle. * @returns an array of bundles that are dependencies. */ getRequiredBundles(): Bundle[]; /** * Lookup all required bundles together with their usage policy (mandatory or optional). * @returns an array of bundles and their usage policy. */ getRequiredBundleEntries(): { policy: BundleDependency["policy"]; bundle: Bundle; }[]; /** * Lookup all required bundles with an optional skip filter. * @param skip a function that will determine if a bundle should be skipped (optional) * @returns an array of required bundles. */ getAllRequiredBundles(skip?: (bundle: Bundle) => boolean): Bundle[]; } /** * The Framework (or 'system' bundle) is a special instance of a bundle. * It has the id === 0 and some special methods */ interface Framework extends Bundle { /** * Indicate, if the framework is started. * @returns true if the framework is started. */ isFrameworkStarted(): boolean; /** * Initialize the framework bundle. * @returns a promise resolving to the initialized framework */ init(): Promise; /** * Start the framework bundle. * @returns a promise resolving to the started framework */ start(): Promise; /** * Stops the framework bundle. * @returns a promise resolving to the stopped framework */ stop(): Promise; } /** * Represents a parsed Filter expression. */ interface Filter { /** * Test, if a filter matches against the given object (case-insensitive). * @param obj target data object * @returns true if the filter matches */ match(obj: Record): boolean; /** * Test, if a filter matches against the given object (case-sensitive). * @param obj target data object * @returns true if the filter matches */ matchCase(obj: Record): boolean; } /** * Represents an execution environment. * This is a helper to evaluate the * {@link WellknownBundleManifestEntries["requiredExecutionEnvironment"]} and * {@link WellknownBundleManifestEntries["excludedExecutionEnvironment"]} information. */ interface ExecutionEnvironment { /** * Checks if the given environments are supported. * @param envList e.g ['IE:[7,]','FF:[14,]'] * @returns true if one of the environments is supported */ isOneSupported(envList: ReadonlyArray): boolean; /** * Check if a given environment is supported. * @param env e.g. 'FF:[14,]' * @returns true if the environment is supported */ isSupported(env: string): boolean; /** * Get the current version for a given environment name * @param env e.g. 'FF' * @returns the version if the environment is known or false if it is unknown or unsupported */ getVersion(env: string): boolean | number | string; /** * Get an array of currently supported environment names. * @returns e.g. [{name:"ie",version:7}] */ getCurrent(): ReadonlyArray; } /** * Record for an ExecutionEnvironmentState. */ interface ExecutionEnvironmentState { /** * Name of the ExecutionEnvironment, e.g. `ie` or `ff`. */ readonly name: string; /** * Version as string or a flag to indicate if the Environment is supported or unknown. */ readonly version: number | string | boolean; } /** * Bundle context. */ interface BundleContext { /** * Creates a {@link Filter} instance from a string expression. * If the `filter` parameter is already a {@link Filter} instance, * the provided `filter` it is returned. * @param filter The expression converted to a {@link Filter} instance. */ createFilter(filter: string | Filter): Filter; /** * Creates a URL from the given `path` within this or another bundle. * @param path The path to a resource. * @param otherBundleName The name of the bundle where the resource is located (optional). * If undefined, the URL is created for this bundle. * @returns A resolved URL to the given path. */ getResourceURL(path: string, otherBundleName?: string): string; /** * Gets the bundle associated with this context. */ getBundle(): Bundle; /** * Gets the bundle with the given `id`. * @param id Id of the bundle to lookup. * If undefined, the bundle associated with this context is returned. */ getBundle(id?: number): Bundle | undefined; /** * Gets all bundles matching a given filter. * If `filter` is undefined, all bundles are returned. * @param filter A filter to reduce the bundles returned in the result. */ getBundles(filter?: string | Filter | ((b: Bundle) => boolean)): Bundle[]; /** * Returns the bundle with the given symbolic name or undefined if no bundle could be found. * @param symbolicName Symbolic name of the bundle to lookup. */ getBundleBySymbolicName(symbolicName: string): Bundle | undefined; /** * Resolves a property from the bundle. * If a given property name is not specified in this bundle, * this method searches framework properties for the given name. * Valid property names are defined in {@link WellknownBundleManifestEntries}. * @param T The type of the returned property. * @param name The name of the property to lookup. * @returns Property value or undefined if property could not be found. */ getProperty(name: string): T | undefined; /** * Tests if a service has at least one created instance. * @param reference The service reference. */ isServiceCreated(reference: ServiceReference): boolean; /** * Tests if a service is used by this or other bundles. * @param reference The service reference. */ isServiceUsed(reference: ServiceReference): boolean; /** * Resolves the service instance associated with the given service reference. * @param T The type of the service instance. * @param reference The service reference. * @returns The service instance or undefined if no service could be found. */ getService(reference: ServiceReference): T | undefined; /** * Releases a service instance. * @param reference the service reference. * @returns `true`, if service has been released successfully, `false` otherwise. */ ungetService(reference: ServiceReference): boolean; /** * Finds all services matching an interface and/or a given filter. * If `interfaceName` and `filter` are undefined, all registered services are returned. * * @param interfaceName The name of the service interface. * @param filter reduces matching services by their properties. */ getServiceReferences(interfaceName?: string, filter?: string | Filter): ServiceReference[]; /** * Dynamically installs a new bundle by providing manifest metadata. * @param location URL to the bundle resources. * @param manifest manifest metadata. * @param symName (symbolic) name of the bundle */ installBundle(location: string, manifest: BundleManifestJson, symName?: string): Bundle; /** * Dynamically installs a new bundle by fetching manifest metadata from the given location. * @param location URL to bundle resources. * @param manifest manifest metadata. * @param symName (symbolic) name of the bundle. */ installBundle(location: string, manifest?: undefined, symName?: string): Promise; /** * Registers a new service, provided by this bundle. * @param interfaceNames the interface(s) provided by the service. * @param service the service instance. * @param properties the service metadata. * @returns A service registration handle. */ registerService(interfaceNames: string | ReadonlyArray, service: ServiceInstance, properties?: ServiceProperties): ServiceRegistration; /** * Registers a bundle event listener. * @param listener The listener or method name in `scope`. * @param scope If `listener` is a method name, then `scope` must have a method with this name. */ addBundleListener(listener: BundleEventListener | string, scope?: any): EventHandle; /** * Removes a registered bundle event listener by using the provided handle. * @param handle the handle. * @deprecated use `EventHandle.remove` */ removeBundleListener(handle: EventHandle): void; /** * Registers a framework event listener. * @param listener the listener or method name in `scope`. * @param scope if `listener` is a method name, then `scope` must have a method with this name. */ addFrameworkListener(listener: FrameworkEventListener | string, scope?: any): EventHandle; /** * Removes a registered framework event listener by using the provided handle. * @param handle the handle. * @deprecated use `EventHandle.remove` */ removeFrameworkListener(handle: EventHandle): void; /** * Registers a service event listener. * @param filter Optional filter expression to reduce the events the listener will receive. * @param listener The listener or method name in `scope`. * @param scope If `listener` is a method name, then `scope` must have a method with this name. * @returns A handle which can be used to remove the listener. */ addServiceListener(filter: string | undefined, listener: ServiceEventListener | string, scope?: any): EventHandle; /** * Removes a registered service event listener through its handle. * @param handle the handle used to remove the listener. * @deprecated use `EventHandle.remove` */ removeServiceListener(handle: EventHandle): void; /** * Provides access to the current browser execution environment. * This can be used to inspect some browser features. */ getExecutionEnvironment(): ExecutionEnvironment; /** * Gets a list of the current execution environment states. */ getCurrentExecutionEnvironment(): ReadonlyArray; } /** * Type of a service instances. * Normally service instances are objects. * But strings may also be registered as services. */ type ServiceInstance = {} | string; /** * Class created when a service is registered. * Provides methods to unregister the service or change its metadata. */ interface ServiceRegistration { /** * Returns the service reference associated with this registration. */ getReference(): ServiceReference; /** * Returns true, if this registration has already been unregistered. */ isUnregistered(): boolean; /** * Unregister the associated service. */ unregister(): void; /** * Changes the service metadata during runtime. * This may lead to the service being injected into consuming services again. * @param props service metadata. */ setProperties(props: ServiceProperties): ServiceRegistration; } /** * The metadata associated with a service. */ type ServiceProperties = Record; /** * A service reference provides access to service metadata. */ interface ServiceReference { /** * The interfaces provided by this service. */ readonly ocs: ReadonlyArray; /** * The interfaces provided by this service. */ getOCs(): ReadonlyArray; /** * The id of the service. */ getId(): ServiceId; /** * The ranking of this service. * If services provide the same interfaces, the ranking specifies which will be preferred. * A higher ranking is preferred over a lower ranking. * The default ranking value is 0. * In case that that services have the same interface and the same ranking value, * the service registered first is preferred. */ getRanking(): number; /** * Compares this reference to another. * @returns A number whose sign indicates the relative order of the two services: * negative if this service is less than that service, * positive if this service is greater than that service, * and zero if they are equal. * @param that other service reference */ compareTo(that: ServiceReference): number; /** * Tests wether this reference is equal to another. * @param that other reference. */ equals(that: ServiceReference): boolean; /** * Provides the service metadata. */ getProperties(): ServiceProperties; /** * Provides a single service metadata entry. * @param T The type of the entry. * @param key The key of the entry. * @param ignoreCase If true, the key is compared case insensitive. */ getProperty(key: string, ignoreCase?: boolean): T | undefined; /** * Returns true if the service is no longer available, false otherwise. */ isUnregistered(): boolean; /** * Gets all service metadata keys. */ getPropertyKeys(): readonly string[]; /** * Gets the bundle which registered this service reference. */ getBundle(): Bundle; /** * Provides access to all bundles currently using the service. */ getUsingBundles(): readonly Bundle[]; } /** * A factory for creating services. * * A service factory is a way to create different service instances for different bundles. * For this instead of registering a service instance register a ServiceFactory implementation. */ interface ServiceFactory { /** * Returns true if a service has already been created, or false otherwise. * @param bundle The bundle which like to use the service. * @param registration The service registration information. */ isServiceCreated?(bundle: Bundle, registration: ServiceRegistration): boolean; /** * Gets the service instance for the bundle. * @param bundle The bundle which like to use the service. * @param registration The service registration. */ getService(bundle: Bundle, registration: ServiceRegistration): ExpectedServiceType; /** * Releases a service instance. * @param bundle The bundle which like not longer use the service. * @param registration The service registration. * @param instance Service instance which should be released. */ ungetService(bundle: Bundle, registration: ServiceRegistration, instance: ExpectedServiceType): void; } /** * A provider for the app configuration. */ interface AppConfigJsonProvider { /** * Provides the app config. */ (): AppConfigJson; /** * Name of the app. */ appName?: string; } /** * Options for launching an app. */ interface LauncherOptions { /** * Optional: Name of the query parameter containing the app name, default is 'app'. */ param?: string; /** * Provides a way to launch an default app by providing its name or its configuration. */ defaultApp?: string | AppConfigJson | AppConfigJsonProvider; /** * The id of the dom node used as the application root node. */ domId?: string; } /** * Launcher for apps. */ interface Launcher { /** * Launches an app using the given options. */ launchAppFromParam(opts: LauncherOptions): Promise; /** * Launches an app with the given name using the given domId as its root node. */ launchApp(app: string, domId: string): Promise; /** * Launches an app with the given name using the given domId as its root node. */ launch(app: string, domId: string): Promise; } /** * Location of a bundle. */ type LocationDefinition = string | { name: string; location?: string; }; /** * Configuration of an app. */ interface AppConfigJson { appName?: string | undefined; properties?: Record | undefined; load?: { bundleLocations?: LocationDefinition[]; allowedBundles?: string[]; skipBundles?: string[]; merge?: boolean; start?: string[]; lazy?: string[]; styles?: string[]; require?: string[]; appRootName?: string; i18n?: string[]; preFetchBundles?: boolean; prefetchLevel?: number; preFetchAll?: boolean; preFetchMain?: boolean; preFetchCompressedVersions?: boolean; prefetchSecondAggregate?: boolean | number; prefetchSecondNonBlocking?: boolean; }; bundles?: Record>; } /** * A bundle activator is a optionally provide by a bundle. * The app runtime calls the bundle activator when the bundle, * that declares it, is started or stopped. */ interface Activator { /** * Called from the app runtime when the bundle is started. */ start?(bCtx: BundleContext): void | Promise; /** * Called from the app runtime when the bundle is stopped. */ stop?(bCtx: BundleContext): void | Promise; } /** * CSS class of the application root. */ type ApplicationRootNodeCssClass = "ctAppRoot"; /** * Properties of an app. */ interface ApplicationProperties { readonly [key: string]: any; } /** * Context of an app. * Available as service `ct.framework.api.ApplicationContext`. */ interface ApplicationContext { /** * Returns the app name. */ getApplicationName(): string; /** * Returns the app title. */ getApplicationTitle(): string; /** * Returns the app properties. */ getApplicationProperties(): ApplicationProperties; /** * Returns the root node of an app. */ getApplicationRootNode(): HTMLElement | undefined; } /** * Components are instances of JavaScript objects that are created and managed by the app runtime as needed. */ interface ComponentInstance { /** * Dispose of the component configuration for this component instance. * The component configuration will be deactivated. * If the component configuration has already been deactivated, this method does nothing. */ dispose(): void; /** * Returns the component instance of the activated component configuration. * * @returns The component instance or `undefined` if the component * configuration has been deactivated. */ getInstance(): InstanceType | undefined; } /** * Type of primitive properties. */ type PrimitivePropertyValue = string | number | boolean | null | undefined; /** * Type for array properties. */ type ArrayPropertyValue = AnyPropertyValue[]; /** * Type of object properties. */ interface ObjectPropertyValue { [key: string]: AnyPropertyValue; } /** * Any allowed property values. */ type AnyPropertyValue = PrimitivePropertyValue | ArrayPropertyValue | ObjectPropertyValue; /** * Component properties. */ type ComponentProperties = Record; /** * Context of a {@link ComponentInstance}. * @param ExpectedServiceType The type of the service instance. */ interface ComponentContext { /** * Returns the {@link ComponentInstance} associated with this context. */ getComponentInstance(): ComponentInstance; /** * Returns the component properties for this context. * * @returns The properties for this context. * The Dictionary is readonly and cannot be modified. */ getProperties(): ComponentProperties; /** * Returns the service reference objects for the specified reference name. * * @param name The name of a reference as specified in a * `reference` element in this component's description. * @returns An array of service reference objects for the referenced service. */ locateServiceReferences(name: string): ReadonlyArray; /** * Creates a URL to a given path, located in this or another bundle. * @param path resource path * @param otherBundleName name of other bundle (optional). * @returns resolved URL to given path. * @deprecated use `BundleContext.getResourceURL` */ getResourceURL(path: string, otherBundleName?: string): string; /** * Returns the service objects for the specified reference name. * * @param name The name of a reference as specified in a * `reference` element in this component's description. * @returns An array of service objects for the referenced service. */ locateServices(name: string): ReadonlyArray; /** * Returns the service object for the specified reference name and * {@link ServiceReference}. * * @param name The name of a reference as specified in a * `reference` element in this component's description. * @param reference The {@link ServiceReference} to a service. * This must be a reference provided by locateService(s) matching the reference name. * @returns A service object for the referenced service or `undefined` */ locateService(name: string, reference: ServiceReference): ServiceType | undefined; /** * Returns the `BundleContext` of the bundle which contains this * component. */ getBundleContext(): BundleContext; /** * If the component instance is registered as a service using the * `serviceFactory="true"` attribute, then this method * returns the bundle using the service provided by the component instance. * * This method will return `undefined` if: * - The component instance is not a service, so no bundle can be use * it as a service. * - The component instance is a service but did not specify the * `serviceFactory="true"` attribute, so all bundles * using the service provided by the component instance will share the same * component instance. * - The service provided by the component instance is not currently used * by any bundle. * * @returns The bundle using the component instance as a service or * `undefined`. */ getUsingBundle(): Bundle | undefined; /** * Enables the component specified by `name`. * The component `name` must be in the same bundle as this component. * * @param name The name of a component or `null` to indicate all * components in the bundle. */ enableComponent(name: string): void; /** * Disables the component specified by `name`. * The component `name` must be in the same bundle as this component. * * @param name The name of a component. */ disableComponent(name: string): void; /** * If the component instance is registered as a service using the * `service` element, this method returns the service * reference of the service provided by this component instance. * * This method will return `undefined` if the component instance is * not registered as a service. * * @returns The `ServiceReference` object for the component * instance or `undefined` if the component instance is not * registered as a service. */ getServiceReference(): ServiceReference | undefined; } /** * Factory for dynamically creating components. * A component factory is registered as service with interface `ct.framework.api.ComponentFactory`. * The service metadata contain the component name, e.g. {"Component-Name": "Test"}. */ interface ComponentFactory { /** * Create a new component instance. * * @param properties Properties used to overwrite properties defined * in the declaration of the component factory. */ newInstance(properties?: ComponentProperties): ComponentInstance; } /** * Interface which must be implemented by an component implementation when the flag `instanceFactory` is set to true. * Then the component is a factory which creates a service implementation. */ interface ComponentInstanceFactory { /** * Creates a new service instance. * The returned service instance is registered as a service at the app runtime. */ createInstance(): ServiceType; /** * Cleans up the service instance during shutdown. */ destroyInstance?(instance: ServiceType): void | Promise; } /** * Methods (hooks) called by the app runtime during the lifecycle of a component. */ interface ComponentLifecycleHooks { /** * Signals the start of the injection phase of the component. * It is the first method called by the app runtime after the construction of the instance. * Services are injected after this method is called. */ init?(context: ComponentContext): void; /** * Signals the end of the injection phase and that the component instance is ready for use. * The app runtime guarantees that service consumers can access the component * instance only after activate is called on the instance. */ activate?(context: ComponentContext): void | Promise; /** * Signals that the component properties(configuration) are changed. * This method is only called between {@link activate} and {@link deactivate}. */ modified?(context: ComponentContext): void | boolean; /** * Signals the start of the shutdown process of the component instance. * All injected services are still available and the ejection phase starts after this method. */ deactivate?(context: ComponentContext): void | Promise; /** * Signals the end of the life of the component instance. * All services are ejected before this method. */ destroy?(): void | Promise; } /** * An event associated with a specific topic. */ interface TopicEvent { /** * Returns a property. * * @param name the name of the property to return * @returns The value of the property, or `undefined` if not found. */ getProperty(name: string): T | undefined; /** * Gets all properties as a copy. * * @returns all properties as plain object. */ getProperties(): Record; /** * Returns a list of this event's property names. * * @returns A non-empty array with one element per property. */ getPropertyNames(): string[]; /** * Returns the topic of this event. */ getTopic(): string; /** * Returns the reason of the topic (last part). * * For example if topic is 'ct/map/EXTENT_CHANGE' * the reason is 'EXTENT_CHANGE'. */ getTopicReason(): string; /** * Tests this event's properties against the given filter using a case * sensitive match. * * @param filter The filter to test. * @returns true if this event's properties match the filter, false * otherwise. */ matches(filter: string | Pick): boolean; /** * @returns The string representation of this event. */ toString(): string; } /** * The Topic Event Service is used to broadcast events as topics within the App Runtime. * The Topic Event Service is registered as `ct.framework.api.EventService` in the app runtime. */ interface TopicEventService { /** * Synchronously broadcasts an event to the EventListeners. * @param topic Event topic * @param evtProperties Event properties */ sendEvent(topic: string, evtProperties?: Record): void; /** * Asynchronously broadcasts an event to the EventListeners. * @param topic Event topic * @param evtProperties Event properties */ postEvent(topic: string, evtProperties?: Record): void; } /** * A service that wants to listen to events broadcasted by the {@link TopicEventService}. * Such a service must be registered as `ct.framework.api.EventHandler` * with the service property `Event-Topics: [""]`. */ interface TopicEventHandler { /** * Handles a given event. */ handleEvent(evt: TopicEvent): void; } /** * An item logged by the log service. */ interface LogNotificationItem { /** * Short info. */ shortInfo?: string; /** * Log message. */ message?: string; /** * Error. */ error?: Error; /** way to add additional information to a log entry */ [key: string]: any; } /** * Service registered as "ct.framework.api.LogService" used to notify user about problems. */ interface LogNotificationService { /** * Read buffered log messages. * Hint: used only by console bundle. */ getLog(): ReadonlyArray; /** * Logs a debug message */ debug(shortInfo: string, message?: string, error?: Error): void; /** * Logs a debug message */ debug(shortInfo: string, error?: Error): void; /** * Logs a debug message */ debug(logItem: LogNotificationItem): void; /** * Logs an info message */ info(shortInfo: string, message?: string, error?: Error): void; /** * Logs an info message */ info(shortInfo: string, error?: Error): void; /** * Logs an info message */ info(logItem: LogNotificationItem): void; /** * Logs a warning message */ warn(shortInfo: string, message?: string, error?: Error): void; /** * Logs a warning message */ warn(shortInfo: string, error?: Error): void; /** * Logs a warning message */ warn(logItem: LogNotificationItem): void; /** * Logs an error message */ error(shortInfo: string, message?: string, error?: Error): void; /** * Logs an error message */ error(shortInfo: string, error?: Error): void; /** * Logs an error message */ error(logItem: LogNotificationItem): void; } /** * Log level. */ type LogNotificationLevel = 1 | 2 | 3 | 4; /** * Well known log levels. */ interface LogNotificationLevels { /** * Error level. */ LOG_ERROR: 1; /** * Warning level. */ LOG_WARNING: 2; /** * Info level. */ LOG_INFO: 3; /** * Debug level. */ LOG_DEBUG: 4; } /** * A log message. */ interface LogNotificationEntry { /** * Access to the available levels. */ readonly levels: LogNotificationLevels; /** * The bundle which has logged the message. */ readonly bundle: Bundle; /** * Error instance. If it was an log error. */ readonly error: any; /** * A short info. */ readonly shortInfo: string; /** * The log message. */ readonly message: string; /** * The log level. */ readonly level: LogNotificationLevel; /** * Log time as date. */ readonly date: Date; /** * Log time as milliseconds. */ readonly time: number; /** way to add additional information to a log entry */ [key: string]: any; /** * Returns the String representation of the LogLevel */ getLevelAsString(): string; /** * Tests if entry has debug level. */ isDebug(): boolean; /** * Tests if entry has info level. */ isInfo(): boolean; /** * Tests if entry has warning level. */ isWarning(): boolean; /** * Tests if entry has error level. */ isError(): boolean; /** * Support for old stateful style. * @param name property name * @returns value of property * @deprecated use properties directly. */ get(name: string): any; } /** * Listener for log messages logged via the {@link LogNotificationService} * A service which is a log listener must be registered as `ct.framework.api.LogListener`. */ interface LogNotificationListener { /** * Called for each logged message. */ logged(entry: LogNotificationEntry): void; } /** * Authentication state. */ interface Authentication { /** * Please use the {@link getLoginDate} method. * @deprecated */ readonly loginDate: Date; /** * Please use the {@link getName} method. * @deprecated */ readonly name: string | undefined; /** * Please use the {@link isAuthenticated()} method. * @deprecated */ readonly authenticated: boolean; /** may have extra keys */ readonly [key: string]: unknown; /** * Gets the name of the {@link User} that this `Authentication` * context was created for. */ getName(): string | undefined; /** * Gets the user instances associated with this authentication. */ getUser(): User | undefined; /** * Current authentication state of this context. */ isAuthenticated(): boolean; /** * The date of the login. */ getLoginDate(): Date; /** * Logs out the user instances associated with this authentication. */ logout(): boolean | Promise; } /** * Authenticated user. */ interface User { /** * Returns the name of this user. * */ getName(): string; /** may have extra keys */ readonly [key: string]: unknown; /** * support for old Stateful getter access. * @param key any key */ get(key: string): any; } /** * Authorization data. */ interface Authorization { /** * Gets the name of the {@link User} that this `Authorization` * context was created for. * or undefined if created for not authenticated user. */ getName(): string | undefined; /** * Checks if the role with the specified name is implied by this * `Authorization` context. * * @param name The name of the role to check for. */ hasRole(name: string): boolean; /** * Gets the names of all roles implied by this `Authorization` * context. */ getRoles(): string[]; /** may have extra keys */ readonly [key: string]: unknown; } /** * Login credentials. */ interface LoginCredentials { /** * Name of the user. */ username?: string; /** * Password. */ password?: string; } /** * Options used for login. */ interface LoginOptions { /** * If true, no events are triggered during login. */ refresh?: boolean; } /** * An event thrown by a {@link UserAdminService}. */ interface UserAdminEvent { /** * Authentication data. */ readonly authentication: Authentication; /** * True, if this event belongs to a login of a user.. */ readonly login: boolean; /** * True, if this event belongs to a logout of a user. */ readonly logout: boolean; /** * Error during login/logout process. */ readonly error?: unknown; /** * Event source. */ readonly source: UserAdminService; } /** * Events thrown by {@link UserAdminService}. */ interface UserAdminServiceEvents { /** * User authentication has started. */ "authentication-change-start": UserAdminEvent; /** * User authentication has changed. */ "authentication-changed": UserAdminEvent; } /** * Service used to login/logout a user. * Available as service with interface `ct.framework.api.UserAdmin` */ interface UserAdminService extends EventSource { /** * Gets the current authentication state. */ getAuthentication(): Authentication; /** * Creates an `Authorization` object that provides access to the roles of the current user. */ getAuthorization(authentication?: User | Authentication): Authorization; /** * Creates an `User` object that provides access to properties of the current user. * (normally triggered via: `getAuthentication().getUser();` ) */ getUser(authentication?: Authentication): User | undefined; /** * Performs a login. * options is only {refresh:true}, which marks that no events are triggered! */ login(credentials?: LoginCredentials, options?: LoginOptions): Promise; /** * Triggers logout of an Authentication instance * (normally triggered via: `getAuthentication().logout();` */ logout(authentication?: Authentication): Promise; } /** * Plugin used in the {@link UserAdminService} to login/logout a user. * The {@link UserAdminService} is only available if at least on AuthenticationPlugin is available in the system. * An AuthenticationPlugin must be registered as service with interface `system.user.api.AuthenticationPlugin`. */ interface AuthenticationPlugin { /** * Login a user. * @returns {Authentication} authentication instance */ login(credentials: LoginCredentials | undefined, userAdmin: UserAdminService): Authentication | Promise; /** * Logout a user. * * @returns {boolean} success state */ logout(authentication: Authentication, userAdmin: UserAdminService): boolean | Promise; /** * Get authorization data for a user. * @returns {Authorization} authorization instance */ getAuthorization(user: User | undefined, userAdmin: UserAdminService): Authorization; /** * Get user associated with an authentication. * @returns {User} user instance */ getUser(authentication: Authentication, userAdmin: UserAdminService): User | undefined; } /** * Service used to force a user login. * The service is available via interface name `ct.framework.api.ForceLoginService`. */ interface ForceLoginService { /** * Provides a promise, which blocks until login happens. */ forceLogin(): Promise; /** * Resets the service like if `forceLogin` is never used before. * This is provided for test scenarios. * It will send a Cancel error to all clients of 'forceLogin'. */ reset(): void; } /** * Service used to change a component configuration of an app programmatically. * The service is available via interface name `ct.framework.api.ConfigurationAdmin`. */ interface ConfigAdminService { /** * Get the current configuration of component. * @param persistentIdentifier Identifier for the component. */ getConfiguration(persistentIdentifier: string): Configuration; /** * Reads all factory configuration instance entries. * @param factoryPersistentIdentifier Identifier for the factory component. */ getFactoryConfigurations(factoryPersistentIdentifier: string): Configuration[]; /** * Creates a configuration for a factory component. * @param factoryPersistentIdentifier Identifier for the factory component. */ createFactoryConfiguration(factoryPersistentIdentifier: string): Configuration; /** * Permanently store configuration changes with the app configuration. */ save(): Promise; } /** * Component configuration. */ interface Configuration { /** * Persistent identifier. */ readonly pid: string; /** * Persistent identifier of a factory component. */ readonly factoryPid: string | undefined; /** * Configuration properties. */ readonly properties: ComponentProperties; /** * @deprecated use flat properties, e.g. pid or properties directly. */ get(key: string): any; /** * Used to update the configuration. */ update(properties: ComponentProperties): void; /** * Removes this configuration. */ remove(): void; } /** * Plugin used to modify component configurations. * A configuration plugin must be registered with service interface `ct.framework.api.ConfigurationPlugin`. */ interface ConfigurationPlugin { /** * View and possibly modify a set of configuration properties before * they are sent to the Managed Service or the Managed Service Factory. * * @param targetInfo : { managedService : .., managedServiceProperties: .., pid: .., factoryPid : .. } * @param properties The configuration properties. */ modifyConfiguration(targetInfo: unknown, properties: ComponentProperties): ComponentProperties; } /** * Interceptors used to access the current store of configurations. * Registered as 'system.config.ConfigurationInterceptor' in the app * runtime. */ interface ConfigurationInterceptor { /** * Called from the {@link ConfigAdminService} * to provide this instance with the current configuration store. */ intercept(store: ConfigurationStore): void; } /** * Configuration entry in a {@link ConfigurationStore} */ interface ConfigurationStoreEntry { /** * Persistent identifier. */ readonly pid: string; /** * Identifier of the factory component. */ readonly factoryPid?: string; /** * Component properties. */ readonly properties: ComponentProperties; } /** * Events thrown by the {@link ConfigurationStore} */ interface ConfigurationStoreEvents { /** * Configuration has changed. */ ConfigChanged: { removed: boolean; pid: string; item: ConfigurationStoreEntry; source: ConfigurationStore; }; } /** * Store for configurations. * It is available as service with interface `system.config.ConfigurationStore`. * * WARNING: Please do not modify the configurations manually. */ interface ConfigurationStore extends EventSource { /** * Search available configs. */ searchConfigs(filter: (value: ConfigurationStoreEntry) => boolean): ConfigurationStoreEntry[]; /** * Read a configuration. */ getConfig(pid: string): ConfigurationStoreEntry | undefined; /** * Read configurations by factory pid. */ getFactoryConfigs(factoryPid: string): ConfigurationStoreEntry[]; /** * Removes a configuration. */ removeConfig(pid: string): void; /** * Writes a new configuration. */ setConfig(pid: string, entry: Omit): void; } /** * A managed service. * A managed service is registered as `ct.framework.api.ManagedService`. */ interface ManagedService { /** * Update the configuration for a service. * * * @param properties A copy of the Configuration properties, or * `undefined`. */ updated(properties: ComponentProperties | undefined): void; } /** * A factory for managed services. * A managed service factory must be registered as `ct.framework.api.ManagedServiceFactory`. */ interface ManagedServiceFactory { /** * Create a new instance, or update the configuration of an existing * instance. * * If the PID of the `Configuration` object is new for the * Managed Service Factory, then create a new factory instance, using the * configuration `properties` provided. Else, update the * service instance with the provided `properties`. * * @param pid The PID for this configuration. * @param properties A copy of the configuration properties. */ updated(pid: string, properties: ComponentProperties): void; /** * Remove a factory instance. * * Remove the factory instance associated with the PID. If the instance was * registered with the service registry, it should be unregistered. * * @param pid the PID of the service to be removed */ deleted(pid: string): void; } export type { AUTOSTART_POLICY_NO, AUTOSTART_POLICY_YES, Activator, AnyPropertyValue, AppConfigJson, AppConfigJsonProvider, ApplicationContext, ApplicationProperties, ApplicationRootNodeCssClass, ArrayPropertyValue, Authentication, AuthenticationPlugin, Authorization, Bundle, BundleContext, BundleDependency, BundleEvent, BundleEventListener, BundleEventNames, BundleEventTypes, BundleEvent_INSTALLED, BundleEvent_RESOLVED, BundleEvent_RESOLVING, BundleEvent_STARTED, BundleEvent_STARTING, BundleEvent_STOPPED, BundleEvent_STOPPING, BundleEvent_UNINSTALLED, BundleEvent_UNRESOLVED, BundleHeaders, BundleId, BundleManifestEntries, BundleManifestJson, BundleManifestJson3x, BundleState, BundleStateName, BundleStates, ComponentContext, ComponentFactory, ComponentInstance, ComponentInstanceFactory, ComponentLifecycleHooks, ComponentProperties, ConfigAdminService, Configuration, ConfigurationInterceptor, ConfigurationPlugin, ConfigurationStore, ConfigurationStoreEntry, ConfigurationStoreEvents, EventHandle, ExecutionEnvironment, ExecutionEnvironmentState, Filter, ForceLoginService, Framework, FrameworkEvent, FrameworkEventListener, FrameworkEventNames, FrameworkEventTypes, FrameworkEvent_ERROR, FrameworkEvent_STARTED, FrameworkEvent_STARTLEVEL_CHANGED, FrameworkEvent_STOPPED, FrameworkEvent_WARNING, I18N, I18NData, I18NValue, Launcher, LauncherOptions, LocationDefinition, LogNotificationEntry, LogNotificationItem, LogNotificationLevel, LogNotificationLevels, LogNotificationListener, LogNotificationService, LoginCredentials, LoginOptions, ManagedService, ManagedServiceFactory, ObjectPropertyValue, PrimitivePropertyValue, RequiredBundleJson, SemVer, SemVerRange, SemVerRangeVisitor, ServiceEvent, ServiceEventListener, ServiceEventNames, ServiceEventTypes, ServiceEvent_LAZY_GET, ServiceEvent_LAZY_UNGET, ServiceEvent_MODIFIED, ServiceEvent_REGISTERED, ServiceEvent_UNREGISTERING, ServiceFactory, ServiceId, ServiceInstance, ServiceProperties, ServiceReference, ServiceRegistration, TopicEvent, TopicEventHandler, TopicEventService, User, UserAdminEvent, UserAdminService, UserAdminServiceEvents, WellknownBundleManifestEntries, WellknownBundleManifestJsonEntries };