Class: SystemMetadata

SystemMetadata()

new SystemMetadata()

Class representing System Metadata for a DataONE object. This class currently only provides a basic implementation for fetching and parsing system metadata from a DataONE service. It excludes parsing complex elements like accessPolicy and replicationPolicy. In the future, all fields will be implemented, and the class will support serialization to XML and updating system metadata on the server.
Properties:
Name Type Description
data object The object that contains all the system metadata fields, like identifier, formatId, size, checksum, etc.
errors Array An array to hold any errors that occur during the fetch operation.
parsed boolean Indicates whether the system metadata has been parsed from XML.
Since:
  • 2.34.0
Source:

Methods

parse(xmlString) → {object}

Parses the XML string into a system metadata object.
Parameters:
Name Type Description
xmlString string The XML string to parse.
Source:
Returns:
The parsed system metadata object.
Type
object

toJSON(includeErrorsopt, otherFieldsopt) → {object}

Return a JSON-serializable representation of the SystemMetadata.
Parameters:
Name Type Attributes Default Description
includeErrors boolean <optional>
true Whether to include any parsing errors in the output. If true, the `errors` array will be included, and if there was a parsing error, an additional Error object will be added to the array. If false, no errors will be included.
otherFields Array <optional>
An array of other SystemMetadata fields to include in the output, if they exist on the instance.
Source:
Returns:
The JSON representation of the SystemMetadata, as a new and unreferenced object.
Type
object

parseError(text) → {Error|null}

Attempts to parse an xml error object returned from DataONE, e.g.: READ not allowed on urn:uuid:c6556d90-4f58-4439-a309-a517a4fe3dc3 for subject[s]: public;
Parameters:
Name Type Description
text string The XML string to parse.
Source:
Returns:
Returns a SysMetaError with the error message and status if the XML contains an error element, or null if no error is found.
Type
Error | null

SystemMetadata(data)

new SystemMetadata(data)

Creates an instance of SystemMetadata.
Parameters:
Name Type Description
data object SystemMetadata fields and values, if known.
Source:

Methods

parse(xmlString) → {object}

Parses the XML string into a system metadata object.
Parameters:
Name Type Description
xmlString string The XML string to parse.
Source:
Returns:
The parsed system metadata object.
Type
object

toJSON(includeErrorsopt, otherFieldsopt) → {object}

Return a JSON-serializable representation of the SystemMetadata.
Parameters:
Name Type Attributes Default Description
includeErrors boolean <optional>
true Whether to include any parsing errors in the output. If true, the `errors` array will be included, and if there was a parsing error, an additional Error object will be added to the array. If false, no errors will be included.
otherFields Array <optional>
An array of other SystemMetadata fields to include in the output, if they exist on the instance.
Source:
Returns:
The JSON representation of the SystemMetadata, as a new and unreferenced object.
Type
object

parseError(text) → {Error|null}

Attempts to parse an xml error object returned from DataONE, e.g.: READ not allowed on urn:uuid:c6556d90-4f58-4439-a309-a517a4fe3dc3 for subject[s]: public;
Parameters:
Name Type Description
text string The XML string to parse.
Source:
Returns:
Returns a SysMetaError with the error message and status if the XML contains an error element, or null if no error is found.
Type
Error | null