@backstage/plugin-scaffolder-backend 1.11.0 → 1.12.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,63 +1,73 @@
1
- /**
2
- * The Backstage backend plugin that helps you create new things
3
- *
4
- * @packageDocumentation
5
- */
6
-
7
1
  /// <reference types="node" />
8
-
9
- import { ActionContext as ActionContext_2 } from '@backstage/plugin-scaffolder-node';
10
- import { BackendFeature } from '@backstage/backend-plugin-api';
2
+ import * as _backstage_plugin_scaffolder_node from '@backstage/plugin-scaffolder-node';
3
+ import { TemplateAction as TemplateAction$1, TaskSecrets as TaskSecrets$1, ActionContext as ActionContext$1 } from '@backstage/plugin-scaffolder-node';
4
+ import { ScmIntegrations, ScmIntegrationRegistry, GithubCredentialsProvider } from '@backstage/integration';
11
5
  import { CatalogApi } from '@backstage/catalog-client';
12
- import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
13
- import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
6
+ import { UrlReader, PluginDatabaseManager } from '@backstage/backend-common';
14
7
  import { Config } from '@backstage/config';
8
+ import { JsonValue, JsonObject, Observable } from '@backstage/types';
9
+ import { Octokit } from 'octokit';
15
10
  import { createPullRequest } from 'octokit-plugin-create-pull-request';
16
- import { Entity } from '@backstage/catalog-model';
17
- import express from 'express';
18
- import { GithubCredentialsProvider } from '@backstage/integration';
19
- import { IdentityApi } from '@backstage/plugin-auth-node';
20
- import { JsonObject } from '@backstage/types';
21
- import { JsonValue } from '@backstage/types';
11
+ import { SpawnOptionsWithoutStdio } from 'child_process';
12
+ import { Writable } from 'stream';
22
13
  import { Knex } from 'knex';
23
- import { LocationSpec } from '@backstage/plugin-catalog-backend';
14
+ import * as _backstage_plugin_scaffolder_common from '@backstage/plugin-scaffolder-common';
15
+ import { TaskSpec } from '@backstage/plugin-scaffolder-common';
24
16
  import { Logger } from 'winston';
25
- import { Observable } from '@backstage/types';
26
- import { Octokit } from 'octokit';
27
- import { PluginDatabaseManager } from '@backstage/backend-common';
28
17
  import { PluginTaskScheduler } from '@backstage/backend-tasks';
