@backstage/plugin-scaffolder-common 1.2.7-next.0 → 1.2.7-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @backstage/plugin-scaffolder-common
2
2
 
3
+ ## 1.2.7-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/catalog-model@1.3.0-next.0
9
+ - @backstage/types@1.0.2
10
+ - @backstage/plugin-permission-common@0.7.5-next.0
11
+
12
+ ## 1.2.7-next.1
13
+
14
+ ### Patch Changes
15
+
16
+ - 65e989f4018: Added permissions for authorizing parameters and steps
17
+ - 65e989f4018: Define optional `backstage:permissions` property to parameters and steps used to authorize part of the template using the permission framework
18
+ - Updated dependencies
19
+ - @backstage/plugin-permission-common@0.7.5-next.0
20
+ - @backstage/catalog-model@1.2.1
21
+ - @backstage/types@1.0.2
22
+
3
23
  ## 1.2.7-next.0
4
24
 
5
25
  ### Patch Changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@backstage/plugin-scaffolder-common",
3
+ "version": "1.2.7-next.2",
4
+ "main": "../dist/alpha.cjs.js",
5
+ "module": "../dist/alpha.esm.js",
6
+ "types": "../dist/alpha.d.ts"
7
+ }
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var pluginPermissionCommon = require('@backstage/plugin-permission-common');
6
+
7
+ const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = "scaffolder-template";
8
+ const templateParameterReadPermission = pluginPermissionCommon.createPermission({
9
+ name: "scaffolder.template.parameter.read",
10
+ attributes: {
11
+ action: "read"
12
+ },
13
+ resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE
14
+ });
15
+ const templateStepReadPermission = pluginPermissionCommon.createPermission({
16
+ name: "scaffolder.template.step.read",
17
+ attributes: {
18
+ action: "read"
19
+ },
20
+ resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE
21
+ });
22
+ const scaffolderPermissions = [
23
+ templateParameterReadPermission,
24
+ templateStepReadPermission
25
+ ];
26
+
27
+ exports.RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = RESOURCE_TYPE_SCAFFOLDER_TEMPLATE;
28
+ exports.scaffolderPermissions = scaffolderPermissions;
29
+ exports.templateParameterReadPermission = templateParameterReadPermission;
30
+ exports.templateStepReadPermission = templateStepReadPermission;
31
+ //# sourceMappingURL=alpha.cjs.js.map
@@ -0,0 +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 * 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 templateParameterReadPermission,\n templateStepReadPermission,\n];\n"],"names":["createPermission"],"mappings":";;;;;;AAuBO,MAAM,iCAAoC,GAAA,sBAAA;AAY1C,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,+BAAA;AAAA,EACA,0BAAA;AACF;;;;;;;"}
@@ -0,0 +1,37 @@
1
+ import * as _backstage_plugin_permission_common from '@backstage/plugin-permission-common';
2
+
3
+ /**
4
+ * Permission resource type which corresponds to a scaffolder templates.
5
+ *
6
+ * @alpha
7
+ */
8
+ declare const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = "scaffolder-template";
9
+ /**
10
+ * This permission is used to authorize actions that involve reading
11
+ * one or more parameters from a template.
12
+ *
13
+ * If this permission is not authorized, it will appear that the
14
+ * parameter does not exist in the template — both in the frontend
15
+ * and in API responses.
16
+ *
17
+ * @alpha
18
+ */
19
+ declare const templateParameterReadPermission: _backstage_plugin_permission_common.ResourcePermission<"scaffolder-template">;
20
+ /**
21
+ * This permission is used to authorize actions that involve reading
22
+ * one or more steps from a template.
23
+ *
24
+ * If this permission is not authorized, it will appear that the
25
+ * step does not exist in the template — both in the frontend
26
+ * and in API responses. Steps will also not be executed.
27
+ *
28
+ * @alpha
29
+ */
30
+ declare const templateStepReadPermission: _backstage_plugin_permission_common.ResourcePermission<"scaffolder-template">;
31
+ /**
32
+ * List of all the scaffolder permissions
33
+ * @alpha
34
+ */
35
+ declare const scaffolderPermissions: _backstage_plugin_permission_common.ResourcePermission<"scaffolder-template">[];
36
+
37
+ export { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE, scaffolderPermissions, templateParameterReadPermission, templateStepReadPermission };
@@ -0,0 +1,24 @@
1
+ import { createPermission } from '@backstage/plugin-permission-common';
2
+
3
+ const RESOURCE_TYPE_SCAFFOLDER_TEMPLATE = "scaffolder-template";
4
+ const templateParameterReadPermission = createPermission({
5
+ name: "scaffolder.template.parameter.read",
6
+ attributes: {
7
+ action: "read"
8
+ },
9
+ resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE
10
+ });
11
+ const templateStepReadPermission = createPermission({
12
+ name: "scaffolder.template.step.read",
13
+ attributes: {
14
+ action: "read"
15
+ },
16
+ resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE
17
+ });
18
+ const scaffolderPermissions = [
19
+ templateParameterReadPermission,
20
+ templateStepReadPermission
21
+ ];
22
+
23
+ export { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE, scaffolderPermissions, templateParameterReadPermission, templateStepReadPermission };
24
+ //# sourceMappingURL=alpha.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alpha.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 * 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 templateParameterReadPermission,\n templateStepReadPermission,\n];\n"],"names":[],"mappings":";;AAuBO,MAAM,iCAAoC,GAAA,sBAAA;AAY1C,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,+BAAA;AAAA,EACA,0BAAA;AACF;;;;"}
package/dist/index.cjs.js CHANGED
@@ -28,6 +28,12 @@ var examples = [
28
28
  "description",
29
29
  "repoUrl"
30
30
  ],
