@backstage/plugin-scaffolder-backend 0.0.0-nightly-20220306022754 → 0.0.0-nightly-20220307022304

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
- ## 0.0.0-nightly-20220306022754
3
+ ## 0.0.0-nightly-20220307022304
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -15,11 +15,11 @@
15
15
 
16
16
  - 458d16869c: Allow passing more repo configuration for `publish:github` action
17
17
  - Updated dependencies
18
- - @backstage/plugin-catalog-backend@0.0.0-nightly-20220306022754
19
- - @backstage/catalog-model@0.0.0-nightly-20220306022754
20
- - @backstage/backend-common@0.0.0-nightly-20220306022754
21
- - @backstage/catalog-client@0.0.0-nightly-20220306022754
22
- - @backstage/plugin-scaffolder-common@0.0.0-nightly-20220306022754
18
+ - @backstage/plugin-catalog-backend@0.0.0-nightly-20220307022304
19
+ - @backstage/catalog-model@0.0.0-nightly-20220307022304
20
+ - @backstage/backend-common@0.0.0-nightly-20220307022304
21
+ - @backstage/catalog-client@0.0.0-nightly-20220307022304
22
+ - @backstage/plugin-scaffolder-common@0.0.0-nightly-20220307022304
23
23
 
24
24
  ## 0.17.3
25
25
 
