@backstage/plugin-scaffolder-backend 1.10.0 → 1.11.0-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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 1.11.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0b2952ee4b: Added the option to overwrite files in the `targetPath` of the `template:fetch` action
8
+
9
+ ### Patch Changes
10
+
11
+ - ad3edc402d: **Deprecations**: The following are deprecated and should instead be imported from the new package `@backstage/plugin-scaffolder-node`:
12
+
13
+ - `ActionContext`
14
+ - `createTemplateAction`
15
+ - `TaskSecrets`
16
+ - `TemplateAction`
17
+
18
+ - Updated dependencies
19
+ - @backstage/plugin-scaffolder-node@0.1.0-next.0
20
+ - @backstage/catalog-model@1.1.6-next.0
21
+ - @backstage/backend-common@0.18.2-next.0
22
+ - @backstage/catalog-client@1.3.1-next.0
23
+ - @backstage/plugin-catalog-backend@1.7.2-next.0
24
+ - @backstage/plugin-catalog-node@1.3.3-next.0
25
+ - @backstage/plugin-scaffolder-common@1.2.5-next.0
26
+ - @backstage/backend-tasks@0.4.3-next.0
27
+ - @backstage/plugin-auth-node@0.2.11-next.0
28
+ - @backstage/backend-plugin-api@0.3.2-next.0
29
+
3
30
  ## 1.10.0
4
31
 
5
32
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend",
3
- "version": "1.10.0",
3
+ "version": "1.11.0-next.0",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -6,6 +6,7 @@
6
6
 
7
7
  /// <reference types="node" />
8
8
 
9
+ import { ActionContext as ActionContext_2 } from '@backstage/plugin-scaffolder-node';
9
10
  import { BackendFeature } from '@backstage/backend-plugin-api';
10
11
  import { CatalogApi } from '@backstage/catalog-client';
11
12
  import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
@@ -25,52 +26,21 @@ import { Observable } from '@backstage/types';
25
26
  import { Octokit } from 'octokit';
26
27
  import { PluginDatabaseManager } from '@backstage/backend-common';
27
28
  import { PluginTaskScheduler } from '@backstage/backend-tasks';
28
- import { Schema } from 'jsonschema';
29
29
  import { ScmIntegrationRegistry } from '@backstage/integration';
30
30
  import { ScmIntegrations } from '@backstage/integration';
31
31
  import { SpawnOptionsWithoutStdio } from 'child_process';
32
+ import { TaskSecrets as TaskSecrets_2 } from '@backstage/plugin-scaffolder-node';
32
33
  import { TaskSpec } from '@backstage/plugin-scaffolder-common';
33
34
  import { TaskSpecV1beta3 } from '@backstage/plugin-scaffolder-common';
34
- import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
35
+ import { TemplateAction as TemplateAction_2 } from '@backstage/plugin-scaffolder-node';
35
36
  import { UrlReader } from '@backstage/backend-common';
36
- import { UserEntity } from '@backstage/catalog-model';
37
37
  import { Writable } from 'stream';
38
38
 
39
39
  /**
40
- * ActionContext is passed into scaffolder actions.
41
40
  * @public
41
+ * @deprecated Import from {@link @backstage/plugin-scaffolder-node#ActionContext} instead
42
42
  */
43
- export declare type ActionContext<Input extends JsonObject> = {
44
- logger: Logger;
45
- logStream: Writable;
46
- secrets?: TaskSecrets;
47
- workspacePath: string;
48
- input: Input;
49
- output(name: string, value: JsonValue): void;
50
- /**
51
- * Creates a temporary directory for use by the action, which is then cleaned up automatically.
52
- */
53
- createTemporaryDirectory(): Promise<string>;
54
- templateInfo?: TemplateInfo;
55
- /**
56
- * Whether this action invocation is a dry-run or not.
57
- * This will only ever be true if the actions as marked as supporting dry-runs.
58
- */
59
- isDryRun?: boolean;
60
- /**
61
- * The user which triggered the action.
62
- */
63
- user?: {
64
- /**
65
- * The decorated entity from the Catalog
66
- */
67
- entity?: UserEntity;
68
- /**
69
- * An entity ref for the author of the task
70
- */
71
- ref?: string;
72
- };
73
- };
43
+ export declare type ActionContext<TInput extends JsonObject> = ActionContext_2<TInput>;
74
44
 
