Lime Web Components API Documentation - v6.24.0
    Preparing search index...

    Interface LimeObjectRepository

    interface LimeObjectRepository {
        deleteObject(limetype: string, id: number): Promise<void>;
        getObject(limetype: string, id: number): LimeObject;
        getObjects(limetype: string): LimeObject[];
        getSchema?<TSchemaType extends Record<string, any> = object>(
            limetype: string,
        ): TSchemaType;
        loadObject(
            limetype: string,
            id: number,
            options?: Pick<LoadOptions, "properties">,
        ): void;
        loadObjects(
            limetype: string,
            options?: LoadOptions,
        ): Promise<ObjectResponse>;
        loadRelations(
            limetype: string,
            id: number,
            property: string,
            options?: LoadOptions,
        ): Promise<ObjectResponse>;
        loadSchema<TSchemaType extends Record<string, any> = object>(
            limetype: string,
        ): Promise<TSchemaType>;
        subscribe(
            callback: (...args: unknown[]) => void,
            options?: StateOptions,
        ): () => void;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Delete the specified limeobject

      Parameters

      • limetype: string

        name of the limetype of the limeobject

      • id: number

        the id of the limeobject

      Returns Promise<void>

    • Get an already loaded LimeObject

      Parameters

      • limetype: string

        name of the limetype

      • id: number

        the id of the object

      Returns LimeObject

      the LimeObject if it is loaded, otherwise undefined

    • Get a schema that is already loaded for the limetype.

      Type Parameters

      • TSchemaType extends Record<string, any> = object

      Parameters

      • limetype: string

        name of the limetype of the owning limeobject

      Returns TSchemaType

    • Load the specified limeobject into the state

      Parameters

      • limetype: string
      • id: number
      • Optionaloptions: Pick<LoadOptions, "properties">

      Returns void

    • Load objects of the specified limetype into the state

      Parameters

      • limetype: string

        name of the limetype

      • Optionaloptions: LoadOptions

        options about the objects to load

      Returns Promise<ObjectResponse>

      list of objects together with total count of objects

    • Load related objects into the state

      Parameters

      • limetype: string

        name of the limetype of the owning limeobject

      • id: number

        the id of the owning limeobject

      • property: string

        name of the property that contain the relations

      • Optionaloptions: LoadOptions

        options about the objects to load

      Returns Promise<ObjectResponse>

      list of related objects together with total count of objects

    • Loads a schema for the limetype.

      Type Parameters

      • TSchemaType extends Record<string, any> = object

      Parameters

      • limetype: string

        name of the limetype of the owning limeobject

      Returns Promise<TSchemaType>

    • Subscribe to state changes with optional transformation and filtering.

      The subscription will immediately invoke the callback with the current state (if any), then continue to call it whenever the state changes. The map and filter options allow you to transform and selectively receive updates.

      Parameters

      • callback: (...args: unknown[]) => void

        Function called with state updates (after map/filter applied)

      • Optionaloptions: StateOptions

        Optional transformations and filters for the subscription

      Returns () => void

      Unsubscribe function - call this to stop receiving updates

      • Map functions are applied sequentially to transform the state
      • Filter functions must all return true for the callback to be invoked
      • Functions in map/filter arrays are bound to the component instance
      • Always store and call the unsubscribe function when component is destroyed
      // Basic subscription
      const unsubscribe = repository.subscribe((state) => {
      console.log('State updated:', state);
      });

      // With transformations
      const unsubscribe = repository.subscribe(
      (userName) => console.log('User:', userName),
      { map: [(state) => state.user?.name] }
      );