Fake Mirrors
    Preparing search index...

    Class RedisTargetRepository

    Redis-based target repository implementation.

    Depends:

    import { DIContainer } from '@famir/common'
    import { TARGET_REPOSITORY, TargetRepository, RedisTargetRepository } from '@famir/database'

    // Get container singleton
    const container = DIContainer.getInstance()

    // Register dependency in container
    RedisTargetRepository.register(container)

    // Resolve dependency from container
    const targetRepository = container.resolve<TargetRepository>(TARGET_REPOSITORY)

    // TODO more examples

    Implements

    • Appends a label to the target.

      Labels are used for categorization and filtering of targets. The label is automatically converted to lowercase.

      Parameters

      • campaignId: string

        The ID of the campaign containing the target.

      • targetId: string

        The target ID to append label to.

      • label: string

        The label to append to the target.

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock.

      Returns Promise<void>

      DatabaseError If the campaign does not exist.

      DatabaseError If the campaign is not locked.

      DatabaseError If the campaign lock secret does not match.

      DatabaseError If the target does not exist.

      DatabaseError If the data validation fails.

    • Creates a new target.

      The target will be created in a disabled state (isEnabled = false). Use enable to activate it for traffic routing.

      Parameters

      • campaignId: string

        The ID of the campaign to create the target in.

      • targetId: string

        The new target ID to create.

      • accessLevel: "transparent" | "landing"

        The access level.

      • donorSecure: boolean

        The flag indicating if the donor server uses HTTPS.

      • donorSub: string

        The donor subdomain.

      • donorDomain: string

        The donor domain name.

      • donorPort: number

        The donor server port.

      • mirrorSecure: boolean

        The flag indicating if the mirror server uses HTTPS.

      • mirrorSub: string

        The mirror subdomain.

      • mirrorPort: number

        The mirror server port.

      • connectTimeout: number

        The connection timeout in milliseconds.

      • simpleTimeout: number

        The simple request timeout in milliseconds.

      • streamTimeout: number

        The streaming request timeout in milliseconds.

      • headersSizeLimit: number

        The maximum headers size in bytes.

      • bodySizeLimit: number

        The maximum body size in bytes.

      • mainPage: string

        The custom main page content.

      • notFoundPage: string

        The custom not-found page content.

      • faviconIco: string

        The custom favicon.ico content.

      • robotsTxt: string

        The custom robots.txt content.

      • sitemapXml: string

        The custom sitemap.xml content.

      • allowWebSockets: boolean

        The flag indicating if WebSocket connections allowed.

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock.

      Returns Promise<void>

      DatabaseError If the campaign does not exist.

      DatabaseError If the campaign is not locked.

      DatabaseError If the campaign lock secret does not match.

      DatabaseError If a target with the same ID already exists.

      DatabaseError If the target donor is already used.

      DatabaseError If the target mirror is already used.

      DatabaseError If the data validation fails.

    • Updates the target specific fields.

      All update parameters are optional. Only provided fields will be updated.

      Parameters

      • campaignId: string

        The ID of the campaign containing the target.

      • targetId: string

        The target ID to update.

      • connectTimeout: number | null | undefined

        The connection timeout in milliseconds.

      • simpleTimeout: number | null | undefined

        The simple request timeout in milliseconds.

      • streamTimeout: number | null | undefined

        The streaming request timeout in milliseconds.

      • headersSizeLimit: number | null | undefined

        The maximum headers size in bytes.

      • bodySizeLimit: number | null | undefined

        The maximum body size in bytes.

      • mainPage: string | null | undefined

        The custom main page content.

      • notFoundPage: string | null | undefined

        The custom not-found page content.

      • faviconIco: string | null | undefined

        The custom favicon.ico content.

      • robotsTxt: string | null | undefined

        The custom robots.txt content.

      • sitemapXml: string | null | undefined

        The custom sitemap.xml content.

      • allowWebSockets: boolean | null | undefined

        The flag indicating if WebSocket connections allowed.

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock.

      Returns Promise<void>

      DatabaseError If the campaign does not exist.

      DatabaseError If the campaign is not locked.

      DatabaseError If the campaign lock secret does not match.

      DatabaseError If the target does not exist.

      DatabaseError If the data validation fails.