75
45
  /**
76
46
  * A function to generate create a list of default actions that the scaffolder provides.
@@ -79,7 +49,7 @@ export declare type ActionContext<Input extends JsonObject> = {
79
49
  * @public
80
50
  * @returns A list of actions that can be used in the scaffolder
81
51
  */
82
- export declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction<JsonObject>[];
52
+ export declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction_2<JsonObject>[];
83
53
 
84
54
  /**
85
55
  * The options passed to {@link createBuiltinActions}
@@ -117,7 +87,7 @@ export declare interface CreateBuiltInActionsOptions {
117
87
  export declare function createCatalogRegisterAction(options: {
118
88
  catalogClient: CatalogApi;
119
89
  integrations: ScmIntegrations;
120
- }): TemplateAction< {
90
+ }): TemplateAction_2< {
121
91
  catalogInfoUrl: string;
122
92
  optional?: boolean | undefined;
123
93
  } | {
@@ -130,7 +100,7 @@ optional?: boolean | undefined;
130
100
  * Writes a catalog descriptor file containing the provided entity to a path in the workspace.
131
101
  * @public
132
102
  */
133
- export declare function createCatalogWriteAction(): TemplateAction< {
103
+ export declare function createCatalogWriteAction(): TemplateAction_2< {
134
104
  filePath?: string | undefined;
135
105
  entity: Entity;
136
106
  }>;
@@ -145,7 +115,7 @@ entity: Entity;
145
115
  *
146
116
  * @public
147
117
  */
148
- export declare function createDebugLogAction(): TemplateAction< {
118
+ export declare function createDebugLogAction(): TemplateAction_2< {
149
119
  message?: string | undefined;
150
120
  listWorkspace?: boolean | undefined;
151
121
  }>;
@@ -156,7 +126,7 @@ listWorkspace?: boolean | undefined;
156
126
  */
157
127
  export declare function createFetchCatalogEntityAction(options: {
158
128
  catalogClient: CatalogApi;
159
- }): TemplateAction< {
129
+ }): TemplateAction_2< {
160
130
  entityRef: string;
161
131
  optional?: boolean | undefined;
162
132
  }>;
@@ -169,7 +139,7 @@ optional?: boolean | undefined;
169
139
  export declare function createFetchPlainAction(options: {
170
140
  reader: UrlReader;
171
141
  integrations: ScmIntegrations;
172
- }): TemplateAction< {
142
+ }): TemplateAction_2< {
173
143
  url: string;
174
144
  targetPath?: string | undefined;
175
145
  }>;
@@ -186,7 +156,7 @@ export declare function createFetchTemplateAction(options: {
186
156
  integrations: ScmIntegrations;
187
157
  additionalTemplateFilters?: Record<string, TemplateFilter>;
188
158
  additionalTemplateGlobals?: Record<string, TemplateGlobal>;
189
- }): TemplateAction< {
159
+ }): TemplateAction_2< {
190
160
  url: string;
191
161
  targetPath?: string | undefined;
192
162
  values: any;
@@ -197,13 +167,14 @@ templateFileExtension?: string | boolean | undefined;
197
167
  copyWithoutRender?: string[] | undefined;
198
168
  copyWithoutTemplating?: string[] | undefined;
199
169
  cookiecutterCompat?: boolean | undefined;
170
+ replace?: boolean | undefined;
200
171
  }>;
201
172
 
202
173
  /**
203
174
  * Creates new action that enables deletion of files and directories in the workspace.
204
175
  * @public
205
176
  */
