@backstage/plugin-scaffolder-common 1.6.0 → 1.7.0-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.
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateEntityV1beta3.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 * Form hooks to be run\n */\n EXPERIMENTAL_formDecorators?: { id: string; input?: JsonObject }[];\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 * Specifies the lifecycle phase of the TemplateEntity\n */\n lifecycle?: 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","schema"],"mappings":";;;;;AAkKA,MAAM,SAAA,GAAYA,uCAA0BC,+BAAM,CAAA;AAO3C,MAAM,8BAAgD,GAAA;AAAA;AAAA,EAE3D,MAAM,MAAM,IAAc,EAAA;AACxB,IAAO,OAAA,SAAA,CAAU,IAAI,CAAM,KAAA,IAAA;AAAA;AAE/B;AAMO,MAAM,0BAA0B,CACrC,MAAA,KAEA,OAAO,UAAe,KAAA,iCAAA,IACtB,OAAO,IAAS,KAAA;;;;;"}
1
+ {"version":3,"file":"TemplateEntityV1beta3.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 * Form hooks to be run\n */\n EXPERIMENTAL_formDecorators?: { id: string; input?: JsonObject }[];\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 * Specifies the lifecycle phase of the TemplateEntity\n */\n lifecycle?: 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 * The shape of each entry of parameters which gets rendered\n * as a separate step in the wizard input\n *\n * @public\n */\nexport type TemplateParameterSchema = {\n title: string;\n description?: string;\n presentation?: TemplatePresentationV1beta3;\n steps: Array<{\n title: string;\n description?: string;\n schema: JsonObject;\n }>;\n EXPERIMENTAL_formDecorators?: { id: string; input?: JsonObject }[];\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","schema"],"mappings":";;;;;AAoLA,MAAM,SAAA,GAAYA,uCAA0BC,+BAAM,CAAA;AAO3C,MAAM,8BAAgD,GAAA;AAAA;AAAA,EAE3D,MAAM,MAAM,IAAc,EAAA;AACxB,IAAO,OAAA,SAAA,CAAU,IAAI,CAAM,KAAA,IAAA;AAAA;AAE/B;AAMO,MAAM,0BAA0B,CACrC,MAAA,KAEA,OAAO,UAAe,KAAA,iCAAA,IACtB,OAAO,IAAS,KAAA;;;;;"}
@@ -1 +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 * Form hooks to be run\n */\n EXPERIMENTAL_formDecorators?: { id: string; input?: JsonObject }[];\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 * Specifies the lifecycle phase of the TemplateEntity\n */\n lifecycle?: 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":";;;AAkKA,MAAM,SAAA,GAAY,0BAA0B,MAAM,CAAA;AAO3C,MAAM,8BAAgD,GAAA;AAAA;AAAA,EAE3D,MAAM,MAAM,IAAc,EAAA;AACxB,IAAO,OAAA,SAAA,CAAU,IAAI,CAAM,KAAA,IAAA;AAAA;AAE/B;AAMO,MAAM,0BAA0B,CACrC,MAAA,KAEA,OAAO,UAAe,KAAA,iCAAA,IACtB,OAAO,IAAS,KAAA;;;;"}
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 * Form hooks to be run\n */\n EXPERIMENTAL_formDecorators?: { id: string; input?: JsonObject }[];\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 * Specifies the lifecycle phase of the TemplateEntity\n */\n lifecycle?: 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 * The shape of each entry of parameters which gets rendered\n * as a separate step in the wizard input\n *\n * @public\n */\nexport type TemplateParameterSchema = {\n title: string;\n description?: string;\n presentation?: TemplatePresentationV1beta3;\n steps: Array<{\n title: string;\n description?: string;\n schema: JsonObject;\n }>;\n EXPERIMENTAL_formDecorators?: { id: string; input?: JsonObject }[];\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":";;;AAoLA,MAAM,SAAA,GAAY,0BAA0B,MAAM,CAAA;AAO3C,MAAM,8BAAgD,GAAA;AAAA;AAAA,EAE3D,MAAM,MAAM,IAAc,EAAA;AACxB,IAAO,OAAA,SAAA,CAAU,IAAI,CAAM,KAAA,IAAA;AAAA;AAE/B;AAMO,MAAM,0BAA0B,CACrC,MAAA,KAEA,OAAO,UAAe,KAAA,iCAAA,IACtB,OAAO,IAAS,KAAA;;;;"}
package/dist/index.cjs.js CHANGED
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var TemplateEntityV1beta3 = require('./TemplateEntityV1beta3.cjs.js');
4
+ var ScaffolderClient = require('./ScaffolderClient.cjs.js');
4
5
 
5
6
 
6
7
 
7
8
  exports.isTemplateEntityV1beta3 = TemplateEntityV1beta3.isTemplateEntityV1beta3;
8
9
  exports.templateEntityV1beta3Validator = TemplateEntityV1beta3.templateEntityV1beta3Validator;
10
+ exports.ScaffolderClient = ScaffolderClient.ScaffolderClient;
9
11
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { EntityMeta, UserEntity, Entity, KindValidator } from '@backstage/catalog-model';
2
- import { JsonObject, JsonArray, JsonValue } from '@backstage/types';
2
+ import { JsonObject, JsonArray, JsonValue, Observable } from '@backstage/types';
3
+ import { ScmIntegrationRegistry } from '@backstage/integration';
4
+ import { JSONSchema7 } from 'json-schema';
3
5
 
4
6
  /**
5
7
  * Information about a template that is stored on a task specification.
@@ -253,6 +255,26 @@ interface TemplateEntityStepV1beta3 extends JsonObject {
253
255
  if?: string | boolean;
254
256
  'backstage:permissions'?: TemplatePermissionsV1beta3;
255
257
  }
258
+ /**
259
+ * The shape of each entry of parameters which gets rendered
260
+ * as a separate step in the wizard input
261
+ *
262
+ * @public
263
+ */
264
+ type TemplateParameterSchema = {
265
+ title: string;
266
+ description?: string;
267
+ presentation?: TemplatePresentationV1beta3;
268
+ steps: Array<{
269
+ title: string;
270
+ description?: string;
271
+ schema: JsonObject;
272
+ }>;
273
+ EXPERIMENTAL_formDecorators?: {
274
+ id: string;
275
+ input?: JsonObject;
276
+ }[];
277
+ };
256
278
  /**
257
279
  * Parameter that is part of a Template Entity.
258
280
  *
@@ -281,4 +303,381 @@ declare const templateEntityV1beta3Validator: KindValidator;
281
303
  */
282
304
  declare const isTemplateEntityV1beta3: (entity: Entity) => entity is TemplateEntityV1beta3;
283
305
 
284
- 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 };
306
+ /**
307
+ * @public
308
+ */
309
+ type TaskStatus = 'cancelled' | 'completed' | 'failed' | 'open' | 'processing' | 'skipped';
310
+
311
+ /**
312
+ * @public
313
+ */
314
+ type TaskEventType = 'cancelled' | 'completion' | 'log' | 'recovered';
315
+
316
+ /**
317
+ * Options you can pass into a Scaffolder request for additional information.
318
+ *
319
+ * @public
320
+ */
321
+ interface ScaffolderRequestOptions {
322
+ token?: string;
323
+ }
324
+ /**
325
+ * The shape of each task returned from the `scaffolder-backend`
326
+ *
327
+ * @public
328
+ */
329
+ type ScaffolderTask = {
330
+ id: string;
331
+ spec: TaskSpec;
332
+ status: TaskStatus;
333
+ lastHeartbeatAt?: string;
334
+ createdAt: string;
335
+ };
336
+ /**
337
+ * A single scaffolder usage example
338
+ *
339
+ * @public
340
+ */
341
+ type ScaffolderUsageExample = {
342
+ description?: string;
343
+ example: string;
344
+ notes?: string;
345
+ };
346
+ /**
347
+ * The response shape for a single action in the `listActions` call to the `scaffolder-backend`
348
+ *
349
+ * @public
350
+ */
351
+ type Action = {
352
+ id: string;
353
+ description?: string;
354
+ schema?: {
355
+ input?: JSONSchema7;
356
+ output?: JSONSchema7;
357
+ };
358
+ examples?: ScaffolderUsageExample[];
359
+ };
360
+ /**
361
+ * The response shape for the `listActions` call to the `scaffolder-backend`
362
+ *
363
+ * @public
364
+ */
365
+ type ListActionsResponse = Array<Action>;
366
+ /**
367
+ * The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend`
368
+ *
369
+ * @public
370
+ */
371
+ type TemplateFilter = {
372
+ description?: string;
373
+ schema?: {
374
+ input?: JSONSchema7;
375
+ arguments?: JSONSchema7[];
376
+ output?: JSONSchema7;
377
+ };
378
+ examples?: ScaffolderUsageExample[];
379
+ };
380
+ /**
381
+ * The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend`
382
+ *
383
+ * @public
384
+ */
385
+ type TemplateGlobalFunction = {
386
+ description?: string;
387
+ schema?: {
388
+ arguments?: JSONSchema7[];
389
+ output?: JSONSchema7;
390
+ };
391
+ examples?: ScaffolderUsageExample[];
392
+ };
393
+ /**
394
+ * The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend`
395
+ *
396
+ * @public
397
+ */
398
+ type TemplateGlobalValue = {
399
+ description?: string;
400
+ value: JsonValue;
401
+ };
402
+ /**
403
+ * The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend`
404
+ *
405
+ * @public
406
+ */
407
+ type ListTemplatingExtensionsResponse = {
408
+ filters: Record<string, TemplateFilter>;
409
+ globals: {
410
+ functions: Record<string, TemplateGlobalFunction>;
411
+ values: Record<string, TemplateGlobalValue>;
412
+ };
413
+ };
414
+ /** @public */
415
+ type ScaffolderOutputLink = {
416
+ title?: string;
417
+ icon?: string;
418
+ url?: string;
419
+ entityRef?: string;
420
+ };
421
+ /** @public */
422
+ type ScaffolderOutputText = {
423
+ title?: string;
424
+ icon?: string;
425
+ content?: string;
426
+ default?: boolean;
427
+ };
428
+ /** @public */
429
+ type ScaffolderTaskOutput = {
430
+ links?: ScaffolderOutputLink[];
431
+ text?: ScaffolderOutputText[];
432
+ } & {
433
+ [key: string]: unknown;
434
+ };
435
+ /**
436
+ * The shape of a `LogEvent` message from the `scaffolder-backend`
437
+ *
438
+ * @public
439
+ */
440
+ type LogEvent = {
441
+ type: TaskEventType;
442
+ body: {
443
+ message: string;
444
+ stepId?: string;
445
+ status?: TaskStatus;
446
+ };
447
+ createdAt: string;
448
+ id: number;
449
+ taskId: string;
450
+ };
451
+ /**
452
+ * The input options to the `scaffold` method of the `ScaffolderClient`.
453
+ *
454
+ * @public
455
+ */
456
+ interface ScaffolderScaffoldOptions {
457
+ templateRef: string;
458
+ values: Record<string, JsonValue>;
459
+ secrets?: Record<string, string>;
460
+ }
461
+ /**
462
+ * The response shape of the `scaffold` method of the `ScaffolderClient`.
463
+ *
464
+ * @public
465
+ */
466
+ interface ScaffolderScaffoldResponse {
467
+ taskId: string;
468
+ }
469
+ /**
470
+ * The arguments for `getIntegrationsList`.
471
+ *
472
+ * @public
473
+ */
474
+ interface ScaffolderGetIntegrationsListOptions {
475
+ allowedHosts: string[];
476
+ }
477
+ /**
478
+ * The response shape for `getIntegrationsList`.
479
+ *
480
+ * @public
481
+ */
482
+ interface ScaffolderGetIntegrationsListResponse {
483
+ integrations: {
484
+ type: string;
485
+ title: string;
486
+ host: string;
487
+ }[];
488
+ }
489
+ /**
490
+ * The input options to the `streamLogs` method of the `ScaffolderClient`.
491
+ *
492
+ * @public
493
+ */
494
+ interface ScaffolderStreamLogsOptions {
495
+ isTaskRecoverable?: boolean;
496
+ taskId: string;
497
+ after?: number;
498
+ }
499
+ /** @public */
500
+ interface ScaffolderDryRunOptions {
501
+ template: TemplateEntityV1beta3;
502
+ values: JsonObject;
503
+ secrets?: Record<string, string>;
504
+ directoryContents: {
505
+ path: string;
506
+ base64Content: string;
507
+ }[];
508
+ }
509
+ /** @public */
510
+ interface ScaffolderDryRunResponse {
511
+ directoryContents: Array<{
512
+ path: string;
513
+ base64Content: string;
514
+ executable?: boolean;
515
+ }>;
516
+ log: Array<Pick<LogEvent, 'body'>>;
517
+ steps: TaskStep[];
518
+ output: ScaffolderTaskOutput;
519
+ }
520
+ /**
521
+ * An API to interact with the scaffolder backend.
522
+ *
523
+ * @public
524
+ */
525
+ interface ScaffolderApi {
526
+ getTemplateParameterSchema(templateRef: string, options?: ScaffolderRequestOptions): Promise<TemplateParameterSchema>;
527
+ /**
528
+ * Executes the scaffolding of a component, given a template and its
529
+ * parameter values.
530
+ *
531
+ * @param options - The {@link ScaffolderScaffoldOptions} the scaffolding.
532
+ */
533
+ scaffold(request: ScaffolderScaffoldOptions, options?: ScaffolderRequestOptions): Promise<ScaffolderScaffoldResponse>;
534
+ getTask(taskId: string, options?: ScaffolderRequestOptions): Promise<ScaffolderTask>;
535
+ /**
536
+ * Sends a signal to a task broker to cancel the running task by taskId.
537
+ *
538
+ * @param taskId - the id of the task
539
+ */
540
+ cancelTask(taskId: string, options?: ScaffolderRequestOptions): Promise<{
541
+ status?: TaskStatus;
542
+ }>;
543
+ /**
544
+ * Starts the task again from the point where it failed.
545
+ *
546
+ * @param taskId - the id of the task
547
+ */
548
+ retry?(taskId: string, options?: ScaffolderRequestOptions): Promise<{
549
+ id: string;
550
+ }>;
551
+ listTasks?(request: {
552
+ filterByOwnership: 'owned' | 'all';
553
+ limit?: number;
554
+ offset?: number;
555
+ }, options?: ScaffolderRequestOptions): Promise<{
556
+ tasks: ScaffolderTask[];
557
+ totalTasks?: number;
558
+ }>;
559
+ getIntegrationsList(options: ScaffolderGetIntegrationsListOptions): Promise<ScaffolderGetIntegrationsListResponse>;
560
+ /**
561
+ * Returns a list of all installed actions.
562
+ */
563
+ listActions(options?: ScaffolderRequestOptions): Promise<ListActionsResponse>;
564
+ /**
565
+ * Returns a structure describing the available templating extensions.
566
+ */
567
+ listTemplatingExtensions?(options?: ScaffolderRequestOptions): Promise<ListTemplatingExtensionsResponse>;
568
+ streamLogs(request: ScaffolderStreamLogsOptions, options?: ScaffolderRequestOptions): Observable<LogEvent>;
569
+ dryRun?(request: ScaffolderDryRunOptions, options?: ScaffolderRequestOptions): Promise<ScaffolderDryRunResponse>;
570
+ autocomplete?(request: {
571
+ token: string;
572
+ provider: string;
573
+ resource: string;
574
+ context: Record<string, string>;
575
+ }, options?: ScaffolderRequestOptions): Promise<{
576
+ results: {
577
+ title?: string;
578
+ id: string;
579
+ }[];
580
+ }>;
581
+ }
582
+
583
+ /**
584
+ * An API to interact with the scaffolder backend.
585
+ *
586
+ * @public
587
+ */
588
+ declare class ScaffolderClient implements ScaffolderApi {
589
+ private readonly apiClient;
590
+ private readonly discoveryApi;
591
+ private readonly scmIntegrationsApi;
592
+ private readonly fetchApi;
593
+ private readonly identityApi?;
594
+ private readonly useLongPollingLogs;
595
+ constructor(options: {
596
+ discoveryApi: {
597
+ getBaseUrl(pluginId: string): Promise<string>;
598
+ };
599
+ fetchApi: {
600
+ fetch: typeof fetch;
601
+ };
602
+ identityApi?: {
603
+ getBackstageIdentity(): Promise<{
604
+ type: 'user';
605
+ userEntityRef: string;
606
+ ownershipEntityRefs: string[];
607
+ }>;
608
+ };
609
+ scmIntegrationsApi: ScmIntegrationRegistry;
610
+ useLongPollingLogs?: boolean;
611
+ });
612
+ /**
613
+ * {@inheritdoc ScaffolderApi.listTasks}
614
+ */
615
+ listTasks(request: {
616
+ filterByOwnership: 'owned' | 'all';
617
+ limit?: number;
618
+ offset?: number;
619
+ }, options?: ScaffolderRequestOptions): Promise<{
620
+ tasks: ScaffolderTask[];
621
+ totalTasks?: number;
622
+ }>;
623
+ getIntegrationsList(options: ScaffolderGetIntegrationsListOptions): Promise<ScaffolderGetIntegrationsListResponse>;
624
+ /**
625
+ * {@inheritdoc ScaffolderApi.getTemplateParameterSchema}
626
+ */
627
+ getTemplateParameterSchema(templateRef: string, options?: ScaffolderRequestOptions): Promise<TemplateParameterSchema>;
628
+ /**
629
+ * {@inheritdoc ScaffolderApi.scaffold}
630
+ */
631
+ scaffold(request: ScaffolderScaffoldOptions, options?: ScaffolderRequestOptions): Promise<ScaffolderScaffoldResponse>;
632
+ /**
633
+ * {@inheritdoc ScaffolderApi.getTask}
634
+ */
635
+ getTask(taskId: string, options?: ScaffolderRequestOptions): Promise<ScaffolderTask>;
636
+ /**
637
+ * {@inheritdoc ScaffolderApi.streamLogs}
638
+ */
639
+ streamLogs(request: ScaffolderStreamLogsOptions, options?: ScaffolderRequestOptions): Observable<LogEvent>;
640
+ /**
641
+ * {@inheritdoc ScaffolderApi.dryRun}
642
+ */
643
+ dryRun(request: ScaffolderDryRunOptions, options?: ScaffolderRequestOptions): Promise<ScaffolderDryRunResponse>;
644
+ private streamLogsEventStream;
645
+ private streamLogsPolling;
646
+ /**
647
+ * {@inheritdoc ScaffolderApi.listActions}
648
+ */
649
+ listActions(options?: ScaffolderRequestOptions): Promise<ListActionsResponse>;
650
+ /**
651
+ * {@inheritdoc ScaffolderApi.listTemplatingExtensions}
652
+ */
653
+ listTemplatingExtensions(options?: ScaffolderRequestOptions): Promise<ListTemplatingExtensionsResponse>;
654
+ /**
655
+ * {@inheritdoc ScaffolderApi.cancelTask}
656
+ */
657
+ cancelTask(taskId: string, options?: ScaffolderRequestOptions): Promise<{
658
+ status?: TaskStatus;
659
+ }>;
660
+ /**
661
+ * {@inheritdoc ScaffolderApi.retry}
662
+ */
663
+ retry?(taskId: string, options?: ScaffolderRequestOptions): Promise<{
664
+ id: string;
665
+ }>;
666
+ /**
667
+ * {@inheritdoc ScaffolderApi.retry}
668
+ */
669
+ autocomplete({ token, resource, provider, context, }: {
670
+ token: string;
671
+ provider: string;
672
+ resource: string;
673
+ context: Record<string, string>;
674
+ }): Promise<{
675
+ results: {
676
+ title?: string;
677
+ id: string;
678
+ }[];
679
+ }>;
680
+ private requestRequired;
681
+ }
682
+
683
+ export { type Action, type ListActionsResponse, type ListTemplatingExtensionsResponse, type LogEvent, type ScaffolderApi, ScaffolderClient, type ScaffolderDryRunOptions, type ScaffolderDryRunResponse, type ScaffolderGetIntegrationsListOptions, type ScaffolderGetIntegrationsListResponse, type ScaffolderOutputLink, type ScaffolderOutputText, type ScaffolderRequestOptions, type ScaffolderScaffoldOptions, type ScaffolderScaffoldResponse, type ScaffolderStreamLogsOptions, type ScaffolderTask, type ScaffolderTaskOutput, type TaskStatus as ScaffolderTaskStatus, type ScaffolderUsageExample, type TaskEventType, type TaskRecoverStrategy, type TaskRecovery, type TaskSpec, type TaskSpecV1beta3, type TaskStep, type TemplateEntityStepV1beta3, type TemplateEntityV1beta3, type TemplateFilter, type TemplateGlobalFunction, type TemplateGlobalValue, type TemplateInfo, type TemplateParameterSchema, type TemplateParametersV1beta3, type TemplatePermissionsV1beta3, type TemplatePresentationV1beta3, type TemplateRecoveryV1beta3, isTemplateEntityV1beta3, templateEntityV1beta3Validator };
package/dist/index.esm.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { isTemplateEntityV1beta3, templateEntityV1beta3Validator } from './TemplateEntityV1beta3.esm.js';
2
+ export { ScaffolderClient } from './ScaffolderClient.esm.js';
2
3
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}