@backstage/plugin-scaffolder-backend 1.10.1 → 1.11.0-next.1

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,23 @@ 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>;
44
+
45
+ /* Excluded from this release type: catalogModuleTemplateKind */
74
46
 
75
47
  /**
76
48
  * A function to generate create a list of default actions that the scaffolder provides.
@@ -79,7 +51,7 @@ export declare type ActionContext<Input extends JsonObject> = {
79
51
  * @public
80
52
  * @returns A list of actions that can be used in the scaffolder
81
53
  */
82
- export declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction<JsonObject>[];
54
+ export declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction_2<JsonObject>[];
83
55
 
84
56
  /**
85
57
  * The options passed to {@link createBuiltinActions}
@@ -117,7 +89,7 @@ export declare interface CreateBuiltInActionsOptions {
117
89
  export declare function createCatalogRegisterAction(options: {
118
90
  catalogClient: CatalogApi;
119
91
  integrations: ScmIntegrations;
120
- }): TemplateAction< {
92
+ }): TemplateAction_2< {
121
93
  catalogInfoUrl: string;
122
94
  optional?: boolean | undefined;
123
95
  } | {
@@ -130,7 +102,7 @@ optional?: boolean | undefined;
130
102
  * Writes a catalog descriptor file containing the provided entity to a path in the workspace.
131
103
  * @public
132
104
  */
133
- export declare function createCatalogWriteAction(): TemplateAction< {
105
+ export declare function createCatalogWriteAction(): TemplateAction_2< {
134
106
  filePath?: string | undefined;
135
107
  entity: Entity;
136
108
  }>;
@@ -145,7 +117,7 @@ entity: Entity;
145
117
  *
146
118
  * @public
147
119
  */
148
- export declare function createDebugLogAction(): TemplateAction< {
120
+ export declare function createDebugLogAction(): TemplateAction_2< {
149
121
  message?: string | undefined;
150
122
  listWorkspace?: boolean | undefined;
151
123
  }>;
@@ -156,7 +128,7 @@ listWorkspace?: boolean | undefined;
156
128
  */
157
129
  export declare function createFetchCatalogEntityAction(options: {
158
130
  catalogClient: CatalogApi;
159
- }): TemplateAction< {
131
+ }): TemplateAction_2< {
160
132
  entityRef: string;
161
133
  optional?: boolean | undefined;
162
134
  }>;
@@ -169,7 +141,7 @@ optional?: boolean | undefined;
169
141
  export declare function createFetchPlainAction(options: {
170
142
  reader: UrlReader;
171
143
  integrations: ScmIntegrations;
172
- }): TemplateAction< {
144
+ }): TemplateAction_2< {
173
145
  url: string;
174
146
  targetPath?: string | undefined;
175
147
  }>;
@@ -186,7 +158,7 @@ export declare function createFetchTemplateAction(options: {
186
158
  integrations: ScmIntegrations;
187
159
  additionalTemplateFilters?: Record<string, TemplateFilter>;
188
160
  additionalTemplateGlobals?: Record<string, TemplateGlobal>;
189
- }): TemplateAction< {
161
+ }): TemplateAction_2< {
190
162
  url: string;
191
163
  targetPath?: string | undefined;
192
164
  values: any;
@@ -197,13 +169,14 @@ templateFileExtension?: string | boolean | undefined;
197
169
  copyWithoutRender?: string[] | undefined;
198
170
  copyWithoutTemplating?: string[] | undefined;
199
171
  cookiecutterCompat?: boolean | undefined;
172
+ replace?: boolean | undefined;
200
173
  }>;
201
174
 
202
175
  /**
203
176
  * Creates new action that enables deletion of files and directories in the workspace.
204
177
  * @public
205
178
  */
