The 'MetaSet' class manages metadata sets and includes a collection of tables and views. This class provides features such as serialization of data, schema conversion, data loading and storage, and more.

Hierarchy (view full)

Implements

Constructors

  • Creates a 'MetaSet' object.

    Parameters

    • name: string

      Name of the meta set.

    Returns MetaSet

Properties

_guid: string

Unique identifier of the object (GUID). Uniquely identifies the object.

_name: string

The name of the element, which acts as a unique identifier for the MetaElement.

_type: Function

The generator function of the object. The function used when the object was created.

autoChanges: boolean

Enable automatic transaction change. Default is 'false'.

setName: string

Name of the meta set.

A collection of meta tables.

This is a collection of meta-views.

_NS: string

Indicates the namespace.

'Meta'
_PARAM: []

List of parameters used for the constructor.

['name']
_UNION: []

List of implemented interfaces.

[IElement]

Methods

  • Allow and commit changes to the meta set.

    Returns void

    metaSet.acceptChanges(); // Commit changes
    
  • Initializes the rows of all views and all tables.

    Returns void

    metaSet.clear(); // Initialize rows of all views and tables
    
  • Create a new object by replicating the current 'MetaSet' object.

    Returns this

    Replicated 'MetaSet' object.

    const clone = metaSet.clone();
    
  • Compare the current object with the specified object.

    Parameters

    • target: object

      the object to be compared to.

    Returns boolean

    Returns whether the two objects are the same.

  • Converts the current 'MetaSet' object to a serialized GUID type object. In the serialization process, the cyclic reference is replaced by the value '$ref'.

    Parameters

    • OptionalvOpt: number

      Specifies the serialization option.

      • '0': Convert to a reference structure (including '_guid' and '$ref')
      • '1': Converting to a redundant structure (including '_guid' and '$ref')
      • '2': Conversion to non-coordinated structure (excluding '_guid' and '$ref')
    • Optionalowned: object | object[]

      The parent objects that currently own the object. You can receive an object or array of objects.

    Returns object

    Serialized object.

    const serialized = metaSet.getObject(2); // Import serialized objects in a non-coordinated structure
    
  • Returns the creators of the current object and all the creators of the prototype chain to the array.

    Returns Function[]

    Returns the array of generator functions.

    const types = obj.getTypes();
    console.log(types); // [Function: MetaObject]
  • Verify that there are changes to the meta set.

    Returns boolean

    Return 'true' if there is any change or 'false' if there is no change.

    const hasChanges = metaSet.hasChanges(); // Check if there are any changes
    
  • Verify that the current object is an instance of the specified type (including _UNION)

    Parameters

    • target: string | object

      The type of object to be checked (object or string).

    Returns boolean

    Returns whether it is an instance of the specified type.

  • Import or import data (not for merge purposes) Initialize existing data and import new data.

    Parameters

    • obj: string | object

      Data to be retrieved. You can receive an object or string.

    • Optionalparse: Function

      Optional parser function.

    Returns void

    metaSet.load (dataObject, JSON.path); // import data object
    
  • Output (serialize) the meta set object.

    Parameters

    • OptionalvOpt: number

      Serialization option.

      • '0': Output to reference structure
      • '1': Output in duplicate structure
      • '2': Output in a non-coordinated structure
    • Optionalstringify: Function

      Optional serialization function. Default is 'JSON.stringify'.

    • Optionalspace: string

      Optional blank string; default is 'undefined'.

    Returns string

    Serialized string.

    const jsonString = metaSet.output(2, JSON.stringify, ''); // serialized string output
    
  • Read the object and load the meta set. Follow JSON schema rules.

    Parameters

    • obj: object

      Metaset objects, entities, or other objects.

    • opt: number

      Optional; default is '3'.

    Returns void

    metaSet.read(dataObject, 3); // read data objects and load the meta set
    
  • Read the data to set the row of the meta set.

    Parameters

    • obj: object

      Data to read.

    Returns void

    metaSet.readData(dataObject); // Set the row of the metaset by reading the data object
    
  • Read the schema and apply it to the meta set. If not, set whether an empty column should be created.

    Parameters

    • obj: object

      Schema object or GUID object.

    • OptionalcreateRow: boolean

      If 'true', add a column based on the first row.

    Returns void

    metaSet.readSchema(schemaObject, true); // Read schema and apply to metaset
    
  • Cancel the changes to the meta set.

    Returns void

    metaSet.rejectChanges(); // Cancel the changes
    
  • Performs a full initialization operation.

    Returns void

    metaSet.reset(); // initializing the metaset globally
    
  • Sets the serialized GUID type object to the current 'MetaSet' object. During this process, the object is initialized.

    Parameters

    • oGuid: object

      object of serialized GUID type.

    • Optionalorigin: object

      This is the original object that sets the current object. Default is 'oGuid'.

    Returns void

    metaSet.setObject(serializedObject); // Set serialized objects to the current meta set
    
  • Export the meta set as an object of schema type.

    Parameters

    • OptionalvOpt: number

      Export option.

    Returns object

    Exported schema object.

    const schemaObject = metaSet.write(1); // Exporting the meta set as schema object
    
  • Export the data (low) of the meta set as an object of schema type.

    Parameters

    • OptionalvOpt: number

      Export option.

    Returns object

    The exported data object.

    const dataObject = metaSet.writeData(1); // Export data (low) as schema object
    
  • Export the schema (column) of the meta set as an object of schema type.

    Parameters

    • OptionalvOpt: number

      Export option.

    Returns object

    schema object.

    const schemaObject = metaSet.writeSchema(1); // Export schema (column) as schema object
    
  • Converts the meta set to a schema object.

    Parameters

    • oGuid: object

      serialized object obtained by 'getObject()'.

    Returns object

    The transformed schema object.

    const schema = MetaSet.transformSchema(serializedObject);