@backstage/plugin-scaffolder-backend 1.12.1-next.0 → 1.13.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
@@ -1,11 +1,12 @@
1
1
  /// <reference types="node" />
2
2
  import * as _backstage_plugin_scaffolder_node from '@backstage/plugin-scaffolder-node';
3
3
  import { TemplateAction as TemplateAction$1, TaskSecrets as TaskSecrets$1, ActionContext as ActionContext$1 } from '@backstage/plugin-scaffolder-node';
4
+ import * as _backstage_types from '@backstage/types';
5
+ import { JsonValue, HumanDuration, JsonObject, Observable } from '@backstage/types';
4
6
  import { ScmIntegrations, ScmIntegrationRegistry, GithubCredentialsProvider } from '@backstage/integration';
5
7
  import { CatalogApi } from '@backstage/catalog-client';
6
8
  import { UrlReader, PluginDatabaseManager } from '@backstage/backend-common';
7
9
  import { Config } from '@backstage/config';
8
- import { JsonValue, HumanDuration, JsonObject, Observable } from '@backstage/types';
9
10
  import { Duration } from 'luxon';
10
11
  import { Octokit } from 'octokit';
11
12
  import { createPullRequest } from 'octokit-plugin-create-pull-request';
@@ -13,11 +14,14 @@ import { SpawnOptionsWithoutStdio } from 'child_process';
13
14
  import { Writable } from 'stream';
14
15
  import { Knex } from 'knex';
15
16
  import * as _backstage_plugin_scaffolder_common from '@backstage/plugin-scaffolder-common';
16
- import { TaskSpec } from '@backstage/plugin-scaffolder-common';
17
+ import { TaskSpec, TemplateEntityStepV1beta3, TemplateParametersV1beta3 } from '@backstage/plugin-scaffolder-common';
17
18
  import { Logger } from 'winston';
18
19
  import { PluginTaskScheduler } from '@backstage/backend-tasks';
20
+ import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common/alpha';
19
21
  import express from 'express';
20
22
  import { IdentityApi } from '@backstage/plugin-auth-node';
23
+ import { PermissionRuleParams, PermissionEvaluator } from '@backstage/plugin-permission-common';
24
+ import { PermissionRule } from '@backstage/plugin-permission-node';
21
25
  import { Entity } from '@backstage/catalog-model';
22
26
  import { CatalogProcessor, CatalogProcessorEmit } from '@backstage/plugin-catalog-node';
23
27
  import { LocationSpec } from '@backstage/plugin-catalog-common';
@@ -38,16 +42,18 @@ declare function createCatalogRegisterAction(options: {
38
42
  repoContentsUrl: string;
39
43
  catalogInfoPath?: string | undefined;
40
44
  optional?: boolean | undefined;
41
- }>;
45
+ }, _backstage_types.JsonObject>;
42
46
 
43
47
  /**
44
48
  * Writes a catalog descriptor file containing the provided entity to a path in the workspace.
45
49
  * @public
46
50
  */
47
51
  declare function createCatalogWriteAction(): _backstage_plugin_scaffolder_node.TemplateAction<{
52
+ entity: {} & {
53
+ [k: string]: unknown;
54
+ };
48
55
  filePath?: string | undefined;
49
- entity: {};
50
- }>;
56
+ }, _backstage_types.JsonObject>;
51
57
 
52
58
  /**
53
59
  * Returns entity or entities from the catalog by entity reference(s).
@@ -60,6 +66,9 @@ declare function createFetchCatalogEntityAction(options: {
60
66
  entityRef?: string | undefined;
61
67
  entityRefs?: string[] | undefined;
62
68
  optional?: boolean | undefined;
69
+ }, {
70
+ entity?: any;
71
+ entities?: any[] | undefined;
63
72
  }>;
64
73
 
65
74
  /** @public */
@@ -117,7 +126,7 @@ declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => Te
117
126
  declare function createDebugLogAction(): _backstage_plugin_scaffolder_node.TemplateAction<{
118
127
  message?: string | undefined;
119
128
  listWorkspace?: boolean | undefined;
120
- }>;
129
+ }, _backstage_types.JsonObject>;
121
130
 
