@backstage/plugin-scaffolder-backend 0.17.2 → 0.17.3
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 +24 -2
- package/dist/index.cjs.js +23 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +104 -10
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ import { Knex } from 'knex';
|
|
|
17
17
|
import express from 'express';
|
|
18
18
|
import { CatalogProcessor, LocationSpec, CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Registers entities from a catalog descriptor file in the workspace into the software catalog.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
20
24
|
declare function createCatalogRegisterAction(options: {
|
|
21
25
|
catalogClient: CatalogApi;
|
|
22
26
|
integrations: ScmIntegrations;
|
|
@@ -29,11 +33,16 @@ declare function createCatalogRegisterAction(options: {
|
|
|
29
33
|
optional?: boolean | undefined;
|
|
30
34
|
}>;
|
|
31
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Writes a catalog descriptor file containing the provided entity to a path in the workspace.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
32
40
|
declare function createCatalogWriteAction(): TemplateAction<{
|
|
33
41
|
filePath?: string | undefined;
|
|
34
42
|
entity: Entity;
|
|
35
43
|
}>;
|
|
36
44
|
|
|
45
|
+
/** @public */
|
|
37
46
|
declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
|
|
38
47
|
|
|
39
48
|
/**
|
|
@@ -219,6 +228,9 @@ interface TaskStore {
|
|
|
219
228
|
}>;
|
|
220
229
|
}
|
|
221
230
|
|
|
231
|
+
/**
|
|
232
|
+
* ActionContext is passed into scaffolder actions.
|
|
233
|
+
* @public */
|
|
222
234
|
declare type ActionContext<Input extends JsonObject> = {
|
|
223
235
|
/**
|
|
224
236
|
* Base URL for the location of the task spec, typically the url of the source entity file.
|
|
@@ -241,6 +253,7 @@ declare type ActionContext<Input extends JsonObject> = {
|
|
|
241
253
|
metadata?: TemplateMetadata;
|
|
242
254
|
templateInfo?: TemplateInfo;
|
|
243
255
|
};
|
|
256
|
+
/** @public */
|
|
244
257
|
declare type TemplateAction<Input extends JsonObject> = {
|
|
245
258
|
id: string;
|
|
246
259
|
description?: string;
|
|
@@ -274,14 +287,25 @@ interface CreateBuiltInActionsOptions {
|
|
|
274
287
|
declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction<JsonObject>[];
|
|
275
288
|
|
|
276
289
|
/**
|
|
290
|
+
* Writes a message into the log or lists all files in the workspace
|
|
291
|
+
*
|
|
292
|
+
* @remarks
|
|
293
|
+
*
|
|
277
294
|
* This task is useful for local development and testing of both the scaffolder
|
|
278
295
|
* and scaffolder templates.
|
|
296
|
+
*
|
|
297
|
+
* @public
|
|
279
298
|
*/
|
|
280
299
|
declare function createDebugLogAction(): TemplateAction<{
|
|
281
300
|
message?: string | undefined;
|
|
282
301
|
listWorkspace?: boolean | undefined;
|
|
283
302
|
}>;
|
|
284
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Downloads content and places it in the workspace, or optionally
|
|
306
|
+
* in a subdirectory specified by the 'targetPath' input option.
|
|
307
|
+
* @public
|
|
308
|
+
*/
|
|
285
309
|
declare function createFetchPlainAction(options: {
|
|
286
310
|
reader: UrlReader;
|
|
287
311
|
integrations: ScmIntegrations;
|
|
@@ -290,6 +314,13 @@ declare function createFetchPlainAction(options: {
|
|
|
290
314
|
targetPath?: string | undefined;
|
|
291
315
|
}>;
|
|
292
316
|
|
|
317
|
+
/**
|
|
318
|
+
* Downloads a skeleton, templates variables into file and directory names and content.
|
|
319
|
+
* Then places the result in the workspace, or optionally in a subdirectory
|
|
320
|
+
* specified by the 'targetPath' input option.
|
|
321
|
+
*
|
|
322
|
+
* @public
|
|
323
|
+
*/
|
|
293
324
|
declare function createFetchTemplateAction(options: {
|
|
294
325
|
reader: UrlReader;
|
|
295
326
|
integrations: ScmIntegrations;
|
|
@@ -317,10 +348,18 @@ declare function fetchContents({ reader, integrations, baseUrl, fetchUrl, output
|
|
|
317
348
|
outputPath: string;
|
|
318
349
|
}): Promise<void>;
|
|
319
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Creates new action that enables deletion of files and directories in the workspace.
|
|
353
|
+
* @public
|
|
354
|
+
*/
|
|
320
355
|
declare const createFilesystemDeleteAction: () => TemplateAction<{
|
|
321
356
|
files: string[];
|
|
322
357
|
}>;
|
|
323
358
|
|
|
359
|
+
/**
|
|
360
|
+
* Creates a new action that allows renames of files and directories in the workspace.
|
|
361
|
+
* @public
|
|
362
|
+
*/
|
|
324
363
|
declare const createFilesystemRenameAction: () => TemplateAction<{
|
|
325
364
|
files: Array<{
|
|
326
365
|
from: string;
|
|
@@ -329,6 +368,11 @@ declare const createFilesystemRenameAction: () => TemplateAction<{
|
|
|
329
368
|
}>;
|
|
330
369
|
}>;
|
|
331
370
|
|
|
371
|
+
/**
|
|
372
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
373
|
+
* and publishes it to Azure.
|
|
374
|
+
* @public
|
|
375
|
+
*/
|
|
332
376
|
declare function createPublishAzureAction(options: {
|
|
333
377
|
integrations: ScmIntegrationRegistry;
|
|
334
378
|
config: Config;
|
|
@@ -340,6 +384,11 @@ declare function createPublishAzureAction(options: {
|
|
|
340
384
|
token?: string | undefined;
|
|
341
385
|
}>;
|
|
342
386
|
|
|
387
|
+
/**
|
|
388
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
389
|
+
* and publishes it to Bitbucket.
|
|
390
|
+
* @public
|
|
391
|
+
*/
|
|
343
392
|
declare function createPublishBitbucketAction(options: {
|
|
344
393
|
integrations: ScmIntegrationRegistry;
|
|
345
394
|
config: Config;
|
|
@@ -357,13 +406,23 @@ declare function createPublishBitbucketAction(options: {
|
|
|
357
406
|
* This task is useful for local development and testing of both the scaffolder
|
|
358
407
|
* and scaffolder templates.
|
|
359
408
|
*
|
|
409
|
+
* @remarks
|
|
410
|
+
*
|
|
360
411
|
* This action is not installed by default and should not be installed in
|
|
361
412
|
* production, as it writes the files to the local filesystem of the scaffolder.
|
|
413
|
+
*
|
|
414
|
+
* @public
|
|
362
415
|
*/
|
|
363
416
|
declare function createPublishFileAction(): TemplateAction<{
|
|
364
417
|
path: string;
|
|
365
418
|
}>;
|
|
366
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
422
|
+
* and publishes it to GitHub.
|
|
423
|
+
*
|
|
424
|
+
* @public
|
|
425
|
+
*/
|
|
367
426
|
declare function createPublishGithubAction(options: {
|
|
368
427
|
integrations: ScmIntegrationRegistry;
|
|
369
428
|
config: Config;
|
|
@@ -384,15 +443,16 @@ declare function createPublishGithubAction(options: {
|
|
|
384
443
|
topics?: string[] | undefined;
|
|
385
444
|
}>;
|
|
386
445
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
446
|
+
/** @public */
|
|
447
|
+
interface OctokitWithPullRequestPluginClient {
|
|
448
|
+
createPullRequest(options: createPullRequest.Options): Promise<{
|
|
449
|
+
data: {
|
|
450
|
+
html_url: string;
|
|
451
|
+
};
|
|
452
|
+
} | null>;
|
|
394
453
|
}
|
|
395
|
-
|
|
454
|
+
/** @public */
|
|
455
|
+
declare type CreateGithubPullRequestClientFactoryInput = {
|
|
396
456
|
integrations: ScmIntegrationRegistry;
|
|
397
457
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
398
458
|
host: string;
|
|
@@ -400,11 +460,16 @@ declare type ClientFactoryInput = {
|
|
|
400
460
|
repo: string;
|
|
401
461
|
token?: string;
|
|
402
462
|
};
|
|
463
|
+
/** @public */
|
|
403
464
|
interface CreateGithubPullRequestActionOptions {
|
|
404
465
|
integrations: ScmIntegrationRegistry;
|
|
405
466
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
406
|
-
clientFactory?: (input:
|
|
467
|
+
clientFactory?: (input: CreateGithubPullRequestClientFactoryInput) => Promise<OctokitWithPullRequestPluginClient>;
|
|
407
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* Creates a Github Pull Request action.
|
|
471
|
+
* @public
|
|
472
|
+
*/
|
|
408
473
|
declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction<{
|
|
409
474
|
title: string;
|
|
410
475
|
branchName: string;
|
|
@@ -415,6 +480,12 @@ declare const createPublishGithubPullRequestAction: ({ integrations, githubCrede
|
|
|
415
480
|
token?: string | undefined;
|
|
416
481
|
}>;
|
|
417
482
|
|
|
483
|
+
/**
|
|
484
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
485
|
+
* and publishes it to GitLab.
|
|
486
|
+
*
|
|
487
|
+
* @public
|
|
488
|
+
*/
|
|
418
489
|
declare function createPublishGitlabAction(options: {
|
|
419
490
|
integrations: ScmIntegrationRegistry;
|
|
420
491
|
config: Config;
|
|
@@ -426,6 +497,11 @@ declare function createPublishGitlabAction(options: {
|
|
|
426
497
|
token?: string | undefined;
|
|
427
498
|
}>;
|
|
428
499
|
|
|
500
|
+
/**
|
|
501
|
+
* Create a new action that creates a gitlab merge request.
|
|
502
|
+
*
|
|
503
|
+
* @public
|
|
504
|
+
*/
|
|
429
505
|
declare const createPublishGitlabMergeRequestAction: (options: {
|
|
430
506
|
integrations: ScmIntegrationRegistry;
|
|
431
507
|
}) => TemplateAction<{
|
|
@@ -438,6 +514,10 @@ declare const createPublishGitlabMergeRequestAction: (options: {
|
|
|
438
514
|
token?: string | undefined;
|
|
439
515
|
}>;
|
|
440
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
441
521
|
declare function createGithubActionsDispatchAction(options: {
|
|
442
522
|
integrations: ScmIntegrations;
|
|
443
523
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
@@ -451,6 +531,10 @@ declare function createGithubActionsDispatchAction(options: {
|
|
|
451
531
|
token?: string | undefined;
|
|
452
532
|
}>;
|
|
453
533
|
|
|
534
|
+
/**
|
|
535
|
+
* Creates new action that creates a webhook for a repository on GitHub.
|
|
536
|
+
* @public
|
|
537
|
+
*/
|
|
454
538
|
declare function createGithubWebhookAction(options: {
|
|
455
539
|
integrations: ScmIntegrationRegistry;
|
|
456
540
|
defaultWebhookSecret?: string;
|
|
@@ -496,6 +580,7 @@ declare class OctokitProvider {
|
|
|
496
580
|
}): Promise<OctokitIntegration>;
|
|
497
581
|
}
|
|
498
582
|
|
|
583
|
+
/** @public */
|
|
499
584
|
declare type RunCommandOptions = {
|
|
500
585
|
/** command to run */
|
|
501
586
|
command: string;
|
|
@@ -519,6 +604,10 @@ declare const executeShellCommand: (options: RunCommandOptions) => Promise<void>
|
|
|
519
604
|
*/
|
|
520
605
|
declare const runCommand: (options: RunCommandOptions) => Promise<void>;
|
|
521
606
|
|
|
607
|
+
/**
|
|
608
|
+
* Registry of all registered template actions.
|
|
609
|
+
* @public
|
|
610
|
+
*/
|
|
522
611
|
declare class TemplateActionRegistry {
|
|
523
612
|
private readonly actions;
|
|
524
613
|
register<TInput extends JsonObject>(action: TemplateAction<TInput>): void;
|
|
@@ -526,6 +615,10 @@ declare class TemplateActionRegistry {
|
|
|
526
615
|
list(): TemplateAction<JsonObject>[];
|
|
527
616
|
}
|
|
528
617
|
|
|
618
|
+
/**
|
|
619
|
+
* This function is used to create new template actions to get type safety.
|
|
620
|
+
* @public
|
|
621
|
+
*/
|
|
529
622
|
declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
|
|
530
623
|
|
|
531
624
|
/**
|
|
@@ -651,6 +744,7 @@ interface RouterOptions {
|
|
|
651
744
|
taskBroker?: TaskBroker;
|
|
652
745
|
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
653
746
|
}
|
|
747
|
+
/** @public */
|
|
654
748
|
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
655
749
|
|
|
656
750
|
/** @public */
|
|
@@ -661,4 +755,4 @@ declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
|
|
|
661
755
|
postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
|
|
662
756
|
}
|
|
663
757
|
|
|
664
|
-
export { ActionContext, CompletedTaskState, CreateBuiltInActionsOptions, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DispatchResult, OctokitProvider, RouterOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, Status, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskState, TaskStatus, TaskStore, TaskStoreCreateTaskOptions, TaskStoreCreateTaskResult, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishFileAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, executeShellCommand, fetchContents, runCommand };
|
|
758
|
+
export { ActionContext, CompletedTaskState, CreateBuiltInActionsOptions, CreateGithubPullRequestActionOptions, CreateGithubPullRequestClientFactoryInput, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DatabaseTaskStoreOptions, DispatchResult, OctokitProvider, OctokitWithPullRequestPluginClient, RouterOptions, RunCommandOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, Status, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskState, TaskStatus, TaskStore, TaskStoreCreateTaskOptions, TaskStoreCreateTaskResult, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishFileAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, executeShellCommand, fetchContents, runCommand };
|
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": "0.17.
|
|
4
|
+
"version": "0.17.3",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"build:assets": "node scripts/build-nunjucks.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@backstage/backend-common": "^0.
|
|
38
|
-
"@backstage/catalog-client": "^0.
|
|
39
|
-
"@backstage/catalog-model": "^0.
|
|
37
|
+
"@backstage/backend-common": "^0.12.0",
|
|
38
|
+
"@backstage/catalog-client": "^0.8.0",
|
|
39
|
+
"@backstage/catalog-model": "^0.12.0",
|
|
40
40
|
"@backstage/config": "^0.1.15",
|
|
41
41
|
"@backstage/errors": "^0.2.2",
|
|
42
|
-
"@backstage/integration": "^0.
|
|
43
|
-
"@backstage/plugin-catalog-backend": "^0.
|
|
44
|
-
"@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.2.
|
|
45
|
-
"@backstage/plugin-scaffolder-common": "^0.2.
|
|
42
|
+
"@backstage/integration": "^0.8.0",
|
|
43
|
+
"@backstage/plugin-catalog-backend": "^0.23.0",
|
|
44
|
+
"@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.2.3",
|
|
45
|
+
"@backstage/plugin-scaffolder-common": "^0.2.3",
|
|
46
46
|
"@backstage/types": "^0.1.3",
|
|
47
47
|
"@gitbeaker/core": "^34.6.0",
|
|
48
48
|
"@gitbeaker/node": "^35.1.0",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"zen-observable": "^0.8.15"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@backstage/cli": "^0.
|
|
80
|
-
"@backstage/test-utils": "^0.
|
|
79
|
+
"@backstage/cli": "^0.15.0",
|
|
80
|
+
"@backstage/test-utils": "^0.3.0",
|
|
81
81
|
"@types/command-exists": "^1.2.0",
|
|
82
82
|
"@types/fs-extra": "^9.0.1",
|
|
83
83
|
"@types/git-url-parse": "^9.0.0",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"assets"
|
|
100
100
|
],
|
|
101
101
|
"configSchema": "config.d.ts",
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "04bb0dd824b78f6b57dac62c3015e681f094045c"
|
|
103
103
|
}
|