@backstage/plugin-scaffolder-backend 0.0.0-nightly-20220215022550 → 0.0.0-nightly-20220216022224

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.d.ts CHANGED
@@ -3,11 +3,11 @@ import { ScmIntegrations, ScmIntegrationRegistry, GithubCredentialsProvider } fr
3
3
  import { CatalogApi } from '@backstage/catalog-client';
4
4
  import { Logger } from 'winston';
5
5
  import { Writable } from 'stream';
6
- import * as _backstage_types from '@backstage/types';
7
6
  import { JsonValue, JsonObject } from '@backstage/types';
8
7
  import { Schema } from 'jsonschema';
9
8
  import { TaskSpec, TemplateMetadata } from '@backstage/plugin-scaffolder-common';
10
9
  export { TaskSpec, TaskSpecV1beta2, TaskSpecV1beta3, TemplateMetadata } from '@backstage/plugin-scaffolder-common';
10
+ import { Entity, TemplateEntityV1beta2, LocationSpec } from '@backstage/catalog-model';
11
11
  import { UrlReader, ContainerRunner, PluginDatabaseManager } from '@backstage/backend-common';
12
12
  import { Config } from '@backstage/config';
13
13
  import { createPullRequest } from 'octokit-plugin-create-pull-request';
@@ -16,15 +16,24 @@ export { createFetchCookiecutterAction } from '@backstage/plugin-scaffolder-back
16
16
  import { SpawnOptionsWithoutStdio } from 'child_process';
17
17
  import { Knex } from 'knex';
18
18
  import express from 'express';
19
- import { TemplateEntityV1beta2, Entity, LocationSpec } from '@backstage/catalog-model';
20
19
  import { CatalogProcessor, CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
21
20
 
22
21
  declare function createCatalogRegisterAction(options: {
23
22
  catalogClient: CatalogApi;
24
23
  integrations: ScmIntegrations;
25
- }): TemplateAction<any>;
24
+ }): TemplateAction<{
25
+ catalogInfoUrl: string;
26
+ optional?: boolean | undefined;
27
+ } | {
28
+ repoContentsUrl: string;
29
+ catalogInfoPath?: string | undefined;
30
+ optional?: boolean | undefined;
31
+ }>;
26
32
 
27
- declare function createCatalogWriteAction(): TemplateAction<any>;
33
+ declare function createCatalogWriteAction(): TemplateAction<{
34
+ filePath?: string | undefined;
35
+ entity: Entity;
36
+ }>;
28
37
 
