diff --git a/packages/types/report.api.md b/packages/types/report.api.md index 130a6ae504..b6bfae0862 100644 --- a/packages/types/report.api.md +++ b/packages/types/report.api.md @@ -79,11 +79,6 @@ export type Observer = { complete?(): void; }; -// @public -export type Prettify> = { - [K in keyof T]: T[K]; -} & {}; - // @public export type Subscription = { unsubscribe(): void; diff --git a/plugins/scaffolder-node/src/actions/createTemplateAction.test.ts b/plugins/scaffolder-node/src/actions/createTemplateAction.test.ts index 7dcb3f491c..43d5d2f660 100644 --- a/plugins/scaffolder-node/src/actions/createTemplateAction.test.ts +++ b/plugins/scaffolder-node/src/actions/createTemplateAction.test.ts @@ -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(); }); }); diff --git a/plugins/scaffolder-node/src/actions/createTemplateAction.ts b/plugins/scaffolder-node/src/actions/createTemplateAction.ts index 3622c05662..b2a525a5d5 100644 --- a/plugins/scaffolder-node/src/actions/createTemplateAction.ts +++ b/plugins/scaffolder-node/src/actions/createTemplateAction.ts @@ -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; /** + * @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 { +): TemplateAction { const { inputSchema, outputSchema } = parseSchemas(action); return { diff --git a/plugins/scaffolder-node/src/actions/types.ts b/plugins/scaffolder-node/src/actions/types.ts index 9f90df6e08..c5fa4052c4 100644 --- a/plugins/scaffolder-node/src/actions/types.ts +++ b/plugins/scaffolder-node/src/actions/types.ts @@ -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, + ctx: ActionContext< + TActionInput, + TActionOutput, + TInputSchema, + TOutputSchema + >, ) => Promise; }; diff --git a/plugins/scaffolder-node/src/alpha/index.ts b/plugins/scaffolder-node/src/alpha/index.ts index 1b573d0650..d97aa54557 100644 --- a/plugins/scaffolder-node/src/alpha/index.ts +++ b/plugins/scaffolder-node/src/alpha/index.ts @@ -34,7 +34,7 @@ export * from './globals'; * @alpha */ export interface ScaffolderActionsExtensionPoint { - addActions(...actions: TemplateAction[]): void; + addActions(...actions: TemplateAction[]): void; } /**