Files
privacy.sexy/src/application/collections/collection.yaml.d.ts
undergroundwires dc03bff324 Add schema validation for collection files #369
This commit improves collection file editing and error detection
directly in the IDE. It adds YAML schema, IDE configuration and
automatic tests to validate it.

- Introduce a YAML schema for collection file.
- Use `yaml-language-server` for enhanced YAML support in VSCode.
- Add telemetry disabling in `configure_vscode.py` to respect user
  privacy.
- Add automated checks to validate YAML file structure against the
  schema.
- Remove unused properties and do not allow them in compiler.
2024-06-17 14:01:07 +02:00

83 lines
2.2 KiB
TypeScript

declare module '@/application/collections/*' {
export interface ExecutableDefinition extends DocumentableData {
}
export interface CollectionData {
readonly os: string;
readonly scripting: ScriptingDefinitionData;
readonly actions: ReadonlyArray<CategoryData>;
readonly functions?: ReadonlyArray<FunctionData>;
}
export interface CategoryData extends ExecutableDefinition {
readonly children: ReadonlyArray<ExecutableData>;
readonly category: string;
}
export type ExecutableData = CategoryData | ScriptData;
export type DocumentationData = ReadonlyArray<string> | string;
export interface DocumentableData {
readonly docs?: DocumentationData;
}
export interface CodeInstruction {
readonly code: string;
readonly revertCode?: string;
}
export interface CallInstruction {
readonly call: FunctionCallsData;
}
export type InstructionHolder = CodeInstruction | CallInstruction;
export interface ParameterDefinitionData {
readonly name: string;
readonly optional?: boolean;
}
export type FunctionDefinition = {
readonly name: string;
readonly parameters?: readonly ParameterDefinitionData[];
};
export type CodeFunctionData = FunctionDefinition & CodeInstruction;
export type CallFunctionData = FunctionDefinition & CallInstruction;
export type FunctionData = CodeFunctionData | CallFunctionData;
export interface FunctionCallParametersData {
readonly [index: string]: string;
}
export interface FunctionCallData {
readonly function: string;
readonly parameters?: FunctionCallParametersData;
}
export type FunctionCallsData = readonly FunctionCallData[] | FunctionCallData | undefined;
export type ScriptDefinition = ExecutableDefinition & {
readonly name: string;
readonly recommend?: string;
};
export type CodeScriptData = ScriptDefinition & CodeInstruction;
export type CallScriptData = ScriptDefinition & CallInstruction;
export type ScriptData = CodeScriptData | CallScriptData;
export interface ScriptingDefinitionData {
readonly language: string;
readonly startCode: string;
readonly endCode: string;
}
const content: CollectionData;
export default content;
}