29
38
  /**
30
39
  * A catalog client tailored for reading out entity data from the catalog.
@@ -44,151 +53,6 @@ declare class CatalogEntityClient {
44
53
 
45
54
  declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
46
55
 
47
- declare const createBuiltinActions: (options: {
48
- reader: UrlReader;
49
- integrations: ScmIntegrations;
50
- catalogClient: CatalogApi;
51
- containerRunner?: ContainerRunner;
52
- config: Config;
53
- additionalTemplateFilters?: Record<string, TemplateFilter>;
54
- }) => TemplateAction<any>[];
55
-
56
- /**
57
- * This task is useful for local development and testing of both the scaffolder
58
- * and scaffolder templates.
59
- */
60
- declare function createDebugLogAction(): TemplateAction<any>;
61
-
62
- declare function createFetchPlainAction(options: {
63
- reader: UrlReader;
64
- integrations: ScmIntegrations;
65
- }): TemplateAction<any>;
66
-
67
- declare function createFetchTemplateAction(options: {
68
- reader: UrlReader;
69
- integrations: ScmIntegrations;
70
- additionalTemplateFilters?: Record<string, TemplateFilter>;
71
- }): TemplateAction<any>;
72
-
73
- declare function fetchContents({ reader, integrations, baseUrl, fetchUrl, outputPath, }: {
74
- reader: UrlReader;
75
- integrations: ScmIntegrations;
76
- baseUrl?: string;
77
- fetchUrl?: JsonValue;
78
- outputPath: string;
79
- }): Promise<void>;
80
-
81
- declare const createFilesystemDeleteAction: () => TemplateAction<any>;
82
-
83
- declare const createFilesystemRenameAction: () => TemplateAction<any>;
84
-
85
- declare function createPublishAzureAction(options: {
86
- integrations: ScmIntegrationRegistry;
87
- config: Config;
88
- }): TemplateAction<any>;
89
-
90
- declare function createPublishBitbucketAction(options: {
91
- integrations: ScmIntegrationRegistry;
92
- config: Config;
93
- }): TemplateAction<any>;
94
-
95
- /**
96
- * This task is useful for local development and testing of both the scaffolder
97
- * and scaffolder templates.
98
- *
99
- * This action is not installed by default and should not be installed in
100
- * production, as it writes the files to the local filesystem of the scaffolder.
101
- */
102
- declare function createPublishFileAction(): TemplateAction<any>;
103
-
104
- declare function createPublishGithubAction(options: {
105
- integrations: ScmIntegrationRegistry;
106
- config: Config;
107
- githubCredentialsProvider?: GithubCredentialsProvider;
108
- }): TemplateAction<any>;
109
-
110
- declare type CreatePullRequestResponse = {
111
- data: {
112
- html_url: string;
113
- };
114
- };
115
- interface PullRequestCreator {
116
- createPullRequest(options: createPullRequest.Options): Promise<CreatePullRequestResponse | null>;
117
- }
118
- declare type ClientFactoryInput = {
119
- integrations: ScmIntegrationRegistry;
120
- githubCredentialsProvider?: GithubCredentialsProvider;
121
- host: string;
122
- owner: string;
123
- repo: string;
124
- token?: string;
125
- };
126
- interface CreateGithubPullRequestActionOptions {
127
- integrations: ScmIntegrationRegistry;
128
- githubCredentialsProvider?: GithubCredentialsProvider;
129
- clientFactory?: (input: ClientFactoryInput) => Promise<PullRequestCreator>;
130
- }
131
- declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction<any>;
132
-
133
- declare function createPublishGitlabAction(options: {
134
- integrations: ScmIntegrationRegistry;
135
- config: Config;
136
- }): TemplateAction<any>;
137
-
138
- declare const createPublishGitlabMergeRequestAction: (options: {
139
- integrations: ScmIntegrationRegistry;
140
- }) => TemplateAction<any>;
141
-
142
- declare function createGithubActionsDispatchAction(options: {
143
- integrations: ScmIntegrations;
144
- githubCredentialsProvider?: GithubCredentialsProvider;
145
- }): TemplateAction<any>;
146
-
147
- declare function createGithubWebhookAction(options: {
148
- integrations: ScmIntegrationRegistry;
149
- defaultWebhookSecret?: string;
150
- githubCredentialsProvider?: GithubCredentialsProvider;
151
- }): TemplateAction<any>;
152
-
153
- declare type OctokitIntegration = {
154
- client: Octokit;
155
- token: string;
156
- owner: string;
157
- repo: string;
158
- };
159
- /**
160
- * OctokitProvider provides Octokit client based on ScmIntegrationsRegistry configuration.
161
- * OctokitProvider supports GitHub credentials caching out of the box.
162
- */
163
- declare class OctokitProvider {
164
- private readonly integrations;
165
- private readonly githubCredentialsProvider;
166
- constructor(integrations: ScmIntegrationRegistry, githubCredentialsProvider?: GithubCredentialsProvider);
167
- /**
168
- * gets standard Octokit client based on repository URL.
169
- *
170
- * @param repoUrl - Repository URL
171
- */
172
- getOctokit(repoUrl: string, options?: {
173
- token?: string;
174
- }): Promise<OctokitIntegration>;
175
- }
176
-
177
- declare type RunCommandOptions = {
178
- /** command to run */
179
- command: string;
180
- /** arguments to pass the command */
181
- args: string[];
182
- /** options to pass to spawn */
183
- options?: SpawnOptionsWithoutStdio;
184
- /** stream to capture stdout and stderr output */
185
- logStream?: Writable;
186
- };
187
- /**
188
- * Run a command in a sub-process, normally a shell command.
189
- */
190
- declare const runCommand: ({ command, args, logStream, options, }: RunCommandOptions) => Promise<void>;
191
-
192
56
  /**
193
57
  * Status
194
58
  *
@@ -332,12 +196,7 @@ interface TaskStore {
332
196
  }>;
333
197
  }
334
198
 
335
- declare type PartialJsonObject = Partial<JsonObject>;
336
- declare type PartialJsonValue = PartialJsonObject | JsonValue | undefined;
337
- declare type InputBase = Partial<{
338
- [name: string]: PartialJsonValue;
339
- }>;
340
- declare type ActionContext<Input extends InputBase> = {
199
+ declare type ActionContext<Input extends JsonObject> = {
341
200
  /**
342
201
  * Base URL for the location of the task spec, typically the url of the source entity file.
343
202
  */
