@backstage/plugin-scaffolder-common 1.5.1 → 1.5.2-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.
- package/CHANGELOG.md +9 -0
- package/alpha/package.json +1 -1
- package/dist/Template.v1beta3.schema.json.esm.js +343 -0
- package/dist/Template.v1beta3.schema.json.esm.js.map +1 -0
- package/dist/TemplateEntityV1beta3.esm.js +14 -0
- package/dist/TemplateEntityV1beta3.esm.js.map +1 -0
- package/dist/alpha.cjs.js +0 -2
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/alpha.esm.js +1 -35
- package/dist/alpha.esm.js.map +1 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -353
- package/dist/index.esm.js.map +1 -1
- package/dist/permissions.esm.js +36 -0
- package/dist/permissions.esm.js.map +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-common
|
|
2
2
|
|
|
3
|
+
## 1.5.2-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/catalog-model@1.5.0-next.0
|
|
9
|
+
- @backstage/types@1.1.1
|
|
10
|
+
- @backstage/plugin-permission-common@0.7.13
|
|
11
|
+
|
|
3
12
|
## 1.5.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/alpha/package.json
CHANGED
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
var $schema = "http://json-schema.org/draft-07/schema";
|
|
2
|
+
var $id = "TemplateV1beta3";
|
|
3
|
+
var description = "A Template describes a scaffolding task for use with the Scaffolder. It describes the required parameters as well as a series of steps that will be taken to execute the scaffolding task.";
|
|
4
|
+
var examples = [
|
|
5
|
+
{
|
|
6
|
+
apiVersion: "scaffolder.backstage.io/v1beta3",
|
|
7
|
+
kind: "Template",
|
|
8
|
+
metadata: {
|
|
9
|
+
name: "react-ssr-template",
|
|
10
|
+
title: "React SSR Template",
|
|
11
|
+
description: "Next.js application skeleton for creating isomorphic web applications.",
|
|
12
|
+
tags: [
|
|
13
|
+
"recommended",
|
|
14
|
+
"react"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
spec: {
|
|
18
|
+
owner: "artist-relations-team",
|
|
19
|
+
type: "website",
|
|
20
|
+
parameters: {
|
|
21
|
+
required: [
|
|
22
|
+
"name",
|
|
23
|
+
"description",
|
|
24
|
+
"repoUrl"
|
|
25
|
+
],
|
|
26
|
+
"backstage:permissions": {
|
|
27
|
+
tags: [
|
|
28
|
+
"one",
|
|
29
|
+
"two"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
properties: {
|
|
33
|
+
name: {
|
|
34
|
+
title: "Name",
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Unique name of the component"
|
|
37
|
+
},
|
|
38
|
+
description: {
|
|
39
|
+
title: "Description",
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Description of the component"
|
|
42
|
+
},
|
|
43
|
+
repoUrl: {
|
|
44
|
+
title: "Pick a repository",
|
|
45
|
+
type: "string",
|
|
46
|
+
"ui:field": "RepoUrlPicker"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
steps: [
|
|
51
|
+
{
|
|
52
|
+
id: "fetch",
|
|
53
|
+
name: "Fetch",
|
|
54
|
+
action: "fetch:plain",
|
|
55
|
+
parameters: {
|
|
56
|
+
url: "./template"
|
|
57
|
+
},
|
|
58
|
+
"backstage:permissions": {
|
|
59
|
+
tags: [
|
|
60
|
+
"one",
|
|
61
|
+
"two"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "publish",
|
|
67
|
+
name: "Publish to GitHub",
|
|
68
|
+
action: "publish:github",
|
|
69
|
+
parameters: {
|
|
70
|
+
repoUrl: "${{ parameters.repoUrl }}"
|
|
71
|
+
},
|
|
72
|
+
"if": "${{ parameters.repoUrl }}"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
output: {
|
|
76
|
+
catalogInfoUrl: "${{ steps.publish.output.catalogInfoUrl }}"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
var allOf = [
|
|
82
|
+
{
|
|
83
|
+
$ref: "Entity"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: "object",
|
|
87
|
+
required: [
|
|
88
|
+
"spec"
|
|
89
|
+
],
|
|
90
|
+
properties: {
|
|
91
|
+
apiVersion: {
|
|
92
|
+
"enum": [
|
|
93
|
+
"scaffolder.backstage.io/v1beta3"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
kind: {
|
|
97
|
+
"enum": [
|
|
98
|
+
"Template"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
spec: {
|
|
102
|
+
type: "object",
|
|
103
|
+
required: [
|
|
104
|
+
"type",
|
|
105
|
+
"steps"
|
|
106
|
+
],
|
|
107
|
+
properties: {
|
|
108
|
+
type: {
|
|
109
|
+
type: "string",
|
|
110
|
+
description: "The type of component created by the template. The software catalog accepts any type value, but an organization should take great care to establish a proper taxonomy for these. Tools including Backstage itself may read this field and behave differently depending on its value. For example, a website type component may present tooling in the Backstage interface that is specific to just websites.",
|
|
111
|
+
examples: [
|
|
112
|
+
"service",
|
|
113
|
+
"website",
|
|
114
|
+
"library"
|
|
115
|
+
],
|
|
116
|
+
minLength: 1
|
|
117
|
+
},
|
|
118
|
+
owner: {
|
|
119
|
+
type: "string",
|
|
120
|
+
description: "The user (or group) owner of the template",
|
|
121
|
+
minLength: 1
|
|
122
|
+
},
|
|
123
|
+
parameters: {
|
|
124
|
+
oneOf: [
|
|
125
|
+
{
|
|
126
|
+
type: "object",
|
|
127
|
+
description: "The JSONSchema describing the inputs for the template.",
|
|
128
|
+
properties: {
|
|
129
|
+
"backstage:permissions": {
|
|
130
|
+
type: "object",
|
|
131
|
+
description: "Object used for authorizing the parameter",
|
|
132
|
+
properties: {
|
|
133
|
+
tags: {
|
|
134
|
+
type: "array",
|
|
135
|
+
items: {
|
|
136
|
+
type: "string"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: "array",
|
|
145
|
+
description: "A list of separate forms to collect parameters.",
|
|
146
|
+
items: {
|
|
147
|
+
type: "object",
|
|
148
|
+
description: "The JSONSchema describing the inputs for the template.",
|
|
149
|
+
properties: {
|
|
150
|
+
"backstage:permissions": {
|
|
151
|
+
type: "object",
|
|
152
|
+
description: "Object used for authorizing the parameter",
|
|
153
|
+
properties: {
|
|
154
|
+
tags: {
|
|
155
|
+
type: "array",
|
|
156
|
+
items: {
|
|
157
|
+
type: "string"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
presentation: {
|
|
168
|
+
type: "object",
|
|
169
|
+
description: "A way to redefine the labels for actionable buttons.",
|
|
170
|
+
properties: {
|
|
171
|
+
backButtonText: {
|
|
172
|
+
type: "string",
|
|
173
|
+
description: "A button which return the user to one step back."
|
|
174
|
+
},
|
|
175
|
+
createButtonText: {
|
|
176
|
+
type: "string",
|
|
177
|
+
description: "A button which start the execution of the template."
|
|
178
|
+
},
|
|
179
|
+
reviewButtonText: {
|
|
180
|
+
type: "string",
|
|
181
|
+
description: "A button which open the review step to verify the input prior to start the execution."
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
EXPERIMENTAL_recovery: {
|
|
186
|
+
type: "object",
|
|
187
|
+
description: "A task recovery section.",
|
|
188
|
+
properties: {
|
|
189
|
+
EXPERIMENTAL_strategy: {
|
|
190
|
+
type: "string",
|
|
191
|
+
description: "Recovery strategy for your task (none or startOver). By default none"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
steps: {
|
|
196
|
+
type: "array",
|
|
197
|
+
description: "A list of steps to execute.",
|
|
198
|
+
items: {
|
|
199
|
+
type: "object",
|
|
200
|
+
description: "A description of the step to execute.",
|
|
201
|
+
required: [
|
|
202
|
+
"action"
|
|
203
|
+
],
|
|
204
|
+
properties: {
|
|
205
|
+
id: {
|
|
206
|
+
type: "string",
|
|
207
|
+
description: "The ID of the step, which can be used to refer to its outputs."
|
|
208
|
+
},
|
|
209
|
+
name: {
|
|
210
|
+
type: "string",
|
|
211
|
+
description: "The name of the step, which will be displayed in the UI during the scaffolding process."
|
|
212
|
+
},
|
|
213
|
+
action: {
|
|
214
|
+
type: "string",
|
|
215
|
+
description: "The name of the action to execute."
|
|
216
|
+
},
|
|
217
|
+
input: {
|
|
218
|
+
type: "object",
|
|
219
|
+
description: "A templated object describing the inputs to the action."
|
|
220
|
+
},
|
|
221
|
+
"if": {
|
|
222
|
+
type: [
|
|
223
|
+
"string",
|
|
224
|
+
"boolean"
|
|
225
|
+
],
|
|
226
|
+
description: "A templated condition that skips the step when evaluated to false. If the condition is true or not defined, the step is executed. The condition is true, if the input is not `false`, `undefined`, `null`, `\"\"`, `0`, or `[]`."
|
|
227
|
+
},
|
|
228
|
+
"backstage:permissions": {
|
|
229
|
+
type: "object",
|
|
230
|
+
description: "Object used for authorizing the step",
|
|
231
|
+
properties: {
|
|
232
|
+
tags: {
|
|
233
|
+
type: "array",
|
|
234
|
+
items: {
|
|
235
|
+
type: "string"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
output: {
|
|
244
|
+
type: "object",
|
|
245
|
+
description: "A templated object describing the outputs of the scaffolding task.",
|
|
246
|
+
properties: {
|
|
247
|
+
links: {
|
|
248
|
+
type: "array",
|
|
249
|
+
description: "A list of external hyperlinks, typically pointing to resources created or updated by the template",
|
|
250
|
+
items: {
|
|
251
|
+
type: "object",
|
|
252
|
+
required: [
|
|
253
|
+
],
|
|
254
|
+
properties: {
|
|
255
|
+
url: {
|
|
256
|
+
type: "string",
|
|
257
|
+
description: "A url in a standard uri format.",
|
|
258
|
+
examples: [
|
|
259
|
+
"https://github.com/my-org/my-new-repo"
|
|
260
|
+
],
|
|
261
|
+
minLength: 1
|
|
262
|
+
},
|
|
263
|
+
entityRef: {
|
|
264
|
+
type: "string",
|
|
265
|
+
description: "An entity reference to an entity in the catalog.",
|
|
266
|
+
examples: [
|
|
267
|
+
"Component:default/my-app"
|
|
268
|
+
],
|
|
269
|
+
minLength: 1
|
|
270
|
+
},
|
|
271
|
+
title: {
|
|
272
|
+
type: "string",
|
|
273
|
+
description: "A user friendly display name for the link.",
|
|
274
|
+
examples: [
|
|
275
|
+
"View new repo"
|
|
276
|
+
],
|
|
277
|
+
minLength: 1
|
|
278
|
+
},
|
|
279
|
+
icon: {
|
|
280
|
+
type: "string",
|
|
281
|
+
description: "A key representing a visual icon to be displayed in the UI.",
|
|
282
|
+
examples: [
|
|
283
|
+
"dashboard"
|
|
284
|
+
],
|
|
285
|
+
minLength: 1
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
text: {
|
|
291
|
+
type: "array",
|
|
292
|
+
description: "A list of Markdown text blobs, like output data from the template.",
|
|
293
|
+
items: {
|
|
294
|
+
type: "object",
|
|
295
|
+
required: [
|
|
296
|
+
],
|
|
297
|
+
properties: {
|
|
298
|
+
title: {
|
|
299
|
+
type: "string",
|
|
300
|
+
description: "A user friendly display name for the text.",
|
|
301
|
+
examples: [
|
|
302
|
+
"Output Content"
|
|
303
|
+
],
|
|
304
|
+
minLength: 1
|
|
305
|
+
},
|
|
306
|
+
icon: {
|
|
307
|
+
type: "string",
|
|
308
|
+
description: "A key representing a visual icon to be displayed in the UI.",
|
|
309
|
+
examples: [
|
|
310
|
+
"dashboard"
|
|
311
|
+
],
|
|
312
|
+
minLength: 1
|
|
313
|
+
},
|
|
314
|
+
content: {
|
|
315
|
+
type: "string",
|
|
316
|
+
description: "The text blob to display in the UI, rendered as Markdown.",
|
|
317
|
+
examples: [
|
|
318
|
+
"**hey** _I'm_ Markdown"
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
additionalProperties: {
|
|
326
|
+
type: "string"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
];
|
|
334
|
+
var schema = {
|
|
335
|
+
$schema: $schema,
|
|
336
|
+
$id: $id,
|
|
337
|
+
description: description,
|
|
338
|
+
examples: examples,
|
|
339
|
+
allOf: allOf
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export { $id, $schema, allOf, schema as default, description, examples };
|
|
343
|
+
//# sourceMappingURL=Template.v1beta3.schema.json.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Template.v1beta3.schema.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { entityKindSchemaValidator } from '@backstage/catalog-model';
|
|
2
|
+
import schema from './Template.v1beta3.schema.json.esm.js';
|
|
3
|
+
|
|
4
|
+
const validator = entityKindSchemaValidator(schema);
|
|
5
|
+
const templateEntityV1beta3Validator = {
|
|
6
|
+
// TODO(freben): Emulate the old KindValidator until we fix that type
|
|
7
|
+
async check(data) {
|
|
8
|
+
return validator(data) === data;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const isTemplateEntityV1beta3 = (entity) => entity.apiVersion === "scaffolder.backstage.io/v1beta3" && entity.kind === "Template";
|
|
12
|
+
|
|
13
|
+
export { isTemplateEntityV1beta3, templateEntityV1beta3Validator };
|
|
14
|
+
//# sourceMappingURL=TemplateEntityV1beta3.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateEntityV1beta3.esm.js","sources":["../src/TemplateEntityV1beta3.ts"],"sourcesContent":["/*\n * Copyright 2020 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 Entity,\n entityKindSchemaValidator,\n KindValidator,\n} from '@backstage/catalog-model';\nimport { JsonObject } from '@backstage/types';\nimport schema from './Template.v1beta3.schema.json';\n\n/**\n * Backstage catalog Template kind Entity. Templates are used by the Scaffolder\n * plugin to create new entities, such as Components.\n *\n * @public\n */\nexport interface TemplateEntityV1beta3 extends Entity {\n /**\n * The apiVersion string of the TaskSpec.\n */\n apiVersion: 'scaffolder.backstage.io/v1beta3';\n /**\n * The kind of the entity\n */\n kind: 'Template';\n /**\n * The specification of the Template Entity\n */\n spec: {\n /**\n * The type that the Template will create. For example service, website or library.\n */\n type: string;\n\n /**\n * Template specific configuration of the presentation layer.\n */\n presentation?: TemplatePresentationV1beta3;\n\n /**\n * Recovery strategy for the template\n */\n EXPERIMENTAL_recovery?: TemplateRecoveryV1beta3;\n\n /**\n * This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend\n * to collect user input and validate it against that schema. This can then be used in the `steps` part below to template\n * variables passed from the user into each action in the template.\n */\n parameters?: TemplateParametersV1beta3 | TemplateParametersV1beta3[];\n /**\n * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying\n * javascript action and some optional input parameters that may or may not have been collected from the end user.\n */\n steps: Array<TemplateEntityStepV1beta3>;\n /**\n * The output is an object where template authors can pull out information from template actions and return them in a known standard way.\n */\n output?: { [name: string]: string };\n /**\n * The owner entityRef of the TemplateEntity\n */\n owner?: string;\n };\n}\n\n/**\n * Depends on how you designed your task you might tailor the behaviour for each of them.\n *\n * @public\n */\nexport interface TemplateRecoveryV1beta3 extends JsonObject {\n /**\n *\n * none - not recover, let the task be marked as failed\n * startOver - do recover, start the execution of the task from the first step.\n *\n * @public\n */\n EXPERIMENTAL_strategy?: 'none' | 'startOver';\n}\n\n/**\n * The presentation of the template.\n *\n * @public\n */\nexport interface TemplatePresentationV1beta3 extends JsonObject {\n /**\n * Overrides default buttons' text\n */\n buttonLabels?: {\n /**\n * The text for the button which leads to the previous template page\n */\n backButtonText?: string;\n /**\n * The text for the button which starts the execution of the template\n */\n createButtonText?: string;\n /**\n * The text for the button which opens template's review/summary\n */\n reviewButtonText?: string;\n };\n}\n\n/**\n * Step that is part of a Template Entity.\n *\n * @public\n */\nexport interface TemplateEntityStepV1beta3 extends JsonObject {\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n 'backstage:permissions'?: TemplatePermissionsV1beta3;\n}\n\n/**\n * Parameter that is part of a Template Entity.\n *\n * @public\n */\nexport interface TemplateParametersV1beta3 extends JsonObject {\n 'backstage:permissions'?: TemplatePermissionsV1beta3;\n}\n\n/**\n * Access control properties for parts of a template.\n *\n * @public\n */\nexport interface TemplatePermissionsV1beta3 extends JsonObject {\n tags?: string[];\n}\n\nconst validator = entityKindSchemaValidator(schema);\n\n/**\n * Entity data validator for {@link TemplateEntityV1beta3}.\n *\n * @public\n */\nexport const templateEntityV1beta3Validator: KindValidator = {\n // TODO(freben): Emulate the old KindValidator until we fix that type\n async check(data: Entity) {\n return validator(data) === data;\n },\n};\n\n/**\n * Typeguard for filtering entities and ensuring v1beta3 entities\n * @public\n */\nexport const isTemplateEntityV1beta3 = (\n entity: Entity,\n): entity is TemplateEntityV1beta3 =>\n entity.apiVersion === 'scaffolder.backstage.io/v1beta3' &&\n entity.kind === 'Template';\n"],"names":[],"mappings":";;;AAyJA,MAAM,SAAA,GAAY,0BAA0B,MAAM,CAAA,CAAA;AAO3C,MAAM,8BAAgD,GAAA;AAAA;AAAA,EAE3D,MAAM,MAAM,IAAc,EAAA;AACxB,IAAO,OAAA,SAAA,CAAU,IAAI,CAAM,KAAA,IAAA,CAAA;AAAA,GAC7B;AACF,EAAA;AAMO,MAAM,0BAA0B,CACrC,MAAA,KAEA,OAAO,UAAe,KAAA,iCAAA,IACtB,OAAO,IAAS,KAAA;;;;"}
|
package/dist/alpha.cjs.js
CHANGED
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.cjs.js","sources":["../src/permissions.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 { createPermission } from '@backstage/plugin-permission-common';\n\n/**\n * Permission resource type which corresponds to a scaffolder templates.\n *\n * @alpha\n */\nexport const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = 'scaffolder-template';\n\n/**\n * Permission resource type which corresponds to a scaffolder action.\n *\n * @alpha\n */\nexport const RESOURCE_TYPE_SCAFFOLDER_ACTION = 'scaffolder-action';\n\n/**\n * This permission is used to authorize actions that involve executing\n * an action from a template.\n *\n * @alpha\n */\nexport const actionExecutePermission = createPermission({\n name: 'scaffolder.action.execute',\n attributes: {},\n resourceType: RESOURCE_TYPE_SCAFFOLDER_ACTION,\n});\n\n/**\n * This permission is used to authorize actions that involve reading\n * one or more parameters from a template.\n *\n * If this permission is not authorized, it will appear that the\n * parameter does not exist in the template — both in the frontend\n * and in API responses.\n *\n * @alpha\n */\nexport const templateParameterReadPermission = createPermission({\n name: 'scaffolder.template.parameter.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n});\n\n/**\n * This permission is used to authorize actions that involve reading\n * one or more steps from a template.\n *\n * If this permission is not authorized, it will appear that the\n * step does not exist in the template — both in the frontend\n * and in API responses. Steps will also not be executed.\n *\n * @alpha\n */\nexport const templateStepReadPermission = createPermission({\n name: 'scaffolder.template.step.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n});\n\n/**\n * List of all the scaffolder permissions\n * @alpha\n */\nexport const scaffolderPermissions = [\n actionExecutePermission,\n templateParameterReadPermission,\n templateStepReadPermission,\n];\n\n/**\n * List of the scaffolder permissions that are associated with template steps and parameters.\n * @alpha\n */\nexport const scaffolderTemplatePermissions = [\n templateParameterReadPermission,\n templateStepReadPermission,\n];\n\n/**\n * List of the scaffolder permissions that are associated with scaffolder actions.\n * @alpha\n */\nexport const scaffolderActionPermissions = [actionExecutePermission];\n"],"names":["createPermission"],"mappings":"
|
|
1
|
+
{"version":3,"file":"alpha.cjs.js","sources":["../src/permissions.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 { createPermission } from '@backstage/plugin-permission-common';\n\n/**\n * Permission resource type which corresponds to a scaffolder templates.\n *\n * @alpha\n */\nexport const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = 'scaffolder-template';\n\n/**\n * Permission resource type which corresponds to a scaffolder action.\n *\n * @alpha\n */\nexport const RESOURCE_TYPE_SCAFFOLDER_ACTION = 'scaffolder-action';\n\n/**\n * This permission is used to authorize actions that involve executing\n * an action from a template.\n *\n * @alpha\n */\nexport const actionExecutePermission = createPermission({\n name: 'scaffolder.action.execute',\n attributes: {},\n resourceType: RESOURCE_TYPE_SCAFFOLDER_ACTION,\n});\n\n/**\n * This permission is used to authorize actions that involve reading\n * one or more parameters from a template.\n *\n * If this permission is not authorized, it will appear that the\n * parameter does not exist in the template — both in the frontend\n * and in API responses.\n *\n * @alpha\n */\nexport const templateParameterReadPermission = createPermission({\n name: 'scaffolder.template.parameter.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n});\n\n/**\n * This permission is used to authorize actions that involve reading\n * one or more steps from a template.\n *\n * If this permission is not authorized, it will appear that the\n * step does not exist in the template — both in the frontend\n * and in API responses. Steps will also not be executed.\n *\n * @alpha\n */\nexport const templateStepReadPermission = createPermission({\n name: 'scaffolder.template.step.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n});\n\n/**\n * List of all the scaffolder permissions\n * @alpha\n */\nexport const scaffolderPermissions = [\n actionExecutePermission,\n templateParameterReadPermission,\n templateStepReadPermission,\n];\n\n/**\n * List of the scaffolder permissions that are associated with template steps and parameters.\n * @alpha\n */\nexport const scaffolderTemplatePermissions = [\n templateParameterReadPermission,\n templateStepReadPermission,\n];\n\n/**\n * List of the scaffolder permissions that are associated with scaffolder actions.\n * @alpha\n */\nexport const scaffolderActionPermissions = [actionExecutePermission];\n"],"names":["createPermission"],"mappings":";;;;AAuBO,MAAM,iCAAoC,GAAA,sBAAA;AAO1C,MAAM,+BAAkC,GAAA,oBAAA;AAQxC,MAAM,0BAA0BA,uCAAiB,CAAA;AAAA,EACtD,IAAM,EAAA,2BAAA;AAAA,EACN,YAAY,EAAC;AAAA,EACb,YAAc,EAAA,+BAAA;AAChB,CAAC,EAAA;AAYM,MAAM,kCAAkCA,uCAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,oCAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,iCAAA;AAChB,CAAC,EAAA;AAYM,MAAM,6BAA6BA,uCAAiB,CAAA;AAAA,EACzD,IAAM,EAAA,+BAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,iCAAA;AAChB,CAAC,EAAA;AAMM,MAAM,qBAAwB,GAAA;AAAA,EACnC,uBAAA;AAAA,EACA,+BAAA;AAAA,EACA,0BAAA;AACF,EAAA;AAMO,MAAM,6BAAgC,GAAA;AAAA,EAC3C,+BAAA;AAAA,EACA,0BAAA;AACF,EAAA;AAMa,MAAA,2BAAA,GAA8B,CAAC,uBAAuB;;;;;;;;;;;"}
|
package/dist/alpha.esm.js
CHANGED
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = "scaffolder-template";
|
|
4
|
-
const RESOURCE_TYPE_SCAFFOLDER_ACTION = "scaffolder-action";
|
|
5
|
-
const actionExecutePermission = createPermission({
|
|
6
|
-
name: "scaffolder.action.execute",
|
|
7
|
-
attributes: {},
|
|
8
|
-
resourceType: RESOURCE_TYPE_SCAFFOLDER_ACTION
|
|
9
|
-
});
|
|
10
|
-
const templateParameterReadPermission = createPermission({
|
|
11
|
-
name: "scaffolder.template.parameter.read",
|
|
12
|
-
attributes: {
|
|
13
|
-
action: "read"
|
|
14
|
-
},
|
|
15
|
-
resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE
|
|
16
|
-
});
|
|
17
|
-
const templateStepReadPermission = createPermission({
|
|
18
|
-
name: "scaffolder.template.step.read",
|
|
19
|
-
attributes: {
|
|
20
|
-
action: "read"
|
|
21
|
-
},
|
|
22
|
-
resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE
|
|
23
|
-
});
|
|
24
|
-
const scaffolderPermissions = [
|
|
25
|
-
actionExecutePermission,
|
|
26
|
-
templateParameterReadPermission,
|
|
27
|
-
templateStepReadPermission
|
|
28
|
-
];
|
|
29
|
-
const scaffolderTemplatePermissions = [
|
|
30
|
-
templateParameterReadPermission,
|
|
31
|
-
templateStepReadPermission
|
|
32
|
-
];
|
|
33
|
-
const scaffolderActionPermissions = [actionExecutePermission];
|
|
34
|
-
|
|
35
|
-
export { RESOURCE_TYPE_SCAFFOLDER_ACTION, RESOURCE_TYPE_SCAFFOLDER_TEMPLATE, actionExecutePermission, scaffolderActionPermissions, scaffolderPermissions, scaffolderTemplatePermissions, templateParameterReadPermission, templateStepReadPermission };
|
|
1
|
+
export { RESOURCE_TYPE_SCAFFOLDER_ACTION, RESOURCE_TYPE_SCAFFOLDER_TEMPLATE, actionExecutePermission, scaffolderActionPermissions, scaffolderPermissions, scaffolderTemplatePermissions, templateParameterReadPermission, templateStepReadPermission } from './permissions.esm.js';
|
|
36
2
|
//# sourceMappingURL=alpha.esm.js.map
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":[
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index.cjs.js
CHANGED
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/TemplateEntityV1beta3.ts"],"sourcesContent":["/*\n * Copyright 2020 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 Entity,\n entityKindSchemaValidator,\n KindValidator,\n} from '@backstage/catalog-model';\nimport { JsonObject } from '@backstage/types';\nimport schema from './Template.v1beta3.schema.json';\n\n/**\n * Backstage catalog Template kind Entity. Templates are used by the Scaffolder\n * plugin to create new entities, such as Components.\n *\n * @public\n */\nexport interface TemplateEntityV1beta3 extends Entity {\n /**\n * The apiVersion string of the TaskSpec.\n */\n apiVersion: 'scaffolder.backstage.io/v1beta3';\n /**\n * The kind of the entity\n */\n kind: 'Template';\n /**\n * The specification of the Template Entity\n */\n spec: {\n /**\n * The type that the Template will create. For example service, website or library.\n */\n type: string;\n\n /**\n * Template specific configuration of the presentation layer.\n */\n presentation?: TemplatePresentationV1beta3;\n\n /**\n * Recovery strategy for the template\n */\n EXPERIMENTAL_recovery?: TemplateRecoveryV1beta3;\n\n /**\n * This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend\n * to collect user input and validate it against that schema. This can then be used in the `steps` part below to template\n * variables passed from the user into each action in the template.\n */\n parameters?: TemplateParametersV1beta3 | TemplateParametersV1beta3[];\n /**\n * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying\n * javascript action and some optional input parameters that may or may not have been collected from the end user.\n */\n steps: Array<TemplateEntityStepV1beta3>;\n /**\n * The output is an object where template authors can pull out information from template actions and return them in a known standard way.\n */\n output?: { [name: string]: string };\n /**\n * The owner entityRef of the TemplateEntity\n */\n owner?: string;\n };\n}\n\n/**\n * Depends on how you designed your task you might tailor the behaviour for each of them.\n *\n * @public\n */\nexport interface TemplateRecoveryV1beta3 extends JsonObject {\n /**\n *\n * none - not recover, let the task be marked as failed\n * startOver - do recover, start the execution of the task from the first step.\n *\n * @public\n */\n EXPERIMENTAL_strategy?: 'none' | 'startOver';\n}\n\n/**\n * The presentation of the template.\n *\n * @public\n */\nexport interface TemplatePresentationV1beta3 extends JsonObject {\n /**\n * Overrides default buttons' text\n */\n buttonLabels?: {\n /**\n * The text for the button which leads to the previous template page\n */\n backButtonText?: string;\n /**\n * The text for the button which starts the execution of the template\n */\n createButtonText?: string;\n /**\n * The text for the button which opens template's review/summary\n */\n reviewButtonText?: string;\n };\n}\n\n/**\n * Step that is part of a Template Entity.\n *\n * @public\n */\nexport interface TemplateEntityStepV1beta3 extends JsonObject {\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n 'backstage:permissions'?: TemplatePermissionsV1beta3;\n}\n\n/**\n * Parameter that is part of a Template Entity.\n *\n * @public\n */\nexport interface TemplateParametersV1beta3 extends JsonObject {\n 'backstage:permissions'?: TemplatePermissionsV1beta3;\n}\n\n/**\n * Access control properties for parts of a template.\n *\n * @public\n */\nexport interface TemplatePermissionsV1beta3 extends JsonObject {\n tags?: string[];\n}\n\nconst validator = entityKindSchemaValidator(schema);\n\n/**\n * Entity data validator for {@link TemplateEntityV1beta3}.\n *\n * @public\n */\nexport const templateEntityV1beta3Validator: KindValidator = {\n // TODO(freben): Emulate the old KindValidator until we fix that type\n async check(data: Entity) {\n return validator(data) === data;\n },\n};\n\n/**\n * Typeguard for filtering entities and ensuring v1beta3 entities\n * @public\n */\nexport const isTemplateEntityV1beta3 = (\n entity: Entity,\n): entity is TemplateEntityV1beta3 =>\n entity.apiVersion === 'scaffolder.backstage.io/v1beta3' &&\n entity.kind === 'Template';\n"],"names":["entityKindSchemaValidator"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/TemplateEntityV1beta3.ts"],"sourcesContent":["/*\n * Copyright 2020 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 Entity,\n entityKindSchemaValidator,\n KindValidator,\n} from '@backstage/catalog-model';\nimport { JsonObject } from '@backstage/types';\nimport schema from './Template.v1beta3.schema.json';\n\n/**\n * Backstage catalog Template kind Entity. Templates are used by the Scaffolder\n * plugin to create new entities, such as Components.\n *\n * @public\n */\nexport interface TemplateEntityV1beta3 extends Entity {\n /**\n * The apiVersion string of the TaskSpec.\n */\n apiVersion: 'scaffolder.backstage.io/v1beta3';\n /**\n * The kind of the entity\n */\n kind: 'Template';\n /**\n * The specification of the Template Entity\n */\n spec: {\n /**\n * The type that the Template will create. For example service, website or library.\n */\n type: string;\n\n /**\n * Template specific configuration of the presentation layer.\n */\n presentation?: TemplatePresentationV1beta3;\n\n /**\n * Recovery strategy for the template\n */\n EXPERIMENTAL_recovery?: TemplateRecoveryV1beta3;\n\n /**\n * This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend\n * to collect user input and validate it against that schema. This can then be used in the `steps` part below to template\n * variables passed from the user into each action in the template.\n */\n parameters?: TemplateParametersV1beta3 | TemplateParametersV1beta3[];\n /**\n * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying\n * javascript action and some optional input parameters that may or may not have been collected from the end user.\n */\n steps: Array<TemplateEntityStepV1beta3>;\n /**\n * The output is an object where template authors can pull out information from template actions and return them in a known standard way.\n */\n output?: { [name: string]: string };\n /**\n * The owner entityRef of the TemplateEntity\n */\n owner?: string;\n };\n}\n\n/**\n * Depends on how you designed your task you might tailor the behaviour for each of them.\n *\n * @public\n */\nexport interface TemplateRecoveryV1beta3 extends JsonObject {\n /**\n *\n * none - not recover, let the task be marked as failed\n * startOver - do recover, start the execution of the task from the first step.\n *\n * @public\n */\n EXPERIMENTAL_strategy?: 'none' | 'startOver';\n}\n\n/**\n * The presentation of the template.\n *\n * @public\n */\nexport interface TemplatePresentationV1beta3 extends JsonObject {\n /**\n * Overrides default buttons' text\n */\n buttonLabels?: {\n /**\n * The text for the button which leads to the previous template page\n */\n backButtonText?: string;\n /**\n * The text for the button which starts the execution of the template\n */\n createButtonText?: string;\n /**\n * The text for the button which opens template's review/summary\n */\n reviewButtonText?: string;\n };\n}\n\n/**\n * Step that is part of a Template Entity.\n *\n * @public\n */\nexport interface TemplateEntityStepV1beta3 extends JsonObject {\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n 'backstage:permissions'?: TemplatePermissionsV1beta3;\n}\n\n/**\n * Parameter that is part of a Template Entity.\n *\n * @public\n */\nexport interface TemplateParametersV1beta3 extends JsonObject {\n 'backstage:permissions'?: TemplatePermissionsV1beta3;\n}\n\n/**\n * Access control properties for parts of a template.\n *\n * @public\n */\nexport interface TemplatePermissionsV1beta3 extends JsonObject {\n tags?: string[];\n}\n\nconst validator = entityKindSchemaValidator(schema);\n\n/**\n * Entity data validator for {@link TemplateEntityV1beta3}.\n *\n * @public\n */\nexport const templateEntityV1beta3Validator: KindValidator = {\n // TODO(freben): Emulate the old KindValidator until we fix that type\n async check(data: Entity) {\n return validator(data) === data;\n },\n};\n\n/**\n * Typeguard for filtering entities and ensuring v1beta3 entities\n * @public\n */\nexport const isTemplateEntityV1beta3 = (\n entity: Entity,\n): entity is TemplateEntityV1beta3 =>\n entity.apiVersion === 'scaffolder.backstage.io/v1beta3' &&\n entity.kind === 'Template';\n"],"names":["entityKindSchemaValidator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyJA,MAAM,SAAA,GAAYA,uCAA0B,MAAM,CAAA,CAAA;AAO3C,MAAM,8BAAgD,GAAA;AAAA;AAAA,EAE3D,MAAM,MAAM,IAAc,EAAA;AACxB,IAAO,OAAA,SAAA,CAAU,IAAI,CAAM,KAAA,IAAA,CAAA;AAAA,GAC7B;AACF,EAAA;AAMO,MAAM,0BAA0B,CACrC,MAAA,KAEA,OAAO,UAAe,KAAA,iCAAA,IACtB,OAAO,IAAS,KAAA;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -270,4 +270,4 @@ declare const templateEntityV1beta3Validator: KindValidator;
|
|
|
270
270
|
*/
|
|
271
271
|
declare const isTemplateEntityV1beta3: (entity: Entity) => entity is TemplateEntityV1beta3;
|
|
272
272
|
|
|
273
|
-
export { TaskRecoverStrategy, TaskRecovery, TaskSpec, TaskSpecV1beta3, TaskStep, TemplateEntityStepV1beta3, TemplateEntityV1beta3, TemplateInfo, TemplateParametersV1beta3, TemplatePermissionsV1beta3, TemplatePresentationV1beta3, TemplateRecoveryV1beta3, isTemplateEntityV1beta3, templateEntityV1beta3Validator };
|
|
273
|
+
export { type TaskRecoverStrategy, type TaskRecovery, type TaskSpec, type TaskSpecV1beta3, type TaskStep, type TemplateEntityStepV1beta3, type TemplateEntityV1beta3, type TemplateInfo, type TemplateParametersV1beta3, type TemplatePermissionsV1beta3, type TemplatePresentationV1beta3, type TemplateRecoveryV1beta3, isTemplateEntityV1beta3, templateEntityV1beta3Validator };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,354 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var $schema = "http://json-schema.org/draft-07/schema";
|
|
4
|
-
var $id = "TemplateV1beta3";
|
|
5
|
-
var description = "A Template describes a scaffolding task for use with the Scaffolder. It describes the required parameters as well as a series of steps that will be taken to execute the scaffolding task.";
|
|
6
|
-
var examples = [
|
|
7
|
-
{
|
|
8
|
-
apiVersion: "scaffolder.backstage.io/v1beta3",
|
|
9
|
-
kind: "Template",
|
|
10
|
-
metadata: {
|
|
11
|
-
name: "react-ssr-template",
|
|
12
|
-
title: "React SSR Template",
|
|
13
|
-
description: "Next.js application skeleton for creating isomorphic web applications.",
|
|
14
|
-
tags: [
|
|
15
|
-
"recommended",
|
|
16
|
-
"react"
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
spec: {
|
|
20
|
-
owner: "artist-relations-team",
|
|
21
|
-
type: "website",
|
|
22
|
-
parameters: {
|
|
23
|
-
required: [
|
|
24
|
-
"name",
|
|
25
|
-
"description",
|
|
26
|
-
"repoUrl"
|
|
27
|
-
],
|
|
28
|
-
"backstage:permissions": {
|
|
29
|
-
tags: [
|
|
30
|
-
"one",
|
|
31
|
-
"two"
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
properties: {
|
|
35
|
-
name: {
|
|
36
|
-
title: "Name",
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "Unique name of the component"
|
|
39
|
-
},
|
|
40
|
-
description: {
|
|
41
|
-
title: "Description",
|
|
42
|
-
type: "string",
|
|
43
|
-
description: "Description of the component"
|
|
44
|
-
},
|
|
45
|
-
repoUrl: {
|
|
46
|
-
title: "Pick a repository",
|
|
47
|
-
type: "string",
|
|
48
|
-
"ui:field": "RepoUrlPicker"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
steps: [
|
|
53
|
-
{
|
|
54
|
-
id: "fetch",
|
|
55
|
-
name: "Fetch",
|
|
56
|
-
action: "fetch:plain",
|
|
57
|
-
parameters: {
|
|
58
|
-
url: "./template"
|
|
59
|
-
},
|
|
60
|
-
"backstage:permissions": {
|
|
61
|
-
tags: [
|
|
62
|
-
"one",
|
|
63
|
-
"two"
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: "publish",
|
|
69
|
-
name: "Publish to GitHub",
|
|
70
|
-
action: "publish:github",
|
|
71
|
-
parameters: {
|
|
72
|
-
repoUrl: "${{ parameters.repoUrl }}"
|
|
73
|
-
},
|
|
74
|
-
"if": "${{ parameters.repoUrl }}"
|
|
75
|
-
}
|
|
76
|
-
],
|
|
77
|
-
output: {
|
|
78
|
-
catalogInfoUrl: "${{ steps.publish.output.catalogInfoUrl }}"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
];
|
|
83
|
-
var allOf = [
|
|
84
|
-
{
|
|
85
|
-
$ref: "Entity"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
type: "object",
|
|
89
|
-
required: [
|
|
90
|
-
"spec"
|
|
91
|
-
],
|
|
92
|
-
properties: {
|
|
93
|
-
apiVersion: {
|
|
94
|
-
"enum": [
|
|
95
|
-
"scaffolder.backstage.io/v1beta3"
|
|
96
|
-
]
|
|
97
|
-
},
|
|
98
|
-
kind: {
|
|
99
|
-
"enum": [
|
|
100
|
-
"Template"
|
|
101
|
-
]
|
|
102
|
-
},
|
|
103
|
-
spec: {
|
|
104
|
-
type: "object",
|
|
105
|
-
required: [
|
|
106
|
-
"type",
|
|
107
|
-
"steps"
|
|
108
|
-
],
|
|
109
|
-
properties: {
|
|
110
|
-
type: {
|
|
111
|
-
type: "string",
|
|
112
|
-
description: "The type of component created by the template. The software catalog accepts any type value, but an organization should take great care to establish a proper taxonomy for these. Tools including Backstage itself may read this field and behave differently depending on its value. For example, a website type component may present tooling in the Backstage interface that is specific to just websites.",
|
|
113
|
-
examples: [
|
|
114
|
-
"service",
|
|
115
|
-
"website",
|
|
116
|
-
"library"
|
|
117
|
-
],
|
|
118
|
-
minLength: 1
|
|
119
|
-
},
|
|
120
|
-
owner: {
|
|
121
|
-
type: "string",
|
|
122
|
-
description: "The user (or group) owner of the template",
|
|
123
|
-
minLength: 1
|
|
124
|
-
},
|
|
125
|
-
parameters: {
|
|
126
|
-
oneOf: [
|
|
127
|
-
{
|
|
128
|
-
type: "object",
|
|
129
|
-
description: "The JSONSchema describing the inputs for the template.",
|
|
130
|
-
properties: {
|
|
131
|
-
"backstage:permissions": {
|
|
132
|
-
type: "object",
|
|
133
|
-
description: "Object used for authorizing the parameter",
|
|
134
|
-
properties: {
|
|
135
|
-
tags: {
|
|
136
|
-
type: "array",
|
|
137
|
-
items: {
|
|
138
|
-
type: "string"
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
type: "array",
|
|
147
|
-
description: "A list of separate forms to collect parameters.",
|
|
148
|
-
items: {
|
|
149
|
-
type: "object",
|
|
150
|
-
description: "The JSONSchema describing the inputs for the template.",
|
|
151
|
-
properties: {
|
|
152
|
-
"backstage:permissions": {
|
|
153
|
-
type: "object",
|
|
154
|
-
description: "Object used for authorizing the parameter",
|
|
155
|
-
properties: {
|
|
156
|
-
tags: {
|
|
157
|
-
type: "array",
|
|
158
|
-
items: {
|
|
159
|
-
type: "string"
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
]
|
|
168
|
-
},
|
|
169
|
-
presentation: {
|
|
170
|
-
type: "object",
|
|
171
|
-
description: "A way to redefine the labels for actionable buttons.",
|
|
172
|
-
properties: {
|
|
173
|
-
backButtonText: {
|
|
174
|
-
type: "string",
|
|
175
|
-
description: "A button which return the user to one step back."
|
|
176
|
-
},
|
|
177
|
-
createButtonText: {
|
|
178
|
-
type: "string",
|
|
179
|
-
description: "A button which start the execution of the template."
|
|
180
|
-
},
|
|
181
|
-
reviewButtonText: {
|
|
182
|
-
type: "string",
|
|
183
|
-
description: "A button which open the review step to verify the input prior to start the execution."
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
EXPERIMENTAL_recovery: {
|
|
188
|
-
type: "object",
|
|
189
|
-
description: "A task recovery section.",
|
|
190
|
-
properties: {
|
|
191
|
-
EXPERIMENTAL_strategy: {
|
|
192
|
-
type: "string",
|
|
193
|
-
description: "Recovery strategy for your task (none or startOver). By default none"
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
steps: {
|
|
198
|
-
type: "array",
|
|
199
|
-
description: "A list of steps to execute.",
|
|
200
|
-
items: {
|
|
201
|
-
type: "object",
|
|
202
|
-
description: "A description of the step to execute.",
|
|
203
|
-
required: [
|
|
204
|
-
"action"
|
|
205
|
-
],
|
|
206
|
-
properties: {
|
|
207
|
-
id: {
|
|
208
|
-
type: "string",
|
|
209
|
-
description: "The ID of the step, which can be used to refer to its outputs."
|
|
210
|
-
},
|
|
211
|
-
name: {
|
|
212
|
-
type: "string",
|
|
213
|
-
description: "The name of the step, which will be displayed in the UI during the scaffolding process."
|
|
214
|
-
},
|
|
215
|
-
action: {
|
|
216
|
-
type: "string",
|
|
217
|
-
description: "The name of the action to execute."
|
|
218
|
-
},
|
|
219
|
-
input: {
|
|
220
|
-
type: "object",
|
|
221
|
-
description: "A templated object describing the inputs to the action."
|
|
222
|
-
},
|
|
223
|
-
"if": {
|
|
224
|
-
type: [
|
|
225
|
-
"string",
|
|
226
|
-
"boolean"
|
|
227
|
-
],
|
|
228
|
-
description: "A templated condition that skips the step when evaluated to false. If the condition is true or not defined, the step is executed. The condition is true, if the input is not `false`, `undefined`, `null`, `\"\"`, `0`, or `[]`."
|
|
229
|
-
},
|
|
230
|
-
"backstage:permissions": {
|
|
231
|
-
type: "object",
|
|
232
|
-
description: "Object used for authorizing the step",
|
|
233
|
-
properties: {
|
|
234
|
-
tags: {
|
|
235
|
-
type: "array",
|
|
236
|
-
items: {
|
|
237
|
-
type: "string"
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
output: {
|
|
246
|
-
type: "object",
|
|
247
|
-
description: "A templated object describing the outputs of the scaffolding task.",
|
|
248
|
-
properties: {
|
|
249
|
-
links: {
|
|
250
|
-
type: "array",
|
|
251
|
-
description: "A list of external hyperlinks, typically pointing to resources created or updated by the template",
|
|
252
|
-
items: {
|
|
253
|
-
type: "object",
|
|
254
|
-
required: [
|
|
255
|
-
],
|
|
256
|
-
properties: {
|
|
257
|
-
url: {
|
|
258
|
-
type: "string",
|
|
259
|
-
description: "A url in a standard uri format.",
|
|
260
|
-
examples: [
|
|
261
|
-
"https://github.com/my-org/my-new-repo"
|
|
262
|
-
],
|
|
263
|
-
minLength: 1
|
|
264
|
-
},
|
|
265
|
-
entityRef: {
|
|
266
|
-
type: "string",
|
|
267
|
-
description: "An entity reference to an entity in the catalog.",
|
|
268
|
-
examples: [
|
|
269
|
-
"Component:default/my-app"
|
|
270
|
-
],
|
|
271
|
-
minLength: 1
|
|
272
|
-
},
|
|
273
|
-
title: {
|
|
274
|
-
type: "string",
|
|
275
|
-
description: "A user friendly display name for the link.",
|
|
276
|
-
examples: [
|
|
277
|
-
"View new repo"
|
|
278
|
-
],
|
|
279
|
-
minLength: 1
|
|
280
|
-
},
|
|
281
|
-
icon: {
|
|
282
|
-
type: "string",
|
|
283
|
-
description: "A key representing a visual icon to be displayed in the UI.",
|
|
284
|
-
examples: [
|
|
285
|
-
"dashboard"
|
|
286
|
-
],
|
|
287
|
-
minLength: 1
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
text: {
|
|
293
|
-
type: "array",
|
|
294
|
-
description: "A list of Markdown text blobs, like output data from the template.",
|
|
295
|
-
items: {
|
|
296
|
-
type: "object",
|
|
297
|
-
required: [
|
|
298
|
-
],
|
|
299
|
-
properties: {
|
|
300
|
-
title: {
|
|
301
|
-
type: "string",
|
|
302
|
-
description: "A user friendly display name for the text.",
|
|
303
|
-
examples: [
|
|
304
|
-
"Output Content"
|
|
305
|
-
],
|
|
306
|
-
minLength: 1
|
|
307
|
-
},
|
|
308
|
-
icon: {
|
|
309
|
-
type: "string",
|
|
310
|
-
description: "A key representing a visual icon to be displayed in the UI.",
|
|
311
|
-
examples: [
|
|
312
|
-
"dashboard"
|
|
313
|
-
],
|
|
314
|
-
minLength: 1
|
|
315
|
-
},
|
|
316
|
-
content: {
|
|
317
|
-
type: "string",
|
|
318
|
-
description: "The text blob to display in the UI, rendered as Markdown.",
|
|
319
|
-
examples: [
|
|
320
|
-
"**hey** _I'm_ Markdown"
|
|
321
|
-
]
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
additionalProperties: {
|
|
328
|
-
type: "string"
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
];
|
|
336
|
-
var schema = {
|
|
337
|
-
$schema: $schema,
|
|
338
|
-
$id: $id,
|
|
339
|
-
description: description,
|
|
340
|
-
examples: examples,
|
|
341
|
-
allOf: allOf
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
const validator = entityKindSchemaValidator(schema);
|
|
345
|
-
const templateEntityV1beta3Validator = {
|
|
346
|
-
// TODO(freben): Emulate the old KindValidator until we fix that type
|
|
347
|
-
async check(data) {
|
|
348
|
-
return validator(data) === data;
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
const isTemplateEntityV1beta3 = (entity) => entity.apiVersion === "scaffolder.backstage.io/v1beta3" && entity.kind === "Template";
|
|
352
|
-
|
|
353
|
-
export { isTemplateEntityV1beta3, templateEntityV1beta3Validator };
|
|
1
|
+
export { isTemplateEntityV1beta3, templateEntityV1beta3Validator } from './TemplateEntityV1beta3.esm.js';
|
|
354
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createPermission } from '@backstage/plugin-permission-common';
|
|
2
|
+
|
|
3
|
+
const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = "scaffolder-template";
|
|
4
|
+
const RESOURCE_TYPE_SCAFFOLDER_ACTION = "scaffolder-action";
|
|
5
|
+
const actionExecutePermission = createPermission({
|
|
6
|
+
name: "scaffolder.action.execute",
|
|
7
|
+
attributes: {},
|
|
8
|
+
resourceType: RESOURCE_TYPE_SCAFFOLDER_ACTION
|
|
9
|
+
});
|
|
10
|
+
const templateParameterReadPermission = createPermission({
|
|
11
|
+
name: "scaffolder.template.parameter.read",
|
|
12
|
+
attributes: {
|
|
13
|
+
action: "read"
|
|
14
|
+
},
|
|
15
|
+
resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE
|
|
16
|
+
});
|
|
17
|
+
const templateStepReadPermission = createPermission({
|
|
18
|
+
name: "scaffolder.template.step.read",
|
|
19
|
+
attributes: {
|
|
20
|
+
action: "read"
|
|
21
|
+
},
|
|
22
|
+
resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE
|
|
23
|
+
});
|
|
24
|
+
const scaffolderPermissions = [
|
|
25
|
+
actionExecutePermission,
|
|
26
|
+
templateParameterReadPermission,
|
|
27
|
+
templateStepReadPermission
|
|
28
|
+
];
|
|
29
|
+
const scaffolderTemplatePermissions = [
|
|
30
|
+
templateParameterReadPermission,
|
|
31
|
+
templateStepReadPermission
|
|
32
|
+
];
|
|
33
|
+
const scaffolderActionPermissions = [actionExecutePermission];
|
|
34
|
+
|
|
35
|
+
export { RESOURCE_TYPE_SCAFFOLDER_ACTION, RESOURCE_TYPE_SCAFFOLDER_TEMPLATE, actionExecutePermission, scaffolderActionPermissions, scaffolderPermissions, scaffolderTemplatePermissions, templateParameterReadPermission, templateStepReadPermission };
|
|
36
|
+
//# sourceMappingURL=permissions.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.esm.js","sources":["../src/permissions.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 { createPermission } from '@backstage/plugin-permission-common';\n\n/**\n * Permission resource type which corresponds to a scaffolder templates.\n *\n * @alpha\n */\nexport const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = 'scaffolder-template';\n\n/**\n * Permission resource type which corresponds to a scaffolder action.\n *\n * @alpha\n */\nexport const RESOURCE_TYPE_SCAFFOLDER_ACTION = 'scaffolder-action';\n\n/**\n * This permission is used to authorize actions that involve executing\n * an action from a template.\n *\n * @alpha\n */\nexport const actionExecutePermission = createPermission({\n name: 'scaffolder.action.execute',\n attributes: {},\n resourceType: RESOURCE_TYPE_SCAFFOLDER_ACTION,\n});\n\n/**\n * This permission is used to authorize actions that involve reading\n * one or more parameters from a template.\n *\n * If this permission is not authorized, it will appear that the\n * parameter does not exist in the template — both in the frontend\n * and in API responses.\n *\n * @alpha\n */\nexport const templateParameterReadPermission = createPermission({\n name: 'scaffolder.template.parameter.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n});\n\n/**\n * This permission is used to authorize actions that involve reading\n * one or more steps from a template.\n *\n * If this permission is not authorized, it will appear that the\n * step does not exist in the template — both in the frontend\n * and in API responses. Steps will also not be executed.\n *\n * @alpha\n */\nexport const templateStepReadPermission = createPermission({\n name: 'scaffolder.template.step.read',\n attributes: {\n action: 'read',\n },\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n});\n\n/**\n * List of all the scaffolder permissions\n * @alpha\n */\nexport const scaffolderPermissions = [\n actionExecutePermission,\n templateParameterReadPermission,\n templateStepReadPermission,\n];\n\n/**\n * List of the scaffolder permissions that are associated with template steps and parameters.\n * @alpha\n */\nexport const scaffolderTemplatePermissions = [\n templateParameterReadPermission,\n templateStepReadPermission,\n];\n\n/**\n * List of the scaffolder permissions that are associated with scaffolder actions.\n * @alpha\n */\nexport const scaffolderActionPermissions = [actionExecutePermission];\n"],"names":[],"mappings":";;AAuBO,MAAM,iCAAoC,GAAA,sBAAA;AAO1C,MAAM,+BAAkC,GAAA,oBAAA;AAQxC,MAAM,0BAA0B,gBAAiB,CAAA;AAAA,EACtD,IAAM,EAAA,2BAAA;AAAA,EACN,YAAY,EAAC;AAAA,EACb,YAAc,EAAA,+BAAA;AAChB,CAAC,EAAA;AAYM,MAAM,kCAAkC,gBAAiB,CAAA;AAAA,EAC9D,IAAM,EAAA,oCAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,iCAAA;AAChB,CAAC,EAAA;AAYM,MAAM,6BAA6B,gBAAiB,CAAA;AAAA,EACzD,IAAM,EAAA,+BAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA,iCAAA;AAChB,CAAC,EAAA;AAMM,MAAM,qBAAwB,GAAA;AAAA,EACnC,uBAAA;AAAA,EACA,+BAAA;AAAA,EACA,0BAAA;AACF,EAAA;AAMO,MAAM,6BAAgC,GAAA;AAAA,EAC3C,+BAAA;AAAA,EACA,0BAAA;AACF,EAAA;AAMa,MAAA,2BAAA,GAA8B,CAAC,uBAAuB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-common",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2-next.0",
|
|
4
4
|
"description": "Common functionalities for the scaffolder, to be shared between scaffolder and scaffolder-backend plugin",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "common-library"
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"test": "backstage-cli package test"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@backstage/catalog-model": "^1.
|
|
55
|
+
"@backstage/catalog-model": "^1.5.0-next.0",
|
|
56
56
|
"@backstage/plugin-permission-common": "^0.7.13",
|
|
57
57
|
"@backstage/types": "^1.1.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@backstage/cli": "^0.26.0"
|
|
60
|
+
"@backstage/cli": "^0.26.5-next.0"
|
|
61
61
|
},
|
|
62
62
|
"module": "./dist/index.esm.js"
|
|
63
63
|
}
|