@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/package.json CHANGED
@@ -1,15 +1,25 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-node",
3
3
  "description": "The plugin-scaffolder-node module for @backstage/plugin-scaffolder-backend",
4
- "version": "0.2.6-next.2",
5
- "main": "dist/index.cjs.js",
6
- "types": "dist/index.d.ts",
4
+ "version": "0.2.7",
5
+ "main": "./dist/index.cjs.js",
6
+ "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
8
8
  "publishConfig": {
9
- "access": "public",
10
- "alphaTypes": "dist/index.alpha.d.ts",
11
- "main": "dist/index.cjs.js",
12
- "types": "dist/index.d.ts"
9
+ "access": "public"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "require": "./dist/index.cjs.js",
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.cjs.js"
16
+ },
17
+ "./alpha": {
18
+ "require": "./dist/alpha.cjs.js",
19
+ "types": "./dist/alpha.d.ts",
20
+ "default": "./dist/alpha.cjs.js"
21
+ },
22
+ "./package.json": "./package.json"
13
23
  },
14
24
  "backstage": {
15
25
  "role": "node-library"
@@ -22,7 +32,7 @@
22
32
  },
23
33
  "scripts": {
24
34
  "start": "backstage-cli package start",
25
- "build": "backstage-cli package build --experimental-type-build",
35
+ "build": "backstage-cli package build",
26
36
  "lint": "backstage-cli package lint",
27
37
  "test": "backstage-cli package test",
28
38
  "clean": "backstage-cli package clean",
@@ -30,12 +40,12 @@
30
40
  "postpack": "backstage-cli package postpack"
31
41
  },
32
42
  "dependencies": {
33
- "@backstage/backend-common": "^0.19.8-next.2",
34
- "@backstage/backend-plugin-api": "^0.6.6-next.2",
35
- "@backstage/catalog-model": "^1.4.3-next.0",
36
- "@backstage/errors": "^1.2.3-next.0",
37
- "@backstage/integration": "^1.7.1-next.1",
38
- "@backstage/plugin-scaffolder-common": "^1.4.2-next.0",
43
+ "@backstage/backend-common": "^0.19.8",
44
+ "@backstage/backend-plugin-api": "^0.6.6",
45
+ "@backstage/catalog-model": "^1.4.3",
46
+ "@backstage/errors": "^1.2.3",
47
+ "@backstage/integration": "^1.7.1",
48
+ "@backstage/plugin-scaffolder-common": "^1.4.2",
39
49
  "@backstage/types": "^1.1.1",
40
50
  "fs-extra": "10.1.0",
41
51
  "jsonschema": "^1.2.6",
@@ -44,8 +54,8 @@
44
54
  "zod-to-json-schema": "^3.20.4"
45
55
  },
46
56
  "devDependencies": {
47
- "@backstage/cli": "^0.23.0-next.2",
48
- "@backstage/config": "^1.1.1-next.0"
57
+ "@backstage/cli": "^0.23.0",
58
+ "@backstage/config": "^1.1.1"
49
59
  },
