prorm API Reference
    Preparing search index...

    Class DataMasker

    Static facade bundling the masking API (mirrors the module-level functions).

    Index
    maskField: (Model: any, field: string, options?: MaskOptions) => void = maskField

    Type Declaration

      • (Model: any, field: string, options?: MaskOptions): void
      • Register a masking rule for a field on a model.

        Parameters

        Returns void

    getRules: (Model: any) => MaskRule[] = getMaskRules

    Type Declaration

      • (Model: any): MaskRule[]
      • Get all masking rules for a model.

        Parameters

        • Model: any

        Returns MaskRule[]

    mask: (instance: any, role: string, Model?: any) => Record<string, any> = mask

    Type Declaration

      • (instance: any, role: string, Model?: any): Record<string, any>
      • Apply masking to a model instance, respecting both permission rules and masking rules.

        Parameters

        • instance: any

          The model instance or plain object

        • role: string

          The current user's role (for permission filtering)

        • OptionalModel: any

          The model class (optional, inferred from instance.constructor)

        Returns Record<string, any>

    maskMany: (instances: any[], role: string, Model?: any) => Record<string, any>[] = maskMany

    Type Declaration

      • (instances: any[], role: string, Model?: any): Record<string, any>[]
      • Apply masking to an array of instances.

        Parameters

        • instances: any[]
        • role: string
        • OptionalModel: any

        Returns Record<string, any>[]

    maskValue: (value: any, options: MaskOptions) => string = maskValue

    Type Declaration

      • (value: any, options: MaskOptions): string
      • Apply masking to a single value.

        Parameters

        Returns string

    applyHooks: (Model: any) => void = applyHooks

    Type Declaration

      • (Model: any): void
      • Wire afterFind hooks onto a model to automatically mask results.

        DataMasker.applyHooks(User);

        Parameters

        • Model: any

        Returns void