31
+ "backstage:permissions": {
32
+ tags: [
33
+ "one",
34
+ "two"
35
+ ]
36
+ },
31
37
  properties: {
32
38
  name: {
33
39
  title: "Name",
@@ -53,6 +59,12 @@ var examples = [
53
59
  action: "fetch:plain",
54
60
  parameters: {
55
61
  url: "./template"
62
+ },
63
+ "backstage:permissions": {
64
+ tags: [
65
+ "one",
66
+ "two"
67
+ ]
56
68
  }
57
69
  },
58
70
  {
@@ -117,14 +129,42 @@ var allOf = [
117
129
  oneOf: [
118
130
  {
119
131
  type: "object",
120
- description: "The JSONSchema describing the inputs for the template."
132
+ description: "The JSONSchema describing the inputs for the template.",
133
+ properties: {
134
+ "backstage:permissions": {
135
+ type: "object",
136
+ description: "Object used for authorizing the parameter",
137
+ properties: {
138
+ tags: {
139
+ type: "array",
140
+ items: {
141
+ type: "string"
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
121
147
  },
122
148
  {
123
149
  type: "array",
124
150
  description: "A list of separate forms to collect parameters.",
125
151
  items: {
126
152
  type: "object",
127
- description: "The JSONSchema describing the inputs for the template."
153
+ description: "The JSONSchema describing the inputs for the template.",
154
+ properties: {
155
+ "backstage:permissions": {
156
+ type: "object",
157
+ description: "Object used for authorizing the parameter",
158
+ properties: {
159
+ tags: {
160
+ type: "array",
161
+ items: {
162
+ type: "string"
163
+ }
164
+ }
165
+ }
166
+ }
167
+ }
128
168
  }
129
169
  }
130
170
  ]
@@ -161,6 +201,18 @@ var allOf = [
161
201
  "boolean"
162
202
  ],
163
203
  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 `[]`."
204
+ },
205
+ "backstage:permissions": {
206
+ type: "object",
207
+ description: "Object used for authorizing the step",
208
+ properties: {
209
+ tags: {
210
+ type: "array",
211
+ items: {
212
+ type: "string"
213
+ }
214
+ }
215
+ }
164
216
  }
165
217
  }
166
218
  }
@@ -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 * 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?: JsonObject | JsonObject[];\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<{\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n }>;\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\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,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;;;;;"}
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 * 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 * 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA,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
@@ -7,7 +7,7 @@ import { JsonObject, JsonValue } from '@backstage/types';
7
7
  *
8
8
  * @public
9
9
  */
10
- declare type TemplateInfo = {
10
+ type TemplateInfo = {
11
11
  /**
12
12
  * The entityRef of the template
13
13
  */
@@ -104,7 +104,7 @@ interface TaskSpecV1beta3 {
104
104
  *
105
105
  * @public
106
106
  */
107
- declare type TaskSpec = TaskSpecV1beta3;
107
+ type TaskSpec = TaskSpecV1beta3;
108
108
 
109
109
  /**
110
110
  * Backstage catalog Template kind Entity. Templates are used by the Scaffolder
@@ -134,18 +134,12 @@ interface TemplateEntityV1beta3 extends Entity {
134
134
  * to collect user input and validate it against that schema. This can then be used in the `steps` part below to template
135
135
  * variables passed from the user into each action in the template.
136
136
  */
137
- parameters?: JsonObject | JsonObject[];
137
+ parameters?: TemplateParametersV1beta3 | TemplateParametersV1beta3[];
138
138
  /**
139
139
  * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying
140
140
  * javascript action and some optional input parameters that may or may not have been collected from the end user.
141
141
  */
142
- steps: Array<{
143
- id?: string;
144
- name?: string;
145
- action: string;
146
- input?: JsonObject;
147
- if?: string | boolean;
148
- }>;
142
+ steps: Array<TemplateEntityStepV1beta3>;
149
143
  /**
150
144
  * The output is an object where template authors can pull out information from template actions and return them in a known standard way.
151
145
  */
@@ -158,6 +152,35 @@ interface TemplateEntityV1beta3 extends Entity {
158
152
  owner?: string;
159
153
  };
160
154
  }
155
+ /**
156
+ * Step that is part of a Template Entity.
157
+ *
158
+ * @public
159
+ */
160
+ interface TemplateEntityStepV1beta3 extends JsonObject {
161
+ id?: string;
162
+ name?: string;
163
+ action: string;
164
+ input?: JsonObject;
165
+ if?: string | boolean;
166
+ 'backstage:permissions'?: TemplatePermissionsV1beta3;
167
+ }
168
+ /**
169
+ * Parameter that is part of a Template Entity.
170
+ *
171
+ * @public
172
+ */
173
+ interface TemplateParametersV1beta3 extends JsonObject {
174
+ 'backstage:permissions'?: TemplatePermissionsV1beta3;
175
+ }
176
+ /**
177
+ * Access control properties for parts of a template.
178
+ *
179
+ * @public
180
+ */
181
+ interface TemplatePermissionsV1beta3 extends JsonObject {
182
+ tags?: string[];
183
+ }
161
184
  /**
162
185
  * Entity data validator for {@link TemplateEntityV1beta3}.
163
186
  *
@@ -170,4 +193,4 @@ declare const templateEntityV1beta3Validator: KindValidator;
170
193
  */
171
194
  declare const isTemplateEntityV1beta3: (entity: Entity) => entity is TemplateEntityV1beta3;
172
195
 
173
- export { TaskSpec, TaskSpecV1beta3, TaskStep, TemplateEntityV1beta3, TemplateInfo, isTemplateEntityV1beta3, templateEntityV1beta3Validator };
196
+ export { TaskSpec, TaskSpecV1beta3, TaskStep, TemplateEntityStepV1beta3, TemplateEntityV1beta3, TemplateInfo, TemplateParametersV1beta3, TemplatePermissionsV1beta3, isTemplateEntityV1beta3, templateEntityV1beta3Validator };
package/dist/index.esm.js CHANGED
@@ -24,6 +24,12 @@ var examples = [
24
24
  "description",
25
25
  "repoUrl"
26
26
  ],
27
+ "backstage:permissions": {
28
+ tags: [
29
+ "one",
30
+ "two"
31
+ ]
32
+ },
27
33
  properties: {
28
34
  name: {
29
35
  title: "Name",
@@ -49,6 +55,12 @@ var examples = [
49
55
  action: "fetch:plain",
50
56
  parameters: {
51
57
  url: "./template"
58
+ },
59
+ "backstage:permissions": {
60
+ tags: [
61
+ "one",
62
+ "two"
63
+ ]
52
64
  }
53
65
  },
54
66
  {
@@ -113,14 +125,42 @@ var allOf = [
113
125
  oneOf: [
114
126
  {
115
127
  type: "object",
116
- description: "The JSONSchema describing the inputs for the template."
128
+ description: "The JSONSchema describing the inputs for the template.",
129
+ properties: {
130
+ "backstage:permissions": {
131
+ type: "object",
132
+ description: "Object used for authorizing the parameter",
133
+ properties: {
134
+ tags: {
135
+ type: "array",
136
+ items: {
137
+ type: "string"
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
117
143
  },
118
144
  {
119
145
  type: "array",
120
146
  description: "A list of separate forms to collect parameters.",
121
147
  items: {
122
148
  type: "object",
123
- description: "The JSONSchema describing the inputs for the template."
149
+ description: "The JSONSchema describing the inputs for the template.",
150
+ properties: {
151
+ "backstage:permissions": {
152
+ type: "object",
153
+ description: "Object used for authorizing the parameter",
154
+ properties: {
155
+ tags: {
156
+ type: "array",
157
+ items: {
158
+ type: "string"
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
124
164
  }
125
165
  }
126
166
  ]
@@ -157,6 +197,18 @@ var allOf = [
157
197
  "boolean"
158
198
  ],
159
199
  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 `[]`."
200
+ },
201
+ "backstage:permissions": {
202
+ type: "object",
203
+ description: "Object used for authorizing the step",
204
+ properties: {
205
+ tags: {
206
+ type: "array",
207
+ items: {
208
+ type: "string"
209
+ }
210
+ }
211
+ }
160
212
  }
161
213
  }
162
214
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.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 * 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?: JsonObject | JsonObject[];\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<{\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n }>;\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\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,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;;;;"}
1
+ {"version":3,"file":"index.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 * 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 * 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA,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/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": "1.2.7-next.0",
4
+ "version": "1.2.7-next.2",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -11,6 +11,21 @@
11
11
  "module": "dist/index.esm.js",
12
12
  "types": "dist/index.d.ts"
13
13
  },
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/index.esm.js",
17
+ "require": "./dist/index.cjs.js",
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.cjs.js"
20
+ },
21
+ "./alpha": {
22
+ "import": "./dist/alpha.esm.js",
23
+ "require": "./dist/alpha.cjs.js",
24
+ "types": "./dist/alpha.d.ts",
25
+ "default": "./dist/alpha.cjs.js"
26
+ },
27
+ "./package.json": "./package.json"
28
+ },
14
29
  "backstage": {
15
30
  "role": "common-library"
16
31
  },
@@ -24,7 +39,8 @@
24
39
  "scaffolder"
25
40
  ],
26
41
  "files": [
27
- "dist"
42
+ "dist",
43
+ "alpha"
28
44
  ],
29
45
  "scripts": {
30
46
  "build": "backstage-cli package build",
@@ -38,11 +54,12 @@
38
54
  "url": "https://github.com/backstage/backstage/issues"
39
55
  },
40
56
  "dependencies": {
41
- "@backstage/catalog-model": "^1.2.1",
57
+ "@backstage/catalog-model": "^1.3.0-next.0",
58
+ "@backstage/plugin-permission-common": "^0.7.5-next.0",
42
59
  "@backstage/types": "^1.0.2"
43
60
  },
44
61
  "devDependencies": {
45
- "@backstage/cli": "^0.22.6-next.0"
62
+ "@backstage/cli": "^0.22.6-next.3"
46
63
  },
47
64
  "module": "dist/index.esm.js"
48
65
  }