@backstage/plugin-scaffolder-backend 1.11.1-next.0 → 1.12.0-next.2

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 CHANGED
@@ -1,5 +1,48 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 1.12.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 860de10fa67: Make identity valid if subject of token is a backstage server-2-server auth token
8
+ - 65454876fb2: Minor API report tweaks
9
+ - 9968f455921: catalog write action should allow any shape of object
10
+ - Updated dependencies
11
+ - @backstage/plugin-auth-node@0.2.12-next.2
12
+ - @backstage/backend-tasks@0.5.0-next.2
13
+ - @backstage/backend-common@0.18.3-next.2
14
+ - @backstage/backend-plugin-api@0.4.1-next.2
15
+ - @backstage/plugin-catalog-backend@1.8.0-next.2
16
+ - @backstage/plugin-catalog-node@1.3.4-next.2
17
+ - @backstage/plugin-scaffolder-node@0.1.1-next.2
18
+ - @backstage/config@1.0.7-next.0
19
+ - @backstage/integration@1.4.3-next.0
20
+
21
+ ## 1.12.0-next.1
22
+
23
+ ### Minor Changes
24
+
25
+ - 7d724d8ef56: Added the ability to be able to define an actions `input` and `output` schema using `zod` instead of hand writing types and `jsonschema`
26
+
27
+ ### Patch Changes
28
+
29
+ - 52b0022dab7: Updated dependency `msw` to `^1.0.0`.
30
+ - Updated dependencies
31
+ - @backstage/errors@1.1.5-next.0
32
+ - @backstage/backend-common@0.18.3-next.1
33
+ - @backstage/catalog-client@1.4.0-next.1
34
+ - @backstage/integration@1.4.3-next.0
35
+ - @backstage/plugin-auth-node@0.2.12-next.1
36
+ - @backstage/plugin-catalog-backend@1.8.0-next.1
37
+ - @backstage/backend-plugin-api@0.4.1-next.1
38
+ - @backstage/backend-tasks@0.4.4-next.1
39
+ - @backstage/config@1.0.7-next.0
40
+ - @backstage/catalog-model@1.2.1-next.1
41
+ - @backstage/types@1.0.2
42
+ - @backstage/plugin-catalog-node@1.3.4-next.1
43
+ - @backstage/plugin-scaffolder-common@1.2.6-next.1
44
+ - @backstage/plugin-scaffolder-node@0.1.1-next.1
45
+
3
46
  ## 1.11.1-next.0
4
47
 
5
48
  ### Patch Changes
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Scaffolder Backend
2
2
 
