@backstage/plugin-scaffolder-common 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @backstage/plugin-scaffolder-common
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix for the previous release with missing type declarations.
8
+ - Updated dependencies
9
+ - @backstage/catalog-model@0.10.1
10
+ - @backstage/types@0.1.3
11
+
12
+ ## 0.2.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 5e585bbc7f: **BREAKING**: Removed the `templateEntityV1beta3Schema` export
17
+
18
+ ### Patch Changes
19
+
20
+ - e72d371296: Added `TemplateEntityV1beta2` which was moved here from
21
+ `@backstage/plugin-scaffolder-common`. It has also been marked as deprecated in
22
+ the process - please consider [migrating to `v1beta3`
23
+ templates](https://backstage.io/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3).
24
+ - c77c5c7eb6: Added `backstage.role` to `package.json`
25
+ - Updated dependencies
26
+ - @backstage/catalog-model@0.10.0
27
+ - @backstage/types@0.1.2
28
+
29
+ ## 0.1.3
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies
34
+ - @backstage/catalog-model@0.9.10
35
+
36
+ ## 0.1.3-next.0
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies
41
+ - @backstage/catalog-model@0.9.10-next.0
42
+
3
43
  ## 0.1.2
4
44
 
5
45
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -2,6 +2,236 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var catalogModel = require('@backstage/catalog-model');
6
+
7
+ var $schema$1 = "http://json-schema.org/draft-07/schema";
8
+ var $id$1 = "TemplateV1beta2";
9
+ var description$1 = "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.";
10
+ var examples$1 = [
11
+ {
12
+ apiVersion: "backstage.io/v1beta2",
13
+ kind: "Template",
14
+ metadata: {
15
+ name: "react-ssr-template",
16
+ title: "React SSR Template",
17
+ description: "Next.js application skeleton for creating isomorphic web applications.",
18
+ tags: [
19
+ "recommended",
20
+ "react"
21
+ ]
22
+ },
23
+ spec: {
24
+ owner: "artist-relations-team",
25
+ type: "website",
26
+ parameters: {
27
+ required: [
28
+ "name",
29
+ "description"
30
+ ],
31
+ properties: {
32
+ name: {
33
+ title: "Name",
34
+ type: "string",
35
+ description: "Unique name of the component"
36
+ },
37
+ description: {
38
+ title: "Description",
39
+ type: "string",
40
+ description: "Description of the component"
41
+ }
42
+ }
43
+ },
44
+ steps: [
45
+ {
46
+ id: "fetch",
47
+ name: "Fetch",
48
+ action: "fetch:plain",
49
+ parameters: {
50
+ url: "./template"
51
+ }
52
+ },
53
+ {
54
+ id: "publish",
55
+ name: "Publish to GitHub",
56
+ action: "publish:github",
57
+ parameters: {
58
+ repoUrl: "{{ parameters.repoUrl }}"
59
+ },
60
+ "if": "{{ parameters.repoUrl }}"
61
+ }
62
+ ],
63
+ output: {
64
+ catalogInfoUrl: "{{ steps.publish.output.catalogInfoUrl }}"
65
+ }
66
+ }
67
+ }
68
+ ];
69
+ var allOf$1 = [
70
+ {
71
+ $ref: "Entity"
72
+ },
73
+ {
74
+ type: "object",
75
+ required: [
76
+ "spec"
77
+ ],
78
+ properties: {
79
+ apiVersion: {
80
+ "enum": [
81
+ "backstage.io/v1beta2"
82
+ ]
83
+ },
84
+ kind: {
85
+ "enum": [
86
+ "Template"
87
+ ]
88
+ },
89
+ spec: {
90
+ type: "object",
91
+ required: [
92
+ "type",
93
+ "steps"
94
+ ],
95
+ properties: {
96
+ type: {
97
+ type: "string",
98
+ 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.",
99
+ examples: [
100
+ "service",
101
+ "website",
102
+ "library"
103
+ ],
104
+ minLength: 1
105
+ },
106
+ parameters: {
107
+ oneOf: [
108
+ {
109
+ type: "object",
110
+ description: "The JSONSchema describing the inputs for the template."
111
+ },
112
+ {
113
+ type: "array",
114
+ description: "A list of separate forms to collect parameters.",
115
+ items: {
116
+ type: "object",
117
+ description: "The JSONSchema describing the inputs for the template."
118
+ }
119
+ }
120
+ ]
121
+ },
122
+ steps: {
123
+ type: "array",
124
+ description: "A list of steps to execute.",
125
+ items: {
126
+ type: "object",
127
+ description: "A description of the step to execute.",
128
+ required: [
129
+ "action"
130
+ ],
131
+ properties: {
132
+ id: {
133
+ type: "string",
134
+ description: "The ID of the step, which can be used to refer to its outputs."
135
+ },
136
+ name: {
137
+ type: "string",
138
+ description: "The name of the step, which will be displayed in the UI during the scaffolding process."
139
+ },
140
+ action: {
141
+ type: "string",
142
+ description: "The name of the action to execute."
143
+ },
144
+ input: {
145
+ type: "object",
146
+ description: "A templated object describing the inputs to the action."
147
+ },
148
+ "if": {
149
+ type: [
150
+ "string",
151
+ "boolean"
152
+ ],
153
+ 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 `[]`."
154
+ }
155
+ }
156
+ }
157
+ },
158
+ output: {
159
+ type: "object",
160
+ description: "A templated object describing the outputs of the scaffolding task.",
161
+ properties: {
162
+ links: {
163
+ type: "array",
164
+ description: "A list of external hyperlinks, typically pointing to resources created or updated by the template",
165
+ items: {
166
+ type: "object",
167
+ required: [
168
+ ],
169
+ properties: {
170
+ url: {
171
+ type: "string",
172
+ description: "A url in a standard uri format.",
173
+ examples: [
174
+ "https://github.com/my-org/my-new-repo"
175
+ ],
176
+ minLength: 1
177
+ },
178
+ entityRef: {
179
+ type: "string",
180
+ description: "An entity reference to an entity in the catalog.",
181
+ examples: [
182
+ "Component:default/my-app"
183
+ ],
184
+ minLength: 1
185
+ },
186
+ title: {
187
+ type: "string",
188
+ description: "A user friendly display name for the link.",
189
+ examples: [
190
+ "View new repo"
191
+ ],
192
+ minLength: 1
193
+ },
194
+ icon: {
195
+ type: "string",
196
+ description: "A key representing a visual icon to be displayed in the UI.",
197
+ examples: [
198
+ "dashboard"
199
+ ],
200
+ minLength: 1
201
+ }
202
+ }
203
+ }
204
+ }
205
+ },
206
+ additionalProperties: {
207
+ type: "string"
208
+ }
209
+ },
210
+ owner: {
211
+ type: "string",
212
+ description: "The user (or group) owner of the template",
213
+ minLength: 1
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ ];
220
+ var schema$1 = {
221
+ $schema: $schema$1,
222
+ $id: $id$1,
223
+ description: description$1,
224
+ examples: examples$1,
225
+ allOf: allOf$1
226
+ };
227
+
228
+ const validator$1 = catalogModel.entityKindSchemaValidator(schema$1);
229
+ const templateEntityV1beta2Validator = {
230
+ async check(data) {
231
+ return validator$1(data) === data;
232
+ }
233
+ };
234
+
5
235
  var $schema = "http://json-schema.org/draft-07/schema";
6
236
  var $id = "TemplateV1beta3";
7
237
  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.";
@@ -220,7 +450,7 @@ var allOf = [
220
450
  }
221
451
  }
222
452
  ];
223
- var v1beta3Schema = {
453
+ var schema = {
224
454
  $schema: $schema,
225
455
  $id: $id,
226
456
  description: description,
@@ -228,7 +458,13 @@ var v1beta3Schema = {
228
458
  allOf: allOf
229
459
  };
230
460
 
231
- const templateEntityV1beta3Schema = v1beta3Schema;
461
+ const validator = catalogModel.entityKindSchemaValidator(schema);
462
+ const templateEntityV1beta3Validator = {
463
+ async check(data) {
464
+ return validator(data) === data;
465
+ }
466
+ };
232
467
 
233
- exports.templateEntityV1beta3Schema = templateEntityV1beta3Schema;
468
+ exports.templateEntityV1beta2Validator = templateEntityV1beta2Validator;
469
+ exports.templateEntityV1beta3Validator = templateEntityV1beta3Validator;
234
470
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/index.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\n/**\n * Common functionalities for the scaffolder, to be shared between scaffolder and scaffolder-backend plugin\n *\n * @packageDocumentation\n */\n\nimport { JSONSchema } from '@backstage/catalog-model';\nimport v1beta3Schema from './Template.v1beta3.schema.json';\n\nexport type { TemplateEntityV1beta3 } from './TemplateEntityV1beta3';\n\n/** @public */\nexport const templateEntityV1beta3Schema: JSONSchema = v1beta3Schema as Omit<\n JSONSchema,\n 'examples'\n>;\n\nexport * from './TaskSpec';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA4Ba,8BAA0C;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/TemplateEntityV1beta2.ts","../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.v1beta2.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 * @deprecated Please convert your templates to TemplateEntityV1beta3 on\n * apiVersion scaffolder.backstage.io/v1beta3\n */\nexport interface TemplateEntityV1beta2 extends Entity {\n apiVersion: 'backstage.io/v1beta2';\n kind: 'Template';\n spec: {\n type: string;\n parameters?: JsonObject | JsonObject[];\n steps: Array<{\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n }>;\n output?: { [name: string]: string };\n owner?: string;\n };\n}\n\nconst validator = entityKindSchemaValidator(schema);\n\n/**\n * Entity data validator for {@link TemplateEntityV1beta2}.\n *\n * @public\n * @deprecated Please convert your templates to TemplateEntityV1beta3 on\n * apiVersion scaffolder.backstage.io/v1beta3\n */\nexport const templateEntityV1beta2Validator: 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 * 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 apiVersion: 'scaffolder.backstage.io/v1beta3';\n kind: 'Template';\n spec: {\n type: string;\n parameters?: JsonObject | JsonObject[];\n steps: Array<{\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n }>;\n output?: { [name: string]: string };\n owner?: string;\n };\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"],"names":["validator","entityKindSchemaValidator","schema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAMA,cAAYC,uCAA0BC;MAS/B,iCAAgD;AAAA,QAErD,MAAM,MAAc;AACxB,WAAOF,YAAU,UAAU;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACd/B,MAAM,YAAYC,uCAA0B;MAO/B,iCAAgD;AAAA,QAErD,MAAM,MAAc;AACxB,WAAO,UAAU,UAAU;AAAA;AAAA;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,29 +1,9 @@
1
- import { Entity, JSONSchema } from '@backstage/catalog-model';
2
1
  import { JsonObject, JsonValue } from '@backstage/types';
3
-
4
- /** @public */
5
- interface TemplateEntityV1beta3 extends Entity {
6
- apiVersion: 'scaffolder.backstage.io/v1beta3';
7
- kind: 'Template';
8
- spec: {
9
- type: string;
10
- parameters?: JsonObject | JsonObject[];
11
- steps: Array<{
12
- id?: string;
13
- name?: string;
14
- action: string;
15
- input?: JsonObject;
16
- if?: string | boolean;
17
- }>;
18
- output?: {
19
- [name: string]: string;
20
- };
21
- owner?: string;
22
- };
23
- }
2
+ import { Entity, KindValidator } from '@backstage/catalog-model';
24
3
 
25
4
  /**
26
- * TemplateMetadata
5
+ * Metadata about the Template that was the originator of a scaffolder task, as
6
+ * stored in the database.
27
7
  *
28
8
  * @public
29
9
  */
@@ -31,7 +11,7 @@ declare type TemplateMetadata = {
31
11
  name: string;
32
12
  };
33
13
  /**
34
- * TaskStep
14
+ * An individual step of a scaffolder task, as stored in the database.
35
15
  *
36
16
  * @public
37
17
  */
@@ -43,9 +23,12 @@ interface TaskStep {
43
23
  if?: string | boolean;
44
24
  }
45
25
  /**
46
- * TaskSpecV1beta2
26
+ * A scaffolder task as stored in the database, generated from a v1beta2
27
+ * apiVersion Template.
47
28
  *
48
29
  * @public
30
+ * @deprecated Please convert your templates to TaskSpecV1beta3 on apiVersion
31
+ * scaffolder.backstage.io/v1beta3
49
32
  */
50
33
  interface TaskSpecV1beta2 {
51
34
  apiVersion: 'backstage.io/v1beta2';
@@ -58,7 +41,8 @@ interface TaskSpecV1beta2 {
58
41
  metadata?: TemplateMetadata;
59
42
  }
60
43
  /**
61
- * TaskSpecV1beta3
44
+ * A scaffolder task as stored in the database, generated from a v1beta3
45
+ * apiVersion Template.
62
46
  *
63
47
  * @public
64
48
  */
@@ -73,19 +57,78 @@ interface TaskSpecV1beta3 {
73
57
  metadata?: TemplateMetadata;
74
58
  }
75
59
  /**
76
- * TaskSpec
60
+ * A scaffolder task as stored in the database, generated from a Template.
77
61
  *
78
62
  * @public
79
63
  */
80
64
  declare type TaskSpec = TaskSpecV1beta2 | TaskSpecV1beta3;
81
65
 
82
66
  /**
83
- * Common functionalities for the scaffolder, to be shared between scaffolder and scaffolder-backend plugin
67
+ * Backstage catalog Template kind Entity. Templates are used by the Scaffolder
68
+ * plugin to create new entities, such as Components.
69
+ *
70
+ * @public
71
+ * @deprecated Please convert your templates to TemplateEntityV1beta3 on
72
+ * apiVersion scaffolder.backstage.io/v1beta3
73
+ */
74
+ interface TemplateEntityV1beta2 extends Entity {
75
+ apiVersion: 'backstage.io/v1beta2';
76
+ kind: 'Template';
77
+ spec: {
78
+ type: string;
79
+ parameters?: JsonObject | JsonObject[];
80
+ steps: Array<{
81
+ id?: string;
82
+ name?: string;
83
+ action: string;
84
+ input?: JsonObject;
85
+ if?: string | boolean;
86
+ }>;
87
+ output?: {
88
+ [name: string]: string;
89
+ };
90
+ owner?: string;
91
+ };
92
+ }
93
+ /**
94
+ * Entity data validator for {@link TemplateEntityV1beta2}.
84
95
  *
85
- * @packageDocumentation
96
+ * @public
97
+ * @deprecated Please convert your templates to TemplateEntityV1beta3 on
98
+ * apiVersion scaffolder.backstage.io/v1beta3
86
99
  */
100
+ declare const templateEntityV1beta2Validator: KindValidator;
87
101
 
88
- /** @public */
89
- declare const templateEntityV1beta3Schema: JSONSchema;
102
+ /**
103
+ * Backstage catalog Template kind Entity. Templates are used by the Scaffolder
104
+ * plugin to create new entities, such as Components.
105
+ *
106
+ * @public
107
+ */
108
+ interface TemplateEntityV1beta3 extends Entity {
109
+ apiVersion: 'scaffolder.backstage.io/v1beta3';
110
+ kind: 'Template';
111
+ spec: {
112
+ type: string;
113
+ parameters?: JsonObject | JsonObject[];
114
+ steps: Array<{
115
+ id?: string;
116
+ name?: string;
117
+ action: string;
118
+ input?: JsonObject;
119
+ if?: string | boolean;
120
+ }>;
121
+ output?: {
122
+ [name: string]: string;
123
+ };
124
+ owner?: string;
125
+ };
126
+ }
127
+ /**
128
+ * Entity data validator for {@link TemplateEntityV1beta3}.
129
+ *
130
+ * @public
131
+ */
132
+ declare const templateEntityV1beta3Validator: KindValidator;
90
133
 
91
- export { TaskSpec, TaskSpecV1beta2, TaskSpecV1beta3, TaskStep, TemplateEntityV1beta3, TemplateMetadata, templateEntityV1beta3Schema };
134
+ export { TaskSpec, TaskSpecV1beta2, TaskSpecV1beta3, TaskStep, TemplateEntityV1beta2, TemplateEntityV1beta3, TemplateMetadata, templateEntityV1beta2Validator, templateEntityV1beta3Validator };
package/dist/index.esm.js CHANGED
@@ -1,3 +1,233 @@
1
+ import { entityKindSchemaValidator } from '@backstage/catalog-model';
2
+
3
+ var $schema$1 = "http://json-schema.org/draft-07/schema";
4
+ var $id$1 = "TemplateV1beta2";
5
+ var description$1 = "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$1 = [
7
+ {
8
+ apiVersion: "backstage.io/v1beta2",
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
+ ],
27
+ properties: {
28
+ name: {
29
+ title: "Name",
30
+ type: "string",
31
+ description: "Unique name of the component"
32
+ },
33
+ description: {
34
+ title: "Description",
35
+ type: "string",
36
+ description: "Description of the component"
37
+ }
38
+ }
39
+ },
40
+ steps: [
41
+ {
42
+ id: "fetch",
43
+ name: "Fetch",
44
+ action: "fetch:plain",
45
+ parameters: {
46
+ url: "./template"
47
+ }
48
+ },
49
+ {
50
+ id: "publish",
51
+ name: "Publish to GitHub",
52
+ action: "publish:github",
53
+ parameters: {
54
+ repoUrl: "{{ parameters.repoUrl }}"
55
+ },
56
+ "if": "{{ parameters.repoUrl }}"
57
+ }
58
+ ],
59
+ output: {
60
+ catalogInfoUrl: "{{ steps.publish.output.catalogInfoUrl }}"
61
+ }
62
+ }
63
+ }
64
+ ];
65
+ var allOf$1 = [
66
+ {
67
+ $ref: "Entity"
68
+ },
69
+ {
70
+ type: "object",
71
+ required: [
72
+ "spec"
73
+ ],
74
+ properties: {
75
+ apiVersion: {
76
+ "enum": [
77
+ "backstage.io/v1beta2"
78
+ ]
79
+ },
80
+ kind: {
81
+ "enum": [
82
+ "Template"
83
+ ]
84
+ },
85
+ spec: {
86
+ type: "object",
87
+ required: [
88
+ "type",
89
+ "steps"
90
+ ],
91
+ properties: {
92
+ type: {
93
+ type: "string",
94
+ 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.",
95
+ examples: [
96
+ "service",
97
+ "website",
98
+ "library"
99
+ ],
100
+ minLength: 1
101
+ },
102
+ parameters: {
103
+ oneOf: [
104
+ {
105
+ type: "object",
106
+ description: "The JSONSchema describing the inputs for the template."
107
+ },
108
+ {
109
+ type: "array",
110
+ description: "A list of separate forms to collect parameters.",
111
+ items: {
112
+ type: "object",
113
+ description: "The JSONSchema describing the inputs for the template."
114
+ }
115
+ }
116
+ ]
117
+ },
118
+ steps: {
119
+ type: "array",
120
+ description: "A list of steps to execute.",
121
+ items: {
122
+ type: "object",
123
+ description: "A description of the step to execute.",
124
+ required: [
125
+ "action"
126
+ ],
127
+ properties: {
128
+ id: {
129
+ type: "string",
130
+ description: "The ID of the step, which can be used to refer to its outputs."
131
+ },
132
+ name: {
133
+ type: "string",
134
+ description: "The name of the step, which will be displayed in the UI during the scaffolding process."
135
+ },
136
+ action: {
137
+ type: "string",
138
+ description: "The name of the action to execute."
139
+ },
140
+ input: {
141
+ type: "object",
142
+ description: "A templated object describing the inputs to the action."
143
+ },
144
+ "if": {
145
+ type: [
146
+ "string",
147
+ "boolean"
148
+ ],
149
+ 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 `[]`."
150
+ }
151
+ }
152
+ }
153
+ },
154
+ output: {
155
+ type: "object",
156
+ description: "A templated object describing the outputs of the scaffolding task.",
157
+ properties: {
158
+ links: {
159
+ type: "array",
160
+ description: "A list of external hyperlinks, typically pointing to resources created or updated by the template",
161
+ items: {
162
+ type: "object",
163
+ required: [
164
+ ],
165
+ properties: {
166
+ url: {
167
+ type: "string",
168
+ description: "A url in a standard uri format.",
169
+ examples: [
170
+ "https://github.com/my-org/my-new-repo"
171
+ ],
172
+ minLength: 1
173
+ },
174
+ entityRef: {
175
+ type: "string",
176
+ description: "An entity reference to an entity in the catalog.",
177
+ examples: [
178
+ "Component:default/my-app"
179
+ ],
180
+ minLength: 1
181
+ },
182
+ title: {
183
+ type: "string",
184
+ description: "A user friendly display name for the link.",
185
+ examples: [
186
+ "View new repo"
187
+ ],
188
+ minLength: 1
189
+ },
190
+ icon: {
191
+ type: "string",
192
+ description: "A key representing a visual icon to be displayed in the UI.",
193
+ examples: [
194
+ "dashboard"
195
+ ],
196
+ minLength: 1
197
+ }
198
+ }
199
+ }
200
+ }
201
+ },
202
+ additionalProperties: {
203
+ type: "string"
204
+ }
205
+ },
206
+ owner: {
207
+ type: "string",
208
+ description: "The user (or group) owner of the template",
209
+ minLength: 1
210
+ }
211
+ }
212
+ }
213
+ }
214
+ }
215
+ ];
216
+ var schema$1 = {
217
+ $schema: $schema$1,
218
+ $id: $id$1,
219
+ description: description$1,
220
+ examples: examples$1,
221
+ allOf: allOf$1
222
+ };
223
+
224
+ const validator$1 = entityKindSchemaValidator(schema$1);
225
+ const templateEntityV1beta2Validator = {
226
+ async check(data) {
227
+ return validator$1(data) === data;
228
+ }
229
+ };
230
+
1
231
  var $schema = "http://json-schema.org/draft-07/schema";
2
232
  var $id = "TemplateV1beta3";
3
233
  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.";
@@ -216,7 +446,7 @@ var allOf = [
216
446
  }
217
447
  }
218
448
  ];
219
- var v1beta3Schema = {
449
+ var schema = {
220
450
  $schema: $schema,
221
451
  $id: $id,
222
452
  description: description,
@@ -224,7 +454,12 @@ var v1beta3Schema = {
224
454
  allOf: allOf
225
455
  };
226
456
 
227
- const templateEntityV1beta3Schema = v1beta3Schema;
457
+ const validator = entityKindSchemaValidator(schema);
458
+ const templateEntityV1beta3Validator = {
459
+ async check(data) {
460
+ return validator(data) === data;
461
+ }
462
+ };
228
463
 
229
- export { templateEntityV1beta3Schema };
464
+ export { templateEntityV1beta2Validator, templateEntityV1beta3Validator };
230
465
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/index.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\n/**\n * Common functionalities for the scaffolder, to be shared between scaffolder and scaffolder-backend plugin\n *\n * @packageDocumentation\n */\n\nimport { JSONSchema } from '@backstage/catalog-model';\nimport v1beta3Schema from './Template.v1beta3.schema.json';\n\nexport type { TemplateEntityV1beta3 } from './TemplateEntityV1beta3';\n\n/** @public */\nexport const templateEntityV1beta3Schema: JSONSchema = v1beta3Schema as Omit<\n JSONSchema,\n 'examples'\n>;\n\nexport * from './TaskSpec';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA4Ba,8BAA0C;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/TemplateEntityV1beta2.ts","../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.v1beta2.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 * @deprecated Please convert your templates to TemplateEntityV1beta3 on\n * apiVersion scaffolder.backstage.io/v1beta3\n */\nexport interface TemplateEntityV1beta2 extends Entity {\n apiVersion: 'backstage.io/v1beta2';\n kind: 'Template';\n spec: {\n type: string;\n parameters?: JsonObject | JsonObject[];\n steps: Array<{\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n }>;\n output?: { [name: string]: string };\n owner?: string;\n };\n}\n\nconst validator = entityKindSchemaValidator(schema);\n\n/**\n * Entity data validator for {@link TemplateEntityV1beta2}.\n *\n * @public\n * @deprecated Please convert your templates to TemplateEntityV1beta3 on\n * apiVersion scaffolder.backstage.io/v1beta3\n */\nexport const templateEntityV1beta2Validator: 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 * 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 apiVersion: 'scaffolder.backstage.io/v1beta3';\n kind: 'Template';\n spec: {\n type: string;\n parameters?: JsonObject | JsonObject[];\n steps: Array<{\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n }>;\n output?: { [name: string]: string };\n owner?: string;\n };\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"],"names":["validator","schema"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAMA,cAAY,0BAA0BC;MAS/B,iCAAgD;AAAA,QAErD,MAAM,MAAc;AACxB,WAAOD,YAAU,UAAU;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACd/B,MAAM,YAAY,0BAA0B;MAO/B,iCAAgD;AAAA,QAErD,MAAM,MAAc;AACxB,WAAO,UAAU,UAAU;AAAA;AAAA;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-common",
3
3
  "description": "Common functionalities for the scaffolder, to be shared between scaffolder and scaffolder-backend plugin",
4
- "version": "0.1.2",
4
+ "version": "0.2.1",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -12,6 +12,9 @@
12
12
  "module": "dist/index.esm.js",
13
13
  "types": "dist/index.d.ts"
14
14
  },
15
+ "backstage": {
16
+ "role": "common-library"
17
+ },
15
18
  "homepage": "https://backstage.io",
16
19
  "repository": {
17
20
  "type": "git",
@@ -25,23 +28,23 @@
25
28
  "dist"
26
29
  ],
27
30
  "scripts": {
28
- "build": "backstage-cli build",
29
- "lint": "backstage-cli lint",
30
- "test": "backstage-cli test",
31
- "prepack": "backstage-cli prepack",
32
- "postpack": "backstage-cli postpack",
33
- "clean": "backstage-cli clean"
31
+ "build": "backstage-cli package build",
32
+ "lint": "backstage-cli package lint",
33
+ "test": "backstage-cli package test",
34
+ "prepack": "backstage-cli package prepack",
35
+ "postpack": "backstage-cli package postpack",
36
+ "clean": "backstage-cli package clean"
34
37
  },
35
38
  "bugs": {
36
39
  "url": "https://github.com/backstage/backstage/issues"
37
40
  },
38
41
  "dependencies": {
39
- "@backstage/catalog-model": "^0.9.7",
40
- "@backstage/types": "^0.1.1"
42
+ "@backstage/catalog-model": "^0.10.1",
43
+ "@backstage/types": "^0.1.3"
41
44
  },
42
45
  "devDependencies": {
43
- "@backstage/cli": "^0.10.4"
46
+ "@backstage/cli": "^0.14.0"
44
47
  },
45
- "gitHead": "4b2a8ed96ff427735c872a72c1864321ef698436",
48
+ "gitHead": "e244b348c473700e7d5e5fbcef38bd9f9fd1d0ba",
46
49
  "module": "dist/index.esm.js"
47
50
  }