@@ -0,0 +1,728 @@
1
+ /// <reference types="node" />
2
+ import { ScmIntegrations, ScmIntegrationRegistry, GithubCredentialsProvider } from '@backstage/integration';
3
+ import { CatalogApi } from '@backstage/catalog-client';
4
+ import { Logger } from 'winston';
5
+ import { Writable } from 'stream';
6
+ import { JsonValue, JsonObject, Observable } from '@backstage/types';
7
+ import { Schema } from 'jsonschema';
8
+ import { TaskSpec, TemplateMetadata, TemplateInfo } from '@backstage/plugin-scaffolder-common';
9
+ import { Entity } from '@backstage/catalog-model';
10
+ import { UrlReader, PluginDatabaseManager } from '@backstage/backend-common';
11
+ import { Config } from '@backstage/config';
12
+ import { createPullRequest } from 'octokit-plugin-create-pull-request';
13
+ import { SpawnOptionsWithoutStdio } from 'child_process';
14
+ import { Knex } from 'knex';
15
+ import express from 'express';
16
+ import { CatalogProcessor, LocationSpec, CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
17
+
18
+ /**
19
+ * Registers entities from a catalog descriptor file in the workspace into the software catalog.
20
+ * @public
21
+ */
22
+ declare function createCatalogRegisterAction(options: {
23
+ catalogClient: CatalogApi;
24
+ integrations: ScmIntegrations;
25
+ }): TemplateAction<{
26
+ catalogInfoUrl: string;
27
+ optional?: boolean | undefined;
28
+ } | {
29
+ repoContentsUrl: string;
30
+ catalogInfoPath?: string | undefined;
31
+ optional?: boolean | undefined;
32
+ }>;
33
+
34
+ /**
35
+ * Writes a catalog descriptor file containing the provided entity to a path in the workspace.
36
+ * @public
37
+ */
38
+ declare function createCatalogWriteAction(): TemplateAction<{
39
+ filePath?: string | undefined;
40
+ entity: Entity;
41
+ }>;
42
+
43
+ /** @public */
44
+ declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
45
+
46
+ /**
47
+ * The status of each step of the Task
48
+ *
49
+ * @public
50
+ */
51
+ declare type TaskStatus = 'open' | 'processing' | 'failed' | 'cancelled' | 'completed';
52
+ /**
53
+ * The status of each step of the Task
54
+ *
55
+ * @public
56
+ * @deprecated use TaskStatus instead
57
+ */
58
+ declare type Status = TaskStatus;
59
+ /**
60
+ * The state of a completed task.
61
+ *
62
+ * @public
63
+ */
64
+ declare type TaskCompletionState = 'failed' | 'completed';
65
+ /**
66
+ * The state of a completed task.
67
+ *
68
+ * @public
69
+ * @deprecated use TaskCompletionState instead
70
+ */
71
+ declare type CompletedTaskState = TaskCompletionState;
72
+ /**
73
+ * SerializedTask
74
+ *
75
+ * @public
76
+ */
77
+ declare type SerializedTask = {
78
+ id: string;
79
+ spec: TaskSpec;
80
+ status: TaskStatus;
81
+ createdAt: string;
82
+ lastHeartbeatAt?: string;
83
+ secrets?: TaskSecrets;
84
+ };
85
+ /**
86
+ * TaskEventType
87
+ *
88
+ * @public
89
+ */
90
+ declare type TaskEventType = 'completion' | 'log';
91
+ /**
92
+ * SerializedTaskEvent
93
+ *
94
+ * @public
95
+ */
96
+ declare type SerializedTaskEvent = {
97
+ id: number;
98
+ taskId: string;
99
+ body: JsonObject;
100
+ type: TaskEventType;
101
+ createdAt: string;
102
+ };
103
+ /**
104
+ * TaskSecrets
105
+ *
106
+ * @public
107
+ */
108
+ declare type TaskSecrets = Record<string, string> & {
109
+ backstageToken?: string;
110
+ };
111
+ /**
112
+ * The result of {@link TaskBroker.dispatch}
113
+ *
114
+ * @public
115
+ */
116
+ declare type TaskBrokerDispatchResult = {
117
+ taskId: string;
118
+ };
119
+ /**
120
+ * The options passed to {@link TaskBroker.dispatch}
121
+ * Currently a spec and optional secrets
122
+ *
123
+ * @public
124
+ */
125
+ declare type TaskBrokerDispatchOptions = {
126
+ spec: TaskSpec;
127
+ secrets?: TaskSecrets;
128
+ };
129
+ /**
130
+ * DispatchResult
131
+ *
132
+ * @public
133
+ * @deprecated use TaskBrokerDispatchResult instead
134
+ */
135
+ declare type DispatchResult = TaskBrokerDispatchResult;
136
+ /**
137
+ * Task
138
+ *
139
+ * @public
140
+ */
141
+ interface TaskContext {
142
+ spec: TaskSpec;
143
+ secrets?: TaskSecrets;
144
+ done: boolean;
145
+ emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
146
+ complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
147
+ getWorkspaceName(): Promise<string>;
148
+ }
149
+ /**
150
+ * TaskBroker
151
+ *
152
+ * @public
153
+ */
154
+ interface TaskBroker {
155
+ claim(): Promise<TaskContext>;
156
+ dispatch(options: TaskBrokerDispatchOptions): Promise<TaskBrokerDispatchResult>;
157
+ vacuumTasks(options: {
158
+ timeoutS: number;
159
+ }): Promise<void>;
160
+ event$(options: {
161
+ taskId: string;
162
+ after: number | undefined;
163
+ }): Observable<{
164
+ events: SerializedTaskEvent[];
165
+ }>;
166
+ get(taskId: string): Promise<SerializedTask>;
167
+ }
168
+ /**
169
+ * TaskStoreEmitOptions
170
+ *
171
+ * @public
172
+ */
173
+ declare type TaskStoreEmitOptions<TBody = JsonObject> = {
174
+ taskId: string;
175
+ body: TBody;
176
+ };
177
+ /**
178
+ * TaskStoreListEventsOptions
179
+ *
180
+ * @public
181
+ */
182
+ declare type TaskStoreListEventsOptions = {
183
+ taskId: string;
184
+ after?: number | undefined;
185
+ };
186
+ /**
187
+ * The options passed to {@link TaskStore.createTask}
188
+ * @public
189
+ */
190
+ declare type TaskStoreCreateTaskOptions = {
191
+ spec: TaskSpec;
192
+ secrets?: TaskSecrets;
193
+ };
194
+ /**
195
+ * The response from {@link TaskStore.createTask}
196
+ * @public
197
+ */
198
+ declare type TaskStoreCreateTaskResult = {
199
+ taskId: string;
200
+ };
201
+ /**
202
+ * TaskStore
203
+ *
204
+ * @public
205
+ */
206
+ interface TaskStore {
207
+ createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
208
+ getTask(taskId: string): Promise<SerializedTask>;
209
+ claimTask(): Promise<SerializedTask | undefined>;
210
+ completeTask(options: {
211
+ taskId: string;
212
+ status: TaskStatus;
213
+ eventBody: JsonObject;
214
+ }): Promise<void>;
215
+ heartbeatTask(taskId: string): Promise<void>;
216
+ listStaleTasks(options: {
217
+ timeoutS: number;
218
+ }): Promise<{
219
+ tasks: {
220
+ taskId: string;
221
+ }[];
222
+ }>;
223
+ emitLogEvent({ taskId, body }: TaskStoreEmitOptions): Promise<void>;
224
+ listEvents({ taskId, after, }: TaskStoreListEventsOptions): Promise<{
225
+ events: SerializedTaskEvent[];
226
+ }>;
227
+ }
228
+
229
+ /**
230
+ * ActionContext is passed into scaffolder actions.
231
+ * @public
232
+ */
233
+ declare type ActionContext<Input extends JsonObject> = {
234
+ /**
235
+ * Base URL for the location of the task spec, typically the url of the source entity file.
236
+ * @deprecated please use templateInfo.baseUrl instead
237
+ */
238
+ baseUrl?: string;
239
+ logger: Logger;
240
+ logStream: Writable;
241
+ secrets?: TaskSecrets;
242
+ workspacePath: string;
243
+ input: Input;
244
+ output(name: string, value: JsonValue): void;
245
+ /**
246
+ * Creates a temporary directory for use by the action, which is then cleaned up automatically.
247
+ */
248
+ createTemporaryDirectory(): Promise<string>;
249
+ /**
250
+ * @deprecated please use templateInfo instead
251
+ */
252
+ metadata?: TemplateMetadata;
253
+ templateInfo?: TemplateInfo;
254
+ };
255
+ /** @public */
256
+ declare type TemplateAction<Input extends JsonObject> = {
257
+ id: string;
258
+ description?: string;
259
+ schema?: {
260
+ input?: Schema;
261
+ output?: Schema;
262
+ };
263
+ handler: (ctx: ActionContext<Input>) => Promise<void>;
264
+ };
265
+
266
+ /**
267
+ * The options passed to {@link createBuiltinActions}
268
+ * @public
269
+ */
270
+ interface CreateBuiltInActionsOptions {
271
+ reader: UrlReader;
272
+ integrations: ScmIntegrations;
273
+ catalogClient: CatalogApi;
274
+ config: Config;
275
+ additionalTemplateFilters?: Record<string, TemplateFilter>;
276
+ }
277
+ /**
278
+ * A function to generate create a list of default actions that the scaffolder provides.
279
+ * Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones
280
+ *
281
+ * @public
282
+ * @returns A list of actions that can be used in the scaffolder
283
+ */
284
+ declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction<JsonObject>[];
285
+
286
+ /**
287
+ * Writes a message into the log or lists all files in the workspace
288
+ *
289
+ * @remarks
290
+ *
291
+ * This task is useful for local development and testing of both the scaffolder
292
+ * and scaffolder templates.
293
+ *
294
+ * @public
295
+ */
296
+ declare function createDebugLogAction(): TemplateAction<{
297
+ message?: string | undefined;
298
+ listWorkspace?: boolean | undefined;
299
+ }>;
300
+
301
+ /**
302
+ * Downloads content and places it in the workspace, or optionally
303
+ * in a subdirectory specified by the 'targetPath' input option.
304
+ * @public
305
+ */
306
+ declare function createFetchPlainAction(options: {
307
+ reader: UrlReader;
308
+ integrations: ScmIntegrations;
309
+ }): TemplateAction<{
310
+ url: string;
311
+ targetPath?: string | undefined;
312
+ }>;
313
+
314
+ /**
315
+ * Downloads a skeleton, templates variables into file and directory names and content.
316
+ * Then places the result in the workspace, or optionally in a subdirectory
317
+ * specified by the 'targetPath' input option.
318
+ *
319
+ * @public
320
+ */
321
+ declare function createFetchTemplateAction(options: {
322
+ reader: UrlReader;
323
+ integrations: ScmIntegrations;
324
+ additionalTemplateFilters?: Record<string, TemplateFilter>;
325
+ }): TemplateAction<{
326
+ url: string;
327
+ targetPath?: string | undefined;
328
+ values: any;
329
+ templateFileExtension?: string | boolean | undefined;
330
+ copyWithoutRender?: string[] | undefined;
331
+ cookiecutterCompat?: boolean | undefined;
332
+ }>;
333
+
334
+ /**
335
+ * A helper function that reads the contents of a directory from the given URL.
336
+ * Can be used in your own actions, and also used behind fetch:template and fetch:plain
337
+ *
338
+ * @public
339
+ */
340
+ declare function fetchContents({ reader, integrations, baseUrl, fetchUrl, outputPath, }: {
341
+ reader: UrlReader;
342
+ integrations: ScmIntegrations;
343
+ baseUrl?: string;
344
+ fetchUrl?: string;
345
+ outputPath: string;
346
+ }): Promise<void>;
347
+
348
+ /**
349
+ * Creates new action that enables deletion of files and directories in the workspace.
350
+ * @public
351
+ */
352
+ declare const createFilesystemDeleteAction: () => TemplateAction<{
353
+ files: string[];
354
+ }>;
355
+
356
+ /**
357
+ * Creates a new action that allows renames of files and directories in the workspace.
358
+ * @public
359
+ */
360
+ declare const createFilesystemRenameAction: () => TemplateAction<{
361
+ files: Array<{
362
+ from: string;
363
+ to: string;
364
+ overwrite?: boolean;
365
+ }>;
366
+ }>;
367
+
368
+ /**
369
+ * Creates a new action that initializes a git repository of the content in the workspace
370
+ * and publishes it to Azure.
371
+ * @public
372
+ */
373
+ declare function createPublishAzureAction(options: {
374
+ integrations: ScmIntegrationRegistry;
375
+ config: Config;
376
+ }): TemplateAction<{
377
+ repoUrl: string;
378
+ description?: string | undefined;
379
+ defaultBranch?: string | undefined;
380
+ sourcePath?: string | undefined;
381
+ token?: string | undefined;
382
+ }>;
383
+
384
+ /**
385
+ * Creates a new action that initializes a git repository of the content in the workspace
386
+ * and publishes it to Bitbucket.
387
+ * @public
388
+ */
389
+ declare function createPublishBitbucketAction(options: {
390
+ integrations: ScmIntegrationRegistry;
391
+ config: Config;
392
+ }): TemplateAction<{
393
+ repoUrl: string;
394
+ description?: string | undefined;
395
+ defaultBranch?: string | undefined;
396
+ repoVisibility?: "private" | "public" | undefined;
397
+ sourcePath?: string | undefined;
398
+ enableLFS?: boolean | undefined;
399
+ token?: string | undefined;
400
+ }>;
401
+
402
+ /**
403
+ * This task is useful for local development and testing of both the scaffolder
404
+ * and scaffolder templates.
405
+ *
406
+ * @remarks
407
+ *
408
+ * This action is not installed by default and should not be installed in
409
+ * production, as it writes the files to the local filesystem of the scaffolder.
410
+ *
411
+ * @public
412
+ */
413
+ declare function createPublishFileAction(): TemplateAction<{
414
+ path: string;
415
+ }>;
416
+
417
+ /**
418
+ * Creates a new action that initializes a git repository of the content in the workspace
419
+ * and publishes it to GitHub.
420
+ *
421
+ * @public
422
+ */
423
+ declare function createPublishGithubAction(options: {
424
+ integrations: ScmIntegrationRegistry;
425
+ config: Config;
426
+ githubCredentialsProvider?: GithubCredentialsProvider;
427
+ }): TemplateAction<{
428
+ repoUrl: string;
429
+ description?: string | undefined;
430
+ access?: string | undefined;
431
+ defaultBranch?: string | undefined;
432
+ deleteBranchOnMerge?: boolean | undefined;
433
+ allowRebaseMerge?: boolean | undefined;
434
+ allowSquashMerge?: boolean | undefined;
435
+ allowMergeCommit?: boolean | undefined;
436
+ sourcePath?: string | undefined;
437
+ requireCodeOwnerReviews?: boolean | undefined;
438
+ repoVisibility?: "private" | "public" | "internal" | undefined;
439
+ collaborators?: {
440
+ username: string;
441
+ access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
442
+ }[] | undefined;
443
+ token?: string | undefined;
444
+ topics?: string[] | undefined;
445
+ }>;
446
+
447
+ /** @public */
448
+ interface OctokitWithPullRequestPluginClient {
449
+ createPullRequest(options: createPullRequest.Options): Promise<{
450
+ data: {
451
+ html_url: string;
452
+ };
453
+ } | null>;
454
+ }
455
+ /** @public */
456
+ declare type CreateGithubPullRequestClientFactoryInput = {
457
+ integrations: ScmIntegrationRegistry;
458
+ githubCredentialsProvider?: GithubCredentialsProvider;
459
+ host: string;
460
+ owner: string;
461
+ repo: string;
462
+ token?: string;
463
+ };
464
+ /** @public */
465
+ interface CreateGithubPullRequestActionOptions {
466
+ integrations: ScmIntegrationRegistry;
467
+ githubCredentialsProvider?: GithubCredentialsProvider;
468
+ clientFactory?: (input: CreateGithubPullRequestClientFactoryInput) => Promise<OctokitWithPullRequestPluginClient>;
469
+ }
470
+ /**
471
+ * Creates a Github Pull Request action.
472
+ * @public
473
+ */
474
+ declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction<{
475
+ title: string;
476
+ branchName: string;
477
+ description: string;
478
+ repoUrl: string;
479
+ targetPath?: string | undefined;
480
+ sourcePath?: string | undefined;
481
+ token?: string | undefined;
482
+ }>;
483
+
484
+ /**
485
+ * Creates a new action that initializes a git repository of the content in the workspace
486
+ * and publishes it to GitLab.
487
+ *
488
+ * @public
489
+ */
490
+ declare function createPublishGitlabAction(options: {
491
+ integrations: ScmIntegrationRegistry;
492
+ config: Config;
493
+ }): TemplateAction<{
494
+ repoUrl: string;
495
+ defaultBranch?: string | undefined;
496
+ repoVisibility?: "private" | "public" | "internal" | undefined;
497
+ sourcePath?: string | undefined;
498
+ token?: string | undefined;
499
+ }>;
500
+
501
+ /**
502
+ * Create a new action that creates a gitlab merge request.
503
+ *
504
+ * @public
505
+ */
506
+ declare const createPublishGitlabMergeRequestAction: (options: {
507
+ integrations: ScmIntegrationRegistry;
508
+ }) => TemplateAction<{
509
+ projectid: string;
510
+ repoUrl: string;
511
+ title: string;
512
+ description: string;
513
+ branchName: string;
514
+ targetPath: string;
515
+ token?: string | undefined;
516
+ }>;
517
+
518
+ /**
519
+ * Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.
520
+ * @public
521
+ */
522
+ declare function createGithubActionsDispatchAction(options: {
523
+ integrations: ScmIntegrations;
524
+ githubCredentialsProvider?: GithubCredentialsProvider;
525
+ }): TemplateAction<{
526
+ repoUrl: string;
527
+ workflowId: string;
528
+ branchOrTagName: string;
529
+ workflowInputs?: {
530
+ [key: string]: string;
531
+ } | undefined;
532
+ token?: string | undefined;
533
+ }>;
534
+
535
+ /**
536
+ * Creates new action that creates a webhook for a repository on GitHub.
537
+ * @public
538
+ */
539
+ declare function createGithubWebhookAction(options: {
540
+ integrations: ScmIntegrationRegistry;
541
+ defaultWebhookSecret?: string;
542
+ githubCredentialsProvider?: GithubCredentialsProvider;
543
+ }): TemplateAction<{
544
+ repoUrl: string;
545
+ webhookUrl: string;
546
+ webhookSecret?: string | undefined;
547
+ events?: string[] | undefined;
548
+ active?: boolean | undefined;
549
+ contentType?: "form" | "json" | undefined;
550
+ insecureSsl?: boolean | undefined;
551
+ token?: string | undefined;
552
+ }>;
553
+
554
+ /** @public */
555
+ declare type RunCommandOptions = {
556
+ /** command to run */
557
+ command: string;
558
+ /** arguments to pass the command */
559
+ args: string[];
560
+ /** options to pass to spawn */
561
+ options?: SpawnOptionsWithoutStdio;
562
+ /** stream to capture stdout and stderr output */
563
+ logStream?: Writable;
564
+ };
565
+ /**
566
+ * Run a command in a sub-process, normally a shell command.
567
+ *
568
+ * @public
569
+ */
570
+ declare const executeShellCommand: (options: RunCommandOptions) => Promise<void>;
571
+ /**
572
+ * Run a command in a sub-process, normally a shell command.
573
+ * @public
574
+ * @deprecated use {@link executeShellCommand} instead
575
+ */
576
+ declare const runCommand: (options: RunCommandOptions) => Promise<void>;
577
+
578
+ /**
579
+ * Registry of all registered template actions.
580
+ * @public
581
+ */
582
+ declare class TemplateActionRegistry {
583
+ private readonly actions;
584
+ register<TInput extends JsonObject>(action: TemplateAction<TInput>): void;
585
+ get(actionId: string): TemplateAction<JsonObject>;
586
+ list(): TemplateAction<JsonObject>[];
587
+ }
588
+
589
+ /**
590
+ * This function is used to create new template actions to get type safety.
591
+ * @public
592
+ */
593
+ declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
594
+
595
+ /**
596
+ * DatabaseTaskStore
597
+ *
598
+ * @public
599
+ */
600
+ declare type DatabaseTaskStoreOptions = {
601
+ database: Knex;
602
+ };
603
+ /**
604
+ * DatabaseTaskStore
605
+ *
606
+ * @public
607
+ */
608
+ declare class DatabaseTaskStore implements TaskStore {
609
+ private readonly db;
610
+ static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
611
+ private constructor();
612
+ getTask(taskId: string): Promise<SerializedTask>;
613
+ createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
614
+ claimTask(): Promise<SerializedTask | undefined>;
615
+ heartbeatTask(taskId: string): Promise<void>;
616
+ listStaleTasks({ timeoutS }: {
617
+ timeoutS: number;
618
+ }): Promise<{
619
+ tasks: {
620
+ taskId: string;
621
+ }[];
622
+ }>;
623
+ completeTask({ taskId, status, eventBody, }: {
624
+ taskId: string;
625
+ status: TaskStatus;
626
+ eventBody: JsonObject;
627
+ }): Promise<void>;
628
+ emitLogEvent(options: TaskStoreEmitOptions<{
629
+ message: string;
630
+ } & JsonObject>): Promise<void>;
631
+ listEvents({ taskId, after, }: TaskStoreListEventsOptions): Promise<{
632
+ events: SerializedTaskEvent[];
633
+ }>;
634
+ }
635
+
636
+ /**
637
+ * TaskManager
638
+ *
639
+ * @public
640
+ */
641
+ declare class TaskManager implements TaskContext {
642
+ private readonly task;
643
+ private readonly storage;
644
+ private readonly logger;
645
+ private isDone;
646
+ private heartbeatTimeoutId?;
647
+ static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
648
+ private constructor();
649
+ get spec(): TaskSpec;
650
+ get secrets(): TaskSecrets | undefined;
651
+ getWorkspaceName(): Promise<string>;
652
+ get done(): boolean;
653
+ emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
654
+ complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
655
+ private startTimeout;
656
+ }
657
+ /**
658
+ * Stores the state of the current claimed task passed to the TaskContext
659
+ *
660
+ * @public
661
+ */
662
+ interface CurrentClaimedTask {
663
+ spec: TaskSpec;
664
+ taskId: string;
665
+ secrets?: TaskSecrets;
666
+ }
667
+ /**
668
+ * TaskState
669
+ *
670
+ * @public
671
+ * @deprecated use CurrentClaimedTask instead
672
+ */
673
+ declare type TaskState = CurrentClaimedTask;
674
+
675
+ /**
676
+ * CreateWorkerOptions
677
+ *
678
+ * @public
679
+ */
680
+ declare type CreateWorkerOptions = {
681
+ taskBroker: TaskBroker;
682
+ actionRegistry: TemplateActionRegistry;
683
+ integrations: ScmIntegrations;
684
+ workingDirectory: string;
685
+ logger: Logger;
686
+ additionalTemplateFilters?: Record<string, TemplateFilter>;
687
+ };
688
+ /**
689
+ * TaskWorker
690
+ *
691
+ * @public
692
+ */
693
+ declare class TaskWorker {
694
+ private readonly options;
695
+ private constructor();
696
+ static create(options: CreateWorkerOptions): Promise<TaskWorker>;
697
+ start(): void;
698
+ runOneTask(task: TaskContext): Promise<void>;
699
+ }
700
+
701
+ /**
702
+ * RouterOptions
703
+ *
704
+ * @public
705
+ */
706
+ interface RouterOptions {
707
+ logger: Logger;
708
+ config: Config;
709
+ reader: UrlReader;
710
+ database: PluginDatabaseManager;
711
+ catalogClient: CatalogApi;
712
+ actions?: TemplateAction<any>[];
713
+ taskWorkers?: number;
714
+ taskBroker?: TaskBroker;
715
+ additionalTemplateFilters?: Record<string, TemplateFilter>;
716
+ }
717
+ /** @public */
718
+ declare function createRouter(options: RouterOptions): Promise<express.Router>;
719
+
720
+ /** @public */
721
+ declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
722
+ getProcessorName(): string;
723
+ private readonly validators;
724
+ validateEntityKind(entity: Entity): Promise<boolean>;
725
+ postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
726
+ }
727
+
728
+ export { ActionContext, CompletedTaskState, CreateBuiltInActionsOptions, CreateGithubPullRequestActionOptions, CreateGithubPullRequestClientFactoryInput, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DatabaseTaskStoreOptions, DispatchResult, OctokitWithPullRequestPluginClient, RouterOptions, RunCommandOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, Status, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskState, TaskStatus, TaskStore, TaskStoreCreateTaskOptions, TaskStoreCreateTaskResult, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishFileAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, executeShellCommand, fetchContents, runCommand };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend",
3
3
  "description": "The Backstage backend plugin that helps you create new things",
