@backstage/plugin-scaffolder-backend 1.11.0 → 1.11.1-next.0

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