@@ -36,9 +36,10 @@ export type ActionContext<TInput extends JsonObject> = {
|
||||
export const createTemplateAction: <
|
||||
TParams,
|
||||
TInputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {},
|
||||
TOutputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {},
|
||||
>(
|
||||
templateAction: TemplateAction<TParams, TInputSchema>,
|
||||
) => TemplateAction<TParams, TInputSchema>;
|
||||
templateAction: TemplateAction<TParams, TInputSchema, TOutputSchema>,
|
||||
) => TemplateAction<TParams, TInputSchema, TOutputSchema>;
|
||||
|
||||
// @alpha
|
||||
export interface ScaffolderActionsExtensionPoint {
|
||||
@@ -56,8 +57,9 @@ export type TaskSecrets = Record<string, string> & {
|
||||
|
||||
// @public (undocumented)
|
||||
export type TemplateAction<
|
||||
TParams,
|
||||
TParams = {},
|
||||
TInputSchema extends Schema | z.ZodType = {},
|
||||
TOutputSchema extends Schema | z.ZodType = {},
|
||||
> = {
|
||||
id: string;
|
||||
description?: string;
|
||||
@@ -68,7 +70,7 @@ export type TemplateAction<
|
||||
supportsDryRun?: boolean;
|
||||
schema?: {
|
||||
input?: TInputSchema;
|
||||
output?: Schema;
|
||||
output?: TOutputSchema;
|
||||
};
|
||||
handler: (
|
||||
ctx: ActionContext<
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
import { TemplateAction } from './types';
|
||||
import { z } from 'zod';
|
||||
import { Schema } from 'jsonschema';
|
||||
|
||||
/**
|
||||
* This function is used to create new template actions to get type safety.
|
||||
*
|
||||
@@ -26,9 +25,9 @@ import { Schema } from 'jsonschema';
|
||||
export const createTemplateAction = <
|
||||
TParams,
|
||||
TInputSchema extends Schema | z.ZodType = {},
|
||||
TOutputSchema extends Schema | z.ZodType = {},
|
||||
>(
|
||||
templateAction: TemplateAction<TParams, TInputSchema>,
|
||||
): TemplateAction<TParams, TInputSchema> => {
|
||||
// TODO(blam): Can add some more validation here to validate the action later on
|
||||
templateAction: TemplateAction<TParams, TInputSchema, TOutputSchema>,
|
||||
): TemplateAction<TParams, TInputSchema, TOutputSchema> => {
|
||||
return templateAction;
|
||||
};
|
||||
|
||||
@@ -64,8 +64,9 @@ export type ActionContext<TInput extends JsonObject> = {
|
||||
|
||||
/** @public */
|
||||
export type TemplateAction<
|
||||
TParams,
|
||||
TParams = {},
|
||||
TInputSchema extends Schema | z.ZodType = {},
|
||||
TOutputSchema extends Schema | z.ZodType = {},
|
||||
> = {
|
||||
id: string;
|
||||
description?: string;
|
||||
@@ -73,7 +74,7 @@ export type TemplateAction<
|
||||
supportsDryRun?: boolean;
|
||||
schema?: {
|
||||
input?: TInputSchema;
|
||||
output?: Schema;
|
||||
output?: TOutputSchema;
|
||||
};
|
||||
handler: (
|
||||
ctx: ActionContext<
|
||||
|
||||
Reference in New Issue
Block a user