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:
blam
2023-02-24 15:20:09 +01:00
parent 14d1a325b7
commit d57708a0c7
11 changed files with 384 additions and 511 deletions
@@ -16,16 +16,12 @@ export function createFetchCookiecutterAction(options: {
reader: UrlReader;
integrations: ScmIntegrations;
containerRunner: ContainerRunner;
}): TemplateAction<
{
url: string;
targetPath?: string | undefined;
values: JsonObject;
copyWithoutRender?: string[] | undefined;
extensions?: string[] | undefined;
imageName?: string | undefined;
},
{},
{}
>;
}): TemplateAction<{
url: string;
targetPath?: string | undefined;
values: JsonObject;
copyWithoutRender?: string[] | undefined;
extensions?: string[] | undefined;
imageName?: string | undefined;
}>;
```
@@ -15,14 +15,10 @@ export function createFetchRailsAction(options: {
integrations: ScmIntegrations;
containerRunner: ContainerRunner;
allowedImageNames?: string[];
}): TemplateAction<
{
url: string;
targetPath?: string | undefined;
values: JsonObject;
imageName?: string | undefined;
},
{},
{}
>;
}): TemplateAction<{
url: string;
targetPath?: string | undefined;
values: JsonObject;
imageName?: string | undefined;
}>;
```
@@ -9,17 +9,13 @@ import { TemplateAction } from '@backstage/plugin-scaffolder-node';
// @public
export function createSentryCreateProjectAction(options: {
config: Config;
}): TemplateAction<
{
organizationSlug: string;
teamSlug: string;
name: string;
slug?: string | undefined;
authToken?: string | undefined;
},
{},
{}
>;
}): TemplateAction<{
organizationSlug: string;
teamSlug: string;
name: string;
slug?: string | undefined;
authToken?: string | undefined;
}>;
// (No @packageDocumentation comment for this package)
```
@@ -7,13 +7,9 @@ import { JsonObject } from '@backstage/types';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
// @public
export function createRunYeomanAction(): TemplateAction<
{
namespace: string;
args?: string[] | undefined;
options?: JsonObject | undefined;
},
{},
{}
>;
export function createRunYeomanAction(): TemplateAction<{
namespace: string;
args?: string[] | undefined;
options?: JsonObject | undefined;
}>;
```
+328 -429
View File
@@ -35,7 +35,6 @@ import { TemplateAction as TemplateAction_2 } from '@backstage/plugin-scaffolder
import { TemplateActionOptions } from '@backstage/plugin-scaffolder-node';
import { UrlReader } from '@backstage/backend-common';
import { Writable } from 'stream';
import { z } from 'zod';
import { ZodType } from 'zod';
import { ZodTypeDef } from 'zod';
@@ -71,68 +70,37 @@ export function createCatalogRegisterAction(options: {
repoContentsUrl: string;
catalogInfoPath?: string | undefined;
optional?: boolean | undefined;
},
{},
{}
>;
// @public
export function createCatalogWriteAction(): TemplateAction_2<
unknown,
z.ZodObject<
{
filePath: z.ZodOptional<z.ZodString>;
entity: z.ZodOptional<z.ZodObject<{}, 'strip', z.ZodTypeAny, {}, {}>>;
},
'strip',
z.ZodTypeAny,
{
filePath?: string | undefined;
entity?: {} | undefined;
},
{
filePath?: string | undefined;
entity?: {} | undefined;
}
>,
{}
>;
// @public
export function createDebugLogAction(): TemplateAction_2<
{
message?: string | undefined;
listWorkspace?: boolean | undefined;
},
{},
{}
>;
export function createCatalogWriteAction(): TemplateAction_2<{
filePath?: string | undefined;
entity?: {} | undefined;
}>;
// @public
export function createDebugLogAction(): TemplateAction_2<{
message?: string | undefined;
listWorkspace?: boolean | undefined;
}>;
// @public
export function createFetchCatalogEntityAction(options: {
catalogClient: CatalogApi;
}): TemplateAction_2<
{
entityRef: string;
optional?: boolean | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
entityRef: string;
optional?: boolean | undefined;
}>;
// @public
export function createFetchPlainAction(options: {
reader: UrlReader;
integrations: ScmIntegrations;
}): TemplateAction_2<
{
url: string;
targetPath?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
url: string;
targetPath?: string | undefined;
}>;
// @public
export function createFetchTemplateAction(options: {
@@ -140,77 +108,57 @@ export function createFetchTemplateAction(options: {
integrations: ScmIntegrations;
additionalTemplateFilters?: Record<string, TemplateFilter>;
additionalTemplateGlobals?: Record<string, TemplateGlobal>;
}): TemplateAction_2<
{
url: string;
targetPath?: string | undefined;
values: any;
templateFileExtension?: string | boolean | undefined;
copyWithoutRender?: string[] | undefined;
copyWithoutTemplating?: string[] | undefined;
cookiecutterCompat?: boolean | undefined;
replace?: boolean | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
url: string;
targetPath?: string | undefined;
values: any;
templateFileExtension?: string | boolean | undefined;
copyWithoutRender?: string[] | undefined;
copyWithoutTemplating?: string[] | undefined;
cookiecutterCompat?: boolean | undefined;
replace?: boolean | undefined;
}>;
// @public
export const createFilesystemDeleteAction: () => TemplateAction_2<
{
files: string[];
},
{},
{}
>;
export const createFilesystemDeleteAction: () => TemplateAction_2<{
files: string[];
}>;
// @public
export const createFilesystemRenameAction: () => TemplateAction_2<
{
files: Array<{
from: string;
to: string;
overwrite?: boolean;
}>;
},
{},
{}
>;
export const createFilesystemRenameAction: () => TemplateAction_2<{
files: Array<{
from: string;
to: string;
overwrite?: boolean;
}>;
}>;
// @public
export function createGithubActionsDispatchAction(options: {
integrations: ScmIntegrations;
githubCredentialsProvider?: GithubCredentialsProvider;
}): TemplateAction_2<
{
repoUrl: string;
workflowId: string;
branchOrTagName: string;
workflowInputs?:
| {
[key: string]: string;
}
| undefined;
token?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
workflowId: string;
branchOrTagName: string;
workflowInputs?:
| {
[key: string]: string;
}
| undefined;
token?: string | undefined;
}>;
// @public
export function createGithubIssuesLabelAction(options: {
integrations: ScmIntegrationRegistry;
githubCredentialsProvider?: GithubCredentialsProvider;
}): TemplateAction_2<
{
repoUrl: string;
number: number;
labels: string[];
token?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
number: number;
labels: string[];
token?: string | undefined;
}>;
// @public
export interface CreateGithubPullRequestActionOptions {
@@ -235,388 +183,336 @@ export type CreateGithubPullRequestClientFactoryInput = {
export function createGithubRepoCreateAction(options: {
integrations: ScmIntegrationRegistry;
githubCredentialsProvider?: GithubCredentialsProvider;
}): TemplateAction_2<
{
repoUrl: string;
description?: string | undefined;
homepage?: string | undefined;
access?: string | undefined;
deleteBranchOnMerge?: boolean | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
allowRebaseMerge?: boolean | undefined;
allowSquashMerge?: boolean | undefined;
squashMergeCommitTitle?: 'PR_TITLE' | 'COMMIT_OR_PR_TITLE' | undefined;
squashMergeCommitMessage?:
| 'PR_BODY'
| 'COMMIT_MESSAGES'
| 'BLANK'
| undefined;
allowMergeCommit?: boolean | undefined;
allowAutoMerge?: boolean | undefined;
requireCodeOwnerReviews?: boolean | undefined;
bypassPullRequestAllowances?:
| {
users?: string[] | undefined;
teams?: string[] | undefined;
apps?: string[] | undefined;
}
| undefined;
requiredApprovingReviewCount?: number | undefined;
restrictions?:
| {
users: string[];
teams: string[];
apps?: string[] | undefined;
}
| undefined;
requiredStatusCheckContexts?: string[] | undefined;
requireBranchesToBeUpToDate?: boolean | undefined;
requiredConversationResolution?: boolean | undefined;
repoVisibility?: 'internal' | 'private' | 'public' | undefined;
collaborators?:
| (
| {
user: string;
access: string;
}
| {
team: string;
access: string;
}
| {
username: string;
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
}
)[]
| undefined;
hasProjects?: boolean | undefined;
hasWiki?: boolean | undefined;
hasIssues?: boolean | undefined;
token?: string | undefined;
topics?: string[] | undefined;
requireCommitSigning?: boolean | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
description?: string | undefined;
homepage?: string | undefined;
access?: string | undefined;
deleteBranchOnMerge?: boolean | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
allowRebaseMerge?: boolean | undefined;
allowSquashMerge?: boolean | undefined;
squashMergeCommitTitle?: 'PR_TITLE' | 'COMMIT_OR_PR_TITLE' | undefined;
squashMergeCommitMessage?:
| 'PR_BODY'
| 'COMMIT_MESSAGES'
| 'BLANK'
| undefined;
allowMergeCommit?: boolean | undefined;
allowAutoMerge?: boolean | undefined;
requireCodeOwnerReviews?: boolean | undefined;
bypassPullRequestAllowances?:
| {
users?: string[] | undefined;
teams?: string[] | undefined;
apps?: string[] | undefined;
}
| undefined;
requiredApprovingReviewCount?: number | undefined;
restrictions?:
| {
users: string[];
teams: string[];
apps?: string[] | undefined;
}
| undefined;
requiredStatusCheckContexts?: string[] | undefined;
requireBranchesToBeUpToDate?: boolean | undefined;
requiredConversationResolution?: boolean | undefined;
repoVisibility?: 'internal' | 'private' | 'public' | undefined;
collaborators?:
| (
| {
user: string;
access: string;
}
| {
team: string;
access: string;
}
| {
username: string;
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
}
)[]
| undefined;
hasProjects?: boolean | undefined;
hasWiki?: boolean | undefined;
hasIssues?: boolean | undefined;
token?: string | undefined;
topics?: string[] | undefined;
requireCommitSigning?: boolean | undefined;
}>;
// @public
export function createGithubRepoPushAction(options: {
integrations: ScmIntegrationRegistry;
config: Config;
githubCredentialsProvider?: GithubCredentialsProvider;
}): TemplateAction_2<
{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
protectDefaultBranch?: boolean | undefined;
protectEnforceAdmins?: boolean | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
requireCodeOwnerReviews?: boolean | undefined;
dismissStaleReviews?: boolean | undefined;
bypassPullRequestAllowances?:
| {
users?: string[];
teams?: string[];
apps?: string[];
}
| undefined;
requiredApprovingReviewCount?: number | undefined;
restrictions?:
| {
users: string[];
teams: string[];
apps?: string[];
}
| undefined;
requiredStatusCheckContexts?: string[] | undefined;
requireBranchesToBeUpToDate?: boolean | undefined;
requiredConversationResolution?: boolean | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
requiredCommitSigning?: boolean | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
protectDefaultBranch?: boolean | undefined;
protectEnforceAdmins?: boolean | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
requireCodeOwnerReviews?: boolean | undefined;
dismissStaleReviews?: boolean | undefined;
bypassPullRequestAllowances?:
| {
users?: string[];
teams?: string[];
apps?: string[];
}
| undefined;
requiredApprovingReviewCount?: number | undefined;
restrictions?:
| {
users: string[];
teams: string[];
apps?: string[];
}
| undefined;
requiredStatusCheckContexts?: string[] | undefined;
requireBranchesToBeUpToDate?: boolean | undefined;
requiredConversationResolution?: boolean | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
requiredCommitSigning?: boolean | undefined;
}>;
// @public
export function createGithubWebhookAction(options: {
integrations: ScmIntegrationRegistry;
defaultWebhookSecret?: string;
githubCredentialsProvider?: GithubCredentialsProvider;
}): TemplateAction_2<
{
repoUrl: string;
webhookUrl: string;
webhookSecret?: string | undefined;
events?: string[] | undefined;
active?: boolean | undefined;
contentType?: 'form' | 'json' | undefined;
insecureSsl?: boolean | undefined;
token?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
webhookUrl: string;
webhookSecret?: string | undefined;
events?: string[] | undefined;
active?: boolean | undefined;
contentType?: 'form' | 'json' | undefined;
insecureSsl?: boolean | undefined;
token?: string | undefined;
}>;
// @public
export function createPublishAzureAction(options: {
integrations: ScmIntegrationRegistry;
config: Config;
}): TemplateAction_2<
{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
}>;
// @public @deprecated
export function createPublishBitbucketAction(options: {
integrations: ScmIntegrationRegistry;
config: Config;
}): TemplateAction_2<
{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
repoVisibility?: 'private' | 'public' | undefined;
sourcePath?: string | undefined;
enableLFS?: boolean | undefined;
token?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
repoVisibility?: 'private' | 'public' | undefined;
sourcePath?: string | undefined;
enableLFS?: boolean | undefined;
token?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
}>;
// @public
export function createPublishBitbucketCloudAction(options: {
integrations: ScmIntegrationRegistry;
config: Config;
}): TemplateAction_2<
{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
repoVisibility?: 'private' | 'public' | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
repoVisibility?: 'private' | 'public' | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
}>;
// @public
export function createPublishBitbucketServerAction(options: {
integrations: ScmIntegrationRegistry;
config: Config;
}): TemplateAction_2<
{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
repoVisibility?: 'private' | 'public' | undefined;
sourcePath?: string | undefined;
enableLFS?: boolean | undefined;
token?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
description?: string | undefined;
defaultBranch?: string | undefined;
repoVisibility?: 'private' | 'public' | undefined;
sourcePath?: string | undefined;
enableLFS?: boolean | undefined;
token?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
}>;
// @public
export function createPublishGerritAction(options: {
integrations: ScmIntegrationRegistry;
config: Config;
}): TemplateAction_2<
{
repoUrl: string;
description: string;
defaultBranch?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
sourcePath?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
description: string;
defaultBranch?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
sourcePath?: string | undefined;
}>;
// @public
export function createPublishGerritReviewAction(options: {
integrations: ScmIntegrationRegistry;
config: Config;
}): TemplateAction_2<
{
repoUrl: string;
branch?: string | undefined;
sourcePath?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
branch?: string | undefined;
sourcePath?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
}>;
// @public
export function createPublishGithubAction(options: {
integrations: ScmIntegrationRegistry;
config: Config;
githubCredentialsProvider?: GithubCredentialsProvider;
}): TemplateAction_2<
{
repoUrl: string;
description?: string | undefined;
homepage?: string | undefined;
access?: string | undefined;
defaultBranch?: string | undefined;
protectDefaultBranch?: boolean | undefined;
protectEnforceAdmins?: boolean | undefined;
deleteBranchOnMerge?: boolean | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
allowRebaseMerge?: boolean | undefined;
allowSquashMerge?: boolean | undefined;
squashMergeCommitTitle?: 'PR_TITLE' | 'COMMIT_OR_PR_TITLE' | undefined;
squashMergeCommitMessage?:
| 'PR_BODY'
| 'COMMIT_MESSAGES'
| 'BLANK'
| undefined;
allowMergeCommit?: boolean | undefined;
allowAutoMerge?: boolean | undefined;
sourcePath?: string | undefined;
bypassPullRequestAllowances?:
| {
users?: string[];
teams?: string[];
apps?: string[];
}
| undefined;
requiredApprovingReviewCount?: number | undefined;
restrictions?:
| {
users: string[];
teams: string[];
apps?: string[];
}
| undefined;
requireCodeOwnerReviews?: boolean | undefined;
dismissStaleReviews?: boolean | undefined;
requiredStatusCheckContexts?: string[] | undefined;
requireBranchesToBeUpToDate?: boolean | undefined;
requiredConversationResolution?: boolean | undefined;
repoVisibility?: 'internal' | 'private' | 'public' | undefined;
collaborators?:
| (
| {
user: string;
access: string;
}
| {
team: string;
access: string;
}
| {
username: string;
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
}
)[]
| undefined;
hasProjects?: boolean | undefined;
hasWiki?: boolean | undefined;
hasIssues?: boolean | undefined;
token?: string | undefined;
topics?: string[] | undefined;
requiredCommitSigning?: boolean | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
description?: string | undefined;
homepage?: string | undefined;
access?: string | undefined;
defaultBranch?: string | undefined;
protectDefaultBranch?: boolean | undefined;
protectEnforceAdmins?: boolean | undefined;
deleteBranchOnMerge?: boolean | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
allowRebaseMerge?: boolean | undefined;
allowSquashMerge?: boolean | undefined;
squashMergeCommitTitle?: 'PR_TITLE' | 'COMMIT_OR_PR_TITLE' | undefined;
squashMergeCommitMessage?:
| 'PR_BODY'
| 'COMMIT_MESSAGES'
| 'BLANK'
| undefined;
allowMergeCommit?: boolean | undefined;
allowAutoMerge?: boolean | undefined;
sourcePath?: string | undefined;
bypassPullRequestAllowances?:
| {
users?: string[];
teams?: string[];
apps?: string[];
}
| undefined;
requiredApprovingReviewCount?: number | undefined;
restrictions?:
| {
users: string[];
teams: string[];
apps?: string[];
}
| undefined;
requireCodeOwnerReviews?: boolean | undefined;
dismissStaleReviews?: boolean | undefined;
requiredStatusCheckContexts?: string[] | undefined;
requireBranchesToBeUpToDate?: boolean | undefined;
requiredConversationResolution?: boolean | undefined;
repoVisibility?: 'internal' | 'private' | 'public' | undefined;
collaborators?:
| (
| {
user: string;
access: string;
}
| {
team: string;
access: string;
}
| {
username: string;
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
}
)[]
| undefined;
hasProjects?: boolean | undefined;
hasWiki?: boolean | undefined;
hasIssues?: boolean | undefined;
token?: string | undefined;
topics?: string[] | undefined;
requiredCommitSigning?: boolean | undefined;
}>;
// @public
export const createPublishGithubPullRequestAction: ({
integrations,
githubCredentialsProvider,
clientFactory,
}: CreateGithubPullRequestActionOptions) => TemplateAction_2<
{
title: string;
branchName: string;
description: string;
repoUrl: string;
draft?: boolean | undefined;
targetPath?: string | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
reviewers?: string[] | undefined;
teamReviewers?: string[] | undefined;
},
{},
{}
>;
}: CreateGithubPullRequestActionOptions) => TemplateAction_2<{
title: string;
branchName: string;
description: string;
repoUrl: string;
draft?: boolean | undefined;
targetPath?: string | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
reviewers?: string[] | undefined;
teamReviewers?: string[] | undefined;
}>;
// @public
export function createPublishGitlabAction(options: {
integrations: ScmIntegrationRegistry;
config: Config;
}): TemplateAction_2<
{
repoUrl: string;
defaultBranch?: string | undefined;
repoVisibility?: 'internal' | 'private' | 'public' | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
setUserAsOwner?: boolean | undefined;
topics?: string[] | undefined;
},
{},
{}
>;
}): TemplateAction_2<{
repoUrl: string;
defaultBranch?: string | undefined;
repoVisibility?: 'internal' | 'private' | 'public' | undefined;
sourcePath?: string | undefined;
token?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
setUserAsOwner?: boolean | undefined;
topics?: string[] | undefined;
}>;
// @public
export const createPublishGitlabMergeRequestAction: (options: {
integrations: ScmIntegrationRegistry;
}) => TemplateAction_2<
{
repoUrl: string;
title: string;
description: string;
branchName: string;
sourcePath?: string | undefined;
targetPath?: string | undefined;
token?: string | undefined;
commitAction?: 'update' | 'delete' | 'create' | undefined;
projectid?: string | undefined;
removeSourceBranch?: boolean | undefined;
assignee?: string | undefined;
},
{},
{}
>;
}) => TemplateAction_2<{
repoUrl: string;
title: string;
description: string;
branchName: string;
sourcePath?: string | undefined;
targetPath?: string | undefined;
token?: string | undefined;
commitAction?: 'update' | 'delete' | 'create' | undefined;
projectid?: string | undefined;
removeSourceBranch?: boolean | undefined;
assignee?: string | undefined;
}>;
// @public
export function createRouter(options: RouterOptions): Promise<express.Router>;
@@ -626,9 +522,12 @@ export const createTemplateAction: <
TParams,
TInputSchema extends ZodType<any, ZodTypeDef, any> | Schema = {},
TOutputSchema extends ZodType<any, ZodTypeDef, any> | Schema = {},
TActionInput = TInputSchema extends ZodType<any, any, infer IReturn>
? IReturn
: TParams,
>(
action: TemplateActionOptions<TParams, TInputSchema, TOutputSchema>,
) => TemplateAction_2<TParams, TInputSchema, TOutputSchema>;
action: TemplateActionOptions<TActionInput, TInputSchema, TOutputSchema>,
) => TemplateAction_2<TActionInput>;
// @public
export type CreateWorkerOptions = {
@@ -726,7 +625,7 @@ export type OctokitWithPullRequestPluginClient = Octokit & {
// @public
export interface RouterOptions {
// (undocumented)
actions?: TemplateAction_2[];
actions?: TemplateAction_2<any>[];
// (undocumented)
additionalTemplateFilters?: Record<string, TemplateFilter>;
// (undocumented)
@@ -27,6 +27,7 @@ import { TaskSpec } from '@backstage/plugin-scaffolder-common';
import {
createTemplateAction,
TaskSecrets,
TemplateAction,
} from '@backstage/plugin-scaffolder-node';
import { UserEntity } from '@backstage/catalog-model';
import { z } from 'zod';
@@ -111,14 +112,14 @@ describe('DefaultWorkflowRunner', () => {
createTemplateAction({
id: 'jest-zod-validated-action',
description: 'Mock action for testing',
supportsDryRun: true,
handler: fakeActionHandler,
supportsDryRun: true,
schema: {
input: z.object({
foo: z.number(),
}),
},
}),
}) as TemplateAction<unknown>,
);
actionRegistry.register({
@@ -24,7 +24,7 @@ import { JsonObject, JsonValue } from '@backstage/types';
import { InputError } from '@backstage/errors';
import { PassThrough } from 'stream';
import { generateExampleOutput, isTruthy } from './helper';
import { Schema, validate as validateJsonSchema } from 'jsonschema';
import { validate as validateJsonSchema } from 'jsonschema';
import { parseRepoUrl } from '../actions/builtin/publish/util';
import { TemplateActionRegistry } from '../actions';
import {
@@ -66,8 +66,7 @@ export interface RouterOptions {
database: PluginDatabaseManager;
catalogClient: CatalogApi;
scheduler?: PluginTaskScheduler;
actions?: TemplateAction[];
actions?: TemplateAction<any>[];
/**
* @deprecated taskWorkers is deprecated in favor of concurrentTasksLimit option with a single TaskWorker
* @defaultValue 1
+13 -20
View File
@@ -15,12 +15,12 @@ import { Writable } from 'stream';
import { z } from 'zod';
// @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;
createTemporaryDirectory(): Promise<string>;
templateInfo?: TemplateInfo;
@@ -36,9 +36,12 @@ export const createTemplateAction: <
TParams,
TInputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {},
TOutputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {},
TActionInput = TInputSchema extends z.ZodType<any, any, infer IReturn>
? IReturn
: TParams,
>(
action: TemplateActionOptions<TParams, TInputSchema, TOutputSchema>,
) => TemplateAction<TParams, TInputSchema, TOutputSchema>;
action: TemplateActionOptions<TActionInput, TInputSchema, TOutputSchema>,
) => TemplateAction<TActionInput>;
// @alpha
export interface ScaffolderActionsExtensionPoint {
@@ -55,11 +58,7 @@ export type TaskSecrets = Record<string, string> & {
};
// @public (undocumented)
export type TemplateAction<
TParams = unknown,
TInputSchema extends Schema | unknown = unknown,
TOutputSchema extends Schema | unknown = unknown,
> = {
export type TemplateAction<TActionInput = unknown> = {
id: string;
description?: string;
examples?: {
@@ -68,15 +67,15 @@ export type TemplateAction<
}[];
supportsDryRun?: boolean;
schema?: {
input?: TInputSchema;
output?: TOutputSchema;
input?: Schema;
output?: Schema;
};
handler: (ctx: ActionContext<TParams>) => Promise<void>;
handler: (ctx: ActionContext<TActionInput>) => Promise<void>;
};
// @public (undocumented)
export type TemplateActionOptions<
TParams = {},
TActionInput = {},
TInputSchema extends Schema | z.ZodType = {},
TOutputSchema extends Schema | z.ZodType = {},
> = {
@@ -91,12 +90,6 @@ 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>;
};
```
@@ -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;
};
+4 -4
View File
@@ -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>;
};