@adviser/cement - v0.0.0
    Preparing search index...

    Class IdService

    ID generator with deterministic modes for testing.

    Generates unique identifiers with support for different modes:

    • UUID: Uses crypto.randomUUID() for real UUIDs (default)
    • CONST: Always returns the same constant ID for reproducible tests
    • STEP: Returns incrementing IDs (STEPId-0, STEPId-1, etc.) for predictable sequences
    // Production: real UUIDs
    const idService = new IdService(IDMode.UUID);
    const id = idService.NextId(); // "550e8400-e29b-41d4-a716-446655440000"

    // Testing: constant ID
    const constId = new IdService(IDMode.CONST);
    const id1 = constId.NextId(); // "VeryUniqueID"
    const id2 = constId.NextId(); // "VeryUniqueID"

    // Testing: stepped sequence
    const stepId = new IdService(IDMode.STEP);
    const id1 = stepId.NextId(); // "STEPId-0"
    const id2 = stepId.NextId(); // "STEPId-1"
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    _mode: string
    _step: number = 0

    Methods

    • Generates the next unique identifier.

      Returns string

      Unique ID string based on the configured mode