@backstage/plugin-scaffolder-backend 1.20.0 → 1.21.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.cjs.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var router = require('./cjs/router-e667d04e.cjs.js');
5
+ var router = require('./cjs/router-43c4dd8a.cjs.js');
6
6
  var github = require('@backstage/plugin-scaffolder-backend-module-github');
7
7
  var gitlab = require('@backstage/plugin-scaffolder-backend-module-gitlab');
8
8
  var azure = require('@backstage/plugin-scaffolder-backend-module-azure');
@@ -31,11 +31,11 @@ require('isolated-vm');
31
31
  require('lodash/get');
32
32
  require('uuid');
33
33
  require('zen-observable');
34
+ require('lodash');
34
35
  require('p-queue');
35
36
  require('winston');
36
37
  require('nunjucks');
37
38
  require('stream');
38
- require('lodash');
39
39
  require('@backstage/plugin-permission-node');
40
40
  require('prom-client');
41
41
  require('@backstage/plugin-permission-common');
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ import * as bitbucket from '@backstage/plugin-scaffolder-backend-module-bitbucke
15
15
  import * as gerrit from '@backstage/plugin-scaffolder-backend-module-gerrit';
16
16
  import { Knex } from 'knex';
17
17
  import * as _backstage_plugin_scaffolder_common from '@backstage/plugin-scaffolder-common';
18
- import { TaskSpec, TemplateEntityStepV1beta3, TemplateParametersV1beta3 } from '@backstage/plugin-scaffolder-common';
18
+ import { TaskSpec, TaskRecovery, TemplateEntityStepV1beta3, TemplateParametersV1beta3 } from '@backstage/plugin-scaffolder-common';
19
19
  import { Logger } from 'winston';
20
20
  import { PermissionEvaluator, PermissionRuleParams } from '@backstage/plugin-permission-common';
21
21
  import { PluginTaskScheduler } from '@backstage/backend-tasks';
@@ -23,6 +23,7 @@ import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE, RESOURCE_TYPE_SCAFFOLDER_ACTION } fr
23
23
  import express from 'express';
24
24
  import { IdentityApi } from '@backstage/plugin-auth-node';
25
25
  import { PermissionRule } from '@backstage/plugin-permission-node';
26
+ import { LifecycleService } from '@backstage/backend-plugin-api';
26
27
  import * as jsonschema from 'jsonschema';
27
28
  import * as zod from 'zod';
28
29
  import { ScaffolderEntitiesProcessor as ScaffolderEntitiesProcessor$1 } from '@backstage/plugin-catalog-backend-module-scaffolder-entity-model';
@@ -161,6 +162,7 @@ declare function createFetchPlainAction(options: {
161
162
  }): _backstage_plugin_scaffolder_node.TemplateAction<{
162
163
  url: string;
163
164
  targetPath?: string | undefined;
165
+ token?: string | undefined;
164
166
  }, _backstage_types.JsonObject>;
165
167
 