50
60
  "files": [
51
61
  "alpha",
@@ -1,342 +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
- /**
131
- * Extension point for managing scaffolder actions.
132
- *
133
- * @alpha
134
- */
135
- export declare interface ScaffolderActionsExtensionPoint {
136
- addActions(...actions: TemplateAction_2<any, any>[]): void;
137
- }
138
-
139
- /**
140
- * Extension point for managing scaffolder actions.
141
- *
142
- * @alpha
143
- */
144
- export declare const scaffolderActionsExtensionPoint: ExtensionPoint<ScaffolderActionsExtensionPoint>;
145
-
146
- /**
147
- * Extension point for replacing the scaffolder task broker.
148
- *
149
- * @alpha
150
- */
151
- export declare interface ScaffolderTaskBrokerExtensionPoint {
152
- setTaskBroker(taskBroker: TaskBroker_2): void;
153
- }
154
-
155
- /**
156
- * Extension point for replacing the scaffolder task broker.
157
- *
158
- * @alpha
159
- */
160
- export declare const scaffolderTaskBrokerExtensionPoint: ExtensionPoint<ScaffolderTaskBrokerExtensionPoint>;
161
-
162
- /**
163
- * Extension point for adding template filters and globals.
164
- *
165
- * @alpha
166
- */
167
- export declare interface ScaffolderTemplatingExtensionPoint {
168
- addTemplateFilters(filters: Record<string, TemplateFilter_2>): void;
169
- addTemplateGlobals(filters: Record<string, TemplateGlobal_2>): void;
170
- }
171
-
172
- /**
173
- * Extension point for adding template filters and globals.
174
- *
175
- * @alpha
176
- */
177
- export declare const scaffolderTemplatingExtensionPoint: ExtensionPoint<ScaffolderTemplatingExtensionPoint>;
178
-
179
- /**
180
- * SerializedTask
181
- *
182
- * @public
183
- */
184
- export declare type SerializedTask = {
185
- id: string;
186
- spec: TaskSpec;
187
- status: TaskStatus;
188
- createdAt: string;
189
- lastHeartbeatAt?: string;
190
- createdBy?: string;
191
- secrets?: TaskSecrets;
192
- };
193
-
194
- /**
195
- * SerializedTaskEvent
196
- *
197
- * @public
198
- */
199
- export declare type SerializedTaskEvent = {
200
- id: number;
201
- taskId: string;
202
- body: JsonObject;
203
- type: TaskEventType;
204
- createdAt: string;
205
- };
206
-
207
- /**
208
- * TaskBroker
209
- *
210
- * @public
211
- */
212
- export declare interface TaskBroker {
213
- cancel?(taskId: string): Promise<void>;
214
- claim(): Promise<TaskContext>;
215
- dispatch(options: TaskBrokerDispatchOptions): Promise<TaskBrokerDispatchResult>;
216
- vacuumTasks(options: {
217
- timeoutS: number;
218
- }): Promise<void>;
219
- event$(options: {
220
- taskId: string;
221
- after: number | undefined;
222
- }): Observable<{
223
- events: SerializedTaskEvent[];
224
- }>;
225
- get(taskId: string): Promise<SerializedTask>;
226
- list?(options?: {
227
- createdBy?: string;
228
- }): Promise<{
229
- tasks: SerializedTask[];
230
- }>;
231
- }
232
-
233
- /**
234
- * The options passed to {@link TaskBroker.dispatch}
235
- * Currently a spec and optional secrets
236
- *
237
- * @public
238
- */
239
- export declare type TaskBrokerDispatchOptions = {
240
- spec: TaskSpec;
241
- secrets?: TaskSecrets;
242
- createdBy?: string;
243
- };
244
-
245
- /**
246
- * The result of {@link TaskBroker.dispatch}
247
- *
248
- * @public
249
- */
250
- export declare type TaskBrokerDispatchResult = {
251
- taskId: string;
252
- };
253
-
254
- /**
255
- * The state of a completed task.
256
- *
257
- * @public
258
- */
259
- export declare type TaskCompletionState = 'failed' | 'completed';
260
-
261
- /**
262
- * Task
263
- *
264
- * @public
265
- */
266
- export declare interface TaskContext {
267
- cancelSignal: AbortSignal;
268
- spec: TaskSpec;
269
- secrets?: TaskSecrets;
270
- createdBy?: string;
271
- done: boolean;
272
- isDryRun?: boolean;
273
- complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
274
- emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
275
- getWorkspaceName(): Promise<string>;
276
- }
277
-
278
- /**
279
- * TaskEventType
280
- *
281
- * @public
282
- */
283
- export declare type TaskEventType = 'completion' | 'log' | 'cancelled';
284
-
285
- /**
286
- * TaskSecrets
287
- *
288
- * @public
289
- */
290
- export declare type TaskSecrets = Record<string, string> & {
291
- backstageToken?: string;
292
- };
293
-
294
- /**
295
- * The status of each step of the Task
296
- *
297
- * @public
298
- */
299
- export declare type TaskStatus = 'cancelled' | 'completed' | 'failed' | 'open' | 'processing';
300
-
301
- /** @public */
302
- export declare type TemplateAction<TActionInput extends JsonObject = JsonObject, TActionOutput extends JsonObject = JsonObject> = {
303
- id: string;
304
- description?: string;
305
- examples?: {
306
- description: string;
307
- example: string;
308
- }[];
309
- supportsDryRun?: boolean;
310
- schema?: {
311
- input?: Schema;
312
- output?: Schema;
313
- };
314
- handler: (ctx: ActionContext<TActionInput, TActionOutput>) => Promise<void>;
315
- };
316
-
317
- /** @public */
318
- export declare type TemplateActionOptions<TActionInput extends JsonObject = {}, TActionOutput extends JsonObject = {}, TInputSchema extends Schema | z.ZodType = {}, TOutputSchema extends Schema | z.ZodType = {}> = {
319
- id: string;
320
- description?: string;
321
- examples?: TemplateExample[];
322
- supportsDryRun?: boolean;
323
- schema?: {
324
- input?: TInputSchema;
325
- output?: TOutputSchema;
326
- };
327
- handler: (ctx: ActionContext<TActionInput, TActionOutput>) => Promise<void>;
328
- };
329
-
330
- /** @public */
331
- export declare type TemplateExample = {
332
- description: string;
333
- example: string;
334
- };
335
-
336
- /** @public */
337
- export declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
338
-
339
- /** @public */
340
- export declare type TemplateGlobal = ((...args: JsonValue[]) => JsonValue | undefined) | JsonValue;
341
-
342
- export { }