@backstage/plugin-scaffolder-backend 1.16.6-next.2 → 1.17.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.
- package/CHANGELOG.md +103 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +13 -30
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/alpha.d.ts +4 -11
- package/dist/cjs/{ScaffolderEntitiesProcessor-519a7b88.cjs.js → router-129b368d.cjs.js} +30 -91
- package/dist/cjs/router-129b368d.cjs.js.map +1 -0
- package/dist/index.cjs.js +38 -37
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +8 -11
- package/package.json +21 -20
- package/dist/cjs/ScaffolderEntitiesProcessor-519a7b88.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b5f239b50bcf: Improved the `parseEntityRef` Scaffolder filter by introducing the ability for users to provide default kind and/or namespace values. The filter now takes
|
|
8
|
+
2 arguments, similarly to the original [parseEntityRef](https://github.com/backstage/backstage/blob/v1.17.2/packages/catalog-model/src/entity/ref.ts#L77).
|
|
9
|
+
- d5313ede3529: **DEPRECATION**: Deprecated `ScaffolderEntitiesProcessor`, which should now instead be imported from `@backstage/plugin-catalog-backend-module-scaffolder-entity-model`.
|
|
10
|
+
|
|
11
|
+
`catalogModuleTemplateKind` was also moved to that package and renamed to `catalogModuleScaffolderEntityModel`, without any deprecation since it was an alpha export.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 71114ac50e02: The export for the new backend system has been moved to be the `default` export.
|
|
16
|
+
|
|
17
|
+
For example, if you are currently importing the plugin using the following pattern:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { examplePlugin } from '@backstage/plugin-example-backend';
|
|
21
|
+
|
|
22
|
+
backend.add(examplePlugin);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
It should be migrated to this:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
backend.add(import('@backstage/plugin-example-backend'));
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- a4989552d828: Add examples for `publish:github` and `publish:gitlab` scaffolder actions.
|
|
32
|
+
- ded27b83ead2: Add examples for `publish:bitbucket` scaffolder actions.
|
|
33
|
+
- 5f1a92b9f19f: Use `DefaultAzureDevOpsCredentialsProvider` to retrieve credentials for Azure DevOps.
|
|
34
|
+
- fb57a4694fc6: Fixed the plugin and module ID of the alpha `catalogModuleTemplateKind` export.
|
|
35
|
+
- f3c0b95e3ef1: Add examples for `github:actions:dispatch` scaffolder actions.
|
|
36
|
+
- cfc3ca6ce060: Changes needed to support MySQL
|
|
37
|
+
- 814feeed7343: Update to handle invalid luxon values
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
- @backstage/plugin-catalog-backend@1.13.0
|
|
40
|
+
- @backstage/backend-tasks@0.5.8
|
|
41
|
+
- @backstage/backend-common@0.19.5
|
|
42
|
+
- @backstage/plugin-auth-node@0.3.0
|
|
43
|
+
- @backstage/config@1.1.0
|
|
44
|
+
- @backstage/catalog-client@1.4.4
|
|
45
|
+
- @backstage/catalog-model@1.4.2
|
|
46
|
+
- @backstage/errors@1.2.2
|
|
47
|
+
- @backstage/integration@1.7.0
|
|
48
|
+
- @backstage/plugin-catalog-common@1.0.16
|
|
49
|
+
- @backstage/plugin-permission-common@0.7.8
|
|
50
|
+
- @backstage/plugin-scaffolder-common@1.4.1
|
|
51
|
+
- @backstage/types@1.1.1
|
|
52
|
+
- @backstage/plugin-permission-node@0.7.14
|
|
53
|
+
- @backstage/backend-plugin-api@0.6.3
|
|
54
|
+
- @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.1.0
|
|
55
|
+
- @backstage/plugin-catalog-node@1.4.4
|
|
56
|
+
- @backstage/plugin-scaffolder-node@0.2.3
|
|
57
|
+
|
|
58
|
+
## 1.17.0-next.3
|
|
59
|
+
|
|
60
|
+
### Minor Changes
|
|
61
|
+
|
|
62
|
+
- b5f239b50bcf: Improved the `parseEntityRef` Scaffolder filter by introducing the ability for users to provide default kind and/or namespace values. The filter now takes
|
|
63
|
+
2 arguments, similarly to the original [parseEntityRef](https://github.com/backstage/backstage/blob/v1.17.2/packages/catalog-model/src/entity/ref.ts#L77).
|
|
64
|
+
- d5313ede3529: **DEPRECATION**: Deprecated `ScaffolderEntitiesProcessor`, which should now instead be imported from `@backstage/plugin-catalog-backend-module-scaffolder-entity-model`.
|
|
65
|
+
|
|
66
|
+
`catalogModuleTemplateKind` was also moved to that package and renamed to `catalogModuleScaffolderEntityModel`, without any deprecation since it was an alpha export.
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- 71114ac50e02: The export for the new backend system has been moved to be the `default` export.
|
|
71
|
+
|
|
72
|
+
For example, if you are currently importing the plugin using the following pattern:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { examplePlugin } from '@backstage/plugin-example-backend';
|
|
76
|
+
|
|
77
|
+
backend.add(examplePlugin);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
It should be migrated to this:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
backend.add(import('@backstage/plugin-example-backend'));
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- Updated dependencies
|
|
87
|
+
- @backstage/plugin-catalog-backend@1.13.0-next.3
|
|
88
|
+
- @backstage/catalog-client@1.4.4-next.2
|
|
89
|
+
- @backstage/catalog-model@1.4.2-next.2
|
|
90
|
+
- @backstage/config@1.1.0-next.2
|
|
91
|
+
- @backstage/errors@1.2.2-next.0
|
|
92
|
+
- @backstage/integration@1.7.0-next.3
|
|
93
|
+
- @backstage/plugin-catalog-common@1.0.16-next.2
|
|
94
|
+
- @backstage/plugin-permission-common@0.7.8-next.2
|
|
95
|
+
- @backstage/plugin-scaffolder-common@1.4.1-next.2
|
|
96
|
+
- @backstage/types@1.1.1-next.0
|
|
97
|
+
- @backstage/plugin-permission-node@0.7.14-next.3
|
|
98
|
+
- @backstage/backend-plugin-api@0.6.3-next.3
|
|
99
|
+
- @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.1.0-next.0
|
|
100
|
+
- @backstage/backend-common@0.19.5-next.3
|
|
101
|
+
- @backstage/backend-tasks@0.5.8-next.3
|
|
102
|
+
- @backstage/plugin-auth-node@0.3.0-next.3
|
|
103
|
+
- @backstage/plugin-catalog-node@1.4.4-next.3
|
|
104
|
+
- @backstage/plugin-scaffolder-node@0.2.3-next.3
|
|
105
|
+
|
|
3
106
|
## 1.16.6-next.2
|
|
4
107
|
|
|
5
108
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var alpha = require('@backstage/plugin-catalog-node/alpha');
|
|
7
|
-
var ScaffolderEntitiesProcessor = require('./cjs/ScaffolderEntitiesProcessor-519a7b88.cjs.js');
|
|
8
|
-
var alpha$1 = require('@backstage/plugin-scaffolder-common/alpha');
|
|
5
|
+
var alpha = require('@backstage/plugin-scaffolder-common/alpha');
|
|
9
6
|
var pluginPermissionNode = require('@backstage/plugin-permission-node');
|
|
7
|
+
var router = require('./cjs/router-129b368d.cjs.js');
|
|
8
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
10
9
|
var backendCommon = require('@backstage/backend-common');
|
|
11
10
|
var integration = require('@backstage/integration');
|
|
11
|
+
var alpha$1 = require('@backstage/plugin-catalog-node/alpha');
|
|
12
12
|
var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
|
|
13
13
|
require('@backstage/errors');
|
|
14
14
|
require('@backstage/catalog-model');
|
|
@@ -46,32 +46,16 @@ require('prom-client');
|
|
|
46
46
|
require('@backstage/plugin-permission-common');
|
|
47
47
|
require('url');
|
|
48
48
|
require('os');
|
|
49
|
-
require('@backstage/plugin-catalog-node');
|
|
50
|
-
|
|
51
|
-
const catalogModuleTemplateKind = backendPluginApi.createBackendModule({
|
|
52
|
-
moduleId: "templateKind",
|
|
53
|
-
pluginId: "catalog",
|
|
54
|
-
register(env) {
|
|
55
|
-
env.registerInit({
|
|
56
|
-
deps: {
|
|
57
|
-
catalog: alpha.catalogProcessingExtensionPoint
|
|
58
|
-
},
|
|
59
|
-
async init({ catalog }) {
|
|
60
|
-
catalog.addProcessor(new ScaffolderEntitiesProcessor.ScaffolderEntitiesProcessor());
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
49
|
|
|
66
50
|
const templateConditionExports = pluginPermissionNode.createConditionExports({
|
|
67
51
|
pluginId: "scaffolder",
|
|
68
|
-
resourceType: alpha
|
|
69
|
-
rules:
|
|
52
|
+
resourceType: alpha.RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,
|
|
53
|
+
rules: router.scaffolderTemplateRules
|
|
70
54
|
});
|
|
71
55
|
const actionsConditionExports = pluginPermissionNode.createConditionExports({
|
|
72
56
|
pluginId: "scaffolder",
|
|
73
|
-
resourceType: alpha
|
|
74
|
-
rules:
|
|
57
|
+
resourceType: alpha.RESOURCE_TYPE_SCAFFOLDER_ACTION,
|
|
58
|
+
rules: router.scaffolderActionRules
|
|
75
59
|
});
|
|
76
60
|
const createScaffolderTemplateConditionalDecision = templateConditionExports.createConditionalDecision;
|
|
77
61
|
const scaffolderTemplateConditions = templateConditionExports.conditions;
|
|
@@ -114,7 +98,7 @@ const scaffolderPlugin = backendPluginApi.createBackendPlugin({
|
|
|
114
98
|
permissions: backendPluginApi.coreServices.permissions,
|
|
115
99
|
database: backendPluginApi.coreServices.database,
|
|
116
100
|
httpRouter: backendPluginApi.coreServices.httpRouter,
|
|
117
|
-
catalogClient: alpha.catalogServiceRef
|
|
101
|
+
catalogClient: alpha$1.catalogServiceRef
|
|
118
102
|
},
|
|
119
103
|
async init({
|
|
120
104
|
logger,
|
|
@@ -128,7 +112,7 @@ const scaffolderPlugin = backendPluginApi.createBackendPlugin({
|
|
|
128
112
|
const log = backendCommon.loggerToWinstonLogger(logger);
|
|
129
113
|
const actions = [
|
|
130
114
|
...addedActions,
|
|
131
|
-
...
|
|
115
|
+
...router.createBuiltinActions({
|
|
132
116
|
integrations: integration.ScmIntegrations.fromConfig(config),
|
|
133
117
|
catalogClient,
|
|
134
118
|
reader,
|
|
@@ -141,7 +125,7 @@ const scaffolderPlugin = backendPluginApi.createBackendPlugin({
|
|
|
141
125
|
log.info(
|
|
142
126
|
`Starting scaffolder with the following actions enabled ${actionIds}`
|
|
143
127
|
);
|
|
144
|
-
const router = await
|
|
128
|
+
const router$1 = await router.createRouter({
|
|
145
129
|
logger: log,
|
|
146
130
|
config,
|
|
147
131
|
database,
|
|
@@ -153,16 +137,15 @@ const scaffolderPlugin = backendPluginApi.createBackendPlugin({
|
|
|
153
137
|
additionalTemplateGlobals,
|
|
154
138
|
permissions
|
|
155
139
|
});
|
|
156
|
-
httpRouter.use(router);
|
|
140
|
+
httpRouter.use(router$1);
|
|
157
141
|
}
|
|
158
142
|
});
|
|
159
143
|
}
|
|
160
144
|
});
|
|
161
145
|
|
|
162
|
-
exports.catalogModuleTemplateKind = catalogModuleTemplateKind;
|
|
163
146
|
exports.createScaffolderActionConditionalDecision = createScaffolderActionConditionalDecision;
|
|
164
147
|
exports.createScaffolderTemplateConditionalDecision = createScaffolderTemplateConditionalDecision;
|
|
148
|
+
exports["default"] = scaffolderPlugin;
|
|
165
149
|
exports.scaffolderActionConditions = scaffolderActionConditions;
|
|
166
|
-
exports.scaffolderPlugin = scaffolderPlugin;
|
|
167
150
|
exports.scaffolderTemplateConditions = scaffolderTemplateConditions;
|
|
168
151
|
//# sourceMappingURL=alpha.cjs.js.map
|
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.cjs.js","sources":["../src/modules/catalogModuleTemplateKind.ts","../src/service/conditionExports.ts","../src/ScaffolderPlugin.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createBackendModule } from '@backstage/backend-plugin-api';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\nimport { ScaffolderEntitiesProcessor } from '../processor';\n\n/**\n * Registers support for the Template kind to the catalog backend plugin.\n *\n * @alpha\n */\nexport const catalogModuleTemplateKind = createBackendModule({\n moduleId: 'templateKind',\n pluginId: 'catalog',\n register(env) {\n env.registerInit({\n deps: {\n catalog: catalogProcessingExtensionPoint,\n },\n async init({ catalog }) {\n catalog.addProcessor(new ScaffolderEntitiesProcessor());\n },\n });\n },\n});\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n RESOURCE_TYPE_SCAFFOLDER_ACTION,\n} from '@backstage/plugin-scaffolder-common/alpha';\nimport { createConditionExports } from '@backstage/plugin-permission-node';\nimport { scaffolderTemplateRules, scaffolderActionRules } from './rules';\n\nconst templateConditionExports = createConditionExports({\n pluginId: 'scaffolder',\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n rules: scaffolderTemplateRules,\n});\n\nconst actionsConditionExports = createConditionExports({\n pluginId: 'scaffolder',\n resourceType: RESOURCE_TYPE_SCAFFOLDER_ACTION,\n rules: scaffolderActionRules,\n});\n\n/**\n * `createScaffolderTemplateConditionalDecision` can be used when authoring policies to\n * create conditional decisions. It requires a permission of type\n * `ResourcePermission<'scaffolder-template'>` to be passed as the first parameter.\n * It's recommended that you use the provided `isResourcePermission` and\n * `isPermission` helper methods to narrow the type of the permission passed to\n * the handle method as shown below.\n *\n * ```\n * // MyAuthorizationPolicy.ts\n * ...\n * import { createScaffolderPolicyDecision } from '@backstage/plugin-scaffolder-backend';\n * import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common';\n *\n * class MyAuthorizationPolicy implements PermissionPolicy {\n * async handle(request, user) {\n * ...\n *\n * if (isResourcePermission(request.permission, RESOURCE_TYPE_SCAFFOLDER_TEMPLATE)) {\n * return createScaffolderConditionalDecision(\n * request.permission,\n * { anyOf: [...insert conditions here...] }\n * );\n * }\n *\n * ...\n * }\n *\n * ```\n *\n * @alpha\n */\nexport const createScaffolderTemplateConditionalDecision =\n templateConditionExports.createConditionalDecision;\n\n/**\n * These conditions are used when creating conditional decisions for scaffolder\n * templates that are returned by authorization policies.\n *\n * @alpha\n */\nexport const scaffolderTemplateConditions = templateConditionExports.conditions;\n\n/**\n * @alpha\n */\nexport const createScaffolderActionConditionalDecision =\n actionsConditionExports.createConditionalDecision;\n\n/**\n *\n * These conditions are used when creating conditional decisions for scaffolder\n * actions that are returned by authorization policies.\n *\n * @alpha\n */\nexport const scaffolderActionConditions = actionsConditionExports.conditions;\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createBackendPlugin,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport {\n scaffolderActionsExtensionPoint,\n scaffolderTaskBrokerExtensionPoint,\n scaffolderTemplatingExtensionPoint,\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport { createBuiltinActions } from './scaffolder';\nimport { createRouter } from './service/router';\n\n/**\n * Scaffolder plugin\n *\n * @alpha\n */\nexport const scaffolderPlugin = createBackendPlugin({\n pluginId: 'scaffolder',\n register(env) {\n const addedActions = new Array<TemplateAction<any, any>>();\n env.registerExtensionPoint(scaffolderActionsExtensionPoint, {\n addActions(...newActions: TemplateAction<any>[]) {\n addedActions.push(...newActions);\n },\n });\n\n let taskBroker: TaskBroker | undefined;\n env.registerExtensionPoint(scaffolderTaskBrokerExtensionPoint, {\n setTaskBroker(newTaskBroker) {\n if (taskBroker) {\n throw new Error('Task broker may only be set once');\n }\n taskBroker = newTaskBroker;\n },\n });\n\n const additionalTemplateFilters: Record<string, TemplateFilter> = {};\n const additionalTemplateGlobals: Record<string, TemplateGlobal> = {};\n env.registerExtensionPoint(scaffolderTemplatingExtensionPoint, {\n addTemplateFilters(newFilters) {\n Object.assign(additionalTemplateFilters, newFilters);\n },\n addTemplateGlobals(newGlobals) {\n Object.assign(additionalTemplateGlobals, newGlobals);\n },\n });\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n database: coreServices.database,\n httpRouter: coreServices.httpRouter,\n catalogClient: catalogServiceRef,\n },\n async init({\n logger,\n config,\n reader,\n database,\n httpRouter,\n catalogClient,\n permissions,\n }) {\n const log = loggerToWinstonLogger(logger);\n\n const actions = [\n ...addedActions,\n ...createBuiltinActions({\n integrations: ScmIntegrations.fromConfig(config),\n catalogClient,\n reader,\n config,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n ];\n\n const actionIds = actions.map(action => action.id).join(', ');\n log.info(\n `Starting scaffolder with the following actions enabled ${actionIds}`,\n );\n\n const router = await createRouter({\n logger: log,\n config,\n database,\n catalogClient,\n reader,\n actions,\n taskBroker,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n permissions,\n });\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createBackendModule","catalogProcessingExtensionPoint","ScaffolderEntitiesProcessor","createConditionExports","RESOURCE_TYPE_SCAFFOLDER_TEMPLATE","scaffolderTemplateRules","RESOURCE_TYPE_SCAFFOLDER_ACTION","scaffolderActionRules","createBackendPlugin","scaffolderActionsExtensionPoint","scaffolderTaskBrokerExtensionPoint","scaffolderTemplatingExtensionPoint","coreServices","catalogServiceRef","loggerToWinstonLogger","createBuiltinActions","ScmIntegrations","createRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,4BAA4BA,oCAAoB,CAAA;AAAA,EAC3D,QAAU,EAAA,cAAA;AAAA,EACV,QAAU,EAAA,SAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,OAAS,EAAAC,qCAAA;AAAA,OACX;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,OAAA,EAAW,EAAA;AACtB,QAAQ,OAAA,CAAA,YAAA,CAAa,IAAIC,uDAAA,EAA6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IAAA;AAAA,UACF,0DAA0D,SAAS,CAAA,CAAA;AAAA,SACrE,CAAA;AAEA,QAAM,MAAA,MAAA,GAAS,MAAMC,wCAAa,CAAA;AAAA,UAChC,MAAQ,EAAA,GAAA;AAAA,UACR,MAAA;AAAA,UACA,QAAA;AAAA,UACA,aAAA;AAAA,UACA,MAAA;AAAA,UACA,OAAA;AAAA,UACA,UAAA;AAAA,UACA,yBAAA;AAAA,UACA,yBAAA;AAAA,UACA,WAAA;AAAA,SACD,CAAA,CAAA;AACD,QAAA,UAAA,CAAW,IAAI,MAAM,CAAA,CAAA;AAAA,OACvB;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"alpha.cjs.js","sources":["../src/service/conditionExports.ts","../src/ScaffolderPlugin.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n RESOURCE_TYPE_SCAFFOLDER_ACTION,\n} from '@backstage/plugin-scaffolder-common/alpha';\nimport { createConditionExports } from '@backstage/plugin-permission-node';\nimport { scaffolderTemplateRules, scaffolderActionRules } from './rules';\n\nconst templateConditionExports = createConditionExports({\n pluginId: 'scaffolder',\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n rules: scaffolderTemplateRules,\n});\n\nconst actionsConditionExports = createConditionExports({\n pluginId: 'scaffolder',\n resourceType: RESOURCE_TYPE_SCAFFOLDER_ACTION,\n rules: scaffolderActionRules,\n});\n\n/**\n * `createScaffolderTemplateConditionalDecision` can be used when authoring policies to\n * create conditional decisions. It requires a permission of type\n * `ResourcePermission<'scaffolder-template'>` to be passed as the first parameter.\n * It's recommended that you use the provided `isResourcePermission` and\n * `isPermission` helper methods to narrow the type of the permission passed to\n * the handle method as shown below.\n *\n * ```\n * // MyAuthorizationPolicy.ts\n * ...\n * import { createScaffolderPolicyDecision } from '@backstage/plugin-scaffolder-backend';\n * import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common';\n *\n * class MyAuthorizationPolicy implements PermissionPolicy {\n * async handle(request, user) {\n * ...\n *\n * if (isResourcePermission(request.permission, RESOURCE_TYPE_SCAFFOLDER_TEMPLATE)) {\n * return createScaffolderConditionalDecision(\n * request.permission,\n * { anyOf: [...insert conditions here...] }\n * );\n * }\n *\n * ...\n * }\n *\n * ```\n *\n * @alpha\n */\nexport const createScaffolderTemplateConditionalDecision =\n templateConditionExports.createConditionalDecision;\n\n/**\n * These conditions are used when creating conditional decisions for scaffolder\n * templates that are returned by authorization policies.\n *\n * @alpha\n */\nexport const scaffolderTemplateConditions = templateConditionExports.conditions;\n\n/**\n * @alpha\n */\nexport const createScaffolderActionConditionalDecision =\n actionsConditionExports.createConditionalDecision;\n\n/**\n *\n * These conditions are used when creating conditional decisions for scaffolder\n * actions that are returned by authorization policies.\n *\n * @alpha\n */\nexport const scaffolderActionConditions = actionsConditionExports.conditions;\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createBackendPlugin,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport {\n scaffolderActionsExtensionPoint,\n scaffolderTaskBrokerExtensionPoint,\n scaffolderTemplatingExtensionPoint,\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport { createBuiltinActions } from './scaffolder';\nimport { createRouter } from './service/router';\n\n/**\n * Scaffolder plugin\n *\n * @alpha\n */\nexport const scaffolderPlugin = createBackendPlugin({\n pluginId: 'scaffolder',\n register(env) {\n const addedActions = new Array<TemplateAction<any, any>>();\n env.registerExtensionPoint(scaffolderActionsExtensionPoint, {\n addActions(...newActions: TemplateAction<any>[]) {\n addedActions.push(...newActions);\n },\n });\n\n let taskBroker: TaskBroker | undefined;\n env.registerExtensionPoint(scaffolderTaskBrokerExtensionPoint, {\n setTaskBroker(newTaskBroker) {\n if (taskBroker) {\n throw new Error('Task broker may only be set once');\n }\n taskBroker = newTaskBroker;\n },\n });\n\n const additionalTemplateFilters: Record<string, TemplateFilter> = {};\n const additionalTemplateGlobals: Record<string, TemplateGlobal> = {};\n env.registerExtensionPoint(scaffolderTemplatingExtensionPoint, {\n addTemplateFilters(newFilters) {\n Object.assign(additionalTemplateFilters, newFilters);\n },\n addTemplateGlobals(newGlobals) {\n Object.assign(additionalTemplateGlobals, newGlobals);\n },\n });\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n database: coreServices.database,\n httpRouter: coreServices.httpRouter,\n catalogClient: catalogServiceRef,\n },\n async init({\n logger,\n config,\n reader,\n database,\n httpRouter,\n catalogClient,\n permissions,\n }) {\n const log = loggerToWinstonLogger(logger);\n\n const actions = [\n ...addedActions,\n ...createBuiltinActions({\n integrations: ScmIntegrations.fromConfig(config),\n catalogClient,\n reader,\n config,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n ];\n\n const actionIds = actions.map(action => action.id).join(', ');\n log.info(\n `Starting scaffolder with the following actions enabled ${actionIds}`,\n );\n\n const router = await createRouter({\n logger: log,\n config,\n database,\n catalogClient,\n reader,\n actions,\n taskBroker,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n permissions,\n });\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createConditionExports","RESOURCE_TYPE_SCAFFOLDER_TEMPLATE","scaffolderTemplateRules","RESOURCE_TYPE_SCAFFOLDER_ACTION","scaffolderActionRules","createBackendPlugin","scaffolderActionsExtensionPoint","scaffolderTaskBrokerExtensionPoint","scaffolderTemplatingExtensionPoint","coreServices","catalogServiceRef","loggerToWinstonLogger","createBuiltinActions","ScmIntegrations","router","createRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,2BAA2BA,2CAAuB,CAAA;AAAA,EACtD,QAAU,EAAA,YAAA;AAAA,EACV,YAAc,EAAAC,uCAAA;AAAA,EACd,KAAO,EAAAC,8BAAA;AACT,CAAC,CAAA,CAAA;AAED,MAAM,0BAA0BF,2CAAuB,CAAA;AAAA,EACrD,QAAU,EAAA,YAAA;AAAA,EACV,YAAc,EAAAG,qCAAA;AAAA,EACd,KAAO,EAAAC,4BAAA;AACT,CAAC,CAAA,CAAA;AAkCM,MAAM,8CACX,wBAAyB,CAAA,0BAAA;AAQpB,MAAM,+BAA+B,wBAAyB,CAAA,WAAA;AAK9D,MAAM,4CACX,uBAAwB,CAAA,0BAAA;AASnB,MAAM,6BAA6B,uBAAwB,CAAA;;ACnD3D,MAAM,mBAAmBC,oCAAoB,CAAA;AAAA,EAClD,QAAU,EAAA,YAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAM,MAAA,YAAA,GAAe,IAAI,KAAgC,EAAA,CAAA;AACzD,IAAA,GAAA,CAAI,uBAAuBC,oDAAiC,EAAA;AAAA,MAC1D,cAAc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ACC,EAAA;AACD,QAAM,MAAA,GAAA,GAAMC,oCAAsB,MAAM,CAAA,CAAA;AAExC,QAAA,MAAM,OAAU,GAAA;AAAA,UACd,GAAG,YAAA;AAAA,UACH,GAAGC,2BAAqB,CAAA;AAAA,YACtB,YAAA,EAAcC,2BAAgB,CAAA,UAAA,CAAW,MAAM,CAAA;AAAA,YAC/C,aAAA;AAAA,YACA,MAAA;AAAA,YACA,MAAA;AAAA,YACA,yBAAA;AAAA,YACA,yBAAA;AAAA,WACD,CAAA;AAAA,SACH,CAAA;AAEA,QAAM,MAAA,SAAA,GAAY,QAAQ,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,EAAE,CAAA,CAAE,KAAK,IAAI,CAAA,CAAA;AAC5D,QAAI,GAAA,CAAA,IAAA;AAAA,UACF,0DAA0D,SAAS,CAAA,CAAA;AAAA,SACrE,CAAA;AAEA,QAAM,MAAAC,QAAA,GAAS,MAAMC,mBAAa,CAAA;AAAA,UAChC,MAAQ,EAAA,GAAA;AAAA,UACR,MAAA;AAAA,UACA,QAAA;AAAA,UACA,aAAA;AAAA,UACA,MAAA;AAAA,UACA,OAAA;AAAA,UACA,UAAA;AAAA,UACA,yBAAA;AAAA,UACA,yBAAA;AAAA,UACA,WAAA;AAAA,SACD,CAAA,CAAA;AACD,QAAA,UAAA,CAAW,IAAID,QAAM,CAAA,CAAA;AAAA,OACvB;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
1
|
import * as _backstage_types from '@backstage/types';
|
|
3
2
|
import * as _backstage_plugin_permission_node from '@backstage/plugin-permission-node';
|
|
4
3
|
import * as _backstage_plugin_scaffolder_common from '@backstage/plugin-scaffolder-common';
|
|
5
4
|
import * as _backstage_plugin_permission_common from '@backstage/plugin-permission-common';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Registers support for the Template kind to the catalog backend plugin.
|
|
9
|
-
*
|
|
10
|
-
* @alpha
|
|
11
|
-
*/
|
|
12
|
-
declare const catalogModuleTemplateKind: () => _backstage_backend_plugin_api.BackendFeature;
|
|
5
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
13
6
|
|
|
14
7
|
/**
|
|
15
8
|
* `createScaffolderTemplateConditionalDecision` can be used when authoring policies to
|
|
@@ -43,7 +36,7 @@ declare const catalogModuleTemplateKind: () => _backstage_backend_plugin_api.Bac
|
|
|
43
36
|
*
|
|
44
37
|
* @alpha
|
|
45
38
|
*/
|
|
46
|
-
declare const createScaffolderTemplateConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"scaffolder-template">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"scaffolder-template"
|
|
39
|
+
declare const createScaffolderTemplateConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"scaffolder-template">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"scaffolder-template">>) => _backstage_plugin_permission_common.ConditionalPolicyDecision;
|
|
47
40
|
/**
|
|
48
41
|
* These conditions are used when creating conditional decisions for scaffolder
|
|
49
42
|
* templates that are returned by authorization policies.
|
|
@@ -58,7 +51,7 @@ declare const scaffolderTemplateConditions: _backstage_plugin_permission_node.Co
|
|
|
58
51
|
/**
|
|
59
52
|
* @alpha
|
|
60
53
|
*/
|
|
61
|
-
declare const createScaffolderActionConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"scaffolder-action">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"scaffolder-action"
|
|
54
|
+
declare const createScaffolderActionConditionalDecision: (permission: _backstage_plugin_permission_common.ResourcePermission<"scaffolder-action">, conditions: _backstage_plugin_permission_common.PermissionCriteria<_backstage_plugin_permission_common.PermissionCondition<"scaffolder-action">>) => _backstage_plugin_permission_common.ConditionalPolicyDecision;
|
|
62
55
|
/**
|
|
63
56
|
*
|
|
64
57
|
* These conditions are used when creating conditional decisions for scaffolder
|
|
@@ -103,4 +96,4 @@ declare const scaffolderActionConditions: _backstage_plugin_permission_node.Cond
|
|
|
103
96
|
*/
|
|
104
97
|
declare const scaffolderPlugin: () => _backstage_backend_plugin_api.BackendFeature;
|
|
105
98
|
|
|
106
|
-
export {
|
|
99
|
+
export { createScaffolderActionConditionalDecision, createScaffolderTemplateConditionalDecision, scaffolderPlugin as default, scaffolderActionConditions, scaffolderTemplateConditions };
|
|
@@ -41,7 +41,6 @@ var promClient = require('prom-client');
|
|
|
41
41
|
var pluginPermissionCommon = require('@backstage/plugin-permission-common');
|
|
42
42
|
var url = require('url');
|
|
43
43
|
var os = require('os');
|
|
44
|
-
var pluginCatalogNode = require('@backstage/plugin-catalog-node');
|
|
45
44
|
|
|
46
45
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
47
46
|
|
|
@@ -953,7 +952,7 @@ const createDefaultFilters = ({
|
|
|
953
952
|
}) => {
|
|
954
953
|
return {
|
|
955
954
|
parseRepoUrl: (url) => parseRepoUrl(url, integrations),
|
|
956
|
-
parseEntityRef: (ref) => catalogModel.parseEntityRef(ref),
|
|
955
|
+
parseEntityRef: (ref, context) => catalogModel.parseEntityRef(ref, context),
|
|
957
956
|
pick: (obj, key) => get__default["default"](obj, key),
|
|
958
957
|
projectSlug: (repoUrl) => {
|
|
959
958
|
const { owner, repo } = parseRepoUrl(repoUrl, integrations);
|
|
@@ -5454,15 +5453,15 @@ const createBuiltinActions = (options) => {
|
|
|
5454
5453
|
return actions;
|
|
5455
5454
|
};
|
|
5456
5455
|
|
|
5457
|
-
var __defProp$
|
|
5458
|
-
var __defNormalProp$
|
|
5459
|
-
var __publicField$
|
|
5460
|
-
__defNormalProp$
|
|
5456
|
+
var __defProp$4 = Object.defineProperty;
|
|
5457
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5458
|
+
var __publicField$4 = (obj, key, value) => {
|
|
5459
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5461
5460
|
return value;
|
|
5462
5461
|
};
|
|
5463
5462
|
class TemplateActionRegistry {
|
|
5464
5463
|
constructor() {
|
|
5465
|
-
__publicField$
|
|
5464
|
+
__publicField$4(this, "actions", /* @__PURE__ */ new Map());
|
|
5466
5465
|
}
|
|
5467
5466
|
register(action) {
|
|
5468
5467
|
if (this.actions.has(action.id)) {
|
|
@@ -5486,10 +5485,10 @@ class TemplateActionRegistry {
|
|
|
5486
5485
|
}
|
|
5487
5486
|
}
|
|
5488
5487
|
|
|
5489
|
-
var __defProp$
|
|
5490
|
-
var __defNormalProp$
|
|
5491
|
-
var __publicField$
|
|
5492
|
-
__defNormalProp$
|
|
5488
|
+
var __defProp$3 = Object.defineProperty;
|
|
5489
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5490
|
+
var __publicField$3 = (obj, key, value) => {
|
|
5491
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5493
5492
|
return value;
|
|
5494
5493
|
};
|
|
5495
5494
|
const migrationsDir = backendCommon.resolvePackagePath(
|
|
@@ -5513,7 +5512,7 @@ const parseSqlDateToIsoString = (input) => {
|
|
|
5513
5512
|
};
|
|
5514
5513
|
class DatabaseTaskStore {
|
|
5515
5514
|
constructor(client) {
|
|
5516
|
-
__publicField$
|
|
5515
|
+
__publicField$3(this, "db");
|
|
5517
5516
|
this.db = client;
|
|
5518
5517
|
}
|
|
5519
5518
|
static async create(options) {
|
|
@@ -5787,10 +5786,10 @@ class DatabaseTaskStore {
|
|
|
5787
5786
|
}
|
|
5788
5787
|
}
|
|
5789
5788
|
|
|
5790
|
-
var __defProp$
|
|
5791
|
-
var __defNormalProp$
|
|
5792
|
-
var __publicField$
|
|
5793
|
-
__defNormalProp$
|
|
5789
|
+
var __defProp$2 = Object.defineProperty;
|
|
5790
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5791
|
+
var __publicField$2 = (obj, key, value) => {
|
|
5792
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5794
5793
|
return value;
|
|
5795
5794
|
};
|
|
5796
5795
|
class TaskManager {
|
|
@@ -5800,8 +5799,8 @@ class TaskManager {
|
|
|
5800
5799
|
this.storage = storage;
|
|
5801
5800
|
this.signal = signal;
|
|
5802
5801
|
this.logger = logger;
|
|
5803
|
-
__publicField$
|
|
5804
|
-
__publicField$
|
|
5802
|
+
__publicField$2(this, "isDone", false);
|
|
5803
|
+
__publicField$2(this, "heartbeatTimeoutId");
|
|
5805
5804
|
}
|
|
5806
5805
|
static create(task, storage, abortSignal, logger) {
|
|
5807
5806
|
const agent = new TaskManager(task, storage, abortSignal, logger);
|
|
@@ -5873,7 +5872,7 @@ class StorageTaskBroker {
|
|
|
5873
5872
|
constructor(storage, logger) {
|
|
5874
5873
|
this.storage = storage;
|
|
5875
5874
|
this.logger = logger;
|
|
5876
|
-
__publicField$
|
|
5875
|
+
__publicField$2(this, "deferredDispatch", defer());
|
|
5877
5876
|
}
|
|
5878
5877
|
async list(options) {
|
|
5879
5878
|
if (!this.storage.list) {
|
|
@@ -6142,10 +6141,10 @@ const scaffolderActionRules = {
|
|
|
6142
6141
|
hasStringProperty
|
|
6143
6142
|
};
|
|
6144
6143
|
|
|
6145
|
-
var __defProp$
|
|
6146
|
-
var __defNormalProp$
|
|
6147
|
-
var __publicField$
|
|
6148
|
-
__defNormalProp$
|
|
6144
|
+
var __defProp$1 = Object.defineProperty;
|
|
6145
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6146
|
+
var __publicField$1 = (obj, key, value) => {
|
|
6147
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6149
6148
|
return value;
|
|
6150
6149
|
};
|
|
6151
6150
|
const isValidTaskSpec = (taskSpec) => {
|
|
@@ -6180,8 +6179,8 @@ const isActionAuthorized = pluginPermissionNode.createConditionAuthorizer(
|
|
|
6180
6179
|
class NunjucksWorkflowRunner {
|
|
6181
6180
|
constructor(options) {
|
|
6182
6181
|
this.options = options;
|
|
6183
|
-
__publicField$
|
|
6184
|
-
__publicField$
|
|
6182
|
+
__publicField$1(this, "defaultTemplateFilters");
|
|
6183
|
+
__publicField$1(this, "tracker", scaffoldingTracker());
|
|
6185
6184
|
this.defaultTemplateFilters = createDefaultFilters({
|
|
6186
6185
|
integrations: this.options.integrations
|
|
6187
6186
|
});
|
|
@@ -6562,16 +6561,16 @@ function scaffoldingTracker() {
|
|
|
6562
6561
|
};
|
|
6563
6562
|
}
|
|
6564
6563
|
|
|
6565
|
-
var __defProp
|
|
6566
|
-
var __defNormalProp
|
|
6567
|
-
var __publicField
|
|
6568
|
-
__defNormalProp
|
|
6564
|
+
var __defProp = Object.defineProperty;
|
|
6565
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6566
|
+
var __publicField = (obj, key, value) => {
|
|
6567
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6569
6568
|
return value;
|
|
6570
6569
|
};
|
|
6571
6570
|
class TaskWorker {
|
|
6572
6571
|
constructor(options) {
|
|
6573
6572
|
this.options = options;
|
|
6574
|
-
__publicField
|
|
6573
|
+
__publicField(this, "taskQueue");
|
|
6575
6574
|
this.taskQueue = new PQueue__default["default"]({
|
|
6576
6575
|
concurrency: options.concurrentTasksLimit
|
|
6577
6576
|
});
|
|
@@ -7241,67 +7240,7 @@ data: ${JSON.stringify(event)}
|
|
|
7241
7240
|
return app;
|
|
7242
7241
|
}
|
|
7243
7242
|
|
|
7244
|
-
var __defProp = Object.defineProperty;
|
|
7245
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7246
|
-
var __publicField = (obj, key, value) => {
|
|
7247
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7248
|
-
return value;
|
|
7249
|
-
};
|
|
7250
|
-
class ScaffolderEntitiesProcessor {
|
|
7251
|
-
constructor() {
|
|
7252
|
-
__publicField(this, "validators", [pluginScaffolderCommon.templateEntityV1beta3Validator]);
|
|
7253
|
-
}
|
|
7254
|
-
getProcessorName() {
|
|
7255
|
-
return "ScaffolderEntitiesProcessor";
|
|
7256
|
-
}
|
|
7257
|
-
async validateEntityKind(entity) {
|
|
7258
|
-
for (const validator of this.validators) {
|
|
7259
|
-
if (await validator.check(entity)) {
|
|
7260
|
-
return true;
|
|
7261
|
-
}
|
|
7262
|
-
}
|
|
7263
|
-
return false;
|
|
7264
|
-
}
|
|
7265
|
-
async postProcessEntity(entity, _location, emit) {
|
|
7266
|
-
const selfRef = catalogModel.getCompoundEntityRef(entity);
|
|
7267
|
-
if (entity.apiVersion === "scaffolder.backstage.io/v1beta3" && entity.kind === "Template") {
|
|
7268
|
-
const template = entity;
|
|
7269
|
-
const target = template.spec.owner;
|
|
7270
|
-
if (target) {
|
|
7271
|
-
const targetRef = catalogModel.parseEntityRef(target, {
|
|
7272
|
-
defaultKind: "Group",
|
|
7273
|
-
defaultNamespace: selfRef.namespace
|
|
7274
|
-
});
|
|
7275
|
-
emit(
|
|
7276
|
-
pluginCatalogNode.processingResult.relation({
|
|
7277
|
-
source: selfRef,
|
|
7278
|
-
type: catalogModel.RELATION_OWNED_BY,
|
|
7279
|
-
target: {
|
|
7280
|
-
kind: targetRef.kind,
|
|
7281
|
-
namespace: targetRef.namespace,
|
|
7282
|
-
name: targetRef.name
|
|
7283
|
-
}
|
|
7284
|
-
})
|
|
7285
|
-
);
|
|
7286
|
-
emit(
|
|
7287
|
-
pluginCatalogNode.processingResult.relation({
|
|
7288
|
-
source: {
|
|
7289
|
-
kind: targetRef.kind,
|
|
7290
|
-
namespace: targetRef.namespace,
|
|
7291
|
-
name: targetRef.name
|
|
7292
|
-
},
|
|
7293
|
-
type: catalogModel.RELATION_OWNER_OF,
|
|
7294
|
-
target: selfRef
|
|
7295
|
-
})
|
|
7296
|
-
);
|
|
7297
|
-
}
|
|
7298
|
-
}
|
|
7299
|
-
return entity;
|
|
7300
|
-
}
|
|
7301
|
-
}
|
|
7302
|
-
|
|
7303
7243
|
exports.DatabaseTaskStore = DatabaseTaskStore;
|
|
7304
|
-
exports.ScaffolderEntitiesProcessor = ScaffolderEntitiesProcessor;
|
|
7305
7244
|
exports.TaskManager = TaskManager;
|
|
7306
7245
|
exports.TaskWorker = TaskWorker;
|
|
7307
7246
|
exports.TemplateActionRegistry = TemplateActionRegistry;
|
|
@@ -7337,4 +7276,4 @@ exports.createRouter = createRouter;
|
|
|
7337
7276
|
exports.createWaitAction = createWaitAction;
|
|
7338
7277
|
exports.scaffolderActionRules = scaffolderActionRules;
|
|
7339
7278
|
exports.scaffolderTemplateRules = scaffolderTemplateRules;
|
|
7340
|
-
//# sourceMappingURL=
|
|
7279
|
+
//# sourceMappingURL=router-129b368d.cjs.js.map
|