Lime Web Components API Documentation - v7.4.0
    Preparing search index...

    Interface LimeTypeRepository

    Repository for accessing limetype metadata and schema information.

    LimeTypeRepository provides access to limetype definitions that describe the structure, properties, and access controls for business object types in Lime CRM. Each LimeType contains:

    • Property definitions (name, type, validation rules, etc.)
    • Access control lists (ACLs) defining permissions
    • Localized display names
    • Relationship information to other limetypes

    The repository extends StateRepository, enabling:

    • Reactive subscriptions to limetype changes
    • Automatic updates when metadata changes
    • Integration with state decorators

    RECOMMENDED: Use SelectCurrentLimeType decorator to automatically get the limetype for the current context. This is more convenient than manual repository access and ensures your component reacts to context changes.

    Each method below carries its own example.

    interface LimeTypeRepository {
        getLimeType(name: string): LimeType | undefined;
        getLimeTypes(): LimeType[];
        subscribe(
            callback: (...args: unknown[]) => void,
            options?: StateOptions,
        ): () => void;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Get a specific limetype by name.

      Retrieves the LimeType definition for the specified limetype name. Returns undefined if the limetype does not exist or has not been loaded.

      Common limetype names include: 'company', 'person', 'deal', 'todo', 'helpdesk', but the available types depend on your Lime CRM configuration.

      Parameters

      • name: string

        Internal name of the limetype (e.g., 'deal', 'company', 'person')

      Returns LimeType | undefined

      The LimeType definition, or undefined if not found

      import { PlatformServiceName } from '@limetech/lime-web-components';

      const repository = platform.get(PlatformServiceName.LimeTypeRepository);
      const dealType = repository.getLimeType('deal');

      if (dealType) {
      console.log('Deal type:', dealType.localname.singular);
      console.log('Can create deals:', dealType.acl.create);
      }
    • Get all loaded limetypes.

      Returns an array of all LimeType definitions currently loaded in the repository state. This typically includes all limetypes that the current user has access to in the Lime CRM system.

      The returned array may be empty if limetypes have not been loaded yet. Limetypes are usually loaded automatically during platform initialization.

      Returns LimeType[]

      Array of LimeType definitions (may be empty)

      import { PlatformServiceName } from '@limetech/lime-web-components';

      const repository = platform.get(PlatformServiceName.LimeTypeRepository);
      const types = repository.getLimeTypes();
      const creatableTypes = types.filter((limetype) => limetype.acl.create);
      • LimeType for the structure of limetype definitions
      • getLimeType to retrieve a specific limetype by name
    • 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
      import { PlatformServiceName } from '@limetech/lime-web-components';

      const repository = platform.get(PlatformServiceName.Application);
      const logger = platform
      .get(PlatformServiceName.Logger)
      .createLogger('my-component');

      // Basic subscription
      const unsubscribeState = repository.subscribe((state) => {
      logger.debug('State updated', { state });
      });

      // With transformations
      const unsubscribeUserName = repository.subscribe(
      (userName) => logger.debug('User', { userName }),
      { map: [(state) => state.currentUser?.fullname] }
      );