@adobe/asset-compute-xmp

1.0.0 • Public • Published

Version License codecov Travis

asset-compute-xmp

Metadata XMP serialization used by custom Adobe Asset Compute serverless actions.

Installation

npm install @adobe/asset-compute-xmp

API Details

Limitations

  • Alternative arrays, rdf:Alt, are not supported
  • Nested arrays are not supported
  • Qualifiers, including xml:lang, are not supported
  • Resource references are not supported

Serialize simple name/value pairs

const { serializeXmp } = require("@adobe/asset-compute-xmp");
console.log(serializeXmp({
  "ns1:key1": true,
  "ns1:key2": false,
  "ns1:key3": new Date(),
  "ns1:key4": 123,
  "ns1:key5": "text",
  "ns1:key6": "http://www.adobe.com"
}, {
  namespaces: {
    ns1: "https://example.com/schema/example"
  }
}));
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns1="https://example.com/schema/example">
  <rdf:Description>
    <ns1:key1>True</ns1:key1>
    <ns1:key2>False</ns1:key2>
    <ns1:key3>2020-08-26T17:38:29.991Z</ns1:key3>
    <ns1:key4>123</ns1:key4>
    <ns1:key5>text</ns1:key5>
    <ns1:key6 rdf:resource="http://www.adobe.com"/>
  </rdf:Description>
</rdf:RDF>

Serialize an ordered sequence of values

const { serializeXmp } = require("@adobe/asset-compute-xmp");
console.log(serializeXmp({
  "ns1:key": [ "value1", "value2", "value3" ]
}, {
  namespaces: {
    ns1: "https://example.com/schema/example"
  }
}));
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns1="https://example.com/schema/example">
  <rdf:Description>
    <ns1:key>
      <rdf:Seq>
        <rdf:li>value1</rdf:li>
        <rdf:li>value2</rdf:li>
        <rdf:li>value3</rdf:li>
      </rdf:Seq>
    </ns1:key>
  </rdf:Description>
</rdf:RDF>

Serialize an unordered set of values

const { serializeXmp } = require("@adobe/asset-compute-xmp");
console.log(serializeXmp({
  "ns1:key": [ "value1", "value2", "value3" ]
}, {
  namespaces: {
    ns1: "https://example.com/schema/example"
  },
  xmpBags: [ "ns1:key" ]
}));
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns1="https://example.com/schema/example">
  <rdf:Description>
    <ns1:key>
      <rdf:Bag>
        <rdf:li>value1</rdf:li>
        <rdf:li>value2</rdf:li>
        <rdf:li>value3</rdf:li>
      </rdf:Bag>
    </ns1:key>
  </rdf:Description>
</rdf:RDF>

Serialize a nested structure

const { serializeXmp } = require("@adobe/asset-compute-xmp");
console.log(serializeXmp({
  "ns1:key1": {
    "ns1:key2": "value"
  }
}, {
  namespaces: {
    ns1: "https://example.com/schema/example"
  }
}));
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns1="https://example.com/schema/example">
  <rdf:Description>
    <ns1:key1>
      <rdf:Description>
        <ns1:key2>value</ns1:key2>
      </rdf:Description>
    </ns1:key1>
  </rdf:Description>
</rdf:RDF>

License and Contributing Guidelines

Package Sidebar

Install

npm i @adobe/asset-compute-xmp

Weekly Downloads

2

Version

1.0.0

License

Apache-2.0

Unpacked Size

26.7 kB

Total Files

7

Last publish

Collaborators

  • amol-anand
  • doten
  • stopp-adobe
  • dylandepass
  • djaeggi
  • adobehalls
  • fullcolorcoder
  • marbec
  • tripod
  • garthdb
  • lazd
  • adobe-admin
  • patrickfulton
  • trieloff
  • shazron
  • krisnye
  • dcpfsdk
  • natebaldwin
  • devongovett
  • aspro83
  • symanovi
  • dpfister
  • stefan-guggisberg
  • korra
  • rofe
  • kptdobe