chore: really fix up the api-reports and make them clean and tidy
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -21,7 +21,7 @@ import zodToJsonSchema from 'zod-to-json-schema';
|
||||
|
||||
/** @public */
|
||||
export type TemplateActionOptions<
|
||||
TParams = {},
|
||||
TActionInput = {},
|
||||
TInputSchema extends Schema | z.ZodType = {},
|
||||
TOutputSchema extends Schema | z.ZodType = {},
|
||||
> = {
|
||||
@@ -33,13 +33,7 @@ export type TemplateActionOptions<
|
||||
input?: TInputSchema;
|
||||
output?: TOutputSchema;
|
||||
};
|
||||
handler: (
|
||||
ctx: ActionContext<
|
||||
TInputSchema extends z.ZodType<any, any, infer IReturn>
|
||||
? IReturn
|
||||
: TParams
|
||||
>,
|
||||
) => Promise<void>;
|
||||
handler: (ctx: ActionContext<TActionInput>) => Promise<void>;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -51,9 +45,12 @@ export const createTemplateAction = <
|
||||
TParams,
|
||||
TInputSchema extends Schema | z.ZodType = {},
|
||||
TOutputSchema extends Schema | z.ZodType = {},
|
||||
TActionInput = TInputSchema extends z.ZodType<any, any, infer IReturn>
|
||||
? IReturn
|
||||
: TParams,
|
||||
>(
|
||||
action: TemplateActionOptions<TParams, TInputSchema, TOutputSchema>,
|
||||
): TemplateAction<TParams> => {
|
||||
action: TemplateActionOptions<TActionInput, TInputSchema, TOutputSchema>,
|
||||
): TemplateAction<TActionInput> => {
|
||||
const inputSchema =
|
||||
action.schema?.input && 'safeParseAsync' in action.schema.input
|
||||
? zodToJsonSchema(action.schema.input)
|
||||
@@ -73,5 +70,5 @@ export const createTemplateAction = <
|
||||
},
|
||||
};
|
||||
|
||||
return templateAction as TemplateAction<TParams>;
|
||||
return templateAction;
|
||||
};
|
||||
|
||||
@@ -25,12 +25,12 @@ import { Schema } from 'jsonschema';
|
||||
* ActionContext is passed into scaffolder actions.
|
||||
* @public
|
||||
*/
|
||||
export type ActionContext<TInput = unknown> = {
|
||||
export type ActionContext<TActionInput = unknown> = {
|
||||
logger: Logger;
|
||||
logStream: Writable;
|
||||
secrets?: TaskSecrets;
|
||||
workspacePath: string;
|
||||
input: TInput;
|
||||
input: TActionInput;
|
||||
output(name: string, value: JsonValue): void;
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ export type ActionContext<TInput = unknown> = {
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type TemplateAction<TParams = unknown> = {
|
||||
export type TemplateAction<TActionInput = unknown> = {
|
||||
id: string;
|
||||
description?: string;
|
||||
examples?: { description: string; example: string }[];
|
||||
@@ -71,5 +71,5 @@ export type TemplateAction<TParams = unknown> = {
|
||||
input?: Schema;
|
||||
output?: Schema;
|
||||
};
|
||||
handler: (ctx: ActionContext<TParams>) => Promise<void>;
|
||||
handler: (ctx: ActionContext<TActionInput>) => Promise<void>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user