dependency upgrades, server and platform module updates, linting wip

This commit is contained in:
William Welling
2017-07-12 14:33:16 -05:00
parent afc39022f8
commit c08f5c672b
190 changed files with 6321 additions and 4703 deletions

View File

@@ -1,23 +1,24 @@
import { COMMUNITIES } from "./communities";
const util = require('util');
const { Router } = require('express');
const util = require('util');
// Our API for demos only
import { fakeDataBase } from './db';
import { fakeDemoRedisCache } from './cache';
import { COLLECTIONS } from "./collections";
import { ITEMS } from "./items";
import { BUNDLES } from "./bundles";
import { BITSTREAMS } from "./bitstreams";
import { METADATA } from "./metadata";
import COMMUNITIES from './data/communities.json';
import COLLECTIONS from './data/collections.json';
import ITEMS from './data/items.json';
import BUNDLES from './data/bundles.json';
import BITSTREAMS from './data/bitstreams.json';
import METADATA from './data/metadata.json';
// you would use cookies/token etc
const USER_ID = 'f9d98cf1-1b96-464e-8755-bcc2a5c09077'; // hardcoded as an example
// Our API for demos only
export function serverApi(req, res) {
let key = USER_ID + '/data.json';
let cache = fakeDemoRedisCache.get(key);
const key = USER_ID + '/data.json';
const cache = fakeDemoRedisCache.get(key);
if (cache !== undefined) {
console.log('/data.json Cache Hit');
return res.json(cache);
@@ -25,24 +26,23 @@ export function serverApi(req, res) {
console.log('/data.json Cache Miss');
fakeDataBase.get()
.then(data => {
.then((data) => {
fakeDemoRedisCache.set(key, data);
return data;
})
.then(data => res.json(data));
.then((data) => res.json(data));
}
function toHALResponse(req, data, included?) {
let result = {
"_embedded": data,
"_links": {
"self": req.protocol + '://' + req.get('host') + req.originalUrl
const result = {
_embedded: data,
_links: {
self: req.protocol + '://' + req.get('host') + req.originalUrl
}
};
if (included && Array.isArray(included) && included.length > 0) {
Object.assign(result, {
"included": included
included: included
});
}
return result;
@@ -50,39 +50,22 @@ function toHALResponse(req, data, included?) {
export function createMockApi() {
let router = Router();
const router = Router();
router.route('/communities')
.get(function(req, res) {
console.log('GET');
// 70ms latency
setTimeout(function() {
res.json(toHALResponse(req, COMMUNITIES));
}, 0);
router.route('/communities').get((req, res) => {
console.log('GET');
// 70ms latency
setTimeout(() => {
res.json(toHALResponse(req, COMMUNITIES));
}, 0);
});
// })
// .post(function(req, res) {
// console.log('POST', util.inspect(req.body, { colors: true }));
// let community = req.body;
// if (community) {
// COMMUNITIES.push({
// value: community.value,
// created_at: new Date(),
// completed: community.completed,
// id: COMMUNITY_COUNT++
// });
// return res.json(community);
// }
//
// return res.end();
});
router.param('community_id', function(req, res, next, community_id) {
router.param('community_id', (req, res, next, communityId) => {
// ensure correct prop type
let id = req.params.community_id;
const id = req.params.community_id;
try {
req.community_id = id;
req.community = COMMUNITIES["communities"].find((community) => {
req.community = COMMUNITIES.communities.find((community) => {
return community.id === id;
});
next();
@@ -91,59 +74,24 @@ export function createMockApi() {
}
});
router.route('/communities/:community_id')
.get(function(req, res) {
// console.log('GET', util.inspect(req.community.id, { colors: true }));
res.json(toHALResponse(req, req.community));
// })
// .put(function(req, res) {
// console.log('PUT', util.inspect(req.body, { colors: true }));
//
// let index = COMMUNITIES.indexOf(req.community);
// let community = COMMUNITIES[index] = req.body;
//
// res.json(community);
// })
// .delete(function(req, res) {
// console.log('DELETE', req.community_id);
//
// let index = COMMUNITIES.indexOf(req.community);
// COMMUNITIES.splice(index, 1);
//
// res.json(req.community);
});
router.route('/communities/:community_id').get((req, res) => {
res.json(toHALResponse(req, req.community));
});
router.route('/collections')
.get(function(req, res) {
console.log('GET');
// 70ms latency
setTimeout(function() {
res.json(toHALResponse(req, COLLECTIONS));
}, 0);
router.route('/collections').get((req, res) => {
console.log('GET');
// 70ms latency
setTimeout(() => {
res.json(toHALResponse(req, COLLECTIONS));
}, 0);
});
// })
// .post(function(req, res) {
// console.log('POST', util.inspect(req.body, { colors: true }));
// let collection = req.body;
// if (collection) {
// COLLECTIONS.push({
// value: collection.value,
// created_at: new Date(),
// completed: collection.completed,
// id: COLLECTION_COUNT++
// });
// return res.json(collection);
// }
//
// return res.end();
});
router.param('collection_id', function(req, res, next, collection_id) {
router.param('collection_id', (req, res, next, collectionId) => {
// ensure correct prop type
let id = req.params.collection_id;
const id = req.params.collection_id;
try {
req.collection_id = id;
req.collection = COLLECTIONS["collections"].find((collection) => {
req.collection = COLLECTIONS.collections.find((collection) => {
return collection.id === id;
});
next();
@@ -152,60 +100,24 @@ export function createMockApi() {
}
});
router.route('/collections/:collection_id')
.get(function(req, res) {
// console.log('GET', util.inspect(req.collection.id, { colors: true }));
res.json(toHALResponse(req, req.collection));
// })
// .put(function(req, res) {
// console.log('PUT', util.inspect(req.body, { colors: true }));
//
// let index = COLLECTIONS.indexOf(req.collection);
// let collection = COLLECTIONS[index] = req.body;
//
// res.json(collection);
// })
// .delete(function(req, res) {
// console.log('DELETE', req.collection_id);
//
// let index = COLLECTIONS.indexOf(req.collection);
// COLLECTIONS.splice(index, 1);
//
// res.json(req.collection);
});
router.route('/collections/:collection_id').get((req, res) => {
res.json(toHALResponse(req, req.collection));
});
router.route('/items').get((req, res) => {
console.log('GET');
// 70ms latency
setTimeout(() => {
res.json(toHALResponse(req, ITEMS));
}, 0);
});
router.route('/items')
.get(function(req, res) {
console.log('GET');
// 70ms latency
setTimeout(function() {
res.json(toHALResponse(req, ITEMS));
}, 0);
// })
// .post(function(req, res) {
// console.log('POST', util.inspect(req.body, { colors: true }));
// let item = req.body;
// if (item) {
// ITEMS.push({
// value: item.value,
// created_at: new Date(),
// completed: item.completed,
// id: ITEM_COUNT++
// });
// return res.json(item);
// }
//
// return res.end();
});
router.param('item_id', function(req, res, next, item_id) {
router.param('item_id', (req, res, next, itemId) => {
// ensure correct prop type
let id = req.params.item_id;
const id = req.params.item_id;
try {
req.item_id = id;
req.item = ITEMS["items"].find((item) => {
req.item = ITEMS.items.find((item) => {
return item.id === id;
});
next();
@@ -214,86 +126,63 @@ export function createMockApi() {
}
});
router.route('/items/:item_id')
.get(function(req, res) {
// console.log('GET', util.inspect(req.item, { colors: true }));
res.json(toHALResponse(req, req.item));
// })
// .put(function(req, res) {
// console.log('PUT', util.inspect(req.body, { colors: true }));
//
// let index = ITEMS.indexOf(req.item);
// let item = ITEMS[index] = req.body;
//
// res.json(item);
// })
// .delete(function(req, res) {
// console.log('DELETE', req.item_id);
//
// let index = ITEMS.indexOf(req.item);
// ITEMS.splice(index, 1);
//
// res.json(req.item);
});
router.route('/items/:item_id').get((req, res) => {
res.json(toHALResponse(req, req.item));
});
router.route('/bundles')
.get(function(req, res) {
console.log('GET');
// 70ms latency
setTimeout(function() {
res.json(toHALResponse(req, BUNDLES));
}, 0);
});
router.route('/bundles').get((req, res) => {
console.log('GET');
// 70ms latency
setTimeout(() => {
res.json(toHALResponse(req, BUNDLES));
}, 0);
});
router.param('bundle_id', function(req, res, next, bundle_id) {
// ensure correct prop type
let id = req.params.bundle_id;
try {
req.bundle_id = id;
req.bundle = BUNDLES["bundles"].find((bundle) => {
return bundle.id === id;
});
next();
} catch (e) {
next(new Error('failed to load item'));
}
});
router.param('bundle_id', (req, res, next, bundleId) => {
// ensure correct prop type
const id = req.params.bundle_id;
try {
req.bundle_id = id;
req.bundle = BUNDLES.bundles.find((bundle) => {
return bundle.id === id;
});
next();
} catch (e) {
next(new Error('failed to load item'));
}
});
router.route('/bundles/:bundle_id')
.get(function(req, res) {
// console.log('GET', util.inspect(req.bundle, { colors: true }));
res.json(toHALResponse(req, req.bundle));
});
router.route('/bundles/:bundle_id').get((req, res) => {
// console.log('GET', util.inspect(req.bundle, { colors: true }));
res.json(toHALResponse(req, req.bundle));
});
router.route('/bitstreams').get((req, res) => {
console.log('GET');
// 70ms latency
setTimeout(() => {
res.json(toHALResponse(req, BITSTREAMS));
}, 0);
});
router.route('/bitstreams')
.get(function(req, res) {
console.log('GET');
// 70ms latency
setTimeout(function() {
res.json(toHALResponse(req, BITSTREAMS));
}, 0);
});
router.param('bitstream_id', (req, res, next, bitstreamId) => {
// ensure correct prop type
const id = req.params.bitstream_id;
try {
req.bitstream_id = id;
req.bitstream = BITSTREAMS.bitstreams.find((bitstream) => {
return bitstream.id === id;
});
next();
} catch (e) {
next(new Error('failed to load item'));
}
});
router.param('bitstream_id', function(req, res, next, bitstream_id) {
// ensure correct prop type
let id = req.params.bitstream_id;
try {
req.bitstream_id = id;
req.bitstream = BITSTREAMS["bitstreams"].find((bitstream) => {
return bitstream.id === id;
});
next();
} catch (e) {
next(new Error('failed to load item'));
}
});
router.route('/bitstreams/:bitstream_id')
.get(function(req, res) {
// console.log('GET', util.inspect(req.bitstream, { colors: true }));
res.json(toHALResponse(req, req.bitstream));
});
router.route('/bitstreams/:bitstream_id').get((req, res) => {
// console.log('GET', util.inspect(req.bitstream, { colors: true }));
res.json(toHALResponse(req, req.bitstream));
});
return router;
}

View File

@@ -1,83 +0,0 @@
export const BITSTREAMS = {
"bitstreams": [
{
"_links": {
"self": { "href": "/bitstreams/3678" },
"bundle": { "href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9" },
"retrieve": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa/retrieve" }
},
"id": "3678",
"uuid": "43c57c2b-206f-4645-8c8f-5f10c84b09fa",
"type": "bitstream",
"name": "do_open_access_CRL.pdf",
"size": 636626,
"checksum": {
"value": "063dfbbbac873aa3fca479b878eccff3",
"algorithm": "MD5"
},
"metadata": [
{ "key": "dc.title", "value": "do_open_access_CRL.pdf", "language": null },
{ "key": "dc.description", "value": "Conference Paper", "language": "en" }
],
"format": "Adobe PDF",
"mimetype": "application/pdf"
},
{
"_links": {
"self": { "href": "/bitstreams/8842" },
"bundle": { "href": "/bundles/a469c57a-abcf-45c3-83e4-b187ebd708fd" },
"retrieve": { "href": "/rest/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632/retrieve" }
},
"id": "8842",
"uuid": "1a013ecc-fb25-4689-a44f-f1383ad26632",
"type": "bitstream",
"name": "do_open_access_CRL.pdf.jpg",
"size": 41183,
"checksum": {
"value": "a8ad475e86f9645c60e13e06f1427814",
"algorithm": "MD5"
},
"metadata": [
{ "key": "dc.title", "value": "do_open_access_CRL.pdf.jpg", "language": null },
{ "key": "dc.description", "value": "Generated Thumbnail", "language": "en" }
],
"format": "JPEG",
"mimetype": "image/jpeg"
},
{
"_links": {
"self": { "href": "/bitstreams/8934" },
"bundle": { "href": "/bundles/99f78e5e-3677-43b0-aaef-cddaa1a49092" },
"retrieve": { "href": "/rest/bitstreams/ba7d24f2-8fc7-4b8e-b7b6-6c32be1c12a6/retrieve" }
},
"id": "8934",
"uuid": "ba7d24f2-8fc7-4b8e-b7b6-6c32be1c12a6",
"type": "bitstream",
"name": "license.txt",
"size": 41183,
"checksum": {
"value": "8ad416e8a39e645020e13e06f1427814",
"algorithm": "MD5"
},
"metadata": [
{ "key": "dc.title", "value": "license.txt", "language": null },
{ "key": "dc.description", "value": "License", "language": "en" }
],
"format": "Text",
"mimetype": "text/plain"
},
{
"_links": {
"self": { "href": "/bitstreams/4688" },
},
"id": "4688",
"uuid": "1bb1be24-c934-41e3-a0fb-ca7a71ab0e71",
"type": "bitstream",
"name": "collection-5179-logo.png",
"size": 299832,
"url": "/bitstreams/1bb1be24-c934-41e3-a0fb-ca7a71ab0e71/retrieve",
"format": "PNG",
"mimetype": "image/png"
},
]
};

View File

@@ -1,61 +0,0 @@
export const BUNDLES = {
"bundles": [
{
"_links": {
"self": { "href": "/bundles/2355" },
"items": [
{ "href": "/items/8871" }
],
"bitstreams": [
{ "href": "/bitstreams/3678" },
],
"primaryBitstream": { "href": "/bitstreams/3678" }
},
"id": "2355",
"uuid": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9",
"type": "bundle",
"name": "ORIGINAL",
"metadata": [
{ "key": "dc.title", "value": "ORIGINAL", "language": "en" }
]
},
{
"_links": {
"self": { "href": "/bundles/5687" },
"items": [
{ "href": "/items/8871" }
],
"bitstreams": [
{ "href": "/bitstreams/8842" },
],
"primaryBitstream": { "href": "/bitstreams/8842" }
},
"id": "5687",
"uuid": "a469c57a-abcf-45c3-83e4-b187ebd708fd",
"type": "bundle",
"name": "THUMBNAIL",
"metadata": [
{ "key": "dc.title", "value": "THUMBNAIL", "language": "en" }
]
},
{
"_links": {
"self": { "href": "/bundles/8475" },
"items": [
{ "href": "/items/8871" }
],
"bitstreams": [
{ "href": "/bitstreams/8934" },
],
"primaryBitstream": { "href": "/bitstreams/8934" }
},
"id": "8475",
"uuid": "99f78e5e-3677-43b0-aaef-cddaa1a49092",
"type": "bundle",
"name": "LICENSE",
"metadata": [
{ "key": "dc.title", "value": "LICENSE", "language": "en" }
]
}
]
};

View File

@@ -1,10 +1,8 @@
var _fakeLRUcount = 0;
let _fakeLRUcount = 0;
export const fakeDemoRedisCache = {
_cache: {},
get: (key) => {
let cache = fakeDemoRedisCache._cache[key];
const cache = fakeDemoRedisCache._cache[key];
_fakeLRUcount++;
if (_fakeLRUcount >= 10) {
fakeDemoRedisCache.clear();

View File

@@ -0,0 +1,123 @@
{
"bitstreams": [{
"_links": {
"self": {
"href": "/bitstreams/3678"
},
"bundle": {
"href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9"
},
"retrieve": {
"href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa/retrieve"
}
},
"id": "3678",
"uuid": "43c57c2b-206f-4645-8c8f-5f10c84b09fa",
"type": "bitstream",
"name": "do_open_access_CRL.pdf",
"size": 636626,
"checksum": {
"value": "063dfbbbac873aa3fca479b878eccff3",
"algorithm": "MD5"
},
"metadata": [{
"key": "dc.title",
"value": "do_open_access_CRL.pdf",
"language": null
},
{
"key": "dc.description",
"value": "Conference Paper",
"language": "en"
}
],
"format": "Adobe PDF",
"mimetype": "application/pdf"
},
{
"_links": {
"self": {
"href": "/bitstreams/8842"
},
"bundle": {
"href": "/bundles/a469c57a-abcf-45c3-83e4-b187ebd708fd"
},
"retrieve": {
"href": "/rest/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632/retrieve"
}
},
"id": "8842",
"uuid": "1a013ecc-fb25-4689-a44f-f1383ad26632",
"type": "bitstream",
"name": "do_open_access_CRL.pdf.jpg",
"size": 41183,
"checksum": {
"value": "a8ad475e86f9645c60e13e06f1427814",
"algorithm": "MD5"
},
"metadata": [{
"key": "dc.title",
"value": "do_open_access_CRL.pdf.jpg",
"language": null
},
{
"key": "dc.description",
"value": "Generated Thumbnail",
"language": "en"
}
],
"format": "JPEG",
"mimetype": "image/jpeg"
},
{
"_links": {
"self": {
"href": "/bitstreams/8934"
},
"bundle": {
"href": "/bundles/99f78e5e-3677-43b0-aaef-cddaa1a49092"
},
"retrieve": {
"href": "/rest/bitstreams/ba7d24f2-8fc7-4b8e-b7b6-6c32be1c12a6/retrieve"
}
},
"id": "8934",
"uuid": "ba7d24f2-8fc7-4b8e-b7b6-6c32be1c12a6",
"type": "bitstream",
"name": "license.txt",
"size": 41183,
"checksum": {
"value": "8ad416e8a39e645020e13e06f1427814",
"algorithm": "MD5"
},
"metadata": [{
"key": "dc.title",
"value": "license.txt",
"language": null
},
{
"key": "dc.description",
"value": "License",
"language": "en"
}
],
"format": "Text",
"mimetype": "text/plain"
},
{
"_links": {
"self": {
"href": "/bitstreams/4688"
}
},
"id": "4688",
"uuid": "1bb1be24-c934-41e3-a0fb-ca7a71ab0e71",
"type": "bitstream",
"name": "collection-5179-logo.png",
"size": 299832,
"url": "/bitstreams/1bb1be24-c934-41e3-a0fb-ca7a71ab0e71/retrieve",
"format": "PNG",
"mimetype": "image/png"
}
]
}

View File

@@ -0,0 +1,78 @@
{
"bundles": [{
"_links": {
"self": {
"href": "/bundles/2355"
},
"items": [{
"href": "/items/8871"
}],
"bitstreams": [{
"href": "/bitstreams/3678"
}],
"primaryBitstream": {
"href": "/bitstreams/3678"
}
},
"id": "2355",
"uuid": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9",
"type": "bundle",
"name": "ORIGINAL",
"metadata": [{
"key": "dc.title",
"value": "ORIGINAL",
"language": "en"
}]
},
{
"_links": {
"self": {
"href": "/bundles/5687"
},
"items": [{
"href": "/items/8871"
}],
"bitstreams": [{
"href": "/bitstreams/8842"
}],
"primaryBitstream": {
"href": "/bitstreams/8842"
}
},
"id": "5687",
"uuid": "a469c57a-abcf-45c3-83e4-b187ebd708fd",
"type": "bundle",
"name": "THUMBNAIL",
"metadata": [{
"key": "dc.title",
"value": "THUMBNAIL",
"language": "en"
}]
},
{
"_links": {
"self": {
"href": "/bundles/8475"
},
"items": [{
"href": "/items/8871"
}],
"bitstreams": [{
"href": "/bitstreams/8934"
}],
"primaryBitstream": {
"href": "/bitstreams/8934"
}
},
"id": "8475",
"uuid": "99f78e5e-3677-43b0-aaef-cddaa1a49092",
"type": "bundle",
"name": "LICENSE",
"metadata": [{
"key": "dc.title",
"value": "LICENSE",
"language": "en"
}]
}
]
}

View File

@@ -1,21 +1,26 @@
export const COLLECTIONS = {
"collections": [
{
{
"collections": [{
"_links": {
"self": { "href": "/collections/5179" },
"items": [
{ "href": "/items/8871" },
{ "href": "/items/9978" }
"self": {
"href": "/collections/5179"
},
"items": [{
"href": "/items/8871"
},
{
"href": "/items/9978"
}
],
"logo": { "href": "/bitstreams/4688" }
"logo": {
"href": "/bitstreams/4688"
}
},
"id": "5179",
"uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60",
"type": "collection",
"name": "A Test Collection",
"handle": "123456789/5179",
"metadata": [
{
"metadata": [{
"key": "dc.rights",
"value": "<p>© 2005-2016 JOHN DOE SOME RIGHTS RESERVED</p>",
"language": null
@@ -39,10 +44,15 @@ export const COLLECTIONS = {
},
{
"_links": {
"self": { "href": "/collections/6547" },
"items": [
{ "href": "/items/8871" },
{ "href": "/items/9978" }
"self": {
"href": "/collections/6547"
},
"items": [{
"href": "/items/8871"
},
{
"href": "/items/9978"
}
]
},
"id": "6547",
@@ -50,8 +60,7 @@ export const COLLECTIONS = {
"type": "collection",
"name": "Another Test Collection",
"handle": "123456789/6547",
"metadata": [
{
"metadata": [{
"key": "dc.rights",
"value": "<p>© 2005-2016 JOHN DOE SOME RIGHTS RESERVED</p>",
"language": null
@@ -74,4 +83,4 @@ export const COLLECTIONS = {
]
}
]
};
}

View File

@@ -1,13 +1,11 @@
export const COMMUNITIES = {
"communities": [
{
{
"communities": [{
"name": "Community 1",
"handle": "10673/1",
"id": "6631",
"uuid": "83cd3281-f241-48be-9234-d876f8010d14",
"type": "community",
"metadata": [
{
"metadata": [{
"key": "dc.description",
"value": "<p>This is the introductory text for the <em>Sample Community</em> on the DSpace Demonstration Site. It is editable by System or Community Administrators (of this Community).</p>\r\n<p><strong>DSpace Communities may contain one or more Sub-Communities or Collections (of Items).</strong></p>\r\n<p>This particular Community has its own logo (the <a href=\"http://www.duraspace.org/\">DuraSpace</a> logo).</p>",
"language": null
@@ -37,10 +35,12 @@ export const COMMUNITIES = {
"self": {
"href": "/communities/6631"
},
"collections": [
{ "href": "/collections/5179" }
],
"logo": { "href": "/bitstreams/4688" }
"collections": [{
"href": "/collections/5179"
}],
"logo": {
"href": "/bitstreams/4688"
}
}
},
{
@@ -49,8 +49,7 @@ export const COMMUNITIES = {
"id": "2365",
"uuid": "80eec4c6-70bd-4beb-b3d4-5d46c6343157",
"type": "community",
"metadata": [
{
"metadata": [{
"key": "dc.description",
"value": "<p>This is the introductory text for the <em>Sample Community</em> on the DSpace Demonstration Site. It is editable by System or Community Administrators (of this Community).</p>\r\n<p><strong>DSpace Communities may contain one or more Sub-Communities or Collections (of Items).</strong></p>\r\n<p>This particular Community has its own logo (the <a href=\"http://www.duraspace.org/\">DuraSpace</a> logo).</p>",
"language": null
@@ -80,10 +79,10 @@ export const COMMUNITIES = {
"self": {
"href": "/communities/2365"
},
"collections": [
{ "href": "/collections/6547" }
]
"collections": [{
"href": "/collections/6547"
}]
}
}
]
};
}

View File

@@ -1,26 +1,19 @@
export const ITEMS = {
"items": [
{
{
"items": [{
"_links": {
"self": {
"href": "/items/8871"
},
"parents": [
{
"parents": [{
"href": "/collections/5179"
},
{
"href": "/collections/6547"
}
],
"bundles": [
{
"href": "/bundles/2355"
},
// {
// "href": "/bundles/5687"
// }
]
"bundles": [{
"href": "/bundles/2355"
}]
},
"id": "8871",
"uuid": "21539b1d-9ef1-4eda-9c77-49565b5bfb78",
@@ -30,8 +23,7 @@ export const ITEMS = {
"lastModified": "2016-10-14 10:41:12.886",
"isArchived": true,
"isWithdrawn": false,
"metadata": [
{
"metadata": [{
"key": "dc.contributor.author",
"value": "Antelman, Kristin",
"language": "en"
@@ -93,91 +85,108 @@ export const ITEMS = {
}
],
"_embedded": {
"parents": [
{
"_links": {
"self": { "href": "/collections/6547" },
"items": [
{ "href": "/items/8871" },
{ "href": "/items/9978" }
]
"parents": [{
"_links": {
"self": {
"href": "/collections/6547"
},
"id": "6547",
"uuid": "598ce822-c357-46f3-ab70-63724d02d6ad",
"type": "collection",
"name": "Another Test Collection",
"handle": "123456789/6547",
"metadata": [
{
"key": "dc.rights",
"value": "<p>© 2005-2016 JOHN DOE SOME RIGHTS RESERVED</p>",
"language": null
"items": [{
"href": "/items/8871"
},
{
"key": "dc.description",
"value": "<p class='lead'>Another introductory text dolor sit amet, consectetur adipiscing elit. Duis laoreet lorem erat, eget auctor est ultrices quis. Nullam ac tincidunt quam. In nec nisl odio. In egestas aliquam tincidunt.</p>\r\n<p>Integer vitae diam id dolor pharetra dignissim in sed enim. Vivamus pulvinar tristique sem a iaculis. Aenean ultricies dui vel facilisis laoreet. Integer porta erat eu ultrices rhoncus. Sed condimentum malesuada ex sit amet ullamcorper. Morbi a ipsum dolor. Vivamus interdum eget lacus ut fermentum.</p>",
"language": null
},
{
"key": "dc.description.abstract",
"value": "Another collection for testing purposes",
"language": null
},
{
"key": "dc.description.tableofcontents",
"value": "<p>Some more news sed condimentum malesuada ex sit amet ullamcorper. Morbi a ipsum dolor. Vivamus interdum eget lacus ut fermentum. Donec sed ultricies erat, nec sollicitudin mauris. Duis varius nulla quis quam vulputate, at hendrerit turpis rutrum. Integer nec facilisis sapien. Fusce fringilla malesuada lectus id pulvinar. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae</p>",
"language": null
"href": "/items/9978"
}
]
}
],
"bundles": [
{
"_links": {
"self": { "href": "/bundles/2355" },
"items": [
{ "href": "/items/8871" }
],
"bitstreams": [
{ "href": "/bitstreams/3678" },
],
"primaryBitstream": { "href": "/bitstreams/3678" }
},
"id": "6547",
"uuid": "598ce822-c357-46f3-ab70-63724d02d6ad",
"type": "collection",
"name": "Another Test Collection",
"handle": "123456789/6547",
"metadata": [{
"key": "dc.rights",
"value": "<p>© 2005-2016 JOHN DOE SOME RIGHTS RESERVED</p>",
"language": null
},
"id": "2355",
"uuid": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9",
"type": "bundle",
"name": "ORIGINAL",
"metadata": [
{ "key": "dc.title", "value": "ORIGINAL", "language": "en" }
],
"_embedded": {
"bitstreams": [
{
"_links": {
"self": { "href": "/bitstreams/3678" },
"bundle": { "href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9" },
"retrieve": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa/retrieve" }
},
"id": "3678",
"uuid": "43c57c2b-206f-4645-8c8f-5f10c84b09fa",
"type": "bitstream",
"name": "do_open_access_CRL.pdf",
"size": 636626,
"checksum": {
"value": "063dfbbbac873aa3fca479b878eccff3",
"algorithm": "MD5"
},
"metadata": [
{ "key": "dc.title", "value": "do_open_access_CRL.pdf", "language": null },
{ "key": "dc.description", "value": "Conference Paper", "language": "en" }
],
"format": "Adobe PDF",
"mimetype": "application/pdf"
}
]
{
"key": "dc.description",
"value": "<p class='lead'>Another introductory text dolor sit amet, consectetur adipiscing elit. Duis laoreet lorem erat, eget auctor est ultrices quis. Nullam ac tincidunt quam. In nec nisl odio. In egestas aliquam tincidunt.</p>\r\n<p>Integer vitae diam id dolor pharetra dignissim in sed enim. Vivamus pulvinar tristique sem a iaculis. Aenean ultricies dui vel facilisis laoreet. Integer porta erat eu ultrices rhoncus. Sed condimentum malesuada ex sit amet ullamcorper. Morbi a ipsum dolor. Vivamus interdum eget lacus ut fermentum.</p>",
"language": null
},
{
"key": "dc.description.abstract",
"value": "Another collection for testing purposes",
"language": null
},
{
"key": "dc.description.tableofcontents",
"value": "<p>Some more news sed condimentum malesuada ex sit amet ullamcorper. Morbi a ipsum dolor. Vivamus interdum eget lacus ut fermentum. Donec sed ultricies erat, nec sollicitudin mauris. Duis varius nulla quis quam vulputate, at hendrerit turpis rutrum. Integer nec facilisis sapien. Fusce fringilla malesuada lectus id pulvinar. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae</p>",
"language": null
}
]
}],
"bundles": [{
"_links": {
"self": {
"href": "/bundles/2355"
},
"items": [{
"href": "/items/8871"
}],
"bitstreams": [{
"href": "/bitstreams/3678"
}],
"primaryBitstream": {
"href": "/bitstreams/3678"
}
},
"id": "2355",
"uuid": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9",
"type": "bundle",
"name": "ORIGINAL",
"metadata": [{
"key": "dc.title",
"value": "ORIGINAL",
"language": "en"
}],
"_embedded": {
"bitstreams": [{
"_links": {
"self": {
"href": "/bitstreams/3678"
},
"bundle": {
"href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9"
},
"retrieve": {
"href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa/retrieve"
}
},
"id": "3678",
"uuid": "43c57c2b-206f-4645-8c8f-5f10c84b09fa",
"type": "bitstream",
"name": "do_open_access_CRL.pdf",
"size": 636626,
"checksum": {
"value": "063dfbbbac873aa3fca479b878eccff3",
"algorithm": "MD5"
},
"metadata": [{
"key": "dc.title",
"value": "do_open_access_CRL.pdf",
"language": null
},
{
"key": "dc.description",
"value": "Conference Paper",
"language": "en"
}
],
"format": "Adobe PDF",
"mimetype": "application/pdf"
}]
}
]
}]
}
},
{
@@ -185,22 +194,16 @@ export const ITEMS = {
"self": {
"href": "/items/9978"
},
"parents": [
{
"parents": [{
"href": "/collections/5179"
},
{
"href": "/collections/6547"
}
],
"bundles": [
{
"href": "/bundles/2355"
},
// {
// "href": "/bundles/5687"
// }
]
"bundles": [{
"href": "/bundles/2355"
}]
},
"id": "9978",
"uuid": "be8325f7-243b-49f4-8a4b-df2b793ff3b5",
@@ -210,8 +213,7 @@ export const ITEMS = {
"lastModified": "2016-05-27 03:00:20.063",
"isArchived": true,
"isWithdrawn": false,
"metadata": [
{
"metadata": [{
"key": "dc.contributor.author",
"value": "John Doe",
"language": "en"
@@ -253,23 +255,28 @@ export const ITEMS = {
}
],
"_embedded": {
"parents": [
{
"parents": [{
"_links": {
"self": { "href": "/collections/5179" },
"items": [
{ "href": "/items/8871" },
{ "href": "/items/9978" }
"self": {
"href": "/collections/5179"
},
"items": [{
"href": "/items/8871"
},
{
"href": "/items/9978"
}
],
"logo": { "href": "/bitstreams/4688" }
"logo": {
"href": "/bitstreams/4688"
}
},
"id": "5179",
"uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60",
"type": "collection",
"name": "A Test Collection",
"handle": "123456789/5179",
"metadata": [
{
"metadata": [{
"key": "dc.rights",
"value": "<p>© 2005-2016 JOHN DOE SOME RIGHTS RESERVED</p>",
"language": null
@@ -293,10 +300,15 @@ export const ITEMS = {
},
{
"_links": {
"self": { "href": "/collections/6547" },
"items": [
{ "href": "/items/8871" },
{ "href": "/items/9978" }
"self": {
"href": "/collections/6547"
},
"items": [{
"href": "/items/8871"
},
{
"href": "/items/9978"
}
]
},
"id": "6547",
@@ -304,8 +316,7 @@ export const ITEMS = {
"type": "collection",
"name": "Another Test Collection",
"handle": "123456789/6547",
"metadata": [
{
"metadata": [{
"key": "dc.rights",
"value": "<p>© 2005-2016 JOHN DOE SOME RIGHTS RESERVED</p>",
"language": null
@@ -331,4 +342,4 @@ export const ITEMS = {
}
}
]
};
}

View File

@@ -1,6 +1,5 @@
export const METADATA = {
"metadata": [
{
{
"metadata": [{
"type": "metadata",
"id": "d58a3098-b390-4cd6-8f52-b088b3daa637",
"attributes": {
@@ -181,4 +180,4 @@ export const METADATA = {
}
}
]
};
}

View File

@@ -1,7 +1,7 @@
// Our API for demos only
export const fakeDataBase = {
get() {
let res = { data: 'This fake data came from the db on the server.' };
const res = { data: 'This fake data came from the db on the server.' };
return Promise.resolve(res);
}
};