4
- "version": "0.0.0-nightly-20220306022754",
4
+ "version": "0.0.0-nightly-20220307022304",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -34,14 +34,14 @@
34
34
  "build:assets": "node scripts/build-nunjucks.js"
35
35
  },
36
36
  "dependencies": {
37
- "@backstage/backend-common": "^0.0.0-nightly-20220306022754",
38
- "@backstage/catalog-client": "^0.0.0-nightly-20220306022754",
39
- "@backstage/catalog-model": "^0.0.0-nightly-20220306022754",
37
+ "@backstage/backend-common": "^0.0.0-nightly-20220307022304",
38
+ "@backstage/catalog-client": "^0.0.0-nightly-20220307022304",
39
+ "@backstage/catalog-model": "^0.0.0-nightly-20220307022304",
40
40
  "@backstage/config": "^0.1.15",
41
41
  "@backstage/errors": "^0.2.2",
42
42
  "@backstage/integration": "^0.8.0",
43
- "@backstage/plugin-catalog-backend": "^0.0.0-nightly-20220306022754",
44
- "@backstage/plugin-scaffolder-common": "^0.0.0-nightly-20220306022754",
43
+ "@backstage/plugin-catalog-backend": "^0.0.0-nightly-20220307022304",
44
+ "@backstage/plugin-scaffolder-common": "^0.0.0-nightly-20220307022304",
45
45
  "@backstage/types": "^0.1.3",
46
46
  "@gitbeaker/core": "^34.6.0",
47
47
  "@gitbeaker/node": "^35.1.0",
@@ -75,7 +75,7 @@
75
75
  "zen-observable": "^0.8.15"
76
76
  },
77
77
  "devDependencies": {
78
- "@backstage/cli": "^0.0.0-nightly-20220306022754",
78
+ "@backstage/cli": "^0.0.0-nightly-20220307022304",
79
79
  "@backstage/test-utils": "^0.3.0",
80
80
  "@types/command-exists": "^1.2.0",
81
81
  "@types/fs-extra": "^9.0.1",