<img width="378" alt="Capture d’écran 2025-01-07 à 15 37 20" src="https://github.com/user-attachments/assets/c15abcac-684a-4c3b-ad12-62cf91afe927" /> Here is a first version: - simple fields have a suggested value - composite do not, but sub values of composite do - json, arrays or complex values do not
30 lines
797 B
TypeScript
30 lines
797 B
TypeScript
import { createFamilyState } from '@/ui/utilities/state/utils/createFamilyState';
|
|
import { ServerlessFunctionExecutionStatus } from '~/generated-metadata/graphql';
|
|
|
|
export type ServerlessFunctionTestData = {
|
|
input: { [field: string]: any };
|
|
output: {
|
|
data?: string;
|
|
duration?: number;
|
|
status?: ServerlessFunctionExecutionStatus;
|
|
error?: string;
|
|
};
|
|
language: 'plaintext' | 'json';
|
|
height: number;
|
|
};
|
|
|
|
export const DEFAULT_OUTPUT_VALUE = 'Enter an input above then press "Test"';
|
|
|
|
export const serverlessFunctionTestDataFamilyState = createFamilyState<
|
|
ServerlessFunctionTestData,
|
|
string
|
|
>({
|
|
key: 'serverlessFunctionTestDataFamilyState',
|
|
defaultValue: {
|
|
language: 'plaintext',
|
|
height: 64,
|
|
input: {},
|
|
output: { data: DEFAULT_OUTPUT_VALUE },
|
|
},
|
|
});
|