206
- export declare const createFilesystemDeleteAction: () => TemplateAction< {
177
+ export declare const createFilesystemDeleteAction: () => TemplateAction_2< {
207
178
  files: string[];
208
179
  }>;
209
180
 
@@ -211,7 +182,7 @@ files: string[];
211
182
  * Creates a new action that allows renames of files and directories in the workspace.
212
183
  * @public
213
184
  */
214
- export declare const createFilesystemRenameAction: () => TemplateAction< {
185
+ export declare const createFilesystemRenameAction: () => TemplateAction_2< {
215
186
  files: Array<{
216
187
  from: string;
217
188
  to: string;
@@ -226,7 +197,7 @@ overwrite?: boolean;
226
197
  export declare function createGithubActionsDispatchAction(options: {
227
198
  integrations: ScmIntegrations;
228
199
  githubCredentialsProvider?: GithubCredentialsProvider;
229
- }): TemplateAction< {
200
+ }): TemplateAction_2< {
230
201
  repoUrl: string;
231
202
  workflowId: string;
232
203
  branchOrTagName: string;
@@ -243,7 +214,7 @@ token?: string | undefined;
243
214
  export declare function createGithubIssuesLabelAction(options: {
244
215
  integrations: ScmIntegrationRegistry;
245
216
  githubCredentialsProvider?: GithubCredentialsProvider;
246
- }): TemplateAction< {
217
+ }): TemplateAction_2< {
247
218
  repoUrl: string;
248
219
  number: number;
249
220
  labels: string[];
@@ -290,7 +261,7 @@ export declare type CreateGithubPullRequestClientFactoryInput = {
290
261
  export declare function createGithubRepoCreateAction(options: {
291
262
  integrations: ScmIntegrationRegistry;
292
263
  githubCredentialsProvider?: GithubCredentialsProvider;
293
- }): TemplateAction< {
264
+ }): TemplateAction_2< {
294
265
  repoUrl: string;
295
266
  description?: string | undefined;
296
267
  homepage?: string | undefined;
@@ -349,7 +320,7 @@ export declare function createGithubRepoPushAction(options: {
349
320
  integrations: ScmIntegrationRegistry;
350
321
  config: Config;
351
322
  githubCredentialsProvider?: GithubCredentialsProvider;
352
- }): TemplateAction< {
323
+ }): TemplateAction_2< {
353
324
  repoUrl: string;
354
325
  description?: string | undefined;
355
326
  defaultBranch?: string | undefined;
@@ -387,7 +358,7 @@ export declare function createGithubWebhookAction(options: {
387
358
  integrations: ScmIntegrationRegistry;
388
359
  defaultWebhookSecret?: string;
389
360
  githubCredentialsProvider?: GithubCredentialsProvider;
390
- }): TemplateAction< {
361
+ }): TemplateAction_2< {
391
362
  repoUrl: string;
392
363
  webhookUrl: string;
393
364
  webhookSecret?: string | undefined;
@@ -406,7 +377,7 @@ token?: string | undefined;
406
377
  export declare function createPublishAzureAction(options: {
407
378
  integrations: ScmIntegrationRegistry;
408
379
  config: Config;
409
- }): TemplateAction< {
380
+ }): TemplateAction_2< {
410
381
  repoUrl: string;
411
382
  description?: string | undefined;
412
383
  defaultBranch?: string | undefined;
@@ -426,7 +397,7 @@ gitAuthorEmail?: string | undefined;
426
397
  export declare function createPublishBitbucketAction(options: {
427
398
  integrations: ScmIntegrationRegistry;
428
399
  config: Config;
429
- }): TemplateAction< {
400
+ }): TemplateAction_2< {
430
401
  repoUrl: string;
431
402
  description?: string | undefined;
432
403
  defaultBranch?: string | undefined;
@@ -447,7 +418,7 @@ gitAuthorEmail?: string | undefined;
447
418
  export declare function createPublishBitbucketCloudAction(options: {
448
419
  integrations: ScmIntegrationRegistry;
449
420
  config: Config;
450
- }): TemplateAction< {
421
+ }): TemplateAction_2< {
451
422
  repoUrl: string;
452
423
  description?: string | undefined;
453
424
  defaultBranch?: string | undefined;
@@ -464,7 +435,7 @@ token?: string | undefined;
464
435
  export declare function createPublishBitbucketServerAction(options: {
465
436
  integrations: ScmIntegrationRegistry;
466
437
  config: Config;
467
- }): TemplateAction< {
438
+ }): TemplateAction_2< {
468
439
  repoUrl: string;
469
440
  description?: string | undefined;
470
441
  defaultBranch?: string | undefined;
@@ -485,7 +456,7 @@ gitAuthorEmail?: string | undefined;
485
456
  export declare function createPublishGerritAction(options: {
486
457
  integrations: ScmIntegrationRegistry;
487
458
  config: Config;
488
- }): TemplateAction< {
459
+ }): TemplateAction_2< {
489
460
  repoUrl: string;
490
461
  description: string;
491
462
  defaultBranch?: string | undefined;
@@ -502,7 +473,7 @@ sourcePath?: string | undefined;
502
473
  export declare function createPublishGerritReviewAction(options: {
503
474
  integrations: ScmIntegrationRegistry;
504
475
  config: Config;
505
- }): TemplateAction< {
476
+ }): TemplateAction_2< {
506
477
  repoUrl: string;
507
478
  branch?: string | undefined;
508
479
  sourcePath?: string | undefined;
@@ -521,7 +492,7 @@ export declare function createPublishGithubAction(options: {
521
492
  integrations: ScmIntegrationRegistry;
522
493
  config: Config;
523
494
  githubCredentialsProvider?: GithubCredentialsProvider;
524
- }): TemplateAction< {
495
+ }): TemplateAction_2< {
525
496
  repoUrl: string;
526
497
  description?: string | undefined;
527
498
  homepage?: string | undefined;
@@ -580,7 +551,7 @@ requiredCommitSigning?: boolean | undefined;
580
551
  * Creates a Github Pull Request action.
581
552
  * @public
582
553
  */
583
- export declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction< {
554
+ export declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction_2< {
584
555
  title: string;
585
556
  branchName: string;
586
557
  description: string;
@@ -602,7 +573,7 @@ teamReviewers?: string[] | undefined;
602
573
  export declare function createPublishGitlabAction(options: {
603
574
  integrations: ScmIntegrationRegistry;
604
575
  config: Config;
605
- }): TemplateAction< {
576
+ }): TemplateAction_2< {
606
577
  repoUrl: string;
607
578
  defaultBranch?: string | undefined;
608
579
  repoVisibility?: "internal" | "private" | "public" | undefined;
@@ -622,7 +593,7 @@ topics?: string[] | undefined;
622
593
  */
623
594
  export declare const createPublishGitlabMergeRequestAction: (options: {
624
595
  integrations: ScmIntegrationRegistry;
625
- }) => TemplateAction< {
596
+ }) => TemplateAction_2< {
626
597
  repoUrl: string;
627
598
  title: string;
628
599
  description: string;
@@ -644,10 +615,10 @@ assignee?: string | undefined;
644
615
  export declare function createRouter(options: RouterOptions): Promise<express.Router>;
645
616
 
646
617
  /**
647
- * This function is used to create new template actions to get type safety.
648
618
  * @public
619
+ * @deprecated Use `createTemplateAction` from `@backstage/plugin-scaffolder-node` instead
649
620
  */
650
- export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
621
+ export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction_2<TInput>) => TemplateAction_2<TInput>;
651
622
 
652
623
  /**
653
624
  * CreateWorkerOptions
@@ -694,7 +665,7 @@ export declare interface CurrentClaimedTask {
694
665
  /**
695
666
  * The secrets that are stored with the task.
696
667
  */
697
- secrets?: TaskSecrets;
668
+ secrets?: TaskSecrets_2;
698
669
  /**
699
670
  * The creator of the task.
700
671
  */
@@ -794,7 +765,7 @@ export declare interface RouterOptions {
794
765
  database: PluginDatabaseManager;
795
766
  catalogClient: CatalogApi;
796
767
  scheduler?: PluginTaskScheduler;
797
- actions?: TemplateAction<any>[];
768
+ actions?: TemplateAction_2<any>[];
798
769
  /**
799
770
  * @deprecated taskWorkers is deprecated in favor of concurrentTasksLimit option with a single TaskWorker
800
771
  * @defaultValue 1
@@ -839,16 +810,18 @@ export declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
839
810
 
840
811
  /**
841
812
  * Catalog plugin
813
+ *
842
814
  * @alpha
843
815
  */
844
816
  export declare const scaffolderPlugin: (options: ScaffolderPluginOptions) => BackendFeature;
845
817
 
846
818
  /**
847
819
  * Catalog plugin options
820
+ *
848
821
  * @alpha
849
822
  */
850
823
  export declare type ScaffolderPluginOptions = {
851
- actions?: TemplateAction<any>[];
824
+ actions?: TemplateAction_2<any>[];
852
825
  taskWorkers?: number;
853
826
  taskBroker?: TaskBroker;
854
827
  additionalTemplateFilters?: Record<string, TemplateFilter>;
@@ -867,7 +840,7 @@ export declare type SerializedTask = {
867
840
  createdAt: string;
868
841
  lastHeartbeatAt?: string;
869
842
  createdBy?: string;
870
- secrets?: TaskSecrets;
843
+ secrets?: TaskSecrets_2;
871
844
  };
872
845
 
873
846
  /**
@@ -916,7 +889,7 @@ export declare interface TaskBroker {
916
889
  */
917
890
  export declare type TaskBrokerDispatchOptions = {
918
891
  spec: TaskSpec;
919
- secrets?: TaskSecrets;
892
+ secrets?: TaskSecrets_2;
920
893
  createdBy?: string;
921
894
  };
922
895
 
@@ -943,7 +916,7 @@ export declare type TaskCompletionState = 'failed' | 'completed';
943
916
  */
944
917
  export declare interface TaskContext {
945
918
  spec: TaskSpec;
946
- secrets?: TaskSecrets;
919
+ secrets?: TaskSecrets_2;
947
920
  createdBy?: string;
948
921
  done: boolean;
949
922
  isDryRun?: boolean;
@@ -973,7 +946,7 @@ export declare class TaskManager implements TaskContext {
973
946
  static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
974
947
  private constructor();
975
948
  get spec(): TaskSpecV1beta3;
976
- get secrets(): TaskSecrets | undefined;
949
+ get secrets(): TaskSecrets_2 | undefined;
977
950
  get createdBy(): string | undefined;
978
951
  getWorkspaceName(): Promise<string>;
979
952
  get done(): boolean;
@@ -983,13 +956,10 @@ export declare class TaskManager implements TaskContext {
983
956
  }
984
957
 
985
958
  /**
986
- * TaskSecrets
987
- *
988
959
  * @public
960
+ * @deprecated Use `TaskSecrets` from `@backstage/plugin-scaffolder-node` instead
989
961
  */
990
- export declare type TaskSecrets = Record<string, string> & {
991
- backstageToken?: string;
992
- };
962
+ export declare type TaskSecrets = TaskSecrets_2;
993
963
 
994
964
  /**
995
965
  * The status of each step of the Task
@@ -1039,7 +1009,7 @@ export declare interface TaskStore {
1039
1009
  export declare type TaskStoreCreateTaskOptions = {
1040
1010
  spec: TaskSpec;
1041
1011
  createdBy?: string;
1042
- secrets?: TaskSecrets;
1012
+ secrets?: TaskSecrets_2;
1043
1013
  };
1044
1014
 
1045
1015
  /**
@@ -1094,21 +1064,11 @@ export declare class TaskWorker {
1094
1064
  runOneTask(task: TaskContext): Promise<void>;
1095
1065
  }
1096
1066
 
1097
- /** @public */
1098
- export declare type TemplateAction<Input extends JsonObject> = {
1099
- id: string;
1100
- description?: string;
1101
- examples?: {
1102
- description: string;
1103
- example: string;
1104
- }[];
1105
- supportsDryRun?: boolean;
1106
- schema?: {
1107
- input?: Schema;
1108
- output?: Schema;
1109
- };
1110
- handler: (ctx: ActionContext<Input>) => Promise<void>;
1111
- };
1067
+ /**
1068
+ * @public
1069
+ * @deprecated Use `TemplateAction` from `@backstage/plugin-scaffolder-node` instead
1070
+ */
1071
+ export declare type TemplateAction<TInput extends JsonObject> = TemplateAction_2<TInput>;
1112
1072
 
1113
1073
  /**
1114
1074
  * Registry of all registered template actions.
@@ -1116,9 +1076,9 @@ export declare type TemplateAction<Input extends JsonObject> = {
1116
1076
  */
1117
1077
  export declare class TemplateActionRegistry {
1118
1078
  private readonly actions;
1119
- register<TInput extends JsonObject>(action: TemplateAction<TInput>): void;
1120
- get(actionId: string): TemplateAction<JsonObject>;
1121
- list(): TemplateAction<JsonObject>[];
1079
+ register<TInput extends JsonObject>(action: TemplateAction_2<TInput>): void;
1080
+ get(actionId: string): TemplateAction_2<JsonObject>;
1081
+ list(): TemplateAction_2<JsonObject>[];
1122
1082
  }
1123
1083
 
1124
1084
  /** @public */