@backstage/plugin-scaffolder-backend 1.12.0-next.2 → 1.12.1-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 +55 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +402 -164
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/index.cjs.js +403 -164
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +35 -9
- package/package.json +19 -16
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import { ScmIntegrations, ScmIntegrationRegistry, GithubCredentialsProvider } fr
|
|
|
5
5
|
import { CatalogApi } from '@backstage/catalog-client';
|
|
6
6
|
import { UrlReader, PluginDatabaseManager } from '@backstage/backend-common';
|
|
7
7
|
import { Config } from '@backstage/config';
|
|
8
|
-
import { JsonValue, JsonObject, Observable } from '@backstage/types';
|
|
8
|
+
import { JsonValue, HumanDuration, JsonObject, Observable } from '@backstage/types';
|
|
9
|
+
import { Duration } from 'luxon';
|
|
9
10
|
import { Octokit } from 'octokit';
|
|
10
11
|
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
|
11
12
|
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
@@ -18,7 +19,8 @@ import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
|
|
18
19
|
import express from 'express';
|
|
19
20
|
import { IdentityApi } from '@backstage/plugin-auth-node';
|
|
20
21
|
import { Entity } from '@backstage/catalog-model';
|
|
21
|
-
import { CatalogProcessor,
|
|
22
|
+
import { CatalogProcessor, CatalogProcessorEmit } from '@backstage/plugin-catalog-node';
|
|
23
|
+
import { LocationSpec } from '@backstage/plugin-catalog-common';
|
|
22
24
|
import * as jsonschema from 'jsonschema';
|
|
23
25
|
import * as zod from 'zod';
|
|
24
26
|
|
|
@@ -48,13 +50,15 @@ declare function createCatalogWriteAction(): _backstage_plugin_scaffolder_node.T
|
|
|
48
50
|
}>;
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
|
-
* Returns entity from the catalog by entity reference.
|
|
53
|
+
* Returns entity or entities from the catalog by entity reference(s).
|
|
54
|
+
*
|
|
52
55
|
* @public
|
|
53
56
|
*/
|
|
54
57
|
declare function createFetchCatalogEntityAction(options: {
|
|
55
58
|
catalogClient: CatalogApi;
|
|
56
59
|
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
57
|
-
entityRef
|
|
60
|
+
entityRef?: string | undefined;
|
|
61
|
+
entityRefs?: string[] | undefined;
|
|
58
62
|
optional?: boolean | undefined;
|
|
59
63
|
}>;
|
|
60
64
|
|
|
@@ -115,6 +119,20 @@ declare function createDebugLogAction(): _backstage_plugin_scaffolder_node.Templ
|
|
|
115
119
|
listWorkspace?: boolean | undefined;
|
|
116
120
|
}>;
|
|
117
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Waits for a certain period of time.
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
*
|
|
127
|
+
* This task is useful to give some waiting time for manual intervention.
|
|
128
|
+
* Has to be used in a combination with other actions.
|
|
129
|
+
*
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
declare function createWaitAction(options?: {
|
|
133
|
+
maxWaitTime?: Duration | HumanDuration;
|
|
134
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<HumanDuration>;
|
|
135
|
+
|
|
118
136
|
/**
|
|
119
137
|
* Downloads content and places it in the workspace, or optionally
|
|
120
138
|
* in a subdirectory specified by the 'targetPath' input option.
|
|
@@ -647,7 +665,7 @@ declare class TemplateActionRegistry {
|
|
|
647
665
|
*
|
|
648
666
|
* @public
|
|
649
667
|
*/
|
|
650
|
-
declare type TaskStatus = '
|
|
668
|
+
declare type TaskStatus = 'cancelled' | 'completed' | 'failed' | 'open' | 'processing';
|
|
651
669
|
/**
|
|
652
670
|
* The state of a completed task.
|
|
653
671
|
*
|
|
@@ -673,7 +691,7 @@ declare type SerializedTask = {
|
|
|
673
691
|
*
|
|
674
692
|
* @public
|
|
675
693
|
*/
|
|
676
|
-
declare type TaskEventType = 'completion' | 'log';
|
|
694
|
+
declare type TaskEventType = 'completion' | 'log' | 'cancelled';
|
|
677
695
|
/**
|
|
678
696
|
* SerializedTaskEvent
|
|
679
697
|
*
|
|
@@ -711,13 +729,14 @@ declare type TaskBrokerDispatchOptions = {
|
|
|
711
729
|
* @public
|
|
712
730
|
*/
|
|
713
731
|
interface TaskContext {
|
|
732
|
+
cancelSignal: AbortSignal;
|
|
714
733
|
spec: TaskSpec;
|
|
715
734
|
secrets?: TaskSecrets$1;
|
|
716
735
|
createdBy?: string;
|
|
717
736
|
done: boolean;
|
|
718
737
|
isDryRun?: boolean;
|
|
719
|
-
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
|
|
720
738
|
complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
|
|
739
|
+
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
|
|
721
740
|
getWorkspaceName(): Promise<string>;
|
|
722
741
|
}
|
|
723
742
|
/**
|
|
@@ -726,6 +745,7 @@ interface TaskContext {
|
|
|
726
745
|
* @public
|
|
727
746
|
*/
|
|
728
747
|
interface TaskBroker {
|
|
748
|
+
cancel?(taskId: string): Promise<void>;
|
|
729
749
|
claim(): Promise<TaskContext>;
|
|
730
750
|
dispatch(options: TaskBrokerDispatchOptions): Promise<TaskBrokerDispatchResult>;
|
|
731
751
|
vacuumTasks(options: {
|
|
@@ -792,6 +812,7 @@ declare type TaskStoreCreateTaskResult = {
|
|
|
792
812
|
* @public
|
|
793
813
|
*/
|
|
794
814
|
interface TaskStore {
|
|
815
|
+
cancelTask?(options: TaskStoreEmitOptions): Promise<void>;
|
|
795
816
|
createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
|
|
796
817
|
getTask(taskId: string): Promise<SerializedTask>;
|
|
797
818
|
claimTask(): Promise<SerializedTask | undefined>;
|
|
@@ -867,6 +888,9 @@ declare class DatabaseTaskStore implements TaskStore {
|
|
|
867
888
|
events: SerializedTaskEvent[];
|
|
868
889
|
}>;
|
|
869
890
|
shutdownTask(options: TaskStoreShutDownTaskOptions): Promise<void>;
|
|
891
|
+
cancelTask(options: TaskStoreEmitOptions<{
|
|
892
|
+
message: string;
|
|
893
|
+
} & JsonObject>): Promise<void>;
|
|
870
894
|
}
|
|
871
895
|
|
|
872
896
|
/**
|
|
@@ -877,12 +901,14 @@ declare class DatabaseTaskStore implements TaskStore {
|
|
|
877
901
|
declare class TaskManager implements TaskContext {
|
|
878
902
|
private readonly task;
|
|
879
903
|
private readonly storage;
|
|
904
|
+
private readonly signal;
|
|
880
905
|
private readonly logger;
|
|
881
906
|
private isDone;
|
|
882
907
|
private heartbeatTimeoutId?;
|
|
883
|
-
static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
|
|
908
|
+
static create(task: CurrentClaimedTask, storage: TaskStore, abortSignal: AbortSignal, logger: Logger): TaskManager;
|
|
884
909
|
private constructor();
|
|
885
910
|
get spec(): _backstage_plugin_scaffolder_common.TaskSpecV1beta3;
|
|
911
|
+
get cancelSignal(): AbortSignal;
|
|
886
912
|
get secrets(): TaskSecrets$1 | undefined;
|
|
887
913
|
get createdBy(): string | undefined;
|
|
888
914
|
getWorkspaceName(): Promise<string>;
|
|
@@ -1020,4 +1046,4 @@ declare type TaskSecrets = TaskSecrets$1;
|
|
|
1020
1046
|
*/
|
|
1021
1047
|
declare type TemplateAction<TInput extends JsonObject> = TemplateAction$1<TInput>;
|
|
1022
1048
|
|
|
1023
|
-
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, executeShellCommand, fetchContents };
|
|
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 };
|
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.
|
|
4
|
+
"version": "1.12.1-next.0",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -44,24 +44,26 @@
|
|
|
44
44
|
"build:assets": "node scripts/build-nunjucks.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@backstage/backend-common": "^0.18.
|
|
48
|
-
"@backstage/backend-plugin-api": "^0.
|
|
49
|
-
"@backstage/backend-tasks": "^0.5.
|
|
50
|
-
"@backstage/catalog-client": "^1.4.0
|
|
51
|
-
"@backstage/catalog-model": "^1.2.1
|
|
52
|
-
"@backstage/config": "^1.0.7
|
|
53
|
-
"@backstage/errors": "^1.1.5
|
|
54
|
-
"@backstage/integration": "^1.4.3
|
|
55
|
-
"@backstage/plugin-auth-node": "^0.2.
|
|
56
|
-
"@backstage/plugin-catalog-backend": "^1.8.
|
|
57
|
-
"@backstage/plugin-catalog-
|
|
58
|
-
"@backstage/plugin-
|
|
59
|
-
"@backstage/plugin-scaffolder-
|
|
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",
|
|
50
|
+
"@backstage/catalog-client": "^1.4.0",
|
|
51
|
+
"@backstage/catalog-model": "^1.2.1",
|
|
52
|
+
"@backstage/config": "^1.0.7",
|
|
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",
|
|
60
61
|
"@backstage/types": "^1.0.2",
|
|
61
62
|
"@gitbeaker/core": "^35.6.0",
|
|
62
63
|
"@gitbeaker/node": "^35.1.0",
|
|
63
64
|
"@octokit/webhooks": "^10.0.0",
|
|
64
65
|
"@types/express": "^4.17.6",
|
|
66
|
+
"@types/luxon": "^3.0.0",
|
|
65
67
|
"azure-devops-node-api": "^11.0.1",
|
|
66
68
|
"command-exists": "^1.2.9",
|
|
67
69
|
"compression": "^1.7.4",
|
|
@@ -93,8 +95,8 @@
|
|
|
93
95
|
"zod": "~3.18.0"
|
|
94
96
|
},
|
|
95
97
|
"devDependencies": {
|
|
96
|
-
"@backstage/backend-test-utils": "^0.1.
|
|
97
|
-
"@backstage/cli": "^0.22.
|
|
98
|
+
"@backstage/backend-test-utils": "^0.1.36-next.0",
|
|
99
|
+
"@backstage/cli": "^0.22.6-next.0",
|
|
98
100
|
"@types/command-exists": "^1.2.0",
|
|
99
101
|
"@types/fs-extra": "^9.0.1",
|
|
100
102
|
"@types/git-url-parse": "^9.0.0",
|
|
@@ -107,6 +109,7 @@
|
|
|
107
109
|
"mock-fs": "^5.1.0",
|
|
108
110
|
"msw": "^1.0.0",
|
|
109
111
|
"supertest": "^6.1.3",
|
|
112
|
+
"wait-for-expect": "^3.0.2",
|
|
110
113
|
"yaml": "^2.0.0"
|
|
111
114
|
},
|
|
112
115
|
"files": [
|