@backstage/plugin-scaffolder-backend 1.11.0-next.2 → 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.
@@ -1,1070 +0,0 @@
1
- /**
2
- * The Backstage backend plugin that helps you create new things
3
- *
4
- * @packageDocumentation
5
- */
6
-
7
- /// <reference types="node" />
8
-
9
- import { ActionContext as ActionContext_2 } from '@backstage/plugin-scaffolder-node';
10
- import { BackendFeature } from '@backstage/backend-plugin-api';
11
- import { CatalogApi } from '@backstage/catalog-client';
12
- import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
13
- import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
14
- import { Config } from '@backstage/config';
15
- 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';
22
- import { Knex } from 'knex';
23
- import { LocationSpec } from '@backstage/plugin-catalog-backend';
24
- import { Logger } from 'winston';
25
- import { Observable } from '@backstage/types';
26
- import { Octokit } from 'octokit';
27
- import { PluginDatabaseManager } from '@backstage/backend-common';
28
- 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';
38
-
39
- /**
40
- * @public
41
- * @deprecated Import from {@link @backstage/plugin-scaffolder-node#ActionContext} instead
42
- */
43
- export declare type ActionContext<TInput extends JsonObject> = ActionContext_2<TInput>;
44
-
45
- /* Excluded from this release type: catalogModuleTemplateKind */
46
-
47
- /**
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
- * @public
52
- * @returns A list of actions that can be used in the scaffolder
53
- */
54
- export declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction_2<JsonObject>[];
55
-
56
- /**
57
- * The options passed to {@link createBuiltinActions}
58
- * @public
59
- */
60
- export declare interface CreateBuiltInActionsOptions {
61
- /**
62
- * The {@link @backstage/backend-common#UrlReader} interface that will be used in the default actions.
63
- */
64
- reader: UrlReader;
65
- /**
66
- * The {@link @backstage/integrations#ScmIntegrations} that will be used in the default actions.
67
- */
68
- integrations: ScmIntegrations;
69
- /**
70
- * The {@link @backstage/catalog-client#CatalogApi} that will be used in the default actions.
71
- */
72
- catalogClient: CatalogApi;
73
- /**
74
- * The {@link @backstage/config#Config} that will be used in the default actions.
75
- */
76
- config: Config;
77
- /**
78
- * Additional custom filters that will be passed to the nunjucks template engine for use in
79
- * Template Manifests and also template skeleton files when using `fetch:template`.
80
- */
81
- additionalTemplateFilters?: Record<string, TemplateFilter>;
82
- additionalTemplateGlobals?: Record<string, TemplateGlobal>;
83
- }
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
- /**
102
- * Writes a catalog descriptor file containing the provided entity to a path in the workspace.
103
- * @public
104
- */
105
- export declare function createCatalogWriteAction(): TemplateAction_2< {
106
- filePath?: string | undefined;
107
- entity: Entity;
108
- }>;
109
-
110
- /**
111
- * Writes a message into the log or lists all files in the workspace
112
- *
113
- * @remarks
114
- *
115
- * This task is useful for local development and testing of both the scaffolder
116
- * and scaffolder templates.
117
- *
118
- * @public
119
- */
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;
134
- }>;
135
-
136
- /**
137
- * Downloads content and places it in the workspace, or optionally
138
- * in a subdirectory specified by the 'targetPath' input option.
139
- * @public
140
- */
141
- export declare function createFetchPlainAction(options: {
142
- reader: UrlReader;
143
- integrations: ScmIntegrations;
144
- }): TemplateAction_2< {
145
- url: string;
146
- targetPath?: string | undefined;
147
- }>;
148
-
149
- /**
150
- * Downloads a skeleton, templates variables into file and directory names and content.
151
- * Then places the result in the workspace, or optionally in a subdirectory
152
- * specified by the 'targetPath' input option.
153
- *
154
- * @public
155
- */
156
- export declare function createFetchTemplateAction(options: {
157
- reader: UrlReader;
158
- integrations: ScmIntegrations;
159
- additionalTemplateFilters?: Record<string, TemplateFilter>;
160
- 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;
173
- }>;
174
-
175
- /**
176
- * Creates new action that enables deletion of files and directories in the workspace.
177
- * @public
178
- */
179
- export declare const createFilesystemDeleteAction: () => TemplateAction_2< {
180
- files: string[];
181
- }>;
182
-
183
- /**
184
- * Creates a new action that allows renames of files and directories in the workspace.
185
- * @public
186
- */
187
- export declare const createFilesystemRenameAction: () => TemplateAction_2< {
188
- files: Array<{
189
- from: string;
190
- to: string;
191
- overwrite?: boolean;
192
- }>;
193
- }>;
194
-
195
- /**
196
- * Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.
197
- * @public
198
- */
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;
210
- }>;
211
-
212
- /**
213
- * Adds labels to a pull request or issue on GitHub
214
- * @public
215
- */
216
- export declare function createGithubIssuesLabelAction(options: {
217
- integrations: ScmIntegrationRegistry;
218
- githubCredentialsProvider?: GithubCredentialsProvider;
219
- }): TemplateAction_2< {
220
- repoUrl: string;
221
- number: number;
222
- labels: string[];
223
- token?: string | undefined;
224
- }>;
225
-
226
- /**
227
- * The options passed to {@link createPublishGithubPullRequestAction} method
228
- * @public
229
- */
230
- export declare interface CreateGithubPullRequestActionOptions {
231
- /**
232
- * An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.
233
- */
234
- 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
- }
244
-
245
- /**
246
- * The options passed to the client factory function.
247
- * @public
248
- */
249
- export declare type CreateGithubPullRequestClientFactoryInput = {
250
- integrations: ScmIntegrationRegistry;
251
- githubCredentialsProvider?: GithubCredentialsProvider;
252
- host: string;
253
- owner: string;
254
- repo: string;
255
- token?: string;
256
- };
257
-
258
- /**
259
- * Creates a new action that initializes a git repository
260
- *
261
- * @public
262
- */
263
- export declare function createGithubRepoCreateAction(options: {
264
- 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;
313
- }>;
314
-
315
- /**
316
- * Creates a new action that initializes a git repository of the content in the workspace
317
- * and publishes it to GitHub.
318
- *
319
- * @public
320
- */
321
- export declare function createGithubRepoPushAction(options: {
322
- integrations: ScmIntegrationRegistry;
323
- config: Config;
324
- 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;
353
- }>;
354
-
355
- /**
356
- * Creates new action that creates a webhook for a repository on GitHub.
357
- * @public
358
- */
359
- export declare function createGithubWebhookAction(options: {
360
- integrations: ScmIntegrationRegistry;
361
- defaultWebhookSecret?: string;
362
- 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
-
374
- /**
375
- * Creates a new action that initializes a git repository of the content in the workspace
376
- * and publishes it to Azure.
377
- * @public
378
- */
379
- export declare function createPublishAzureAction(options: {
380
- 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;
391
- }>;
392
-
393
- /**
394
- * Creates a new action that initializes a git repository of the content in the workspace
395
- * and publishes it to Bitbucket.
396
- * @public
397
- * @deprecated in favor of createPublishBitbucketCloudAction and createPublishBitbucketServerAction
398
- */
399
- export declare function createPublishBitbucketAction(options: {
400
- integrations: ScmIntegrationRegistry;
401
- 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;
413
- }>;
414
-
415
- /**
416
- * Creates a new action that initializes a git repository of the content in the workspace
417
- * and publishes it to Bitbucket Cloud.
418
- * @public
419
- */
420
- export declare function createPublishBitbucketCloudAction(options: {
421
- 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;
430
- }>;
431
-
432
- /**
433
- * Creates a new action that initializes a git repository of the content in the workspace
434
- * and publishes it to Bitbucket Server.
435
- * @public
436
- */
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;
451
- }>;
452
-
453
- /**
454
- * Creates a new action that initializes a git repository of the content in the workspace
455
- * and publishes it to a Gerrit instance.
456
- * @public
457
- */
458
- export declare function createPublishGerritAction(options: {
459
- 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;
469
- }>;
470
-
471
- /**
472
- * Creates a new action that creates a Gerrit review
473
- * @public
474
- */
475
- export declare function createPublishGerritReviewAction(options: {
476
- 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;
485
- }>;
486
-
487
- /**
488
- * Creates a new action that initializes a git repository of the content in the workspace
489
- * and publishes it to GitHub.
490
- *
491
- * @public
492
- */
493
- export declare function createPublishGithubAction(options: {
494
- integrations: ScmIntegrationRegistry;
495
- config: Config;
496
- 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;
550
- }>;
551
-
552
- /**
553
- * Creates a Github Pull Request action.
554
- * @public
555
- */
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;
567
- }>;
568
-
569
- /**
570
- * Creates a new action that initializes a git repository of the content in the workspace
571
- * and publishes it to GitLab.
572
- *
573
- * @public
574
- */
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
- }>;
590
-
591
- /**
592
- * Create a new action that creates a gitlab merge request.
593
- *
594
- * @public
595
- */
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
- }>;
612
-
613
- /**
614
- * A method to create a router for the scaffolder backend plugin.
615
- * @public
616
- */
617
- export declare function createRouter(options: RouterOptions): Promise<express.Router>;
618
-
619
- /**
620
- * @public
621
- * @deprecated Use `createTemplateAction` from `@backstage/plugin-scaffolder-node` instead
622
- */
623
- export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction_2<TInput>) => TemplateAction_2<TInput>;
624
-
625
- /**
626
- * CreateWorkerOptions
627
- *
628
- * @public
629
- */
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
- 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
- */
674
- 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;
725
- };
726
-
727
- /**
728
- * Run a command in a sub-process, normally a shell command.
729
- *
730
- * @public
731
- */
732
- export declare const executeShellCommand: (options: RunCommandOptions) => Promise<void>;
733
-
734
- /**
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
737
- *
738
- * @public
739
- */
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>;
756
- };
757
-
758
- /**
759
- * RouterOptions
760
- *
761
- * @public
762
- */
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;
797
- };
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
- /**
812
- * SerializedTask
813
- *
814
- * @public
815
- */
816
- export declare type SerializedTask = {
817
- id: string;
818
- spec: TaskSpec;
819
- status: TaskStatus;
820
- createdAt: string;
821
- lastHeartbeatAt?: string;
822
- createdBy?: string;
823
- secrets?: TaskSecrets_2;
824
- };
825
-
826
- /**
827
- * SerializedTaskEvent
828
- *
829
- * @public
830
- */
831
- export declare type SerializedTaskEvent = {
832
- id: number;
833
- taskId: string;
834
- body: JsonObject;
835
- type: TaskEventType;
836
- createdAt: string;
837
- };
838
-
839
- /**
840
- * TaskBroker
841
- *
842
- * @public
843
- */
844
- export declare interface TaskBroker {
845
- claim(): Promise<TaskContext>;
846
- dispatch(options: TaskBrokerDispatchOptions): Promise<TaskBrokerDispatchResult>;
847
- vacuumTasks(options: {
848
- timeoutS: number;
849
- }): Promise<void>;
850
- event$(options: {
851
- taskId: string;
852
- after: number | undefined;
853
- }): Observable<{
854
- events: SerializedTaskEvent[];
855
- }>;
856
- get(taskId: string): Promise<SerializedTask>;
857
- list?(options?: {
858
- createdBy?: string;
859
- }): Promise<{
860
- tasks: SerializedTask[];
861
- }>;
862
- }
863
-
864
- /**
865
- * The options passed to {@link TaskBroker.dispatch}
866
- * Currently a spec and optional secrets
867
- *
868
- * @public
869
- */
870
- export declare type TaskBrokerDispatchOptions = {
871
- spec: TaskSpec;
872
- secrets?: TaskSecrets_2;
873
- createdBy?: string;
874
- };
875
-
876
- /**
877
- * The result of {@link TaskBroker.dispatch}
878
- *
879
- * @public
880
- */
881
- export declare type TaskBrokerDispatchResult = {
882
- taskId: string;
883
- };
884
-
885
- /**
886
- * The state of a completed task.
887
- *
888
- * @public
889
- */
890
- export declare type TaskCompletionState = 'failed' | 'completed';
891
-
892
- /**
893
- * Task
894
- *
895
- * @public
896
- */
897
- export declare interface TaskContext {
898
- spec: TaskSpec;
899
- secrets?: TaskSecrets_2;
900
- 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
-
944
- /**
945
- * The status of each step of the Task
946
- *
947
- * @public
948
- */
949
- export declare type TaskStatus = 'open' | 'processing' | 'failed' | 'cancelled' | 'completed';
950
-
951
- /**
952
- * TaskStore
953
- *
954
- * @public
955
- */
956
- export declare interface TaskStore {
957
- createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
958
- getTask(taskId: string): Promise<SerializedTask>;
959
- claimTask(): Promise<SerializedTask | undefined>;
960
- completeTask(options: {
961
- taskId: string;
962
- status: TaskStatus;
963
- eventBody: JsonObject;
964
- }): Promise<void>;
965
- heartbeatTask(taskId: string): Promise<void>;
966
- listStaleTasks(options: {
967
- timeoutS: number;
968
- }): Promise<{
969
- tasks: {
970
- taskId: string;
971
- }[];
972
- }>;
973
- list?(options: {
974
- createdBy?: string;
975
- }): Promise<{
976
- tasks: SerializedTask[];
977
- }>;
978
- emitLogEvent({ taskId, body }: TaskStoreEmitOptions): Promise<void>;
979
- listEvents({ taskId, after, }: TaskStoreListEventsOptions): Promise<{
980
- events: SerializedTaskEvent[];
981
- }>;
982
- shutdownTask?({ taskId }: TaskStoreShutDownTaskOptions): Promise<void>;
983
- }
984
-
985
- /**
986
- * The options passed to {@link TaskStore.createTask}
987
- * @public
988
- */
989
- export declare type TaskStoreCreateTaskOptions = {
990
- spec: TaskSpec;
991
- createdBy?: string;
992
- secrets?: TaskSecrets_2;
993
- };
994
-
995
- /**
996
- * The response from {@link TaskStore.createTask}
997
- * @public
998
- */
999
- export declare type TaskStoreCreateTaskResult = {
1000
- taskId: string;
1001
- };
1002
-
1003
- /**
1004
- * TaskStoreEmitOptions
1005
- *
1006
- * @public
1007
- */
1008
- export declare type TaskStoreEmitOptions<TBody = JsonObject> = {
1009
- taskId: string;
1010
- body: TBody;
1011
- };
1012
-
1013
- /**
1014
- * TaskStoreListEventsOptions
1015
- *
1016
- * @public
1017
- */
1018
- export declare type TaskStoreListEventsOptions = {
1019
- taskId: string;
1020
- after?: number | undefined;
1021
- };
1022
-
1023
- /**
1024
- * TaskStoreShutDownTaskOptions
1025
- *
1026
- * @public
1027
- */
1028
- export declare type TaskStoreShutDownTaskOptions = {
1029
- taskId: string;
1030
- };
1031
-
1032
- /**
1033
- * TaskWorker
1034
- *
1035
- * @public
1036
- */
1037
- export declare class TaskWorker {
1038
- private readonly options;
1039
- private constructor();
1040
- private taskQueue;
1041
- static create(options: CreateWorkerOptions): Promise<TaskWorker>;
1042
- start(): void;
1043
- protected onReadyToClaimTask(): Promise<void>;
1044
- runOneTask(task: TaskContext): Promise<void>;
1045
- }
1046
-
1047
- /**
1048
- * @public
1049
- * @deprecated Use `TemplateAction` from `@backstage/plugin-scaffolder-node` instead
1050
- */
1051
- export declare type TemplateAction<TInput extends JsonObject> = TemplateAction_2<TInput>;
1052
-
1053
- /**
1054
- * Registry of all registered template actions.
1055
- * @public
1056
- */
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
- }
1063
-
1064
- /** @public */
1065
- export declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
1066
-
1067
- /** @public */
1068
- export declare type TemplateGlobal = ((...args: JsonValue[]) => JsonValue | undefined) | JsonValue;
1069
-
1070
- export { }