diff --git a/src/if-run/builtins/sci-embodied/index.ts b/src/if-run/builtins/sci-embodied/index.ts index e8b69cd2b..b304d4ae1 100644 --- a/src/if-run/builtins/sci-embodied/index.ts +++ b/src/if-run/builtins/sci-embodied/index.ts @@ -1,6 +1,7 @@ import {z} from 'zod'; import { ExecutePlugin, + ParameterMetadata, PluginParametersMetadata, PluginParams, } from '@grnsft/if-core/types'; @@ -16,37 +17,41 @@ export const SciEmbodied = ( ): ExecutePlugin => { const metadata = { kind: 'execute', - inputs: parametersMetadata?.inputs || { - 'device/emissions-embodied': { - description: 'total embodied emissions of some component', - unit: 'gCO2e', - 'aggregation-method': 'sum', - }, - 'device/expected-lifespan': { - description: 'Total Expected Lifespan of the Component in Seconds', - unit: 'seconds', - 'aggregation-method': 'sum', - }, - 'resources-reserved': { - description: 'resources reserved for an application', - unit: 'count', - 'aggregation-method': 'none', - }, - 'resources-total': { - description: 'total resources available', - unit: 'count', - 'aggregation-method': 'none', - }, - 'vcpus-allocated': { - description: 'number of vcpus allocated to particular resource', - unit: 'count', - 'aggregation-method': 'none', - }, - 'vcpus-total': { - description: 'total number of vcpus available on a particular resource', - unit: 'count', - 'aggregation-method': 'none', - }, + inputs: { + ...({ + 'device/emissions-embodied': { + description: 'total embodied emissions of some component', + unit: 'gCO2e', + 'aggregation-method': 'sum', + }, + 'device/expected-lifespan': { + description: 'Total Expected Lifespan of the Component in Seconds', + unit: 'seconds', + 'aggregation-method': 'sum', + }, + 'resources-reserved': { + description: 'resources reserved for an application', + unit: 'count', + 'aggregation-method': 'none', + }, + 'resources-total': { + description: 'total resources available', + unit: 'count', + 'aggregation-method': 'none', + }, + 'vcpus-allocated': { + description: 'number of vcpus allocated to particular resource', + unit: 'count', + 'aggregation-method': 'none', + }, + 'vcpus-total': { + description: + 'total number of vcpus available on a particular resource', + unit: 'count', + 'aggregation-method': 'none', + }, + } as ParameterMetadata), + ...parametersMetadata?.inputs, }, outputs: parametersMetadata?.outputs || { 'carbon-embodied': { diff --git a/src/if-run/builtins/sci/index.ts b/src/if-run/builtins/sci/index.ts index 70608fe84..1106f3725 100644 --- a/src/if-run/builtins/sci/index.ts +++ b/src/if-run/builtins/sci/index.ts @@ -5,6 +5,7 @@ import { PluginParams, ConfigParams, PluginParametersMetadata, + ParameterMetadata, } from '@grnsft/if-core/types'; import {validate, allDefined} from '../../../common/util/validations'; @@ -25,18 +26,21 @@ export const Sci = ( ): ExecutePlugin => { const metadata = { kind: 'execute', - inputs: parametersMetadata?.inputs || { - carbon: { - description: 'an amount of carbon emitted into the atmosphere', - unit: 'gCO2e', - 'aggregation-method': 'sum', - }, - 'functional-unit': { - description: - 'the name of the functional unit in which the final SCI value should be expressed, e.g. requests, users', - unit: 'none', - 'aggregation-method': 'sum', - }, + inputs: { + ...({ + carbon: { + description: 'an amount of carbon emitted into the atmosphere', + unit: 'gCO2e', + 'aggregation-method': 'sum', + }, + 'functional-unit': { + description: + 'the name of the functional unit in which the final SCI value should be expressed, e.g. requests, users', + unit: 'none', + 'aggregation-method': 'sum', + }, + } as ParameterMetadata), + ...parametersMetadata?.inputs, }, outputs: parametersMetadata?.outputs || { sci: { diff --git a/src/if-run/builtins/time-sync.ts b/src/if-run/builtins/time-sync.ts index e9f4ee1bc..6619c2ff0 100644 --- a/src/if-run/builtins/time-sync.ts +++ b/src/if-run/builtins/time-sync.ts @@ -10,6 +10,7 @@ import { TimeNormalizerConfig, TimeParams, PluginParametersMetadata, + ParameterMetadata, } from '@grnsft/if-core/types'; import {validate} from '../../common/util/validations'; @@ -57,17 +58,20 @@ export const TimeSync = ( ): ExecutePlugin => { const metadata = { kind: 'execute', - inputs: parametersMetadata?.inputs || { - timestamp: { - description: 'refers to the time of occurrence of the input', - unit: 'RFC3339', - 'aggregation-method': 'none', - }, - duration: { - description: 'refers to the duration of the input', - unit: 'seconds', - 'aggregation-method': 'sum', - }, + inputs: { + ...({ + timestamp: { + description: 'refers to the time of occurrence of the input', + unit: 'RFC3339', + 'aggregation-method': 'none', + }, + duration: { + description: 'refers to the duration of the input', + unit: 'seconds', + 'aggregation-method': 'sum', + }, + } as ParameterMetadata), + ...parametersMetadata?.inputs, }, outputs: parametersMetadata?.outputs, };