add api to retrieve template extensions info from scaffolder-backend

Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
This commit is contained in:
Matt Benson
2025-02-07 19:25:05 -06:00
parent 7bc740adeb
commit 5890016e8a
5 changed files with 136 additions and 8 deletions
+69 -3
View File
@@ -45,15 +45,24 @@ export type ScaffolderTask = {
};
/**
* A single action example
* A single scaffolder usage example
*
* @public
*/
export type ActionExample = {
description: string;
export type ScaffolderUsageExample = {
description?: string;
example: string;
notes?: string;
};
/**
* A single action example
*
* @public
* @deprecated in favor of ScaffolderUsageExample
*/
export type ActionExample = ScaffolderUsageExample;
/**
* The response shape for a single action in the `listActions` call to the `scaffolder-backend`
*
@@ -76,6 +85,58 @@ export type Action = {
*/
export type ListActionsResponse = Array<Action>;
/**
* The response shape for a single filter in the `listTemplateExtensions` call to the `scaffolder-backend`
*
* @public
*/
export type TemplateFilter = {
description?: string;
schema?: {
input?: JSONSchema7;
arguments?: JSONSchema7[];
output?: JSONSchema7;
};
examples?: ScaffolderUsageExample[];
};
/**
* The response shape for a single global function in the `listTemplateExtensions` call to the `scaffolder-backend`
*
* @public
*/
export type TemplateGlobalFunction = {
description?: string;
schema?: {
arguments?: JSONSchema7[];
output?: JSONSchema7;
};
examples?: ScaffolderUsageExample[];
};
/**
* The response shape for a single global value in the `listTemplateExtensions` call to the `scaffolder-backend`
*
* @public
*/
export type TemplateGlobalValue = {
description?: string;
value: JsonValue;
};
/**
* The response shape for the `listTemplateExtensions` call to the `scaffolder-backend`
*
* @public
*/
export type ListTemplateExtensionsResponse = {
filters: Record<string, TemplateFilter>;
globals: {
functions: Record<string, TemplateGlobalFunction>;
values: Record<string, TemplateGlobalValue>;
};
};
/** @public */
export type ScaffolderOutputLink = {
title?: string;
@@ -236,6 +297,11 @@ export interface ScaffolderApi {
*/
listActions(): Promise<ListActionsResponse>;
/**
* Returns a structure describing the available templating extensions.
*/
listTemplateExtensions?(): Promise<ListTemplateExtensionsResponse>;
streamLogs(options: ScaffolderStreamLogsOptions): Observable<LogEvent>;
dryRun?(options: ScaffolderDryRunOptions): Promise<ScaffolderDryRunResponse>;