122
131
  /**
123
132
  * Waits for a certain period of time.
@@ -131,7 +140,7 @@ declare function createDebugLogAction(): _backstage_plugin_scaffolder_node.Templ
131
140
  */
132
141
  declare function createWaitAction(options?: {
133
142
  maxWaitTime?: Duration | HumanDuration;
134
- }): _backstage_plugin_scaffolder_node.TemplateAction<HumanDuration>;
143
+ }): _backstage_plugin_scaffolder_node.TemplateAction<HumanDuration, _backstage_types.JsonObject>;
135
144
 
136
145
  /**
137
146
  * Downloads content and places it in the workspace, or optionally
@@ -144,7 +153,20 @@ declare function createFetchPlainAction(options: {
144
153
  }): _backstage_plugin_scaffolder_node.TemplateAction<{
145
154
  url: string;
146
155
  targetPath?: string | undefined;
147
- }>;
156
+ }, _backstage_types.JsonObject>;
157
+
158
+ /**
159
+ * Downloads content and places it in the workspace, or optionally
160
+ * in a subdirectory specified by the 'targetPath' input option.
161
+ * @public
162
+ */
163
+ declare function createFetchPlainFileAction(options: {
164
+ reader: UrlReader;
165
+ integrations: ScmIntegrations;
166
+ }): _backstage_plugin_scaffolder_node.TemplateAction<{
167
+ url: string;
168
+ targetPath: string;
169
+ }, _backstage_types.JsonObject>;
148
170
 
149
171
  /**
150
172
  * Downloads a skeleton, templates variables into file and directory names and content.
@@ -170,7 +192,7 @@ declare function createFetchTemplateAction(options: {
170
192
  copyWithoutTemplating?: string[] | undefined;
171
193
  cookiecutterCompat?: boolean | undefined;
172
194
  replace?: boolean | undefined;
173
- }>;
195
+ }, _backstage_types.JsonObject>;
174
196
 
175
197
  /**
176
198
  * A helper function that reads the contents of a directory from the given URL.
@@ -192,7 +214,7 @@ declare function fetchContents(options: {
192
214
  */
193
215
  declare const createFilesystemDeleteAction: () => _backstage_plugin_scaffolder_node.TemplateAction<{
194
216
  files: string[];
195
- }>;
217
+ }, _backstage_types.JsonObject>;
196
218
 
197
219
  /**
198
220
  * Creates a new action that allows renames of files and directories in the workspace.
@@ -204,7 +226,7 @@ declare const createFilesystemRenameAction: () => _backstage_plugin_scaffolder_n
204
226
  to: string;
205
227
  overwrite?: boolean;
206
228
  }>;
207
- }>;
229
+ }, _backstage_types.JsonObject>;
208
230
 
209
231
  /**
210
232
  * Creates a new action that initializes a git repository of the content in the workspace
@@ -223,7 +245,7 @@ declare function createPublishAzureAction(options: {
223
245
  gitCommitMessage?: string | undefined;
224
246
  gitAuthorName?: string | undefined;
225
247
  gitAuthorEmail?: string | undefined;
226
- }>;
248
+ }, _backstage_types.JsonObject>;
227
249
 
228
250
  /**
229
251
  * Creates a new action that initializes a git repository of the content in the workspace
@@ -245,7 +267,7 @@ declare function createPublishBitbucketAction(options: {
245
267
  gitCommitMessage?: string | undefined;
246
268
  gitAuthorName?: string | undefined;
247
269
  gitAuthorEmail?: string | undefined;
248
- }>;
270
+ }, _backstage_types.JsonObject>;
249
271
 
250
272
  /**
251
273
  * Creates a new action that initializes a git repository of the content in the workspace
@@ -262,7 +284,7 @@ declare function createPublishBitbucketCloudAction(options: {
262
284
  repoVisibility?: "private" | "public" | undefined;
263
285
  sourcePath?: string | undefined;
264
286
  token?: string | undefined;
265
- }>;
287
+ }, _backstage_types.JsonObject>;
266
288
 
267
289
  /**
268
290
  * Creates a new action that initializes a git repository of the content in the workspace
@@ -283,7 +305,7 @@ declare function createPublishBitbucketServerAction(options: {
283
305
  gitCommitMessage?: string | undefined;
284
306
  gitAuthorName?: string | undefined;
285
307
  gitAuthorEmail?: string | undefined;
286
- }>;
308
+ }, _backstage_types.JsonObject>;
287
309
 
288
310
  /**
289
311
  * Creates a new action that initializes a git repository of the content in the workspace
@@ -301,7 +323,7 @@ declare function createPublishGerritAction(options: {
301
323
  gitAuthorName?: string | undefined;
302
324
  gitAuthorEmail?: string | undefined;
303
325
  sourcePath?: string | undefined;
304
- }>;
326
+ }, _backstage_types.JsonObject>;
305
327
 
306
328
  /**
307
329
  * Creates a new action that creates a Gerrit review
@@ -317,7 +339,7 @@ declare function createPublishGerritReviewAction(options: {
317
339
  gitCommitMessage?: string | undefined;
318
340
  gitAuthorName?: string | undefined;
319
341
  gitAuthorEmail?: string | undefined;
320
- }>;
342
+ }, _backstage_types.JsonObject>;
321
343
 
322
344
  /**
323
345
  * Creates a new action that initializes a git repository of the content in the workspace
@@ -382,7 +404,7 @@ declare function createPublishGithubAction(options: {
382
404
  token?: string | undefined;
383
405
  topics?: string[] | undefined;
384
406
  requiredCommitSigning?: boolean | undefined;
385
- }>;
407
+ }, _backstage_types.JsonObject>;
386
408
 
387
409
  /** @public */