206
- export declare const createFilesystemDeleteAction: () => TemplateAction< {
179
+ export declare const createFilesystemDeleteAction: () => TemplateAction_2< {
207
180
  files: string[];
208
181
  }>;
209
182
 
@@ -211,7 +184,7 @@ files: string[];
211
184
  * Creates a new action that allows renames of files and directories in the workspace.
212
185
  * @public
213
186
  */
214
- export declare const createFilesystemRenameAction: () => TemplateAction< {
187
+ export declare const createFilesystemRenameAction: () => TemplateAction_2< {
215
188
  files: Array<{
216
189
  from: string;
217
190
  to: string;
@@ -226,7 +199,7 @@ overwrite?: boolean;
226
199
  export declare function createGithubActionsDispatchAction(options: {
227
200
  integrations: ScmIntegrations;
228
201
  githubCredentialsProvider?: GithubCredentialsProvider;
229
- }): TemplateAction< {
202
+ }): TemplateAction_2< {
230
203
  repoUrl: string;
231
204
  workflowId: string;
232
205
  branchOrTagName: string;
@@ -243,7 +216,7 @@ token?: string | undefined;
243
216
  export declare function createGithubIssuesLabelAction(options: {
244
217
  integrations: ScmIntegrationRegistry;
245
218
  githubCredentialsProvider?: GithubCredentialsProvider;
246
- }): TemplateAction< {
219
+ }): TemplateAction_2< {
247
220
  repoUrl: string;
248
221
  number: number;
249
222
  labels: string[];
@@ -290,7 +263,7 @@ export declare type CreateGithubPullRequestClientFactoryInput = {
290
263
  export declare function createGithubRepoCreateAction(options: {
291
264
  integrations: ScmIntegrationRegistry;
292
265
  githubCredentialsProvider?: GithubCredentialsProvider;
293
- }): TemplateAction< {
266
+ }): TemplateAction_2< {
294
267
  repoUrl: string;
295
268
  description?: string | undefined;
296
269
  homepage?: string | undefined;
@@ -349,7 +322,7 @@ export declare function createGithubRepoPushAction(options: {
349
322
  integrations: ScmIntegrationRegistry;
350
323
  config: Config;
351
324
  githubCredentialsProvider?: GithubCredentialsProvider;
352
- }): TemplateAction< {
325
+ }): TemplateAction_2< {
353
326
  repoUrl: string;
354
327
  description?: string | undefined;
355
328
  defaultBranch?: string | undefined;
@@ -387,7 +360,7 @@ export declare function createGithubWebhookAction(options: {
387
360
  integrations: ScmIntegrationRegistry;
388
361
  defaultWebhookSecret?: string;
389
362
  githubCredentialsProvider?: GithubCredentialsProvider;
390
- }): TemplateAction< {
363
+ }): TemplateAction_2< {
391
364
  repoUrl: string;
392
365
  webhookUrl: string;
393
366
  webhookSecret?: string | undefined;
@@ -406,7 +379,7 @@ token?: string | undefined;
406
379
  export declare function createPublishAzureAction(options: {
407
380
  integrations: ScmIntegrationRegistry;
408
381
  config: Config;
409
- }): TemplateAction< {
382
+ }): TemplateAction_2< {
410
383
  repoUrl: string;
411
384
  description?: string | undefined;
412
385
  defaultBranch?: string | undefined;
@@ -426,7 +399,7 @@ gitAuthorEmail?: string | undefined;
426
399
  export declare function createPublishBitbucketAction(options: {
427
400
  integrations: ScmIntegrationRegistry;
428
401
  config: Config;
429
- }): TemplateAction< {
402
+ }): TemplateAction_2< {
430
403
  repoUrl: string;
431
404
  description?: string | undefined;
432
405
  defaultBranch?: string | undefined;
@@ -447,7 +420,7 @@ gitAuthorEmail?: string | undefined;
447
420
  export declare function createPublishBitbucketCloudAction(options: {
448
421
  integrations: ScmIntegrationRegistry;
449
422
  config: Config;
450
- }): TemplateAction< {
423
+ }): TemplateAction_2< {
451
424
  repoUrl: string;
452
425
  description?: string | undefined;
453
426
  defaultBranch?: string | undefined;
@@ -464,7 +437,7 @@ token?: string | undefined;
464
437
  export declare function createPublishBitbucketServerAction(options: {
465
438
  integrations: ScmIntegrationRegistry;
466
439
  config: Config;
467
- }): TemplateAction< {
440
+ }): TemplateAction_2< {
468
441
  repoUrl: string;
469
442
  description?: string | undefined;
470
443
  defaultBranch?: string | undefined;
@@ -485,7 +458,7 @@ gitAuthorEmail?: string | undefined;
485
458
  export declare function createPublishGerritAction(options: {
486
459
  integrations: ScmIntegrationRegistry;
487
460
  config: Config;
488
- }): TemplateAction< {
461
+ }): TemplateAction_2< {
489
462
  repoUrl: string;
490
463
  description: string;
491
464
  defaultBranch?: string | undefined;
@@ -502,7 +475,7 @@ sourcePath?: string | undefined;
502
475
  export declare function createPublishGerritReviewAction(options: {
503
476
  integrations: ScmIntegrationRegistry;
504
477
  config: Config;
505
- }): TemplateAction< {
478
+ }): TemplateAction_2< {
506
479
  repoUrl: string;
507
480
  branch?: string | undefined;
508
481
  sourcePath?: string | undefined;
@@ -521,7 +494,7 @@ export declare function createPublishGithubAction(options: {
521
494
  integrations: ScmIntegrationRegistry;
522
495
  config: Config;
523
496
  githubCredentialsProvider?: GithubCredentialsProvider;
524
- }): TemplateAction< {
497
+ }): TemplateAction_2< {
525
498
  repoUrl: string;
526
499
  description?: string | undefined;
527
500
  homepage?: string | undefined;
@@ -580,7 +553,7 @@ requiredCommitSigning?: boolean | undefined;
580
553
  * Creates a Github Pull Request action.
581
554
  * @public
582
555
  */
583
- export declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction< {
556
+ export declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction_2< {
584
557
  title: string;
585
558
  branchName: string;
586
559
  description: string;
@@ -602,7 +575,7 @@ teamReviewers?: string[] | undefined;
602
575
  export declare function createPublishGitlabAction(options: {
603
576
  integrations: ScmIntegrationRegistry;
604
577
  config: Config;
605
- }): TemplateAction< {
578
+ }): TemplateAction_2< {
606
579
  repoUrl: string;
607
580
  defaultBranch?: string | undefined;
608
581
  repoVisibility?: "internal" | "private" | "public" | undefined;
@@ -622,7 +595,7 @@ topics?: string[] | undefined;
622
595
  */
623
596
  export declare const createPublishGitlabMergeRequestAction: (options: {
624
597
  integrations: ScmIntegrationRegistry;
625
- }) => TemplateAction< {
598
+ }) => TemplateAction_2< {
626
599
  repoUrl: string;
627
600
  title: string;
628
601
  description: string;
@@ -644,10 +617,10 @@ assignee?: string | undefined;
644
617
  export declare function createRouter(options: RouterOptions): Promise<express.Router>;
645
618
 
646
619
  /**
647
- * This function is used to create new template actions to get type safety.
648
620
  * @public
621
+ * @deprecated Use `createTemplateAction` from `@backstage/plugin-scaffolder-node` instead
649
622
  */
650
- export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
623
+ export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction_2<TInput>) => TemplateAction_2<TInput>;
651
624
 
652
625
  /**
653
626
  * CreateWorkerOptions
@@ -694,7 +667,7 @@ export declare interface CurrentClaimedTask {
694
667
  /**
695
668
  * The secrets that are stored with the task.
696
669
  */
697
- secrets?: TaskSecrets;
670
+ secrets?: TaskSecrets_2;
698
671
  /**
699
672
  * The creator of the task.
700
673
  */
@@ -794,7 +767,7 @@ export declare interface RouterOptions {
794
767
  database: PluginDatabaseManager;
795
768
  catalogClient: CatalogApi;
796
769
  scheduler?: PluginTaskScheduler;
797
- actions?: TemplateAction<any>[];
770
+ actions?: TemplateAction_2<any>[];
798
771
  /**
799
772
  * @deprecated taskWorkers is deprecated in favor of concurrentTasksLimit option with a single TaskWorker
800
773
  * @defaultValue 1
@@ -823,8 +796,6 @@ export declare type RunCommandOptions = {
823
796
  logStream?: Writable;
824
797
  };
825
798
 
826
- /* Excluded from this release type: scaffolderCatalogModule */
827
-
828
799
  /** @public */
829
800
  export declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
830
801
  getProcessorName(): string;
@@ -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.1",
4
+ "version": "1.11.0-next.1",
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.1",
38
- "@backstage/backend-plugin-api": "^0.3.1",
39
- "@backstage/backend-tasks": "^0.4.2",
40
- "@backstage/catalog-client": "^1.3.0",
41
- "@backstage/catalog-model": "^1.1.5",
37
+ "@backstage/backend-common": "^0.18.2-next.1",
38
+ "@backstage/backend-plugin-api": "^0.3.2-next.1",
39
+ "@backstage/backend-tasks": "^0.4.3-next.1",
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.10",
46
- "@backstage/plugin-catalog-backend": "^1.7.1",
47
- "@backstage/plugin-catalog-node": "^1.3.2",
48
- "@backstage/plugin-scaffolder-common": "^1.2.4",
45
+ "@backstage/plugin-auth-node": "^0.2.11-next.1",
46
+ "@backstage/plugin-catalog-backend": "^1.7.2-next.1",
47
+ "@backstage/plugin-catalog-node": "^1.3.3-next.1",
48
+ "@backstage/plugin-scaffolder-common": "^1.2.5-next.0",
49
+ "@backstage/plugin-scaffolder-node": "^0.1.0-next.1",
49
50
  "@backstage/types": "^1.0.2",
50
51
  "@gitbeaker/core": "^35.6.0",
51
52
  "@gitbeaker/node": "^35.1.0",
@@ -82,8 +83,8 @@
82
83
  "zod": "~3.18.0"
83
84
  },
84
85
  "devDependencies": {
85
- "@backstage/backend-test-utils": "^0.1.33",
86
- "@backstage/cli": "^0.22.1",
86
+ "@backstage/backend-test-utils": "^0.1.34-next.1",
87
+ "@backstage/cli": "^0.22.2-next.0",
87
88
  "@types/command-exists": "^1.2.0",
88
89
  "@types/fs-extra": "^9.0.1",
89
90
  "@types/git-url-parse": "^9.0.0",
@@ -91,7 +92,7 @@
91
92
  "@types/nunjucks": "^3.1.4",
92
93
  "@types/supertest": "^2.0.8",
93
94
  "@types/zen-observable": "^0.8.0",
94
- "esbuild": "^0.16.0",
95
+ "esbuild": "^0.17.0",
95
96
  "jest-when": "^3.1.0",
96
97
  "mock-fs": "^5.1.0",
97
98
  "msw": "^0.49.0",