2022-11-23 15:35:34 -08:00
|
|
|
import {WorkflowContext} from "../context/workflow-context";
|
2022-11-23 10:54:15 -08:00
|
|
|
|
2022-11-08 17:00:59 -08:00
|
|
|
export interface Value {
|
2023-01-05 17:35:05 -08:00
|
|
|
/** Label of this value */
|
2022-11-08 17:00:59 -08:00
|
|
|
label: string;
|
2023-01-05 17:35:05 -08:00
|
|
|
|
2023-01-23 16:02:13 -05:00
|
|
|
/** Optional description to show when auto-completing */
|
2022-11-08 17:00:59 -08:00
|
|
|
description?: string;
|
2023-01-05 17:35:05 -08:00
|
|
|
|
|
|
|
|
/** Whether this value is deprecated */
|
2022-12-14 13:07:26 -05:00
|
|
|
deprecated?: boolean;
|
2023-01-05 17:35:05 -08:00
|
|
|
|
|
|
|
|
/** Alternative insert text, if not given `label` will be used */
|
2023-01-05 17:26:08 -08:00
|
|
|
insertText?: string;
|
2022-11-08 17:00:59 -08:00
|
|
|
}
|
|
|
|
|
|
2022-11-28 16:15:57 -08:00
|
|
|
export enum ValueProviderKind {
|
|
|
|
|
AllowedValues,
|
|
|
|
|
SuggestedValues
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type ValueProvider = {
|
|
|
|
|
kind: ValueProviderKind;
|
|
|
|
|
get: (context: WorkflowContext) => Promise<Value[]>;
|
|
|
|
|
};
|
2022-11-08 17:00:59 -08:00
|
|
|
|
|
|
|
|
export interface ValueProviderConfig {
|
2022-11-28 15:47:05 -08:00
|
|
|
[definitionKey: string]: ValueProvider;
|
2022-11-08 17:00:59 -08:00
|
|
|
}
|