@rising3/smart-entity-js - v0.1.1
    Preparing search index...

    Class default<T>Abstract

    Abstract base class for creating smart entities with schema validation, JSON serialization, and masking capabilities.

    Type Parameters

    • T

      The type of the entity.

    Index

    Constructors

    Properties

    example: () => default<any>

    Example instance of the entity.

    Methods

    • Creates a deep copy of the entity.

      Returns T

      A deep copy of the entity.

    • Serializes the entity to a JSON string.

      Parameters

      • pretty: boolean = false

        Whether to format the JSON string with indentation.

      • maskSensitive: boolean = false

        Whether to mask sensitive fields.

      Returns string

      The serialized JSON string.

    • Validates the entity against its schema.

      Returns void

      If the entity does not match the schema.

    • Creates an entity instance from a JSON string.

      Type Parameters

      • U

        The type of the entity.

      Parameters

      • json: string

        The JSON string to parse.

      Returns U

      The created entity instance.

      If the JSON string is invalid or does not match the schema.

    • Generates a JSON schema for the entity.

      Type Parameters

      • U

        The type of the entity.

      Returns JSONSchemaType<U>

      The JSON schema for the entity.