29
- import { ScmIntegrationRegistry } from '@backstage/integration';
30
- import { ScmIntegrations } from '@backstage/integration';
31
- import { SpawnOptionsWithoutStdio } from 'child_process';
32
- import { TaskSecrets as TaskSecrets_2 } from '@backstage/plugin-scaffolder-node';
33
- import { TaskSpec } from '@backstage/plugin-scaffolder-common';
34
- import { TaskSpecV1beta3 } from '@backstage/plugin-scaffolder-common';
35
- import { TemplateAction as TemplateAction_2 } from '@backstage/plugin-scaffolder-node';
36
- import { UrlReader } from '@backstage/backend-common';
37
- import { Writable } from 'stream';
18
+ import express from 'express';
19
+ import { IdentityApi } from '@backstage/plugin-auth-node';
20
+ import { Entity } from '@backstage/catalog-model';
21
+ import { CatalogProcessor, LocationSpec, CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
22
+ import * as jsonschema from 'jsonschema';
23
+ import * as zod from 'zod';
38
24
 
39
25
  /**
26
+ * Registers entities from a catalog descriptor file in the workspace into the software catalog.
40
27
  * @public
41
- * @deprecated Import from {@link @backstage/plugin-scaffolder-node#ActionContext} instead
42
28
  */
43
- export declare type ActionContext<TInput extends JsonObject> = ActionContext_2<TInput>;
29
+ declare function createCatalogRegisterAction(options: {
30
+ catalogClient: CatalogApi;
31
+ integrations: ScmIntegrations;
32
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
33
+ catalogInfoUrl: string;
34
+ optional?: boolean | undefined;
35
+ } | {
36
+ repoContentsUrl: string;
37
+ catalogInfoPath?: string | undefined;
38
+ optional?: boolean | undefined;
39
+ }>;
44
40
 
45
- /* Excluded from this release type: catalogModuleTemplateKind */
41
+ /**
42
+ * Writes a catalog descriptor file containing the provided entity to a path in the workspace.
43
+ * @public
44
+ */
45
+ declare function createCatalogWriteAction(): _backstage_plugin_scaffolder_node.TemplateAction<{
46
+ filePath?: string | undefined;
47
+ entity: {};
48
+ }>;
46
49
 
47
50
  /**
48
- * A function to generate create a list of default actions that the scaffolder provides.
49
- * Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones
50
- *
51
+ * Returns entity from the catalog by entity reference.
51
52
  * @public
52
- * @returns A list of actions that can be used in the scaffolder
53
53
  */
54
- export declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction_2<JsonObject>[];
54
+ declare function createFetchCatalogEntityAction(options: {
55
+ catalogClient: CatalogApi;
56
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
57
+ entityRef: string;
58
+ optional?: boolean | undefined;
59
+ }>;
60
+
61
+ /** @public */
62
+ declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
63
+ /** @public */
64
+ declare type TemplateGlobal = ((...args: JsonValue[]) => JsonValue | undefined) | JsonValue;
55
65
 
56
66
  /**
57
67
  * The options passed to {@link createBuiltinActions}
58
68
  * @public
59
69
  */
60
- export declare interface CreateBuiltInActionsOptions {
70
+ interface CreateBuiltInActionsOptions {
61
71
  /**
62
72
  * The {@link @backstage/backend-common#UrlReader} interface that will be used in the default actions.
63
73
  */
@@ -81,31 +91,14 @@ export declare interface CreateBuiltInActionsOptions {
81
91
  additionalTemplateFilters?: Record<string, TemplateFilter>;
82
92
  additionalTemplateGlobals?: Record<string, TemplateGlobal>;
83
93
  }
84
-
85
- /**
86
- * Registers entities from a catalog descriptor file in the workspace into the software catalog.
87
- * @public
88
- */
89
- export declare function createCatalogRegisterAction(options: {
90
- catalogClient: CatalogApi;
91
- integrations: ScmIntegrations;
92
- }): TemplateAction_2< {
93
- catalogInfoUrl: string;
94
- optional?: boolean | undefined;
95
- } | {
96
- repoContentsUrl: string;
97
- catalogInfoPath?: string | undefined;
98
- optional?: boolean | undefined;
99
- }>;
100
-
101
94
  /**
102
- * Writes a catalog descriptor file containing the provided entity to a path in the workspace.
95
+ * A function to generate create a list of default actions that the scaffolder provides.
96
+ * Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones
97
+ *
103
98
  * @public
99
+ * @returns A list of actions that can be used in the scaffolder
104
100
  */
105
- export declare function createCatalogWriteAction(): TemplateAction_2< {
106
- filePath?: string | undefined;
107
- entity: Entity;
108
- }>;
101
+ declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction$1[];
109
102
 
110
103
  /**
111
104
  * Writes a message into the log or lists all files in the workspace
@@ -117,20 +110,9 @@ entity: Entity;
117
110
  *
118
111
  * @public
119
112
  */
120
- export declare function createDebugLogAction(): TemplateAction_2< {
121
- message?: string | undefined;
122
- listWorkspace?: boolean | undefined;
123
- }>;
124
-
125
- /**
126
- * Returns entity from the catalog by entity reference.
127
- * @public
128
- */
129
- export declare function createFetchCatalogEntityAction(options: {
130
- catalogClient: CatalogApi;
131
- }): TemplateAction_2< {
132
- entityRef: string;
133
- optional?: boolean | undefined;
113
+ declare function createDebugLogAction(): _backstage_plugin_scaffolder_node.TemplateAction<{
114
+ message?: string | undefined;
115
+ listWorkspace?: boolean | undefined;
134
116
  }>;
135
117
 
136
118
  /**
@@ -138,12 +120,12 @@ optional?: boolean | undefined;
138
120
  * in a subdirectory specified by the 'targetPath' input option.
139
121
  * @public
140
122
  */
141
- export declare function createFetchPlainAction(options: {
123
+ declare function createFetchPlainAction(options: {
142
124
  reader: UrlReader;
143
125
  integrations: ScmIntegrations;
144
- }): TemplateAction_2< {
145
- url: string;
146
- targetPath?: string | undefined;
126
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
127
+ url: string;
128
+ targetPath?: string | undefined;
147
129
  }>;
148
130
 
149
131
  /**
@@ -153,163 +135,170 @@ targetPath?: string | undefined;
153
135
  *
154
136
  * @public
155
137
  */
156
- export declare function createFetchTemplateAction(options: {
138
+ declare function createFetchTemplateAction(options: {
157
139
  reader: UrlReader;
158
140
  integrations: ScmIntegrations;
159
141
  additionalTemplateFilters?: Record<string, TemplateFilter>;
160
142
  additionalTemplateGlobals?: Record<string, TemplateGlobal>;
161
- }): TemplateAction_2< {
162
- url: string;
163
- targetPath?: string | undefined;
164
- values: any;
165
- templateFileExtension?: string | boolean | undefined;
166
- /**
167
- * @deprecated This field is deprecated in favor of copyWithoutTemplating.
168
- */
169
- copyWithoutRender?: string[] | undefined;
170
- copyWithoutTemplating?: string[] | undefined;
171
- cookiecutterCompat?: boolean | undefined;
172
- replace?: boolean | undefined;
143
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
144
+ url: string;
145
+ targetPath?: string | undefined;
146
+ values: any;
147
+ templateFileExtension?: string | boolean | undefined;
148
+ /**
149
+ * @deprecated This field is deprecated in favor of copyWithoutTemplating.
150
+ */
151
+ copyWithoutRender?: string[] | undefined;
152
+ copyWithoutTemplating?: string[] | undefined;
153
+ cookiecutterCompat?: boolean | undefined;
154
+ replace?: boolean | undefined;
173
155
  }>;
174
156
 
157
+ /**
158
+ * A helper function that reads the contents of a directory from the given URL.
159
+ * Can be used in your own actions, and also used behind fetch:template and fetch:plain
160
+ *
161
+ * @public
162
+ */
163
+ declare function fetchContents(options: {
164
+ reader: UrlReader;
165
+ integrations: ScmIntegrations;
166
+ baseUrl?: string;
167
+ fetchUrl?: string;
168
+ outputPath: string;
169
+ }): Promise<void>;
170
+
175
171
  /**
176
172
  * Creates new action that enables deletion of files and directories in the workspace.
177
173
  * @public
178
174
  */
179
- export declare const createFilesystemDeleteAction: () => TemplateAction_2< {
180
- files: string[];
175
+ declare const createFilesystemDeleteAction: () => _backstage_plugin_scaffolder_node.TemplateAction<{
176
+ files: string[];
181
177
  }>;
182
178
 
183
179
  /**
184
180
  * Creates a new action that allows renames of files and directories in the workspace.
185
181
  * @public
186
182
  */
187
- export declare const createFilesystemRenameAction: () => TemplateAction_2< {
188
- files: Array<{
189
- from: string;
190
- to: string;
191
- overwrite?: boolean;
183
+ declare const createFilesystemRenameAction: () => _backstage_plugin_scaffolder_node.TemplateAction<{
184
+ files: Array<{
185
+ from: string;
186
+ to: string;
187
+ overwrite?: boolean;
188
+ }>;
192
189
  }>;
190
+
191
+ /**
192
+ * Creates a new action that initializes a git repository of the content in the workspace
193
+ * and publishes it to Azure.
194
+ * @public
195
+ */
196
+ declare function createPublishAzureAction(options: {
197
+ integrations: ScmIntegrationRegistry;
198
+ config: Config;
199
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
200
+ repoUrl: string;
201
+ description?: string | undefined;
202
+ defaultBranch?: string | undefined;
203
+ sourcePath?: string | undefined;
204
+ token?: string | undefined;
205
+ gitCommitMessage?: string | undefined;
206
+ gitAuthorName?: string | undefined;
207
+ gitAuthorEmail?: string | undefined;
193
208
  }>;
194
209
 
195
210
  /**
196
- * Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.
211
+ * Creates a new action that initializes a git repository of the content in the workspace
212
+ * and publishes it to Bitbucket.
197
213
  * @public
214
+ * @deprecated in favor of createPublishBitbucketCloudAction and createPublishBitbucketServerAction
198
215
  */
199
- export declare function createGithubActionsDispatchAction(options: {
200
- integrations: ScmIntegrations;
201
- githubCredentialsProvider?: GithubCredentialsProvider;
202
- }): TemplateAction_2< {
203
- repoUrl: string;
204
- workflowId: string;
205
- branchOrTagName: string;
206
- workflowInputs?: {
207
- [key: string]: string;
208
- } | undefined;
209
- token?: string | undefined;
216
+ declare function createPublishBitbucketAction(options: {
217
+ integrations: ScmIntegrationRegistry;
218
+ config: Config;
219
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
220
+ repoUrl: string;
221
+ description?: string | undefined;
222
+ defaultBranch?: string | undefined;
223
+ repoVisibility?: "private" | "public" | undefined;
224
+ sourcePath?: string | undefined;
225
+ enableLFS?: boolean | undefined;
226
+ token?: string | undefined;
227
+ gitCommitMessage?: string | undefined;
228
+ gitAuthorName?: string | undefined;
229
+ gitAuthorEmail?: string | undefined;
210
230
  }>;
211
231
 
212
232
  /**
213
- * Adds labels to a pull request or issue on GitHub
233
+ * Creates a new action that initializes a git repository of the content in the workspace
234
+ * and publishes it to Bitbucket Cloud.
214
235
  * @public
215
236
  */
216
- export declare function createGithubIssuesLabelAction(options: {
237
+ declare function createPublishBitbucketCloudAction(options: {
217
238
  integrations: ScmIntegrationRegistry;
218
- githubCredentialsProvider?: GithubCredentialsProvider;
219
- }): TemplateAction_2< {
220
- repoUrl: string;
221
- number: number;
222
- labels: string[];
223
- token?: string | undefined;
239
+ config: Config;
240
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
241
+ repoUrl: string;
242
+ description?: string | undefined;
243
+ defaultBranch?: string | undefined;
244
+ repoVisibility?: "private" | "public" | undefined;
245
+ sourcePath?: string | undefined;
246
+ token?: string | undefined;
224
247
  }>;
225
248
 
226
249
  /**
227
- * The options passed to {@link createPublishGithubPullRequestAction} method
250
+ * Creates a new action that initializes a git repository of the content in the workspace
251
+ * and publishes it to Bitbucket Server.
228
252
  * @public
229
253
  */
230
- export declare interface CreateGithubPullRequestActionOptions {
231
- /**
232
- * An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.
233
- */
254
+ declare function createPublishBitbucketServerAction(options: {
234
255
  integrations: ScmIntegrationRegistry;
235
- /**
236
- * An instance of {@link @backstage/integration#GithubCredentialsProvider} that will be used to get credentials for the action.
237
- */
238
- githubCredentialsProvider?: GithubCredentialsProvider;
239
- /**
240
- * A method to return the Octokit client with the Pull Request Plugin.
241
- */
242
- clientFactory?: (input: CreateGithubPullRequestClientFactoryInput) => Promise<OctokitWithPullRequestPluginClient>;
243
- }
256
+ config: Config;
257
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
258
+ repoUrl: string;
259
+ description?: string | undefined;
260
+ defaultBranch?: string | undefined;
261
+ repoVisibility?: "private" | "public" | undefined;
262
+ sourcePath?: string | undefined;
263
+ enableLFS?: boolean | undefined;
264
+ token?: string | undefined;
265
+ gitCommitMessage?: string | undefined;
266
+ gitAuthorName?: string | undefined;
267
+ gitAuthorEmail?: string | undefined;
268
+ }>;
244
269
 
245
270
  /**
246
- * The options passed to the client factory function.
271
+ * Creates a new action that initializes a git repository of the content in the workspace
272
+ * and publishes it to a Gerrit instance.
247
273
  * @public
248
274
  */
249
- export declare type CreateGithubPullRequestClientFactoryInput = {
275
+ declare function createPublishGerritAction(options: {
250
276
  integrations: ScmIntegrationRegistry;
251
- githubCredentialsProvider?: GithubCredentialsProvider;
252
- host: string;
253
- owner: string;
254
- repo: string;
255
- token?: string;
256
- };
277
+ config: Config;
278
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
279
+ repoUrl: string;
280
+ description: string;
281
+ defaultBranch?: string | undefined;
282
+ gitCommitMessage?: string | undefined;
283
+ gitAuthorName?: string | undefined;
284
+ gitAuthorEmail?: string | undefined;
285
+ sourcePath?: string | undefined;
286
+ }>;
257
287
 
258
288
  /**
259
- * Creates a new action that initializes a git repository
260
- *
289
+ * Creates a new action that creates a Gerrit review
261
290
  * @public
262
291
  */
263
- export declare function createGithubRepoCreateAction(options: {
292
+ declare function createPublishGerritReviewAction(options: {
264
293
  integrations: ScmIntegrationRegistry;
265
- githubCredentialsProvider?: GithubCredentialsProvider;
266
- }): TemplateAction_2< {
267
- repoUrl: string;
268
- description?: string | undefined;
269
- homepage?: string | undefined;
270
- access?: string | undefined;
271
- deleteBranchOnMerge?: boolean | undefined;
272
- gitAuthorName?: string | undefined;
273
- gitAuthorEmail?: string | undefined;
274
- allowRebaseMerge?: boolean | undefined;
275
- allowSquashMerge?: boolean | undefined;
276
- squashMergeCommitTitle?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
277
- squashMergeCommitMessage?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
278
- allowMergeCommit?: boolean | undefined;
279
- allowAutoMerge?: boolean | undefined;
280
- requireCodeOwnerReviews?: boolean | undefined;
281
- bypassPullRequestAllowances?: {
282
- users?: string[] | undefined;
283
- teams?: string[] | undefined;
284
- apps?: string[] | undefined;
285
- } | undefined;
286
- requiredApprovingReviewCount?: number | undefined;
287
- restrictions?: {
288
- users: string[];
289
- teams: string[];
290
- apps?: string[] | undefined;
291
- } | undefined;
292
- requiredStatusCheckContexts?: string[] | undefined;
293
- requireBranchesToBeUpToDate?: boolean | undefined;
294
- requiredConversationResolution?: boolean | undefined;
295
- repoVisibility?: "internal" | "private" | "public" | undefined;
296
- collaborators?: ({
297
- user: string;
298
- access: string;
299
- } | {
300
- team: string;
301
- access: string;
302
- } | {
303
- /** @deprecated This field is deprecated in favor of team */
304
- username: string;
305
- access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
306
- })[] | undefined;
307
- hasProjects?: boolean | undefined;
308
- hasWiki?: boolean | undefined;
309
- hasIssues?: boolean | undefined;
310
- token?: string | undefined;
311
- topics?: string[] | undefined;
312
- requireCommitSigning?: boolean | undefined;
294
+ config: Config;
295
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
296
+ repoUrl: string;
297
+ branch?: string | undefined;
298
+ sourcePath?: string | undefined;
299
+ gitCommitMessage?: string | undefined;
300
+ gitAuthorName?: string | undefined;
301
+ gitAuthorEmail?: string | undefined;
313
302
  }>;
314
303
 
315
304
  /**
@@ -318,170 +307,251 @@ requireCommitSigning?: boolean | undefined;
318
307
  *
319
308
  * @public
320
309
  */
321
- export declare function createGithubRepoPushAction(options: {
310
+ declare function createPublishGithubAction(options: {
322
311
  integrations: ScmIntegrationRegistry;
323
312
  config: Config;
324
313
  githubCredentialsProvider?: GithubCredentialsProvider;
325
- }): TemplateAction_2< {
326
- repoUrl: string;
327
- description?: string | undefined;
328
- defaultBranch?: string | undefined;
329
- protectDefaultBranch?: boolean | undefined;
330
- protectEnforceAdmins?: boolean | undefined;
331
- gitCommitMessage?: string | undefined;
332
- gitAuthorName?: string | undefined;
333
- gitAuthorEmail?: string | undefined;
334
- requireCodeOwnerReviews?: boolean | undefined;
335
- dismissStaleReviews?: boolean | undefined;
336
- bypassPullRequestAllowances?: {
337
- users?: string[];
338
- teams?: string[];
339
- apps?: string[];
340
- } | undefined;
341
- requiredApprovingReviewCount?: number | undefined;
342
- restrictions?: {
343
- users: string[];
344
- teams: string[];
345
- apps?: string[];
346
- } | undefined;
347
- requiredStatusCheckContexts?: string[] | undefined;
348
- requireBranchesToBeUpToDate?: boolean | undefined;
349
- requiredConversationResolution?: boolean | undefined;
350
- sourcePath?: string | undefined;
351
- token?: string | undefined;
352
- requiredCommitSigning?: boolean | undefined;
314
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
315
+ repoUrl: string;
316
+ description?: string | undefined;
317
+ homepage?: string | undefined;
318
+ access?: string | undefined;
319
+ defaultBranch?: string | undefined;
320
+ protectDefaultBranch?: boolean | undefined;
321
+ protectEnforceAdmins?: boolean | undefined;
322
+ deleteBranchOnMerge?: boolean | undefined;
323
+ gitCommitMessage?: string | undefined;
324
+ gitAuthorName?: string | undefined;
325
+ gitAuthorEmail?: string | undefined;
326
+ allowRebaseMerge?: boolean | undefined;
327
+ allowSquashMerge?: boolean | undefined;
328
+ squashMergeCommitTitle?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
329
+ squashMergeCommitMessage?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
330
+ allowMergeCommit?: boolean | undefined;
331
+ allowAutoMerge?: boolean | undefined;
332
+ sourcePath?: string | undefined;
333
+ bypassPullRequestAllowances?: {
334
+ users?: string[];
335
+ teams?: string[];
336
+ apps?: string[];
337
+ } | undefined;
338
+ requiredApprovingReviewCount?: number | undefined;
339
+ restrictions?: {
340
+ users: string[];
341
+ teams: string[];
342
+ apps?: string[];
343
+ } | undefined;
344
+ requireCodeOwnerReviews?: boolean | undefined;
345
+ dismissStaleReviews?: boolean | undefined;
346
+ requiredStatusCheckContexts?: string[] | undefined;
347
+ requireBranchesToBeUpToDate?: boolean | undefined;
348
+ requiredConversationResolution?: boolean | undefined;
349
+ repoVisibility?: "internal" | "private" | "public" | undefined;
350
+ collaborators?: ({
351
+ user: string;
352
+ access: string;
353
+ } | {
354
+ team: string;
355
+ access: string;
356
+ } | {
357
+ /** @deprecated This field is deprecated in favor of team */
358
+ username: string;
359
+ access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
360
+ })[] | undefined;
361
+ hasProjects?: boolean | undefined;
362
+ hasWiki?: boolean | undefined;
363
+ hasIssues?: boolean | undefined;
364
+ token?: string | undefined;
365
+ topics?: string[] | undefined;
366
+ requiredCommitSigning?: boolean | undefined;
353
367
  }>;
354
368
 
369
+ /** @public */
370
+ declare type OctokitWithPullRequestPluginClient = Octokit & {
371
+ createPullRequest(options: createPullRequest.Options): Promise<{
372
+ data: {
373
+ html_url: string;
374
+ number: number;
375
+ };
376
+ } | null>;
377
+ };
355
378
  /**
356
- * Creates new action that creates a webhook for a repository on GitHub.
379
+ * The options passed to the client factory function.
357
380
  * @public
358
381
  */
359
- export declare function createGithubWebhookAction(options: {
382
+ declare type CreateGithubPullRequestClientFactoryInput = {
360
383
  integrations: ScmIntegrationRegistry;
361
- defaultWebhookSecret?: string;
362
384
  githubCredentialsProvider?: GithubCredentialsProvider;
363
- }): TemplateAction_2< {
364
- repoUrl: string;
365
- webhookUrl: string;
366
- webhookSecret?: string | undefined;
367
- events?: string[] | undefined;
368
- active?: boolean | undefined;
369
- contentType?: "form" | "json" | undefined;
370
- insecureSsl?: boolean | undefined;
371
- token?: string | undefined;
372
- }>;
373
-
385
+ host: string;
386
+ owner: string;
387
+ repo: string;
388
+ token?: string;
389
+ };
374
390
  /**
375
- * Creates a new action that initializes a git repository of the content in the workspace
376
- * and publishes it to Azure.
391
+ * The options passed to {@link createPublishGithubPullRequestAction} method
377
392
  * @public
378
393
  */
379
- export declare function createPublishAzureAction(options: {
394
+ interface CreateGithubPullRequestActionOptions {
395
+ /**
396
+ * An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.
397
+ */
380
398
  integrations: ScmIntegrationRegistry;
381
- config: Config;
382
- }): TemplateAction_2< {
383
- repoUrl: string;
384
- description?: string | undefined;
385
- defaultBranch?: string | undefined;
386
- sourcePath?: string | undefined;
387
- token?: string | undefined;
388
- gitCommitMessage?: string | undefined;
389
- gitAuthorName?: string | undefined;
390
- gitAuthorEmail?: string | undefined;
399
+ /**
400
+ * An instance of {@link @backstage/integration#GithubCredentialsProvider} that will be used to get credentials for the action.
401
+ */
402
+ githubCredentialsProvider?: GithubCredentialsProvider;
403
+ /**
404
+ * A method to return the Octokit client with the Pull Request Plugin.
405
+ */
406
+ clientFactory?: (input: CreateGithubPullRequestClientFactoryInput) => Promise<OctokitWithPullRequestPluginClient>;
407
+ }
408
+ /**
409
+ * Creates a Github Pull Request action.
410
+ * @public
411
+ */
412
+ declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => _backstage_plugin_scaffolder_node.TemplateAction<{
413
+ title: string;
414
+ branchName: string;
415
+ description: string;
416
+ repoUrl: string;
417
+ draft?: boolean | undefined;
418
+ targetPath?: string | undefined;
419
+ sourcePath?: string | undefined;
420
+ token?: string | undefined;
421
+ reviewers?: string[] | undefined;
422
+ teamReviewers?: string[] | undefined;
391
423
  }>;
392
424
 
393
425
  /**
394
426
  * Creates a new action that initializes a git repository of the content in the workspace
395
- * and publishes it to Bitbucket.
427
+ * and publishes it to GitLab.
428
+ *
396
429
  * @public
397
- * @deprecated in favor of createPublishBitbucketCloudAction and createPublishBitbucketServerAction
398
430
  */
399
- export declare function createPublishBitbucketAction(options: {
431
+ declare function createPublishGitlabAction(options: {
400
432
  integrations: ScmIntegrationRegistry;
401
433
  config: Config;
402
- }): TemplateAction_2< {
403
- repoUrl: string;
404
- description?: string | undefined;
405
- defaultBranch?: string | undefined;
406
- repoVisibility?: "private" | "public" | undefined;
407
- sourcePath?: string | undefined;
408
- enableLFS?: boolean | undefined;
409
- token?: string | undefined;
410
- gitCommitMessage?: string | undefined;
411
- gitAuthorName?: string | undefined;
412
- gitAuthorEmail?: string | undefined;
434
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
435
+ repoUrl: string;
436
+ defaultBranch?: string | undefined;
437
+ repoVisibility?: "internal" | "private" | "public" | undefined;
438
+ sourcePath?: string | undefined;
439
+ token?: string | undefined;
440
+ gitCommitMessage?: string | undefined;
441
+ gitAuthorName?: string | undefined;
442
+ gitAuthorEmail?: string | undefined;
443
+ setUserAsOwner?: boolean | undefined;
444
+ topics?: string[] | undefined;
413
445
  }>;
414
446
 
415
447
  /**
416
- * Creates a new action that initializes a git repository of the content in the workspace
417
- * and publishes it to Bitbucket Cloud.
448
+ * Create a new action that creates a gitlab merge request.
449
+ *
418
450
  * @public
419
451
  */
420
- export declare function createPublishBitbucketCloudAction(options: {
452
+ declare const createPublishGitlabMergeRequestAction: (options: {
421
453
  integrations: ScmIntegrationRegistry;
422
- config: Config;
423
- }): TemplateAction_2< {
424
- repoUrl: string;
425
- description?: string | undefined;
426
- defaultBranch?: string | undefined;
427
- repoVisibility?: "private" | "public" | undefined;
428
- sourcePath?: string | undefined;
429
- token?: string | undefined;
454
+ }) => _backstage_plugin_scaffolder_node.TemplateAction<{
455
+ repoUrl: string;
456
+ title: string;
457
+ description: string;
458
+ branchName: string;
459
+ sourcePath?: string | undefined;
460
+ targetPath?: string | undefined;
461
+ token?: string | undefined;
462
+ commitAction?: "update" | "delete" | "create" | undefined;
463
+ /** @deprecated projectID passed as query parameters in the repoUrl */
464
+ projectid?: string | undefined;
465
+ removeSourceBranch?: boolean | undefined;
466
+ assignee?: string | undefined;
430
467
  }>;
431
468
 
432
469
  /**
433
- * Creates a new action that initializes a git repository of the content in the workspace
434
- * and publishes it to Bitbucket Server.
470
+ * Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.
435
471
  * @public
436
472
  */
437
- export declare function createPublishBitbucketServerAction(options: {
438
- integrations: ScmIntegrationRegistry;
439
- config: Config;
440
- }): TemplateAction_2< {
441
- repoUrl: string;
442
- description?: string | undefined;
443
- defaultBranch?: string | undefined;
444
- repoVisibility?: "private" | "public" | undefined;
445
- sourcePath?: string | undefined;
446
- enableLFS?: boolean | undefined;
447
- token?: string | undefined;
448
- gitCommitMessage?: string | undefined;
449
- gitAuthorName?: string | undefined;
450
- gitAuthorEmail?: string | undefined;
473
+ declare function createGithubActionsDispatchAction(options: {
474
+ integrations: ScmIntegrations;
475
+ githubCredentialsProvider?: GithubCredentialsProvider;
476
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
477
+ repoUrl: string;
478
+ workflowId: string;
479
+ branchOrTagName: string;
480
+ workflowInputs?: {
481
+ [key: string]: string;
482
+ } | undefined;
483
+ token?: string | undefined;
451
484
  }>;
452
485
 
453
486
  /**
454
- * Creates a new action that initializes a git repository of the content in the workspace
455
- * and publishes it to a Gerrit instance.
487
+ * Adds labels to a pull request or issue on GitHub
456
488
  * @public
457
489
  */
458
- export declare function createPublishGerritAction(options: {
490
+ declare function createGithubIssuesLabelAction(options: {
459
491
  integrations: ScmIntegrationRegistry;
460
- config: Config;
461
- }): TemplateAction_2< {
462
- repoUrl: string;
463
- description: string;
464
- defaultBranch?: string | undefined;
465
- gitCommitMessage?: string | undefined;
466
- gitAuthorName?: string | undefined;
467
- gitAuthorEmail?: string | undefined;
468
- sourcePath?: string | undefined;
492
+ githubCredentialsProvider?: GithubCredentialsProvider;
493
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
494
+ repoUrl: string;
495
+ number: number;
496
+ labels: string[];
497
+ token?: string | undefined;
469
498
  }>;
470
499
 
471
500
  /**
472
- * Creates a new action that creates a Gerrit review
501
+ * Creates a new action that initializes a git repository
502
+ *
473
503
  * @public
474
504
  */
475
- export declare function createPublishGerritReviewAction(options: {
505
+ declare function createGithubRepoCreateAction(options: {
476
506
  integrations: ScmIntegrationRegistry;
477
- config: Config;
478
- }): TemplateAction_2< {
479
- repoUrl: string;
480
- branch?: string | undefined;
481
- sourcePath?: string | undefined;
482
- gitCommitMessage?: string | undefined;
483
- gitAuthorName?: string | undefined;
484
- gitAuthorEmail?: string | undefined;
507
+ githubCredentialsProvider?: GithubCredentialsProvider;
508
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
509
+ repoUrl: string;
510
+ description?: string | undefined;
511
+ homepage?: string | undefined;
512
+ access?: string | undefined;
513
+ deleteBranchOnMerge?: boolean | undefined;
514
+ gitAuthorName?: string | undefined;
515
+ gitAuthorEmail?: string | undefined;
516
+ allowRebaseMerge?: boolean | undefined;
517
+ allowSquashMerge?: boolean | undefined;
518
+ squashMergeCommitTitle?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
519
+ squashMergeCommitMessage?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
520
+ allowMergeCommit?: boolean | undefined;
521
+ allowAutoMerge?: boolean | undefined;
522
+ requireCodeOwnerReviews?: boolean | undefined;
523
+ bypassPullRequestAllowances?: {
524
+ users?: string[] | undefined;
525
+ teams?: string[] | undefined;
526
+ apps?: string[] | undefined;
527
+ } | undefined;
528
+ requiredApprovingReviewCount?: number | undefined;
529
+ restrictions?: {
530
+ users: string[];
531
+ teams: string[];
532
+ apps?: string[] | undefined;
533
+ } | undefined;
534
+ requiredStatusCheckContexts?: string[] | undefined;
535
+ requireBranchesToBeUpToDate?: boolean | undefined;
536
+ requiredConversationResolution?: boolean | undefined;
537
+ repoVisibility?: "internal" | "private" | "public" | undefined;
538
+ collaborators?: ({
539
+ user: string;
540
+ access: string;
541
+ } | {
542
+ team: string;
543
+ access: string;
544
+ } | {
545
+ /** @deprecated This field is deprecated in favor of team */
546
+ username: string;
547
+ access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
548
+ })[] | undefined;
549
+ hasProjects?: boolean | undefined;
550
+ hasWiki?: boolean | undefined;
551
+ hasIssues?: boolean | undefined;
552
+ token?: string | undefined;
553
+ topics?: string[] | undefined;
554
+ requireCommitSigning?: boolean | undefined;
485
555
  }>;
486
556
 
487
557
  /**
@@ -490,358 +560,172 @@ gitAuthorEmail?: string | undefined;
490
560
  *
491
561
  * @public
492
562
  */
493
- export declare function createPublishGithubAction(options: {
563
+ declare function createGithubRepoPushAction(options: {
494
564
  integrations: ScmIntegrationRegistry;
495
565
  config: Config;
496
566
  githubCredentialsProvider?: GithubCredentialsProvider;
497
- }): TemplateAction_2< {
498
- repoUrl: string;
499
- description?: string | undefined;
500
- homepage?: string | undefined;
501
- access?: string | undefined;
502
- defaultBranch?: string | undefined;
503
- protectDefaultBranch?: boolean | undefined;
504
- protectEnforceAdmins?: boolean | undefined;
505
- deleteBranchOnMerge?: boolean | undefined;
506
- gitCommitMessage?: string | undefined;
507
- gitAuthorName?: string | undefined;
508
- gitAuthorEmail?: string | undefined;
509
- allowRebaseMerge?: boolean | undefined;
510
- allowSquashMerge?: boolean | undefined;
511
- squashMergeCommitTitle?: "PR_TITLE" | "COMMIT_OR_PR_TITLE" | undefined;
512
- squashMergeCommitMessage?: "PR_BODY" | "COMMIT_MESSAGES" | "BLANK" | undefined;
513
- allowMergeCommit?: boolean | undefined;
514
- allowAutoMerge?: boolean | undefined;
515
- sourcePath?: string | undefined;
516
- bypassPullRequestAllowances?: {
517
- users?: string[];
518
- teams?: string[];
519
- apps?: string[];
520
- } | undefined;
521
- requiredApprovingReviewCount?: number | undefined;
522
- restrictions?: {
523
- users: string[];
524
- teams: string[];
525
- apps?: string[];
526
- } | undefined;
527
- requireCodeOwnerReviews?: boolean | undefined;
528
- dismissStaleReviews?: boolean | undefined;
529
- requiredStatusCheckContexts?: string[] | undefined;
530
- requireBranchesToBeUpToDate?: boolean | undefined;
531
- requiredConversationResolution?: boolean | undefined;
532
- repoVisibility?: "internal" | "private" | "public" | undefined;
533
- collaborators?: ({
534
- user: string;
535
- access: string;
536
- } | {
537
- team: string;
538
- access: string;
539
- } | {
540
- /** @deprecated This field is deprecated in favor of team */
541
- username: string;
542
- access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
543
- })[] | undefined;
544
- hasProjects?: boolean | undefined;
545
- hasWiki?: boolean | undefined;
546
- hasIssues?: boolean | undefined;
547
- token?: string | undefined;
548
- topics?: string[] | undefined;
549
- requiredCommitSigning?: boolean | undefined;
567
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
568
+ repoUrl: string;
569
+ description?: string | undefined;
570
+ defaultBranch?: string | undefined;
571
+ protectDefaultBranch?: boolean | undefined;
572
+ protectEnforceAdmins?: boolean | undefined;
573
+ gitCommitMessage?: string | undefined;
574
+ gitAuthorName?: string | undefined;
575
+ gitAuthorEmail?: string | undefined;
576
+ requireCodeOwnerReviews?: boolean | undefined;
577
+ dismissStaleReviews?: boolean | undefined;
578
+ bypassPullRequestAllowances?: {
579
+ users?: string[];
580
+ teams?: string[];
581
+ apps?: string[];
582
+ } | undefined;
583
+ requiredApprovingReviewCount?: number | undefined;
584
+ restrictions?: {
585
+ users: string[];
586
+ teams: string[];
587
+ apps?: string[];
588
+ } | undefined;
589
+ requiredStatusCheckContexts?: string[] | undefined;
590
+ requireBranchesToBeUpToDate?: boolean | undefined;
591
+ requiredConversationResolution?: boolean | undefined;
592
+ sourcePath?: string | undefined;
593
+ token?: string | undefined;
594
+ requiredCommitSigning?: boolean | undefined;
550
595
  }>;
551
596
 
552
597
  /**
553
- * Creates a Github Pull Request action.
598
+ * Creates new action that creates a webhook for a repository on GitHub.
554
599
  * @public
555
600
  */
556
- export declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction_2< {
557
- title: string;
558
- branchName: string;
559
- description: string;
560
- repoUrl: string;
561
- draft?: boolean | undefined;
562
- targetPath?: string | undefined;
563
- sourcePath?: string | undefined;
564
- token?: string | undefined;
565
- reviewers?: string[] | undefined;
566
- teamReviewers?: string[] | undefined;
601
+ declare function createGithubWebhookAction(options: {
602
+ integrations: ScmIntegrationRegistry;
603
+ defaultWebhookSecret?: string;
604
+ githubCredentialsProvider?: GithubCredentialsProvider;
605
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
606
+ repoUrl: string;
607
+ webhookUrl: string;
608
+ webhookSecret?: string | undefined;
609
+ events?: string[] | undefined;
610
+ active?: boolean | undefined;
611
+ contentType?: "form" | "json" | undefined;
612
+ insecureSsl?: boolean | undefined;
613
+ token?: string | undefined;
567
614
  }>;
568
615
 
616
+ /** @public */
617
+ declare type RunCommandOptions = {
618
+ /** command to run */
619
+ command: string;
620
+ /** arguments to pass the command */
621
+ args: string[];
622
+ /** options to pass to spawn */
623
+ options?: SpawnOptionsWithoutStdio;
624
+ /** stream to capture stdout and stderr output */
625
+ logStream?: Writable;
626
+ };
569
627
  /**
570
- * Creates a new action that initializes a git repository of the content in the workspace
571
- * and publishes it to GitLab.
628
+ * Run a command in a sub-process, normally a shell command.
572
629
  *
573
630
  * @public
574
631
  */
575
- export declare function createPublishGitlabAction(options: {
576
- integrations: ScmIntegrationRegistry;
577
- config: Config;
578
- }): TemplateAction_2< {
579
- repoUrl: string;
580
- defaultBranch?: string | undefined;
581
- repoVisibility?: "internal" | "private" | "public" | undefined;
582
- sourcePath?: string | undefined;
583
- token?: string | undefined;
584
- gitCommitMessage?: string | undefined;
585
- gitAuthorName?: string | undefined;
586
- gitAuthorEmail?: string | undefined;
587
- setUserAsOwner?: boolean | undefined;
588
- topics?: string[] | undefined;
589
- }>;
632
+ declare const executeShellCommand: (options: RunCommandOptions) => Promise<void>;
590
633
 
591
634
  /**
592
- * Create a new action that creates a gitlab merge request.
593
- *
635
+ * Registry of all registered template actions.
594
636
  * @public
595
637
  */
596
- export declare const createPublishGitlabMergeRequestAction: (options: {
597
- integrations: ScmIntegrationRegistry;
598
- }) => TemplateAction_2< {
599
- repoUrl: string;
600
- title: string;
601
- description: string;
602
- branchName: string;
603
- sourcePath?: string | undefined;
604
- targetPath?: string | undefined;
605
- token?: string | undefined;
606
- commitAction?: "update" | "delete" | "create" | undefined;
607
- /** @deprecated projectID passed as query parameters in the repoUrl */
608
- projectid?: string | undefined;
609
- removeSourceBranch?: boolean | undefined;
610
- assignee?: string | undefined;
611
- }>;
638
+ declare class TemplateActionRegistry {
639
+ private readonly actions;
640
+ register(action: TemplateAction$1): void;
641
+ get(actionId: string): TemplateAction$1;
642
+ list(): TemplateAction$1[];
643
+ }
612
644
 
613
645
  /**
614
- * A method to create a router for the scaffolder backend plugin.
646
+ * The status of each step of the Task
647
+ *
615
648
  * @public
616
649
  */
617
- export declare function createRouter(options: RouterOptions): Promise<express.Router>;
618
-
650
+ declare type TaskStatus = 'open' | 'processing' | 'failed' | 'cancelled' | 'completed';
619
651
  /**
652
+ * The state of a completed task.
653
+ *
620
654
  * @public
621
- * @deprecated Use `createTemplateAction` from `@backstage/plugin-scaffolder-node` instead
622
655
  */
623
- export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction_2<TInput>) => TemplateAction_2<TInput>;
624
-
656
+ declare type TaskCompletionState = 'failed' | 'completed';
625
657
  /**
626
- * CreateWorkerOptions
658
+ * SerializedTask
627
659
  *
628
660
  * @public
629
661
  */
630
- export declare type CreateWorkerOptions = {
631
- taskBroker: TaskBroker;
632
- actionRegistry: TemplateActionRegistry;
633
- integrations: ScmIntegrations;
634
- workingDirectory: string;
635
- logger: Logger;
636
- additionalTemplateFilters?: Record<string, TemplateFilter>;
637
- /**
638
- * The number of tasks that can be executed at the same time by the worker
639
- * @defaultValue 10
640
- * @example
641
- * ```
642
- * {
643
- * concurrentTasksLimit: 1,
644
- * // OR
645
- * concurrentTasksLimit: Infinity
646
- * }
647
- * ```
648
- */
649
- concurrentTasksLimit?: number;
650
- additionalTemplateGlobals?: Record<string, TemplateGlobal>;
651
- };
652
-
653
- /**
654
- * Stores the state of the current claimed task passed to the TaskContext
655
- *
656
- * @public
657
- */
658
- export declare interface CurrentClaimedTask {
659
- /**
660
- * The TaskSpec of the current claimed task.
661
- */
662
+ declare type SerializedTask = {
663
+ id: string;
662
664
  spec: TaskSpec;
663
- /**
664
- * The uuid of the current claimed task.
665
- */
666
- taskId: string;
667
- /**
668
- * The secrets that are stored with the task.
669
- */
670
- secrets?: TaskSecrets_2;
671
- /**
672
- * The creator of the task.
673
- */
665
+ status: TaskStatus;
666
+ createdAt: string;
667
+ lastHeartbeatAt?: string;
674
668
  createdBy?: string;
675
- }
676
-
677
- /**
678
- * DatabaseTaskStore
679
- *
680
- * @public
681
- */
682
- export declare class DatabaseTaskStore implements TaskStore {
683
- private readonly db;
684
- static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
685
- private static getClient;
686
- private static runMigrations;
687
- private constructor();
688
- list(options: {
689
- createdBy?: string;
690
- }): Promise<{
691
- tasks: SerializedTask[];
692
- }>;
693
- getTask(taskId: string): Promise<SerializedTask>;
694
- createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
695
- claimTask(): Promise<SerializedTask | undefined>;
696
- heartbeatTask(taskId: string): Promise<void>;
697
- listStaleTasks(options: {
698
- timeoutS: number;
699
- }): Promise<{
700
- tasks: {
701
- taskId: string;
702
- }[];
703
- }>;
704
- completeTask(options: {
705
- taskId: string;
706
- status: TaskStatus;
707
- eventBody: JsonObject;
708
- }): Promise<void>;
709
- emitLogEvent(options: TaskStoreEmitOptions<{
710
- message: string;
711
- } & JsonObject>): Promise<void>;
712
- listEvents(options: TaskStoreListEventsOptions): Promise<{
713
- events: SerializedTaskEvent[];
714
- }>;
715
- shutdownTask({ taskId }: TaskStoreShutDownTaskOptions): Promise<void>;
716
- }
717
-
718
- /**
719
- * DatabaseTaskStore
720
- *
721
- * @public
722
- */
723
- export declare type DatabaseTaskStoreOptions = {
724
- database: PluginDatabaseManager | Knex;
669
+ secrets?: TaskSecrets$1;
725
670
  };
726
-
727
671
  /**
728
- * Run a command in a sub-process, normally a shell command.
672
+ * TaskEventType
729
673
  *
730
674
  * @public
731
675
  */
732
- export declare const executeShellCommand: (options: RunCommandOptions) => Promise<void>;
733
-
676
+ declare type TaskEventType = 'completion' | 'log';
734
677
  /**
735
- * A helper function that reads the contents of a directory from the given URL.
736
- * Can be used in your own actions, and also used behind fetch:template and fetch:plain
678
+ * SerializedTaskEvent
737
679
  *
738
680
  * @public
739
681
  */
740
- export declare function fetchContents(options: {
741
- reader: UrlReader;
742
- integrations: ScmIntegrations;
743
- baseUrl?: string;
744
- fetchUrl?: string;
745
- outputPath: string;
746
- }): Promise<void>;
747
-
748
- /** @public */
749
- export declare type OctokitWithPullRequestPluginClient = Octokit & {
750
- createPullRequest(options: createPullRequest.Options): Promise<{
751
- data: {
752
- html_url: string;
753
- number: number;
754
- };
755
- } | null>;
682
+ declare type SerializedTaskEvent = {
683
+ id: number;
684
+ taskId: string;
685
+ body: JsonObject;
686
+ type: TaskEventType;
687
+ createdAt: string;
756
688
  };
757
-
758
689
  /**
759
- * RouterOptions
690
+ * The result of {@link TaskBroker.dispatch}
760
691
  *
761
692
  * @public
762
693
  */
763
- export declare interface RouterOptions {
764
- logger: Logger;
765
- config: Config;
766
- reader: UrlReader;
767
- database: PluginDatabaseManager;
768
- catalogClient: CatalogApi;
769
- scheduler?: PluginTaskScheduler;
770
- actions?: TemplateAction_2<any>[];
771
- /**
772
- * @deprecated taskWorkers is deprecated in favor of concurrentTasksLimit option with a single TaskWorker
773
- * @defaultValue 1
774
- */
775
- taskWorkers?: number;
776
- /**
777
- * Sets the number of concurrent tasks that can be run at any given time on the TaskWorker
778
- * @defaultValue 10
779
- */
780
- concurrentTasksLimit?: number;
781
- taskBroker?: TaskBroker;
782
- additionalTemplateFilters?: Record<string, TemplateFilter>;
783
- additionalTemplateGlobals?: Record<string, TemplateGlobal>;
784
- identity?: IdentityApi;
785
- }
786
-
787
- /** @public */
788
- export declare type RunCommandOptions = {
789
- /** command to run */
790
- command: string;
791
- /** arguments to pass the command */
792
- args: string[];
793
- /** options to pass to spawn */
794
- options?: SpawnOptionsWithoutStdio;
795
- /** stream to capture stdout and stderr output */
796
- logStream?: Writable;
694
+ declare type TaskBrokerDispatchResult = {
695
+ taskId: string;
797
696
  };
798
-
799
- /** @public */
800
- export declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
801
- getProcessorName(): string;
802
- private readonly validators;
803
- validateEntityKind(entity: Entity): Promise<boolean>;
804
- postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
805
- }
806
-
807
- /* Excluded from this release type: scaffolderPlugin */
808
-
809
- /* Excluded from this release type: ScaffolderPluginOptions */
810
-
811
697
  /**
812
- * SerializedTask
698
+ * The options passed to {@link TaskBroker.dispatch}
699
+ * Currently a spec and optional secrets
813
700
  *
814
701
  * @public
815
702
  */
816
- export declare type SerializedTask = {
817
- id: string;
703
+ declare type TaskBrokerDispatchOptions = {
818
704
  spec: TaskSpec;
819
- status: TaskStatus;
820
- createdAt: string;
821
- lastHeartbeatAt?: string;
705
+ secrets?: TaskSecrets$1;
822
706
  createdBy?: string;
823
- secrets?: TaskSecrets_2;
824
707
  };
825
-
826
708
  /**
827
- * SerializedTaskEvent
709
+ * Task
828
710
  *
829
711
  * @public
830
712
  */
831
- export declare type SerializedTaskEvent = {
832
- id: number;
833
- taskId: string;
834
- body: JsonObject;
835
- type: TaskEventType;
836
- createdAt: string;
837
- };
838
-
713
+ interface TaskContext {
714
+ spec: TaskSpec;
715
+ secrets?: TaskSecrets$1;
716
+ createdBy?: string;
717
+ done: boolean;
718
+ isDryRun?: boolean;
719
+ emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
720
+ complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
721
+ getWorkspaceName(): Promise<string>;
722
+ }
839
723
  /**
840
724
  * TaskBroker
841
725
  *
842
726
  * @public
843
727
  */
844
- export declare interface TaskBroker {
728
+ interface TaskBroker {
845
729
  claim(): Promise<TaskContext>;
846
730
  dispatch(options: TaskBrokerDispatchOptions): Promise<TaskBrokerDispatchResult>;
847
731
  vacuumTasks(options: {
@@ -860,100 +744,54 @@ export declare interface TaskBroker {
860
744
  tasks: SerializedTask[];
861
745
  }>;
862
746
  }
863
-
864
747
  /**
865
- * The options passed to {@link TaskBroker.dispatch}
866
- * Currently a spec and optional secrets
748
+ * TaskStoreEmitOptions
867
749
  *
868
750
  * @public
869
751
  */
870
- export declare type TaskBrokerDispatchOptions = {
871
- spec: TaskSpec;
872
- secrets?: TaskSecrets_2;
873
- createdBy?: string;
752
+ declare type TaskStoreEmitOptions<TBody = JsonObject> = {
753
+ taskId: string;
754
+ body: TBody;
874
755
  };
875
-
876
756
  /**
877
- * The result of {@link TaskBroker.dispatch}
757
+ * TaskStoreListEventsOptions
878
758
  *
879
759
  * @public
880
760
  */
881
- export declare type TaskBrokerDispatchResult = {
761
+ declare type TaskStoreListEventsOptions = {
882
762
  taskId: string;
763
+ after?: number | undefined;
883
764
  };
884
-
885
765
  /**
886
- * The state of a completed task.
766
+ * TaskStoreShutDownTaskOptions
887
767
  *
888
768
  * @public
889
769
  */
890
- export declare type TaskCompletionState = 'failed' | 'completed';
891
-
770
+ declare type TaskStoreShutDownTaskOptions = {
771
+ taskId: string;
772
+ };
892
773
  /**
893
- * Task
894
- *
774
+ * The options passed to {@link TaskStore.createTask}
895
775
  * @public
896
776
  */
897
- export declare interface TaskContext {
777
+ declare type TaskStoreCreateTaskOptions = {
898
778
  spec: TaskSpec;
899
- secrets?: TaskSecrets_2;
900
779
  createdBy?: string;
901
- done: boolean;
902
- isDryRun?: boolean;
903
- emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
904
- complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
905
- getWorkspaceName(): Promise<string>;
906
- }
907
-
908
- /**
909
- * TaskEventType
910
- *
911
- * @public
912
- */
913
- export declare type TaskEventType = 'completion' | 'log';
914
-
915
- /**
916
- * TaskManager
917
- *
918
- * @public
919
- */
920
- export declare class TaskManager implements TaskContext {
921
- private readonly task;
922
- private readonly storage;
923
- private readonly logger;
924
- private isDone;
925
- private heartbeatTimeoutId?;
926
- static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
927
- private constructor();
928
- get spec(): TaskSpecV1beta3;
929
- get secrets(): TaskSecrets_2 | undefined;
930
- get createdBy(): string | undefined;
931
- getWorkspaceName(): Promise<string>;
932
- get done(): boolean;
933
- emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
934
- complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
935
- private startTimeout;
936
- }
937
-
938
- /**
939
- * @public
940
- * @deprecated Use `TaskSecrets` from `@backstage/plugin-scaffolder-node` instead
941
- */
942
- export declare type TaskSecrets = TaskSecrets_2;
943
-
780
+ secrets?: TaskSecrets$1;
781
+ };
944
782
  /**
945
- * The status of each step of the Task
946
- *
783
+ * The response from {@link TaskStore.createTask}
947
784
  * @public
948
785
  */
949
- export declare type TaskStatus = 'open' | 'processing' | 'failed' | 'cancelled' | 'completed';
950
-
786
+ declare type TaskStoreCreateTaskResult = {
787
+ taskId: string;
788
+ };
951
789
  /**
952
790
  * TaskStore
953
791
  *
954
792
  * @public
955
793
  */
956
- export declare interface TaskStore {
794
+ interface TaskStore {
957
795
  createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
958
796
  getTask(taskId: string): Promise<SerializedTask>;
959
797
  claimTask(): Promise<SerializedTask | undefined>;
@@ -983,58 +821,133 @@ export declare interface TaskStore {
983
821
  }
984
822
 
985
823
  /**
986
- * The options passed to {@link TaskStore.createTask}
824
+ * DatabaseTaskStore
825
+ *
987
826
  * @public
988
827
  */
989
- export declare type TaskStoreCreateTaskOptions = {
990
- spec: TaskSpec;
991
- createdBy?: string;
992
- secrets?: TaskSecrets_2;
828
+ declare type DatabaseTaskStoreOptions = {
829
+ database: PluginDatabaseManager | Knex;
993
830
  };
994
-
995
831
  /**
996
- * The response from {@link TaskStore.createTask}
832
+ * DatabaseTaskStore
833
+ *
997
834
  * @public
998
835
  */
999
- export declare type TaskStoreCreateTaskResult = {
1000
- taskId: string;
1001
- };
836
+ declare class DatabaseTaskStore implements TaskStore {
837
+ private readonly db;
838
+ static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
839
+ private static getClient;
840
+ private static runMigrations;
841
+ private constructor();
842
+ list(options: {
843
+ createdBy?: string;
844
+ }): Promise<{
845
+ tasks: SerializedTask[];
846
+ }>;
847
+ getTask(taskId: string): Promise<SerializedTask>;
848
+ createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
849
+ claimTask(): Promise<SerializedTask | undefined>;
850
+ heartbeatTask(taskId: string): Promise<void>;
851
+ listStaleTasks(options: {
852
+ timeoutS: number;
853
+ }): Promise<{
854
+ tasks: {
855
+ taskId: string;
856
+ }[];
857
+ }>;
858
+ completeTask(options: {
859
+ taskId: string;
860
+ status: TaskStatus;
861
+ eventBody: JsonObject;
862
+ }): Promise<void>;
863
+ emitLogEvent(options: TaskStoreEmitOptions<{
864
+ message: string;
865
+ } & JsonObject>): Promise<void>;
866
+ listEvents(options: TaskStoreListEventsOptions): Promise<{
867
+ events: SerializedTaskEvent[];
868
+ }>;
869
+ shutdownTask({ taskId }: TaskStoreShutDownTaskOptions): Promise<void>;
870
+ }
1002
871
 
1003
872
  /**
1004
- * TaskStoreEmitOptions
873
+ * TaskManager
1005
874
  *
1006
875
  * @public
1007
876
  */
1008
- export declare type TaskStoreEmitOptions<TBody = JsonObject> = {
1009
- taskId: string;
1010
- body: TBody;
1011
- };
1012
-
877
+ declare class TaskManager implements TaskContext {
878
+ private readonly task;
879
+ private readonly storage;
880
+ private readonly logger;
881
+ private isDone;
882
+ private heartbeatTimeoutId?;
883
+ static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
884
+ private constructor();
885
+ get spec(): _backstage_plugin_scaffolder_common.TaskSpecV1beta3;
886
+ get secrets(): TaskSecrets$1 | undefined;
887
+ get createdBy(): string | undefined;
888
+ getWorkspaceName(): Promise<string>;
889
+ get done(): boolean;
890
+ emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
891
+ complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
892
+ private startTimeout;
893
+ }
1013
894
  /**
1014
- * TaskStoreListEventsOptions
895
+ * Stores the state of the current claimed task passed to the TaskContext
1015
896
  *
1016
897
  * @public
1017
898
  */
1018
- export declare type TaskStoreListEventsOptions = {
899
+ interface CurrentClaimedTask {
900
+ /**
901
+ * The TaskSpec of the current claimed task.
902
+ */
903
+ spec: TaskSpec;
904
+ /**
905
+ * The uuid of the current claimed task.
906
+ */
1019
907
  taskId: string;
1020
- after?: number | undefined;
1021
- };
908
+ /**
909
+ * The secrets that are stored with the task.
910
+ */
911
+ secrets?: TaskSecrets$1;
912
+ /**
913
+ * The creator of the task.
914
+ */
915
+ createdBy?: string;
916
+ }
1022
917
 
1023
918
  /**
1024
- * TaskStoreShutDownTaskOptions
919
+ * CreateWorkerOptions
1025
920
  *
1026
921
  * @public
1027
922
  */
1028
- export declare type TaskStoreShutDownTaskOptions = {
1029
- taskId: string;
923
+ declare type CreateWorkerOptions = {
924
+ taskBroker: TaskBroker;
925
+ actionRegistry: TemplateActionRegistry;
926
+ integrations: ScmIntegrations;
927
+ workingDirectory: string;
928
+ logger: Logger;
929
+ additionalTemplateFilters?: Record<string, TemplateFilter>;
930
+ /**
931
+ * The number of tasks that can be executed at the same time by the worker
932
+ * @defaultValue 10
933
+ * @example
934
+ * ```
935
+ * {
936
+ * concurrentTasksLimit: 1,
937
+ * // OR
938
+ * concurrentTasksLimit: Infinity
939
+ * }
940
+ * ```
941
+ */
942
+ concurrentTasksLimit?: number;
943
+ additionalTemplateGlobals?: Record<string, TemplateGlobal>;
1030
944
  };
1031
-
1032
945
  /**
1033
946
  * TaskWorker
1034
947
  *
1035
948
  * @public
1036
949
  */
1037
- export declare class TaskWorker {
950
+ declare class TaskWorker {
1038
951
  private readonly options;
1039
952
  private constructor();
1040
953
  private taskQueue;
@@ -1045,26 +958,66 @@ export declare class TaskWorker {
1045
958
  }
1046
959
 
1047
960
  /**
961
+ * RouterOptions
962
+ *
1048
963
  * @public
1049
- * @deprecated Use `TemplateAction` from `@backstage/plugin-scaffolder-node` instead
1050
964
  */
1051
- export declare type TemplateAction<TInput extends JsonObject> = TemplateAction_2<TInput>;
1052
-
965
+ interface RouterOptions {
966
+ logger: Logger;
967
+ config: Config;
968
+ reader: UrlReader;
969
+ database: PluginDatabaseManager;
970
+ catalogClient: CatalogApi;
971
+ scheduler?: PluginTaskScheduler;
972
+ actions?: TemplateAction$1<any>[];
973
+ /**
974
+ * @deprecated taskWorkers is deprecated in favor of concurrentTasksLimit option with a single TaskWorker
975
+ * @defaultValue 1
976
+ */
977
+ taskWorkers?: number;
978
+ /**
979
+ * Sets the number of concurrent tasks that can be run at any given time on the TaskWorker
980
+ * @defaultValue 10
981
+ */
982
+ concurrentTasksLimit?: number;
983
+ taskBroker?: TaskBroker;
984
+ additionalTemplateFilters?: Record<string, TemplateFilter>;
985
+ additionalTemplateGlobals?: Record<string, TemplateGlobal>;
986
+ identity?: IdentityApi;
987
+ }
1053
988
  /**
1054
- * Registry of all registered template actions.
989
+ * A method to create a router for the scaffolder backend plugin.
1055
990
  * @public
1056
991
  */
1057
- export declare class TemplateActionRegistry {
1058
- private readonly actions;
1059
- register<TInput extends JsonObject>(action: TemplateAction_2<TInput>): void;
1060
- get(actionId: string): TemplateAction_2<JsonObject>;
1061
- list(): TemplateAction_2<JsonObject>[];
1062
- }
992
+ declare function createRouter(options: RouterOptions): Promise<express.Router>;
1063
993
 
1064
994
  /** @public */
1065
- export declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
995
+ declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
996
+ getProcessorName(): string;
997
+ private readonly validators;
998
+ validateEntityKind(entity: Entity): Promise<boolean>;
999
+ postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
1000
+ }
1066
1001
 
1067
- /** @public */
1068
- export declare type TemplateGlobal = ((...args: JsonValue[]) => JsonValue | undefined) | JsonValue;
1002
+ /**
1003
+ * @public
1004
+ * @deprecated Import from {@link @backstage/plugin-scaffolder-node#ActionContext} instead
1005
+ */
1006
+ declare type ActionContext<TInput extends JsonObject> = ActionContext$1<TInput>;
1007
+ /**
1008
+ * @public
1009
+ * @deprecated Use `createTemplateAction` from `@backstage/plugin-scaffolder-node` instead
1010
+ */
1011
+ declare const createTemplateAction: <TParams, TInputSchema extends zod.ZodType<any, zod.ZodTypeDef, any> | jsonschema.Schema = {}, TOutputSchema extends zod.ZodType<any, zod.ZodTypeDef, any> | jsonschema.Schema = {}, TActionInput = TInputSchema extends zod.ZodType<any, any, infer IReturn> ? IReturn : TParams>(action: _backstage_plugin_scaffolder_node.TemplateActionOptions<TActionInput, TInputSchema, TOutputSchema>) => TemplateAction$1<TActionInput>;
1012
+ /**
1013
+ * @public
1014
+ * @deprecated Use `TaskSecrets` from `@backstage/plugin-scaffolder-node` instead
1015
+ */
1016
+ declare type TaskSecrets = TaskSecrets$1;
1017
+ /**
1018
+ * @public
1019
+ * @deprecated Use `TemplateAction` from `@backstage/plugin-scaffolder-node` instead
1020
+ */
1021
+ declare type TemplateAction<TInput extends JsonObject> = TemplateAction$1<TInput>;
1069
1022
 
1070
- export { }
1023
+ export { ActionContext, CreateBuiltInActionsOptions, CreateGithubPullRequestActionOptions, CreateGithubPullRequestClientFactoryInput, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DatabaseTaskStoreOptions, OctokitWithPullRequestPluginClient, RouterOptions, RunCommandOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskStatus, TaskStore, TaskStoreCreateTaskOptions, TaskStoreCreateTaskResult, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskStoreShutDownTaskOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, TemplateGlobal, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchCatalogEntityAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishBitbucketCloudAction, createPublishBitbucketServerAction, createPublishGerritAction, createPublishGerritReviewAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, executeShellCommand, fetchContents };