@@ -359,7 +218,7 @@ declare type ActionContext<Input extends InputBase> = {
359
218
  createTemporaryDirectory(): Promise<string>;
360
219
  metadata?: TemplateMetadata;
361
220
  };
362
- declare type TemplateAction<Input extends InputBase> = {
221
+ declare type TemplateAction<Input extends JsonObject> = {
363
222
  id: string;
364
223
  description?: string;
365
224
  schema?: {
@@ -369,16 +228,249 @@ declare type TemplateAction<Input extends InputBase> = {
369
228
  handler: (ctx: ActionContext<Input>) => Promise<void>;
370
229
  };
371
230
 
231
+ declare const createBuiltinActions: (options: {
232
+ reader: UrlReader;
233
+ integrations: ScmIntegrations;
234
+ catalogClient: CatalogApi;
235
+ containerRunner?: ContainerRunner;
236
+ config: Config;
237
+ additionalTemplateFilters?: Record<string, TemplateFilter>;
238
+ }) => TemplateAction<JsonObject>[];
239
+
240
+ /**
241
+ * This task is useful for local development and testing of both the scaffolder
242
+ * and scaffolder templates.
243
+ */
244
+ declare function createDebugLogAction(): TemplateAction<{
245
+ message?: string | undefined;
246
+ listWorkspace?: boolean | undefined;
247
+ }>;
248
+
249
+ declare function createFetchPlainAction(options: {
250
+ reader: UrlReader;
251
+ integrations: ScmIntegrations;
252
+ }): TemplateAction<{
253
+ url: string;
254
+ targetPath?: string | undefined;
255
+ }>;
256
+
257
+ declare function createFetchTemplateAction(options: {
258
+ reader: UrlReader;
259
+ integrations: ScmIntegrations;
260
+ additionalTemplateFilters?: Record<string, TemplateFilter>;
261
+ }): TemplateAction<{
262
+ url: string;
263
+ targetPath?: string | undefined;
264
+ values: any;
265
+ templateFileExtension?: string | boolean | undefined;
266
+ copyWithoutRender?: string[] | undefined;
267
+ cookiecutterCompat?: boolean | undefined;
268
+ }>;
269
+
270
+ declare function fetchContents({ reader, integrations, baseUrl, fetchUrl, outputPath, }: {
271
+ reader: UrlReader;
272
+ integrations: ScmIntegrations;
273
+ baseUrl?: string;
274
+ fetchUrl?: JsonValue;
275
+ outputPath: string;
276
+ }): Promise<void>;
277
+
278
+ declare const createFilesystemDeleteAction: () => TemplateAction<{
279
+ files: string[];
280
+ }>;
281
+
282
+ declare const createFilesystemRenameAction: () => TemplateAction<{
283
+ files: Array<{
284
+ from: string;
285
+ to: string;
286
+ overwrite?: boolean;
287
+ }>;
288
+ }>;
289
+
290
+ declare function createPublishAzureAction(options: {
291
+ integrations: ScmIntegrationRegistry;
292
+ config: Config;
293
+ }): TemplateAction<{
294
+ repoUrl: string;
295
+ description?: string | undefined;
296
+ defaultBranch?: string | undefined;
297
+ sourcePath?: string | undefined;
298
+ token?: string | undefined;
299
+ }>;
300
+
301
+ declare function createPublishBitbucketAction(options: {
302
+ integrations: ScmIntegrationRegistry;
303
+ config: Config;
304
+ }): TemplateAction<{
305
+ repoUrl: string;
306
+ description?: string | undefined;
307
+ defaultBranch?: string | undefined;
308
+ repoVisibility?: "private" | "public" | undefined;
309
+ sourcePath?: string | undefined;
310
+ enableLFS?: boolean | undefined;
311
+ token?: string | undefined;
312
+ }>;
313
+
314
+ /**
315
+ * This task is useful for local development and testing of both the scaffolder
316
+ * and scaffolder templates.
317
+ *
318
+ * This action is not installed by default and should not be installed in
319
+ * production, as it writes the files to the local filesystem of the scaffolder.
320
+ */
321
+ declare function createPublishFileAction(): TemplateAction<{
322
+ path: string;
323
+ }>;
324
+
325
+ declare function createPublishGithubAction(options: {
326
+ integrations: ScmIntegrationRegistry;
327
+ config: Config;
328
+ githubCredentialsProvider?: GithubCredentialsProvider;
329
+ }): TemplateAction<{
330
+ repoUrl: string;
331
+ description?: string | undefined;
332
+ access?: string | undefined;
333
+ defaultBranch?: string | undefined;
334
+ sourcePath?: string | undefined;
335
+ requireCodeOwnerReviews?: boolean | undefined;
336
+ repoVisibility?: "private" | "public" | "internal" | undefined;
337
+ collaborators?: {
338
+ username: string;
339
+ access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
340
+ }[] | undefined;
341
+ token?: string | undefined;
342
+ topics?: string[] | undefined;
343
+ }>;
344
+
345
+ declare type CreatePullRequestResponse = {
346
+ data: {
347
+ html_url: string;
348
+ };
349
+ };
350
+ interface PullRequestCreator {
351
+ createPullRequest(options: createPullRequest.Options): Promise<CreatePullRequestResponse | null>;
352
+ }
353
+ declare type ClientFactoryInput = {
354
+ integrations: ScmIntegrationRegistry;
355
+ githubCredentialsProvider?: GithubCredentialsProvider;
356
+ host: string;
357
+ owner: string;
358
+ repo: string;
359
+ token?: string;
360
+ };
361
+ interface CreateGithubPullRequestActionOptions {
362
+ integrations: ScmIntegrationRegistry;
363
+ githubCredentialsProvider?: GithubCredentialsProvider;
364
+ clientFactory?: (input: ClientFactoryInput) => Promise<PullRequestCreator>;
365
+ }
366
+ declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction<{
367
+ title: string;
368
+ branchName: string;
369
+ description: string;
370
+ repoUrl: string;
371
+ targetPath?: string | undefined;
372
+ sourcePath?: string | undefined;
373
+ token?: string | undefined;
374
+ }>;
375
+
376
+ declare function createPublishGitlabAction(options: {
377
+ integrations: ScmIntegrationRegistry;
378
+ config: Config;
379
+ }): TemplateAction<{
380
+ repoUrl: string;
381
+ defaultBranch?: string | undefined;
382
+ repoVisibility?: "private" | "public" | "internal" | undefined;
383
+ sourcePath?: string | undefined;
384
+ token?: string | undefined;
385
+ }>;
386
+
387
+ declare const createPublishGitlabMergeRequestAction: (options: {
388
+ integrations: ScmIntegrationRegistry;
389
+ }) => TemplateAction<{
390
+ projectid: string;
391
+ repoUrl: string;
392
+ title: string;
393
+ description: string;
394
+ branchName: string;
395
+ targetPath: string;
396
+ token?: string | undefined;
397
+ }>;
398
+
399
+ declare function createGithubActionsDispatchAction(options: {
400
+ integrations: ScmIntegrations;
401
+ githubCredentialsProvider?: GithubCredentialsProvider;
402
+ }): TemplateAction<{
403
+ repoUrl: string;
404
+ workflowId: string;
405
+ branchOrTagName: string;
406
+ workflowInputs?: {
407
+ [key: string]: string;
408
+ } | undefined;
409
+ token?: string | undefined;
410
+ }>;
411
+
412
+ declare function createGithubWebhookAction(options: {
413
+ integrations: ScmIntegrationRegistry;
414
+ defaultWebhookSecret?: string;
415
+ githubCredentialsProvider?: GithubCredentialsProvider;
416
+ }): TemplateAction<{
417
+ repoUrl: string;
418
+ webhookUrl: string;
419
+ webhookSecret?: string | undefined;
420
+ events?: string[] | undefined;
421
+ active?: boolean | undefined;
422
+ contentType?: "form" | "json" | undefined;
423
+ insecureSsl?: boolean | undefined;
424
+ token?: string | undefined;
425
+ }>;
426
+
427
+ declare type OctokitIntegration = {
428
+ client: Octokit;
429
+ token: string;
430
+ owner: string;
431
+ repo: string;
432
+ };
433
+ /**
434
+ * OctokitProvider provides Octokit client based on ScmIntegrationsRegistry configuration.
435
+ * OctokitProvider supports GitHub credentials caching out of the box.
436
+ */
437
+ declare class OctokitProvider {
438
+ private readonly integrations;
439
+ private readonly githubCredentialsProvider;
440
+ constructor(integrations: ScmIntegrationRegistry, githubCredentialsProvider?: GithubCredentialsProvider);
441
+ /**
442
+ * gets standard Octokit client based on repository URL.
443
+ *
444
+ * @param repoUrl - Repository URL
445
+ */
446
+ getOctokit(repoUrl: string, options?: {
447
+ token?: string;
448
+ }): Promise<OctokitIntegration>;
449
+ }
450
+
451
+ declare type RunCommandOptions = {
452
+ /** command to run */
453
+ command: string;
454
+ /** arguments to pass the command */
455
+ args: string[];
456
+ /** options to pass to spawn */
457
+ options?: SpawnOptionsWithoutStdio;
458
+ /** stream to capture stdout and stderr output */
459
+ logStream?: Writable;
460
+ };
461
+ /**
462
+ * Run a command in a sub-process, normally a shell command.
463
+ */
464
+ declare const runCommand: ({ command, args, logStream, options, }: RunCommandOptions) => Promise<void>;
465
+
372
466
  declare class TemplateActionRegistry {
373
467
  private readonly actions;
374
- register<Parameters extends InputBase>(action: TemplateAction<Parameters>): void;
375
- get(actionId: string): TemplateAction<any>;
376
- list(): TemplateAction<any>[];
468
+ register<TInput extends JsonObject>(action: TemplateAction<TInput>): void;
469
+ get(actionId: string): TemplateAction<JsonObject>;
470
+ list(): TemplateAction<JsonObject>[];
377
471
  }
378
472
 
379
- declare const createTemplateAction: <Input extends Partial<{
380
- [name: string]: _backstage_types.JsonValue | Partial<_backstage_types.JsonObject> | undefined;
381
- }>>(templateAction: TemplateAction<Input>) => TemplateAction<any>;
473
+ declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
382
474
 
383
475
  /**
384
476
  * DatabaseTaskStore
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.0.0-nightly-20220215022550",
4
+ "version": "0.0.0-nightly-20220216022224",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -31,15 +31,15 @@
31
31
  "build:assets": "node scripts/build-nunjucks.js"
32
32
  },
33
33
  "dependencies": {
34
- "@backstage/backend-common": "^0.0.0-nightly-20220215022550",
35
- "@backstage/catalog-client": "^0.0.0-nightly-20220215022550",
36
- "@backstage/catalog-model": "^0.0.0-nightly-20220215022550",
34
+ "@backstage/backend-common": "^0.0.0-nightly-20220216022224",
35
+ "@backstage/catalog-client": "^0.0.0-nightly-20220216022224",
36
+ "@backstage/catalog-model": "^0.0.0-nightly-20220216022224",
37
37
  "@backstage/config": "^0.1.13",
38
- "@backstage/errors": "^0.0.0-nightly-20220215022550",
39
- "@backstage/integration": "^0.0.0-nightly-20220215022550",
40
- "@backstage/plugin-catalog-backend": "^0.0.0-nightly-20220215022550",
41
- "@backstage/plugin-scaffolder-common": "^0.0.0-nightly-20220215022550",
42
- "@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.1.11",
38
+ "@backstage/errors": "^0.0.0-nightly-20220216022224",
39
+ "@backstage/integration": "^0.0.0-nightly-20220216022224",
40
+ "@backstage/plugin-catalog-backend": "^0.0.0-nightly-20220216022224",
41
+ "@backstage/plugin-scaffolder-common": "^0.0.0-nightly-20220216022224",
42
+ "@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.0.0-nightly-20220216022224",
43
43
  "@backstage/types": "^0.1.1",
44
44
  "@gitbeaker/core": "^34.6.0",
45
45
  "@gitbeaker/node": "^35.1.0",
@@ -73,8 +73,8 @@
73
73
  "vm2": "^3.9.6"
74
74
  },
75
75
  "devDependencies": {
76
- "@backstage/cli": "^0.0.0-nightly-20220215022550",
77
- "@backstage/test-utils": "^0.0.0-nightly-20220215022550",
76
+ "@backstage/cli": "^0.0.0-nightly-20220216022224",
77
+ "@backstage/test-utils": "^0.0.0-nightly-20220216022224",
78
78
  "@types/command-exists": "^1.2.0",
79
79
  "@types/fs-extra": "^9.0.1",
80
80
  "@types/git-url-parse": "^9.0.0",