@infrasoftbe/vnv-sdk
    Preparing search index...

    Function Layer

    • Creates a Layer factory function that constructs API layers with configurable endpoints.

      Type Parameters

      • LayerConfig extends LayerDefaultConfig = {}

        Type extending LayerDefaultConfig for layer configuration

      Parameters

      • baseUrl: URL

        Base URL for the API layer

      Returns LayerConstructor<LayerConfig>

      A LayerConstructor function that creates layer factories

      const apiLayer = Layer(new URL('https://api.example.com'))({
      // layer config
      });

      The returned layer factory creates proxy-based API layer objects that:

      • Support nested layer structures through the 'layers' configuration
      • Allow dynamic path extensions through identificators
      • Provide URL manipulation and endpoint access
      • Enable runtime layer registration through the 'use' method

      Each created layer instance includes:

      • URL: The complete URL for this layer
      • baseUrl: String representation of the layer's URL
      • endpoint: Alias for baseUrl
      • use: Method to register new sub-layers

      The proxy implementation allows transparent access to configured sub-layers and handles property access for both direct properties and nested layers.