388
410
  declare type OctokitWithPullRequestPluginClient = Octokit & {
@@ -438,7 +460,7 @@ declare const createPublishGithubPullRequestAction: (options: CreateGithubPullRe
438
460
  token?: string | undefined;
439
461
  reviewers?: string[] | undefined;
440
462
  teamReviewers?: string[] | undefined;
441
- }>;
463
+ }, _backstage_types.JsonObject>;
442
464
 
443
465
  /**
444
466
  * Creates a new action that initializes a git repository of the content in the workspace
@@ -460,7 +482,7 @@ declare function createPublishGitlabAction(options: {
460
482
  gitAuthorEmail?: string | undefined;
461
483
  setUserAsOwner?: boolean | undefined;
462
484
  topics?: string[] | undefined;
463
- }>;
485
+ }, _backstage_types.JsonObject>;
464
486
 
465
487
  /**
466
488
  * Create a new action that creates a gitlab merge request.
@@ -482,7 +504,7 @@ declare const createPublishGitlabMergeRequestAction: (options: {
482
504
  projectid?: string | undefined;
483
505
  removeSourceBranch?: boolean | undefined;
484
506
  assignee?: string | undefined;
485
- }>;
507
+ }, _backstage_types.JsonObject>;
486
508
 
487
509
  /**
488
510
  * Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.
@@ -499,7 +521,7 @@ declare function createGithubActionsDispatchAction(options: {
499
521
  [key: string]: string;
500
522
  } | undefined;
501
523
  token?: string | undefined;
502
- }>;
524
+ }, _backstage_types.JsonObject>;
503
525
 
504
526
  /**
505
527
  * Adds labels to a pull request or issue on GitHub
@@ -513,7 +535,7 @@ declare function createGithubIssuesLabelAction(options: {
513
535
  number: number;
514
536
  labels: string[];
515
537
  token?: string | undefined;
516
- }>;
538
+ }, _backstage_types.JsonObject>;
517
539
 
518
540
  /**
519
541
  * Creates a new action that initializes a git repository
@@ -570,7 +592,7 @@ declare function createGithubRepoCreateAction(options: {
570
592
  token?: string | undefined;
571
593
  topics?: string[] | undefined;
572
594
  requireCommitSigning?: boolean | undefined;
573
- }>;
595
+ }, _backstage_types.JsonObject>;
574
596
 
575
597
  /**
576
598
  * Creates a new action that initializes a git repository of the content in the workspace
@@ -610,7 +632,7 @@ declare function createGithubRepoPushAction(options: {
610
632
  sourcePath?: string | undefined;
611
633
  token?: string | undefined;
612
634
  requiredCommitSigning?: boolean | undefined;
613
- }>;
635
+ }, _backstage_types.JsonObject>;
614
636
 
615
637
  /**
616
638
  * Creates new action that creates a webhook for a repository on GitHub.
@@ -629,7 +651,7 @@ declare function createGithubWebhookAction(options: {
629
651
  contentType?: "form" | "json" | undefined;
630
652
  insecureSsl?: boolean | undefined;
631
653
  token?: string | undefined;
632
- }>;
654
+ }, _backstage_types.JsonObject>;
633
655
 
634
656
  /** @public */