166
168
  /**
@@ -174,6 +176,7 @@ declare function createFetchPlainFileAction(options: {
174
176
  }): _backstage_plugin_scaffolder_node.TemplateAction<{
175
177
  url: string;
176
178
  targetPath: string;
179
+ token?: string | undefined;
177
180
  }, _backstage_types.JsonObject>;
178
181
 
179
182
  /**
@@ -200,6 +203,9 @@ declare function createFetchTemplateAction(options: {
200
203
  copyWithoutTemplating?: string[] | undefined;
201
204
  cookiecutterCompat?: boolean | undefined;
202
205
  replace?: boolean | undefined;
206
+ trimBlocks?: boolean | undefined;
207
+ lstripBlocks?: boolean | undefined;
208
+ token?: string | undefined;
203
209
  }, _backstage_types.JsonObject>;
204
210
 
205
211
  /**
@@ -275,6 +281,7 @@ declare const createPublishGithubPullRequestAction: (options: github.CreateGithu
275
281
  teamReviewers?: string[] | undefined;
276
282
  commitMessage?: string | undefined;
277
283
  update?: boolean | undefined;
284
+ forceFork?: boolean | undefined;
278
285
  }, _backstage_types.JsonObject>;
279
286
  /**
280
287
  * @public @deprecated use import from \@backstage/plugin-scaffolder-backend-module-bitbucket instead
@@ -438,6 +445,13 @@ type TaskStoreCreateTaskOptions = {
438
445
  createdBy?: string;
439
446
  secrets?: TaskSecrets$1;
440
447
  };
448
+ /**
449
+ * The options passed to {@link TaskStore.recoverTasks}
450
+ * @public
451
+ */
452
+ type TaskStoreRecoverTaskOptions = {
453
+ timeout: HumanDuration;
454
+ };
441
455
  /**
442
456
  * The response from {@link TaskStore.createTask}
443
457
  * @public
@@ -453,6 +467,9 @@ type TaskStoreCreateTaskResult = {
453
467
  interface TaskStore {
454
468
  cancelTask?(options: TaskStoreEmitOptions): Promise<void>;
455
469
  createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
470
+ recoverTasks?(options: TaskStoreRecoverTaskOptions): Promise<{
471
+ ids: string[];
472
+ }>;
456
473
  getTask(taskId: string): Promise<SerializedTask>;
457
474
  claimTask(): Promise<SerializedTask | undefined>;
458
475
  completeTask(options: {
@@ -496,6 +513,9 @@ type DatabaseTaskStoreOptions = {
496
513
  declare class DatabaseTaskStore implements TaskStore {
497
514
  private readonly db;
498
515
  static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
516
+ private isRecoverableTask;
517
+ private parseSpec;
518
+ private parseTaskSecrets;
499
519
  private static getClient;
500
520
  private static runMigrations;
501
521
  private constructor();
@@ -513,6 +533,7 @@ declare class DatabaseTaskStore implements TaskStore {
513
533
  }): Promise<{
514
534
  tasks: {
515
535
  taskId: string;
536
+ recovery?: TaskRecovery;
516
537
  }[];
517
538
  }>;
518
539
  completeTask(options: {
@@ -530,6 +551,9 @@ declare class DatabaseTaskStore implements TaskStore {
530
551
  cancelTask(options: TaskStoreEmitOptions<{
531
552
  message: string;
532
553
  } & JsonObject>): Promise<void>;
554
+ recoverTasks(options: TaskStoreRecoverTaskOptions): Promise<{
555
+ ids: string[];
556
+ }>;
533
557
  }
534
558
 
535
559
  /**
@@ -616,9 +640,13 @@ type CreateWorkerOptions = {
616
640
  declare class TaskWorker {
617
641
  private readonly options;
618
642
  private taskQueue;
643
+ private logger;
644
+ private stopWorkers;
619
645
  private constructor();
620
646
  static create(options: CreateWorkerOptions): Promise<TaskWorker>;
647
+ recoverTasks(): Promise<void>;
621
648
  start(): void;
649
+ stop(): void;
622
650
  protected onReadyToClaimTask(): Promise<void>;
623
651
  runOneTask(task: TaskContext): Promise<void>;
624
652
  }
@@ -642,6 +670,7 @@ interface RouterOptions {
642
670
  logger: Logger;
643
671
  config: Config;
644
672
  reader: UrlReader;
673
+ lifecycle?: LifecycleService;
645
674
  database: PluginDatabaseManager;
646
675
  catalogClient: CatalogApi;
647
676
  scheduler?: PluginTaskScheduler;
@@ -719,4 +748,4 @@ declare const fetchContents: typeof fetchContents$1;
719
748
  */
720
749
  declare const ScaffolderEntitiesProcessor: typeof ScaffolderEntitiesProcessor$1;
721
750
 
722
- export { ActionContext, ActionPermissionRuleInput, CreateBuiltInActionsOptions, CreateGithubPullRequestActionOptions, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DatabaseTaskStoreOptions, 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, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishBitbucketCloudAction, createPublishBitbucketServerAction, createPublishBitbucketServerPullRequestAction, createPublishGerritAction, createPublishGerritReviewAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, createWaitAction, executeShellCommand, fetchContents };
751
+ export { ActionContext, ActionPermissionRuleInput, CreateBuiltInActionsOptions, CreateGithubPullRequestActionOptions, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DatabaseTaskStoreOptions, RouterOptions, RunCommandOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskStatus, TaskStore, TaskStoreCreateTaskOptions, TaskStoreCreateTaskResult, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskStoreRecoverTaskOptions, TaskStoreShutDownTaskOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, TemplateGlobal, TemplatePermissionRuleInput, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchCatalogEntityAction, createFetchPlainAction, createFetchPlainFileAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubDeployKeyAction, createGithubEnvironmentAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishBitbucketCloudAction, createPublishBitbucketServerAction, createPublishBitbucketServerPullRequestAction, 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.20.0",
4
+ "version": "1.21.0-next.1",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -44,26 +44,26 @@
44
44
  "build:assets": "node scripts/build-nunjucks.js"
45
45
  },
