mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
initial commit for the DDO typings
This commit is contained in:
parent
5938939847
commit
f1962f7103
9
src/ddo/Credentials.ts
Normal file
9
src/ddo/Credentials.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export interface Credential {
|
||||
type: string
|
||||
values: string[]
|
||||
}
|
||||
|
||||
export interface Credentials {
|
||||
allow: Credential[]
|
||||
deny: Credential[]
|
||||
}
|
54
src/ddo/DDO.ts
Normal file
54
src/ddo/DDO.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import { Service } from './Service'
|
||||
import { Metadata } from './Metadata'
|
||||
import { Credentials } from './Credentials'
|
||||
|
||||
/**
|
||||
* DID Descriptor Object.
|
||||
* Contains metadata about the asset, and define access in at least one service.
|
||||
*/
|
||||
export class DDO {
|
||||
/**
|
||||
* Contexts used for validation..
|
||||
* @type {string[]}
|
||||
*/
|
||||
public '@context': string[]
|
||||
|
||||
/**
|
||||
* DID, descentralized ID.
|
||||
* Computed as sha256(address of ERC721 contract + chainId)
|
||||
* @type {string}
|
||||
*/
|
||||
public id: string
|
||||
|
||||
/**
|
||||
* Version information in SemVer notation
|
||||
* referring to the DDO spec version
|
||||
* @type {string}
|
||||
*/
|
||||
public version: string
|
||||
|
||||
/**
|
||||
* ChainId of the network the DDO was published to.
|
||||
* @type {number}
|
||||
*/
|
||||
public chainId: number
|
||||
|
||||
/**
|
||||
* Stores an object describing the asset.
|
||||
* @type {Metadata}
|
||||
*/
|
||||
public metadata: Metadata
|
||||
|
||||
/**
|
||||
* Stores an array of services defining access to the asset.
|
||||
* @type {Service[]}
|
||||
*/
|
||||
public services: Service[]
|
||||
|
||||
/**
|
||||
* Describes the credentials needed to access a dataset
|
||||
* in addition to the services definition.
|
||||
* @type {Credentials}
|
||||
*/
|
||||
public credentials?: Credentials
|
||||
}
|
26
src/ddo/Metadata.ts
Normal file
26
src/ddo/Metadata.ts
Normal file
@ -0,0 +1,26 @@
|
||||
export interface MetadataAlgorithm {
|
||||
language?: string
|
||||
version?: string
|
||||
container: {
|
||||
entrypoint: string
|
||||
image: string
|
||||
tag: string
|
||||
checksum: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface Metadata {
|
||||
created: string
|
||||
updated: string
|
||||
name: string
|
||||
description: string
|
||||
type: 'dataset' | 'algorithm'
|
||||
author: string
|
||||
license: string
|
||||
links?: string[]
|
||||
tags?: string[]
|
||||
copyrightHolder?: string
|
||||
contentLanguage?: string
|
||||
algorithm?: MetadataAlgorithm
|
||||
additionalInformation?: any
|
||||
}
|
29
src/ddo/Service.ts
Normal file
29
src/ddo/Service.ts
Normal file
@ -0,0 +1,29 @@
|
||||
export interface PublisherTrustedAlgorithm {
|
||||
did: string
|
||||
filesChecksum: string
|
||||
containerSectionChecksum: string
|
||||
}
|
||||
|
||||
export interface ServiceComputeOptions {
|
||||
namespace: string
|
||||
cpu?: number
|
||||
gpu?: number
|
||||
gpuType?: string
|
||||
memory?: string
|
||||
volumeSize?: string
|
||||
allowRawAlgorithm: boolean
|
||||
allowNetworkAccess: boolean
|
||||
publisherTrustedAlgorithmPublishers: string[]
|
||||
publisherTrustedAlgorithms: PublisherTrustedAlgorithm[]
|
||||
}
|
||||
|
||||
export interface Service {
|
||||
type: 'access' | 'compute' | string
|
||||
files: string
|
||||
datatokenAddress: string
|
||||
serviceEndpoint: string
|
||||
timeout: string
|
||||
name?: string
|
||||
description?: string
|
||||
compute?: ServiceComputeOptions
|
||||
}
|
1
src/ddo/index.ts
Normal file
1
src/ddo/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './DDO'
|
Loading…
x
Reference in New Issue
Block a user