635
657
  declare type RunCommandOptions = {
@@ -983,6 +1005,11 @@ declare class TaskWorker {
983
1005
  runOneTask(task: TaskContext): Promise<void>;
984
1006
  }
985
1007
 
1008
+ /**
1009
+ *
1010
+ * @public
1011
+ */
1012
+ declare type TemplatePermissionRuleInput<TParams extends PermissionRuleParams = PermissionRuleParams> = PermissionRule<TemplateEntityStepV1beta3 | TemplateParametersV1beta3, {}, typeof RESOURCE_TYPE_SCAFFOLDER_TEMPLATE, TParams>;
986
1013
  /**
987
1014
  * RouterOptions
988
1015
  *
@@ -1009,6 +1036,8 @@ interface RouterOptions {
1009
1036
  taskBroker?: TaskBroker;
1010
1037
  additionalTemplateFilters?: Record<string, TemplateFilter>;
1011
1038
  additionalTemplateGlobals?: Record<string, TemplateGlobal>;
1039
+ permissionApi?: PermissionEvaluator;
1040
+ permissionRules?: TemplatePermissionRuleInput[];
1012
1041
  identity?: IdentityApi;
1013
1042
  }
1014
1043
  /**
@@ -1034,7 +1063,7 @@ declare type ActionContext<TInput extends JsonObject> = ActionContext$1<TInput>;
1034
1063
  * @public
1035
1064
  * @deprecated Use `createTemplateAction` from `@backstage/plugin-scaffolder-node` instead
1036
1065
  */
1037
- declare const createTemplateAction: <TParams, TInputSchema extends zod.ZodType<any, zod.ZodTypeDef, any> | jsonschema.Schema = {}, TOutputSchema extends zod.ZodType<any, zod.ZodTypeDef, any> | jsonschema.Schema = {}, TActionInput = TInputSchema extends zod.ZodType<any, any, infer IReturn> ? IReturn : TParams>(action: _backstage_plugin_scaffolder_node.TemplateActionOptions<TActionInput, TInputSchema, TOutputSchema>) => TemplateAction$1<TActionInput>;
1066
+ declare const createTemplateAction: <TInputParams extends JsonObject = JsonObject, TOutputParams extends JsonObject = JsonObject, TInputSchema extends zod.ZodType<any, zod.ZodTypeDef, any> | jsonschema.Schema = {}, TOutputSchema extends zod.ZodType<any, zod.ZodTypeDef, any> | jsonschema.Schema = {}, TActionInput = TInputSchema extends zod.ZodType<any, any, infer IReturn> ? IReturn : TInputParams, TActionOutput = TOutputSchema extends zod.ZodType<any, any, infer IReturn_1> ? IReturn_1 : TOutputParams>(action: _backstage_plugin_scaffolder_node.TemplateActionOptions<TActionInput, TActionOutput, TInputSchema, TOutputSchema>) => TemplateAction$1<TActionInput, TActionOutput>;
1038
1067
  /**
1039
1068
  * @public
1040
1069
  * @deprecated Use `TaskSecrets` from `@backstage/plugin-scaffolder-node` instead
@@ -1046,4 +1075,4 @@ declare type TaskSecrets = TaskSecrets$1;
1046
1075
  */
1047
1076
  declare type TemplateAction<TInput extends JsonObject> = TemplateAction$1<TInput>;
1048
1077
 
1049
- export { ActionContext, CreateBuiltInActionsOptions, CreateGithubPullRequestActionOptions, CreateGithubPullRequestClientFactoryInput, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DatabaseTaskStoreOptions, OctokitWithPullRequestPluginClient, RouterOptions, RunCommandOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskStatus, TaskStore, TaskStoreCreateTaskOptions, TaskStoreCreateTaskResult, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskStoreShutDownTaskOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, TemplateGlobal, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchCatalogEntityAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishBitbucketCloudAction, createPublishBitbucketServerAction, createPublishGerritAction, createPublishGerritReviewAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, createWaitAction, executeShellCommand, fetchContents };
1078
+ export { ActionContext, CreateBuiltInActionsOptions, CreateGithubPullRequestActionOptions, CreateGithubPullRequestClientFactoryInput, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DatabaseTaskStoreOptions, OctokitWithPullRequestPluginClient, RouterOptions, RunCommandOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskStatus, TaskStore, TaskStoreCreateTaskOptions, TaskStoreCreateTaskResult, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskStoreShutDownTaskOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, TemplateGlobal, TemplatePermissionRuleInput, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchCatalogEntityAction, createFetchPlainAction, createFetchPlainFileAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishBitbucketCloudAction, createPublishBitbucketServerAction, createPublishGerritAction, createPublishGerritReviewAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, createWaitAction, executeShellCommand, fetchContents };
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.12.1-next.0",
4
+ "version": "1.13.0-next.1",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -44,20 +44,22 @@
44
44
  "build:assets": "node scripts/build-nunjucks.js"
45
45
  },
