Class: SystemMetadata

SystemMetadata()

new SystemMetadata()

Typed DataONE System Metadata domain model with direct root properties, owned child domains, tolerant XML parsing, and canonical v2 XML serialization. Parsing silently repairs harmless XML shape issues such as missing namespaces, unknown child elements, out-of-order known children, and duplicate singleton elements where the last value wins. `parseWarnings` is only populated when parsing had to drop invalid optional content.
Properties:
Name Type Description
serialVersion number | null Optional sysmeta serial version.
identifier string | null DataONE identifier.
formatId string | null DataONE format identifier.
size number | null Object size in bytes.
submitter string | null Optional submitter subject.
rightsHolder string | null Rights holder subject.
obsoletes string | null PID obsoleted by this object.
obsoletedBy string | null PID that obsoletes this object.
archived boolean | null Archived flag.
dateUploaded Date | null Upload timestamp.
dateSysMetadataModified Date | null Sysmeta-modified timestamp.
originMemberNode string | null Origin member node.
authoritativeMemberNode string | null Authoritative member node.
seriesId string | null Optional series identifier.
fileName string | null Optional file name.
checksum Checksum Owned checksum value object.
accessPolicy AccessPolicy Owned access-policy collection.
replicationPolicy ReplicationPolicy Owned replication policy.
replicas ReplicaList Owned replica collection.
mediaType MediaType Owned media-type value object.
parseWarnings Array.<object> Lossy parse warnings from the most recent successful XML parse.
Since:
  • 2.34.0
Source:

Methods

clone() → {SystemMetadata}

Create an independent copy of this System Metadata.
Since:
  • 2.39.0
Source:
Returns:
Cloned System Metadata
Type
SystemMetadata

normalize() → {SystemMetadata}

Normalize this instance's values in-place
Since:
  • 2.39.0
Source:
Returns:
This instance with normalized values.
Type
SystemMetadata

parse(xmlString) → {SystemMetadata}

Parse and normalize a System Metadata XML document onto this instance. Harmless XML cleanup such as missing namespaces, unknown child elements, out-of-order known children, and duplicate singleton elements is repaired silently. `parseWarnings` is only populated when parsing had to drop invalid optional content.
Parameters:
Name Type Description
xmlString string System Metadata XML string to parse.
Source:
Throws:
Throws when the XML is malformed, is a DataONE error document, has the wrong root element, or is missing required core data after recovery.
Type
Error
Returns:
The same instance with parsed values.
Type
SystemMetadata

reset()

Reset all fields to default values.
Since:
  • 2.39.0
Source:

serialize(optionsopt) → {string}

Serialize the current System Metadata state to canonical v2 XML.
Parameters:
Name Type Attributes Description
options object <optional>
Serialization options.
Properties
Name Type Attributes Description
validate boolean <optional>
Whether to validate before serializing.
Since:
  • 2.39.0
Source:
Throws:
Throws when validation is enabled and the model is invalid.
Type
Error
Returns:
Canonical v2 XML serialization.
Type
string

toJSON() → {object}

Return a JSON-safe snapshot of the current normalized state.
Source:
Returns:
Plain system metadata JSON.
Type
object

toObject() → {object}

Return values for all sysMeta fields in a plain object.
Since:
  • 2.39.0
Source:
Returns:
Plain snapshot of the current state.
Type
object

validate() → {Array.<object>}

Validate the current System Metadata state.
Since:
  • 2.39.0
Source:
Returns:
Validation issues for invalid fields.
Type
Array.<object>

fromXml(xmlString) → {SystemMetadata}

Create a new SystemMetadata instance from XML.
Parameters:
Name Type Description
xmlString string System Metadata XML string.
Since:
  • 2.39.0
Source:
Returns:
Parsed System Metadata instance.
Type
SystemMetadata

getDefaults() → {object}

Get default values for all sysMeta fields.
Since:
  • 2.39.0
Source:
Returns:
Default values object.
Type
object

normalizeValues(values) → {object}

