Home Reference Source
import {BaseModel} from 'datamatic/src/Model/base-model.js'
public class | source

BaseModel

Direct Subclass:

ItemsModel, PropertiesModel

Static Method Summary

Static Public Methods
public static

createRef(ref: *, obj: *): *

creates owner Model reference on Proxied data object

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get

handler: object: {"setPrototypeOf": *, "isExtensible": *, "preventExtensions": *, "getOwnPropertyDescriptor": *, "defineProperty": *, "has": *, "ownKeys": *, "apply": *}

public get

Getter for Model validation status for hierarchy

public get

Getter for Object.isFrozen status of this node and it's ancestors

public get

Getter for path to JSON Object for Model

public get

model: object | array | null: *

stub for model getter, overridden by Model sub-class

public get

Getter for Model's Unique Object ID

public get

options: any: *

Get options (if any) for this model's schema todo: review for possible removal

public get

owner: Model: *

Getter for model's Model owner object

public get

Getter for Model's parent

public get

path: string: *

Getter for path to current Element

public get

Getter for root element of Model hierarchy

public get

schema: *: *

todo: add tests

public get

Provides formatted string for json-schema lookup

Method Summary

Public Methods
public

Applies Object.freeze to model and triggers complete notification -- unlike Object.freeze, this prevents modification -- to all children in Model hierarchy

public

pipeline(pipesOrSchemas: *): Pipeline

returns pipeline segment for process chaining

public

resets Model to empty value

public

subscribe(func: *): object

Subscribes handler method to observer for model

public

subscribeTo(path: *, func: *): object

Subscribes handler method to property observer for path

public

toJSON(): *

Provides JSON object representation of Model

public

Provides JSON String representation of Model

public

validate(value: json): boolean

Tests value for validation without setting value to Model

public

valueOf(): *

Raw value of this Model

Static Public Methods

public static createRef(ref: *, obj: *): * source

creates owner Model reference on Proxied data object

Params:

NameTypeAttributeDescription
ref *
obj *

Return:

*

Public Constructors

public constructor() source

Public Members

public get handler: object: {"setPrototypeOf": *, "isExtensible": *, "preventExtensions": *, "getOwnPropertyDescriptor": *, "defineProperty": *, "has": *, "ownKeys": *, "apply": *} source

Return:

object

public get isDirty: boolean: * source

Getter for Model validation status for hierarchy

Return:

boolean

public get isFrozen: boolean: * source

Getter for Object.isFrozen status of this node and it's ancestors

Return:

boolean

public get jsonPath: string: * source

Getter for path to JSON Object for Model

Return:

string

public get model: object | array | null: * source

stub for model getter, overridden by Model sub-class

Return:

object | array | null

public get objectID: string: * source

Getter for Model's Unique Object ID

Return:

string

Object ID for Model

public get options: any: * source

Get options (if any) for this model's schema todo: review for possible removal

Return:

any

public get owner: Model: * source

Getter for model's Model owner object

Return:

Model

public get parent: BaseModel: * source

Getter for Model's parent

Return:

BaseModel

public get path: string: * source

Getter for path to current Element

Return:

string

public get root: BaseModel: * source

Getter for root element of Model hierarchy

Return:

BaseModel

public get schema: *: * source

todo: add tests

Return:

*

public get validationPath: string: * source

Provides formatted string for json-schema lookup

Return:

string

Public Methods

public freeze(): BaseModel source

Applies Object.freeze to model and triggers complete notification -- unlike Object.freeze, this prevents modification -- to all children in Model hierarchy

Return:

BaseModel

public pipeline(pipesOrSchemas: *): Pipeline source

returns pipeline segment for process chaining

Params:

NameTypeAttributeDescription
pipesOrSchemas *

Return:

Pipeline

public reset(): BaseModel source

resets Model to empty value

Return:

BaseModel

public subscribe(func: *): object source

Subscribes handler method to observer for model

Params:

NameTypeAttributeDescription
func *

Return:

object

public subscribeTo(path: *, func: *): object source

Subscribes handler method to property observer for path

Params:

NameTypeAttributeDescription
path *
func *

Return:

object

public toJSON(): * source

Provides JSON object representation of Model

Return:

*

public toString(): string source

Provides JSON String representation of Model

Return:

string

public validate(value: json): boolean source

Tests value for validation without setting value to Model

Params:

NameTypeAttributeDescription
value json

JSON value to validate for validity

Return:

boolean

public valueOf(): * source

Raw value of this Model

Return:

*