@@ -28,6 +28,7 @@ export function createPublishAzureAction(options: {
|
||||
gitAuthorName?: string;
|
||||
gitAuthorEmail?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
```
|
||||
|
||||
@@ -23,7 +23,12 @@ export const createBitbucketPipelinesRunAction: (options: {
|
||||
body?: object;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
{
|
||||
buildNumber: number;
|
||||
repoUrl: string;
|
||||
pipelinesUrl: string;
|
||||
},
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -40,7 +45,8 @@ export function createPublishBitbucketCloudAction(options: {
|
||||
sourcePath?: string;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -58,6 +64,7 @@ export function createPublishBitbucketCloudPullRequestAction(options: {
|
||||
gitAuthorName?: string;
|
||||
gitAuthorEmail?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
```
|
||||
|
||||
@@ -30,7 +30,8 @@ export function createPublishBitbucketServerAction(options: {
|
||||
gitAuthorName?: string;
|
||||
gitAuthorEmail?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -49,6 +50,7 @@ export function createPublishBitbucketServerPullRequestAction(options: {
|
||||
gitAuthorName?: string;
|
||||
gitAuthorEmail?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
```
|
||||
|
||||
@@ -25,7 +25,12 @@ export const createBitbucketPipelinesRunAction: (options: {
|
||||
body?: object;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
{
|
||||
buildNumber: number;
|
||||
repoUrl: string;
|
||||
pipelinesUrl: string;
|
||||
},
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public @deprecated
|
||||
@@ -45,7 +50,8 @@ export function createPublishBitbucketAction(options: {
|
||||
gitAuthorName?: string;
|
||||
gitAuthorEmail?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
|
||||
@@ -24,6 +24,7 @@ export const createConfluenceToMarkdownAction: (options: {
|
||||
confluenceUrls: string[];
|
||||
repoUrl: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
```
|
||||
|
||||
@@ -54,6 +54,7 @@ export function createFetchCookiecutterAction(options: {
|
||||
extensions?: string[];
|
||||
imageName?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
```
|
||||
|
||||
@@ -23,7 +23,8 @@ export function createPublishGerritAction(options: {
|
||||
gitAuthorEmail?: string;
|
||||
sourcePath?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -39,7 +40,8 @@ export function createPublishGerritReviewAction(options: {
|
||||
gitAuthorName?: string;
|
||||
gitAuthorEmail?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -24,7 +24,8 @@ export function createPublishGiteaAction(options: {
|
||||
gitAuthorEmail?: string;
|
||||
sourcePath?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -30,7 +30,8 @@ export function createGithubActionsDispatchAction(options: {
|
||||
};
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -45,7 +46,8 @@ export function createGithubAutolinksAction(options: {
|
||||
isAlphanumeric?: boolean;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -81,7 +83,8 @@ export function createGithubBranchProtectionAction(options: {
|
||||
requiredLinearHistory?: boolean;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -96,7 +99,8 @@ export function createGithubDeployKeyAction(options: {
|
||||
privateKeySecretName?: string;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -125,7 +129,8 @@ export function createGithubEnvironmentAction(options: {
|
||||
preventSelfReview?: boolean;
|
||||
reviewers?: string[];
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -139,7 +144,8 @@ export function createGithubIssuesLabelAction(options: {
|
||||
labels: string[];
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -154,7 +160,8 @@ export function createGithubPagesEnableAction(options: {
|
||||
sourcePath?: '/' | '/docs';
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -255,7 +262,8 @@ export function createGithubRepoCreateAction(options: {
|
||||
};
|
||||
subscribe?: boolean;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -299,7 +307,8 @@ export function createGithubRepoPushAction(options: {
|
||||
requiredLinearHistory?: boolean;
|
||||
requireLastPushApproval?: boolean;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -318,7 +327,8 @@ export function createGithubWebhookAction(options: {
|
||||
insecureSsl?: boolean;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -404,7 +414,8 @@ export function createPublishGithubAction(options: {
|
||||
};
|
||||
subscribe?: boolean;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -431,7 +442,8 @@ export const createPublishGithubPullRequestAction: (
|
||||
forceEmptyGitAuthor?: boolean;
|
||||
createWhenEmpty?: boolean;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -26,7 +26,8 @@ export const createGitlabGroupEnsureExistsAction: (options: {
|
||||
},
|
||||
{
|
||||
groupId?: number | undefined;
|
||||
}
|
||||
},
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -55,7 +56,8 @@ export const createGitlabIssueAction: (options: {
|
||||
issueUrl: string;
|
||||
issueId: number;
|
||||
issueIid: number;
|
||||
}
|
||||
},
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -73,7 +75,8 @@ export const createGitlabProjectAccessTokenAction: (options: {
|
||||
},
|
||||
{
|
||||
access_token: string;
|
||||
}
|
||||
},
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -91,7 +94,8 @@ export const createGitlabProjectDeployTokenAction: (options: {
|
||||
{
|
||||
user: string;
|
||||
deploy_token: string;
|
||||
}
|
||||
},
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -110,7 +114,8 @@ export const createGitlabProjectVariableAction: (options: {
|
||||
environmentScope?: string | undefined;
|
||||
variableProtected?: boolean | undefined;
|
||||
},
|
||||
JsonObject
|
||||
any,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -126,7 +131,8 @@ export const createGitlabRepoPushAction: (options: {
|
||||
token?: string;
|
||||
commitAction?: 'create' | 'delete' | 'update';
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -176,7 +182,8 @@ export function createPublishGitlabAction(options: {
|
||||
environment_scope?: string;
|
||||
}>;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -199,7 +206,8 @@ export const createPublishGitlabMergeRequestAction: (options: {
|
||||
reviewers?: string[];
|
||||
assignReviewersFromApprovalRules?: boolean;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -216,7 +224,8 @@ export const createTriggerGitlabPipelineAction: (options: {
|
||||
},
|
||||
{
|
||||
pipelineUrl: string;
|
||||
}
|
||||
},
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -252,7 +261,8 @@ export const editGitlabIssueAction: (options: {
|
||||
issueUrl: string;
|
||||
issueId: number;
|
||||
issueIid: number;
|
||||
}
|
||||
},
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -23,7 +23,8 @@ export function createSendNotificationAction(options: {
|
||||
scope?: string;
|
||||
optional?: boolean;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -49,7 +49,8 @@ export function createFetchRailsAction(options: {
|
||||
values: JsonObject;
|
||||
imageName?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -19,7 +19,8 @@ export function createSentryCreateProjectAction(options: {
|
||||
slug?: string;
|
||||
authToken?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -14,7 +14,8 @@ export function createRunYeomanAction(): TemplateAction<
|
||||
args?: string[];
|
||||
options?: JsonObject;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -30,6 +30,7 @@ import { createPublishGerritAction as createPublishGerritAction_2 } from '@backs
|
||||
import { createPublishGerritReviewAction as createPublishGerritReviewAction_2 } from '@backstage/plugin-scaffolder-backend-module-gerrit';
|
||||
import { createPublishGithubAction as createPublishGithubAction_2 } from '@backstage/plugin-scaffolder-backend-module-github';
|
||||
import { createPublishGitlabAction as createPublishGitlabAction_2 } from '@backstage/plugin-scaffolder-backend-module-gitlab';
|
||||
import { createTemplateAction as createTemplateAction_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { DatabaseService } from '@backstage/backend-plugin-api';
|
||||
import { DiscoveryService } from '@backstage/backend-plugin-api';
|
||||
import { Duration } from 'luxon';
|
||||
@@ -54,7 +55,6 @@ import { RESOURCE_TYPE_SCAFFOLDER_ACTION } from '@backstage/plugin-scaffolder-co
|
||||
import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common/alpha';
|
||||
import { ScaffolderEntitiesProcessor as ScaffolderEntitiesProcessor_2 } from '@backstage/plugin-catalog-backend-module-scaffolder-entity-model';
|
||||
import { SchedulerService } from '@backstage/backend-plugin-api';
|
||||
import { Schema } from 'jsonschema';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import { SerializedTask as SerializedTask_2 } from '@backstage/plugin-scaffolder-node';
|
||||
@@ -71,14 +71,12 @@ import { TaskSpec } from '@backstage/plugin-scaffolder-common';
|
||||
import { TaskSpecV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { TaskStatus as TaskStatus_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateAction as TemplateAction_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateActionOptions } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateEntityStepV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { TemplateFilter as TemplateFilter_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateGlobal as TemplateGlobal_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateParametersV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { UrlReaderService } from '@backstage/backend-plugin-api';
|
||||
import { WorkspaceProvider } from '@backstage/plugin-scaffolder-node/alpha';
|
||||
import { ZodType } from 'zod';
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export type ActionContext<TInput extends JsonObject> = ActionContext_2<TInput>;
|
||||
@@ -125,7 +123,8 @@ export function createCatalogRegisterAction(options: {
|
||||
catalogInfoPath?: string;
|
||||
optional?: boolean;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -134,17 +133,12 @@ export function createCatalogWriteAction(): TemplateAction_2<
|
||||
entity: Record<string, any>;
|
||||
filePath?: string | undefined;
|
||||
},
|
||||
JsonObject
|
||||
any,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function createDebugLogAction(): TemplateAction_2<
|
||||
{
|
||||
message?: string;
|
||||
listWorkspace?: boolean | 'with-filenames' | 'with-contents';
|
||||
},
|
||||
JsonObject
|
||||
>;
|
||||
export function createDebugLogAction(): TemplateAction_2<any, any, 'v1'>;
|
||||
|
||||
// @public
|
||||
export function createFetchCatalogEntityAction(options: {
|
||||
@@ -152,16 +146,17 @@ export function createFetchCatalogEntityAction(options: {
|
||||
auth?: AuthService;
|
||||
}): TemplateAction_2<
|
||||
{
|
||||
entityRef?: string | undefined;
|
||||
entityRefs?: string[] | undefined;
|
||||
optional?: boolean | undefined;
|
||||
defaultKind?: string | undefined;
|
||||
defaultNamespace?: string | undefined;
|
||||
entityRef?: string | undefined;
|
||||
entityRefs?: string[] | undefined;
|
||||
},
|
||||
{
|
||||
entities?: any[] | undefined;
|
||||
entity?: any;
|
||||
}
|
||||
entities?: any[] | undefined;
|
||||
},
|
||||
'v2'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -174,7 +169,8 @@ export function createFetchPlainAction(options: {
|
||||
targetPath?: string;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -187,7 +183,8 @@ export function createFetchPlainFileAction(options: {
|
||||
targetPath: string;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -210,7 +207,8 @@ export function createFetchTemplateAction(options: {
|
||||
lstripBlocks?: boolean;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -230,7 +228,8 @@ export function createFetchTemplateFileAction(options: {
|
||||
lstripBlocks?: boolean;
|
||||
token?: string;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -238,14 +237,15 @@ export const createFilesystemDeleteAction: () => TemplateAction_2<
|
||||
{
|
||||
files: string[];
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
export const createFilesystemReadDirAction: () => TemplateAction_2<
|
||||
{
|
||||
recursive: boolean;
|
||||
paths: string[];
|
||||
recursive?: boolean | undefined;
|
||||
},
|
||||
{
|
||||
files: {
|
||||
@@ -258,7 +258,8 @@ export const createFilesystemReadDirAction: () => TemplateAction_2<
|
||||
path: string;
|
||||
fullPath: string;
|
||||
}[];
|
||||
}
|
||||
},
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public
|
||||
@@ -270,7 +271,8 @@ export const createFilesystemRenameAction: () => TemplateAction_2<
|
||||
overwrite?: boolean;
|
||||
}>;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
@@ -346,7 +348,8 @@ export const createPublishGithubPullRequestAction: (
|
||||
forceEmptyGitAuthor?: boolean;
|
||||
createWhenEmpty?: boolean;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
@@ -372,45 +375,20 @@ export const createPublishGitlabMergeRequestAction: (options: {
|
||||
reviewers?: string[];
|
||||
assignReviewersFromApprovalRules?: boolean;
|
||||
},
|
||||
JsonObject
|
||||
JsonObject,
|
||||
'v1'
|
||||
>;
|
||||
|
||||
// @public @deprecated
|
||||
export function createRouter(options: RouterOptions): Promise<express.Router>;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export const createTemplateAction: <
|
||||
TInputParams extends JsonObject = JsonObject,
|
||||
TOutputParams extends JsonObject = JsonObject,
|
||||
TInputSchema extends Schema | ZodType = {},
|
||||
TOutputSchema extends Schema | ZodType = {},
|
||||
TActionInput extends JsonObject = TInputSchema extends ZodType<
|
||||
any,
|
||||
any,
|
||||
infer IReturn
|
||||
>
|
||||
? IReturn
|
||||
: TInputParams,
|
||||
TActionOutput extends JsonObject = TOutputSchema extends ZodType<
|
||||
any,
|
||||
any,
|
||||
infer IReturn_1
|
||||
>
|
||||
? IReturn_1
|
||||
: TOutputParams,
|
||||
>(
|
||||
action: TemplateActionOptions<
|
||||
TActionInput,
|
||||
TActionOutput,
|
||||
TInputSchema,
|
||||
TOutputSchema
|
||||
>,
|
||||
) => TemplateAction_2<TActionInput, TActionOutput>;
|
||||
export const createTemplateAction: typeof createTemplateAction_2;
|
||||
|
||||
// @public
|
||||
export function createWaitAction(options?: {
|
||||
maxWaitTime?: Duration | HumanDuration;
|
||||
}): TemplateAction_2<HumanDuration, JsonObject>;
|
||||
}): TemplateAction_2<HumanDuration, JsonObject, 'v1'>;
|
||||
|
||||
// @public
|
||||
export type CreateWorkerOptions = {
|
||||
@@ -547,7 +525,7 @@ export const fetchContents: typeof fetchContents_2;
|
||||
// @public @deprecated
|
||||
export interface RouterOptions {
|
||||
// (undocumented)
|
||||
actions?: TemplateAction_2<any, any>[];
|
||||
actions?: TemplateAction_2<any, any, any>[];
|
||||
// (undocumented)
|
||||
additionalTemplateFilters?:
|
||||
| Record<string, TemplateFilter_2>
|
||||
@@ -866,11 +844,11 @@ export type TemplateAction<TInput extends JsonObject> =
|
||||
// @public
|
||||
export class TemplateActionRegistry {
|
||||
// (undocumented)
|
||||
get(actionId: string): TemplateAction_2;
|
||||
get(actionId: string): TemplateAction_2<any, any, any>;
|
||||
// (undocumented)
|
||||
list(): TemplateAction_2[];
|
||||
list(): TemplateAction_2<any, any, any>[];
|
||||
// (undocumented)
|
||||
register(action: TemplateAction_2): void;
|
||||
register(action: TemplateAction_2<any, any, any>): void;
|
||||
}
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
|
||||
@@ -23,7 +23,7 @@ import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
export class TemplateActionRegistry {
|
||||
private readonly actions = new Map<string, TemplateAction>();
|
||||
|
||||
register(action: TemplateAction) {
|
||||
register(action: TemplateAction<any, any, any>) {
|
||||
if (this.actions.has(action.id)) {
|
||||
throw new ConflictError(
|
||||
`Template action with ID '${action.id}' has already been registered`,
|
||||
@@ -33,7 +33,7 @@ export class TemplateActionRegistry {
|
||||
this.actions.set(action.id, action);
|
||||
}
|
||||
|
||||
get(actionId: string): TemplateAction {
|
||||
get(actionId: string): TemplateAction<any, any, any> {
|
||||
const action = this.actions.get(actionId);
|
||||
if (!action) {
|
||||
throw new NotFoundError(
|
||||
@@ -43,7 +43,7 @@ export class TemplateActionRegistry {
|
||||
return action;
|
||||
}
|
||||
|
||||
list(): TemplateAction[] {
|
||||
list(): TemplateAction<any, any, any>[] {
|
||||
return [...this.actions.values()];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ describe('NunjucksWorkflowRunner', () => {
|
||||
},
|
||||
},
|
||||
handler: fakeActionHandler,
|
||||
}) as TemplateAction<any, any, any>,
|
||||
}),
|
||||
);
|
||||
|
||||
actionRegistry.register(
|
||||
@@ -215,9 +215,7 @@ describe('NunjucksWorkflowRunner', () => {
|
||||
ctx.output('key2', key2);
|
||||
ctx.output('key3', key3);
|
||||
|
||||
// @ts-expect-error - this is void return
|
||||
ctx.output('key4', key4);
|
||||
// @ts-expect-error - this is void return
|
||||
ctx.output('key5', key5);
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -122,7 +122,7 @@ export const restoreWorkspace: (opts: {
|
||||
// @alpha
|
||||
export interface ScaffolderActionsExtensionPoint {
|
||||
// (undocumented)
|
||||
addActions(...actions: TemplateAction<any, any>[]): void;
|
||||
addActions(...actions: TemplateAction<any, any, any>[]): void;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
```ts
|
||||
import { BackstageCredentials } from '@backstage/backend-plugin-api';
|
||||
import { Expand } from '@backstage/types';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
import { Logger } from 'winston';
|
||||
@@ -24,34 +25,63 @@ import { z } from 'zod';
|
||||
export type ActionContext<
|
||||
TActionInput extends JsonObject,
|
||||
TActionOutput extends JsonObject = JsonObject,
|
||||
> = {
|
||||
logger: Logger;
|
||||
logStream: Writable;
|
||||
secrets?: TaskSecrets;
|
||||
workspacePath: string;
|
||||
input: TActionInput;
|
||||
checkpoint<T extends JsonValue | void>(opts: {
|
||||
key: string;
|
||||
fn: () => Promise<T> | T;
|
||||
}): Promise<T>;
|
||||
output(
|
||||
name: keyof TActionOutput,
|
||||
value: TActionOutput[keyof TActionOutput],
|
||||
): void;
|
||||
createTemporaryDirectory(): Promise<string>;
|
||||
getInitiatorCredentials(): Promise<BackstageCredentials>;
|
||||
task: {
|
||||
id: string;
|
||||
};
|
||||
templateInfo?: TemplateInfo;
|
||||
isDryRun?: boolean;
|
||||
user?: {
|
||||
entity?: UserEntity;
|
||||
ref?: string;
|
||||
};
|
||||
signal?: AbortSignal;
|
||||
each?: JsonObject;
|
||||
};
|
||||
TSchemaType extends 'v1' | 'v2' = 'v1',
|
||||
> = TSchemaType extends 'v2'
|
||||
? {
|
||||
logger: LoggerService;
|
||||
secrets?: TaskSecrets;
|
||||
workspacePath: string;
|
||||
input: TActionInput;
|
||||
checkpoint<T extends JsonValue | void>(opts: {
|
||||
key: string;
|
||||
fn: () => Promise<T> | T;
|
||||
}): Promise<T>;
|
||||
output(
|
||||
name: keyof TActionOutput,
|
||||
value: TActionOutput[keyof TActionOutput],
|
||||
): void;
|
||||
createTemporaryDirectory(): Promise<string>;
|
||||
getInitiatorCredentials(): Promise<BackstageCredentials>;
|
||||
task: {
|
||||
id: string;
|
||||
};
|
||||
templateInfo?: TemplateInfo;
|
||||
isDryRun?: boolean;
|
||||
user?: {
|
||||
entity?: UserEntity;
|
||||
ref?: string;
|
||||
};
|
||||
signal?: AbortSignal;
|
||||
each?: JsonObject;
|
||||
}
|
||||
: {
|
||||
logger: Logger;
|
||||
logStream: Writable;
|
||||
secrets?: TaskSecrets;
|
||||
workspacePath: string;
|
||||
input: TActionInput;
|
||||
checkpoint<T extends JsonValue | void>(opts: {
|
||||
key: string;
|
||||
fn: () => Promise<T> | T;
|
||||
}): Promise<T>;
|
||||
output(
|
||||
name: keyof TActionOutput,
|
||||
value: TActionOutput[keyof TActionOutput],
|
||||
): void;
|
||||
createTemporaryDirectory(): Promise<string>;
|
||||
getInitiatorCredentials(): Promise<BackstageCredentials>;
|
||||
task: {
|
||||
id: string;
|
||||
};
|
||||
templateInfo?: TemplateInfo;
|
||||
isDryRun?: boolean;
|
||||
user?: {
|
||||
entity?: UserEntity;
|
||||
ref?: string;
|
||||
};
|
||||
signal?: AbortSignal;
|
||||
each?: JsonObject;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export function addFiles(options: {
|
||||
@@ -148,34 +178,71 @@ export function createBranch(options: {
|
||||
logger?: Logger | undefined;
|
||||
}): Promise<void>;
|
||||
|
||||
// @public
|
||||
export const createTemplateAction: <
|
||||
// @public @deprecated (undocumented)
|
||||
export function createTemplateAction<
|
||||
TInputParams extends JsonObject = JsonObject,
|
||||
TOutputParams extends JsonObject = JsonObject,
|
||||
TInputSchema extends Schema | z.ZodType = {},
|
||||
TOutputSchema extends Schema | z.ZodType = {},
|
||||
TActionInput extends JsonObject = TInputSchema extends z.ZodType<
|
||||
any,
|
||||
any,
|
||||
infer IReturn
|
||||
>
|
||||
? IReturn
|
||||
: TInputParams,
|
||||
TActionOutput extends JsonObject = TOutputSchema extends z.ZodType<
|
||||
any,
|
||||
any,
|
||||
infer IReturn_1
|
||||
>
|
||||
? IReturn_1
|
||||
: TOutputParams,
|
||||
TInputSchema extends JsonObject = JsonObject,
|
||||
TOutputSchema extends JsonObject = JsonObject,
|
||||
TActionInput extends JsonObject = TInputParams,
|
||||
TActionOutput extends JsonObject = TOutputParams,
|
||||
>(
|
||||
action: TemplateActionOptions<
|
||||
TActionInput,
|
||||
TActionOutput,
|
||||
TInputSchema,
|
||||
TOutputSchema
|
||||
TOutputSchema,
|
||||
'v1'
|
||||
>,
|
||||
) => TemplateAction<TActionInput, TActionOutput>;
|
||||
): TemplateAction<TActionInput, TActionOutput, 'v1'>;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export function createTemplateAction<
|
||||
TInputParams extends JsonObject = JsonObject,
|
||||
TOutputParams extends JsonObject = JsonObject,
|
||||
TInputSchema extends z.ZodType = z.ZodType,
|
||||
TOutputSchema extends z.ZodType = z.ZodType,
|
||||
TActionInput extends JsonObject = z.infer<TInputSchema>,
|
||||
TActionOutput extends JsonObject = z.infer<TOutputSchema>,
|
||||
>(
|
||||
action: TemplateActionOptions<
|
||||
TActionInput,
|
||||
TActionOutput,
|
||||
TInputSchema,
|
||||
TOutputSchema,
|
||||
'v1'
|
||||
>,
|
||||
): TemplateAction<TActionInput, TActionOutput, 'v1'>;
|
||||
|
||||
// @public
|
||||
export function createTemplateAction<
|
||||
TInputSchema extends {
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
TOutputSchema extends {
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
>(
|
||||
action: TemplateActionOptions<
|
||||
{
|
||||
[key in keyof TInputSchema]: z.infer<ReturnType<TInputSchema[key]>>;
|
||||
},
|
||||
{
|
||||
[key in keyof TOutputSchema]: z.infer<ReturnType<TOutputSchema[key]>>;
|
||||
},
|
||||
TInputSchema,
|
||||
TOutputSchema,
|
||||
'v2'
|
||||
>,
|
||||
): TemplateAction<
|
||||
FlattenOptionalProperties<{
|
||||
[key in keyof TInputSchema]: z.output<ReturnType<TInputSchema[key]>>;
|
||||
}>,
|
||||
FlattenOptionalProperties<{
|
||||
[key in keyof TOutputSchema]: z.output<ReturnType<TOutputSchema[key]>>;
|
||||
}>,
|
||||
'v2'
|
||||
>;
|
||||
|
||||
// @public
|
||||
export function deserializeDirectoryContents(
|
||||
@@ -440,6 +507,7 @@ export type TaskStatus =
|
||||
export type TemplateAction<
|
||||
TActionInput extends JsonObject = JsonObject,
|
||||
TActionOutput extends JsonObject = JsonObject,
|
||||
TSchemaType extends 'v1' | 'v2' = 'v1',
|
||||
> = {
|
||||
id: string;
|
||||
description?: string;
|
||||
@@ -452,15 +520,28 @@ export type TemplateAction<
|
||||
input?: Schema;
|
||||
output?: Schema;
|
||||
};
|
||||
handler: (ctx: ActionContext<TActionInput, TActionOutput>) => Promise<void>;
|
||||
handler: (
|
||||
ctx: ActionContext<TActionInput, TActionOutput, TSchemaType>,
|
||||
) => Promise<void>;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type TemplateActionOptions<
|
||||
TActionInput extends JsonObject = {},
|
||||
TActionOutput extends JsonObject = {},
|
||||
TInputSchema extends Schema | z.ZodType = {},
|
||||
TOutputSchema extends Schema | z.ZodType = {},
|
||||
TInputSchema extends
|
||||
| JsonObject
|
||||
| z.ZodType
|
||||
| {
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
} = JsonObject,
|
||||
TOutputSchema extends
|
||||
| JsonObject
|
||||
| z.ZodType
|
||||
| {
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
} = JsonObject,
|
||||
TSchemaType extends 'v1' | 'v2' = 'v1' | 'v2',
|
||||
> = {
|
||||
id: string;
|
||||
description?: string;
|
||||
@@ -470,7 +551,9 @@ export type TemplateActionOptions<
|
||||
input?: TInputSchema;
|
||||
output?: TOutputSchema;
|
||||
};
|
||||
handler: (ctx: ActionContext<TActionInput, TActionOutput>) => Promise<void>;
|
||||
handler: (
|
||||
ctx: ActionContext<TActionInput, TActionOutput, TSchemaType>,
|
||||
) => Promise<void>;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
Reference in New Issue
Block a user