Normalize sysMeta values, applying defaults and type conversions when necessary.
Parameters:
Name Type Description
values object An object with sysMeta fields to normalize.
Since:
  • 2.39.0
Source:
Returns:
Normalized values object.
Type
object

resetFieldToDefault(values, field)

Reset a single field to its default in-place.
Parameters:
Name Type Description
values object Values object to reset a field on.
field string Field name to reset to default.
Since:
  • 2.39.0
Source:

validateValues(values) → {Array.<object>}

Validate values without requiring mutation of a caller-owned object.
Parameters:
Name Type Description
values object Candidate System Metadata values.
Since:
  • 2.39.0
Source:
Returns:
Validation issues.
Type
Array.<object>

SystemMetadata(dataopt)

new SystemMetadata(dataopt)

Create a SystemMetadata instance.
Parameters:
Name Type Attributes Description
data object <optional>
Initial system metadata values.
Source:

Methods

clone() → {SystemMetadata}

Create an independent copy of this System Metadata.
Since:
  • 2.39.0
Source:
Returns:
Cloned System Metadata
Type
SystemMetadata

normalize() → {SystemMetadata}

Normalize this instance's values in-place
Since:
  • 2.39.0
Source:
Returns:
This instance with normalized values.
Type
SystemMetadata

parse(xmlString) → {SystemMetadata}

Parse and normalize a System Metadata XML document onto this instance. Harmless XML cleanup such as missing namespaces, unknown child elements, out-of-order known children, and duplicate singleton elements is repaired silently. `parseWarnings` is only populated when parsing had to drop invalid optional content.
Parameters:
Name Type Description
xmlString string System Metadata XML string to parse.
Source:
Throws:
Throws when the XML is malformed, is a DataONE error document, has the wrong root element, or is missing required core data after recovery.
Type
Error
Returns:
The same instance with parsed values.
Type
SystemMetadata

reset()

Reset all fields to default values.
Since:
  • 2.39.0
Source:

serialize(optionsopt) → {string}

Serialize the current System Metadata state to canonical v2 XML.
Parameters:
Name Type Attributes Description
options object <optional>
Serialization options.
Properties
Name Type Attributes Description
validate boolean <optional>
Whether to validate before serializing.
Since:
  • 2.39.0
Source:
Throws:
Throws when validation is enabled and the model is invalid.
Type
Error
Returns:
Canonical v2 XML serialization.
Type
string

toJSON() → {object}

Return a JSON-safe snapshot of the current normalized state.
Source:
Returns:
Plain system metadata JSON.
Type
object

toObject() → {object}

Return values for all sysMeta fields in a plain object.
Since:
  • 2.39.0
Source:
Returns:
Plain snapshot of the current state.
Type
object

validate() → {Array.<object>}

Validate the current System Metadata state.
Since:
  • 2.39.0
Source:
Returns:
Validation issues for invalid fields.
Type
Array.<object>

fromXml(xmlString) → {SystemMetadata}

Create a new SystemMetadata instance from XML.
Parameters:
Name Type Description
xmlString string System Metadata XML string.
Since:
  • 2.39.0
Source:
Returns:
Parsed System Metadata instance.
Type
SystemMetadata

getDefaults() → {object}

Get default values for all sysMeta fields.
Since:
  • 2.39.0
Source:
Returns:
Default values object.
Type
object

normalizeValues(values) → {object}

Normalize sysMeta values, applying defaults and type conversions when necessary.
Parameters:
Name Type Description
values object An object with sysMeta fields to normalize.
Since:
  • 2.39.0
Source:
Returns:
Normalized values object.
Type
object

resetFieldToDefault(values, field)

Reset a single field to its default in-place.
Parameters:
Name Type Description
values object Values object to reset a field on.
field string Field name to reset to default.
Since:
  • 2.39.0
Source:

validateValues(values) → {Array.<object>}

Validate values without requiring mutation of a caller-owned object.
Parameters:
Name Type Description
values object Candidate System Metadata values.
Since:
  • 2.39.0
Source:
Returns:
Validation issues.
Type
Array.<object>