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

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.
@@ -0,0 +1,31 @@
1
+ import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
2
+ import { TemplateAction } from '@backstage/plugin-scaffolder-node';
3
+ import { TaskBroker, TemplateFilter, TemplateGlobal } from '@backstage/plugin-scaffolder-backend';
4
+
5
+ /**
6
+ * Registers support for the Template kind to the catalog backend plugin.
7
+ *
8
+ * @alpha
9
+ */
10
+ declare const catalogModuleTemplateKind: () => _backstage_backend_plugin_api.BackendFeature;
11
+
12
+ /**
13
+ * Catalog plugin options
14
+ *
15
+ * @alpha
16
+ */
17
+ declare type ScaffolderPluginOptions = {
18
+ actions?: TemplateAction<any>[];
19
+ taskWorkers?: number;
20
+ taskBroker?: TaskBroker;
21
+ additionalTemplateFilters?: Record<string, TemplateFilter>;
22
+ additionalTemplateGlobals?: Record<string, TemplateGlobal>;
23
+ };
24
+ /**
25
+ * Catalog plugin
26
+ *
27
+ * @alpha
28
+ */
29
+ declare const scaffolderPlugin: (options: ScaffolderPluginOptions) => _backstage_backend_plugin_api.BackendFeature;
30
+
31
+ export { ScaffolderPluginOptions, catalogModuleTemplateKind, scaffolderPlugin };
package/dist/index.cjs.js CHANGED
@@ -40,8 +40,6 @@ var zod = require('zod');
40
40
  var url = require('url');
41
41
  var os = require('os');
42
42
  var pluginCatalogBackend = require('@backstage/plugin-catalog-backend');
43
- var backendPluginApi = require('@backstage/backend-plugin-api');
44
- var pluginCatalogNode = require('@backstage/plugin-catalog-node');
45
43
 
46
44
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
47
45
 
@@ -350,6 +348,9 @@ function createFetchCatalogEntityAction(options) {
350
348
  throw e;
351
349
  }
352
350
  }
351
+ if (!entity && !optional) {
352
+ throw new Error(`Entity ${entityRef} not found`);
353
+ }
353
354
  ctx.output("entity", entity != null ? entity : null);
354
355
  }
355
356
  });
@@ -5640,115 +5641,6 @@ class ScaffolderEntitiesProcessor {
5640
5641
  }
5641
5642
  }
5642
5643
 
5643
- const catalogModuleTemplateKind = backendPluginApi.createBackendModule({
5644
- moduleId: "scaffolder",
5645
- pluginId: "templateKind",
5646
- register(env) {
5647
- env.registerInit({
5648
- deps: {
5649
- catalog: pluginCatalogNode.catalogProcessingExtensionPoint
5650
- },
5651
- async init({ catalog }) {
5652
- catalog.addProcessor(new ScaffolderEntitiesProcessor());
5653
- }
5654
- });
5655
- }
5656
- });
5657
-
5658
- var __accessCheck = (obj, member, msg) => {
5659
- if (!member.has(obj))
5660
- throw TypeError("Cannot " + msg);
5661
- };
5662
- var __privateGet = (obj, member, getter) => {
5663
- __accessCheck(obj, member, "read from private field");
5664
- return getter ? getter.call(obj) : member.get(obj);
5665
- };
5666
- var __privateAdd = (obj, member, value) => {
5667
- if (member.has(obj))
5668
- throw TypeError("Cannot add the same private member more than once");
5669
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
5670
- };
5671
- var _actions;
5672
- class ScaffolderActionsExtensionPointImpl {
5673
- constructor() {
5674
- __privateAdd(this, _actions, new Array());
5675
- }
5676
- addActions(...actions) {
5677
- __privateGet(this, _actions).push(...actions);
5678
- }
5679
- get actions() {
5680
- return __privateGet(this, _actions);
5681
- }
5682
- }
5683
- _actions = new WeakMap();
5684
- const scaffolderPlugin = backendPluginApi.createBackendPlugin(
5685
- (options) => ({
5686
- pluginId: "scaffolder",
5687
- register(env) {
5688
- const actionsExtensions = new ScaffolderActionsExtensionPointImpl();
5689
- env.registerExtensionPoint(
5690
- pluginScaffolderNode.scaffolderActionsExtensionPoint,
5691
- actionsExtensions
5692
- );
5693
- env.registerInit({
5694
- deps: {
5695
- logger: backendPluginApi.coreServices.logger,
5696
- config: backendPluginApi.coreServices.config,
5697
- reader: backendPluginApi.coreServices.urlReader,
5698
- permissions: backendPluginApi.coreServices.permissions,
5699
- database: backendPluginApi.coreServices.database,
5700
- httpRouter: backendPluginApi.coreServices.httpRouter,
5701
- catalogClient: pluginCatalogNode.catalogServiceRef
5702
- },
5703
- async init({
5704
- logger,
5705
- config,
5706
- reader,
5707
- database,
5708
- httpRouter,
5709
- catalogClient
5710
- }) {
5711
- const {
5712
- additionalTemplateFilters,
5713
- taskBroker,
5714
- taskWorkers,
5715
- additionalTemplateGlobals
5716
- } = options;
5717
- const log = backendCommon.loggerToWinstonLogger(logger);
5718
- const actions = options.actions || [
5719
- ...actionsExtensions.actions,
5720
- ...createBuiltinActions({
5721
- integrations: integration.ScmIntegrations.fromConfig(config),
5722
- catalogClient,
5723
- reader,
5724
- config,
5725
- additionalTemplateFilters,
5726
- additionalTemplateGlobals
5727
- })
5728
- ];
5729
- const actionIds = actions.map((action) => action.id).join(", ");
5730
- log.info(
5731
- `Starting scaffolder with the following actions enabled ${actionIds}`
5732
- );
5733
- const router = await createRouter({
5734
- logger: log,
5735
- config,
5736
- database,
5737
- catalogClient,
5738
- reader,
5739
- actions,
5740
- taskBroker,
5741
- taskWorkers,
5742
- additionalTemplateFilters,
5743
- additionalTemplateGlobals
5744
- });
5745
- httpRouter.use(router);
5746
- }
5747
- });
5748
- }
5749
- })
5750
- );
5751
-
5752
5644
  const createTemplateAction = pluginScaffolderNode.createTemplateAction;
5753
5645
 
5754
5646
  exports.DatabaseTaskStore = DatabaseTaskStore;
@@ -5756,7 +5648,6 @@ exports.ScaffolderEntitiesProcessor = ScaffolderEntitiesProcessor;
5756
5648
  exports.TaskManager = TaskManager;
5757
5649
  exports.TaskWorker = TaskWorker;
5758
5650
  exports.TemplateActionRegistry = TemplateActionRegistry;
5759
- exports.catalogModuleTemplateKind = catalogModuleTemplateKind;
5760
5651
  exports.createBuiltinActions = createBuiltinActions;
5761
5652
  exports.createCatalogRegisterAction = createCatalogRegisterAction;
5762
5653
  exports.createCatalogWriteAction = createCatalogWriteAction;
@@ -5785,5 +5676,4 @@ exports.createRouter = createRouter;
5785
5676
  exports.createTemplateAction = createTemplateAction;
5786
5677
  exports.executeShellCommand = executeShellCommand;
5787
5678
  exports.fetchContents = fetchContents;
5788
- exports.scaffolderPlugin = scaffolderPlugin;
5789
5679
  //# sourceMappingURL=index.cjs.js.map