46
46
  "dependencies": {
47
- "@backstage/backend-common": "^0.20.1",
48
- "@backstage/backend-plugin-api": "^0.6.9",
49
- "@backstage/backend-tasks": "^0.5.14",
50
- "@backstage/catalog-client": "^1.5.2",
51
- "@backstage/catalog-model": "^1.4.3",
47
+ "@backstage/backend-common": "^0.21.0-next.1",
48
+ "@backstage/backend-plugin-api": "^0.6.10-next.1",
49
+ "@backstage/backend-tasks": "^0.5.15-next.1",
50
+ "@backstage/catalog-client": "^1.6.0-next.1",
51
+ "@backstage/catalog-model": "^1.4.4-next.0",
52
52
  "@backstage/config": "^1.1.1",
53
53
  "@backstage/errors": "^1.2.3",
54
- "@backstage/integration": "^1.8.0",
55
- "@backstage/plugin-auth-node": "^0.4.3",
56
- "@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.1.6",
57
- "@backstage/plugin-catalog-node": "^1.6.1",
54
+ "@backstage/integration": "^1.9.0-next.0",
55
+ "@backstage/plugin-auth-node": "^0.4.4-next.1",
56
+ "@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.1.7-next.1",
57
+ "@backstage/plugin-catalog-node": "^1.6.2-next.1",
58
58
  "@backstage/plugin-permission-common": "^0.7.12",
59
- "@backstage/plugin-permission-node": "^0.7.20",
60
- "@backstage/plugin-scaffolder-backend-module-azure": "^0.1.1",
61
- "@backstage/plugin-scaffolder-backend-module-bitbucket": "^0.1.1",
62
- "@backstage/plugin-scaffolder-backend-module-gerrit": "^0.1.1",
63
- "@backstage/plugin-scaffolder-backend-module-github": "^0.1.1",
64
- "@backstage/plugin-scaffolder-backend-module-gitlab": "^0.2.12",
65
- "@backstage/plugin-scaffolder-common": "^1.4.5",
66
- "@backstage/plugin-scaffolder-node": "^0.2.10",
59
+ "@backstage/plugin-permission-node": "^0.7.21-next.1",
60
+ "@backstage/plugin-scaffolder-backend-module-azure": "^0.1.2-next.1",
61
+ "@backstage/plugin-scaffolder-backend-module-bitbucket": "^0.1.2-next.1",
62
+ "@backstage/plugin-scaffolder-backend-module-gerrit": "^0.1.2-next.1",
63
+ "@backstage/plugin-scaffolder-backend-module-github": "^0.2.0-next.1",
64
+ "@backstage/plugin-scaffolder-backend-module-gitlab": "^0.2.13-next.1",
65
+ "@backstage/plugin-scaffolder-common": "^1.5.0-next.1",
66
+ "@backstage/plugin-scaffolder-node": "^0.3.0-next.1",
67
67
  "@backstage/types": "^1.1.1",
68
68
  "@types/express": "^4.17.6",
69
69
  "@types/luxon": "^3.0.0",
@@ -88,8 +88,8 @@
88
88
  "zod": "^3.22.4"
89
89
  },
90
90
  "devDependencies": {
91
- "@backstage/backend-test-utils": "^0.2.10",
92
- "@backstage/cli": "^0.25.1",
91
+ "@backstage/backend-test-utils": "^0.3.0-next.1",
92
+ "@backstage/cli": "^0.25.2-next.1",
93
93
  "@types/fs-extra": "^9.0.1",
94
94
  "@types/nunjucks": "^3.1.4",
95
95
  "@types/supertest": "^2.0.8",