3
3
  This is the backend for the default Backstage [software
4
- templates](https://backstage.io/docs/features/software-templates/software-templates-index).
4
+ templates](https://backstage.io/docs/features/software-templates/).
5
5
  This provides the API for the frontend [scaffolder
6
6
  plugin](https://github.com/backstage/backstage/tree/master/plugins/scaffolder),
7
7
  as well as the built-in template actions, tasks and stages.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend",
3
- "version": "1.11.1-next.0",
3
+ "version": "1.12.0-next.2",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/alpha.cjs.js CHANGED
@@ -13,6 +13,7 @@ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
13
13
  var errors = require('@backstage/errors');
14
14
  var yaml = require('yaml');
15
15
  var fs = require('fs-extra');
16
+ var zod = require('zod');
16
17
  var path = require('path');
17
18
  var globby = require('globby');
18
19
  var isbinaryfile = require('isbinaryfile');
@@ -39,7 +40,6 @@ var jsonschema = require('jsonschema');
39
40
  var promClient = require('prom-client');
40
41
  var express = require('express');
41
42
  var Router = require('express-promise-router');
42
- var zod = require('zod');
43
43
  var url = require('url');
44
44
  var os = require('os');
45
45
 
@@ -322,24 +322,16 @@ function createCatalogWriteAction() {
322
322
  return pluginScaffolderNode.createTemplateAction({
323
323
  id: id$2,
324
324
  description: "Writes the catalog-info.yaml for your template",
325
- examples: examples$2,
326
325
  schema: {
327
- input: {
328
- type: "object",
329
- properties: {
330
- filePath: {
331
- title: "Catalog file path",
332
- description: "Defaults to catalog-info.yaml",
333
- type: "string"
334
- },
335
- entity: {
336
- title: "Entity info to write catalog-info.yaml",
337
- description: "You can provide the same values used in the Entity schema.",
338
- type: "object"
339
- }
340
- }
341
- }
326
+ input: zod.z.object({
327
+ filePath: zod.z.string().optional().describe("Defaults to catalog-info.yaml"),
328
+ // TODO: this should reference an zod entity validator if it existed.
329
+ entity: zod.z.object({}).passthrough().describe(
330
+ "You can provide the same values used in the Entity schema."
331
+ )
332
+ })
342
333
  },
334
+ examples: examples$2,
343
335
  supportsDryRun: true,
344
336
  async handler(ctx) {
345
337
  ctx.logStream.write(`Writing catalog-info.yaml`);
@@ -3536,11 +3528,12 @@ const defaultClientFactory = async ({
3536
3528
  ...{ throttle: { enabled: false } }
3537
3529
  });
3538
3530
  };
3539
- const createPublishGithubPullRequestAction = ({
3540
- integrations,
3541
- githubCredentialsProvider,
3542
- clientFactory = defaultClientFactory
3543
- }) => {
3531
+ const createPublishGithubPullRequestAction = (options) => {
3532
+ const {
3533
+ integrations,
3534
+ githubCredentialsProvider,
3535
+ clientFactory = defaultClientFactory
3536
+ } = options;
3544
3537
  return pluginScaffolderNode.createTemplateAction({
3545
3538
  id: "publish:github:pull-request",
3546
3539
  schema: {
@@ -4436,7 +4429,8 @@ class DatabaseTaskStore {
4436
4429
  });
4437
4430
  return { events };
4438
4431
  }
4439
- async shutdownTask({ taskId }) {
4432
+ async shutdownTask(options) {
4433
+ const { taskId } = options;
4440
4434
  const message = `This task was marked as stale as it exceeded its timeout`;
4441
4435
  const statusStepEvents = (await this.listEvents({ taskId })).events.filter(
4442
4436
  ({ body }) => body == null ? void 0 : body.stepId
@@ -5241,13 +5235,12 @@ async function findTemplate(options) {
5241
5235
  function isSupportedTemplate(entity) {
5242
5236
  return entity.apiVersion === "scaffolder.backstage.io/v1beta3";
5243
5237
  }
5244
- function buildDefaultIdentityClient({
5245
- logger
5246
- }) {
5238
+ function buildDefaultIdentityClient(options) {
5247
5239
  return {
5248
5240
  getIdentity: async ({ request }) => {
5249
5241
  var _a;
5250
5242
  const header = request.headers.authorization;
5243
+ const { logger } = options;
5251
5244
  if (!header) {
5252
5245
  return void 0;
5253
5246
  }
@@ -5267,6 +5260,9 @@ function buildDefaultIdentityClient({
5267
5260
  if (typeof sub !== "string") {
5268
5261
  throw new TypeError("Expected string sub claim");
5269
5262
  }
5263
+ if (sub === "backstage-server") {
5264
+ return void 0;
5265
+ }
5270
5266
  catalogModel.parseEntityRef(sub);
5271
5267
  return {
5272
5268
  identity: {
@@ -5300,7 +5296,7 @@ async function createRouter(options) {
5300
5296
  additionalTemplateGlobals
5301
5297
  } = options;
5302
5298
  const logger = parentLogger.child({ plugin: "scaffolder" });
5303
- const identity = options.identity || buildDefaultIdentityClient({ logger });
5299
+ const identity = options.identity || buildDefaultIdentityClient(options);
5304
5300
  const workingDirectory = await getWorkingDirectory(config, logger);
5305
5301
  const integrations = integration.ScmIntegrations.fromConfig(config);
5306
5302
  let taskBroker;