Commit cdb93e33 authored by A. Koch's avatar A. Koch

update data model dependency, update migrate script

parent c6e9ed6c
......@@ -20,12 +20,15 @@ const proc = async function () {
await mapsClient.connect()
const maps = await mapsClient.find({})
for (let map of maps) {
Object.keys(map).forEach(key => {
if (key[0] === '_') map[key] = undefined
})
if (typeof map.author === 'string') {
map.author = { id: map.author }
console.log('updating author to', map.author)
}
const mi = new Map(map)
await mapsClient.update(map.uuid, mi)
await mapsClient.update(mi.uuid, mi.toObject(), {})
}
console.log('ANNOTATIONS\n-------------------\n\n')
......@@ -37,6 +40,9 @@ const proc = async function () {
await annoClient.connect()
const annos = await annoClient.find({})
for (let anno of annos) {
Object.keys(anno).forEach(key => {
if (key[0] === '_') anno[key] = undefined
})
if (typeof anno.author === 'string') {
anno.author = { id: anno.author }
console.log('updating author to', anno.author)
......@@ -49,6 +55,10 @@ const proc = async function () {
anno.target.id = anno.target.id.replace(gridPrefix, `${newPrefix}maps/`)
console.log('updating grid target to', anno.target.id)
}
if (anno.target.type === 'Video' && typeof anno.target.id === 'string' && uuid.isUUID(anno.target.id)) {
anno.target.id = `${newPrefix}annotations/${anno.target.id}`
console.log('updating video target to', anno.target.id)
}
if (anno.target.type === 'Timeline' && typeof anno.target.id === 'string' && uuid.isUUID(anno.target.id)) {
anno.target.id = `${newPrefix}maps/${anno.target.id}`
console.log('updating timeline target to', anno.target.id)
......@@ -58,7 +68,7 @@ const proc = async function () {
console.log('updating grid target to', anno.target.id)
}
const ai = new Annotation(anno)
await mapsClient.update(anno.uuid, ai)
await annoClient.update(ai.uuid, ai.toObject(), {})
}
}
......
......@@ -1909,9 +1909,9 @@
}
},
"jsonld": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/jsonld/-/jsonld-1.0.2.tgz",
"integrity": "sha512-P7fQhPC8LaugDqXBw3JMs+JCXapqcWZdwPvMZXDnqIxUe2j3Zgzf908/mashovM4JFAR9D8S1k5qAo+kkqbToQ==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/jsonld/-/jsonld-1.0.4.tgz",
"integrity": "sha512-Kh1f4biEp72ZO7QUTQpc5BQYdE0C/mARzds0MUy+BEqQ4dDM0wYyoeuw4WacAMDzQ6wp3zmMvUvRlITxlRe5xw==",
"requires": {
"rdf-canonize": "^0.2.1",
"request": "^2.83.0",
......@@ -2207,32 +2207,18 @@
}
},
"mbjs-data-models": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/mbjs-data-models/-/mbjs-data-models-0.0.8.tgz",
"integrity": "sha512-KzwK/OnkV1yb4Gut0ggqQVXJm88Hn9VBHa3ZZJVxLtisaVG1WTXnKmFD1HGG4kE5jkxL04c7rHKvCPW21xkLvw==",
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/mbjs-data-models/-/mbjs-data-models-0.0.10.tgz",
"integrity": "sha512-BTKQnNlGOotWXY7rW478Rpfnv5Rbst8gEoFlVejzXWgT4tn/DA6d5tMxW1vUQTEkuw344N/J8w1TB7VyDMPNxw==",
"requires": {
"bignumber.js": "^6.0.0",
"bluebird": "^3.5.1",
"jsonld": "^1.0.2",
"luxon": "^1.3.3",
"mbjs-utils": "^0.0.4",
"mbjs-utils": "^0.0.6",
"schema-object": "^4.0.11",
"slug": "^0.9.1",
"validator": "^9.4.1"
},
"dependencies": {
"mbjs-utils": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/mbjs-utils/-/mbjs-utils-0.0.4.tgz",
"integrity": "sha512-mB6B2nxZ3qvo55qm3Xaq7j6iFrT0Q86+6fn/gFFP25syfSNr75zk908XT2DOC11f91zGIx4BJQaNVwPK7RHRXw==",
"requires": {
"deep-extend": "^0.5.0",
"luxon": "^1.0.0",
"slug": "^0.9.1",
"uuid": "^3.2.1",
"validator": "^9.4.1"
}
}
}
},
"mbjs-generic-api": {
......@@ -2519,9 +2505,9 @@
}
},
"nan": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz",
"integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA=="
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz",
"integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw=="
},
"nanoid": {
"version": "1.0.7",
......@@ -2554,9 +2540,9 @@
}
},
"node-forge": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz",
"integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ=="
"version": "0.7.6",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.6.tgz",
"integrity": "sha512-sol30LUpz1jQFBjOKwbjxijiE3b6pjd74YwfD0fJOKPjF+fONKb2Yg8rYgS6+bK6VDl+/wfr4IYpC7jDzLUIfw=="
},
"normalize-package-data": {
"version": "2.4.0",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment