1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

Add consumer parameter types (#1730)

* feat: add ConsumerParameter type

* feat: add export for ConsumerParameter type

* fix: ConsumerParameter.required type

---------

Co-authored-by: Luca Milanese <luca.milanese90@gmail.com>
This commit is contained in:
Moritz Kirstein 2023-05-12 10:24:05 +02:00 committed by GitHub
parent 59568d292e
commit e3dfa2997a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,43 @@
export interface ConsumerParameter {
/**
* Parameter name.
* @type {string}
*/
name: string
/**
* Field type.
* @type {'text' | 'number' | 'boolean' | 'select'}
*/
type: 'text' | 'number' | 'boolean' | 'select'
/**
* Displayed field label.
* @type {string}
*/
label: string
/**
* Defines if customer input for this field is mandatory.
* @type {boolean}
*/
required: boolean
/**
* Field description.
* @type {string}
*/
description: string
/**
* Field default value. For select types, string key of default option.
* @type {string}
*/
default: string
/**
* For select types, a list of options.
* @type {string}
*/
options?: string
}

View File

@ -1,3 +1,5 @@
import { ConsumerParameter } from './ConsumerParameter'
export interface MetadataAlgorithm {
/**
* Language used to implement the software.
@ -46,6 +48,12 @@ export interface MetadataAlgorithm {
*/
checksum: string
}
/**
* Array of objects describing the consumer parameters
* @type {ConsumerParameter[]}
*/
consumerParameters?: ConsumerParameter[]
}
export interface Metadata {

View File

@ -1,3 +1,5 @@
import { ConsumerParameter } from './ConsumerParameter'
export interface PublisherTrustedAlgorithm {
/**
* The DID of the algorithm which is trusted by the publisher.
@ -102,6 +104,12 @@ export interface Service {
*/
compute?: ServiceComputeOptions
/**
* Array of objects describing the consumer parameters
* @type {ConsumerParameter[]}
*/
consumerParameters?: ConsumerParameter[]
/**
* Stores service specific additional information, this is customizable by publisher
* @type {any}

View File

@ -2,6 +2,7 @@ export * from './DDO/Credentials'
export * from './DDO/DDO'
export * from './DDO/Event'
export * from './DDO/Metadata'
export * from './DDO/ConsumerParameter'
export * from './DDO/Service'
export * from './Asset'
export * from './File'