@backstage/plugin-scaffolder-node 0.2.6-next.2 → 0.2.7
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 +22 -0
- package/alpha/package.json +3 -3
- package/dist/alpha.cjs.js +20 -0
- package/dist/alpha.cjs.js.map +1 -0
- package/dist/alpha.d.ts +48 -0
- package/dist/index.cjs.js +0 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +150 -192
- package/package.json +26 -16
- package/dist/index.alpha.d.ts +0 -342
- package/dist/index.beta.d.ts +0 -305
package/dist/index.beta.d.ts
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The scaffolder-node module for `@backstage/plugin-scaffolder-backend`.
|
|
3
|
-
*
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/// <reference types="node" />
|
|
8
|
-
|
|
9
|
-
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
|
10
|
-
import { JsonObject } from '@backstage/types';
|
|
11
|
-
import { JsonValue } from '@backstage/types';
|
|
12
|
-
import { Logger } from 'winston';
|
|
13
|
-
import { Observable } from '@backstage/types';
|
|
14
|
-
import { Schema } from 'jsonschema';
|
|
15
|
-
import { ScmIntegrations } from '@backstage/integration';
|
|
16
|
-
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
17
|
-
import { TaskBroker as TaskBroker_2 } from '@backstage/plugin-scaffolder-node';
|
|
18
|
-
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
|
|
19
|
-
import { TemplateAction as TemplateAction_2 } from '@backstage/plugin-scaffolder-node';
|
|
20
|
-
import { TemplateFilter as TemplateFilter_2 } from '@backstage/plugin-scaffolder-node';
|
|
21
|
-
import { TemplateGlobal as TemplateGlobal_2 } from '@backstage/plugin-scaffolder-node';
|
|
22
|
-
import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
|
|
23
|
-
import { UrlReader } from '@backstage/backend-common';
|
|
24
|
-
import { UserEntity } from '@backstage/catalog-model';
|
|
25
|
-
import { Writable } from 'stream';
|
|
26
|
-
import { z } from 'zod';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* ActionContext is passed into scaffolder actions.
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
export declare type ActionContext<TActionInput extends JsonObject, TActionOutput extends JsonObject = JsonObject> = {
|
|
33
|
-
logger: Logger;
|
|
34
|
-
logStream: Writable;
|
|
35
|
-
secrets?: TaskSecrets;
|
|
36
|
-
workspacePath: string;
|
|
37
|
-
input: TActionInput;
|
|
38
|
-
output(name: keyof TActionOutput, value: TActionOutput[keyof TActionOutput]): void;
|
|
39
|
-
/**
|
|
40
|
-
* Creates a temporary directory for use by the action, which is then cleaned up automatically.
|
|
41
|
-
*/
|
|
42
|
-
createTemporaryDirectory(): Promise<string>;
|
|
43
|
-
templateInfo?: TemplateInfo;
|
|
44
|
-
/**
|
|
45
|
-
* Whether this action invocation is a dry-run or not.
|
|
46
|
-
* This will only ever be true if the actions as marked as supporting dry-runs.
|
|
47
|
-
*/
|
|
48
|
-
isDryRun?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* The user which triggered the action.
|
|
51
|
-
*/
|
|
52
|
-
user?: {
|
|
53
|
-
/**
|
|
54
|
-
* The decorated entity from the Catalog
|
|
55
|
-
*/
|
|
56
|
-
entity?: UserEntity;
|
|
57
|
-
/**
|
|
58
|
-
* An entity ref for the author of the task
|
|
59
|
-
*/
|
|
60
|
-
ref?: string;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Implement the signal to make your custom step abortable https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal
|
|
64
|
-
*/
|
|
65
|
-
signal?: AbortSignal;
|
|
66
|
-
/**
|
|
67
|
-
* Optional value of each invocation
|
|
68
|
-
*/
|
|
69
|
-
each?: JsonObject;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* This function is used to create new template actions to get type safety.
|
|
74
|
-
* Will convert zod schemas to json schemas for use throughout the system.
|
|
75
|
-
* @public
|
|
76
|
-
*/
|
|
77
|
-
export declare const createTemplateAction: <TInputParams extends JsonObject = JsonObject, TOutputParams extends JsonObject = JsonObject, TInputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {}, TOutputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {}, TActionInput extends JsonObject = TInputSchema extends z.ZodType<any, any, infer IReturn> ? IReturn : TInputParams, TActionOutput extends JsonObject = TOutputSchema extends z.ZodType<any, any, infer IReturn_1> ? IReturn_1 : TOutputParams>(action: TemplateActionOptions<TActionInput, TActionOutput, TInputSchema, TOutputSchema>) => TemplateAction<TActionInput, TActionOutput>;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Run a command in a sub-process, normally a shell command.
|
|
81
|
-
*
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
export declare function executeShellCommand(options: ExecuteShellCommandOptions): Promise<void>;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Options for {@link executeShellCommand}.
|
|
88
|
-
*
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
export declare type ExecuteShellCommandOptions = {
|
|
92
|
-
/** command to run */
|
|
93
|
-
command: string;
|
|
94
|
-
/** arguments to pass the command */
|
|
95
|
-
args: string[];
|
|
96
|
-
/** options to pass to spawn */
|
|
97
|
-
options?: SpawnOptionsWithoutStdio;
|
|
98
|
-
/** stream to capture stdout and stderr output */
|
|
99
|
-
logStream?: Writable;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* A helper function that reads the contents of a directory from the given URL.
|
|
104
|
-
* Can be used in your own actions, and also used behind fetch:template and fetch:plain
|
|
105
|
-
*
|
|
106
|
-
* @public
|
|
107
|
-
*/
|
|
108
|
-
export declare function fetchContents(options: {
|
|
109
|
-
reader: UrlReader;
|
|
110
|
-
integrations: ScmIntegrations;
|
|
111
|
-
baseUrl?: string;
|
|
112
|
-
fetchUrl?: string;
|
|
113
|
-
outputPath: string;
|
|
114
|
-
}): Promise<void>;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* A helper function that reads the content of a single file from the given URL.
|
|
118
|
-
* Can be used in your own actions, and also used behind `fetch:plain:file`
|
|
119
|
-
*
|
|
120
|
-
* @public
|
|
121
|
-
*/
|
|
122
|
-
export declare function fetchFile(options: {
|
|
123
|
-
reader: UrlReader;
|
|
124
|
-
integrations: ScmIntegrations;
|
|
125
|
-
baseUrl?: string;
|
|
126
|
-
fetchUrl?: string;
|
|
127
|
-
outputPath: string;
|
|
128
|
-
}): Promise<void>;
|
|
129
|
-
|
|
130
|
-
/* Excluded from this release type: ScaffolderActionsExtensionPoint */
|
|
131
|
-
|
|
132
|
-
/* Excluded from this release type: scaffolderActionsExtensionPoint */
|
|
133
|
-
|
|
134
|
-
/* Excluded from this release type: ScaffolderTaskBrokerExtensionPoint */
|
|
135
|
-
|
|
136
|
-
/* Excluded from this release type: scaffolderTaskBrokerExtensionPoint */
|
|
137
|
-
|
|
138
|
-
/* Excluded from this release type: ScaffolderTemplatingExtensionPoint */
|
|
139
|
-
|
|
140
|
-
/* Excluded from this release type: scaffolderTemplatingExtensionPoint */
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* SerializedTask
|
|
144
|
-
*
|
|
145
|
-
* @public
|
|
146
|
-
*/
|
|
147
|
-
export declare type SerializedTask = {
|
|
148
|
-
id: string;
|
|
149
|
-
spec: TaskSpec;
|
|
150
|
-
status: TaskStatus;
|
|
151
|
-
createdAt: string;
|
|
152
|
-
lastHeartbeatAt?: string;
|
|
153
|
-
createdBy?: string;
|
|
154
|
-
secrets?: TaskSecrets;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* SerializedTaskEvent
|
|
159
|
-
*
|
|
160
|
-
* @public
|
|
161
|
-
*/
|
|
162
|
-
export declare type SerializedTaskEvent = {
|
|
163
|
-
id: number;
|
|
164
|
-
taskId: string;
|
|
165
|
-
body: JsonObject;
|
|
166
|
-
type: TaskEventType;
|
|
167
|
-
createdAt: string;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* TaskBroker
|
|
172
|
-
*
|
|
173
|
-
* @public
|
|
174
|
-
*/
|
|
175
|
-
export declare interface TaskBroker {
|
|
176
|
-
cancel?(taskId: string): Promise<void>;
|
|
177
|
-
claim(): Promise<TaskContext>;
|
|
178
|
-
dispatch(options: TaskBrokerDispatchOptions): Promise<TaskBrokerDispatchResult>;
|
|
179
|
-
vacuumTasks(options: {
|
|
180
|
-
timeoutS: number;
|
|
181
|
-
}): Promise<void>;
|
|
182
|
-
event$(options: {
|
|
183
|
-
taskId: string;
|
|
184
|
-
after: number | undefined;
|
|
185
|
-
}): Observable<{
|
|
186
|
-
events: SerializedTaskEvent[];
|
|
187
|
-
}>;
|
|
188
|
-
get(taskId: string): Promise<SerializedTask>;
|
|
189
|
-
list?(options?: {
|
|
190
|
-
createdBy?: string;
|
|
191
|
-
}): Promise<{
|
|
192
|
-
tasks: SerializedTask[];
|
|
193
|
-
}>;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* The options passed to {@link TaskBroker.dispatch}
|
|
198
|
-
* Currently a spec and optional secrets
|
|
199
|
-
*
|
|
200
|
-
* @public
|
|
201
|
-
*/
|
|
202
|
-
export declare type TaskBrokerDispatchOptions = {
|
|
203
|
-
spec: TaskSpec;
|
|
204
|
-
secrets?: TaskSecrets;
|
|
205
|
-
createdBy?: string;
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* The result of {@link TaskBroker.dispatch}
|
|
210
|
-
*
|
|
211
|
-
* @public
|
|
212
|
-
*/
|
|
213
|
-
export declare type TaskBrokerDispatchResult = {
|
|
214
|
-
taskId: string;
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* The state of a completed task.
|
|
219
|
-
*
|
|
220
|
-
* @public
|
|
221
|
-
*/
|
|
222
|
-
export declare type TaskCompletionState = 'failed' | 'completed';
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Task
|
|
226
|
-
*
|
|
227
|
-
* @public
|
|
228
|
-
*/
|
|
229
|
-
export declare interface TaskContext {
|
|
230
|
-
cancelSignal: AbortSignal;
|
|
231
|
-
spec: TaskSpec;
|
|
232
|
-
secrets?: TaskSecrets;
|
|
233
|
-
createdBy?: string;
|
|
234
|
-
done: boolean;
|
|
235
|
-
isDryRun?: boolean;
|
|
236
|
-
complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
|
|
237
|
-
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
|
|
238
|
-
getWorkspaceName(): Promise<string>;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* TaskEventType
|
|
243
|
-
*
|
|
244
|
-
* @public
|
|
245
|
-
*/
|
|
246
|
-
export declare type TaskEventType = 'completion' | 'log' | 'cancelled';
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* TaskSecrets
|
|
250
|
-
*
|
|
251
|
-
* @public
|
|
252
|
-
*/
|
|
253
|
-
export declare type TaskSecrets = Record<string, string> & {
|
|
254
|
-
backstageToken?: string;
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* The status of each step of the Task
|
|
259
|
-
*
|
|
260
|
-
* @public
|
|
261
|
-
*/
|
|
262
|
-
export declare type TaskStatus = 'cancelled' | 'completed' | 'failed' | 'open' | 'processing';
|
|
263
|
-
|
|
264
|
-
/** @public */
|
|
265
|
-
export declare type TemplateAction<TActionInput extends JsonObject = JsonObject, TActionOutput extends JsonObject = JsonObject> = {
|
|
266
|
-
id: string;
|
|
267
|
-
description?: string;
|
|
268
|
-
examples?: {
|
|
269
|
-
description: string;
|
|
270
|
-
example: string;
|
|
271
|
-
}[];
|
|
272
|
-
supportsDryRun?: boolean;
|
|
273
|
-
schema?: {
|
|
274
|
-
input?: Schema;
|
|
275
|
-
output?: Schema;
|
|
276
|
-
};
|
|
277
|
-
handler: (ctx: ActionContext<TActionInput, TActionOutput>) => Promise<void>;
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
/** @public */
|
|
281
|
-
export declare type TemplateActionOptions<TActionInput extends JsonObject = {}, TActionOutput extends JsonObject = {}, TInputSchema extends Schema | z.ZodType = {}, TOutputSchema extends Schema | z.ZodType = {}> = {
|
|
282
|
-
id: string;
|
|
283
|
-
description?: string;
|
|
284
|
-
examples?: TemplateExample[];
|
|
285
|
-
supportsDryRun?: boolean;
|
|
286
|
-
schema?: {
|
|
287
|
-
input?: TInputSchema;
|
|
288
|
-
output?: TOutputSchema;
|
|
289
|
-
};
|
|
290
|
-
handler: (ctx: ActionContext<TActionInput, TActionOutput>) => Promise<void>;
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
/** @public */
|
|
294
|
-
export declare type TemplateExample = {
|
|
295
|
-
description: string;
|
|
296
|
-
example: string;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
/** @public */
|
|
300
|
-
export declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
|
|
301
|
-
|
|
302
|
-
/** @public */
|
|
303
|
-
export declare type TemplateGlobal = ((...args: JsonValue[]) => JsonValue | undefined) | JsonValue;
|
|
304
|
-
|
|
305
|
-
export { }
|