Class ResourceAbstract

Base class for all DataTrue resource types

Hierarchy (view full)

Constructors

Properties

name: string
options: ResourceOptions = {}
childTypes: readonly string[]
resourceType: string
resourceTypeRun?: string

Methods

  • Gets the contextID of a resource

    Returns undefined | number

    contextID of the resource

  • Gets the contextType of a resource

    Returns string

    contextType of the resource

  • Gets the resourceID of a resource

    Returns undefined | number

    resourceID of the resource

  • Sets the contextID of a resource

    Parameters

    • id: undefined | number

      the contextID to set

    Returns void

  • Set options from the passed options object

    Parameters

    • options: ResourceOptions

      the object to set options from

    • Optionaloverride: boolean

      whether to override the options object

    Returns void

  • Sets the resourceID of a resource

    Parameters

    • id: undefined | number

      the resourceID to set

    Returns void

  • Convert the resource to an Object

    Returns Promise<Record<string, any>>

    object representation of the resource

  • Convert the resource to a JSON string

    Returns Promise<string>

    the resource represented as a JSON string

  • Create a resource from an object

    Parameters

    • obj: Record<string, any>

      object to create resource from

    • copy: boolean = false

      whether to create a copy of the resource or not (removes resource IDs)

    Returns Resource

    new Resource