@@ -79,11 +79,6 @@ export type Observer<T> = {
|
||||
complete?(): void;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type Prettify<T extends Record<PropertyKey, unknown>> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
|
||||
// @public
|
||||
export type Subscription = {
|
||||
unsubscribe(): void;
|
||||
|
||||
@@ -55,6 +55,8 @@ describe('createTemplateAction', () => {
|
||||
ctx.output('test2', 'value');
|
||||
},
|
||||
});
|
||||
|
||||
expect(action).toBeDefined();
|
||||
});
|
||||
|
||||
it('should allow creating with zod and use the old deprecated types', () => {
|
||||
@@ -87,6 +89,8 @@ describe('createTemplateAction', () => {
|
||||
ctx.output('test2', 'value');
|
||||
},
|
||||
});
|
||||
|
||||
expect(action).toBeDefined();
|
||||
});
|
||||
|
||||
it('should allow creating with new first class zod support', () => {
|
||||
@@ -121,5 +125,7 @@ describe('createTemplateAction', () => {
|
||||
ctx.output('test2', 'value');
|
||||
},
|
||||
});
|
||||
|
||||
expect(action).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -92,6 +92,7 @@ export function createTemplateAction<
|
||||
TInputSchema
|
||||
>;
|
||||
/**
|
||||
* @public
|
||||
* @deprecated migrate to using the new built in zod schema definitions for schemas
|
||||
*/
|
||||
export function createTemplateAction<
|
||||
@@ -110,6 +111,7 @@ export function createTemplateAction<
|
||||
>,
|
||||
): TemplateAction<TActionInput, TActionOutput, TInputSchema>;
|
||||
/**
|
||||
* @public
|
||||
* @deprecated migrate to using the new built in zod schema definitions for schemas
|
||||
*/
|
||||
export function createTemplateAction<
|
||||
@@ -167,7 +169,7 @@ export function createTemplateAction<
|
||||
TInputSchema,
|
||||
TOutputSchema
|
||||
>,
|
||||
): TemplateAction<TActionInput, TActionOutput, TInputSchema> {
|
||||
): TemplateAction<TActionInput, TActionOutput, TInputSchema, TOutputSchema> {
|
||||
const { inputSchema, outputSchema } = parseSchemas(action);
|
||||
|
||||
return {
|
||||
|
||||
@@ -35,7 +35,12 @@ export type ActionContext<
|
||||
TActionOutput extends JsonObject = JsonObject,
|
||||
TInputSchema extends
|
||||
| { [key in string]: (zImpl: typeof z) => z.ZodType }
|
||||
| Schema = Schema,
|
||||
| Schema
|
||||
| unknown = unknown,
|
||||
_TOutputSchema extends
|
||||
| { [key in string]: (zImpl: typeof z) => z.ZodType }
|
||||
| Schema
|
||||
| unknown = unknown,
|
||||
> = TInputSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType }
|
||||
? {
|
||||
logger: LoggerService;
|
||||
@@ -173,7 +178,12 @@ export type TemplateAction<
|
||||
TActionOutput extends JsonObject = JsonObject,
|
||||
TInputSchema extends
|
||||
| { [key in string]: (zImpl: typeof z) => z.ZodType }
|
||||
| Schema = Schema,
|
||||
| Schema
|
||||
| unknown = unknown,
|
||||
TOutputSchema extends
|
||||
| { [key in string]: (zImpl: typeof z) => z.ZodType }
|
||||
| Schema
|
||||
| unknown = unknown,
|
||||
> = {
|
||||
id: string;
|
||||
description?: string;
|
||||
@@ -184,6 +194,11 @@ export type TemplateAction<
|
||||
output?: Schema;
|
||||
};
|
||||
handler: (
|
||||
ctx: ActionContext<TActionInput, TActionOutput, TInputSchema>,
|
||||
ctx: ActionContext<
|
||||
TActionInput,
|
||||
TActionOutput,
|
||||
TInputSchema,
|
||||
TOutputSchema
|
||||
>,
|
||||
) => Promise<void>;
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ export * from './globals';
|
||||
* @alpha
|
||||
*/
|
||||
export interface ScaffolderActionsExtensionPoint {
|
||||
addActions(...actions: TemplateAction<any, any>[]): void;
|
||||
addActions(...actions: TemplateAction<any, any, any>[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user