Logos DX
    Preparing search index...

    Generic store for request properties (headers, params).

    Handles CRUD operations, method-specific overrides, and merging for requests. This class is used internally by FetchEngine to manage both headers and params with a unified API.

    Properties are resolved in order:

    1. Instance defaults
    2. Method-specific overrides
    3. Request-level overrides
    const headers = new PropertyStore<Headers>({
    defaults: { 'Content-Type': 'application/json' },
    methodOverrides: {
    POST: { 'X-Custom': 'post-only' }
    }
    });

    // Add header globally
    headers.set('Authorization', 'Bearer token');

    // Add header for specific method
    headers.set('X-Request-ID', 'abc', 'POST');

    // Resolve headers for a request
    const resolved = headers.resolve('POST', { 'X-Override': 'value' });

    Type Parameters

    • T extends Record<string, unknown>

      The property type (e.g., Record<string, string>)

    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    • get all(): { default: T } & Record<string, Partial<T>>

      Get all values including method overrides.

      Returns an object with 'default' key for defaults and method names as keys for method-specific overrides.

      Returns { default: T } & Record<string, Partial<T>>

      Object with all property values

      const all = headers.all;
      // { default: { Authorization: '...' }, POST: { 'X-Custom': '...' } }
    • get defaults(): T

      Get the default values (without method overrides).

      Returns T

      Clone of the default values

      const defaultHeaders = headers.defaults;
      

    Methods

    • Get method-specific overrides only (not merged with defaults).

      Parameters

      • method: string

        HTTP method

      Returns Partial<T>

      Method-specific overrides or empty object

      const postHeaders = headers.forMethod('POST');
      
    • Check if a property exists globally or for a specific method.

      Parameters

      • key: string

        Property key to check

      • Optionalmethod: string

        Optional HTTP method to check method-specific value

      Returns boolean

      True if the property exists

      if (headers.has('Authorization')) {
      console.log('Auth header is set');
      }
    • Remove a property globally or for a specific method.

      Parameters

      • key: string

        Property key to remove

      • Optionalmethod: string

        Optional HTTP method for method-specific removal

      Returns void

      headers.remove('Authorization');
      headers.remove('X-Custom', 'POST');
    • Remove multiple properties globally or for a specific method.

      Parameters

      • keys: string[]

        Array of property keys to remove

      • Optionalmethod: string

        Optional HTTP method for method-specific removal

      Returns void

      headers.remove(['Authorization', 'X-API-Key']);
      headers.remove(['X-Custom', 'X-Other'], 'POST');
    • Resolve the final property values for a specific method.

      Merges in order: defaults → method overrides → request overrides.

      Parameters

      • method: string

        HTTP method

      • OptionalrequestOverrides: Partial<T>

        Request-level overrides (highest priority)

      Returns T

      Merged property values

      const headers = this.headers.resolve('POST', { 'X-Request-ID': '123' });
      
    • Set a property value globally or for a specific method.

      Parameters

      • key: string

        Property key

      • value: unknown

        Property value

      • Optionalmethod: string

        Optional HTTP method for method-specific override

      Returns void

      headers.set('Authorization', 'Bearer token');
      headers.set('X-Custom', 'value', 'POST');
    • Set multiple property values globally or for a specific method.

      Parameters

      • values: Partial<T>

        Object with key-value pairs to set

      • Optionalmethod: string

        Optional HTTP method for method-specific overrides

      Returns void

      headers.set({ 'Authorization': 'Bearer token', 'X-API-Key': 'abc' });
      headers.set({ 'X-Custom': 'value' }, 'POST');