mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Merge pull request #213 from oceanprotocol/feature/update-metadata-interface
update metadata interface
This commit is contained in:
commit
00d98f2005
@ -5,28 +5,37 @@ const metadata: Partial<MetaData> = {
|
|||||||
name: undefined,
|
name: undefined,
|
||||||
type: "dataset",
|
type: "dataset",
|
||||||
description: "Weather information of UK including temperature and humidity",
|
description: "Weather information of UK including temperature and humidity",
|
||||||
dateCreated: "2012-02-01T10:55:11+00:00",
|
dateCreated: "2012-10-10T17:00:000Z",
|
||||||
|
datePublished: "2012-10-10T17:00:000Z",
|
||||||
author: "Met Office",
|
author: "Met Office",
|
||||||
license: "CC-BY",
|
license: "CC-BY",
|
||||||
copyrightHolder: "Met Office",
|
copyrightHolder: "Met Office",
|
||||||
// tslint:disable-next-line
|
workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68",
|
||||||
workExample: "stationId,latitude,longitude,datetime,temperature,humidity423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68",
|
links: [
|
||||||
|
{
|
||||||
|
sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
inLanguage: "en",
|
||||||
|
categories: ["Economy", "Data Science"],
|
||||||
|
tags: ["weather", "uk", "2011", "temperature", "humidity"],
|
||||||
|
price: 10,
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
|
index: 0,
|
||||||
url: "https://raw.githubusercontent.com/oceanprotocol/squid-js/develop/package.json",
|
url: "https://raw.githubusercontent.com/oceanprotocol/squid-js/develop/package.json",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
index: 1,
|
||||||
url: "https://raw.githubusercontent.com/oceanprotocol/squid-js/develop/README.md",
|
url: "https://raw.githubusercontent.com/oceanprotocol/squid-js/develop/README.md",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
links: [
|
|
||||||
{sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/"},
|
|
||||||
{sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/"},
|
|
||||||
{fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/"},
|
|
||||||
],
|
|
||||||
inLanguage: "en",
|
|
||||||
tags: "weather, uk, 2011, temperature, humidity",
|
|
||||||
price: 10,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ export interface File {
|
|||||||
* File content length.
|
* File content length.
|
||||||
* @type {[type]}
|
* @type {[type]}
|
||||||
*/
|
*/
|
||||||
contentLength?: string
|
contentLength?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resource ID (depending on the source).
|
* Resource ID (depending on the source).
|
||||||
@ -87,12 +87,22 @@ export interface MetaDataBase {
|
|||||||
description?: string
|
description?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date on which the asset was created or was added.
|
* The date on which the asset was created by the originator in
|
||||||
|
* ISO 8601 format, Coordinated Universal Time.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @example "2012-10-10T17:00:000Z"
|
* @example "2019-01-31T08:38:32Z"
|
||||||
*/
|
*/
|
||||||
dateCreated: string
|
dateCreated: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date on which the asset DDO was registered into the metadata store.
|
||||||
|
* This value is created automatically by Aquarius upon registering,
|
||||||
|
* so this value can't be set.
|
||||||
|
* @type {string}
|
||||||
|
* @example "2019-01-31T08:38:32Z"
|
||||||
|
*/
|
||||||
|
datePublished?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the entity generating this data (e.g. Tfl, Disney Corp, etc.).
|
* Name of the entity generating this data (e.g. Tfl, Disney Corp, etc.).
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@ -151,16 +161,22 @@ export interface MetaDataBase {
|
|||||||
inLanguage?: string
|
inLanguage?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keywords or tags used to describe this content. Multiple entries in a keyword
|
* Categories used to describe this content. Empty by default.
|
||||||
* list are typically delimited by commas. Empty by default.
|
* @type {string[]}
|
||||||
* @type {String}
|
* @example ["Economy", "Data Science"]
|
||||||
* @example "weather, uk, 2011, temperature, humidity"
|
|
||||||
*/
|
*/
|
||||||
tags?: string
|
categories?: string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keywords or tags used to describe this content. Empty by default.
|
||||||
|
* @type {string[]}
|
||||||
|
* @example ["weather", "uk", "2011", "temperature", "humidity"]
|
||||||
|
*/
|
||||||
|
tags?: string[]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Price of the asset.
|
* Price of the asset.
|
||||||
* @type {String}
|
* @type {number}
|
||||||
* @example 10
|
* @example 10
|
||||||
*/
|
*/
|
||||||
price: number
|
price: number
|
||||||
@ -201,8 +217,8 @@ export interface Curation {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Schema applied to calculate the rating.
|
* Schema applied to calculate the rating.
|
||||||
* @type {number}
|
* @type {string}
|
||||||
* @example "Binary Votting"
|
* @example "Binary Voting"
|
||||||
*/
|
*/
|
||||||
schema?: string
|
schema?: string
|
||||||
}
|
}
|
||||||
@ -219,7 +235,7 @@ export interface AdditionalInformation {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
* @example "yearly"
|
* @example "yearly"
|
||||||
*/
|
*/
|
||||||
updateFrecuency: string
|
updateFrequency: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A link to machine-readable structured markup (such as ttl/json-ld/rdf)
|
* A link to machine-readable structured markup (such as ttl/json-ld/rdf)
|
||||||
|
@ -77,7 +77,6 @@ describe("DDO", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "Consume",
|
type: "Consume",
|
||||||
// tslint:disable-next-line
|
|
||||||
serviceEndpoint: "http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${pubKey}&serviceId={serviceId}&url={url}",
|
serviceEndpoint: "http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${pubKey}&serviceId={serviceId}&url={url}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -93,49 +92,41 @@ describe("DDO", () => {
|
|||||||
name: "UK Weather information 2011",
|
name: "UK Weather information 2011",
|
||||||
type: "dataset",
|
type: "dataset",
|
||||||
description: "Weather information of UK including temperature and humidity",
|
description: "Weather information of UK including temperature and humidity",
|
||||||
size: "3.1gb",
|
|
||||||
dateCreated: "2012-10-10T17:00:000Z",
|
dateCreated: "2012-10-10T17:00:000Z",
|
||||||
|
datePublished: "2012-10-10T17:00:000Z",
|
||||||
author: "Met Office",
|
author: "Met Office",
|
||||||
license: "CC-BY",
|
license: "CC-BY",
|
||||||
copyrightHolder: "Met Office",
|
copyrightHolder: "Met Office",
|
||||||
encoding: "UTF-8",
|
|
||||||
compression: "zip",
|
|
||||||
contentType: "text/csv",
|
|
||||||
workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68",
|
workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68",
|
||||||
contentUrls: [
|
|
||||||
"https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip",
|
|
||||||
"https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip",
|
|
||||||
],
|
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
// tslint:disable-next-line
|
sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/",
|
||||||
sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// tslint:disable-next-line
|
sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/",
|
||||||
sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/",
|
fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
inLanguage: "en",
|
inLanguage: "en",
|
||||||
tags: "weather, uk, 2011, temperature, humidity",
|
categories: ["Economy", "Data Science"],
|
||||||
|
tags: ["weather", "uk", "2011", "temperature", "humidity"],
|
||||||
price: 10,
|
price: 10,
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
url: "234ab87234acbd09543085340abffh21983ddhiiee982143827423421",
|
index: 0,
|
||||||
checksum: "efb2c764274b745f5fc37f97c6b0e761",
|
checksum: "efb2c764274b745f5fc37f97c6b0e761",
|
||||||
contentLength: "4535431",
|
contentLength: 4535431,
|
||||||
resourceId: "access-log2018-02-13-15-17-29-18386C502CAEA932",
|
resourceId: "access-log2018-02-13-15-17-29-18386C502CAEA932",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "234ab87234acbd6894237582309543085340abffh21983ddhiiee982143827423421",
|
index: 1,
|
||||||
checksum: "085340abffh21495345af97c6b0e761",
|
checksum: "085340abffh21495345af97c6b0e761",
|
||||||
contentLength: "12324",
|
contentLength: 12324,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "80684089027358963495379879a543085340abffh21983ddhiiee982143827abcc2",
|
index: 2,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
checksum: "",
|
checksum: "",
|
||||||
@ -143,7 +134,7 @@ describe("DDO", () => {
|
|||||||
curation: {
|
curation: {
|
||||||
rating: 0.93,
|
rating: 0.93,
|
||||||
numVotes: 123,
|
numVotes: 123,
|
||||||
schema: "Binary Votting",
|
schema: "Binary Voting",
|
||||||
},
|
},
|
||||||
additionalInformation: {
|
additionalInformation: {
|
||||||
updateFrecuency: "yearly",
|
updateFrecuency: "yearly",
|
||||||
|
1
test/testdata/AccessToken.json
vendored
1
test/testdata/AccessToken.json
vendored
@ -1 +0,0 @@
|
|||||||
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzM4NCJ9.eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE1Mzk3ODcxMDEsImV4cCI6NDcyNjk5NjcwNCwiYXVkIjoiIiwic3ViIjoiIiwic2VydmljZV9lbmRwb2ludCI6Imh0dHA6Ly9hZGFzZCIsInJlc291cmNlX2lkIjoiMTIzNDUifQ.2H3TRC3CAToVE9divSckwHi_HNvgOHKrtJPo8128qrKBHTk7YYb0UNfVCuYqwhGR"
|
|
60
test/testdata/MetaData.ts
vendored
60
test/testdata/MetaData.ts
vendored
@ -1,60 +0,0 @@
|
|||||||
import { MetaData } from "../../src/ddo/MetaData"
|
|
||||||
|
|
||||||
export const metadataMock: MetaData = {
|
|
||||||
base: {
|
|
||||||
name: "UK Weather information 2011",
|
|
||||||
type: "dataset",
|
|
||||||
description: "Weather information of UK including temperature and humidity",
|
|
||||||
dateCreated: "2012-10-10T17:00:000Z",
|
|
||||||
author: "Met Office",
|
|
||||||
license: "CC-BY",
|
|
||||||
copyrightHolder: "Met Office",
|
|
||||||
workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68",
|
|
||||||
files: [
|
|
||||||
{
|
|
||||||
url: "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip",
|
|
||||||
checksum: "085340abffh21495345af97c6b0e761",
|
|
||||||
contentLength: "12324",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: "https://testocnfiles.blob.core.windows.net/testfiles/testzkp2.zip",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
links: [
|
|
||||||
{
|
|
||||||
// tslint:disable-next-line
|
|
||||||
sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// tslint:disable-next-line
|
|
||||||
sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
inLanguage: "en",
|
|
||||||
tags: "weather, uk, 2011, temperature, humidity",
|
|
||||||
price: 10,
|
|
||||||
checksum: "",
|
|
||||||
},
|
|
||||||
curation: {
|
|
||||||
rating: 0.93,
|
|
||||||
numVotes: 123,
|
|
||||||
schema: "Binary Votting",
|
|
||||||
},
|
|
||||||
additionalInformation: {
|
|
||||||
updateFrecuency: "yearly",
|
|
||||||
structuredMarkup: [
|
|
||||||
{
|
|
||||||
uri: "http://skos.um.es/unescothes/C01194/jsonld",
|
|
||||||
mediaType: "application/ld+json",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
uri: "http://skos.um.es/unescothes/C01194/turtle",
|
|
||||||
mediaType: "text/turtle",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
checksum: "",
|
|
||||||
},
|
|
||||||
}
|
|
22
test/testdata/ddo.json
vendored
22
test/testdata/ddo.json
vendored
@ -166,18 +166,25 @@
|
|||||||
"name": "UK Weather information 2011",
|
"name": "UK Weather information 2011",
|
||||||
"type": "dataset",
|
"type": "dataset",
|
||||||
"description": "Weather information of UK including temperature and humidity",
|
"description": "Weather information of UK including temperature and humidity",
|
||||||
"size": "3.1gb",
|
|
||||||
"dateCreated": "2012-10-10T17:00:000Z",
|
"dateCreated": "2012-10-10T17:00:000Z",
|
||||||
"author": "Met Office",
|
"author": "Met Office",
|
||||||
"license": "CC-BY",
|
"license": "CC-BY",
|
||||||
"copyrightHolder": "Met Office",
|
"copyrightHolder": "Met Office",
|
||||||
"encoding": "UTF-8",
|
|
||||||
"compression": "zip",
|
|
||||||
"contentType": "text/csv",
|
|
||||||
"workExample": "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68",
|
"workExample": "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68",
|
||||||
"contentUrls": [
|
"contentUrls": [
|
||||||
"https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip"
|
"https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip"
|
||||||
],
|
],
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"url": "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip",
|
||||||
|
"checksum": "085340abffh21495345af97c6b0e761",
|
||||||
|
"contentLength": 12324
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://testocnfiles.blob.core.windows.net/testfiles/testzkp2.zip"
|
||||||
|
}
|
||||||
|
],
|
||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"name": "Sample of Asset Data",
|
"name": "Sample of Asset Data",
|
||||||
@ -191,16 +198,17 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"inLanguage": "en",
|
"inLanguage": "en",
|
||||||
"tags": "weather, uk, 2011, temperature, humidity",
|
"categories": ["Economy", "Data Science"],
|
||||||
|
"tags": ["weather", "uk", "2011", "temperature", "humidity"],
|
||||||
"price": 10
|
"price": 10
|
||||||
},
|
},
|
||||||
"curation": {
|
"curation": {
|
||||||
"rating": 0.93,
|
"rating": 0.93,
|
||||||
"numVotes": 123,
|
"numVotes": 123,
|
||||||
"schema": "Binary Votting"
|
"schema": "Binary Voting"
|
||||||
},
|
},
|
||||||
"additionalInformation": {
|
"additionalInformation": {
|
||||||
"updateFrecuency": "yearly",
|
"updateFrequency": "yearly",
|
||||||
"structuredMarkup": [
|
"structuredMarkup": [
|
||||||
{
|
{
|
||||||
"uri": "http://skos.um.es/unescothes/C01194/jsonld",
|
"uri": "http://skos.um.es/unescothes/C01194/jsonld",
|
||||||
|
Loading…
Reference in New Issue
Block a user