GeoLeaf Core API - v3.0.0
    Preparing search index...

    Concrete implementation of IModuleRegistry.

    const registry = new ModuleRegistry();
    registry.register(new ConfigModule());
    registry.register(new GeoJSONModule());
    await registry.init(adapter, config);

    Implements

    Index

    Constructors

    Methods

    • Registers a module descriptor with the registry.

      Registration is only allowed before init() has been called. Throws a GeoLeafError if:

      • A module with the same id is already registered.
      • init() has already been called on this registry instance.

      Parameters

      Returns void

    • Resolves the dependency graph and initialises all registered modules in topological order.

      Throws a GeoLeafError if a circular dependency is detected. The error message includes the full cycle path (e.g. "A → B → A").

      Returns a Promise that resolves when all modules have completed init(). If any module's init() rejects, the returned Promise rejects with that error (subsequent modules are not initialised).

      Parameters

      Returns Promise<void>

    • Retrieves a registered module by its id, cast to type T.

      Throws a GeoLeafError when no module with the given id is registered. Use has() first when presence is uncertain.

      Type Parameters

      Parameters

      • id: string

        The module's id string.

      Returns T

      GeoLeafError if no module with the given id exists.

      const geojson = registry.get<GeoJSONModule>('geojson');
      geojson.destroy();
    • Returns true if init() has already been called on this registry.

      Use this guard before calling register() in contexts where the registry may have already been initialised (e.g. double-boot scenarios).

      Returns boolean

    • Returns the schema of a registered module, or null if no module with the given id is registered.

      The returned object is a lightweight metadata view — it does not expose internal module state. IModuleSchema will be enriched in S2.1 when capability schemas (config, capabilities, metadata) are defined.

      Parameters

      • id: string

        Module id (e.g. 'poi', 'route', 'search').

      Returns IModuleSchema | null

    • The modules that are actually RUNNING — not merely the ones registered.

      They were identical for as long as a switched-off capability was never registered: registerPresetModules filtered at Pass 2, so the map only ever held live modules and returning all of them was accurate by accident. 9.2 removed that filter — every capability module is now registered, and each decides in its own init() whether to run, so that a profile loaded after Pass 2 gets a say. Returning the whole map from a method called getActiveModules would, from that commit on, have answered « registered » to a question that asks « active ». The introspection surface would report capabilities that are switched off — silently, and to integrators.

      isEnabled() is not in ICoreModule, deliberately: it is put there by the wrapper in presets/apply-preset.ts, and the registry has no business learning what a capability gate is. Everything else — kernel modules, plugin UI slots, anything registered by hand — carries no gate, so it has nothing to be switched off by. Absent ⟹ active is therefore the correct default, not a lenient one.

      ⚠️ A wrapper answers false until its init() has run. Called mid-boot, this method lists the kernel only — which is the honest answer: nothing else has started yet.

      Returns readonly IModuleInfo[]

    • Destroys all registered modules in reverse initialisation order.

      Each module's destroy() is called exactly once. Errors in individual destroy() calls are logged but do not interrupt the teardown sequence — all modules are destroyed regardless of individual failures.

      Returns void