1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00
squid-js/src/ddo/MetaData.ts

224 lines
5.8 KiB
TypeScript
Raw Normal View History

2019-02-04 16:26:56 +01:00
export interface File {
url: string
checksum?: string
checksumType?: string
contentLength?: string
resourceId?: string
}
/**
* Base attributes of Assets Metadata.
* @see https://github.com/oceanprotocol/OEPs/tree/master/8#base-attributes
*/
export class MetaDataBase {
/**
* Descriptive name of the Asset.
* @type {string}
* @example "UK Weather information 2011"
*/
2019-02-04 18:13:54 +01:00
public name: string
/**
* Type of the Asset. Helps to filter by the type of asset,
* initially ("dataset", "algorithm", "container", "workflow", "other").
* @type {string}
* @example "dataset"
*/
2019-02-04 18:13:54 +01:00
public type: "dataset" | "algorithm" | "container" | "workflow" | "other"
/**
* Details of what the resource is. For a dataset, this attribute
* explains what the data represents and what it can be used for.
* @type {string}
* @example "Weather information of UK including temperature and humidity"
*/
2019-02-04 18:13:54 +01:00
public description?: string
/**
* The date on which the asset was created or was added.
* @type {string}
* @example "2012-10-10T17:00:000Z"
*/
2019-02-04 18:13:54 +01:00
public dateCreated: string
/**
* Size of the asset (e.g. 18MB). In the absence of a unit (MB, kB etc.), kB will be assumed.
* @type {string}
* @example "3.1gb"
*/
2019-02-04 18:13:54 +01:00
public size: string
/**
* Name of the entity generating this data (e.g. Tfl, Disney Corp, etc.).
* @type {string}
* @example "Met Office"
*/
2019-02-04 18:13:54 +01:00
public author: string
/**
* Short name referencing the license of the asset (e.g. Public Domain, CC-0, CC-BY, No License Specified, etc. ).
* If it's not specified, the following value will be added: "No License Specified".
* @type {string}
* @example "CC-BY"
*/
2019-02-04 18:13:54 +01:00
public license: string
/**
* The party holding the legal copyright. Empty by default.
* @type {string}
* @example "Met Office"
*/
2019-02-04 18:13:54 +01:00
public copyrightHolder?: string
/**
* File encoding.
* @type {string}
* @example "UTF-8"
*/
2019-02-04 18:13:54 +01:00
public encoding?: string
/**
* File compression (e.g. no, gzip, bzip2, etc).
* @type {string}
* @example "zip"
*/
2019-02-04 18:13:54 +01:00
public compression?: string
/**
* File format, if applicable.
* @type {string}
* @example "text/csv"
*/
2019-02-04 18:13:54 +01:00
public contentType: string
/**
* Example of the concept of this asset. This example is part
* of the metadata, not an external link.
* @type {string}
* @example "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68"
*/
2019-02-04 18:13:54 +01:00
public workExample?: string
/**
* Mapping of links for data samples, or links to find out more information.
* Links may be to either a URL or another Asset. We expect marketplaces to
* converge on agreements of typical formats for linked data: The Ocean Protocol
* itself does not mandate any specific formats as these requirements are likely
* to be domain-specific.
* @type {any[]}
* @example
* [
* {
* anotherSample: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/",
* },
* {
* fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/",
* },
* ]
*/
2019-02-04 18:13:54 +01:00
public links?: Array<{[name: string]: string}>
/**
* The language of the content. Please use one of the language
* codes from the {@link https://tools.ietf.org/html/bcp47 IETF BCP 47 standard}.
* @type {String}
* @example "en"
*/
2019-02-04 18:13:54 +01:00
public inLanguage?: string
/**
* Keywords or tags used to describe this content. Multiple entries in a keyword
* list are typically delimited by commas. Empty by default.
* @type {String}
* @example "weather, uk, 2011, temperature, humidity"
*/
2019-02-04 18:13:54 +01:00
public tags?: string
/**
* Price of the asset.
* @type {String}
* @example 10
*/
2019-02-04 18:13:54 +01:00
public price: number
2019-02-04 16:26:56 +01:00
/**
* Array of File objects including the encrypted file urls and some additional information.
* @type {File[]}
*/
2019-02-04 18:13:54 +01:00
public files: File[]
2019-02-04 16:26:56 +01:00
/**
* SHA3 hash of concatenated values: [list of all file checksums] + name + author + license + did
* @type {string}
*/
public checksum?: string
2019-02-04 18:13:54 +01:00
public encryptedFiles?: any
}
/**
* Curation attributes of Assets Metadata.
* @see https://github.com/oceanprotocol/OEPs/tree/master/8#curation-attributes
*/
export interface Curation {
/**
* Decimal value between 0 and 1. 0 is the default value.
* @type {number}
* @example 0.93
*/
rating: number
/**
* Number of votes. 0 is the default value.
* @type {number}
* @example 123
*/
numVotes: number
/**
* Schema applied to calculate the rating.
* @type {number}
* @example "Binary Votting"
*/
schema?: string
}
/**
* Additional Information of Assets Metadata.
* @see https://github.com/oceanprotocol/OEPs/tree/master/8#additional-information
*/
export interface AdditionalInformation {
/**
* An indication of update latency - i.e. How often are updates expected (seldom,
* annually, quarterly, etc.), or is the resource static that is never expected
* to get updated.
* @type {string}
* @example "yearly"
*/
updateFrecuency: string
/**
* A link to machine-readable structured markup (such as ttl/json-ld/rdf)
* describing the dataset.
* @type {StructuredMarkup[]}
*/
2019-02-04 18:13:54 +01:00
structuredMarkup: Array<{
uri: string
2019-02-04 18:13:54 +01:00
mediaType: string,
}>
/**
* Checksum of attributes to be able to compare if there are changes in
* the asset that you are purchasing.
* @type {string}
*/
checksum: string
}
export interface MetaData {
additionalInformation: AdditionalInformation
base: MetaDataBase
curation: Curation
2018-11-01 11:04:59 +01:00
}