@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/dist/index.d.ts CHANGED
@@ -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
@@ -849,7 +820,7 @@ export declare type SerializedTask = {
849
820
  createdAt: string;
850
821
  lastHeartbeatAt?: string;
851
822
  createdBy?: string;
852
- secrets?: TaskSecrets;
823
+ secrets?: TaskSecrets_2;
853
824
  };
854
825
 
855
826
  /**
@@ -898,7 +869,7 @@ export declare interface TaskBroker {
898
869
  */
899
870
  export declare type TaskBrokerDispatchOptions = {
900
871
  spec: TaskSpec;
901
- secrets?: TaskSecrets;
872
+ secrets?: TaskSecrets_2;
902
873
  createdBy?: string;
903
874
  };
904
875
 
@@ -925,7 +896,7 @@ export declare type TaskCompletionState = 'failed' | 'completed';
925
896
  */
926
897
  export declare interface TaskContext {
927
898
  spec: TaskSpec;
928
- secrets?: TaskSecrets;
899
+ secrets?: TaskSecrets_2;
929
900
  createdBy?: string;
930
901
  done: boolean;
931
902
  isDryRun?: boolean;
@@ -955,7 +926,7 @@ export declare class TaskManager implements TaskContext {
955
926
  static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
956
927
  private constructor();
957
928
  get spec(): TaskSpecV1beta3;
958
- get secrets(): TaskSecrets | undefined;
929
+ get secrets(): TaskSecrets_2 | undefined;
959
930
  get createdBy(): string | undefined;
960
931
  getWorkspaceName(): Promise<string>;
961
932
  get done(): boolean;
@@ -965,13 +936,10 @@ export declare class TaskManager implements TaskContext {
965
936
  }
966
937
 
967
938
  /**
968
- * TaskSecrets
969
- *
970
939
  * @public
940
+ * @deprecated Use `TaskSecrets` from `@backstage/plugin-scaffolder-node` instead
971
941
  */
972
- export declare type TaskSecrets = Record<string, string> & {
973
- backstageToken?: string;
974
- };
942
+ export declare type TaskSecrets = TaskSecrets_2;
975
943
 
976
944
  /**
977
945
  * The status of each step of the Task
@@ -1021,7 +989,7 @@ export declare interface TaskStore {
1021
989
  export declare type TaskStoreCreateTaskOptions = {
1022
990
  spec: TaskSpec;
1023
991
  createdBy?: string;
1024
- secrets?: TaskSecrets;
992
+ secrets?: TaskSecrets_2;
1025
993
  };
1026
994
 
1027
995
  /**
@@ -1076,21 +1044,11 @@ export declare class TaskWorker {
1076
1044
  runOneTask(task: TaskContext): Promise<void>;
1077
1045
  }
1078
1046
 
1079
- /** @public */
1080
- export declare type TemplateAction<Input extends JsonObject> = {
1081
- id: string;
1082
- description?: string;
1083
- examples?: {
1084
- description: string;
1085
- example: string;
1086
- }[];
1087
- supportsDryRun?: boolean;
1088
- schema?: {
1089
- input?: Schema;
1090
- output?: Schema;
1091
- };
1092
- handler: (ctx: ActionContext<Input>) => Promise<void>;
1093
- };
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>;
1094
1052
 
1095
1053
  /**
1096
1054
  * Registry of all registered template actions.
@@ -1098,9 +1056,9 @@ export declare type TemplateAction<Input extends JsonObject> = {
1098
1056
  */
1099
1057
  export declare class TemplateActionRegistry {
1100
1058
  private readonly actions;
1101
- register<TInput extends JsonObject>(action: TemplateAction<TInput>): void;
1102
- get(actionId: string): TemplateAction<JsonObject>;
1103
- list(): TemplateAction<JsonObject>[];
1059
+ register<TInput extends JsonObject>(action: TemplateAction_2<TInput>): void;
1060
+ get(actionId: string): TemplateAction_2<JsonObject>;
1061
+ list(): TemplateAction_2<JsonObject>[];
1104
1062
  }
1105
1063
 
1106
1064
  /** @public */
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": "1.10.0",
4
+ "version": "1.11.0-next.0",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -34,18 +34,19 @@
34
34
  "build:assets": "node scripts/build-nunjucks.js"
35
35
  },
36
36
  "dependencies": {
37
- "@backstage/backend-common": "^0.18.0",
38
- "@backstage/backend-plugin-api": "^0.3.0",
39
- "@backstage/backend-tasks": "^0.4.1",
40
- "@backstage/catalog-client": "^1.3.0",
41
- "@backstage/catalog-model": "^1.1.5",
37
+ "@backstage/backend-common": "^0.18.2-next.0",
38
+ "@backstage/backend-plugin-api": "^0.3.2-next.0",
39
+ "@backstage/backend-tasks": "^0.4.3-next.0",
40
+ "@backstage/catalog-client": "^1.3.1-next.0",
41
+ "@backstage/catalog-model": "^1.1.6-next.0",
42
42
  "@backstage/config": "^1.0.6",
43
43
  "@backstage/errors": "^1.1.4",
44
44
  "@backstage/integration": "^1.4.2",
45
- "@backstage/plugin-auth-node": "^0.2.9",
46
- "@backstage/plugin-catalog-backend": "^1.7.0",
47
- "@backstage/plugin-catalog-node": "^1.3.1",
48
- "@backstage/plugin-scaffolder-common": "^1.2.4",
45
+ "@backstage/plugin-auth-node": "^0.2.11-next.0",
46
+ "@backstage/plugin-catalog-backend": "^1.7.2-next.0",
47
+ "@backstage/plugin-catalog-node": "^1.3.3-next.0",
48
+ "@backstage/plugin-scaffolder-common": "^1.2.5-next.0",
49
+ "@backstage/plugin-scaffolder-node": "^0.1.0-next.0",
49
50
  "@backstage/types": "^1.0.2",
50
51
  "@gitbeaker/core": "^35.6.0",
51
52
  "@gitbeaker/node": "^35.1.0",
@@ -82,7 +83,7 @@
82
83
  "zod": "~3.18.0"
83
84
  },
84
85
  "devDependencies": {
85
- "@backstage/backend-test-utils": "^0.1.32",
86
+ "@backstage/backend-test-utils": "^0.1.34-next.0",
86
87
  "@backstage/cli": "^0.22.1",
87
88
  "@types/command-exists": "^1.2.0",
88
89
  "@types/fs-extra": "^9.0.1",