UNPKG

1.05 kBTypeScriptView Raw
1import * as React from 'react';
2
3import Types from '../types';
4import { IComponent } from "../types/component";
5import { IInfrastructure } from "../types";
6
7export const ENVVALUE_INSTANCE_TYPE = "EnvValueComponent";
8
9
10export interface IEnvValueArgs {
11 /**
12 * The name of the value
13 */
14 name: string,
15
16 /**
17 * the value
18 */
19 value: any
20}
21
22export interface IEnvValueProps {
23
24}
25
26
27/**
28 * identifies a component as a EnvValue: it implements all the required fields
29 *
30 * @param component to be tested
31 */
32export function isEnvValue(component) {
33 return component !== undefined &&
34 component.instanceType === ENVVALUE_INSTANCE_TYPE
35}
36
37
38
39export default (props: IEnvValueArgs | any) => {
40
41 const componentProps: IInfrastructure & IComponent = {
42 infrastructureType: Types.INFRASTRUCTURE_TYPE_COMPONENT,
43 instanceType: ENVVALUE_INSTANCE_TYPE,
44 instanceId: props.name
45 };
46
47 const environmentProps: IEnvValueProps = {
48
49 }
50
51 return Object.assign(props, componentProps, environmentProps);
52
53
54};
\No newline at end of file