46
46
  "dependencies": {
47
- "@backstage/backend-common": "^0.18.4-next.0",
48
- "@backstage/backend-plugin-api": "^0.5.1-next.0",
49
- "@backstage/backend-tasks": "^0.5.1-next.0",
47
+ "@backstage/backend-common": "^0.18.4-next.1",
48
+ "@backstage/backend-plugin-api": "^0.5.1-next.1",
49
+ "@backstage/backend-tasks": "^0.5.1-next.1",
50
50
  "@backstage/catalog-client": "^1.4.0",
51
51
  "@backstage/catalog-model": "^1.2.1",
52
52
  "@backstage/config": "^1.0.7",
53
53
  "@backstage/errors": "^1.1.5",
54
- "@backstage/integration": "^1.4.3",
55
- "@backstage/plugin-auth-node": "^0.2.13-next.0",
56
- "@backstage/plugin-catalog-backend": "^1.8.1-next.0",
57
- "@backstage/plugin-catalog-common": "^1.0.12",
58
- "@backstage/plugin-catalog-node": "^1.3.5-next.0",
59
- "@backstage/plugin-scaffolder-common": "^1.2.7-next.0",
60
- "@backstage/plugin-scaffolder-node": "^0.1.2-next.0",
54
+ "@backstage/integration": "^1.4.4-next.0",
55
+ "@backstage/plugin-auth-node": "^0.2.13-next.1",
56
+ "@backstage/plugin-catalog-backend": "^1.8.1-next.1",
57
+ "@backstage/plugin-catalog-common": "^1.0.13-next.0",
58
+ "@backstage/plugin-catalog-node": "^1.3.5-next.1",
59
+ "@backstage/plugin-permission-common": "^0.7.5-next.0",
60
+ "@backstage/plugin-permission-node": "^0.7.7-next.1",
61
+ "@backstage/plugin-scaffolder-common": "^1.2.7-next.1",
62
+ "@backstage/plugin-scaffolder-node": "^0.1.2-next.1",
61
63
  "@backstage/types": "^1.0.2",
62
64
  "@gitbeaker/core": "^35.6.0",
63
65
  "@gitbeaker/node": "^35.1.0",
@@ -92,11 +94,11 @@
92
94
  "winston": "^3.2.1",
93
95
  "yaml": "^2.0.0",
94
96
  "zen-observable": "^0.10.0",
95
- "zod": "~3.18.0"
97
+ "zod": "^3.21.4"
96
98
  },
97
99
  "devDependencies": {
98
- "@backstage/backend-test-utils": "^0.1.36-next.0",
99
- "@backstage/cli": "^0.22.6-next.0",
100
+ "@backstage/backend-test-utils": "^0.1.36-next.1",
101
+ "@backstage/cli": "^0.22.6-next.1",
100
102
  "@types/command-exists": "^1.2.0",
101
103
  "@types/fs-extra": "^9.0.1",
102
104
  "@types/git-url-parse": "^9.0.0",