From 8cdc0aad49276794eb99d8003538220394bff9c6 Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 9 Jul 2024 13:46:08 -0400 Subject: [PATCH 01/44] Create openapi.yaml Signed-off-by: solimant --- plugins/scaffolder-backend/src/schema/openapi.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/scaffolder-backend/src/schema/openapi.yaml diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml new file mode 100644 index 0000000000..9a2a1e19bc --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -0,0 +1,12 @@ +openapi: 3.0.3 +info: + title: scaffolder + version: '1' + description: The Backstage backend plugin that provides the Backstage scaffolder + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + contact: {} +servers: + - url: / +components: From 4bdb3341b0ce5f1a7ac07dcaa1bf3ba7724f3d59 Mon Sep 17 00:00:00 2001 From: solimant Date: Sat, 17 Aug 2024 16:57:42 +0000 Subject: [PATCH 02/44] Add GetTemplateParameterSchema Signed-off-by: solimant --- .../src/schema/openapi.yaml | 154 +++++++++++++++++- 1 file changed, 153 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 9a2a1e19bc..c76e918867 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -2,7 +2,7 @@ openapi: 3.0.3 info: title: scaffolder version: '1' - description: The Backstage backend plugin that provides the Backstage scaffolder + description: The Backstage backend plugin that helps you create new things license: name: Apache-2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html @@ -10,3 +10,155 @@ info: servers: - url: / components: + examples: {} + headers: {} + parameters: + kind: + name: kind + in: path + required: true + allowReserved: true + schema: + type: string + namespace: + name: namespace + in: path + required: true + allowReserved: true + schema: + type: string + name: + name: name + in: path + required: true + allowReserved: true + schema: + type: string + requestBodies: {} + responses: + ErrorResponse: + description: An error response from the backend. + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/Error' + schemas: + Error: + type: object + properties: + error: + type: object + properties: + name: + type: string + message: + type: string + stack: + type: string + code: + type: string + required: + - name + - message + request: + type: object + properties: + method: + type: string + url: + type: string + required: + - method + - url + response: + type: object + properties: + statusCode: + type: number + required: + - statusCode + required: + - error + - response + additionalProperties: {} + JsonObject: + type: object + properties: {} + description: A type representing all allowed JSON object values. + additionalProperties: {} + TemplateParameterSchema: + type: object + properties: + title: + type: string + description: + type: string + presentation: + $ref: '#/components/schemas/TemplatePresentationV1beta3' + steps: + type: array + items: + type: object + properties: + title: + type: string + description: + type: string + schema: + $ref: '#/components/schemas/JsonObject' + required: + - title + - schema + required: + - title + - steps + description: |- + The shape of each entry of parameters which gets rendered + as a separate step in the wizard input + TemplatePresentationV1beta3: + type: object + properties: + buttonLabels: + type: object + properties: + backButtonText: + type: string + description: The text for the button which leads to the previous template page + createButtonText: + type: string + description: The text for the button which starts the execution of the template + reviewButtonText: + type: string + description: The text for the button which opens template's review/summary + description: Overrides default buttons' text + additionalProperties: false + description: The presentation of the template. + additionalProperties: {} + securitySchemes: + JWT: + type: http + scheme: bearer + bearerFormat: JWT +paths: + /v2/templates/{namespace}/{kind}/{name}/parameter-schema: + get: + operationId: GetTemplateParameterSchema + description: Get template parameter schema. + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/TemplateParameterSchema' + '400': + $ref: '#/components/responses/ErrorResponse' + default: + $ref: '#/components/responses/ErrorResponse' + security: + - {} + - JWT: [] + parameters: + - $ref: '#/components/parameters/namespace' + - $ref: '#/components/parameters/kind' + - $ref: '#/components/parameters/name' From 2a5c17b261cee4a1dd1f25e85ed709410afdc13c Mon Sep 17 00:00:00 2001 From: solimant Date: Mon, 19 Aug 2024 13:39:35 +0000 Subject: [PATCH 03/44] Add ListActions Signed-off-by: solimant --- .../src/schema/openapi.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index c76e918867..bde8677f2a 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -43,6 +43,38 @@ components: schema: $ref: '#/components/schemas/Error' schemas: + Action: + type: object + properties: + id: + type: string + description: + type: string + examples: + type: array + items: + $ref: '#/components/schemas/ActionExample' + schema: + type: object + properties: + input: + $ref: '#/components/schemas/JsonObject' + output: + $ref: '#/components/schemas/JsonObject' + required: + - id + description: The response shape for a single action in the `listActions` call to the `scaffolder-backend` + ActionExample: + type: object + properties: + description: + type: string + example: + type: string + required: + - description + - example + description: A single action example Error: type: object properties: @@ -86,6 +118,11 @@ components: properties: {} description: A type representing all allowed JSON object values. additionalProperties: {} + ListActionsResponse: + type: array + items: + $ref: '#/components/schemas/Action' + description: The response shape for the `listActions` call to the `scaffolder-backend` TemplateParameterSchema: type: object properties: @@ -162,3 +199,19 @@ paths: - $ref: '#/components/parameters/namespace' - $ref: '#/components/parameters/kind' - $ref: '#/components/parameters/name' + + /v2/actions: + get: + operationId: ListActions + description: Returns a list of all installed actions. + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/ListActionsResponse' + security: + - {} + - JWT: [] + parameters: [] From 64af92051980b78a13a46b69733501510d162a69 Mon Sep 17 00:00:00 2001 From: solimant Date: Thu, 22 Aug 2024 15:22:34 +0000 Subject: [PATCH 04/44] Add ListTasks Signed-off-by: solimant --- .../catalog-backend/src/schema/openapi.yaml | 36 +++ .../src/schema/openapi.yaml | 206 ++++++++++++++++++ 2 files changed, 242 insertions(+) diff --git a/plugins/catalog-backend/src/schema/openapi.yaml b/plugins/catalog-backend/src/schema/openapi.yaml index baaba44d48..25b5befa87 100644 --- a/plugins/catalog-backend/src/schema/openapi.yaml +++ b/plugins/catalog-backend/src/schema/openapi.yaml @@ -815,6 +815,42 @@ components: - totalItems - pageInfo additionalProperties: false + UserEntity: + $ref: '#/components/schemas/UserEntityV1alpha1' + UserEntityV1alpha1: + allOf: + - $ref: '#/components/schemas/Entity' + - type: object + properties: + apiVersion: + type: string + enum: + - 'backstage.io/v1alpha1' + - 'backstage.io/v1beta1' + kind: + type: string + enum: + - 'User' + spec: + type: object + properties: + profile: + type: object + properties: + displayName: + type: string + email: + type: string + picture: + type: string + memberOf: + type: array + items: + type: string + required: + - apiVersion + - kind + description: Backstage catalog User kind Entity. securitySchemes: JWT: type: http diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index bde8677f2a..48e1251b67 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -113,16 +113,206 @@ components: - error - response additionalProperties: {} + JsonArray: + type: array + items: + $ref: '#/components/schemas/JsonValue' + description: A type representing all allowed JSON array values. JsonObject: type: object properties: {} description: A type representing all allowed JSON object values. additionalProperties: {} + JsonPrimitive: + oneOf: + - type: number + - type: string + - type: boolean + - type: null + description: A type representing all allowed JSON primitive values. + JsonValue: + oneOf: + - $ref: '#/components/schemas/JsonObject' + - $ref: '#/components/schemas/JsonArray' + - $ref: '#/components/schemas/JsonPrimitive' + description: A type representing all allowed JSON values. ListActionsResponse: type: array items: $ref: '#/components/schemas/Action' description: The response shape for the `listActions` call to the `scaffolder-backend` + ListTasksResponse: + type: object + properties: + tasks: + type: array + items: + $ref: '#/components/schemas/SerializedTask' + description: The response shape for the `listTasks` call to the `scaffolder-backend` + SerializedTask: + type: object + properties: + id: + type: string + spec: + $ref: '#/components/schemas/TaskSpec' + status: + $ref: '#/components/schemas/TaskStatus' + createdAt: + type: string + lastHeartbeatAt: + type: string + createdBy: + type: string + secrets: + $ref: '#/components/schemas/TaskSecrets' + state: + $ref: '#/components/schemas/JsonObject' + required: + - id + - spec + - status + - createdAt + description: SerializedTask + TaskRecovery: + type: object + properties: + EXPERIMENTAL_strategy: + $ref: '#/components/schemas/TaskRecoverStrategy' + description: |- + When task didn't have a chance to complete due to system restart you can define the strategy what to do with such tasks, + by defining a strategy. + + By default, it is none, what means to not recover but updating the status from 'processing' to 'failed'. + TaskRecoverStrategy: + type: string + description: | + - none: not recover, let the task be marked as failed + - startOver: do recover, start the execution of the task from the first step. + enum: + - none + - startOver + TaskSecrets: + type: object + properties: + backstageToken: + type: string + additionalProperties: + type: string + description: TaskSecrets + TaskSpec: + $ref: '#/components/schemas/TaskSpecV1beta3' + TaskSpecV1beta3: + type: object + properties: + apiVersion: + type: string + enum: + - "scaffolder.backstage.io/v1beta3" + description: The apiVersion string of the TaskSpec. + parameters: + $ref: '#/components/schemas/JsonObject' + description: | + This is a JSONSchema which is used to render a form in the frontend + to collect user input and validate it against that schema. This can then be used in the `steps` part below to template + variables passed from the user into each action in the template. + steps: + type: array + items: + $ref: '#/components/schemas/TaskStep' + description: | + A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying + javascript action and some optional input parameters that may or may not have been collected from the end user. + output: + type: object + additionalProperties: + $ref: '#/components/schemas/JsonValue' + description: | + The output is an object where template authors can pull out information from template actions and return them in a known standard way. + templateInfo: + $ref: '#/components/schemas/TemplateInfo' + description: Some information about the template that is stored on the task spec. + user: + type: object + properties: + entity: + $ref: '../../../catalog-backend/src/schema/openapi.yaml#/components/schemas/UserEntity' + description: The decorated entity from the Catalog + ref: + type: string + description: An entity ref for the author of the task + description: Some decoration of the author of the task that should be available in the context + EXPERIMENTAL_recovery: + $ref: '#/components/schemas/TaskRecovery' + description: How to recover the task after system restart or system crash. + required: + - apiVersion + - parameters + - steps + - output + description: |- + A scaffolder task as stored in the database, generated from a v1beta3 + apiVersion Template. + TaskStatus: + type: string + enum: + - 'cancelled' + - 'completed' + - 'failed' + - 'open' + - 'processing' + description: The status of each step of the Task + TaskStep: + type: object + properties: + id: + type: string + description: A unique identifier for this step. + name: + type: string + description: A display name to show the user. + action: + type: string + description: The underlying action ID that will be called as part of running this step. + input: + $ref: '#/components/schemas/JsonObject' + description: Additional data that will be passed to the action. + if: + oneOf: + - type: string + - type: boolean + description: When this is false, or if the templated value string evaluates to something that is falsy the step will be skipped. + each: + oneOf: + - type: string + - $ref: '#/components/schemas/JsonArray' + description: Run step repeatedly. + required: + - id + - name + - action + description: An individual step of a scaffolder task, as stored in the database. + TemplateInfo: + type: object + properties: + entityRef: + type: string + description: The entityRef of the template. + baseUrl: + type: string + description: Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths. + entity: + type: object + description: The Template entity. + properties: + metadata: + $ref: '../../../catalog-backend/src/schema/openapi.yaml#/components/schemas/EntityMeta' + description: The metadata of the Template. + required: + - entityRef + description: |- + Information about a template that is stored on a task specification. + Includes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition TemplateParameterSchema: type: object properties: @@ -215,3 +405,19 @@ paths: - {} - JWT: [] parameters: [] + + /v2/tasks: + get: + operationId: ListTasks + description: Returns a list of tasks, filtering by ownership and/or status if given. + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/ListTasksResponse' + security: + - {} + - JWT: [] + parameters: [] From 91e5c465aaa59305da270169c245cfcfa280ab4c Mon Sep 17 00:00:00 2001 From: solimant Date: Wed, 4 Sep 2024 16:16:55 +0000 Subject: [PATCH 05/44] Add Scaffold Signed-off-by: solimant --- .../src/schema/openapi.yaml | 231 ++++++++++++++++++ 1 file changed, 231 insertions(+) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 48e1251b67..51e7035c6b 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -42,6 +42,62 @@ components: application/json; charset=utf-8: schema: $ref: '#/components/schemas/Error' + ValidationError: + description: Validation errors. + content: + application/json: + schema: + type: object + properties: + errors: + type: array + items: + type: object + properties: + path: + type: array + items: + oneOf: + - type: string + - type: integer + property: + type: string + schema: + $ref: '#/components/schemas/Schema' + stack: + type: string + instance: + oneOf: + - type: string + - type: number + - type: boolean + - type: array + - type: object + nullable: true + argument: + oneOf: + - type: string + - type: number + - type: boolean + - type: array + - type: object + nullable: true + name: + type: string + message: + type: string + required: + - path + - property + - schema + - instance + - name + - message + - argument + - stack + additionalProperties: {} + required: + - errors schemas: Action: type: object @@ -149,6 +205,154 @@ components: items: $ref: '#/components/schemas/SerializedTask' description: The response shape for the `listTasks` call to the `scaffolder-backend` + ScaffolderScaffoldOptions: + type: object + properties: + templateRef: + type: string + values: + type: object + additionalProperties: + $ref: '#/components/schemas/JsonValue' + secrets: + type: object + additionalProperties: + type: string + required: + - templateRef + - values + description: The input options to the `scaffold` method of the `ScaffolderClient`. + Schema: + type: object + properties: + $id: + type: string + id: + type: string + $schema: + type: string + $ref: + type: string + title: + type: string + description: + type: string + multipleOf: + type: number + maximum: + type: number + exclusiveMaximum: + oneOf: + - type: number + - type: boolean + minimum: + type: number + exclusiveMinimum: + oneOf: + - type: number + - type: boolean + maxLength: + type: integer + minLength: + type: integer + pattern: + type: string + additionalItems: + oneOf: + - type: boolean + - $ref: '#/components/schemas/Schema' + items: + oneOf: + - $ref: '#/components/schemas/Schema' + - type: array + items: + $ref: '#/components/schemas/Schema' + maxItems: + type: integer + minItems: + type: integer + uniqueItems: + type: boolean + maxProperties: + type: integer + minProperties: + type: integer + required: + oneOf: + - type: array + items: + type: string + - type: boolean + additionalProperties: + oneOf: + - type: boolean + - $ref: '#/components/schemas/Schema' + definitions: + type: object + additionalProperties: + $ref: '#/components/schemas/Schema' + properties: + type: object + additionalProperties: + $ref: '#/components/schemas/Schema' + patternProperties: + type: object + additionalProperties: + $ref: '#/components/schemas/Schema' + dependencies: + type: object + additionalProperties: + oneOf: + - $ref: '#/components/schemas/Schema' + - type: array + items: + type: string + const: + oneOf: + - type: string + - type: number + - type: boolean + - type: array + - type: object + nullable: true + enum: + type: array + items: + oneOf: + - type: string + - type: number + - type: boolean + - type: array + - type: object + nullable: true + type: + oneOf: + - type: string + - type: array + items: + type: string + format: + type: string + allOf: + type: array + items: + $ref: '#/components/schemas/Schema' + anyOf: + type: array + items: + $ref: '#/components/schemas/Schema' + oneOf: + type: array + items: + $ref: '#/components/schemas/Schema' + not: + $ref: '#/components/schemas/Schema' + if: + $ref: '#/components/schemas/Schema' + then: + $ref: '#/components/schemas/Schema' + else: + $ref: '#/components/schemas/Schema' SerializedTask: type: object properties: @@ -421,3 +625,30 @@ paths: - {} - JWT: [] parameters: [] + post: + operationId: Scaffold + description: |- + Executes the scaffolding of a component, given a template and its + parameter values. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ScaffolderScaffoldOptions' + responses: + '201': + description: Created + content: + application/json: + schema: + type: object + properties: + id: + type: string + '400': + $ref: '#/components/responses/ValidationError' + security: + - {} + - JWT: [] + parameters: [] From 9ebc8c4d25acaf82208ff7b6545dd64c2b2950fc Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 10 Sep 2024 01:38:15 +0000 Subject: [PATCH 06/44] Add GetTask Signed-off-by: solimant --- .../src/schema/openapi.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 51e7035c6b..0b6a5d1d44 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -34,6 +34,13 @@ components: allowReserved: true schema: type: string + taskId: + name: taskId + in: path + required: true + allowReserved: true + schema: + type: string requestBodies: {} responses: ErrorResponse: @@ -652,3 +659,20 @@ paths: - {} - JWT: [] parameters: [] + + /v2/tasks/{taskId}: + get: + operationId: GetTask + description: Get a task by ID. + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/SerializedTask' + security: + - {} + - JWT: [] + parameters: + - $ref: '#/components/parameters/taskId' From 799910c6cc5d9f227556d380f5c2c80f0f2b943f Mon Sep 17 00:00:00 2001 From: solimant Date: Mon, 7 Oct 2024 19:36:43 +0000 Subject: [PATCH 07/44] Add CancelTask Signed-off-by: solimant --- .../src/schema/openapi.yaml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 0b6a5d1d44..b0611bf2d3 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -676,3 +676,23 @@ paths: - JWT: [] parameters: - $ref: '#/components/parameters/taskId' + + /v2/tasks/{taskId}/cancel: + post: + operationId: CancelTask + description: Sends a signal to a task broker to cancel the running task by taskId. + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + status: + $ref: '#/components/schemas/TaskStatus' + security: + - {} + - JWT: [] + parameters: + - $ref: '#/components/parameters/taskId' From 1c38f059a9251cb6dca81ce980d01cd84288f1de Mon Sep 17 00:00:00 2001 From: solimant Date: Mon, 7 Oct 2024 23:52:02 +0000 Subject: [PATCH 08/44] Add Retry Signed-off-by: solimant --- .../src/ScaffolderPlugin.test.ts | 7 ++++--- .../src/schema/openapi.yaml | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/plugins/scaffolder-backend/src/ScaffolderPlugin.test.ts b/plugins/scaffolder-backend/src/ScaffolderPlugin.test.ts index b9cb397ae6..f3b3456e79 100644 --- a/plugins/scaffolder-backend/src/ScaffolderPlugin.test.ts +++ b/plugins/scaffolder-backend/src/ScaffolderPlugin.test.ts @@ -737,9 +737,10 @@ describe('scaffolderPlugin', () => { }); // Retry the task by ID - response = await request(server).post( - `/api/scaffolder/v2/tasks/${taskId}/retry`, - ); + response = await request(server) + .post(`/api/scaffolder/v2/tasks/${taskId}/retry`) + .send({}); + expect(response.status).toBe(201); expect(response.body).toMatchObject({ id: taskId }); diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index b0611bf2d3..734ac9e89a 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -696,3 +696,23 @@ paths: - JWT: [] parameters: - $ref: '#/components/parameters/taskId' + + /v2/tasks/{taskId}/retry: + post: + operationId: Retry + description: Starts the task again from the point where it failed. + responses: + '201': + description: Ok + content: + application/json: + schema: + type: object + properties: + id: + type: string + security: + - {} + - JWT: [] + parameters: + - $ref: '#/components/parameters/taskId' From 56da08711d5a00cceba32f43e5682192a684db0b Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 8 Oct 2024 00:42:25 +0000 Subject: [PATCH 09/44] Add StreamLogsEventStream Signed-off-by: solimant --- .../src/schema/openapi.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 734ac9e89a..0dfdd57d8e 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -716,3 +716,22 @@ paths: - JWT: [] parameters: - $ref: '#/components/parameters/taskId' + + /v2/tasks/{taskId}/eventstream: + get: + operationId: StreamLogsEventStream + description: Get event stream for a task by ID. + responses: + '200': + description: Ok + content: + text/event-stream: + schema: + type: string + parameters: + - $ref: '#/components/parameters/taskId' + - name: after + in: query + description: Offset event ID to stream events after. + schema: + type: integer From 340611f85ab322382ac51eb74673b09ef4ff14ac Mon Sep 17 00:00:00 2001 From: solimant Date: Wed, 9 Oct 2024 02:21:52 +0000 Subject: [PATCH 10/44] Add StreamLogsPolling Signed-off-by: solimant --- .../src/schema/openapi.yaml | 59 +++++++++++++++++-- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 0dfdd57d8e..733d816b12 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -13,6 +13,12 @@ components: examples: {} headers: {} parameters: + eventsAfter: + name: after + in: query + description: Offset event ID to stream events after. + schema: + type: integer kind: name: kind in: path @@ -212,6 +218,28 @@ components: items: $ref: '#/components/schemas/SerializedTask' description: The response shape for the `listTasks` call to the `scaffolder-backend` + SerializedTaskEvent: + type: object + properties: + id: + type: integer + isTaskRecoverable: + type: boolean + taskId: + type: string + body: + $ref: '#/components/schemas/JsonObject' + type: + $ref: '#/components/schemas/TaskEventType' + createdAt: + type: string + required: + - id + - taskId + - body + - type + - createdAt + description: SerializedTaskEvent ScaffolderScaffoldOptions: type: object properties: @@ -385,6 +413,14 @@ components: - status - createdAt description: SerializedTask + TaskEventType: + type: string + description: TaskEventType + enum: + - completion + - log + - cancelled + - recovered TaskRecovery: type: object properties: @@ -729,9 +765,22 @@ paths: schema: type: string parameters: + - $ref: '#/components/parameters/eventsAfter' + - $ref: '#/components/parameters/taskId' + + /v2/tasks/{taskId}/events: + get: + operationId: StreamLogsPolling + description: Get events for a task by ID. + responses: + '200': + description: Ok + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SerializedTaskEvent' + parameters: + - $ref: '#/components/parameters/eventsAfter' - $ref: '#/components/parameters/taskId' - - name: after - in: query - description: Offset event ID to stream events after. - schema: - type: integer From 629485cb8d2f1b56fe18ddcf4b3ce4940e20d98f Mon Sep 17 00:00:00 2001 From: solimant Date: Fri, 11 Oct 2024 21:34:58 +0000 Subject: [PATCH 11/44] Add DryRun Signed-off-by: solimant --- .../src/schema/openapi.yaml | 223 ++++++++++++++++++ .../src/service/router.test.ts | 1 - 2 files changed, 223 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 733d816b12..4eabc141f7 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -144,6 +144,22 @@ components: - description - example description: A single action example + DryRunResult: + type: object + properties: + log: + type: array + items: + type: object + properties: + body: + $ref: '#/components/schemas/JsonObject' + directoryContents: + type: array + items: + $ref: '#/components/schemas/SerializedFile' + output: + $ref: '#/components/schemas/JsonObject' Error: type: object properties: @@ -218,6 +234,21 @@ components: items: $ref: '#/components/schemas/SerializedTask' description: The response shape for the `listTasks` call to the `scaffolder-backend` + SerializedFile: + type: object + properties: + path: + type: string + content: + type: string + format: byte + executable: + type: boolean + symlink: + type: boolean + required: + - path + - content SerializedTaskEvent: type: object properties: @@ -539,6 +570,89 @@ components: - name - action description: An individual step of a scaffolder task, as stored in the database. + TemplateEntityStepV1beta3: + allOf: + - $ref: '#/components/schemas/JsonObject' + - type: object + properties: + id: + type: string + name: + type: string + action: + type: string + input: + $ref: '#/components/schemas/JsonObject' + if: + oneOf: + - type: string + - type: boolean + backstage:permissions: + $ref: '#/components/schemas/TemplatePermissionsV1beta3' + required: + - action + description: Step that is part of a Template Entity. + TemplateEntityV1beta3: + allOf: + - $ref: '../../../catalog-backend/src/schema/openapi.yaml#/components/schemas/Entity' + - type: object + properties: + apiVersion: + type: string + enum: ['scaffolder.backstage.io/v1beta3'] + description: The apiVersion string of the TaskSpec. + kind: + type: string + enum: ['Template'] + description: The kind of the entity + spec: + type: object + properties: + type: + type: string + description: The type that the Template will create. For example service, website or library. + presentation: + $ref: '#/components/schemas/TemplatePresentationV1beta3' + description: Template specific configuration of the presentation layer. + EXPERIMENTAL_recovery: + $ref: '#/components/schemas/TemplateRecoveryV1beta3' + description: Recovery strategy for the template + parameters: + oneOf: + - $ref: '#/components/schemas/TemplateParametersV1beta3' + - type: array + items: + $ref: '#/components/schemas/TemplateParametersV1beta3' + description: |- + This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend + to collect user input and validate it against that schema. This can then be used in the `steps` part below to template + variables passed from the user into each action in the template. + steps: + type: array + items: + $ref: '#/components/schemas/TemplateEntityStepV1beta3' + description: |- + A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying + javascript action and some optional input parameters that may or may not have been collected from the end user. + output: + type: object + additionalProperties: + type: string + description: The output is an object where template authors can pull out information from template actions and return them in a known standard way. + owner: + type: string + description: The owner entityRef of the TemplateEntity + required: + - type + - steps + description: The specification of the Template Entity + required: + - apiVersion + - kind + - spec + description: |- + Backstage catalog Template kind Entity. Templates are used by the Scaffolder + plugin to create new entities, such as Components. TemplateInfo: type: object properties: @@ -589,6 +703,24 @@ components: description: |- The shape of each entry of parameters which gets rendered as a separate step in the wizard input + TemplateParametersV1beta3: + allOf: + - $ref: '#/components/schemas/JsonObject' + - type: object + properties: + backstage:permissions: + $ref: '#/components/schemas/TemplatePermissionsV1beta3' + description: Parameter that is part of a Template Entity. + TemplatePermissionsV1beta3: + allOf: + - $ref: '#/components/schemas/JsonObject' + - type: object + properties: + tags: + type: array + items: + type: string + description: Access control properties for parts of a template. TemplatePresentationV1beta3: type: object properties: @@ -608,6 +740,17 @@ components: additionalProperties: false description: The presentation of the template. additionalProperties: {} + TemplateRecoveryV1beta3: + allOf: + - $ref: '#/components/schemas/JsonObject' + - type: string + enum: + - none + - startOver + description: |- + none - not recover, let the task be marked as failed + startOver - do recover, start the execution of the task from the first step. + description: Depends on how you designed your task you might tailor the behaviour for each of them. securitySchemes: JWT: type: http @@ -784,3 +927,83 @@ paths: parameters: - $ref: '#/components/parameters/eventsAfter' - $ref: '#/components/parameters/taskId' + + /v2/dry-run: + post: + operationId: DryRun + description: Perform a dry-run of a template + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + template: + $ref: '#/components/schemas/TemplateEntityV1beta3' + values: + type: object + secrets: + type: object + directoryContents: + type: array + items: + type: object + properties: + path: + type: string + base64Content: + type: string + required: + - template + - values + - directoryContents + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + allOf: + - $ref: '#/components/schemas/DryRunResult' + - type: object + properties: + steps: + type: array + items: + type: object + properties: + id: + type: string + name: + type: string + action: + type: string + input: + $ref: '#/components/schemas/JsonObject' + if: + oneOf: + - type: string + - type: boolean + backstage:permissions: + $ref: '#/components/schemas/TemplatePermissionsV1beta3' + required: + - id + - name + - action + directoryContents: + type: object + properties: + path: + type: string + executable: + type: boolean + base64Content: + type: string + required: + - path + - base64Content + '400': + $ref: '#/components/responses/ValidationError' + parameters: [] diff --git a/plugins/scaffolder-backend/src/service/router.test.ts b/plugins/scaffolder-backend/src/service/router.test.ts index bebfadb9b1..a938abe611 100644 --- a/plugins/scaffolder-backend/src/service/router.test.ts +++ b/plugins/scaffolder-backend/src/service/router.test.ts @@ -56,7 +56,6 @@ import { } from '@backstage/plugin-scaffolder-node/alpha'; import { catalogServiceMock } from '@backstage/plugin-catalog-node/testUtils'; import { DatabaseService } from '@backstage/backend-plugin-api'; - import { ScmIntegrations } from '@backstage/integration'; import { extractFilterMetadata, From 7895137245ec729b6dfa128676ba772223cb73b4 Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 19 Nov 2024 18:45:11 +0000 Subject: [PATCH 12/44] Add Autocomplete Signed-off-by: solimant --- .../src/schema/openapi.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 4eabc141f7..ff57991b5c 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -1007,3 +1007,49 @@ paths: '400': $ref: '#/components/responses/ValidationError' parameters: [] + + /v2/autocomplete/{provider}/{resource}: + post: + operationId: Autocomplete + description: Perform an autocomplete for the given provider and resource. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + context: + type: object + additionalProperties: + type: string + token: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + properties: + results: + type: array + items: + type: object + properties: + title: + type: string + parameters: + - in: path + name: provider + required: true + allowReserved: true + schema: + type: string + - in: path + name: resource + required: true + allowReserved: true + schema: + type: string From ecb5c209876cc0de3ca6f478a8745e23a2e270af Mon Sep 17 00:00:00 2001 From: solimant Date: Mon, 2 Dec 2024 15:34:21 +0000 Subject: [PATCH 13/44] Remove UserEntity model Signed-off-by: solimant --- .../catalog-backend/src/schema/openapi.yaml | 36 ------------------- .../src/schema/openapi.yaml | 4 ++- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/plugins/catalog-backend/src/schema/openapi.yaml b/plugins/catalog-backend/src/schema/openapi.yaml index 25b5befa87..baaba44d48 100644 --- a/plugins/catalog-backend/src/schema/openapi.yaml +++ b/plugins/catalog-backend/src/schema/openapi.yaml @@ -815,42 +815,6 @@ components: - totalItems - pageInfo additionalProperties: false - UserEntity: - $ref: '#/components/schemas/UserEntityV1alpha1' - UserEntityV1alpha1: - allOf: - - $ref: '#/components/schemas/Entity' - - type: object - properties: - apiVersion: - type: string - enum: - - 'backstage.io/v1alpha1' - - 'backstage.io/v1beta1' - kind: - type: string - enum: - - 'User' - spec: - type: object - properties: - profile: - type: object - properties: - displayName: - type: string - email: - type: string - picture: - type: string - memberOf: - type: array - items: - type: string - required: - - apiVersion - - kind - description: Backstage catalog User kind Entity. securitySchemes: JWT: type: http diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index ff57991b5c..26253d404f 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -514,8 +514,10 @@ components: type: object properties: entity: - $ref: '../../../catalog-backend/src/schema/openapi.yaml#/components/schemas/UserEntity' + type: object + properties: {} description: The decorated entity from the Catalog + additionalProperties: {} ref: type: string description: An entity ref for the author of the task From 45dfc16205f22d0f0c99ea3a6a393604cdb7ee4e Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 10 Dec 2024 21:56:28 +0000 Subject: [PATCH 14/44] Generate Scaffolder OpenAPI server Signed-off-by: solimant --- .../src/types/generated.ts | 7 +- plugins/scaffolder-backend/package.json | 3 +- .../src/schema/openapi.yaml | 609 ++++-- .../generated/apis/DefaultApi.server.ts | 167 ++ .../schema/openapi/generated/apis/index.ts | 17 + .../src/schema/openapi/generated/index.ts | 18 + .../openapi/generated/models/Action.model.ts | 32 + .../generated/models/ActionExample.model.ts | 28 + .../generated/models/ActionSchema.model.ts | 33 + .../models/Autocomplete200Response.model.ts | 27 + ...tocomplete200ResponseResultsInner.model.ts | 26 + .../models/AutocompleteRequest.model.ts | 27 + .../models/CancelTask200Response.model.ts | 27 + .../models/DryRun200Response.model.ts | 35 + .../models/DryRun200ResponseAllOf.model.ts | 29 + ...sponseAllOfDirectoryContentsInner.model.ts | 28 + .../DryRun200ResponseAllOfStepsInner.model.ts | 32 + ...un200ResponseAllOfStepsInnerAllOf.model.ts | 27 + .../generated/models/DryRunRequest.model.ts | 31 + ...yRunRequestDirectoryContentsInner.model.ts | 27 + .../generated/models/DryRunResult.model.ts | 33 + .../models/DryRunResultLogInner.model.ts | 29 + .../openapi/generated/models/Entity.model.ts | 45 + .../generated/models/EntityLink.model.ts | 42 + .../generated/models/EntityMeta.model.ts | 69 + .../generated/models/EntityRelation.model.ts | 34 + .../generated/models/ErrorError.model.ts | 29 + .../generated/models/ErrorRequest.model.ts | 27 + .../generated/models/ErrorResponse.model.ts | 26 + .../generated/models/JsonPrimitive.model.ts | 25 + .../generated/models/JsonValue.model.ts | 29 + .../models/ListTasksResponse.model.ts | 28 + .../generated/models/ModelError.model.ts | 33 + .../models/Scaffold201Response.model.ts | 26 + .../models/Scaffold400Response.model.ts | 27 + .../models/ScaffolderScaffoldOptions.model.ts | 30 + .../openapi/generated/models/Schema.model.ts | 64 + .../models/SchemaAdditionalItems.model.ts | 25 + .../models/SchemaDependenciesValue.model.ts | 25 + .../models/SchemaExclusiveMaximum.model.ts | 24 + .../generated/models/SchemaItems.model.ts | 25 + .../generated/models/SchemaRequired.model.ts | 24 + .../generated/models/SchemaType.model.ts | 24 + .../generated/models/SerializedFile.model.ts | 29 + .../generated/models/SerializedTask.model.ts | 40 + .../models/SerializedTaskEvent.model.ts | 36 + .../generated/models/TaskEventType.model.ts | 34 + .../models/TaskRecoverStrategy.model.ts | 32 + .../generated/models/TaskSecrets.model.ts | 29 + .../generated/models/TaskSpecV1beta3.model.ts | 55 + .../models/TaskSpecV1beta3User.model.ts | 34 + .../generated/models/TaskStatus.model.ts | 40 + .../generated/models/TaskStep.model.ts | 46 + .../generated/models/TaskStepEach.model.ts | 26 + .../models/TemplateEntityStepV1beta3.model.ts | 35 + .../TemplateEntityStepV1beta3AllOf.model.ts | 32 + .../models/TemplateEntityV1beta3.model.ts | 53 + .../TemplateEntityV1beta3AllOf.model.ts | 45 + .../TemplateEntityV1beta3AllOfSpec.model.ts | 49 + ...eEntityV1beta3AllOfSpecParameters.model.ts | 28 + .../generated/models/TemplateInfo.model.ts | 36 + .../models/TemplateInfoEntity.model.ts | 28 + .../models/TemplateParameterSchema.model.ts | 34 + ...TemplateParameterSchemaStepsInner.model.ts | 30 + .../models/TemplateParametersV1beta3.model.ts | 25 + .../TemplatePermissionsV1beta3.model.ts | 27 + .../TemplatePermissionsV1beta3AllOf.model.ts | 26 + .../TemplatePresentationV1beta3.model.ts | 30 + ...tePresentationV1beta3ButtonLabels.model.ts | 38 + .../models/TemplateRecoveryV1beta3.model.ts | 25 + .../generated/models/ValidationError.model.ts | 35 + .../models/ValidationErrorPathInner.model.ts | 24 + .../models/ValidationErrorSchema.model.ts | 25 + .../schema/openapi/generated/models/index.ts | 83 + .../src/schema/openapi/generated/router.ts | 1738 +++++++++++++++++ .../src/schema/openapi/index.ts | 17 + .../scaffolder-backend/src/service/router.ts | 4 +- yarn.lock | 2 +- 78 files changed, 4645 insertions(+), 198 deletions(-) create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/index.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Action.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionExample.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionSchema.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/AutocompleteRequest.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/CancelTask200Response.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResult.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Entity.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityLink.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityMeta.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityRelation.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorError.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonPrimitive.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonValue.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ModelError.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold400Response.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Schema.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaItems.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaRequired.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaType.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedFile.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStep.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStepEach.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfo.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/router.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/index.ts diff --git a/packages/backend-openapi-utils/src/types/generated.ts b/packages/backend-openapi-utils/src/types/generated.ts index e4d5dada72..ffbabb6f92 100644 --- a/packages/backend-openapi-utils/src/types/generated.ts +++ b/packages/backend-openapi-utils/src/types/generated.ts @@ -21,7 +21,12 @@ import { PathTemplate, ValueOf } from './common'; */ export type EndpointMap = Record< string, - { query?: object; body?: object; response?: object | void; path?: object } + { + query?: object; + body?: object; + response?: object | string | void; + path?: object; + } >; // OpenAPI generator doesn't emit regular lowercase 'delete'. diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 6cef18efce..86a361c9dd 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -54,6 +54,7 @@ "build": "backstage-cli package build", "build:assets": "node scripts/build-nunjucks.js", "clean": "backstage-cli package clean", + "generate": "backstage-repo-tools package schema openapi generate --server", "lint": "backstage-cli package lint", "prepack": "backstage-cli package prepack", "postpack": "backstage-cli package postpack", @@ -62,6 +63,7 @@ }, "dependencies": { "@backstage/backend-defaults": "workspace:^", + "@backstage/backend-openapi-utils": "workspace:^", "@backstage/backend-plugin-api": "workspace:^", "@backstage/catalog-model": "workspace:^", "@backstage/config": "workspace:^", @@ -89,7 +91,6 @@ "@types/luxon": "^3.0.0", "concat-stream": "^2.0.0", "express": "^4.17.1", - "express-promise-router": "^4.1.0", "fs-extra": "^11.2.0", "globby": "^11.0.0", "isbinaryfile": "^5.0.0", diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 26253d404f..1e4e372810 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -13,6 +13,14 @@ components: examples: {} headers: {} parameters: + createdBy: + name: createdBy + in: query + description: Created by + required: false + allowReserved: true + schema: + type: string eventsAfter: name: after in: query @@ -26,6 +34,15 @@ components: allowReserved: true schema: type: string + limit: + name: limit + in: query + description: Number of records to return in the response. + required: false + allowReserved: true + schema: + type: integer + minimum: 0 namespace: name: namespace in: path @@ -40,6 +57,34 @@ components: allowReserved: true schema: type: string + offset: + name: offset + in: query + description: Number of records to skip in the query page. + required: false + allowReserved: true + schema: + type: integer + minimum: 0 + order: + name: order + in: query + description: Order + required: false + allowReserved: true + schema: + type: string + enum: + - asc + - desc + status: + name: status + in: query + description: Status + required: false + allowReserved: true + schema: + type: string taskId: name: taskId in: path @@ -55,62 +100,6 @@ components: application/json; charset=utf-8: schema: $ref: '#/components/schemas/Error' - ValidationError: - description: Validation errors. - content: - application/json: - schema: - type: object - properties: - errors: - type: array - items: - type: object - properties: - path: - type: array - items: - oneOf: - - type: string - - type: integer - property: - type: string - schema: - $ref: '#/components/schemas/Schema' - stack: - type: string - instance: - oneOf: - - type: string - - type: number - - type: boolean - - type: array - - type: object - nullable: true - argument: - oneOf: - - type: string - - type: number - - type: boolean - - type: array - - type: object - nullable: true - name: - type: string - message: - type: string - required: - - path - - property - - schema - - instance - - name - - message - - argument - - stack - additionalProperties: {} - required: - - errors schemas: Action: type: object @@ -160,6 +149,143 @@ components: $ref: '#/components/schemas/SerializedFile' output: $ref: '#/components/schemas/JsonObject' + required: + - log + - directoryContents + - output + EntityLink: + type: object + properties: + type: + type: string + description: An optional value to categorize links into specific groups + icon: + type: string + description: An optional semantic key that represents a visual icon. + title: + type: string + description: An optional descriptive title for the link. + url: + type: string + description: The url to the external site, document, etc. + required: + - url + description: A link to external information that is related to the entity. + additionalProperties: false + EntityMeta: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/EntityLink' + description: A list of external hyperlinks related to the entity. + tags: + type: array + items: + type: string + description: |- + A list of single-valued strings, to for example classify catalog entities in + various ways. + annotations: + $ref: '#/components/schemas/MapStringString' + labels: + $ref: '#/components/schemas/MapStringString' + description: + type: string + description: |- + A short (typically relatively few words, on one line) description of the + entity. + title: + type: string + description: |- + A display name of the entity, to be presented in user interfaces instead + of the `name` property above, when available. + This field is sometimes useful when the `name` is cumbersome or ends up + being perceived as overly technical. The title generally does not have + as stringent format requirements on it, so it may contain special + characters and be more explanatory. Do keep it very short though, and + avoid situations where a title can be confused with the name of another + entity, or where two entities share a title. + Note that this is only for display purposes, and may be ignored by some + parts of the code. Entity references still always make use of the `name` + property, not the title. + namespace: + type: string + description: The namespace that the entity belongs to. + name: + type: string + description: |- + The name of the entity. + Must be unique within the catalog at any given point in time, for any + given namespace + kind pair. This value is part of the technical + identifier of the entity, and as such it will appear in URLs, database + tables, entity references, and similar. It is subject to restrictions + regarding what characters are allowed. + If you want to use a different, more human readable string with fewer + restrictions on it in user interfaces, see the `title` field below. + etag: + type: string + description: |- + An opaque string that changes for each update operation to any part of + the entity, including metadata. + This field can not be set by the user at creation time, and the server + will reject an attempt to do so. The field will be populated in read + operations. The field can (optionally) be specified when performing + update or delete operations, and the server will then reject the + operation if it does not match the current stored value. + uid: + type: string + description: |- + A globally unique ID for the entity. + This field can not be set by the user at creation time, and the server + will reject an attempt to do so. The field will be populated in read + operations. The field can (optionally) be specified when performing + update or delete operations, but the server is free to reject requests + that do so in such a way that it breaks semantics. + required: + - name + description: Metadata fields common to all versions/kinds of entity. + additionalProperties: {} + EntityRelation: + type: object + properties: + targetRef: + type: string + description: The entity ref of the target of this relation. + type: + type: string + description: The type of the relation. + required: + - targetRef + - type + description: A relation of a specific type to another entity in the catalog. + additionalProperties: false + Entity: + type: object + properties: + relations: + type: array + items: + $ref: '#/components/schemas/EntityRelation' + description: The relations that this entity has with other entities. + spec: + $ref: '#/components/schemas/JsonObject' + metadata: + $ref: '#/components/schemas/EntityMeta' + kind: + type: string + description: The high level entity type being described. + apiVersion: + type: string + description: |- + The version of specification format for this particular entity that + this is written against. + required: + - metadata + - kind + - apiVersion + description: The parts of the format that's common to all versions/kinds of entity. Error: type: object properties: @@ -210,10 +336,10 @@ components: additionalProperties: {} JsonPrimitive: oneOf: + - type: boolean - type: number - type: string - - type: boolean - - type: null + - nullable: true description: A type representing all allowed JSON primitive values. JsonValue: oneOf: @@ -234,43 +360,12 @@ components: items: $ref: '#/components/schemas/SerializedTask' description: The response shape for the `listTasks` call to the `scaffolder-backend` - SerializedFile: + MapStringString: type: object - properties: - path: - type: string - content: - type: string - format: byte - executable: - type: boolean - symlink: - type: boolean - required: - - path - - content - SerializedTaskEvent: - type: object - properties: - id: - type: integer - isTaskRecoverable: - type: boolean - taskId: - type: string - body: - $ref: '#/components/schemas/JsonObject' - type: - $ref: '#/components/schemas/TaskEventType' - createdAt: - type: string - required: - - id - - taskId - - body - - type - - createdAt - description: SerializedTaskEvent + properties: {} + additionalProperties: + type: string + description: Construct a type with a set of properties K of type T ScaffolderScaffoldOptions: type: object properties: @@ -288,17 +383,19 @@ components: - templateRef - values description: The input options to the `scaffold` method of the `ScaffolderClient`. + # come back to this one - done + # check generated - done Schema: type: object properties: - $id: - type: string + # $id: + # type: string id: type: string - $schema: - type: string - $ref: - type: string + # $schema: + # type: string + # $ref: + # type: string title: type: string description: @@ -322,7 +419,7 @@ components: minLength: type: integer pattern: - type: string + type: object additionalItems: oneOf: - type: boolean @@ -373,24 +470,12 @@ components: - type: array items: type: string - const: - oneOf: - - type: string - - type: number - - type: boolean - - type: array - - type: object - nullable: true - enum: - type: array - items: - oneOf: - - type: string - - type: number - - type: boolean - - type: array - - type: object - nullable: true + # const: + # type: object + # enum: + # type: array + # items: + # type: object type: oneOf: - type: string @@ -413,12 +498,50 @@ components: $ref: '#/components/schemas/Schema' not: $ref: '#/components/schemas/Schema' - if: - $ref: '#/components/schemas/Schema' + # if: + # $ref: '#/components/schemas/Schema' then: $ref: '#/components/schemas/Schema' - else: - $ref: '#/components/schemas/Schema' + # else: + # $ref: '#/components/schemas/Schema' + additionalProperties: {} + SerializedFile: + type: object + properties: + path: + type: string + content: + type: string + format: byte + executable: + type: boolean + symlink: + type: boolean + required: + - path + - content + SerializedTaskEvent: + type: object + properties: + id: + type: integer + isTaskRecoverable: + type: boolean + taskId: + type: string + body: + $ref: '#/components/schemas/JsonObject' + type: + $ref: '#/components/schemas/TaskEventType' + createdAt: + type: string + required: + - id + - taskId + - body + - type + - createdAt + description: SerializedTaskEvent SerializedTask: type: object properties: @@ -454,14 +577,17 @@ components: - recovered TaskRecovery: type: object - properties: - EXPERIMENTAL_strategy: - $ref: '#/components/schemas/TaskRecoverStrategy' + # properties: + # come back to this one - done + # EXPERIMENTAL_strategy: + # $ref: '#/components/schemas/TaskRecoverStrategy' description: |- When task didn't have a chance to complete due to system restart you can define the strategy what to do with such tasks, by defining a strategy. By default, it is none, what means to not recover but updating the status from 'processing' to 'failed'. + additionalProperties: + $ref: '#/components/schemas/TaskRecoverStrategy' TaskRecoverStrategy: type: string description: | @@ -475,9 +601,8 @@ components: properties: backstageToken: type: string - additionalProperties: - type: string description: TaskSecrets + additionalProperties: {} TaskSpec: $ref: '#/components/schemas/TaskSpecV1beta3' TaskSpecV1beta3: @@ -522,9 +647,10 @@ components: type: string description: An entity ref for the author of the task description: Some decoration of the author of the task that should be available in the context - EXPERIMENTAL_recovery: - $ref: '#/components/schemas/TaskRecovery' - description: How to recover the task after system restart or system crash. + # come back to this one - done + # EXPERIMENTAL_recovery: + # $ref: '#/components/schemas/TaskRecovery' + # description: How to recover the task after system restart or system crash. required: - apiVersion - parameters @@ -533,6 +659,8 @@ components: description: |- A scaffolder task as stored in the database, generated from a v1beta3 apiVersion Template. + additionalProperties: + $ref: '#/components/schemas/TaskRecovery' TaskStatus: type: string enum: @@ -557,11 +685,11 @@ components: input: $ref: '#/components/schemas/JsonObject' description: Additional data that will be passed to the action. - if: - oneOf: - - type: string - - type: boolean - description: When this is false, or if the templated value string evaluates to something that is falsy the step will be skipped. + # if: + # oneOf: + # - type: string + # - type: boolean + # description: When this is false, or if the templated value string evaluates to something that is falsy the step will be skipped. each: oneOf: - type: string @@ -572,6 +700,7 @@ components: - name - action description: An individual step of a scaffolder task, as stored in the database. + additionalProperties: {} TemplateEntityStepV1beta3: allOf: - $ref: '#/components/schemas/JsonObject' @@ -585,18 +714,21 @@ components: type: string input: $ref: '#/components/schemas/JsonObject' - if: - oneOf: - - type: string - - type: boolean - backstage:permissions: - $ref: '#/components/schemas/TemplatePermissionsV1beta3' + # if: + # oneOf: + # - type: string + # - type: boolean + # come back to this one - done + # backstage:permissions: + # $ref: '#/components/schemas/TemplatePermissionsV1beta3' required: - action description: Step that is part of a Template Entity. + additionalProperties: {} TemplateEntityV1beta3: allOf: - - $ref: '../../../catalog-backend/src/schema/openapi.yaml#/components/schemas/Entity' + # come back to this one - done + - $ref: '#/components/schemas/Entity' - type: object properties: apiVersion: @@ -616,9 +748,10 @@ components: presentation: $ref: '#/components/schemas/TemplatePresentationV1beta3' description: Template specific configuration of the presentation layer. - EXPERIMENTAL_recovery: - $ref: '#/components/schemas/TemplateRecoveryV1beta3' - description: Recovery strategy for the template + # come back to this one - done + # EXPERIMENTAL_recovery: + # $ref: '#/components/schemas/TemplateRecoveryV1beta3' + # description: Recovery strategy for the template parameters: oneOf: - $ref: '#/components/schemas/TemplateParametersV1beta3' @@ -648,6 +781,7 @@ components: - type - steps description: The specification of the Template Entity + additionalProperties: {} required: - apiVersion - kind @@ -669,7 +803,8 @@ components: description: The Template entity. properties: metadata: - $ref: '../../../catalog-backend/src/schema/openapi.yaml#/components/schemas/EntityMeta' + # come back to this one - done + $ref: '#/components/schemas/EntityMeta' description: The metadata of the Template. required: - entityRef @@ -681,37 +816,56 @@ components: properties: title: type: string - description: - type: string presentation: $ref: '#/components/schemas/TemplatePresentationV1beta3' + description: + type: string + # come back to this one - done + # 'ui:options': + # $ref: '#/components/schemas/JsonValue' steps: type: array items: type: object properties: title: - type: string + $ref: '#/components/schemas/JsonValue' description: - type: string + $ref: '#/components/schemas/JsonValue' schema: - $ref: '#/components/schemas/JsonObject' + $ref: '#/components/schemas/TemplateParametersV1beta3' required: - title - schema + # come back to this one - done + # EXPERIMENTAL_formDecorators: + # type: array + # items: + # - type: object + # properties: + # id: + # type: string + # input: + # $ref: '#/components/schemas/JsonObject' required: - title - steps description: |- The shape of each entry of parameters which gets rendered as a separate step in the wizard input + additionalProperties: {} + # check generated TemplateParametersV1beta3: allOf: - $ref: '#/components/schemas/JsonObject' + # - type: object + # properties: + # # come back to this one - done + # backstage:permissions: + # $ref: '#/components/schemas/TemplatePermissionsV1beta3' - type: object - properties: - backstage:permissions: - $ref: '#/components/schemas/TemplatePermissionsV1beta3' + additionalProperties: + $ref: '#/components/schemas/TemplatePermissionsV1beta3' description: Parameter that is part of a Template Entity. TemplatePermissionsV1beta3: allOf: @@ -742,17 +896,64 @@ components: additionalProperties: false description: The presentation of the template. additionalProperties: {} + # check generated TemplateRecoveryV1beta3: allOf: - $ref: '#/components/schemas/JsonObject' - - type: string - enum: - - none - - startOver - description: |- - none - not recover, let the task be marked as failed - startOver - do recover, start the execution of the task from the first step. + - type: object + # properties: + # # come back to this one - done + # EXPERIMENTAL_strategy: + # type: string + # enum: + # - none + # - startOver + # description: |- + # none - not recover, let the task be marked as failed + # startOver - do recover, start the execution of the task from the first step. + additionalProperties: + type: string + enum: + - none + - startOver + description: |- + none - not recover, let the task be marked as failed + startOver - do recover, start the execution of the task from the first step. description: Depends on how you designed your task you might tailor the behaviour for each of them. + ValidationError: + type: object + properties: + path: + type: array + items: + oneOf: + - type: string + - type: integer + property: + type: string + message: + type: string + schema: + oneOf: + - type: string + - $ref: '#/components/schemas/Schema' + instance: + type: object + name: + type: string + argument: + type: object + stack: + type: string + required: + - path + - property + - message + - schema + - instance + - name + - argument + - stack securitySchemes: JWT: type: http @@ -812,7 +1013,12 @@ paths: security: - {} - JWT: [] - parameters: [] + parameters: + - $ref: '#/components/parameters/createdBy' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/order' + - $ref: '#/components/parameters/status' post: operationId: Scaffold description: |- @@ -835,7 +1041,18 @@ paths: id: type: string '400': - $ref: '#/components/responses/ValidationError' + description: Validation errors. + content: + application/json: + schema: + type: object + properties: + errors: + type: array + items: + $ref: '#/components/schemas/ValidationError' + required: + - errors security: - {} - JWT: [] @@ -966,48 +1183,51 @@ paths: content: application/json: schema: - type: object allOf: - $ref: '#/components/schemas/DryRunResult' - type: object properties: steps: + type: array + items: + allOf: + - $ref: '#/components/schemas/TemplateEntityStepV1beta3' + - type: object + properties: + id: + type: string + name: + type: string + required: + - id + - name + directoryContents: type: array items: type: object properties: - id: + path: type: string - name: + executable: + type: boolean + base64Content: type: string - action: - type: string - input: - $ref: '#/components/schemas/JsonObject' - if: - oneOf: - - type: string - - type: boolean - backstage:permissions: - $ref: '#/components/schemas/TemplatePermissionsV1beta3' required: - - id - - name - - action - directoryContents: - type: object - properties: - path: - type: string - executable: - type: boolean - base64Content: - type: string - required: - - path - - base64Content + - path + - base64Content '400': - $ref: '#/components/responses/ValidationError' + description: Validation errors. + content: + application/json: + schema: + type: object + properties: + errors: + type: array + items: + $ref: '#/components/schemas/ValidationError' + required: + - errors parameters: [] /v2/autocomplete/{provider}/{resource}: @@ -1027,6 +1247,9 @@ paths: type: string token: type: string + required: + - context + - token responses: '200': description: Ok diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts new file mode 100644 index 0000000000..76c18a22f0 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts @@ -0,0 +1,167 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Action } from '../models/Action.model'; +import { Autocomplete200Response } from '../models/Autocomplete200Response.model'; +import { AutocompleteRequest } from '../models/AutocompleteRequest.model'; +import { CancelTask200Response } from '../models/CancelTask200Response.model'; +import { DryRun200Response } from '../models/DryRun200Response.model'; +import { DryRunRequest } from '../models/DryRunRequest.model'; +import { ListTasksResponse } from '../models/ListTasksResponse.model'; +import { Scaffold201Response } from '../models/Scaffold201Response.model'; +import { Scaffold400Response } from '../models/Scaffold400Response.model'; +import { ScaffolderScaffoldOptions } from '../models/ScaffolderScaffoldOptions.model'; +import { SerializedTask } from '../models/SerializedTask.model'; +import { SerializedTaskEvent } from '../models/SerializedTaskEvent.model'; +import { TemplateParameterSchema } from '../models/TemplateParameterSchema.model'; + +/** + * @public + */ +export type Autocomplete = { + path: { + provider: string; + resource: string; + }; + body: AutocompleteRequest; + response: Autocomplete200Response; +}; +/** + * @public + */ +export type CancelTask = { + path: { + taskId: string; + }; + response: CancelTask200Response; +}; +/** + * @public + */ +export type DryRun = { + body: DryRunRequest; + response: DryRun200Response | Scaffold400Response; +}; +/** + * @public + */ +export type GetTask = { + path: { + taskId: string; + }; + response: SerializedTask; +}; +/** + * @public + */ +export type GetTemplateParameterSchema = { + path: { + namespace: string; + kind: string; + name: string; + }; + response: TemplateParameterSchema | Error | Error; +}; +/** + * @public + */ +export type ListActions = { + response: Array; +}; +/** + * @public + */ +export type ListTasks = { + query: { + createdBy?: string; + limit?: number; + offset?: number; + order?: 'asc' | 'desc'; + status?: string; + }; + response: ListTasksResponse; +}; +/** + * @public + */ +export type Retry = { + path: { + taskId: string; + }; + response: Scaffold201Response; +}; +/** + * @public + */ +export type Scaffold = { + body: ScaffolderScaffoldOptions; + response: Scaffold201Response | Scaffold400Response; +}; +/** + * @public + */ +export type StreamLogsEventStream = { + path: { + taskId: string; + }; + query: { + after?: number; + }; + response: string; +}; +/** + * @public + */ +export type StreamLogsPolling = { + path: { + taskId: string; + }; + query: { + after?: number; + }; + response: Array; +}; + +/** + * no description + */ + +export type EndpointMap = { + '#post|/v2/autocomplete/{provider}/{resource}': Autocomplete; + + '#post|/v2/tasks/{taskId}/cancel': CancelTask; + + '#post|/v2/dry-run': DryRun; + + '#get|/v2/tasks/{taskId}': GetTask; + + '#get|/v2/templates/{namespace}/{kind}/{name}/parameter-schema': GetTemplateParameterSchema; + + '#get|/v2/actions': ListActions; + + '#get|/v2/tasks': ListTasks; + + '#post|/v2/tasks/{taskId}/retry': Retry; + + '#post|/v2/tasks': Scaffold; + + '#get|/v2/tasks/{taskId}/eventstream': StreamLogsEventStream; + + '#get|/v2/tasks/{taskId}/events': StreamLogsPolling; +}; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts new file mode 100644 index 0000000000..79855a6fc8 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './DefaultApi.server'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/index.ts new file mode 100644 index 0000000000..69c39313c6 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './apis'; +export * from './router'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Action.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Action.model.ts new file mode 100644 index 0000000000..8e86b8b338 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Action.model.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ActionExample } from '../models/ActionExample.model'; +import { ActionSchema } from '../models/ActionSchema.model'; + +/** + * The response shape for a single action in the `listActions` call to the `scaffolder-backend` + * @public + */ +export interface Action { + id: string; + description?: string; + examples?: Array; + schema?: ActionSchema; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionExample.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionExample.model.ts new file mode 100644 index 0000000000..cf2ffeaf8a --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionExample.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A single action example + * @public + */ +export interface ActionExample { + description: string; + example: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionSchema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionSchema.model.ts new file mode 100644 index 0000000000..037d2fff44 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionSchema.model.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ActionSchema { + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; + /** + * A type representing all allowed JSON object values. + */ + output?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts new file mode 100644 index 0000000000..cad9a0dd29 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Autocomplete200ResponseResultsInner } from '../models/Autocomplete200ResponseResultsInner.model'; + +/** + * @public + */ +export interface Autocomplete200Response { + results?: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts new file mode 100644 index 0000000000..bc8ea23cbb --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface Autocomplete200ResponseResultsInner { + title?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/AutocompleteRequest.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/AutocompleteRequest.model.ts new file mode 100644 index 0000000000..d9ab409224 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/AutocompleteRequest.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface AutocompleteRequest { + context: { [key: string]: string }; + token: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/CancelTask200Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/CancelTask200Response.model.ts new file mode 100644 index 0000000000..745ca8074e --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/CancelTask200Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TaskStatus } from '../models/TaskStatus.model'; + +/** + * @public + */ +export interface CancelTask200Response { + status?: TaskStatus; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts new file mode 100644 index 0000000000..92b8d723a0 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DryRun200ResponseAllOfDirectoryContentsInner } from '../models/DryRun200ResponseAllOfDirectoryContentsInner.model'; +import { DryRun200ResponseAllOfStepsInner } from '../models/DryRun200ResponseAllOfStepsInner.model'; +import { DryRunResultLogInner } from '../models/DryRunResultLogInner.model'; + +/** + * @public + */ +export interface DryRun200Response { + log: Array; + directoryContents: Array; + /** + * A type representing all allowed JSON object values. + */ + output: { [key: string]: any }; + steps?: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts new file mode 100644 index 0000000000..553c6f765a --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DryRun200ResponseAllOfDirectoryContentsInner } from '../models/DryRun200ResponseAllOfDirectoryContentsInner.model'; +import { DryRun200ResponseAllOfStepsInner } from '../models/DryRun200ResponseAllOfStepsInner.model'; + +/** + * @public + */ +export interface DryRun200ResponseAllOf { + steps?: Array; + directoryContents?: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts new file mode 100644 index 0000000000..27174b9b0e --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRun200ResponseAllOfDirectoryContentsInner { + path: string; + executable?: boolean; + base64Content: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts new file mode 100644 index 0000000000..229860f81a --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRun200ResponseAllOfStepsInner { + id: string; + name: string; + action: string; + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts new file mode 100644 index 0000000000..6416143493 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRun200ResponseAllOfStepsInnerAllOf { + id: string; + name: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts new file mode 100644 index 0000000000..510e7fa353 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DryRunRequestDirectoryContentsInner } from '../models/DryRunRequestDirectoryContentsInner.model'; +import { TemplateEntityV1beta3 } from '../models/TemplateEntityV1beta3.model'; + +/** + * @public + */ +export interface DryRunRequest { + template: TemplateEntityV1beta3; + values: any; + secrets?: any; + directoryContents: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts new file mode 100644 index 0000000000..edf90d403d --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRunRequestDirectoryContentsInner { + path?: string; + base64Content?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResult.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResult.model.ts new file mode 100644 index 0000000000..66e35bd9e5 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResult.model.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DryRunResultLogInner } from '../models/DryRunResultLogInner.model'; +import { SerializedFile } from '../models/SerializedFile.model'; + +/** + * @public + */ +export interface DryRunResult { + log: Array; + directoryContents: Array; + /** + * A type representing all allowed JSON object values. + */ + output: { [key: string]: any }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts new file mode 100644 index 0000000000..0f987091c0 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRunResultLogInner { + /** + * A type representing all allowed JSON object values. + */ + body?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Entity.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Entity.model.ts new file mode 100644 index 0000000000..f386f3dd17 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Entity.model.ts @@ -0,0 +1,45 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { EntityMeta } from '../models/EntityMeta.model'; +import { EntityRelation } from '../models/EntityRelation.model'; + +/** + * The parts of the format that's common to all versions/kinds of entity. + * @public + */ +export interface Entity { + /** + * The relations that this entity has with other entities. + */ + relations?: Array; + /** + * A type representing all allowed JSON object values. + */ + spec?: { [key: string]: any }; + metadata: EntityMeta; + /** + * The high level entity type being described. + */ + kind: string; + /** + * The version of specification format for this particular entity that this is written against. + */ + apiVersion: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityLink.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityLink.model.ts new file mode 100644 index 0000000000..53d7d1f9ff --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityLink.model.ts @@ -0,0 +1,42 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A link to external information that is related to the entity. + * @public + */ +export interface EntityLink { + /** + * An optional value to categorize links into specific groups + */ + type?: string; + /** + * An optional semantic key that represents a visual icon. + */ + icon?: string; + /** + * An optional descriptive title for the link. + */ + title?: string; + /** + * The url to the external site, document, etc. + */ + url: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityMeta.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityMeta.model.ts new file mode 100644 index 0000000000..cc8dd555a6 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityMeta.model.ts @@ -0,0 +1,69 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { EntityLink } from '../models/EntityLink.model'; + +/** + * Metadata fields common to all versions/kinds of entity. + * @public + */ +export interface EntityMeta { + [key: string]: any; + + /** + * A list of external hyperlinks related to the entity. + */ + links?: Array; + /** + * A list of single-valued strings, to for example classify catalog entities in various ways. + */ + tags?: Array; + /** + * Construct a type with a set of properties K of type T + */ + annotations?: { [key: string]: string }; + /** + * Construct a type with a set of properties K of type T + */ + labels?: { [key: string]: string }; + /** + * A short (typically relatively few words, on one line) description of the entity. + */ + description?: string; + /** + * A display name of the entity, to be presented in user interfaces instead of the `name` property above, when available. This field is sometimes useful when the `name` is cumbersome or ends up being perceived as overly technical. The title generally does not have as stringent format requirements on it, so it may contain special characters and be more explanatory. Do keep it very short though, and avoid situations where a title can be confused with the name of another entity, or where two entities share a title. Note that this is only for display purposes, and may be ignored by some parts of the code. Entity references still always make use of the `name` property, not the title. + */ + title?: string; + /** + * The namespace that the entity belongs to. + */ + namespace?: string; + /** + * The name of the entity. Must be unique within the catalog at any given point in time, for any given namespace + kind pair. This value is part of the technical identifier of the entity, and as such it will appear in URLs, database tables, entity references, and similar. It is subject to restrictions regarding what characters are allowed. If you want to use a different, more human readable string with fewer restrictions on it in user interfaces, see the `title` field below. + */ + name: string; + /** + * An opaque string that changes for each update operation to any part of the entity, including metadata. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, and the server will then reject the operation if it does not match the current stored value. + */ + etag?: string; + /** + * A globally unique ID for the entity. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, but the server is free to reject requests that do so in such a way that it breaks semantics. + */ + uid?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityRelation.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityRelation.model.ts new file mode 100644 index 0000000000..fe98a84481 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityRelation.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A relation of a specific type to another entity in the catalog. + * @public + */ +export interface EntityRelation { + /** + * The entity ref of the target of this relation. + */ + targetRef: string; + /** + * The type of the relation. + */ + type: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorError.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorError.model.ts new file mode 100644 index 0000000000..fe5811628d --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorError.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorError { + name: string; + message: string; + stack?: string; + code?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts new file mode 100644 index 0000000000..d44dcb66d9 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorRequest { + method: string; + url: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts new file mode 100644 index 0000000000..91c120483d --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorResponse { + statusCode: number; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonPrimitive.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonPrimitive.model.ts new file mode 100644 index 0000000000..6ca5d5144b --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonPrimitive.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A type representing all allowed JSON primitive values. + * @public + */ +export type JsonPrimitive = any | boolean | number | string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonValue.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonValue.model.ts new file mode 100644 index 0000000000..9527b6828d --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonValue.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonPrimitive } from '../models/JsonPrimitive.model'; + +/** + * A type representing all allowed JSON values. + * @public + */ +export type JsonValue = + | Array + | JsonPrimitive + | { [key: string]: any }; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts new file mode 100644 index 0000000000..65a3a04bec --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { SerializedTask } from '../models/SerializedTask.model'; + +/** + * The response shape for the `listTasks` call to the `scaffolder-backend` + * @public + */ +export interface ListTasksResponse { + tasks?: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ModelError.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ModelError.model.ts new file mode 100644 index 0000000000..5526d703e6 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ModelError.model.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ErrorError } from '../models/ErrorError.model'; +import { ErrorRequest } from '../models/ErrorRequest.model'; +import { ErrorResponse } from '../models/ErrorResponse.model'; + +/** + * @public + */ +export interface ModelError { + [key: string]: any; + + error: ErrorError; + request?: ErrorRequest; + response: ErrorResponse; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts new file mode 100644 index 0000000000..9ff2cc8494 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface Scaffold201Response { + id?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold400Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold400Response.model.ts new file mode 100644 index 0000000000..515c5b6de3 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold400Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ValidationError } from '../models/ValidationError.model'; + +/** + * @public + */ +export interface Scaffold400Response { + errors: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts new file mode 100644 index 0000000000..68b9927966 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonValue } from '../models/JsonValue.model'; + +/** + * The input options to the `scaffold` method of the `ScaffolderClient`. + * @public + */ +export interface ScaffolderScaffoldOptions { + templateRef: string; + values: { [key: string]: JsonValue }; + secrets?: { [key: string]: string }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Schema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Schema.model.ts new file mode 100644 index 0000000000..0e24d46c30 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Schema.model.ts @@ -0,0 +1,64 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { SchemaAdditionalItems } from '../models/SchemaAdditionalItems.model'; +import { SchemaDependenciesValue } from '../models/SchemaDependenciesValue.model'; +import { SchemaExclusiveMaximum } from '../models/SchemaExclusiveMaximum.model'; +import { SchemaItems } from '../models/SchemaItems.model'; +import { SchemaRequired } from '../models/SchemaRequired.model'; +import { SchemaType } from '../models/SchemaType.model'; + +/** + * @public + */ +export interface Schema { + [key: string]: any; + + id?: string; + title?: string; + description?: string; + multipleOf?: number; + maximum?: number; + exclusiveMaximum?: SchemaExclusiveMaximum; + minimum?: number; + exclusiveMinimum?: SchemaExclusiveMaximum; + maxLength?: number; + minLength?: number; + pattern?: any; + additionalItems?: SchemaAdditionalItems; + items?: SchemaItems; + maxItems?: number; + minItems?: number; + uniqueItems?: boolean; + maxProperties?: number; + minProperties?: number; + required?: SchemaRequired; + additionalProperties?: SchemaAdditionalItems; + definitions?: { [key: string]: Schema }; + properties?: { [key: string]: Schema }; + patternProperties?: { [key: string]: Schema }; + dependencies?: { [key: string]: SchemaDependenciesValue }; + type?: SchemaType; + format?: string; + allOf?: Array; + anyOf?: Array; + oneOf?: Array; + not?: Schema; + then?: Schema; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts new file mode 100644 index 0000000000..2039e2f9bb --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Schema } from '../models/Schema.model'; + +/** + * @public + */ +export type SchemaAdditionalItems = Schema | boolean; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts new file mode 100644 index 0000000000..97609dda50 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Schema } from '../models/Schema.model'; + +/** + * @public + */ +export type SchemaDependenciesValue = Array | Schema; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts new file mode 100644 index 0000000000..c22a44e80b --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type SchemaExclusiveMaximum = boolean | number; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaItems.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaItems.model.ts new file mode 100644 index 0000000000..c63c6700aa --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaItems.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Schema } from '../models/Schema.model'; + +/** + * @public + */ +export type SchemaItems = Array | Schema; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaRequired.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaRequired.model.ts new file mode 100644 index 0000000000..b1b879cb3b --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaRequired.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type SchemaRequired = Array | boolean; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaType.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaType.model.ts new file mode 100644 index 0000000000..dd0cbb93db --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaType.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type SchemaType = Array | string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedFile.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedFile.model.ts new file mode 100644 index 0000000000..d2bdfc72de --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedFile.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface SerializedFile { + path: string; + content: string; + executable?: boolean; + symlink?: boolean; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts new file mode 100644 index 0000000000..7ba1196cab --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts @@ -0,0 +1,40 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TaskSecrets } from '../models/TaskSecrets.model'; +import { TaskSpecV1beta3 } from '../models/TaskSpecV1beta3.model'; +import { TaskStatus } from '../models/TaskStatus.model'; + +/** + * SerializedTask + * @public + */ +export interface SerializedTask { + id: string; + spec: TaskSpecV1beta3; + status: TaskStatus; + createdAt: string; + lastHeartbeatAt?: string; + createdBy?: string; + secrets?: TaskSecrets; + /** + * A type representing all allowed JSON object values. + */ + state?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts new file mode 100644 index 0000000000..484688e324 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts @@ -0,0 +1,36 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TaskEventType } from '../models/TaskEventType.model'; + +/** + * SerializedTaskEvent + * @public + */ +export interface SerializedTaskEvent { + id: number; + isTaskRecoverable?: boolean; + taskId: string; + /** + * A type representing all allowed JSON object values. + */ + body: { [key: string]: any }; + type: TaskEventType; + createdAt: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts new file mode 100644 index 0000000000..8531d19de8 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type TaskEventType = 'completion' | 'log' | 'cancelled' | 'recovered'; + +/** + * @public + */ +export const TaskEventType = { + Completion: 'completion' as TaskEventType, + Log: 'log' as TaskEventType, + Cancelled: 'cancelled' as TaskEventType, + Recovered: 'recovered' as TaskEventType, +}; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts new file mode 100644 index 0000000000..e00b2dfa88 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type TaskRecoverStrategy = 'none' | 'startOver'; + +/** + * @public + */ +export const TaskRecoverStrategy = { + None: 'none' as TaskRecoverStrategy, + StartOver: 'startOver' as TaskRecoverStrategy, +}; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts new file mode 100644 index 0000000000..ae7c6a891c --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * TaskSecrets + * @public + */ +export interface TaskSecrets { + [key: string]: any; + + backstageToken?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts new file mode 100644 index 0000000000..bb32940062 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts @@ -0,0 +1,55 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonValue } from '../models/JsonValue.model'; +import { TaskSpecV1beta3User } from '../models/TaskSpecV1beta3User.model'; +import { TaskStep } from '../models/TaskStep.model'; +import { TemplateInfo } from '../models/TemplateInfo.model'; + +/** + * A scaffolder task as stored in the database, generated from a v1beta3 apiVersion Template. + * @public + */ +export interface TaskSpecV1beta3 { + [key: string]: any; + + /** + * The apiVersion string of the TaskSpec. + */ + apiVersion: TaskSpecV1beta3ApiVersionEnum; + /** + * A type representing all allowed JSON object values. + */ + parameters: { [key: string]: any }; + /** + * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying javascript action and some optional input parameters that may or may not have been collected from the end user. + */ + steps: Array; + /** + * The output is an object where template authors can pull out information from template actions and return them in a known standard way. + */ + output: { [key: string]: JsonValue }; + templateInfo?: TemplateInfo; + user?: TaskSpecV1beta3User; +} + +/** + * @public + */ +export type TaskSpecV1beta3ApiVersionEnum = 'scaffolder.backstage.io/v1beta3'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts new file mode 100644 index 0000000000..7f36a3f171 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Some decoration of the author of the task that should be available in the context + * @public + */ +export interface TaskSpecV1beta3User { + /** + * The decorated entity from the Catalog + */ + entity?: { [key: string]: any }; + /** + * An entity ref for the author of the task + */ + ref?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts new file mode 100644 index 0000000000..42f8137fb3 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts @@ -0,0 +1,40 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type TaskStatus = + | 'cancelled' + | 'completed' + | 'failed' + | 'open' + | 'processing'; + +/** + * @public + */ +export const TaskStatus = { + Cancelled: 'cancelled' as TaskStatus, + Completed: 'completed' as TaskStatus, + Failed: 'failed' as TaskStatus, + Open: 'open' as TaskStatus, + Processing: 'processing' as TaskStatus, +}; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStep.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStep.model.ts new file mode 100644 index 0000000000..c36049b9a6 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStep.model.ts @@ -0,0 +1,46 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TaskStepEach } from '../models/TaskStepEach.model'; + +/** + * An individual step of a scaffolder task, as stored in the database. + * @public + */ +export interface TaskStep { + [key: string]: any; + + /** + * A unique identifier for this step. + */ + id: string; + /** + * A display name to show the user. + */ + name: string; + /** + * The underlying action ID that will be called as part of running this step. + */ + action: string; + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; + each?: TaskStepEach; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStepEach.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStepEach.model.ts new file mode 100644 index 0000000000..398a19ee88 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStepEach.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonValue } from '../models/JsonValue.model'; + +/** + * Run step repeatedly. + * @public + */ +export type TaskStepEach = Array | string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts new file mode 100644 index 0000000000..e125c46f1d --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Step that is part of a Template Entity. + * @public + */ +export interface TemplateEntityStepV1beta3 { + [key: string]: any; + + id?: string; + name?: string; + action: string; + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts new file mode 100644 index 0000000000..dfba72bf8d --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface TemplateEntityStepV1beta3AllOf { + id?: string; + name?: string; + action: string; + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts new file mode 100644 index 0000000000..efe325cfeb --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts @@ -0,0 +1,53 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { EntityMeta } from '../models/EntityMeta.model'; +import { EntityRelation } from '../models/EntityRelation.model'; +import { TemplateEntityV1beta3AllOfSpec } from '../models/TemplateEntityV1beta3AllOfSpec.model'; + +/** + * Backstage catalog Template kind Entity. Templates are used by the Scaffolder plugin to create new entities, such as Components. + * @public + */ +export interface TemplateEntityV1beta3 { + /** + * The relations that this entity has with other entities. + */ + relations?: Array; + spec: TemplateEntityV1beta3AllOfSpec; + metadata: EntityMeta; + /** + * The kind of the entity + */ + kind: TemplateEntityV1beta3KindEnum; + /** + * The apiVersion string of the TaskSpec. + */ + apiVersion: TemplateEntityV1beta3ApiVersionEnum; +} + +/** + * @public + */ +export type TemplateEntityV1beta3KindEnum = 'Template'; +/** + * @public + */ +export type TemplateEntityV1beta3ApiVersionEnum = + 'scaffolder.backstage.io/v1beta3'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts new file mode 100644 index 0000000000..acc9f8c991 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts @@ -0,0 +1,45 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateEntityV1beta3AllOfSpec } from '../models/TemplateEntityV1beta3AllOfSpec.model'; + +/** + * @public + */ +export interface TemplateEntityV1beta3AllOf { + /** + * The apiVersion string of the TaskSpec. + */ + apiVersion: TemplateEntityV1beta3AllOfApiVersionEnum; + /** + * The kind of the entity + */ + kind: TemplateEntityV1beta3AllOfKindEnum; + spec: TemplateEntityV1beta3AllOfSpec; +} + +/** + * @public + */ +export type TemplateEntityV1beta3AllOfApiVersionEnum = + 'scaffolder.backstage.io/v1beta3'; +/** + * @public + */ +export type TemplateEntityV1beta3AllOfKindEnum = 'Template'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts new file mode 100644 index 0000000000..3fa0063e08 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts @@ -0,0 +1,49 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateEntityStepV1beta3 } from '../models/TemplateEntityStepV1beta3.model'; +import { TemplateEntityV1beta3AllOfSpecParameters } from '../models/TemplateEntityV1beta3AllOfSpecParameters.model'; +import { TemplatePresentationV1beta3 } from '../models/TemplatePresentationV1beta3.model'; + +/** + * The specification of the Template Entity + * @public + */ +export interface TemplateEntityV1beta3AllOfSpec { + [key: string]: any; + + /** + * The type that the Template will create. For example service, website or library. + */ + type: string; + presentation?: TemplatePresentationV1beta3; + parameters?: TemplateEntityV1beta3AllOfSpecParameters; + /** + * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying javascript action and some optional input parameters that may or may not have been collected from the end user. + */ + steps: Array; + /** + * The output is an object where template authors can pull out information from template actions and return them in a known standard way. + */ + output?: { [key: string]: string }; + /** + * The owner entityRef of the TemplateEntity + */ + owner?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts new file mode 100644 index 0000000000..1444a74e19 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.model'; + +/** + * This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend to collect user input and validate it against that schema. This can then be used in the `steps` part below to template variables passed from the user into each action in the template. + * @public + */ +export type TemplateEntityV1beta3AllOfSpecParameters = + | Array + | TemplateParametersV1beta3; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfo.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfo.model.ts new file mode 100644 index 0000000000..ea5b9da6e9 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfo.model.ts @@ -0,0 +1,36 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateInfoEntity } from '../models/TemplateInfoEntity.model'; + +/** + * Information about a template that is stored on a task specification. Includes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition + * @public + */ +export interface TemplateInfo { + /** + * The entityRef of the template. + */ + entityRef: string; + /** + * Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths. + */ + baseUrl?: string; + entity?: TemplateInfoEntity; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts new file mode 100644 index 0000000000..b59414f80f --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { EntityMeta } from '../models/EntityMeta.model'; + +/** + * The Template entity. + * @public + */ +export interface TemplateInfoEntity { + metadata?: EntityMeta; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts new file mode 100644 index 0000000000..aab495d098 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateParameterSchemaStepsInner } from '../models/TemplateParameterSchemaStepsInner.model'; +import { TemplatePresentationV1beta3 } from '../models/TemplatePresentationV1beta3.model'; + +/** + * The shape of each entry of parameters which gets rendered as a separate step in the wizard input + * @public + */ +export interface TemplateParameterSchema { + [key: string]: any; + + title: string; + presentation?: TemplatePresentationV1beta3; + description?: string; + steps: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts new file mode 100644 index 0000000000..2f170b6fc6 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonValue } from '../models/JsonValue.model'; +import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.model'; + +/** + * @public + */ +export interface TemplateParameterSchemaStepsInner { + title: JsonValue; + description?: JsonValue; + schema: TemplateParametersV1beta3; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts new file mode 100644 index 0000000000..e106f9a1de --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Parameter that is part of a Template Entity. + * @public + */ +export interface TemplateParametersV1beta3 {} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts new file mode 100644 index 0000000000..68c2df70a8 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Access control properties for parts of a template. + * @public + */ +export interface TemplatePermissionsV1beta3 { + tags?: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts new file mode 100644 index 0000000000..c7eda5cd8a --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface TemplatePermissionsV1beta3AllOf { + tags?: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts new file mode 100644 index 0000000000..83405f15aa --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplatePresentationV1beta3ButtonLabels } from '../models/TemplatePresentationV1beta3ButtonLabels.model'; + +/** + * The presentation of the template. + * @public + */ +export interface TemplatePresentationV1beta3 { + [key: string]: any; + + buttonLabels?: TemplatePresentationV1beta3ButtonLabels; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts new file mode 100644 index 0000000000..37015a5468 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts @@ -0,0 +1,38 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Overrides default buttons' text + * @public + */ +export interface TemplatePresentationV1beta3ButtonLabels { + /** + * The text for the button which leads to the previous template page + */ + backButtonText?: string; + /** + * The text for the button which starts the execution of the template + */ + createButtonText?: string; + /** + * The text for the button which opens template's review/summary + */ + reviewButtonText?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts new file mode 100644 index 0000000000..3613718ac0 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Depends on how you designed your task you might tailor the behaviour for each of them. + * @public + */ +export interface TemplateRecoveryV1beta3 {} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts new file mode 100644 index 0000000000..e37d3b4af9 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ValidationErrorPathInner } from '../models/ValidationErrorPathInner.model'; +import { ValidationErrorSchema } from '../models/ValidationErrorSchema.model'; + +/** + * @public + */ +export interface ValidationError { + path: Array; + property: string; + message: string; + schema: ValidationErrorSchema; + instance: any; + name: string; + argument: any; + stack: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts new file mode 100644 index 0000000000..397ccab3f2 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type ValidationErrorPathInner = number | string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts new file mode 100644 index 0000000000..851b031d8d --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Schema } from '../models/Schema.model'; + +/** + * @public + */ +export type ValidationErrorSchema = Schema | string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts new file mode 100644 index 0000000000..2d6d6228d7 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts @@ -0,0 +1,83 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../models/Action.model'; +export * from '../models/ActionExample.model'; +export * from '../models/ActionSchema.model'; +export * from '../models/Autocomplete200Response.model'; +export * from '../models/Autocomplete200ResponseResultsInner.model'; +export * from '../models/AutocompleteRequest.model'; +export * from '../models/CancelTask200Response.model'; +export * from '../models/DryRun200Response.model'; +export * from '../models/DryRun200ResponseAllOf.model'; +export * from '../models/DryRun200ResponseAllOfDirectoryContentsInner.model'; +export * from '../models/DryRun200ResponseAllOfStepsInner.model'; +export * from '../models/DryRun200ResponseAllOfStepsInnerAllOf.model'; +export * from '../models/DryRunRequest.model'; +export * from '../models/DryRunRequestDirectoryContentsInner.model'; +export * from '../models/DryRunResult.model'; +export * from '../models/DryRunResultLogInner.model'; +export * from '../models/Entity.model'; +export * from '../models/EntityLink.model'; +export * from '../models/EntityMeta.model'; +export * from '../models/EntityRelation.model'; +export * from '../models/ErrorError.model'; +export * from '../models/ErrorRequest.model'; +export * from '../models/ErrorResponse.model'; +export * from '../models/JsonPrimitive.model'; +export * from '../models/JsonValue.model'; +export * from '../models/ListTasksResponse.model'; +export * from '../models/ModelError.model'; +export * from '../models/Scaffold201Response.model'; +export * from '../models/Scaffold400Response.model'; +export * from '../models/ScaffolderScaffoldOptions.model'; +export * from '../models/Schema.model'; +export * from '../models/SchemaAdditionalItems.model'; +export * from '../models/SchemaDependenciesValue.model'; +export * from '../models/SchemaExclusiveMaximum.model'; +export * from '../models/SchemaItems.model'; +export * from '../models/SchemaRequired.model'; +export * from '../models/SchemaType.model'; +export * from '../models/SerializedFile.model'; +export * from '../models/SerializedTask.model'; +export * from '../models/SerializedTaskEvent.model'; +export * from '../models/TaskEventType.model'; +export * from '../models/TaskRecoverStrategy.model'; +export * from '../models/TaskSecrets.model'; +export * from '../models/TaskSpecV1beta3.model'; +export * from '../models/TaskSpecV1beta3User.model'; +export * from '../models/TaskStatus.model'; +export * from '../models/TaskStep.model'; +export * from '../models/TaskStepEach.model'; +export * from '../models/TemplateEntityStepV1beta3.model'; +export * from '../models/TemplateEntityStepV1beta3AllOf.model'; +export * from '../models/TemplateEntityV1beta3.model'; +export * from '../models/TemplateEntityV1beta3AllOf.model'; +export * from '../models/TemplateEntityV1beta3AllOfSpec.model'; +export * from '../models/TemplateEntityV1beta3AllOfSpecParameters.model'; +export * from '../models/TemplateInfo.model'; +export * from '../models/TemplateInfoEntity.model'; +export * from '../models/TemplateParameterSchema.model'; +export * from '../models/TemplateParameterSchemaStepsInner.model'; +export * from '../models/TemplateParametersV1beta3.model'; +export * from '../models/TemplatePermissionsV1beta3.model'; +export * from '../models/TemplatePermissionsV1beta3AllOf.model'; +export * from '../models/TemplatePresentationV1beta3.model'; +export * from '../models/TemplatePresentationV1beta3ButtonLabels.model'; +export * from '../models/TemplateRecoveryV1beta3.model'; +export * from '../models/ValidationError.model'; +export * from '../models/ValidationErrorPathInner.model'; +export * from '../models/ValidationErrorSchema.model'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts new file mode 100644 index 0000000000..2e11c7e7c5 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -0,0 +1,1738 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { createValidatedOpenApiRouterFromGeneratedEndpointMap } from '@backstage/backend-openapi-utils'; +import { EndpointMap } from './'; + +export const spec = { + openapi: '3.0.3', + info: { + title: 'scaffolder', + version: '1', + description: + 'The Backstage backend plugin that helps you create new things', + license: { + name: 'Apache-2.0', + url: 'http://www.apache.org/licenses/LICENSE-2.0.html', + }, + contact: {}, + }, + servers: [ + { + url: '/', + }, + ], + components: { + examples: {}, + headers: {}, + parameters: { + createdBy: { + name: 'createdBy', + in: 'query', + description: 'Created by', + required: false, + allowReserved: true, + schema: { + type: 'string', + }, + }, + eventsAfter: { + name: 'after', + in: 'query', + description: 'Offset event ID to stream events after.', + schema: { + type: 'integer', + }, + }, + kind: { + name: 'kind', + in: 'path', + required: true, + allowReserved: true, + schema: { + type: 'string', + }, + }, + limit: { + name: 'limit', + in: 'query', + description: 'Number of records to return in the response.', + required: false, + allowReserved: true, + schema: { + type: 'integer', + minimum: 0, + }, + }, + namespace: { + name: 'namespace', + in: 'path', + required: true, + allowReserved: true, + schema: { + type: 'string', + }, + }, + name: { + name: 'name', + in: 'path', + required: true, + allowReserved: true, + schema: { + type: 'string', + }, + }, + offset: { + name: 'offset', + in: 'query', + description: 'Number of records to skip in the query page.', + required: false, + allowReserved: true, + schema: { + type: 'integer', + minimum: 0, + }, + }, + order: { + name: 'order', + in: 'query', + description: 'Order', + required: false, + allowReserved: true, + schema: { + type: 'string', + enum: ['asc', 'desc'], + }, + }, + status: { + name: 'status', + in: 'query', + description: 'Status', + required: false, + allowReserved: true, + schema: { + type: 'string', + }, + }, + taskId: { + name: 'taskId', + in: 'path', + required: true, + allowReserved: true, + schema: { + type: 'string', + }, + }, + }, + requestBodies: {}, + responses: { + ErrorResponse: { + description: 'An error response from the backend.', + content: { + 'application/json; charset=utf-8': { + schema: { + $ref: '#/components/schemas/Error', + }, + }, + }, + }, + }, + schemas: { + Action: { + type: 'object', + properties: { + id: { + type: 'string', + }, + description: { + type: 'string', + }, + examples: { + type: 'array', + items: { + $ref: '#/components/schemas/ActionExample', + }, + }, + schema: { + type: 'object', + properties: { + input: { + $ref: '#/components/schemas/JsonObject', + }, + output: { + $ref: '#/components/schemas/JsonObject', + }, + }, + }, + }, + required: ['id'], + description: + 'The response shape for a single action in the `listActions` call to the `scaffolder-backend`', + }, + ActionExample: { + type: 'object', + properties: { + description: { + type: 'string', + }, + example: { + type: 'string', + }, + }, + required: ['description', 'example'], + description: 'A single action example', + }, + DryRunResult: { + type: 'object', + properties: { + log: { + type: 'array', + items: { + type: 'object', + properties: { + body: { + $ref: '#/components/schemas/JsonObject', + }, + }, + }, + }, + directoryContents: { + type: 'array', + items: { + $ref: '#/components/schemas/SerializedFile', + }, + }, + output: { + $ref: '#/components/schemas/JsonObject', + }, + }, + required: ['log', 'directoryContents', 'output'], + }, + EntityLink: { + type: 'object', + properties: { + type: { + type: 'string', + description: + 'An optional value to categorize links into specific groups', + }, + icon: { + type: 'string', + description: + 'An optional semantic key that represents a visual icon.', + }, + title: { + type: 'string', + description: 'An optional descriptive title for the link.', + }, + url: { + type: 'string', + description: 'The url to the external site, document, etc.', + }, + }, + required: ['url'], + description: + 'A link to external information that is related to the entity.', + additionalProperties: false, + }, + EntityMeta: { + type: 'object', + properties: { + links: { + type: 'array', + items: { + $ref: '#/components/schemas/EntityLink', + }, + description: 'A list of external hyperlinks related to the entity.', + }, + tags: { + type: 'array', + items: { + type: 'string', + }, + description: + 'A list of single-valued strings, to for example classify catalog entities in\nvarious ways.', + }, + annotations: { + $ref: '#/components/schemas/MapStringString', + }, + labels: { + $ref: '#/components/schemas/MapStringString', + }, + description: { + type: 'string', + description: + 'A short (typically relatively few words, on one line) description of the\nentity.', + }, + title: { + type: 'string', + description: + 'A display name of the entity, to be presented in user interfaces instead\nof the `name` property above, when available.\nThis field is sometimes useful when the `name` is cumbersome or ends up\nbeing perceived as overly technical. The title generally does not have\nas stringent format requirements on it, so it may contain special\ncharacters and be more explanatory. Do keep it very short though, and\navoid situations where a title can be confused with the name of another\nentity, or where two entities share a title.\nNote that this is only for display purposes, and may be ignored by some\nparts of the code. Entity references still always make use of the `name`\nproperty, not the title.', + }, + namespace: { + type: 'string', + description: 'The namespace that the entity belongs to.', + }, + name: { + type: 'string', + description: + 'The name of the entity.\nMust be unique within the catalog at any given point in time, for any\ngiven namespace + kind pair. This value is part of the technical\nidentifier of the entity, and as such it will appear in URLs, database\ntables, entity references, and similar. It is subject to restrictions\nregarding what characters are allowed.\nIf you want to use a different, more human readable string with fewer\nrestrictions on it in user interfaces, see the `title` field below.', + }, + etag: { + type: 'string', + description: + 'An opaque string that changes for each update operation to any part of\nthe entity, including metadata.\nThis field can not be set by the user at creation time, and the server\nwill reject an attempt to do so. The field will be populated in read\noperations. The field can (optionally) be specified when performing\nupdate or delete operations, and the server will then reject the\noperation if it does not match the current stored value.', + }, + uid: { + type: 'string', + description: + 'A globally unique ID for the entity.\nThis field can not be set by the user at creation time, and the server\nwill reject an attempt to do so. The field will be populated in read\noperations. The field can (optionally) be specified when performing\nupdate or delete operations, but the server is free to reject requests\nthat do so in such a way that it breaks semantics.', + }, + }, + required: ['name'], + description: 'Metadata fields common to all versions/kinds of entity.', + additionalProperties: {}, + }, + EntityRelation: { + type: 'object', + properties: { + targetRef: { + type: 'string', + description: 'The entity ref of the target of this relation.', + }, + type: { + type: 'string', + description: 'The type of the relation.', + }, + }, + required: ['targetRef', 'type'], + description: + 'A relation of a specific type to another entity in the catalog.', + additionalProperties: false, + }, + Entity: { + type: 'object', + properties: { + relations: { + type: 'array', + items: { + $ref: '#/components/schemas/EntityRelation', + }, + description: + 'The relations that this entity has with other entities.', + }, + spec: { + $ref: '#/components/schemas/JsonObject', + }, + metadata: { + $ref: '#/components/schemas/EntityMeta', + }, + kind: { + type: 'string', + description: 'The high level entity type being described.', + }, + apiVersion: { + type: 'string', + description: + 'The version of specification format for this particular entity that\nthis is written against.', + }, + }, + required: ['metadata', 'kind', 'apiVersion'], + description: + "The parts of the format that's common to all versions/kinds of entity.", + }, + Error: { + type: 'object', + properties: { + error: { + type: 'object', + properties: { + name: { + type: 'string', + }, + message: { + type: 'string', + }, + stack: { + type: 'string', + }, + code: { + type: 'string', + }, + }, + required: ['name', 'message'], + }, + request: { + type: 'object', + properties: { + method: { + type: 'string', + }, + url: { + type: 'string', + }, + }, + required: ['method', 'url'], + }, + response: { + type: 'object', + properties: { + statusCode: { + type: 'number', + }, + }, + required: ['statusCode'], + }, + }, + required: ['error', 'response'], + additionalProperties: {}, + }, + JsonArray: { + type: 'array', + items: { + $ref: '#/components/schemas/JsonValue', + }, + description: 'A type representing all allowed JSON array values.', + }, + JsonObject: { + type: 'object', + properties: {}, + description: 'A type representing all allowed JSON object values.', + additionalProperties: {}, + }, + JsonPrimitive: { + oneOf: [ + { + type: 'boolean', + }, + { + type: 'number', + }, + { + type: 'string', + }, + { + nullable: true, + }, + ], + description: 'A type representing all allowed JSON primitive values.', + }, + JsonValue: { + oneOf: [ + { + $ref: '#/components/schemas/JsonObject', + }, + { + $ref: '#/components/schemas/JsonArray', + }, + { + $ref: '#/components/schemas/JsonPrimitive', + }, + ], + description: 'A type representing all allowed JSON values.', + }, + ListActionsResponse: { + type: 'array', + items: { + $ref: '#/components/schemas/Action', + }, + description: + 'The response shape for the `listActions` call to the `scaffolder-backend`', + }, + ListTasksResponse: { + type: 'object', + properties: { + tasks: { + type: 'array', + items: { + $ref: '#/components/schemas/SerializedTask', + }, + }, + }, + description: + 'The response shape for the `listTasks` call to the `scaffolder-backend`', + }, + MapStringString: { + type: 'object', + properties: {}, + additionalProperties: { + type: 'string', + }, + description: 'Construct a type with a set of properties K of type T', + }, + ScaffolderScaffoldOptions: { + type: 'object', + properties: { + templateRef: { + type: 'string', + }, + values: { + type: 'object', + additionalProperties: { + $ref: '#/components/schemas/JsonValue', + }, + }, + secrets: { + type: 'object', + additionalProperties: { + type: 'string', + }, + }, + }, + required: ['templateRef', 'values'], + description: + 'The input options to the `scaffold` method of the `ScaffolderClient`.', + }, + Schema: { + type: 'object', + properties: { + id: { + type: 'string', + }, + title: { + type: 'string', + }, + description: { + type: 'string', + }, + multipleOf: { + type: 'number', + }, + maximum: { + type: 'number', + }, + exclusiveMaximum: { + oneOf: [ + { + type: 'number', + }, + { + type: 'boolean', + }, + ], + }, + minimum: { + type: 'number', + }, + exclusiveMinimum: { + oneOf: [ + { + type: 'number', + }, + { + type: 'boolean', + }, + ], + }, + maxLength: { + type: 'integer', + }, + minLength: { + type: 'integer', + }, + pattern: { + type: 'object', + }, + additionalItems: { + oneOf: [ + { + type: 'boolean', + }, + { + $ref: '#/components/schemas/Schema', + }, + ], + }, + items: { + oneOf: [ + { + $ref: '#/components/schemas/Schema', + }, + { + type: 'array', + items: { + $ref: '#/components/schemas/Schema', + }, + }, + ], + }, + maxItems: { + type: 'integer', + }, + minItems: { + type: 'integer', + }, + uniqueItems: { + type: 'boolean', + }, + maxProperties: { + type: 'integer', + }, + minProperties: { + type: 'integer', + }, + required: { + oneOf: [ + { + type: 'array', + items: { + type: 'string', + }, + }, + { + type: 'boolean', + }, + ], + }, + additionalProperties: { + oneOf: [ + { + type: 'boolean', + }, + { + $ref: '#/components/schemas/Schema', + }, + ], + }, + definitions: { + type: 'object', + additionalProperties: { + $ref: '#/components/schemas/Schema', + }, + }, + properties: { + type: 'object', + additionalProperties: { + $ref: '#/components/schemas/Schema', + }, + }, + patternProperties: { + type: 'object', + additionalProperties: { + $ref: '#/components/schemas/Schema', + }, + }, + dependencies: { + type: 'object', + additionalProperties: { + oneOf: [ + { + $ref: '#/components/schemas/Schema', + }, + { + type: 'array', + items: { + type: 'string', + }, + }, + ], + }, + }, + type: { + oneOf: [ + { + type: 'string', + }, + { + type: 'array', + items: { + type: 'string', + }, + }, + ], + }, + format: { + type: 'string', + }, + allOf: { + type: 'array', + items: { + $ref: '#/components/schemas/Schema', + }, + }, + anyOf: { + type: 'array', + items: { + $ref: '#/components/schemas/Schema', + }, + }, + oneOf: { + type: 'array', + items: { + $ref: '#/components/schemas/Schema', + }, + }, + not: { + $ref: '#/components/schemas/Schema', + }, + then: { + $ref: '#/components/schemas/Schema', + }, + }, + additionalProperties: {}, + }, + SerializedFile: { + type: 'object', + properties: { + path: { + type: 'string', + }, + content: { + type: 'string', + format: 'byte', + }, + executable: { + type: 'boolean', + }, + symlink: { + type: 'boolean', + }, + }, + required: ['path', 'content'], + }, + SerializedTaskEvent: { + type: 'object', + properties: { + id: { + type: 'integer', + }, + isTaskRecoverable: { + type: 'boolean', + }, + taskId: { + type: 'string', + }, + body: { + $ref: '#/components/schemas/JsonObject', + }, + type: { + $ref: '#/components/schemas/TaskEventType', + }, + createdAt: { + type: 'string', + }, + }, + required: ['id', 'taskId', 'body', 'type', 'createdAt'], + description: 'SerializedTaskEvent', + }, + SerializedTask: { + type: 'object', + properties: { + id: { + type: 'string', + }, + spec: { + $ref: '#/components/schemas/TaskSpec', + }, + status: { + $ref: '#/components/schemas/TaskStatus', + }, + createdAt: { + type: 'string', + }, + lastHeartbeatAt: { + type: 'string', + }, + createdBy: { + type: 'string', + }, + secrets: { + $ref: '#/components/schemas/TaskSecrets', + }, + state: { + $ref: '#/components/schemas/JsonObject', + }, + }, + required: ['id', 'spec', 'status', 'createdAt'], + description: 'SerializedTask', + }, + TaskEventType: { + type: 'string', + description: 'TaskEventType', + enum: ['completion', 'log', 'cancelled', 'recovered'], + }, + TaskRecovery: { + type: 'object', + description: + "When task didn't have a chance to complete due to system restart you can define the strategy what to do with such tasks,\nby defining a strategy.\n\nBy default, it is none, what means to not recover but updating the status from 'processing' to 'failed'.", + additionalProperties: { + $ref: '#/components/schemas/TaskRecoverStrategy', + }, + }, + TaskRecoverStrategy: { + type: 'string', + description: + '- 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', + enum: ['none', 'startOver'], + }, + TaskSecrets: { + type: 'object', + properties: { + backstageToken: { + type: 'string', + }, + }, + description: 'TaskSecrets', + additionalProperties: {}, + }, + TaskSpec: { + $ref: '#/components/schemas/TaskSpecV1beta3', + }, + TaskSpecV1beta3: { + type: 'object', + properties: { + apiVersion: { + type: 'string', + enum: ['scaffolder.backstage.io/v1beta3'], + description: 'The apiVersion string of the TaskSpec.', + }, + parameters: { + $ref: '#/components/schemas/JsonObject', + description: + 'This is a JSONSchema which is used to render a form in the frontend\nto collect user input and validate it against that schema. This can then be used in the `steps` part below to template\nvariables passed from the user into each action in the template.\n', + }, + steps: { + type: 'array', + items: { + $ref: '#/components/schemas/TaskStep', + }, + description: + 'A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying\njavascript action and some optional input parameters that may or may not have been collected from the end user.\n', + }, + output: { + type: 'object', + additionalProperties: { + $ref: '#/components/schemas/JsonValue', + }, + description: + 'The output is an object where template authors can pull out information from template actions and return them in a known standard way.\n', + }, + templateInfo: { + $ref: '#/components/schemas/TemplateInfo', + description: + 'Some information about the template that is stored on the task spec.', + }, + user: { + type: 'object', + properties: { + entity: { + type: 'object', + properties: {}, + description: 'The decorated entity from the Catalog', + additionalProperties: {}, + }, + ref: { + type: 'string', + description: 'An entity ref for the author of the task', + }, + }, + description: + 'Some decoration of the author of the task that should be available in the context', + }, + }, + required: ['apiVersion', 'parameters', 'steps', 'output'], + description: + 'A scaffolder task as stored in the database, generated from a v1beta3\napiVersion Template.', + additionalProperties: { + $ref: '#/components/schemas/TaskRecovery', + }, + }, + TaskStatus: { + type: 'string', + enum: ['cancelled', 'completed', 'failed', 'open', 'processing'], + description: 'The status of each step of the Task', + }, + TaskStep: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'A unique identifier for this step.', + }, + name: { + type: 'string', + description: 'A display name to show the user.', + }, + action: { + type: 'string', + description: + 'The underlying action ID that will be called as part of running this step.', + }, + input: { + $ref: '#/components/schemas/JsonObject', + description: 'Additional data that will be passed to the action.', + }, + each: { + oneOf: [ + { + type: 'string', + }, + { + $ref: '#/components/schemas/JsonArray', + }, + ], + description: 'Run step repeatedly.', + }, + }, + required: ['id', 'name', 'action'], + description: + 'An individual step of a scaffolder task, as stored in the database.', + additionalProperties: {}, + }, + TemplateEntityStepV1beta3: { + allOf: [ + { + $ref: '#/components/schemas/JsonObject', + }, + { + type: 'object', + properties: { + id: { + type: 'string', + }, + name: { + type: 'string', + }, + action: { + type: 'string', + }, + input: { + $ref: '#/components/schemas/JsonObject', + }, + }, + required: ['action'], + }, + ], + description: 'Step that is part of a Template Entity.', + additionalProperties: {}, + }, + TemplateEntityV1beta3: { + allOf: [ + { + $ref: '#/components/schemas/Entity', + }, + { + type: 'object', + properties: { + apiVersion: { + type: 'string', + enum: ['scaffolder.backstage.io/v1beta3'], + description: 'The apiVersion string of the TaskSpec.', + }, + kind: { + type: 'string', + enum: ['Template'], + description: 'The kind of the entity', + }, + spec: { + type: 'object', + properties: { + type: { + type: 'string', + description: + 'The type that the Template will create. For example service, website or library.', + }, + presentation: { + $ref: '#/components/schemas/TemplatePresentationV1beta3', + description: + 'Template specific configuration of the presentation layer.', + }, + parameters: { + oneOf: [ + { + $ref: '#/components/schemas/TemplateParametersV1beta3', + }, + { + type: 'array', + items: { + $ref: '#/components/schemas/TemplateParametersV1beta3', + }, + }, + ], + description: + "This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend\nto collect user input and validate it against that schema. This can then be used in the `steps` part below to template\nvariables passed from the user into each action in the template.", + }, + steps: { + type: 'array', + items: { + $ref: '#/components/schemas/TemplateEntityStepV1beta3', + }, + description: + 'A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying\njavascript action and some optional input parameters that may or may not have been collected from the end user.', + }, + output: { + type: 'object', + additionalProperties: { + type: 'string', + }, + description: + 'The output is an object where template authors can pull out information from template actions and return them in a known standard way.', + }, + owner: { + type: 'string', + description: 'The owner entityRef of the TemplateEntity', + }, + }, + required: ['type', 'steps'], + description: 'The specification of the Template Entity', + additionalProperties: {}, + }, + }, + required: ['apiVersion', 'kind', 'spec'], + }, + ], + description: + 'Backstage catalog Template kind Entity. Templates are used by the Scaffolder\nplugin to create new entities, such as Components.', + }, + TemplateInfo: { + type: 'object', + properties: { + entityRef: { + type: 'string', + description: 'The entityRef of the template.', + }, + baseUrl: { + type: 'string', + description: + 'Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths.', + }, + entity: { + type: 'object', + description: 'The Template entity.', + properties: { + metadata: { + $ref: '#/components/schemas/EntityMeta', + description: 'The metadata of the Template.', + }, + }, + }, + }, + required: ['entityRef'], + description: + 'Information about a template that is stored on a task specification.\nIncludes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition', + }, + TemplateParameterSchema: { + type: 'object', + properties: { + title: { + type: 'string', + }, + presentation: { + $ref: '#/components/schemas/TemplatePresentationV1beta3', + }, + description: { + type: 'string', + }, + steps: { + type: 'array', + items: { + type: 'object', + properties: { + title: { + $ref: '#/components/schemas/JsonValue', + }, + description: { + $ref: '#/components/schemas/JsonValue', + }, + schema: { + $ref: '#/components/schemas/TemplateParametersV1beta3', + }, + }, + required: ['title', 'schema'], + }, + }, + }, + required: ['title', 'steps'], + description: + 'The shape of each entry of parameters which gets rendered\nas a separate step in the wizard input', + additionalProperties: {}, + }, + TemplateParametersV1beta3: { + allOf: [ + { + $ref: '#/components/schemas/JsonObject', + }, + { + type: 'object', + additionalProperties: { + $ref: '#/components/schemas/TemplatePermissionsV1beta3', + }, + }, + ], + description: 'Parameter that is part of a Template Entity.', + }, + TemplatePermissionsV1beta3: { + allOf: [ + { + $ref: '#/components/schemas/JsonObject', + }, + { + type: 'object', + properties: { + tags: { + type: 'array', + items: { + type: 'string', + }, + }, + }, + }, + ], + description: 'Access control properties for parts of a template.', + }, + TemplatePresentationV1beta3: { + type: 'object', + properties: { + buttonLabels: { + type: 'object', + properties: { + backButtonText: { + type: 'string', + description: + 'The text for the button which leads to the previous template page', + }, + createButtonText: { + type: 'string', + description: + 'The text for the button which starts the execution of the template', + }, + reviewButtonText: { + type: 'string', + description: + "The text for the button which opens template's review/summary", + }, + }, + description: "Overrides default buttons' text", + additionalProperties: false, + }, + }, + description: 'The presentation of the template.', + additionalProperties: {}, + }, + TemplateRecoveryV1beta3: { + allOf: [ + { + $ref: '#/components/schemas/JsonObject', + }, + { + type: 'object', + additionalProperties: { + type: 'string', + enum: ['none', 'startOver'], + description: + 'none - not recover, let the task be marked as failed\nstartOver - do recover, start the execution of the task from the first step.', + }, + }, + ], + description: + 'Depends on how you designed your task you might tailor the behaviour for each of them.', + }, + ValidationError: { + type: 'object', + properties: { + path: { + type: 'array', + items: { + oneOf: [ + { + type: 'string', + }, + { + type: 'integer', + }, + ], + }, + }, + property: { + type: 'string', + }, + message: { + type: 'string', + }, + schema: { + oneOf: [ + { + type: 'string', + }, + { + $ref: '#/components/schemas/Schema', + }, + ], + }, + instance: { + type: 'object', + }, + name: { + type: 'string', + }, + argument: { + type: 'object', + }, + stack: { + type: 'string', + }, + }, + required: [ + 'path', + 'property', + 'message', + 'schema', + 'instance', + 'name', + 'argument', + 'stack', + ], + }, + }, + securitySchemes: { + JWT: { + type: 'http', + scheme: 'bearer', + bearerFormat: 'JWT', + }, + }, + }, + paths: { + '/v2/templates/{namespace}/{kind}/{name}/parameter-schema': { + get: { + operationId: 'GetTemplateParameterSchema', + description: 'Get template parameter schema.', + responses: { + '200': { + description: 'Ok', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/TemplateParameterSchema', + }, + }, + }, + }, + '400': { + $ref: '#/components/responses/ErrorResponse', + }, + default: { + $ref: '#/components/responses/ErrorResponse', + }, + }, + security: [ + {}, + { + JWT: [], + }, + ], + parameters: [ + { + $ref: '#/components/parameters/namespace', + }, + { + $ref: '#/components/parameters/kind', + }, + { + $ref: '#/components/parameters/name', + }, + ], + }, + }, + '/v2/actions': { + get: { + operationId: 'ListActions', + description: 'Returns a list of all installed actions.', + responses: { + '200': { + description: 'Ok', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/ListActionsResponse', + }, + }, + }, + }, + }, + security: [ + {}, + { + JWT: [], + }, + ], + parameters: [], + }, + }, + '/v2/tasks': { + get: { + operationId: 'ListTasks', + description: + 'Returns a list of tasks, filtering by ownership and/or status if given.', + responses: { + '200': { + description: 'Ok', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/ListTasksResponse', + }, + }, + }, + }, + }, + security: [ + {}, + { + JWT: [], + }, + ], + parameters: [ + { + $ref: '#/components/parameters/createdBy', + }, + { + $ref: '#/components/parameters/limit', + }, + { + $ref: '#/components/parameters/offset', + }, + { + $ref: '#/components/parameters/order', + }, + { + $ref: '#/components/parameters/status', + }, + ], + }, + post: { + operationId: 'Scaffold', + description: + 'Executes the scaffolding of a component, given a template and its\nparameter values.', + requestBody: { + required: true, + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/ScaffolderScaffoldOptions', + }, + }, + }, + }, + responses: { + '201': { + description: 'Created', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + id: { + type: 'string', + }, + }, + }, + }, + }, + }, + '400': { + description: 'Validation errors.', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + errors: { + type: 'array', + items: { + $ref: '#/components/schemas/ValidationError', + }, + }, + }, + required: ['errors'], + }, + }, + }, + }, + }, + security: [ + {}, + { + JWT: [], + }, + ], + parameters: [], + }, + }, + '/v2/tasks/{taskId}': { + get: { + operationId: 'GetTask', + description: 'Get a task by ID.', + responses: { + '200': { + description: 'Ok', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/SerializedTask', + }, + }, + }, + }, + }, + security: [ + {}, + { + JWT: [], + }, + ], + parameters: [ + { + $ref: '#/components/parameters/taskId', + }, + ], + }, + }, + '/v2/tasks/{taskId}/cancel': { + post: { + operationId: 'CancelTask', + description: + 'Sends a signal to a task broker to cancel the running task by taskId.', + responses: { + '200': { + description: 'Ok', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + status: { + $ref: '#/components/schemas/TaskStatus', + }, + }, + }, + }, + }, + }, + }, + security: [ + {}, + { + JWT: [], + }, + ], + parameters: [ + { + $ref: '#/components/parameters/taskId', + }, + ], + }, + }, + '/v2/tasks/{taskId}/retry': { + post: { + operationId: 'Retry', + description: 'Starts the task again from the point where it failed.', + responses: { + '201': { + description: 'Ok', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + id: { + type: 'string', + }, + }, + }, + }, + }, + }, + }, + security: [ + {}, + { + JWT: [], + }, + ], + parameters: [ + { + $ref: '#/components/parameters/taskId', + }, + ], + }, + }, + '/v2/tasks/{taskId}/eventstream': { + get: { + operationId: 'StreamLogsEventStream', + description: 'Get event stream for a task by ID.', + responses: { + '200': { + description: 'Ok', + content: { + 'text/event-stream': { + schema: { + type: 'string', + }, + }, + }, + }, + }, + parameters: [ + { + $ref: '#/components/parameters/eventsAfter', + }, + { + $ref: '#/components/parameters/taskId', + }, + ], + }, + }, + '/v2/tasks/{taskId}/events': { + get: { + operationId: 'StreamLogsPolling', + description: 'Get events for a task by ID.', + responses: { + '200': { + description: 'Ok', + content: { + 'application/json': { + schema: { + type: 'array', + items: { + $ref: '#/components/schemas/SerializedTaskEvent', + }, + }, + }, + }, + }, + }, + parameters: [ + { + $ref: '#/components/parameters/eventsAfter', + }, + { + $ref: '#/components/parameters/taskId', + }, + ], + }, + }, + '/v2/dry-run': { + post: { + operationId: 'DryRun', + description: 'Perform a dry-run of a template', + requestBody: { + required: true, + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + template: { + $ref: '#/components/schemas/TemplateEntityV1beta3', + }, + values: { + type: 'object', + }, + secrets: { + type: 'object', + }, + directoryContents: { + type: 'array', + items: { + type: 'object', + properties: { + path: { + type: 'string', + }, + base64Content: { + type: 'string', + }, + }, + }, + }, + }, + required: ['template', 'values', 'directoryContents'], + }, + }, + }, + }, + responses: { + '200': { + description: 'Ok', + content: { + 'application/json': { + schema: { + allOf: [ + { + $ref: '#/components/schemas/DryRunResult', + }, + { + type: 'object', + properties: { + steps: { + type: 'array', + items: { + allOf: [ + { + $ref: '#/components/schemas/TemplateEntityStepV1beta3', + }, + { + type: 'object', + properties: { + id: { + type: 'string', + }, + name: { + type: 'string', + }, + }, + required: ['id', 'name'], + }, + ], + }, + }, + directoryContents: { + type: 'array', + items: { + type: 'object', + properties: { + path: { + type: 'string', + }, + executable: { + type: 'boolean', + }, + base64Content: { + type: 'string', + }, + }, + required: ['path', 'base64Content'], + }, + }, + }, + }, + ], + }, + }, + }, + }, + '400': { + description: 'Validation errors.', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + errors: { + type: 'array', + items: { + $ref: '#/components/schemas/ValidationError', + }, + }, + }, + required: ['errors'], + }, + }, + }, + }, + }, + parameters: [], + }, + }, + '/v2/autocomplete/{provider}/{resource}': { + post: { + operationId: 'Autocomplete', + description: + 'Perform an autocomplete for the given provider and resource.', + requestBody: { + required: true, + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + context: { + type: 'object', + additionalProperties: { + type: 'string', + }, + }, + token: { + type: 'string', + }, + }, + required: ['context', 'token'], + }, + }, + }, + }, + responses: { + '200': { + description: 'Ok', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + results: { + type: 'array', + items: { + type: 'object', + properties: { + title: { + type: 'string', + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + parameters: [ + { + in: 'path', + name: 'provider', + required: true, + allowReserved: true, + schema: { + type: 'string', + }, + }, + { + in: 'path', + name: 'resource', + required: true, + allowReserved: true, + schema: { + type: 'string', + }, + }, + ], + }, + }, + }, +} as const; +export const createOpenApiRouter = async ( + options?: Parameters< + typeof createValidatedOpenApiRouterFromGeneratedEndpointMap + >['1'], +) => + createValidatedOpenApiRouterFromGeneratedEndpointMap( + spec, + options, + ); diff --git a/plugins/scaffolder-backend/src/schema/openapi/index.ts b/plugins/scaffolder-backend/src/schema/openapi/index.ts new file mode 100644 index 0000000000..db98243cbf --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './generated'; diff --git a/plugins/scaffolder-backend/src/service/router.ts b/plugins/scaffolder-backend/src/service/router.ts index 6e476d9a19..19dfd8274d 100644 --- a/plugins/scaffolder-backend/src/service/router.ts +++ b/plugins/scaffolder-backend/src/service/router.ts @@ -79,7 +79,6 @@ import { } from '@backstage/plugin-scaffolder-node/alpha'; import { HumanDuration, JsonObject } from '@backstage/types'; import express from 'express'; -import Router from 'express-promise-router'; import { validate } from 'jsonschema'; import { Duration } from 'luxon'; import { pathToFileURL } from 'url'; @@ -93,6 +92,7 @@ import { import { createDryRunner } from '../scaffolder/dryrun'; import { StorageTaskBroker } from '../scaffolder/tasks/StorageTaskBroker'; import { InternalTaskSecrets } from '../scaffolder/tasks/types'; +import { createOpenApiRouter } from '../schema/openapi'; import { checkPermission, checkTaskPermission, @@ -187,7 +187,7 @@ const readDuration = ( export async function createRouter( options: RouterOptions, ): Promise { - const router = Router(); + const router = await createOpenApiRouter(); // Be generous in upload size to support a wide range of templates in dry-run mode. router.use(express.json({ limit: '10MB' })); diff --git a/yarn.lock b/yarn.lock index 72dceeed70..855748a4e4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7323,6 +7323,7 @@ __metadata: dependencies: "@backstage/backend-app-api": "workspace:^" "@backstage/backend-defaults": "workspace:^" + "@backstage/backend-openapi-utils": "workspace:^" "@backstage/backend-plugin-api": "workspace:^" "@backstage/backend-test-utils": "workspace:^" "@backstage/catalog-model": "workspace:^" @@ -7359,7 +7360,6 @@ __metadata: concat-stream: "npm:^2.0.0" esbuild: "npm:^0.25.0" express: "npm:^4.17.1" - express-promise-router: "npm:^4.1.0" fs-extra: "npm:^11.2.0" globby: "npm:^11.0.0" isbinaryfile: "npm:^5.0.0" From 0976e117faee0560da3c85e9ecd987b4a13b5001 Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 10 Dec 2024 22:01:36 +0000 Subject: [PATCH 15/44] Generate Scaffolder OpenAPI client Signed-off-by: solimant --- plugins/scaffolder-backend/package.json | 2 +- .../src/schema/openapi.yaml | 11 + .../{DefaultApi.server.ts => Api.server.ts} | 8 +- .../schema/openapi/generated/apis/index.ts | 8 +- .../generated/models/RetryRequest.model.ts | 26 + .../schema/openapi/generated/models/index.ts | 1 + .../src/schema/openapi/generated/router.ts | 18 + plugins/scaffolder-common/.eslintrc.js | 11 +- .../openapi/generated/apis/Api.client.ts | 465 ++++++++++++++++++ .../schema/openapi/generated/apis/index.ts | 17 + .../src/schema/openapi/generated/index.ts | 18 + .../openapi/generated/models/Action.model.ts | 32 ++ .../generated/models/ActionExample.model.ts | 28 ++ .../generated/models/ActionSchema.model.ts | 33 ++ .../models/Autocomplete200Response.model.ts | 27 + ...tocomplete200ResponseResultsInner.model.ts | 26 + .../models/AutocompleteRequest.model.ts | 27 + .../models/CancelTask200Response.model.ts | 27 + .../models/DryRun200Response.model.ts | 35 ++ .../models/DryRun200ResponseAllOf.model.ts | 29 ++ ...sponseAllOfDirectoryContentsInner.model.ts | 28 ++ .../DryRun200ResponseAllOfStepsInner.model.ts | 32 ++ ...un200ResponseAllOfStepsInnerAllOf.model.ts | 27 + .../generated/models/DryRunRequest.model.ts | 31 ++ ...yRunRequestDirectoryContentsInner.model.ts | 27 + .../generated/models/DryRunResult.model.ts | 33 ++ .../models/DryRunResultLogInner.model.ts | 29 ++ .../openapi/generated/models/Entity.model.ts | 45 ++ .../generated/models/EntityLink.model.ts | 42 ++ .../generated/models/EntityMeta.model.ts | 69 +++ .../generated/models/EntityRelation.model.ts | 34 ++ .../generated/models/ErrorError.model.ts | 29 ++ .../generated/models/ErrorRequest.model.ts | 27 + .../generated/models/ErrorResponse.model.ts | 26 + .../generated/models/JsonPrimitive.model.ts | 25 + .../generated/models/JsonValue.model.ts | 29 ++ .../models/ListTasksResponse.model.ts | 28 ++ .../generated/models/ModelError.model.ts | 33 ++ .../generated/models/RetryRequest.model.ts | 26 + .../models/Scaffold201Response.model.ts | 26 + .../models/Scaffold400Response.model.ts | 27 + .../models/ScaffolderScaffoldOptions.model.ts | 30 ++ .../openapi/generated/models/Schema.model.ts | 64 +++ .../models/SchemaAdditionalItems.model.ts | 25 + .../models/SchemaDependenciesValue.model.ts | 25 + .../models/SchemaExclusiveMaximum.model.ts | 24 + .../generated/models/SchemaItems.model.ts | 25 + .../generated/models/SchemaRequired.model.ts | 24 + .../generated/models/SchemaType.model.ts | 24 + .../generated/models/SerializedFile.model.ts | 29 ++ .../generated/models/SerializedTask.model.ts | 40 ++ .../models/SerializedTaskEvent.model.ts | 36 ++ .../generated/models/TaskEventType.model.ts | 34 ++ .../models/TaskRecoverStrategy.model.ts | 32 ++ .../generated/models/TaskSecrets.model.ts | 29 ++ .../generated/models/TaskSpecV1beta3.model.ts | 55 +++ .../models/TaskSpecV1beta3User.model.ts | 34 ++ .../generated/models/TaskStatus.model.ts | 40 ++ .../generated/models/TaskStep.model.ts | 46 ++ .../generated/models/TaskStepEach.model.ts | 26 + .../models/TemplateEntityStepV1beta3.model.ts | 35 ++ .../TemplateEntityStepV1beta3AllOf.model.ts | 32 ++ .../models/TemplateEntityV1beta3.model.ts | 53 ++ .../TemplateEntityV1beta3AllOf.model.ts | 45 ++ .../TemplateEntityV1beta3AllOfSpec.model.ts | 49 ++ ...eEntityV1beta3AllOfSpecParameters.model.ts | 28 ++ .../generated/models/TemplateInfo.model.ts | 36 ++ .../models/TemplateInfoEntity.model.ts | 28 ++ .../models/TemplateParameterSchema.model.ts | 34 ++ ...TemplateParameterSchemaStepsInner.model.ts | 30 ++ .../models/TemplateParametersV1beta3.model.ts | 25 + .../TemplatePermissionsV1beta3.model.ts | 27 + .../TemplatePermissionsV1beta3AllOf.model.ts | 26 + .../TemplatePresentationV1beta3.model.ts | 30 ++ ...tePresentationV1beta3ButtonLabels.model.ts | 38 ++ .../models/TemplateRecoveryV1beta3.model.ts | 25 + .../generated/models/ValidationError.model.ts | 35 ++ .../models/ValidationErrorPathInner.model.ts | 24 + .../models/ValidationErrorSchema.model.ts | 25 + .../schema/openapi/generated/models/index.ts | 84 ++++ .../src/schema/openapi/generated/pluginId.ts | 17 + .../openapi/generated/types/discovery.ts | 22 + .../schema/openapi/generated/types/fetch.ts | 22 + .../client/src/schema/openapi/index.ts | 17 + plugins/scaffolder-common/package.json | 4 +- 85 files changed, 2947 insertions(+), 8 deletions(-) rename plugins/scaffolder-backend/src/schema/openapi/generated/apis/{DefaultApi.server.ts => Api.server.ts} (97%) create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/RetryRequest.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/apis/index.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/index.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Action.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionExample.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionSchema.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/AutocompleteRequest.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/CancelTask200Response.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResult.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Entity.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityLink.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityMeta.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityRelation.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorError.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorRequest.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorResponse.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonPrimitive.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonValue.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ModelError.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/RetryRequest.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold400Response.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Schema.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaItems.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaRequired.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaType.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedFile.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStep.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStepEach.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfo.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/pluginId.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/types/discovery.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/types/fetch.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/index.ts diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 86a361c9dd..ad0e1c0ed3 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -54,7 +54,7 @@ "build": "backstage-cli package build", "build:assets": "node scripts/build-nunjucks.js", "clean": "backstage-cli package clean", - "generate": "backstage-repo-tools package schema openapi generate --server", + "generate": "backstage-repo-tools package schema openapi generate --server --client-package plugins/scaffolder-common", "lint": "backstage-cli package lint", "prepack": "backstage-cli package prepack", "postpack": "backstage-cli package postpack", diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 1e4e372810..3b67678df1 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -1099,6 +1099,17 @@ paths: post: operationId: Retry description: Starts the task again from the point where it failed. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + secrets: + type: object + additionalProperties: + type: string responses: '201': description: Ok diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts similarity index 97% rename from plugins/scaffolder-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts rename to plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts index 76c18a22f0..a288266d2f 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/DefaultApi.server.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +// + // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** @@ -24,6 +26,7 @@ import { CancelTask200Response } from '../models/CancelTask200Response.model'; import { DryRun200Response } from '../models/DryRun200Response.model'; import { DryRunRequest } from '../models/DryRunRequest.model'; import { ListTasksResponse } from '../models/ListTasksResponse.model'; +import { RetryRequest } from '../models/RetryRequest.model'; import { Scaffold201Response } from '../models/Scaffold201Response.model'; import { Scaffold400Response } from '../models/Scaffold400Response.model'; import { ScaffolderScaffoldOptions } from '../models/ScaffolderScaffoldOptions.model'; @@ -104,6 +107,7 @@ export type Retry = { path: { taskId: string; }; + body: RetryRequest; response: Scaffold201Response; }; /** @@ -138,10 +142,6 @@ export type StreamLogsPolling = { response: Array; }; -/** - * no description - */ - export type EndpointMap = { '#post|/v2/autocomplete/{provider}/{resource}': Autocomplete; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts index 79855a6fc8..a3cdbbebd2 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts @@ -14,4 +14,10 @@ * limitations under the License. */ -export * from './DefaultApi.server'; +// + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +export * from './Api.server'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/RetryRequest.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/RetryRequest.model.ts new file mode 100644 index 0000000000..858fa67566 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/RetryRequest.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface RetryRequest { + secrets?: { [key: string]: string }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts index 2d6d6228d7..598c41822b 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts @@ -41,6 +41,7 @@ export * from '../models/JsonPrimitive.model'; export * from '../models/JsonValue.model'; export * from '../models/ListTasksResponse.model'; export * from '../models/ModelError.model'; +export * from '../models/RetryRequest.model'; export * from '../models/Scaffold201Response.model'; export * from '../models/Scaffold400Response.model'; export * from '../models/ScaffolderScaffoldOptions.model'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts index 2e11c7e7c5..2bc56e28ad 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -1443,6 +1443,24 @@ export const spec = { post: { operationId: 'Retry', description: 'Starts the task again from the point where it failed.', + requestBody: { + required: true, + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + secrets: { + type: 'object', + additionalProperties: { + type: 'string', + }, + }, + }, + }, + }, + }, + }, responses: { '201': { description: 'Ok', diff --git a/plugins/scaffolder-common/.eslintrc.js b/plugins/scaffolder-common/.eslintrc.js index e2a53a6ad2..a9d85200c7 100644 --- a/plugins/scaffolder-common/.eslintrc.js +++ b/plugins/scaffolder-common/.eslintrc.js @@ -1 +1,10 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); +module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, { + overrides: [ + { + files: ['client/src/schema/openapi/generated/models/*.model.ts'], + rules: { + '@typescript-eslint/no-redeclare': 'off', + }, + }, + ], +}); diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts new file mode 100644 index 0000000000..87a2cc94eb --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts @@ -0,0 +1,465 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DiscoveryApi } from '../types/discovery'; +import { FetchApi } from '../types/fetch'; +import crossFetch from 'cross-fetch'; +import { pluginId } from '../pluginId'; +import * as parser from 'uri-template'; +import { Action } from '../models/Action.model'; +import { Autocomplete200Response } from '../models/Autocomplete200Response.model'; +import { AutocompleteRequest } from '../models/AutocompleteRequest.model'; +import { CancelTask200Response } from '../models/CancelTask200Response.model'; +import { DryRun200Response } from '../models/DryRun200Response.model'; +import { DryRunRequest } from '../models/DryRunRequest.model'; +import { ListTasksResponse } from '../models/ListTasksResponse.model'; +import { RetryRequest } from '../models/RetryRequest.model'; +import { Scaffold201Response } from '../models/Scaffold201Response.model'; +import { ScaffolderScaffoldOptions } from '../models/ScaffolderScaffoldOptions.model'; +import { SerializedTask } from '../models/SerializedTask.model'; +import { SerializedTaskEvent } from '../models/SerializedTaskEvent.model'; +import { TemplateParameterSchema } from '../models/TemplateParameterSchema.model'; + +/** + * Wraps the Response type to convey a type on the json call. + * + * @public + */ +export type TypedResponse = Omit & { + json: () => Promise; +}; + +/** + * Options you can pass into a request for additional information. + * + * @public + */ +export interface RequestOptions { + token?: string; +} +/** + * @public + */ +export type Autocomplete = { + path: { + provider: string; + resource: string; + }; + body: AutocompleteRequest; +}; +/** + * @public + */ +export type CancelTask = { + path: { + taskId: string; + }; +}; +/** + * @public + */ +export type DryRun = { + body: DryRunRequest; +}; +/** + * @public + */ +export type GetTask = { + path: { + taskId: string; + }; +}; +/** + * @public + */ +export type GetTemplateParameterSchema = { + path: { + namespace: string; + kind: string; + name: string; + }; +}; +/** + * @public + */ +export type ListActions = {}; +/** + * @public + */ +export type ListTasks = { + query: { + createdBy?: string; + limit?: number; + offset?: number; + order?: 'asc' | 'desc'; + status?: string; + }; +}; +/** + * @public + */ +export type Retry = { + path: { + taskId: string; + }; + body: RetryRequest; +}; +/** + * @public + */ +export type Scaffold = { + body: ScaffolderScaffoldOptions; +}; +/** + * @public + */ +export type StreamLogsEventStream = { + path: { + taskId: string; + }; + query: { + after?: number; + }; +}; +/** + * @public + */ +export type StreamLogsPolling = { + path: { + taskId: string; + }; + query: { + after?: number; + }; +}; + +/** + * @public + */ +export class DefaultApiClient { + private readonly discoveryApi: DiscoveryApi; + private readonly fetchApi: FetchApi; + + constructor(options: { + discoveryApi: { getBaseUrl(pluginId: string): Promise }; + fetchApi?: { fetch: typeof fetch }; + }) { + this.discoveryApi = options.discoveryApi; + this.fetchApi = options.fetchApi || { fetch: crossFetch }; + } + + /** + * Perform an autocomplete for the given provider and resource. + * @param provider - + * @param resource - + * @param autocompleteRequest - + */ + public async autocomplete( + // @ts-ignore + request: Autocomplete, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/autocomplete/{provider}/{resource}`; + + const uri = parser.parse(uriTemplate).expand({ + provider: request.path.provider, + resource: request.path.resource, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } + + /** + * Sends a signal to a task broker to cancel the running task by taskId. + * @param taskId - + */ + public async cancelTask( + // @ts-ignore + request: CancelTask, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/tasks/{taskId}/cancel`; + + const uri = parser.parse(uriTemplate).expand({ + taskId: request.path.taskId, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + }); + } + + /** + * Perform a dry-run of a template + * @param dryRunRequest - + */ + public async dryRun( + // @ts-ignore + request: DryRun, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/dry-run`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } + + /** + * Get a task by ID. + * @param taskId - + */ + public async getTask( + // @ts-ignore + request: GetTask, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/tasks/{taskId}`; + + const uri = parser.parse(uriTemplate).expand({ + taskId: request.path.taskId, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Get template parameter schema. + * @param namespace - + * @param kind - + * @param name - + */ + public async getTemplateParameterSchema( + // @ts-ignore + request: GetTemplateParameterSchema, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/templates/{namespace}/{kind}/{name}/parameter-schema`; + + const uri = parser.parse(uriTemplate).expand({ + namespace: request.path.namespace, + kind: request.path.kind, + name: request.path.name, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Returns a list of all installed actions. + */ + public async listActions( + // @ts-ignore + request: ListActions, + options?: RequestOptions, + ): Promise>> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/actions`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Returns a list of tasks, filtering by ownership and/or status if given. + * @param createdBy - Created by + * @param limit - Number of records to return in the response. + * @param offset - Number of records to skip in the query page. + * @param order - Order + * @param status - Status + */ + public async listTasks( + // @ts-ignore + request: ListTasks, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/tasks{?createdBy,limit,offset,order,status}`; + + const uri = parser.parse(uriTemplate).expand({ + ...request.query, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Starts the task again from the point where it failed. + * @param taskId - + * @param retryRequest - + */ + public async retry( + // @ts-ignore + request: Retry, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/tasks/{taskId}/retry`; + + const uri = parser.parse(uriTemplate).expand({ + taskId: request.path.taskId, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } + + /** + * Executes the scaffolding of a component, given a template and its parameter values. + * @param scaffolderScaffoldOptions - + */ + public async scaffold( + // @ts-ignore + request: Scaffold, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/tasks`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'POST', + body: JSON.stringify(request.body), + }); + } + + /** + * Get event stream for a task by ID. + * @param taskId - + * @param after - Offset event ID to stream events after. + */ + public async streamLogsEventStream( + // @ts-ignore + request: StreamLogsEventStream, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/tasks/{taskId}/eventstream{?after}`; + + const uri = parser.parse(uriTemplate).expand({ + taskId: request.path.taskId, + ...request.query, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + + /** + * Get events for a task by ID. + * @param taskId - + * @param after - Offset event ID to stream events after. + */ + public async streamLogsPolling( + // @ts-ignore + request: StreamLogsPolling, + options?: RequestOptions, + ): Promise>> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/tasks/{taskId}/events{?after}`; + + const uri = parser.parse(uriTemplate).expand({ + taskId: request.path.taskId, + ...request.query, + }); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/index.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/index.ts new file mode 100644 index 0000000000..af52f9db46 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './Api.client'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/index.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/index.ts new file mode 100644 index 0000000000..bb399e97a0 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './apis'; +export * from './models'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Action.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Action.model.ts new file mode 100644 index 0000000000..8e86b8b338 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Action.model.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ActionExample } from '../models/ActionExample.model'; +import { ActionSchema } from '../models/ActionSchema.model'; + +/** + * The response shape for a single action in the `listActions` call to the `scaffolder-backend` + * @public + */ +export interface Action { + id: string; + description?: string; + examples?: Array; + schema?: ActionSchema; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionExample.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionExample.model.ts new file mode 100644 index 0000000000..cf2ffeaf8a --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionExample.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A single action example + * @public + */ +export interface ActionExample { + description: string; + example: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionSchema.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionSchema.model.ts new file mode 100644 index 0000000000..037d2fff44 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionSchema.model.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ActionSchema { + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; + /** + * A type representing all allowed JSON object values. + */ + output?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts new file mode 100644 index 0000000000..cad9a0dd29 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Autocomplete200ResponseResultsInner } from '../models/Autocomplete200ResponseResultsInner.model'; + +/** + * @public + */ +export interface Autocomplete200Response { + results?: Array; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts new file mode 100644 index 0000000000..bc8ea23cbb --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface Autocomplete200ResponseResultsInner { + title?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/AutocompleteRequest.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/AutocompleteRequest.model.ts new file mode 100644 index 0000000000..d9ab409224 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/AutocompleteRequest.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface AutocompleteRequest { + context: { [key: string]: string }; + token: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/CancelTask200Response.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/CancelTask200Response.model.ts new file mode 100644 index 0000000000..745ca8074e --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/CancelTask200Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TaskStatus } from '../models/TaskStatus.model'; + +/** + * @public + */ +export interface CancelTask200Response { + status?: TaskStatus; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts new file mode 100644 index 0000000000..92b8d723a0 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DryRun200ResponseAllOfDirectoryContentsInner } from '../models/DryRun200ResponseAllOfDirectoryContentsInner.model'; +import { DryRun200ResponseAllOfStepsInner } from '../models/DryRun200ResponseAllOfStepsInner.model'; +import { DryRunResultLogInner } from '../models/DryRunResultLogInner.model'; + +/** + * @public + */ +export interface DryRun200Response { + log: Array; + directoryContents: Array; + /** + * A type representing all allowed JSON object values. + */ + output: { [key: string]: any }; + steps?: Array; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts new file mode 100644 index 0000000000..553c6f765a --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DryRun200ResponseAllOfDirectoryContentsInner } from '../models/DryRun200ResponseAllOfDirectoryContentsInner.model'; +import { DryRun200ResponseAllOfStepsInner } from '../models/DryRun200ResponseAllOfStepsInner.model'; + +/** + * @public + */ +export interface DryRun200ResponseAllOf { + steps?: Array; + directoryContents?: Array; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts new file mode 100644 index 0000000000..27174b9b0e --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRun200ResponseAllOfDirectoryContentsInner { + path: string; + executable?: boolean; + base64Content: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts new file mode 100644 index 0000000000..229860f81a --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRun200ResponseAllOfStepsInner { + id: string; + name: string; + action: string; + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts new file mode 100644 index 0000000000..6416143493 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRun200ResponseAllOfStepsInnerAllOf { + id: string; + name: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts new file mode 100644 index 0000000000..510e7fa353 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DryRunRequestDirectoryContentsInner } from '../models/DryRunRequestDirectoryContentsInner.model'; +import { TemplateEntityV1beta3 } from '../models/TemplateEntityV1beta3.model'; + +/** + * @public + */ +export interface DryRunRequest { + template: TemplateEntityV1beta3; + values: any; + secrets?: any; + directoryContents: Array; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts new file mode 100644 index 0000000000..edf90d403d --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRunRequestDirectoryContentsInner { + path?: string; + base64Content?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResult.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResult.model.ts new file mode 100644 index 0000000000..66e35bd9e5 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResult.model.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { DryRunResultLogInner } from '../models/DryRunResultLogInner.model'; +import { SerializedFile } from '../models/SerializedFile.model'; + +/** + * @public + */ +export interface DryRunResult { + log: Array; + directoryContents: Array; + /** + * A type representing all allowed JSON object values. + */ + output: { [key: string]: any }; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts new file mode 100644 index 0000000000..0f987091c0 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface DryRunResultLogInner { + /** + * A type representing all allowed JSON object values. + */ + body?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Entity.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Entity.model.ts new file mode 100644 index 0000000000..f386f3dd17 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Entity.model.ts @@ -0,0 +1,45 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { EntityMeta } from '../models/EntityMeta.model'; +import { EntityRelation } from '../models/EntityRelation.model'; + +/** + * The parts of the format that's common to all versions/kinds of entity. + * @public + */ +export interface Entity { + /** + * The relations that this entity has with other entities. + */ + relations?: Array; + /** + * A type representing all allowed JSON object values. + */ + spec?: { [key: string]: any }; + metadata: EntityMeta; + /** + * The high level entity type being described. + */ + kind: string; + /** + * The version of specification format for this particular entity that this is written against. + */ + apiVersion: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityLink.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityLink.model.ts new file mode 100644 index 0000000000..53d7d1f9ff --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityLink.model.ts @@ -0,0 +1,42 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A link to external information that is related to the entity. + * @public + */ +export interface EntityLink { + /** + * An optional value to categorize links into specific groups + */ + type?: string; + /** + * An optional semantic key that represents a visual icon. + */ + icon?: string; + /** + * An optional descriptive title for the link. + */ + title?: string; + /** + * The url to the external site, document, etc. + */ + url: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityMeta.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityMeta.model.ts new file mode 100644 index 0000000000..cc8dd555a6 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityMeta.model.ts @@ -0,0 +1,69 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { EntityLink } from '../models/EntityLink.model'; + +/** + * Metadata fields common to all versions/kinds of entity. + * @public + */ +export interface EntityMeta { + [key: string]: any; + + /** + * A list of external hyperlinks related to the entity. + */ + links?: Array; + /** + * A list of single-valued strings, to for example classify catalog entities in various ways. + */ + tags?: Array; + /** + * Construct a type with a set of properties K of type T + */ + annotations?: { [key: string]: string }; + /** + * Construct a type with a set of properties K of type T + */ + labels?: { [key: string]: string }; + /** + * A short (typically relatively few words, on one line) description of the entity. + */ + description?: string; + /** + * A display name of the entity, to be presented in user interfaces instead of the `name` property above, when available. This field is sometimes useful when the `name` is cumbersome or ends up being perceived as overly technical. The title generally does not have as stringent format requirements on it, so it may contain special characters and be more explanatory. Do keep it very short though, and avoid situations where a title can be confused with the name of another entity, or where two entities share a title. Note that this is only for display purposes, and may be ignored by some parts of the code. Entity references still always make use of the `name` property, not the title. + */ + title?: string; + /** + * The namespace that the entity belongs to. + */ + namespace?: string; + /** + * The name of the entity. Must be unique within the catalog at any given point in time, for any given namespace + kind pair. This value is part of the technical identifier of the entity, and as such it will appear in URLs, database tables, entity references, and similar. It is subject to restrictions regarding what characters are allowed. If you want to use a different, more human readable string with fewer restrictions on it in user interfaces, see the `title` field below. + */ + name: string; + /** + * An opaque string that changes for each update operation to any part of the entity, including metadata. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, and the server will then reject the operation if it does not match the current stored value. + */ + etag?: string; + /** + * A globally unique ID for the entity. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, but the server is free to reject requests that do so in such a way that it breaks semantics. + */ + uid?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityRelation.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityRelation.model.ts new file mode 100644 index 0000000000..fe98a84481 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityRelation.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A relation of a specific type to another entity in the catalog. + * @public + */ +export interface EntityRelation { + /** + * The entity ref of the target of this relation. + */ + targetRef: string; + /** + * The type of the relation. + */ + type: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorError.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorError.model.ts new file mode 100644 index 0000000000..fe5811628d --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorError.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorError { + name: string; + message: string; + stack?: string; + code?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorRequest.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorRequest.model.ts new file mode 100644 index 0000000000..d44dcb66d9 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorRequest.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorRequest { + method: string; + url: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorResponse.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorResponse.model.ts new file mode 100644 index 0000000000..91c120483d --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorResponse.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface ErrorResponse { + statusCode: number; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonPrimitive.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonPrimitive.model.ts new file mode 100644 index 0000000000..6ca5d5144b --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonPrimitive.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A type representing all allowed JSON primitive values. + * @public + */ +export type JsonPrimitive = any | boolean | number | string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonValue.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonValue.model.ts new file mode 100644 index 0000000000..9527b6828d --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonValue.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonPrimitive } from '../models/JsonPrimitive.model'; + +/** + * A type representing all allowed JSON values. + * @public + */ +export type JsonValue = + | Array + | JsonPrimitive + | { [key: string]: any }; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts new file mode 100644 index 0000000000..65a3a04bec --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { SerializedTask } from '../models/SerializedTask.model'; + +/** + * The response shape for the `listTasks` call to the `scaffolder-backend` + * @public + */ +export interface ListTasksResponse { + tasks?: Array; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ModelError.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ModelError.model.ts new file mode 100644 index 0000000000..5526d703e6 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ModelError.model.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ErrorError } from '../models/ErrorError.model'; +import { ErrorRequest } from '../models/ErrorRequest.model'; +import { ErrorResponse } from '../models/ErrorResponse.model'; + +/** + * @public + */ +export interface ModelError { + [key: string]: any; + + error: ErrorError; + request?: ErrorRequest; + response: ErrorResponse; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/RetryRequest.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/RetryRequest.model.ts new file mode 100644 index 0000000000..858fa67566 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/RetryRequest.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface RetryRequest { + secrets?: { [key: string]: string }; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts new file mode 100644 index 0000000000..9ff2cc8494 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface Scaffold201Response { + id?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold400Response.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold400Response.model.ts new file mode 100644 index 0000000000..515c5b6de3 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold400Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ValidationError } from '../models/ValidationError.model'; + +/** + * @public + */ +export interface Scaffold400Response { + errors: Array; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts new file mode 100644 index 0000000000..68b9927966 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonValue } from '../models/JsonValue.model'; + +/** + * The input options to the `scaffold` method of the `ScaffolderClient`. + * @public + */ +export interface ScaffolderScaffoldOptions { + templateRef: string; + values: { [key: string]: JsonValue }; + secrets?: { [key: string]: string }; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Schema.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Schema.model.ts new file mode 100644 index 0000000000..0e24d46c30 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Schema.model.ts @@ -0,0 +1,64 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { SchemaAdditionalItems } from '../models/SchemaAdditionalItems.model'; +import { SchemaDependenciesValue } from '../models/SchemaDependenciesValue.model'; +import { SchemaExclusiveMaximum } from '../models/SchemaExclusiveMaximum.model'; +import { SchemaItems } from '../models/SchemaItems.model'; +import { SchemaRequired } from '../models/SchemaRequired.model'; +import { SchemaType } from '../models/SchemaType.model'; + +/** + * @public + */ +export interface Schema { + [key: string]: any; + + id?: string; + title?: string; + description?: string; + multipleOf?: number; + maximum?: number; + exclusiveMaximum?: SchemaExclusiveMaximum; + minimum?: number; + exclusiveMinimum?: SchemaExclusiveMaximum; + maxLength?: number; + minLength?: number; + pattern?: any; + additionalItems?: SchemaAdditionalItems; + items?: SchemaItems; + maxItems?: number; + minItems?: number; + uniqueItems?: boolean; + maxProperties?: number; + minProperties?: number; + required?: SchemaRequired; + additionalProperties?: SchemaAdditionalItems; + definitions?: { [key: string]: Schema }; + properties?: { [key: string]: Schema }; + patternProperties?: { [key: string]: Schema }; + dependencies?: { [key: string]: SchemaDependenciesValue }; + type?: SchemaType; + format?: string; + allOf?: Array; + anyOf?: Array; + oneOf?: Array; + not?: Schema; + then?: Schema; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts new file mode 100644 index 0000000000..2039e2f9bb --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Schema } from '../models/Schema.model'; + +/** + * @public + */ +export type SchemaAdditionalItems = Schema | boolean; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts new file mode 100644 index 0000000000..97609dda50 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Schema } from '../models/Schema.model'; + +/** + * @public + */ +export type SchemaDependenciesValue = Array | Schema; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts new file mode 100644 index 0000000000..c22a44e80b --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type SchemaExclusiveMaximum = boolean | number; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaItems.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaItems.model.ts new file mode 100644 index 0000000000..c63c6700aa --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaItems.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Schema } from '../models/Schema.model'; + +/** + * @public + */ +export type SchemaItems = Array | Schema; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaRequired.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaRequired.model.ts new file mode 100644 index 0000000000..b1b879cb3b --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaRequired.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type SchemaRequired = Array | boolean; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaType.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaType.model.ts new file mode 100644 index 0000000000..dd0cbb93db --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaType.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type SchemaType = Array | string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedFile.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedFile.model.ts new file mode 100644 index 0000000000..d2bdfc72de --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedFile.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface SerializedFile { + path: string; + content: string; + executable?: boolean; + symlink?: boolean; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts new file mode 100644 index 0000000000..7ba1196cab --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts @@ -0,0 +1,40 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TaskSecrets } from '../models/TaskSecrets.model'; +import { TaskSpecV1beta3 } from '../models/TaskSpecV1beta3.model'; +import { TaskStatus } from '../models/TaskStatus.model'; + +/** + * SerializedTask + * @public + */ +export interface SerializedTask { + id: string; + spec: TaskSpecV1beta3; + status: TaskStatus; + createdAt: string; + lastHeartbeatAt?: string; + createdBy?: string; + secrets?: TaskSecrets; + /** + * A type representing all allowed JSON object values. + */ + state?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts new file mode 100644 index 0000000000..484688e324 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts @@ -0,0 +1,36 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TaskEventType } from '../models/TaskEventType.model'; + +/** + * SerializedTaskEvent + * @public + */ +export interface SerializedTaskEvent { + id: number; + isTaskRecoverable?: boolean; + taskId: string; + /** + * A type representing all allowed JSON object values. + */ + body: { [key: string]: any }; + type: TaskEventType; + createdAt: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts new file mode 100644 index 0000000000..8531d19de8 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type TaskEventType = 'completion' | 'log' | 'cancelled' | 'recovered'; + +/** + * @public + */ +export const TaskEventType = { + Completion: 'completion' as TaskEventType, + Log: 'log' as TaskEventType, + Cancelled: 'cancelled' as TaskEventType, + Recovered: 'recovered' as TaskEventType, +}; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts new file mode 100644 index 0000000000..e00b2dfa88 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type TaskRecoverStrategy = 'none' | 'startOver'; + +/** + * @public + */ +export const TaskRecoverStrategy = { + None: 'none' as TaskRecoverStrategy, + StartOver: 'startOver' as TaskRecoverStrategy, +}; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts new file mode 100644 index 0000000000..ae7c6a891c --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * TaskSecrets + * @public + */ +export interface TaskSecrets { + [key: string]: any; + + backstageToken?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts new file mode 100644 index 0000000000..bb32940062 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts @@ -0,0 +1,55 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonValue } from '../models/JsonValue.model'; +import { TaskSpecV1beta3User } from '../models/TaskSpecV1beta3User.model'; +import { TaskStep } from '../models/TaskStep.model'; +import { TemplateInfo } from '../models/TemplateInfo.model'; + +/** + * A scaffolder task as stored in the database, generated from a v1beta3 apiVersion Template. + * @public + */ +export interface TaskSpecV1beta3 { + [key: string]: any; + + /** + * The apiVersion string of the TaskSpec. + */ + apiVersion: TaskSpecV1beta3ApiVersionEnum; + /** + * A type representing all allowed JSON object values. + */ + parameters: { [key: string]: any }; + /** + * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying javascript action and some optional input parameters that may or may not have been collected from the end user. + */ + steps: Array; + /** + * The output is an object where template authors can pull out information from template actions and return them in a known standard way. + */ + output: { [key: string]: JsonValue }; + templateInfo?: TemplateInfo; + user?: TaskSpecV1beta3User; +} + +/** + * @public + */ +export type TaskSpecV1beta3ApiVersionEnum = 'scaffolder.backstage.io/v1beta3'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts new file mode 100644 index 0000000000..7f36a3f171 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Some decoration of the author of the task that should be available in the context + * @public + */ +export interface TaskSpecV1beta3User { + /** + * The decorated entity from the Catalog + */ + entity?: { [key: string]: any }; + /** + * An entity ref for the author of the task + */ + ref?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts new file mode 100644 index 0000000000..42f8137fb3 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts @@ -0,0 +1,40 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type TaskStatus = + | 'cancelled' + | 'completed' + | 'failed' + | 'open' + | 'processing'; + +/** + * @public + */ +export const TaskStatus = { + Cancelled: 'cancelled' as TaskStatus, + Completed: 'completed' as TaskStatus, + Failed: 'failed' as TaskStatus, + Open: 'open' as TaskStatus, + Processing: 'processing' as TaskStatus, +}; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStep.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStep.model.ts new file mode 100644 index 0000000000..c36049b9a6 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStep.model.ts @@ -0,0 +1,46 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TaskStepEach } from '../models/TaskStepEach.model'; + +/** + * An individual step of a scaffolder task, as stored in the database. + * @public + */ +export interface TaskStep { + [key: string]: any; + + /** + * A unique identifier for this step. + */ + id: string; + /** + * A display name to show the user. + */ + name: string; + /** + * The underlying action ID that will be called as part of running this step. + */ + action: string; + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; + each?: TaskStepEach; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStepEach.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStepEach.model.ts new file mode 100644 index 0000000000..398a19ee88 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStepEach.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonValue } from '../models/JsonValue.model'; + +/** + * Run step repeatedly. + * @public + */ +export type TaskStepEach = Array | string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts new file mode 100644 index 0000000000..e125c46f1d --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Step that is part of a Template Entity. + * @public + */ +export interface TemplateEntityStepV1beta3 { + [key: string]: any; + + id?: string; + name?: string; + action: string; + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts new file mode 100644 index 0000000000..dfba72bf8d --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface TemplateEntityStepV1beta3AllOf { + id?: string; + name?: string; + action: string; + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts new file mode 100644 index 0000000000..efe325cfeb --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts @@ -0,0 +1,53 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { EntityMeta } from '../models/EntityMeta.model'; +import { EntityRelation } from '../models/EntityRelation.model'; +import { TemplateEntityV1beta3AllOfSpec } from '../models/TemplateEntityV1beta3AllOfSpec.model'; + +/** + * Backstage catalog Template kind Entity. Templates are used by the Scaffolder plugin to create new entities, such as Components. + * @public + */ +export interface TemplateEntityV1beta3 { + /** + * The relations that this entity has with other entities. + */ + relations?: Array; + spec: TemplateEntityV1beta3AllOfSpec; + metadata: EntityMeta; + /** + * The kind of the entity + */ + kind: TemplateEntityV1beta3KindEnum; + /** + * The apiVersion string of the TaskSpec. + */ + apiVersion: TemplateEntityV1beta3ApiVersionEnum; +} + +/** + * @public + */ +export type TemplateEntityV1beta3KindEnum = 'Template'; +/** + * @public + */ +export type TemplateEntityV1beta3ApiVersionEnum = + 'scaffolder.backstage.io/v1beta3'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts new file mode 100644 index 0000000000..acc9f8c991 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts @@ -0,0 +1,45 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateEntityV1beta3AllOfSpec } from '../models/TemplateEntityV1beta3AllOfSpec.model'; + +/** + * @public + */ +export interface TemplateEntityV1beta3AllOf { + /** + * The apiVersion string of the TaskSpec. + */ + apiVersion: TemplateEntityV1beta3AllOfApiVersionEnum; + /** + * The kind of the entity + */ + kind: TemplateEntityV1beta3AllOfKindEnum; + spec: TemplateEntityV1beta3AllOfSpec; +} + +/** + * @public + */ +export type TemplateEntityV1beta3AllOfApiVersionEnum = + 'scaffolder.backstage.io/v1beta3'; +/** + * @public + */ +export type TemplateEntityV1beta3AllOfKindEnum = 'Template'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts new file mode 100644 index 0000000000..3fa0063e08 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts @@ -0,0 +1,49 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateEntityStepV1beta3 } from '../models/TemplateEntityStepV1beta3.model'; +import { TemplateEntityV1beta3AllOfSpecParameters } from '../models/TemplateEntityV1beta3AllOfSpecParameters.model'; +import { TemplatePresentationV1beta3 } from '../models/TemplatePresentationV1beta3.model'; + +/** + * The specification of the Template Entity + * @public + */ +export interface TemplateEntityV1beta3AllOfSpec { + [key: string]: any; + + /** + * The type that the Template will create. For example service, website or library. + */ + type: string; + presentation?: TemplatePresentationV1beta3; + parameters?: TemplateEntityV1beta3AllOfSpecParameters; + /** + * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying javascript action and some optional input parameters that may or may not have been collected from the end user. + */ + steps: Array; + /** + * The output is an object where template authors can pull out information from template actions and return them in a known standard way. + */ + output?: { [key: string]: string }; + /** + * The owner entityRef of the TemplateEntity + */ + owner?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts new file mode 100644 index 0000000000..1444a74e19 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.model'; + +/** + * This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend to collect user input and validate it against that schema. This can then be used in the `steps` part below to template variables passed from the user into each action in the template. + * @public + */ +export type TemplateEntityV1beta3AllOfSpecParameters = + | Array + | TemplateParametersV1beta3; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfo.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfo.model.ts new file mode 100644 index 0000000000..ea5b9da6e9 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfo.model.ts @@ -0,0 +1,36 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateInfoEntity } from '../models/TemplateInfoEntity.model'; + +/** + * Information about a template that is stored on a task specification. Includes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition + * @public + */ +export interface TemplateInfo { + /** + * The entityRef of the template. + */ + entityRef: string; + /** + * Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths. + */ + baseUrl?: string; + entity?: TemplateInfoEntity; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts new file mode 100644 index 0000000000..b59414f80f --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { EntityMeta } from '../models/EntityMeta.model'; + +/** + * The Template entity. + * @public + */ +export interface TemplateInfoEntity { + metadata?: EntityMeta; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts new file mode 100644 index 0000000000..aab495d098 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateParameterSchemaStepsInner } from '../models/TemplateParameterSchemaStepsInner.model'; +import { TemplatePresentationV1beta3 } from '../models/TemplatePresentationV1beta3.model'; + +/** + * The shape of each entry of parameters which gets rendered as a separate step in the wizard input + * @public + */ +export interface TemplateParameterSchema { + [key: string]: any; + + title: string; + presentation?: TemplatePresentationV1beta3; + description?: string; + steps: Array; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts new file mode 100644 index 0000000000..2f170b6fc6 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { JsonValue } from '../models/JsonValue.model'; +import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.model'; + +/** + * @public + */ +export interface TemplateParameterSchemaStepsInner { + title: JsonValue; + description?: JsonValue; + schema: TemplateParametersV1beta3; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts new file mode 100644 index 0000000000..e106f9a1de --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Parameter that is part of a Template Entity. + * @public + */ +export interface TemplateParametersV1beta3 {} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts new file mode 100644 index 0000000000..68c2df70a8 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Access control properties for parts of a template. + * @public + */ +export interface TemplatePermissionsV1beta3 { + tags?: Array; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts new file mode 100644 index 0000000000..c7eda5cd8a --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface TemplatePermissionsV1beta3AllOf { + tags?: Array; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts new file mode 100644 index 0000000000..83405f15aa --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplatePresentationV1beta3ButtonLabels } from '../models/TemplatePresentationV1beta3ButtonLabels.model'; + +/** + * The presentation of the template. + * @public + */ +export interface TemplatePresentationV1beta3 { + [key: string]: any; + + buttonLabels?: TemplatePresentationV1beta3ButtonLabels; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts new file mode 100644 index 0000000000..37015a5468 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts @@ -0,0 +1,38 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Overrides default buttons' text + * @public + */ +export interface TemplatePresentationV1beta3ButtonLabels { + /** + * The text for the button which leads to the previous template page + */ + backButtonText?: string; + /** + * The text for the button which starts the execution of the template + */ + createButtonText?: string; + /** + * The text for the button which opens template's review/summary + */ + reviewButtonText?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts new file mode 100644 index 0000000000..3613718ac0 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * Depends on how you designed your task you might tailor the behaviour for each of them. + * @public + */ +export interface TemplateRecoveryV1beta3 {} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts new file mode 100644 index 0000000000..e37d3b4af9 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts @@ -0,0 +1,35 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ValidationErrorPathInner } from '../models/ValidationErrorPathInner.model'; +import { ValidationErrorSchema } from '../models/ValidationErrorSchema.model'; + +/** + * @public + */ +export interface ValidationError { + path: Array; + property: string; + message: string; + schema: ValidationErrorSchema; + instance: any; + name: string; + argument: any; + stack: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts new file mode 100644 index 0000000000..397ccab3f2 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type ValidationErrorPathInner = number | string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts new file mode 100644 index 0000000000..851b031d8d --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { Schema } from '../models/Schema.model'; + +/** + * @public + */ +export type ValidationErrorSchema = Schema | string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts new file mode 100644 index 0000000000..598c41822b --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts @@ -0,0 +1,84 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from '../models/Action.model'; +export * from '../models/ActionExample.model'; +export * from '../models/ActionSchema.model'; +export * from '../models/Autocomplete200Response.model'; +export * from '../models/Autocomplete200ResponseResultsInner.model'; +export * from '../models/AutocompleteRequest.model'; +export * from '../models/CancelTask200Response.model'; +export * from '../models/DryRun200Response.model'; +export * from '../models/DryRun200ResponseAllOf.model'; +export * from '../models/DryRun200ResponseAllOfDirectoryContentsInner.model'; +export * from '../models/DryRun200ResponseAllOfStepsInner.model'; +export * from '../models/DryRun200ResponseAllOfStepsInnerAllOf.model'; +export * from '../models/DryRunRequest.model'; +export * from '../models/DryRunRequestDirectoryContentsInner.model'; +export * from '../models/DryRunResult.model'; +export * from '../models/DryRunResultLogInner.model'; +export * from '../models/Entity.model'; +export * from '../models/EntityLink.model'; +export * from '../models/EntityMeta.model'; +export * from '../models/EntityRelation.model'; +export * from '../models/ErrorError.model'; +export * from '../models/ErrorRequest.model'; +export * from '../models/ErrorResponse.model'; +export * from '../models/JsonPrimitive.model'; +export * from '../models/JsonValue.model'; +export * from '../models/ListTasksResponse.model'; +export * from '../models/ModelError.model'; +export * from '../models/RetryRequest.model'; +export * from '../models/Scaffold201Response.model'; +export * from '../models/Scaffold400Response.model'; +export * from '../models/ScaffolderScaffoldOptions.model'; +export * from '../models/Schema.model'; +export * from '../models/SchemaAdditionalItems.model'; +export * from '../models/SchemaDependenciesValue.model'; +export * from '../models/SchemaExclusiveMaximum.model'; +export * from '../models/SchemaItems.model'; +export * from '../models/SchemaRequired.model'; +export * from '../models/SchemaType.model'; +export * from '../models/SerializedFile.model'; +export * from '../models/SerializedTask.model'; +export * from '../models/SerializedTaskEvent.model'; +export * from '../models/TaskEventType.model'; +export * from '../models/TaskRecoverStrategy.model'; +export * from '../models/TaskSecrets.model'; +export * from '../models/TaskSpecV1beta3.model'; +export * from '../models/TaskSpecV1beta3User.model'; +export * from '../models/TaskStatus.model'; +export * from '../models/TaskStep.model'; +export * from '../models/TaskStepEach.model'; +export * from '../models/TemplateEntityStepV1beta3.model'; +export * from '../models/TemplateEntityStepV1beta3AllOf.model'; +export * from '../models/TemplateEntityV1beta3.model'; +export * from '../models/TemplateEntityV1beta3AllOf.model'; +export * from '../models/TemplateEntityV1beta3AllOfSpec.model'; +export * from '../models/TemplateEntityV1beta3AllOfSpecParameters.model'; +export * from '../models/TemplateInfo.model'; +export * from '../models/TemplateInfoEntity.model'; +export * from '../models/TemplateParameterSchema.model'; +export * from '../models/TemplateParameterSchemaStepsInner.model'; +export * from '../models/TemplateParametersV1beta3.model'; +export * from '../models/TemplatePermissionsV1beta3.model'; +export * from '../models/TemplatePermissionsV1beta3AllOf.model'; +export * from '../models/TemplatePresentationV1beta3.model'; +export * from '../models/TemplatePresentationV1beta3ButtonLabels.model'; +export * from '../models/TemplateRecoveryV1beta3.model'; +export * from '../models/ValidationError.model'; +export * from '../models/ValidationErrorPathInner.model'; +export * from '../models/ValidationErrorSchema.model'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/pluginId.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/pluginId.ts new file mode 100644 index 0000000000..313bbbc7d5 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/pluginId.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export const pluginId = 'scaffolder'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/types/discovery.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/types/discovery.ts new file mode 100644 index 0000000000..a7f87d3780 --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/types/discovery.ts @@ -0,0 +1,22 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This is a copy of the DiscoveryApi, to avoid importing core-plugin-api. + */ +export type DiscoveryApi = { + getBaseUrl(pluginId: string): Promise; +}; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/types/fetch.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/types/fetch.ts new file mode 100644 index 0000000000..3de56c028e --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/types/fetch.ts @@ -0,0 +1,22 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This is a copy of FetchApi, to avoid importing core-plugin-api. + */ +export type FetchApi = { + fetch: typeof fetch; +}; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/index.ts b/plugins/scaffolder-common/client/src/schema/openapi/index.ts new file mode 100644 index 0000000000..db98243cbf --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './generated'; diff --git a/plugins/scaffolder-common/package.json b/plugins/scaffolder-common/package.json index 631c106ef3..50d695cdee 100644 --- a/plugins/scaffolder-common/package.json +++ b/plugins/scaffolder-common/package.json @@ -65,6 +65,8 @@ "@backstage/types": "workspace:^" }, "devDependencies": { - "@backstage/cli": "workspace:^" + "@backstage/cli": "workspace:^", + "cross-fetch": "^4.0.0", + "uri-template": "^2.0.0" } } From e2fa65af59b8e60ce2db0518264e524c4b5a289b Mon Sep 17 00:00:00 2001 From: solimant Date: Wed, 11 Dec 2024 22:45:23 +0000 Subject: [PATCH 16/44] Fix OpenAPI types Signed-off-by: solimant --- plugins/scaffolder-backend/src/schema/openapi.yaml | 10 +++++++--- .../generated/models/ListTasksResponse.model.ts | 3 ++- .../generated/models/TaskSpecV1beta3User.model.ts | 2 +- .../generated/models/TemplateInfoEntity.model.ts | 2 +- .../src/schema/openapi/generated/router.ts | 9 ++++++--- .../generated/models/ListTasksResponse.model.ts | 3 ++- .../generated/models/TaskSpecV1beta3User.model.ts | 2 +- .../generated/models/TemplateInfoEntity.model.ts | 2 +- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 3b67678df1..b89c270e59 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -359,6 +359,10 @@ components: type: array items: $ref: '#/components/schemas/SerializedTask' + totalTasks: + type: number + required: + - tasks description: The response shape for the `listTasks` call to the `scaffolder-backend` MapStringString: type: object @@ -640,9 +644,7 @@ components: properties: entity: type: object - properties: {} description: The decorated entity from the Catalog - additionalProperties: {} ref: type: string description: An entity ref for the author of the task @@ -800,12 +802,14 @@ components: description: Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths. entity: type: object - description: The Template entity. properties: metadata: # come back to this one - done $ref: '#/components/schemas/EntityMeta' description: The metadata of the Template. + required: + - metadata + description: The Template entity. required: - entityRef description: |- diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts index 65a3a04bec..a61f35d3e6 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts @@ -24,5 +24,6 @@ import { SerializedTask } from '../models/SerializedTask.model'; * @public */ export interface ListTasksResponse { - tasks?: Array; + tasks: Array; + totalTasks?: number; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts index 7f36a3f171..a47b103213 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts @@ -26,7 +26,7 @@ export interface TaskSpecV1beta3User { /** * The decorated entity from the Catalog */ - entity?: { [key: string]: any }; + entity?: any; /** * An entity ref for the author of the task */ diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts index b59414f80f..993b995512 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts @@ -24,5 +24,5 @@ import { EntityMeta } from '../models/EntityMeta.model'; * @public */ export interface TemplateInfoEntity { - metadata?: EntityMeta; + metadata: EntityMeta; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts index 2bc56e28ad..531561a61b 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -464,7 +464,11 @@ export const spec = { $ref: '#/components/schemas/SerializedTask', }, }, + totalTasks: { + type: 'number', + }, }, + required: ['tasks'], description: 'The response shape for the `listTasks` call to the `scaffolder-backend`', }, @@ -833,9 +837,7 @@ export const spec = { properties: { entity: { type: 'object', - properties: {}, description: 'The decorated entity from the Catalog', - additionalProperties: {}, }, ref: { type: 'string', @@ -1014,13 +1016,14 @@ export const spec = { }, entity: { type: 'object', - description: 'The Template entity.', properties: { metadata: { $ref: '#/components/schemas/EntityMeta', description: 'The metadata of the Template.', }, }, + required: ['metadata'], + description: 'The Template entity.', }, }, required: ['entityRef'], diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts index 65a3a04bec..a61f35d3e6 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts @@ -24,5 +24,6 @@ import { SerializedTask } from '../models/SerializedTask.model'; * @public */ export interface ListTasksResponse { - tasks?: Array; + tasks: Array; + totalTasks?: number; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts index 7f36a3f171..a47b103213 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts @@ -26,7 +26,7 @@ export interface TaskSpecV1beta3User { /** * The decorated entity from the Catalog */ - entity?: { [key: string]: any }; + entity?: any; /** * An entity ref for the author of the task */ diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts index b59414f80f..993b995512 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts @@ -24,5 +24,5 @@ import { EntityMeta } from '../models/EntityMeta.model'; * @public */ export interface TemplateInfoEntity { - metadata?: EntityMeta; + metadata: EntityMeta; } From d2da49c568c43301feab5ac333eb24d3148e8b94 Mon Sep 17 00:00:00 2001 From: solimant Date: Fri, 27 Dec 2024 07:22:58 +0000 Subject: [PATCH 17/44] Deprecate and re-export Signed-off-by: solimant --- .../src/scaffolder/dryrun/createDryRunner.ts | 22 +- .../src/scaffolder/tasks/DatabaseTaskStore.ts | 2 +- .../scaffolder/tasks/taskRecoveryHelper.ts | 2 +- .../src/schema/openapi.yaml | 826 +++++++++--------- .../openapi/generated/apis/Api.server.ts | 10 +- .../models/Autocomplete200Response.model.ts | 2 +- ...tocomplete200ResponseResultsInner.model.ts | 1 + .../models/DryRun200Response.model.ts | 2 +- .../models/DryRun200ResponseAllOf.model.ts | 2 +- .../DryRun200ResponseAllOfStepsInner.model.ts | 6 +- .../generated/models/DryRunRequest.model.ts | 10 +- .../models/DryRunResultLogInner.model.ts | 6 +- ...l.ts => DryRunResultLogInnerBody.model.ts} | 8 +- ...=> DryRunResultLogInnerBodyAllOf.model.ts} | 7 +- .../models/Scaffold201Response.model.ts | 2 +- .../models/ScaffolderScaffoldOptions.model.ts | 3 +- .../openapi/generated/models/Schema.model.ts | 64 -- .../models/SchemaAdditionalItems.model.ts | 25 - .../models/SchemaDependenciesValue.model.ts | 25 - .../generated/models/SchemaItems.model.ts | 25 - .../generated/models/SchemaRequired.model.ts | 24 - .../generated/models/SchemaType.model.ts | 24 - .../generated/models/SerializedTask.model.ts | 3 +- .../models/SerializedTaskEvent.model.ts | 6 +- .../generated/models/TaskEventType.model.ts | 4 +- .../generated/models/TaskSecrets.model.ts | 2 - .../models/TaskSecretsAllOf.model.ts} | 4 +- .../generated/models/TaskSpecV1beta3.model.ts | 55 -- .../models/TaskSpecV1beta3User.model.ts | 34 - .../generated/models/TaskStatus.model.ts | 4 +- .../models/TemplateEntityStepV1beta3.model.ts | 35 - .../TemplateEntityStepV1beta3AllOf.model.ts | 32 - .../models/TemplateEntityV1beta3.model.ts | 53 -- .../TemplateEntityV1beta3AllOf.model.ts | 45 - .../TemplateEntityV1beta3AllOfSpec.model.ts | 49 -- ...eEntityV1beta3AllOfSpecParameters.model.ts | 28 - .../models/TemplateParameterSchema.model.ts | 2 - ...TemplateParameterSchemaStepsInner.model.ts | 3 +- .../models/TemplateParametersV1beta3.model.ts | 25 - .../TemplatePresentationV1beta3.model.ts | 30 - ...tePresentationV1beta3ButtonLabels.model.ts | 38 - .../models/TemplateRecoveryV1beta3.model.ts | 25 - .../generated/models/ValidationError.model.ts | 4 +- .../models/ValidationErrorSchema.model.ts | 25 - .../schema/openapi/generated/models/index.ts | 26 +- .../src/schema/openapi/generated/router.ts | 591 +++---------- .../openapi/generated/apis/Api.client.ts | 12 +- .../models/Autocomplete200Response.model.ts | 2 +- ...tocomplete200ResponseResultsInner.model.ts | 1 + .../models/DryRun200Response.model.ts | 2 +- .../models/DryRun200ResponseAllOf.model.ts | 2 +- .../DryRun200ResponseAllOfStepsInner.model.ts | 6 +- .../generated/models/DryRunRequest.model.ts | 10 +- .../models/DryRunResultLogInner.model.ts | 6 +- .../models/DryRunResultLogInnerBody.model.ts} | 8 +- ...=> DryRunResultLogInnerBodyAllOf.model.ts} | 8 +- .../models/Scaffold201Response.model.ts | 2 +- .../models/ScaffolderScaffoldOptions.model.ts | 3 +- .../openapi/generated/models/Schema.model.ts | 64 -- .../models/SchemaAdditionalItems.model.ts | 25 - .../models/SchemaDependenciesValue.model.ts | 25 - .../generated/models/SchemaItems.model.ts | 25 - .../generated/models/SchemaRequired.model.ts | 24 - .../generated/models/SchemaType.model.ts | 24 - .../generated/models/SerializedTask.model.ts | 3 +- .../models/SerializedTaskEvent.model.ts | 6 +- .../generated/models/TaskEventType.model.ts | 4 +- .../generated/models/TaskSecrets.model.ts | 2 - .../models/TaskSecretsAllOf.model.ts} | 4 +- .../generated/models/TaskSpecV1beta3.model.ts | 55 -- .../models/TaskSpecV1beta3User.model.ts | 34 - .../generated/models/TaskStatus.model.ts | 4 +- .../models/TemplateEntityStepV1beta3.model.ts | 35 - .../TemplateEntityStepV1beta3AllOf.model.ts | 32 - .../models/TemplateEntityV1beta3.model.ts | 53 -- .../TemplateEntityV1beta3AllOf.model.ts | 45 - .../TemplateEntityV1beta3AllOfSpec.model.ts | 49 -- ...eEntityV1beta3AllOfSpecParameters.model.ts | 28 - .../models/TemplateParameterSchema.model.ts | 2 - ...TemplateParameterSchemaStepsInner.model.ts | 3 +- .../models/TemplateParametersV1beta3.model.ts | 25 - .../TemplatePermissionsV1beta3.model.ts | 27 - .../TemplatePermissionsV1beta3AllOf.model.ts | 26 - .../TemplatePresentationV1beta3.model.ts | 30 - ...tePresentationV1beta3ButtonLabels.model.ts | 38 - .../models/TemplateRecoveryV1beta3.model.ts | 25 - .../generated/models/ValidationError.model.ts | 4 +- .../models/ValidationErrorSchema.model.ts | 25 - .../schema/openapi/generated/models/index.ts | 26 +- plugins/scaffolder-common/package.json | 9 +- .../scaffolder-common/src/ScaffolderClient.ts | 430 +++++++++ .../src/TemplateEntityV1beta3.ts | 18 + plugins/scaffolder-common/src/api.ts | 362 ++++++++ plugins/scaffolder-common/src/index.ts | 5 + plugins/scaffolder-node/src/tasks/types.ts | 9 +- plugins/scaffolder-react/src/api/types.ts | 277 ++---- plugins/scaffolder-react/src/types.ts | 17 +- plugins/scaffolder/package.json | 6 - .../DryRunResults/DryRunResultsList.tsx | 2 +- plugins/scaffolder/src/api.ts | 383 +------- .../components/OngoingTask/OngoingTask.tsx | 2 +- .../RepoUrlPicker/BitbucketRepoPicker.tsx | 1 + plugins/scaffolder/src/deprecated.ts | 61 +- 103 files changed, 1619 insertions(+), 3018 deletions(-) rename plugins/scaffolder-backend/src/schema/openapi/generated/models/{DryRun200ResponseAllOfStepsInnerAllOf.model.ts => DryRunResultLogInnerBody.model.ts} (83%) rename plugins/scaffolder-backend/src/schema/openapi/generated/models/{TemplatePermissionsV1beta3AllOf.model.ts => DryRunResultLogInnerBodyAllOf.model.ts} (83%) delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Schema.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaItems.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaRequired.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaType.model.ts rename plugins/{scaffolder-common/client/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts => scaffolder-backend/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts} (92%) delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts rename plugins/{scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts => scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts} (83%) rename plugins/scaffolder-common/client/src/schema/openapi/generated/models/{DryRun200ResponseAllOfStepsInnerAllOf.model.ts => DryRunResultLogInnerBodyAllOf.model.ts} (83%) delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Schema.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaItems.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaRequired.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaType.model.ts rename plugins/{scaffolder-backend/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts => scaffolder-common/client/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts} (92%) delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts create mode 100644 plugins/scaffolder-common/src/ScaffolderClient.ts create mode 100644 plugins/scaffolder-common/src/api.ts diff --git a/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts b/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts index 9d4494c536..d384443252 100644 --- a/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts +++ b/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts @@ -22,7 +22,11 @@ import { import type { UserEntity } from '@backstage/catalog-model'; import { ScmIntegrations } from '@backstage/integration'; import { PermissionEvaluator } from '@backstage/plugin-permission-common'; -import { TaskSpec, TemplateInfo } from '@backstage/plugin-scaffolder-common'; +import { + ScaffolderTaskStatus, + TaskSpec, + TemplateInfo, +} from '@backstage/plugin-scaffolder-common'; import { createTemplateAction, deserializeDirectoryContents, @@ -54,7 +58,13 @@ interface DryRunInput { } interface DryRunResult { - log: Array<{ body: JsonObject }>; + log: Array<{ + body: { + message: string; + stepId?: string; + status?: ScaffolderTaskStatus; + }; + }>; directoryContents: SerializedFile[]; output: JsonObject; } @@ -106,7 +116,13 @@ export function createDryRunner(options: TemplateTesterCreateOptions) { const contentsPath = path.dirname(basePath); const dryRunId = uuid(); - const log = new Array<{ body: JsonObject }>(); + const log = new Array<{ + body: { + message: string; + stepId?: string; + status?: ScaffolderTaskStatus; + }; + }>(); try { await deserializeDirectoryContents(contentsPath, input.directoryContents); diff --git a/plugins/scaffolder-backend/src/scaffolder/tasks/DatabaseTaskStore.ts b/plugins/scaffolder-backend/src/scaffolder/tasks/DatabaseTaskStore.ts index f07d827f45..fdcaa8613e 100644 --- a/plugins/scaffolder-backend/src/scaffolder/tasks/DatabaseTaskStore.ts +++ b/plugins/scaffolder-backend/src/scaffolder/tasks/DatabaseTaskStore.ts @@ -607,7 +607,7 @@ export class DatabaseTaskStore implements TaskStore { const events = rawEvents.map(event => { try { - const body = JSON.parse(event.body) as JsonObject; + const body = JSON.parse(event.body) as SerializedTaskEvent['body']; return { id: Number(event.id), isTaskRecoverable, diff --git a/plugins/scaffolder-backend/src/scaffolder/tasks/taskRecoveryHelper.ts b/plugins/scaffolder-backend/src/scaffolder/tasks/taskRecoveryHelper.ts index f3b8b321fe..fa75bdb2df 100644 --- a/plugins/scaffolder-backend/src/scaffolder/tasks/taskRecoveryHelper.ts +++ b/plugins/scaffolder-backend/src/scaffolder/tasks/taskRecoveryHelper.ts @@ -28,7 +28,7 @@ export const trimEventsTillLastRecovery = ( if (recoveredEventInd >= 0) { const ind = events.length - recoveredEventInd - 1; const { recoverStrategy } = events[ind].body as { - recoverStrategy: TaskRecoverStrategy; + recoverStrategy?: TaskRecoverStrategy; }; if (recoverStrategy === 'startOver') { return { diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index b89c270e59..b1a88c5a49 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -20,11 +20,14 @@ components: required: false allowReserved: true schema: - type: string + type: array + items: + type: string eventsAfter: name: after in: query description: Offset event ID to stream events after. + required: false schema: type: integer kind: @@ -41,8 +44,10 @@ components: required: false allowReserved: true schema: - type: integer - minimum: 0 + type: array + items: + type: integer + minimum: 0 namespace: name: namespace in: path @@ -64,8 +69,10 @@ components: required: false allowReserved: true schema: - type: integer - minimum: 0 + type: array + items: + type: integer + minimum: 0 order: name: order in: query @@ -73,10 +80,9 @@ components: required: false allowReserved: true schema: - type: string - enum: - - asc - - desc + type: array + items: + type: string status: name: status in: query @@ -84,7 +90,9 @@ components: required: false allowReserved: true schema: - type: string + type: array + items: + type: string taskId: name: taskId in: path @@ -142,7 +150,20 @@ components: type: object properties: body: - $ref: '#/components/schemas/JsonObject' + allOf: + - $ref: '#/components/schemas/JsonObject' + - type: object + properties: + message: + type: string + status: + $ref: '#/components/schemas/TaskStatus' + stepId: + type: string + required: + - message + required: + - body directoryContents: type: array items: @@ -339,7 +360,8 @@ components: - type: boolean - type: number - type: string - - nullable: true + - type: object + nullable: true description: A type representing all allowed JSON primitive values. JsonValue: oneOf: @@ -377,8 +399,7 @@ components: type: string values: type: object - additionalProperties: - $ref: '#/components/schemas/JsonValue' + additionalProperties: {} secrets: type: object additionalProperties: @@ -387,128 +408,125 @@ components: - templateRef - values description: The input options to the `scaffold` method of the `ScaffolderClient`. - # come back to this one - done - # check generated - done - Schema: - type: object - properties: - # $id: - # type: string - id: - type: string - # $schema: - # type: string - # $ref: - # type: string - title: - type: string - description: - type: string - multipleOf: - type: number - maximum: - type: number - exclusiveMaximum: - oneOf: - - type: number - - type: boolean - minimum: - type: number - exclusiveMinimum: - oneOf: - - type: number - - type: boolean - maxLength: - type: integer - minLength: - type: integer - pattern: - type: object - additionalItems: - oneOf: - - type: boolean - - $ref: '#/components/schemas/Schema' - items: - oneOf: - - $ref: '#/components/schemas/Schema' - - type: array - items: - $ref: '#/components/schemas/Schema' - maxItems: - type: integer - minItems: - type: integer - uniqueItems: - type: boolean - maxProperties: - type: integer - minProperties: - type: integer - required: - oneOf: - - type: array - items: - type: string - - type: boolean - additionalProperties: - oneOf: - - type: boolean - - $ref: '#/components/schemas/Schema' - definitions: - type: object - additionalProperties: - $ref: '#/components/schemas/Schema' - properties: - type: object - additionalProperties: - $ref: '#/components/schemas/Schema' - patternProperties: - type: object - additionalProperties: - $ref: '#/components/schemas/Schema' - dependencies: - type: object - additionalProperties: - oneOf: - - $ref: '#/components/schemas/Schema' - - type: array - items: - type: string - # const: - # type: object - # enum: - # type: array - # items: - # type: object - type: - oneOf: - - type: string - - type: array - items: - type: string - format: - type: string - allOf: - type: array - items: - $ref: '#/components/schemas/Schema' - anyOf: - type: array - items: - $ref: '#/components/schemas/Schema' - oneOf: - type: array - items: - $ref: '#/components/schemas/Schema' - not: - $ref: '#/components/schemas/Schema' - # if: - # $ref: '#/components/schemas/Schema' - then: - $ref: '#/components/schemas/Schema' - # else: - # $ref: '#/components/schemas/Schema' - additionalProperties: {} + # Schema: + # type: object + # properties: + # $id: + # type: string + # id: + # type: string + # $schema: + # type: string + # $ref: + # type: string + # title: + # type: string + # description: + # type: string + # multipleOf: + # type: number + # maximum: + # type: number + # exclusiveMaximum: + # oneOf: + # - type: number + # - type: boolean + # minimum: + # type: number + # exclusiveMinimum: + # oneOf: + # - type: number + # - type: boolean + # maxLength: + # type: integer + # minLength: + # type: integer + # pattern: + # type: object + # additionalItems: + # oneOf: + # - type: boolean + # - $ref: '#/components/schemas/Schema' + # items: + # oneOf: + # - $ref: '#/components/schemas/Schema' + # - type: array + # items: + # $ref: '#/components/schemas/Schema' + # maxItems: + # type: integer + # minItems: + # type: integer + # uniqueItems: + # type: boolean + # maxProperties: + # type: integer + # minProperties: + # type: integer + # required: + # oneOf: + # - type: array + # items: + # type: string + # - type: boolean + # additionalProperties: + # oneOf: + # - type: boolean + # - $ref: '#/components/schemas/Schema' + # definitions: + # type: object + # additionalProperties: + # $ref: '#/components/schemas/Schema' + # properties: + # type: object + # additionalProperties: + # $ref: '#/components/schemas/Schema' + # patternProperties: + # type: object + # additionalProperties: + # $ref: '#/components/schemas/Schema' + # dependencies: + # type: object + # additionalProperties: + # oneOf: + # - $ref: '#/components/schemas/Schema' + # - type: array + # items: + # type: string + # const: + # type: object + # enum: + # type: array + # items: + # type: object + # type: + # oneOf: + # - type: string + # - type: array + # items: + # type: string + # format: + # type: string + # allOf: + # type: array + # items: + # $ref: '#/components/schemas/Schema' + # anyOf: + # type: array + # items: + # $ref: '#/components/schemas/Schema' + # oneOf: + # type: array + # items: + # $ref: '#/components/schemas/Schema' + # not: + # $ref: '#/components/schemas/Schema' + # if: + # $ref: '#/components/schemas/Schema' + # then: + # $ref: '#/components/schemas/Schema' + # else: + # $ref: '#/components/schemas/Schema' SerializedFile: type: object properties: @@ -534,7 +552,18 @@ components: taskId: type: string body: - $ref: '#/components/schemas/JsonObject' + allOf: + - $ref: '#/components/schemas/JsonObject' + - type: object + properties: + message: + type: string + status: + $ref: '#/components/schemas/TaskStatus' + stepId: + type: string + required: + - message type: $ref: '#/components/schemas/TaskEventType' createdAt: @@ -552,7 +581,8 @@ components: id: type: string spec: - $ref: '#/components/schemas/TaskSpec' + type: object + # $ref: '#/components/schemas/TaskSpec' status: $ref: '#/components/schemas/TaskStatus' createdAt: @@ -571,27 +601,25 @@ components: - status - createdAt description: SerializedTask + # additionalProperties: {} TaskEventType: type: string description: TaskEventType enum: + - cancelled - completion - log - - cancelled - recovered TaskRecovery: type: object # properties: - # come back to this one - done - # EXPERIMENTAL_strategy: - # $ref: '#/components/schemas/TaskRecoverStrategy' + # EXPERIMENTAL_strategy: + # $ref: '#/components/schemas/TaskRecoverStrategy' description: |- When task didn't have a chance to complete due to system restart you can define the strategy what to do with such tasks, by defining a strategy. By default, it is none, what means to not recover but updating the status from 'processing' to 'failed'. - additionalProperties: - $ref: '#/components/schemas/TaskRecoverStrategy' TaskRecoverStrategy: type: string description: | @@ -601,76 +629,77 @@ components: - none - startOver TaskSecrets: - type: object - properties: - backstageToken: - type: string - description: TaskSecrets - additionalProperties: {} - TaskSpec: - $ref: '#/components/schemas/TaskSpecV1beta3' - TaskSpecV1beta3: - type: object - properties: - apiVersion: - type: string - enum: - - "scaffolder.backstage.io/v1beta3" - description: The apiVersion string of the TaskSpec. - parameters: - $ref: '#/components/schemas/JsonObject' - description: | - This is a JSONSchema which is used to render a form in the frontend - to collect user input and validate it against that schema. This can then be used in the `steps` part below to template - variables passed from the user into each action in the template. - steps: - type: array - items: - $ref: '#/components/schemas/TaskStep' - description: | - A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying - javascript action and some optional input parameters that may or may not have been collected from the end user. - output: - type: object + allOf: + - type: object additionalProperties: - $ref: '#/components/schemas/JsonValue' - description: | - The output is an object where template authors can pull out information from template actions and return them in a known standard way. - templateInfo: - $ref: '#/components/schemas/TemplateInfo' - description: Some information about the template that is stored on the task spec. - user: - type: object + type: string + - type: object properties: - entity: - type: object - description: The decorated entity from the Catalog - ref: + backstageToken: type: string - description: An entity ref for the author of the task - description: Some decoration of the author of the task that should be available in the context - # come back to this one - done - # EXPERIMENTAL_recovery: - # $ref: '#/components/schemas/TaskRecovery' - # description: How to recover the task after system restart or system crash. - required: - - apiVersion - - parameters - - steps - - output - description: |- - A scaffolder task as stored in the database, generated from a v1beta3 - apiVersion Template. - additionalProperties: - $ref: '#/components/schemas/TaskRecovery' + description: TaskSecrets + # TaskSpec: + # $ref: '#/components/schemas/TaskSpecV1beta3' + # TaskSpecV1beta3: + # type: object + # properties: + # apiVersion: + # type: string + # enum: + # - scaffolder.backstage.io/v1beta3 + # description: The apiVersion string of the TaskSpec. + # parameters: + # $ref: '#/components/schemas/JsonObject' + # description: | + # This is a JSONSchema which is used to render a form in the frontend + # to collect user input and validate it against that schema. This can then be used in the `steps` part below to template + # variables passed from the user into each action in the template. + # steps: + # type: array + # items: + # $ref: '#/components/schemas/TaskStep' + # description: | + # A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying + # javascript action and some optional input parameters that may or may not have been collected from the end user. + # output: + # type: object + # additionalProperties: + # $ref: '#/components/schemas/JsonValue' + # description: | + # The output is an object where template authors can pull out information from template actions and return them in a known standard way. + # templateInfo: + # $ref: '#/components/schemas/TemplateInfo' + # description: Some information about the template that is stored on the task spec. + # user: + # type: object + # properties: + # entity: + # type: object + # description: The decorated entity from the Catalog + # ref: + # type: string + # description: An entity ref for the author of the task + # description: Some decoration of the author of the task that should be available in the context + # EXPERIMENTAL_recovery: + # $ref: '#/components/schemas/TaskRecovery' + # description: How to recover the task after system restart or system crash. + # required: + # - apiVersion + # - parameters + # - steps + # - output + # description: |- + # A scaffolder task as stored in the database, generated from a v1beta3 + # apiVersion Template. TaskStatus: type: string enum: - - 'cancelled' - - 'completed' - - 'failed' - - 'open' - - 'processing' + - cancelled + - completed + - failed + - open + - processing + - skipped description: The status of each step of the Task TaskStep: type: object @@ -703,94 +732,103 @@ components: - action description: An individual step of a scaffolder task, as stored in the database. additionalProperties: {} - TemplateEntityStepV1beta3: - allOf: - - $ref: '#/components/schemas/JsonObject' - - type: object - properties: - id: - type: string - name: - type: string - action: - type: string - input: - $ref: '#/components/schemas/JsonObject' - # if: - # oneOf: - # - type: string - # - type: boolean - # come back to this one - done - # backstage:permissions: - # $ref: '#/components/schemas/TemplatePermissionsV1beta3' - required: - - action - description: Step that is part of a Template Entity. - additionalProperties: {} - TemplateEntityV1beta3: - allOf: - # come back to this one - done - - $ref: '#/components/schemas/Entity' - - type: object - properties: - apiVersion: - type: string - enum: ['scaffolder.backstage.io/v1beta3'] - description: The apiVersion string of the TaskSpec. - kind: - type: string - enum: ['Template'] - description: The kind of the entity - spec: - type: object - properties: - type: - type: string - description: The type that the Template will create. For example service, website or library. - presentation: - $ref: '#/components/schemas/TemplatePresentationV1beta3' - description: Template specific configuration of the presentation layer. - # come back to this one - done - # EXPERIMENTAL_recovery: - # $ref: '#/components/schemas/TemplateRecoveryV1beta3' - # description: Recovery strategy for the template - parameters: - oneOf: - - $ref: '#/components/schemas/TemplateParametersV1beta3' - - type: array - items: - $ref: '#/components/schemas/TemplateParametersV1beta3' - description: |- - This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend - to collect user input and validate it against that schema. This can then be used in the `steps` part below to template - variables passed from the user into each action in the template. - steps: - type: array - items: - $ref: '#/components/schemas/TemplateEntityStepV1beta3' - description: |- - A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying - javascript action and some optional input parameters that may or may not have been collected from the end user. - output: - type: object - additionalProperties: - type: string - description: The output is an object where template authors can pull out information from template actions and return them in a known standard way. - owner: - type: string - description: The owner entityRef of the TemplateEntity - required: - - type - - steps - description: The specification of the Template Entity - additionalProperties: {} - required: - - apiVersion - - kind - - spec - description: |- - Backstage catalog Template kind Entity. Templates are used by the Scaffolder - plugin to create new entities, such as Components. + # TemplateEntityStepV1beta3: + # allOf: + # - $ref: '#/components/schemas/JsonObject' + # - type: object + # properties: + # id: + # type: string + # name: + # type: string + # action: + # type: string + # input: + # $ref: '#/components/schemas/JsonObject' + # if: + # oneOf: + # - type: string + # - type: boolean + # backstage:permissions: + # $ref: '#/components/schemas/TemplatePermissionsV1beta3' + # required: + # - action + # description: Step that is part of a Template Entity. + # additionalProperties: {} + # TemplateEntityV1beta3: + # allOf: + # - $ref: '#/components/schemas/Entity' + # - type: object + # properties: + # apiVersion: + # type: string + # enum: + # - scaffolder.backstage.io/v1beta3 + # description: The apiVersion string of the TaskSpec. + # kind: + # type: string + # enum: + # - Template + # description: The kind of the entity + # spec: + # type: object + # properties: + # type: + # type: string + # description: The type that the Template will create. For example service, website or library. + # presentation: + # $ref: '#/components/schemas/TemplatePresentationV1beta3' + # description: Template specific configuration of the presentation layer. + # EXPERIMENTAL_recovery: + # $ref: '#/components/schemas/TemplateRecoveryV1beta3' + # description: Recovery strategy for the template + # EXPERIMENTAL_formDecorators: + # type: array + # items: + # type: object + # properties: + # id: + # type: string + # input: + # $ref: '#/components/schemas/JsonObject' + # required: + # - id + # parameters: + # oneOf: + # - $ref: '#/components/schemas/TemplateParametersV1beta3' + # - type: array + # items: + # $ref: '#/components/schemas/TemplateParametersV1beta3' + # description: |- + # This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend + # to collect user input and validate it against that schema. This can then be used in the `steps` part below to template + # variables passed from the user into each action in the template. + # steps: + # type: array + # items: + # $ref: '#/components/schemas/TemplateEntityStepV1beta3' + # description: |- + # A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying + # javascript action and some optional input parameters that may or may not have been collected from the end user. + # output: + # type: object + # additionalProperties: + # type: string + # description: The output is an object where template authors can pull out information from template actions and return them in a known standard way. + # owner: + # type: string + # description: The owner entityRef of the TemplateEntity + # required: + # - type + # - steps + # description: The specification of the Template Entity + # required: + # - apiVersion + # - kind + # - spec + # description: |- + # Backstage catalog Template kind Entity. Templates are used by the Scaffolder + # plugin to create new entities, such as Components. TemplateInfo: type: object properties: @@ -804,7 +842,6 @@ components: type: object properties: metadata: - # come back to this one - done $ref: '#/components/schemas/EntityMeta' description: The metadata of the Template. required: @@ -820,11 +857,10 @@ components: properties: title: type: string - presentation: - $ref: '#/components/schemas/TemplatePresentationV1beta3' + # presentation: + # $ref: '#/components/schemas/TemplatePresentationV1beta3' description: type: string - # come back to this one - done # 'ui:options': # $ref: '#/components/schemas/JsonValue' steps: @@ -837,20 +873,22 @@ components: description: $ref: '#/components/schemas/JsonValue' schema: - $ref: '#/components/schemas/TemplateParametersV1beta3' + type: object + # additionalProperties: {} required: - title - schema - # come back to this one - done # EXPERIMENTAL_formDecorators: # type: array # items: - # - type: object - # properties: - # id: - # type: string - # input: - # $ref: '#/components/schemas/JsonObject' + # type: object + # properties: + # id: + # type: string + # input: + # $ref: '#/components/schemas/JsonObject' + # required: + # - id required: - title - steps @@ -858,72 +896,59 @@ components: The shape of each entry of parameters which gets rendered as a separate step in the wizard input additionalProperties: {} - # check generated - TemplateParametersV1beta3: - allOf: - - $ref: '#/components/schemas/JsonObject' - # - type: object - # properties: - # # come back to this one - done - # backstage:permissions: - # $ref: '#/components/schemas/TemplatePermissionsV1beta3' - - type: object - additionalProperties: - $ref: '#/components/schemas/TemplatePermissionsV1beta3' - description: Parameter that is part of a Template Entity. - TemplatePermissionsV1beta3: - allOf: - - $ref: '#/components/schemas/JsonObject' - - type: object - properties: - tags: - type: array - items: - type: string - description: Access control properties for parts of a template. - TemplatePresentationV1beta3: - type: object - properties: - buttonLabels: - type: object - properties: - backButtonText: - type: string - description: The text for the button which leads to the previous template page - createButtonText: - type: string - description: The text for the button which starts the execution of the template - reviewButtonText: - type: string - description: The text for the button which opens template's review/summary - description: Overrides default buttons' text - additionalProperties: false - description: The presentation of the template. - additionalProperties: {} - # check generated - TemplateRecoveryV1beta3: - allOf: - - $ref: '#/components/schemas/JsonObject' - - type: object - # properties: - # # come back to this one - done - # EXPERIMENTAL_strategy: - # type: string - # enum: - # - none - # - startOver - # description: |- - # none - not recover, let the task be marked as failed - # startOver - do recover, start the execution of the task from the first step. - additionalProperties: - type: string - enum: - - none - - startOver - description: |- - none - not recover, let the task be marked as failed - startOver - do recover, start the execution of the task from the first step. - description: Depends on how you designed your task you might tailor the behaviour for each of them. + # TemplateParametersV1beta3: + # allOf: + # - $ref: '#/components/schemas/JsonObject' + # - type: object + # properties: + # backstage:permissions: + # $ref: '#/components/schemas/TemplatePermissionsV1beta3' + # additionalProperties: {} + # description: Parameter that is part of a Template Entity. + # TemplatePermissionsV1beta3: + # allOf: + # - $ref: '#/components/schemas/JsonObject' + # - type: object + # properties: + # tags: + # type: array + # items: + # type: string + # description: Access control properties for parts of a template. + # TemplatePresentationV1beta3: + # allOf: + # - $ref: '#/components/schemas/JsonObject' + # - type: object + # properties: + # buttonLabels: + # type: object + # properties: + # backButtonText: + # type: string + # description: The text for the button which leads to the previous template page + # createButtonText: + # type: string + # description: The text for the button which starts the execution of the template + # reviewButtonText: + # type: string + # description: The text for the button which opens template's review/summary + # description: Overrides default buttons' text + # description: The presentation of the template. + # additionalProperties: {} + # TemplateRecoveryV1beta3: + # allOf: + # - $ref: '#/components/schemas/JsonObject' + # - type: object + # properties: + # EXPERIMENTAL_strategy: + # type: string + # enum: + # - none + # - startOver + # description: |- + # none - not recover, let the task be marked as failed + # startOver - do recover, start the execution of the task from the first step. + # description: Depends on how you designed your task you might tailor the behaviour for each of them. ValidationError: type: object properties: @@ -937,10 +962,10 @@ components: type: string message: type: string - schema: - oneOf: - - type: string - - $ref: '#/components/schemas/Schema' + # schema: + # oneOf: + # - type: string + # - $ref: '#/components/schemas/Schema' instance: type: object name: @@ -958,6 +983,7 @@ components: - name - argument - stack + additionalProperties: {} securitySchemes: JWT: type: http @@ -1044,6 +1070,8 @@ paths: properties: id: type: string + required: + - id '400': description: Validation errors. content: @@ -1124,6 +1152,8 @@ paths: properties: id: type: string + required: + - id security: - {} - JWT: [] @@ -1174,11 +1204,15 @@ paths: type: object properties: template: - $ref: '#/components/schemas/TemplateEntityV1beta3' - values: type: object + # check generation + # additionalProperties: {} + values: + $ref: '#/components/schemas/JsonObject' secrets: type: object + additionalProperties: + type: string directoryContents: type: array items: @@ -1205,17 +1239,19 @@ paths: steps: type: array items: - allOf: - - $ref: '#/components/schemas/TemplateEntityStepV1beta3' - - type: object - properties: - id: - type: string - name: - type: string - required: - - id - - name + type: object + properties: + id: + type: string + name: + type: string + action: + type: string + required: + - id + - name + - action + additionalProperties: {} directoryContents: type: array items: @@ -1230,6 +1266,8 @@ paths: required: - path - base64Content + required: + - steps '400': description: Validation errors. content: @@ -1280,6 +1318,12 @@ paths: properties: title: type: string + id: + type: string + required: + - id + required: + - results parameters: - in: path name: provider diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts index a288266d2f..d723bf2de3 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -92,11 +92,11 @@ export type ListActions = { */ export type ListTasks = { query: { - createdBy?: string; - limit?: number; - offset?: number; - order?: 'asc' | 'desc'; - status?: string; + createdBy?: Array; + limit?: Array; + offset?: Array; + order?: Array; + status?: Array; }; response: ListTasksResponse; }; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts index cad9a0dd29..b104dcbcc2 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts @@ -23,5 +23,5 @@ import { Autocomplete200ResponseResultsInner } from '../models/Autocomplete200Re * @public */ export interface Autocomplete200Response { - results?: Array; + results: Array; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts index bc8ea23cbb..68e8a77723 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts @@ -23,4 +23,5 @@ */ export interface Autocomplete200ResponseResultsInner { title?: string; + id: string; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts index 92b8d723a0..963b71135f 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts @@ -31,5 +31,5 @@ export interface DryRun200Response { * A type representing all allowed JSON object values. */ output: { [key: string]: any }; - steps?: Array; + steps: Array; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts index 553c6f765a..85d99f90cf 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts @@ -24,6 +24,6 @@ import { DryRun200ResponseAllOfStepsInner } from '../models/DryRun200ResponseAll * @public */ export interface DryRun200ResponseAllOf { - steps?: Array; + steps: Array; directoryContents?: Array; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts index 229860f81a..5a2c0639db 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts @@ -22,11 +22,9 @@ * @public */ export interface DryRun200ResponseAllOfStepsInner { + [key: string]: any; + id: string; name: string; action: string; - /** - * A type representing all allowed JSON object values. - */ - input?: { [key: string]: any }; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts index 510e7fa353..c9f10fd0b0 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts @@ -18,14 +18,16 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { DryRunRequestDirectoryContentsInner } from '../models/DryRunRequestDirectoryContentsInner.model'; -import { TemplateEntityV1beta3 } from '../models/TemplateEntityV1beta3.model'; /** * @public */ export interface DryRunRequest { - template: TemplateEntityV1beta3; - values: any; - secrets?: any; + template: any; + /** + * A type representing all allowed JSON object values. + */ + values: { [key: string]: any }; + secrets?: { [key: string]: string }; directoryContents: Array; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts index 0f987091c0..f0da311b91 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts @@ -17,13 +17,11 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { DryRunResultLogInnerBody } from '../models/DryRunResultLogInnerBody.model'; /** * @public */ export interface DryRunResultLogInner { - /** - * A type representing all allowed JSON object values. - */ - body?: { [key: string]: any }; + body: DryRunResultLogInnerBody; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts similarity index 83% rename from plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts rename to plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts index 6416143493..a675d4b1ae 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts @@ -17,11 +17,13 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { TaskStatus } from '../models/TaskStatus.model'; /** * @public */ -export interface DryRun200ResponseAllOfStepsInnerAllOf { - id: string; - name: string; +export interface DryRunResultLogInnerBody { + message: string; + status?: TaskStatus; + stepId?: string; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts similarity index 83% rename from plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts rename to plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts index c7eda5cd8a..665213a954 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts @@ -17,10 +17,13 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { TaskStatus } from '../models/TaskStatus.model'; /** * @public */ -export interface TemplatePermissionsV1beta3AllOf { - tags?: Array; +export interface DryRunResultLogInnerBodyAllOf { + message: string; + status?: TaskStatus; + stepId?: string; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts index 9ff2cc8494..8c0185ca58 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts @@ -22,5 +22,5 @@ * @public */ export interface Scaffold201Response { - id?: string; + id: string; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts index 68b9927966..d02f776ebc 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts @@ -17,7 +17,6 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** -import { JsonValue } from '../models/JsonValue.model'; /** * The input options to the `scaffold` method of the `ScaffolderClient`. @@ -25,6 +24,6 @@ import { JsonValue } from '../models/JsonValue.model'; */ export interface ScaffolderScaffoldOptions { templateRef: string; - values: { [key: string]: JsonValue }; + values: { [key: string]: any }; secrets?: { [key: string]: string }; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Schema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Schema.model.ts deleted file mode 100644 index 0e24d46c30..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Schema.model.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { SchemaAdditionalItems } from '../models/SchemaAdditionalItems.model'; -import { SchemaDependenciesValue } from '../models/SchemaDependenciesValue.model'; -import { SchemaExclusiveMaximum } from '../models/SchemaExclusiveMaximum.model'; -import { SchemaItems } from '../models/SchemaItems.model'; -import { SchemaRequired } from '../models/SchemaRequired.model'; -import { SchemaType } from '../models/SchemaType.model'; - -/** - * @public - */ -export interface Schema { - [key: string]: any; - - id?: string; - title?: string; - description?: string; - multipleOf?: number; - maximum?: number; - exclusiveMaximum?: SchemaExclusiveMaximum; - minimum?: number; - exclusiveMinimum?: SchemaExclusiveMaximum; - maxLength?: number; - minLength?: number; - pattern?: any; - additionalItems?: SchemaAdditionalItems; - items?: SchemaItems; - maxItems?: number; - minItems?: number; - uniqueItems?: boolean; - maxProperties?: number; - minProperties?: number; - required?: SchemaRequired; - additionalProperties?: SchemaAdditionalItems; - definitions?: { [key: string]: Schema }; - properties?: { [key: string]: Schema }; - patternProperties?: { [key: string]: Schema }; - dependencies?: { [key: string]: SchemaDependenciesValue }; - type?: SchemaType; - format?: string; - allOf?: Array; - anyOf?: Array; - oneOf?: Array; - not?: Schema; - then?: Schema; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts deleted file mode 100644 index 2039e2f9bb..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Schema } from '../models/Schema.model'; - -/** - * @public - */ -export type SchemaAdditionalItems = Schema | boolean; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts deleted file mode 100644 index 97609dda50..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Schema } from '../models/Schema.model'; - -/** - * @public - */ -export type SchemaDependenciesValue = Array | Schema; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaItems.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaItems.model.ts deleted file mode 100644 index c63c6700aa..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaItems.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Schema } from '../models/Schema.model'; - -/** - * @public - */ -export type SchemaItems = Array | Schema; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaRequired.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaRequired.model.ts deleted file mode 100644 index b1b879cb3b..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaRequired.model.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export type SchemaRequired = Array | boolean; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaType.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaType.model.ts deleted file mode 100644 index dd0cbb93db..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaType.model.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export type SchemaType = Array | string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts index 7ba1196cab..f661fe07c7 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts @@ -18,7 +18,6 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { TaskSecrets } from '../models/TaskSecrets.model'; -import { TaskSpecV1beta3 } from '../models/TaskSpecV1beta3.model'; import { TaskStatus } from '../models/TaskStatus.model'; /** @@ -27,7 +26,7 @@ import { TaskStatus } from '../models/TaskStatus.model'; */ export interface SerializedTask { id: string; - spec: TaskSpecV1beta3; + spec: any; status: TaskStatus; createdAt: string; lastHeartbeatAt?: string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts index 484688e324..cc75de3a0f 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts @@ -17,6 +17,7 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { DryRunResultLogInnerBody } from '../models/DryRunResultLogInnerBody.model'; import { TaskEventType } from '../models/TaskEventType.model'; /** @@ -27,10 +28,7 @@ export interface SerializedTaskEvent { id: number; isTaskRecoverable?: boolean; taskId: string; - /** - * A type representing all allowed JSON object values. - */ - body: { [key: string]: any }; + body: DryRunResultLogInnerBody; type: TaskEventType; createdAt: string; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts index 8531d19de8..dd3d36d64e 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts @@ -21,14 +21,14 @@ /** * @public */ -export type TaskEventType = 'completion' | 'log' | 'cancelled' | 'recovered'; +export type TaskEventType = 'cancelled' | 'completion' | 'log' | 'recovered'; /** * @public */ export const TaskEventType = { + Cancelled: 'cancelled' as TaskEventType, Completion: 'completion' as TaskEventType, Log: 'log' as TaskEventType, - Cancelled: 'cancelled' as TaskEventType, Recovered: 'recovered' as TaskEventType, }; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts index ae7c6a891c..74da6527a4 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts @@ -23,7 +23,5 @@ * @public */ export interface TaskSecrets { - [key: string]: any; - backstageToken?: string; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts similarity index 92% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts rename to plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts index c22a44e80b..7c1e5d2e9e 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts @@ -21,4 +21,6 @@ /** * @public */ -export type SchemaExclusiveMaximum = boolean | number; +export interface TaskSecretsAllOf { + backstageToken?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts deleted file mode 100644 index bb32940062..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { JsonValue } from '../models/JsonValue.model'; -import { TaskSpecV1beta3User } from '../models/TaskSpecV1beta3User.model'; -import { TaskStep } from '../models/TaskStep.model'; -import { TemplateInfo } from '../models/TemplateInfo.model'; - -/** - * A scaffolder task as stored in the database, generated from a v1beta3 apiVersion Template. - * @public - */ -export interface TaskSpecV1beta3 { - [key: string]: any; - - /** - * The apiVersion string of the TaskSpec. - */ - apiVersion: TaskSpecV1beta3ApiVersionEnum; - /** - * A type representing all allowed JSON object values. - */ - parameters: { [key: string]: any }; - /** - * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying javascript action and some optional input parameters that may or may not have been collected from the end user. - */ - steps: Array; - /** - * The output is an object where template authors can pull out information from template actions and return them in a known standard way. - */ - output: { [key: string]: JsonValue }; - templateInfo?: TemplateInfo; - user?: TaskSpecV1beta3User; -} - -/** - * @public - */ -export type TaskSpecV1beta3ApiVersionEnum = 'scaffolder.backstage.io/v1beta3'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts deleted file mode 100644 index a47b103213..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Some decoration of the author of the task that should be available in the context - * @public - */ -export interface TaskSpecV1beta3User { - /** - * The decorated entity from the Catalog - */ - entity?: any; - /** - * An entity ref for the author of the task - */ - ref?: string; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts index 42f8137fb3..622aa758c0 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts @@ -26,7 +26,8 @@ export type TaskStatus = | 'completed' | 'failed' | 'open' - | 'processing'; + | 'processing' + | 'skipped'; /** * @public @@ -37,4 +38,5 @@ export const TaskStatus = { Failed: 'failed' as TaskStatus, Open: 'open' as TaskStatus, Processing: 'processing' as TaskStatus, + Skipped: 'skipped' as TaskStatus, }; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts deleted file mode 100644 index e125c46f1d..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Step that is part of a Template Entity. - * @public - */ -export interface TemplateEntityStepV1beta3 { - [key: string]: any; - - id?: string; - name?: string; - action: string; - /** - * A type representing all allowed JSON object values. - */ - input?: { [key: string]: any }; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts deleted file mode 100644 index dfba72bf8d..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export interface TemplateEntityStepV1beta3AllOf { - id?: string; - name?: string; - action: string; - /** - * A type representing all allowed JSON object values. - */ - input?: { [key: string]: any }; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts deleted file mode 100644 index efe325cfeb..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { EntityMeta } from '../models/EntityMeta.model'; -import { EntityRelation } from '../models/EntityRelation.model'; -import { TemplateEntityV1beta3AllOfSpec } from '../models/TemplateEntityV1beta3AllOfSpec.model'; - -/** - * Backstage catalog Template kind Entity. Templates are used by the Scaffolder plugin to create new entities, such as Components. - * @public - */ -export interface TemplateEntityV1beta3 { - /** - * The relations that this entity has with other entities. - */ - relations?: Array; - spec: TemplateEntityV1beta3AllOfSpec; - metadata: EntityMeta; - /** - * The kind of the entity - */ - kind: TemplateEntityV1beta3KindEnum; - /** - * The apiVersion string of the TaskSpec. - */ - apiVersion: TemplateEntityV1beta3ApiVersionEnum; -} - -/** - * @public - */ -export type TemplateEntityV1beta3KindEnum = 'Template'; -/** - * @public - */ -export type TemplateEntityV1beta3ApiVersionEnum = - 'scaffolder.backstage.io/v1beta3'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts deleted file mode 100644 index acc9f8c991..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplateEntityV1beta3AllOfSpec } from '../models/TemplateEntityV1beta3AllOfSpec.model'; - -/** - * @public - */ -export interface TemplateEntityV1beta3AllOf { - /** - * The apiVersion string of the TaskSpec. - */ - apiVersion: TemplateEntityV1beta3AllOfApiVersionEnum; - /** - * The kind of the entity - */ - kind: TemplateEntityV1beta3AllOfKindEnum; - spec: TemplateEntityV1beta3AllOfSpec; -} - -/** - * @public - */ -export type TemplateEntityV1beta3AllOfApiVersionEnum = - 'scaffolder.backstage.io/v1beta3'; -/** - * @public - */ -export type TemplateEntityV1beta3AllOfKindEnum = 'Template'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts deleted file mode 100644 index 3fa0063e08..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplateEntityStepV1beta3 } from '../models/TemplateEntityStepV1beta3.model'; -import { TemplateEntityV1beta3AllOfSpecParameters } from '../models/TemplateEntityV1beta3AllOfSpecParameters.model'; -import { TemplatePresentationV1beta3 } from '../models/TemplatePresentationV1beta3.model'; - -/** - * The specification of the Template Entity - * @public - */ -export interface TemplateEntityV1beta3AllOfSpec { - [key: string]: any; - - /** - * The type that the Template will create. For example service, website or library. - */ - type: string; - presentation?: TemplatePresentationV1beta3; - parameters?: TemplateEntityV1beta3AllOfSpecParameters; - /** - * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying javascript action and some optional input parameters that may or may not have been collected from the end user. - */ - steps: Array; - /** - * The output is an object where template authors can pull out information from template actions and return them in a known standard way. - */ - output?: { [key: string]: string }; - /** - * The owner entityRef of the TemplateEntity - */ - owner?: string; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts deleted file mode 100644 index 1444a74e19..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.model'; - -/** - * This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend to collect user input and validate it against that schema. This can then be used in the `steps` part below to template variables passed from the user into each action in the template. - * @public - */ -export type TemplateEntityV1beta3AllOfSpecParameters = - | Array - | TemplateParametersV1beta3; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts index aab495d098..20e9e5c121 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts @@ -18,7 +18,6 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { TemplateParameterSchemaStepsInner } from '../models/TemplateParameterSchemaStepsInner.model'; -import { TemplatePresentationV1beta3 } from '../models/TemplatePresentationV1beta3.model'; /** * The shape of each entry of parameters which gets rendered as a separate step in the wizard input @@ -28,7 +27,6 @@ export interface TemplateParameterSchema { [key: string]: any; title: string; - presentation?: TemplatePresentationV1beta3; description?: string; steps: Array; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts index 2f170b6fc6..43da448f7f 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts @@ -18,7 +18,6 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { JsonValue } from '../models/JsonValue.model'; -import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.model'; /** * @public @@ -26,5 +25,5 @@ import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.m export interface TemplateParameterSchemaStepsInner { title: JsonValue; description?: JsonValue; - schema: TemplateParametersV1beta3; + schema: any; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts deleted file mode 100644 index e106f9a1de..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Parameter that is part of a Template Entity. - * @public - */ -export interface TemplateParametersV1beta3 {} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts deleted file mode 100644 index 83405f15aa..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplatePresentationV1beta3ButtonLabels } from '../models/TemplatePresentationV1beta3ButtonLabels.model'; - -/** - * The presentation of the template. - * @public - */ -export interface TemplatePresentationV1beta3 { - [key: string]: any; - - buttonLabels?: TemplatePresentationV1beta3ButtonLabels; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts deleted file mode 100644 index 37015a5468..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Overrides default buttons' text - * @public - */ -export interface TemplatePresentationV1beta3ButtonLabels { - /** - * The text for the button which leads to the previous template page - */ - backButtonText?: string; - /** - * The text for the button which starts the execution of the template - */ - createButtonText?: string; - /** - * The text for the button which opens template's review/summary - */ - reviewButtonText?: string; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts deleted file mode 100644 index 3613718ac0..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Depends on how you designed your task you might tailor the behaviour for each of them. - * @public - */ -export interface TemplateRecoveryV1beta3 {} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts index e37d3b4af9..a7c30935df 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts @@ -18,16 +18,16 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { ValidationErrorPathInner } from '../models/ValidationErrorPathInner.model'; -import { ValidationErrorSchema } from '../models/ValidationErrorSchema.model'; /** * @public */ export interface ValidationError { + [key: string]: any; + path: Array; property: string; message: string; - schema: ValidationErrorSchema; instance: any; name: string; argument: any; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts deleted file mode 100644 index 851b031d8d..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Schema } from '../models/Schema.model'; - -/** - * @public - */ -export type ValidationErrorSchema = Schema | string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts index 598c41822b..41a96e63ae 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts @@ -25,11 +25,12 @@ export * from '../models/DryRun200Response.model'; export * from '../models/DryRun200ResponseAllOf.model'; export * from '../models/DryRun200ResponseAllOfDirectoryContentsInner.model'; export * from '../models/DryRun200ResponseAllOfStepsInner.model'; -export * from '../models/DryRun200ResponseAllOfStepsInnerAllOf.model'; export * from '../models/DryRunRequest.model'; export * from '../models/DryRunRequestDirectoryContentsInner.model'; export * from '../models/DryRunResult.model'; export * from '../models/DryRunResultLogInner.model'; +export * from '../models/DryRunResultLogInnerBody.model'; +export * from '../models/DryRunResultLogInnerBodyAllOf.model'; export * from '../models/Entity.model'; export * from '../models/EntityLink.model'; export * from '../models/EntityMeta.model'; @@ -45,40 +46,19 @@ export * from '../models/RetryRequest.model'; export * from '../models/Scaffold201Response.model'; export * from '../models/Scaffold400Response.model'; export * from '../models/ScaffolderScaffoldOptions.model'; -export * from '../models/Schema.model'; -export * from '../models/SchemaAdditionalItems.model'; -export * from '../models/SchemaDependenciesValue.model'; -export * from '../models/SchemaExclusiveMaximum.model'; -export * from '../models/SchemaItems.model'; -export * from '../models/SchemaRequired.model'; -export * from '../models/SchemaType.model'; export * from '../models/SerializedFile.model'; export * from '../models/SerializedTask.model'; export * from '../models/SerializedTaskEvent.model'; export * from '../models/TaskEventType.model'; export * from '../models/TaskRecoverStrategy.model'; export * from '../models/TaskSecrets.model'; -export * from '../models/TaskSpecV1beta3.model'; -export * from '../models/TaskSpecV1beta3User.model'; +export * from '../models/TaskSecretsAllOf.model'; export * from '../models/TaskStatus.model'; export * from '../models/TaskStep.model'; export * from '../models/TaskStepEach.model'; -export * from '../models/TemplateEntityStepV1beta3.model'; -export * from '../models/TemplateEntityStepV1beta3AllOf.model'; -export * from '../models/TemplateEntityV1beta3.model'; -export * from '../models/TemplateEntityV1beta3AllOf.model'; -export * from '../models/TemplateEntityV1beta3AllOfSpec.model'; -export * from '../models/TemplateEntityV1beta3AllOfSpecParameters.model'; export * from '../models/TemplateInfo.model'; export * from '../models/TemplateInfoEntity.model'; export * from '../models/TemplateParameterSchema.model'; export * from '../models/TemplateParameterSchemaStepsInner.model'; -export * from '../models/TemplateParametersV1beta3.model'; -export * from '../models/TemplatePermissionsV1beta3.model'; -export * from '../models/TemplatePermissionsV1beta3AllOf.model'; -export * from '../models/TemplatePresentationV1beta3.model'; -export * from '../models/TemplatePresentationV1beta3ButtonLabels.model'; -export * from '../models/TemplateRecoveryV1beta3.model'; export * from '../models/ValidationError.model'; export * from '../models/ValidationErrorPathInner.model'; -export * from '../models/ValidationErrorSchema.model'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts index 531561a61b..1a94e60653 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -49,13 +49,17 @@ export const spec = { required: false, allowReserved: true, schema: { - type: 'string', + type: 'array', + items: { + type: 'string', + }, }, }, eventsAfter: { name: 'after', in: 'query', description: 'Offset event ID to stream events after.', + required: false, schema: { type: 'integer', }, @@ -76,8 +80,11 @@ export const spec = { required: false, allowReserved: true, schema: { - type: 'integer', - minimum: 0, + type: 'array', + items: { + type: 'integer', + minimum: 0, + }, }, }, namespace: { @@ -105,8 +112,11 @@ export const spec = { required: false, allowReserved: true, schema: { - type: 'integer', - minimum: 0, + type: 'array', + items: { + type: 'integer', + minimum: 0, + }, }, }, order: { @@ -116,8 +126,10 @@ export const spec = { required: false, allowReserved: true, schema: { - type: 'string', - enum: ['asc', 'desc'], + type: 'array', + items: { + type: 'string', + }, }, }, status: { @@ -127,7 +139,10 @@ export const spec = { required: false, allowReserved: true, schema: { - type: 'string', + type: 'array', + items: { + type: 'string', + }, }, }, taskId: { @@ -207,9 +222,29 @@ export const spec = { type: 'object', properties: { body: { - $ref: '#/components/schemas/JsonObject', + allOf: [ + { + $ref: '#/components/schemas/JsonObject', + }, + { + type: 'object', + properties: { + message: { + type: 'string', + }, + status: { + $ref: '#/components/schemas/TaskStatus', + }, + stepId: { + type: 'string', + }, + }, + required: ['message'], + }, + ], }, }, + required: ['body'], }, }, directoryContents: { @@ -428,6 +463,7 @@ export const spec = { type: 'string', }, { + type: 'object', nullable: true, }, ], @@ -488,9 +524,7 @@ export const spec = { }, values: { type: 'object', - additionalProperties: { - $ref: '#/components/schemas/JsonValue', - }, + additionalProperties: {}, }, secrets: { type: 'object', @@ -503,194 +537,6 @@ export const spec = { description: 'The input options to the `scaffold` method of the `ScaffolderClient`.', }, - Schema: { - type: 'object', - properties: { - id: { - type: 'string', - }, - title: { - type: 'string', - }, - description: { - type: 'string', - }, - multipleOf: { - type: 'number', - }, - maximum: { - type: 'number', - }, - exclusiveMaximum: { - oneOf: [ - { - type: 'number', - }, - { - type: 'boolean', - }, - ], - }, - minimum: { - type: 'number', - }, - exclusiveMinimum: { - oneOf: [ - { - type: 'number', - }, - { - type: 'boolean', - }, - ], - }, - maxLength: { - type: 'integer', - }, - minLength: { - type: 'integer', - }, - pattern: { - type: 'object', - }, - additionalItems: { - oneOf: [ - { - type: 'boolean', - }, - { - $ref: '#/components/schemas/Schema', - }, - ], - }, - items: { - oneOf: [ - { - $ref: '#/components/schemas/Schema', - }, - { - type: 'array', - items: { - $ref: '#/components/schemas/Schema', - }, - }, - ], - }, - maxItems: { - type: 'integer', - }, - minItems: { - type: 'integer', - }, - uniqueItems: { - type: 'boolean', - }, - maxProperties: { - type: 'integer', - }, - minProperties: { - type: 'integer', - }, - required: { - oneOf: [ - { - type: 'array', - items: { - type: 'string', - }, - }, - { - type: 'boolean', - }, - ], - }, - additionalProperties: { - oneOf: [ - { - type: 'boolean', - }, - { - $ref: '#/components/schemas/Schema', - }, - ], - }, - definitions: { - type: 'object', - additionalProperties: { - $ref: '#/components/schemas/Schema', - }, - }, - properties: { - type: 'object', - additionalProperties: { - $ref: '#/components/schemas/Schema', - }, - }, - patternProperties: { - type: 'object', - additionalProperties: { - $ref: '#/components/schemas/Schema', - }, - }, - dependencies: { - type: 'object', - additionalProperties: { - oneOf: [ - { - $ref: '#/components/schemas/Schema', - }, - { - type: 'array', - items: { - type: 'string', - }, - }, - ], - }, - }, - type: { - oneOf: [ - { - type: 'string', - }, - { - type: 'array', - items: { - type: 'string', - }, - }, - ], - }, - format: { - type: 'string', - }, - allOf: { - type: 'array', - items: { - $ref: '#/components/schemas/Schema', - }, - }, - anyOf: { - type: 'array', - items: { - $ref: '#/components/schemas/Schema', - }, - }, - oneOf: { - type: 'array', - items: { - $ref: '#/components/schemas/Schema', - }, - }, - not: { - $ref: '#/components/schemas/Schema', - }, - then: { - $ref: '#/components/schemas/Schema', - }, - }, - additionalProperties: {}, - }, SerializedFile: { type: 'object', properties: { @@ -723,7 +569,26 @@ export const spec = { type: 'string', }, body: { - $ref: '#/components/schemas/JsonObject', + allOf: [ + { + $ref: '#/components/schemas/JsonObject', + }, + { + type: 'object', + properties: { + message: { + type: 'string', + }, + status: { + $ref: '#/components/schemas/TaskStatus', + }, + stepId: { + type: 'string', + }, + }, + required: ['message'], + }, + ], }, type: { $ref: '#/components/schemas/TaskEventType', @@ -742,7 +607,7 @@ export const spec = { type: 'string', }, spec: { - $ref: '#/components/schemas/TaskSpec', + type: 'object', }, status: { $ref: '#/components/schemas/TaskStatus', @@ -769,15 +634,12 @@ export const spec = { TaskEventType: { type: 'string', description: 'TaskEventType', - enum: ['completion', 'log', 'cancelled', 'recovered'], + enum: ['cancelled', 'completion', 'log', 'recovered'], }, TaskRecovery: { type: 'object', description: "When task didn't have a chance to complete due to system restart you can define the strategy what to do with such tasks,\nby defining a strategy.\n\nBy default, it is none, what means to not recover but updating the status from 'processing' to 'failed'.", - additionalProperties: { - $ref: '#/components/schemas/TaskRecoverStrategy', - }, }, TaskRecoverStrategy: { type: 'string', @@ -786,78 +648,34 @@ export const spec = { enum: ['none', 'startOver'], }, TaskSecrets: { - type: 'object', - properties: { - backstageToken: { - type: 'string', - }, - }, - description: 'TaskSecrets', - additionalProperties: {}, - }, - TaskSpec: { - $ref: '#/components/schemas/TaskSpecV1beta3', - }, - TaskSpecV1beta3: { - type: 'object', - properties: { - apiVersion: { - type: 'string', - enum: ['scaffolder.backstage.io/v1beta3'], - description: 'The apiVersion string of the TaskSpec.', - }, - parameters: { - $ref: '#/components/schemas/JsonObject', - description: - 'This is a JSONSchema which is used to render a form in the frontend\nto collect user input and validate it against that schema. This can then be used in the `steps` part below to template\nvariables passed from the user into each action in the template.\n', - }, - steps: { - type: 'array', - items: { - $ref: '#/components/schemas/TaskStep', - }, - description: - 'A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying\njavascript action and some optional input parameters that may or may not have been collected from the end user.\n', - }, - output: { + allOf: [ + { type: 'object', additionalProperties: { - $ref: '#/components/schemas/JsonValue', + type: 'string', }, - description: - 'The output is an object where template authors can pull out information from template actions and return them in a known standard way.\n', }, - templateInfo: { - $ref: '#/components/schemas/TemplateInfo', - description: - 'Some information about the template that is stored on the task spec.', - }, - user: { + { type: 'object', properties: { - entity: { - type: 'object', - description: 'The decorated entity from the Catalog', - }, - ref: { + backstageToken: { type: 'string', - description: 'An entity ref for the author of the task', }, }, - description: - 'Some decoration of the author of the task that should be available in the context', }, - }, - required: ['apiVersion', 'parameters', 'steps', 'output'], - description: - 'A scaffolder task as stored in the database, generated from a v1beta3\napiVersion Template.', - additionalProperties: { - $ref: '#/components/schemas/TaskRecovery', - }, + ], + description: 'TaskSecrets', }, TaskStatus: { type: 'string', - enum: ['cancelled', 'completed', 'failed', 'open', 'processing'], + enum: [ + 'cancelled', + 'completed', + 'failed', + 'open', + 'processing', + 'skipped', + ], description: 'The status of each step of the Task', }, TaskStep: { @@ -897,111 +715,6 @@ export const spec = { 'An individual step of a scaffolder task, as stored in the database.', additionalProperties: {}, }, - TemplateEntityStepV1beta3: { - allOf: [ - { - $ref: '#/components/schemas/JsonObject', - }, - { - type: 'object', - properties: { - id: { - type: 'string', - }, - name: { - type: 'string', - }, - action: { - type: 'string', - }, - input: { - $ref: '#/components/schemas/JsonObject', - }, - }, - required: ['action'], - }, - ], - description: 'Step that is part of a Template Entity.', - additionalProperties: {}, - }, - TemplateEntityV1beta3: { - allOf: [ - { - $ref: '#/components/schemas/Entity', - }, - { - type: 'object', - properties: { - apiVersion: { - type: 'string', - enum: ['scaffolder.backstage.io/v1beta3'], - description: 'The apiVersion string of the TaskSpec.', - }, - kind: { - type: 'string', - enum: ['Template'], - description: 'The kind of the entity', - }, - spec: { - type: 'object', - properties: { - type: { - type: 'string', - description: - 'The type that the Template will create. For example service, website or library.', - }, - presentation: { - $ref: '#/components/schemas/TemplatePresentationV1beta3', - description: - 'Template specific configuration of the presentation layer.', - }, - parameters: { - oneOf: [ - { - $ref: '#/components/schemas/TemplateParametersV1beta3', - }, - { - type: 'array', - items: { - $ref: '#/components/schemas/TemplateParametersV1beta3', - }, - }, - ], - description: - "This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend\nto collect user input and validate it against that schema. This can then be used in the `steps` part below to template\nvariables passed from the user into each action in the template.", - }, - steps: { - type: 'array', - items: { - $ref: '#/components/schemas/TemplateEntityStepV1beta3', - }, - description: - 'A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying\njavascript action and some optional input parameters that may or may not have been collected from the end user.', - }, - output: { - type: 'object', - additionalProperties: { - type: 'string', - }, - description: - 'The output is an object where template authors can pull out information from template actions and return them in a known standard way.', - }, - owner: { - type: 'string', - description: 'The owner entityRef of the TemplateEntity', - }, - }, - required: ['type', 'steps'], - description: 'The specification of the Template Entity', - additionalProperties: {}, - }, - }, - required: ['apiVersion', 'kind', 'spec'], - }, - ], - description: - 'Backstage catalog Template kind Entity. Templates are used by the Scaffolder\nplugin to create new entities, such as Components.', - }, TemplateInfo: { type: 'object', properties: { @@ -1036,9 +749,6 @@ export const spec = { title: { type: 'string', }, - presentation: { - $ref: '#/components/schemas/TemplatePresentationV1beta3', - }, description: { type: 'string', }, @@ -1054,7 +764,7 @@ export const spec = { $ref: '#/components/schemas/JsonValue', }, schema: { - $ref: '#/components/schemas/TemplateParametersV1beta3', + type: 'object', }, }, required: ['title', 'schema'], @@ -1066,86 +776,6 @@ export const spec = { 'The shape of each entry of parameters which gets rendered\nas a separate step in the wizard input', additionalProperties: {}, }, - TemplateParametersV1beta3: { - allOf: [ - { - $ref: '#/components/schemas/JsonObject', - }, - { - type: 'object', - additionalProperties: { - $ref: '#/components/schemas/TemplatePermissionsV1beta3', - }, - }, - ], - description: 'Parameter that is part of a Template Entity.', - }, - TemplatePermissionsV1beta3: { - allOf: [ - { - $ref: '#/components/schemas/JsonObject', - }, - { - type: 'object', - properties: { - tags: { - type: 'array', - items: { - type: 'string', - }, - }, - }, - }, - ], - description: 'Access control properties for parts of a template.', - }, - TemplatePresentationV1beta3: { - type: 'object', - properties: { - buttonLabels: { - type: 'object', - properties: { - backButtonText: { - type: 'string', - description: - 'The text for the button which leads to the previous template page', - }, - createButtonText: { - type: 'string', - description: - 'The text for the button which starts the execution of the template', - }, - reviewButtonText: { - type: 'string', - description: - "The text for the button which opens template's review/summary", - }, - }, - description: "Overrides default buttons' text", - additionalProperties: false, - }, - }, - description: 'The presentation of the template.', - additionalProperties: {}, - }, - TemplateRecoveryV1beta3: { - allOf: [ - { - $ref: '#/components/schemas/JsonObject', - }, - { - type: 'object', - additionalProperties: { - type: 'string', - enum: ['none', 'startOver'], - description: - 'none - not recover, let the task be marked as failed\nstartOver - do recover, start the execution of the task from the first step.', - }, - }, - ], - description: - 'Depends on how you designed your task you might tailor the behaviour for each of them.', - }, ValidationError: { type: 'object', properties: { @@ -1168,16 +798,6 @@ export const spec = { message: { type: 'string', }, - schema: { - oneOf: [ - { - type: 'string', - }, - { - $ref: '#/components/schemas/Schema', - }, - ], - }, instance: { type: 'object', }, @@ -1201,6 +821,7 @@ export const spec = { 'argument', 'stack', ], + additionalProperties: {}, }, }, securitySchemes: { @@ -1345,6 +966,7 @@ export const spec = { type: 'string', }, }, + required: ['id'], }, }, }, @@ -1476,6 +1098,7 @@ export const spec = { type: 'string', }, }, + required: ['id'], }, }, }, @@ -1561,13 +1184,16 @@ export const spec = { type: 'object', properties: { template: { - $ref: '#/components/schemas/TemplateEntityV1beta3', + type: 'object', }, values: { - type: 'object', + $ref: '#/components/schemas/JsonObject', }, secrets: { type: 'object', + additionalProperties: { + type: 'string', + }, }, directoryContents: { type: 'array', @@ -1605,23 +1231,20 @@ export const spec = { steps: { type: 'array', items: { - allOf: [ - { - $ref: '#/components/schemas/TemplateEntityStepV1beta3', + type: 'object', + properties: { + id: { + type: 'string', }, - { - type: 'object', - properties: { - id: { - type: 'string', - }, - name: { - type: 'string', - }, - }, - required: ['id', 'name'], + name: { + type: 'string', }, - ], + action: { + type: 'string', + }, + }, + required: ['id', 'name', 'action'], + additionalProperties: {}, }, }, directoryContents: { @@ -1643,6 +1266,7 @@ export const spec = { }, }, }, + required: ['steps'], }, ], }, @@ -1715,10 +1339,15 @@ export const spec = { title: { type: 'string', }, + id: { + type: 'string', + }, }, + required: ['id'], }, }, }, + required: ['results'], }, }, }, diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts index 87a2cc94eb..ef188b6a4d 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts @@ -104,11 +104,11 @@ export type ListActions = {}; */ export type ListTasks = { query: { - createdBy?: string; - limit?: number; - offset?: number; - order?: 'asc' | 'desc'; - status?: string; + createdBy?: Array; + limit?: Array; + offset?: Array; + order?: Array; + status?: Array; }; }; /** @@ -339,7 +339,7 @@ export class DefaultApiClient { ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - const uriTemplate = `/v2/tasks{?createdBy,limit,offset,order,status}`; + const uriTemplate = `/v2/tasks{?createdBy*,limit*,offset*,order*,status*}`; const uri = parser.parse(uriTemplate).expand({ ...request.query, diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts index cad9a0dd29..b104dcbcc2 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts @@ -23,5 +23,5 @@ import { Autocomplete200ResponseResultsInner } from '../models/Autocomplete200Re * @public */ export interface Autocomplete200Response { - results?: Array; + results: Array; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts index bc8ea23cbb..68e8a77723 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts @@ -23,4 +23,5 @@ */ export interface Autocomplete200ResponseResultsInner { title?: string; + id: string; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts index 92b8d723a0..963b71135f 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts @@ -31,5 +31,5 @@ export interface DryRun200Response { * A type representing all allowed JSON object values. */ output: { [key: string]: any }; - steps?: Array; + steps: Array; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts index 553c6f765a..85d99f90cf 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts @@ -24,6 +24,6 @@ import { DryRun200ResponseAllOfStepsInner } from '../models/DryRun200ResponseAll * @public */ export interface DryRun200ResponseAllOf { - steps?: Array; + steps: Array; directoryContents?: Array; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts index 229860f81a..5a2c0639db 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts @@ -22,11 +22,9 @@ * @public */ export interface DryRun200ResponseAllOfStepsInner { + [key: string]: any; + id: string; name: string; action: string; - /** - * A type representing all allowed JSON object values. - */ - input?: { [key: string]: any }; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts index 510e7fa353..c9f10fd0b0 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts @@ -18,14 +18,16 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { DryRunRequestDirectoryContentsInner } from '../models/DryRunRequestDirectoryContentsInner.model'; -import { TemplateEntityV1beta3 } from '../models/TemplateEntityV1beta3.model'; /** * @public */ export interface DryRunRequest { - template: TemplateEntityV1beta3; - values: any; - secrets?: any; + template: any; + /** + * A type representing all allowed JSON object values. + */ + values: { [key: string]: any }; + secrets?: { [key: string]: string }; directoryContents: Array; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts index 0f987091c0..f0da311b91 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts @@ -17,13 +17,11 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { DryRunResultLogInnerBody } from '../models/DryRunResultLogInnerBody.model'; /** * @public */ export interface DryRunResultLogInner { - /** - * A type representing all allowed JSON object values. - */ - body?: { [key: string]: any }; + body: DryRunResultLogInnerBody; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts similarity index 83% rename from plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts rename to plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts index 68c2df70a8..a675d4b1ae 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts @@ -17,11 +17,13 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { TaskStatus } from '../models/TaskStatus.model'; /** - * Access control properties for parts of a template. * @public */ -export interface TemplatePermissionsV1beta3 { - tags?: Array; +export interface DryRunResultLogInnerBody { + message: string; + status?: TaskStatus; + stepId?: string; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts similarity index 83% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts rename to plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts index 6416143493..665213a954 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInnerAllOf.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts @@ -17,11 +17,13 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { TaskStatus } from '../models/TaskStatus.model'; /** * @public */ -export interface DryRun200ResponseAllOfStepsInnerAllOf { - id: string; - name: string; +export interface DryRunResultLogInnerBodyAllOf { + message: string; + status?: TaskStatus; + stepId?: string; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts index 9ff2cc8494..8c0185ca58 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts @@ -22,5 +22,5 @@ * @public */ export interface Scaffold201Response { - id?: string; + id: string; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts index 68b9927966..d02f776ebc 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts @@ -17,7 +17,6 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** -import { JsonValue } from '../models/JsonValue.model'; /** * The input options to the `scaffold` method of the `ScaffolderClient`. @@ -25,6 +24,6 @@ import { JsonValue } from '../models/JsonValue.model'; */ export interface ScaffolderScaffoldOptions { templateRef: string; - values: { [key: string]: JsonValue }; + values: { [key: string]: any }; secrets?: { [key: string]: string }; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Schema.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Schema.model.ts deleted file mode 100644 index 0e24d46c30..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Schema.model.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { SchemaAdditionalItems } from '../models/SchemaAdditionalItems.model'; -import { SchemaDependenciesValue } from '../models/SchemaDependenciesValue.model'; -import { SchemaExclusiveMaximum } from '../models/SchemaExclusiveMaximum.model'; -import { SchemaItems } from '../models/SchemaItems.model'; -import { SchemaRequired } from '../models/SchemaRequired.model'; -import { SchemaType } from '../models/SchemaType.model'; - -/** - * @public - */ -export interface Schema { - [key: string]: any; - - id?: string; - title?: string; - description?: string; - multipleOf?: number; - maximum?: number; - exclusiveMaximum?: SchemaExclusiveMaximum; - minimum?: number; - exclusiveMinimum?: SchemaExclusiveMaximum; - maxLength?: number; - minLength?: number; - pattern?: any; - additionalItems?: SchemaAdditionalItems; - items?: SchemaItems; - maxItems?: number; - minItems?: number; - uniqueItems?: boolean; - maxProperties?: number; - minProperties?: number; - required?: SchemaRequired; - additionalProperties?: SchemaAdditionalItems; - definitions?: { [key: string]: Schema }; - properties?: { [key: string]: Schema }; - patternProperties?: { [key: string]: Schema }; - dependencies?: { [key: string]: SchemaDependenciesValue }; - type?: SchemaType; - format?: string; - allOf?: Array; - anyOf?: Array; - oneOf?: Array; - not?: Schema; - then?: Schema; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts deleted file mode 100644 index 2039e2f9bb..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaAdditionalItems.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Schema } from '../models/Schema.model'; - -/** - * @public - */ -export type SchemaAdditionalItems = Schema | boolean; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts deleted file mode 100644 index 97609dda50..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaDependenciesValue.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Schema } from '../models/Schema.model'; - -/** - * @public - */ -export type SchemaDependenciesValue = Array | Schema; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaItems.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaItems.model.ts deleted file mode 100644 index c63c6700aa..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaItems.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Schema } from '../models/Schema.model'; - -/** - * @public - */ -export type SchemaItems = Array | Schema; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaRequired.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaRequired.model.ts deleted file mode 100644 index b1b879cb3b..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaRequired.model.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export type SchemaRequired = Array | boolean; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaType.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaType.model.ts deleted file mode 100644 index dd0cbb93db..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SchemaType.model.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export type SchemaType = Array | string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts index 7ba1196cab..f661fe07c7 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts @@ -18,7 +18,6 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { TaskSecrets } from '../models/TaskSecrets.model'; -import { TaskSpecV1beta3 } from '../models/TaskSpecV1beta3.model'; import { TaskStatus } from '../models/TaskStatus.model'; /** @@ -27,7 +26,7 @@ import { TaskStatus } from '../models/TaskStatus.model'; */ export interface SerializedTask { id: string; - spec: TaskSpecV1beta3; + spec: any; status: TaskStatus; createdAt: string; lastHeartbeatAt?: string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts index 484688e324..cc75de3a0f 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts @@ -17,6 +17,7 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { DryRunResultLogInnerBody } from '../models/DryRunResultLogInnerBody.model'; import { TaskEventType } from '../models/TaskEventType.model'; /** @@ -27,10 +28,7 @@ export interface SerializedTaskEvent { id: number; isTaskRecoverable?: boolean; taskId: string; - /** - * A type representing all allowed JSON object values. - */ - body: { [key: string]: any }; + body: DryRunResultLogInnerBody; type: TaskEventType; createdAt: string; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts index 8531d19de8..dd3d36d64e 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts @@ -21,14 +21,14 @@ /** * @public */ -export type TaskEventType = 'completion' | 'log' | 'cancelled' | 'recovered'; +export type TaskEventType = 'cancelled' | 'completion' | 'log' | 'recovered'; /** * @public */ export const TaskEventType = { + Cancelled: 'cancelled' as TaskEventType, Completion: 'completion' as TaskEventType, Log: 'log' as TaskEventType, - Cancelled: 'cancelled' as TaskEventType, Recovered: 'recovered' as TaskEventType, }; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts index ae7c6a891c..74da6527a4 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts @@ -23,7 +23,5 @@ * @public */ export interface TaskSecrets { - [key: string]: any; - backstageToken?: string; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts similarity index 92% rename from plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts rename to plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts index c22a44e80b..7c1e5d2e9e 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SchemaExclusiveMaximum.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts @@ -21,4 +21,6 @@ /** * @public */ -export type SchemaExclusiveMaximum = boolean | number; +export interface TaskSecretsAllOf { + backstageToken?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts deleted file mode 100644 index bb32940062..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3.model.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { JsonValue } from '../models/JsonValue.model'; -import { TaskSpecV1beta3User } from '../models/TaskSpecV1beta3User.model'; -import { TaskStep } from '../models/TaskStep.model'; -import { TemplateInfo } from '../models/TemplateInfo.model'; - -/** - * A scaffolder task as stored in the database, generated from a v1beta3 apiVersion Template. - * @public - */ -export interface TaskSpecV1beta3 { - [key: string]: any; - - /** - * The apiVersion string of the TaskSpec. - */ - apiVersion: TaskSpecV1beta3ApiVersionEnum; - /** - * A type representing all allowed JSON object values. - */ - parameters: { [key: string]: any }; - /** - * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying javascript action and some optional input parameters that may or may not have been collected from the end user. - */ - steps: Array; - /** - * The output is an object where template authors can pull out information from template actions and return them in a known standard way. - */ - output: { [key: string]: JsonValue }; - templateInfo?: TemplateInfo; - user?: TaskSpecV1beta3User; -} - -/** - * @public - */ -export type TaskSpecV1beta3ApiVersionEnum = 'scaffolder.backstage.io/v1beta3'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts deleted file mode 100644 index a47b103213..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSpecV1beta3User.model.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Some decoration of the author of the task that should be available in the context - * @public - */ -export interface TaskSpecV1beta3User { - /** - * The decorated entity from the Catalog - */ - entity?: any; - /** - * An entity ref for the author of the task - */ - ref?: string; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts index 42f8137fb3..622aa758c0 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts @@ -26,7 +26,8 @@ export type TaskStatus = | 'completed' | 'failed' | 'open' - | 'processing'; + | 'processing' + | 'skipped'; /** * @public @@ -37,4 +38,5 @@ export const TaskStatus = { Failed: 'failed' as TaskStatus, Open: 'open' as TaskStatus, Processing: 'processing' as TaskStatus, + Skipped: 'skipped' as TaskStatus, }; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts deleted file mode 100644 index e125c46f1d..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3.model.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Step that is part of a Template Entity. - * @public - */ -export interface TemplateEntityStepV1beta3 { - [key: string]: any; - - id?: string; - name?: string; - action: string; - /** - * A type representing all allowed JSON object values. - */ - input?: { [key: string]: any }; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts deleted file mode 100644 index dfba72bf8d..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityStepV1beta3AllOf.model.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export interface TemplateEntityStepV1beta3AllOf { - id?: string; - name?: string; - action: string; - /** - * A type representing all allowed JSON object values. - */ - input?: { [key: string]: any }; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts deleted file mode 100644 index efe325cfeb..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3.model.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { EntityMeta } from '../models/EntityMeta.model'; -import { EntityRelation } from '../models/EntityRelation.model'; -import { TemplateEntityV1beta3AllOfSpec } from '../models/TemplateEntityV1beta3AllOfSpec.model'; - -/** - * Backstage catalog Template kind Entity. Templates are used by the Scaffolder plugin to create new entities, such as Components. - * @public - */ -export interface TemplateEntityV1beta3 { - /** - * The relations that this entity has with other entities. - */ - relations?: Array; - spec: TemplateEntityV1beta3AllOfSpec; - metadata: EntityMeta; - /** - * The kind of the entity - */ - kind: TemplateEntityV1beta3KindEnum; - /** - * The apiVersion string of the TaskSpec. - */ - apiVersion: TemplateEntityV1beta3ApiVersionEnum; -} - -/** - * @public - */ -export type TemplateEntityV1beta3KindEnum = 'Template'; -/** - * @public - */ -export type TemplateEntityV1beta3ApiVersionEnum = - 'scaffolder.backstage.io/v1beta3'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts deleted file mode 100644 index acc9f8c991..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOf.model.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplateEntityV1beta3AllOfSpec } from '../models/TemplateEntityV1beta3AllOfSpec.model'; - -/** - * @public - */ -export interface TemplateEntityV1beta3AllOf { - /** - * The apiVersion string of the TaskSpec. - */ - apiVersion: TemplateEntityV1beta3AllOfApiVersionEnum; - /** - * The kind of the entity - */ - kind: TemplateEntityV1beta3AllOfKindEnum; - spec: TemplateEntityV1beta3AllOfSpec; -} - -/** - * @public - */ -export type TemplateEntityV1beta3AllOfApiVersionEnum = - 'scaffolder.backstage.io/v1beta3'; -/** - * @public - */ -export type TemplateEntityV1beta3AllOfKindEnum = 'Template'; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts deleted file mode 100644 index 3fa0063e08..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpec.model.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplateEntityStepV1beta3 } from '../models/TemplateEntityStepV1beta3.model'; -import { TemplateEntityV1beta3AllOfSpecParameters } from '../models/TemplateEntityV1beta3AllOfSpecParameters.model'; -import { TemplatePresentationV1beta3 } from '../models/TemplatePresentationV1beta3.model'; - -/** - * The specification of the Template Entity - * @public - */ -export interface TemplateEntityV1beta3AllOfSpec { - [key: string]: any; - - /** - * The type that the Template will create. For example service, website or library. - */ - type: string; - presentation?: TemplatePresentationV1beta3; - parameters?: TemplateEntityV1beta3AllOfSpecParameters; - /** - * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying javascript action and some optional input parameters that may or may not have been collected from the end user. - */ - steps: Array; - /** - * The output is an object where template authors can pull out information from template actions and return them in a known standard way. - */ - output?: { [key: string]: string }; - /** - * The owner entityRef of the TemplateEntity - */ - owner?: string; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts deleted file mode 100644 index 1444a74e19..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateEntityV1beta3AllOfSpecParameters.model.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.model'; - -/** - * This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend to collect user input and validate it against that schema. This can then be used in the `steps` part below to template variables passed from the user into each action in the template. - * @public - */ -export type TemplateEntityV1beta3AllOfSpecParameters = - | Array - | TemplateParametersV1beta3; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts index aab495d098..20e9e5c121 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts @@ -18,7 +18,6 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { TemplateParameterSchemaStepsInner } from '../models/TemplateParameterSchemaStepsInner.model'; -import { TemplatePresentationV1beta3 } from '../models/TemplatePresentationV1beta3.model'; /** * The shape of each entry of parameters which gets rendered as a separate step in the wizard input @@ -28,7 +27,6 @@ export interface TemplateParameterSchema { [key: string]: any; title: string; - presentation?: TemplatePresentationV1beta3; description?: string; steps: Array; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts index 2f170b6fc6..43da448f7f 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts @@ -18,7 +18,6 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { JsonValue } from '../models/JsonValue.model'; -import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.model'; /** * @public @@ -26,5 +25,5 @@ import { TemplateParametersV1beta3 } from '../models/TemplateParametersV1beta3.m export interface TemplateParameterSchemaStepsInner { title: JsonValue; description?: JsonValue; - schema: TemplateParametersV1beta3; + schema: any; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts deleted file mode 100644 index e106f9a1de..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParametersV1beta3.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Parameter that is part of a Template Entity. - * @public - */ -export interface TemplateParametersV1beta3 {} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts deleted file mode 100644 index 68c2df70a8..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3.model.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Access control properties for parts of a template. - * @public - */ -export interface TemplatePermissionsV1beta3 { - tags?: Array; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts deleted file mode 100644 index c7eda5cd8a..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePermissionsV1beta3AllOf.model.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export interface TemplatePermissionsV1beta3AllOf { - tags?: Array; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts deleted file mode 100644 index 83405f15aa..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3.model.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplatePresentationV1beta3ButtonLabels } from '../models/TemplatePresentationV1beta3ButtonLabels.model'; - -/** - * The presentation of the template. - * @public - */ -export interface TemplatePresentationV1beta3 { - [key: string]: any; - - buttonLabels?: TemplatePresentationV1beta3ButtonLabels; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts deleted file mode 100644 index 37015a5468..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplatePresentationV1beta3ButtonLabels.model.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Overrides default buttons' text - * @public - */ -export interface TemplatePresentationV1beta3ButtonLabels { - /** - * The text for the button which leads to the previous template page - */ - backButtonText?: string; - /** - * The text for the button which starts the execution of the template - */ - createButtonText?: string; - /** - * The text for the button which opens template's review/summary - */ - reviewButtonText?: string; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts deleted file mode 100644 index 3613718ac0..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateRecoveryV1beta3.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * Depends on how you designed your task you might tailor the behaviour for each of them. - * @public - */ -export interface TemplateRecoveryV1beta3 {} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts index e37d3b4af9..a7c30935df 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts @@ -18,16 +18,16 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { ValidationErrorPathInner } from '../models/ValidationErrorPathInner.model'; -import { ValidationErrorSchema } from '../models/ValidationErrorSchema.model'; /** * @public */ export interface ValidationError { + [key: string]: any; + path: Array; property: string; message: string; - schema: ValidationErrorSchema; instance: any; name: string; argument: any; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts deleted file mode 100644 index 851b031d8d..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorSchema.model.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Schema } from '../models/Schema.model'; - -/** - * @public - */ -export type ValidationErrorSchema = Schema | string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts index 598c41822b..41a96e63ae 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts @@ -25,11 +25,12 @@ export * from '../models/DryRun200Response.model'; export * from '../models/DryRun200ResponseAllOf.model'; export * from '../models/DryRun200ResponseAllOfDirectoryContentsInner.model'; export * from '../models/DryRun200ResponseAllOfStepsInner.model'; -export * from '../models/DryRun200ResponseAllOfStepsInnerAllOf.model'; export * from '../models/DryRunRequest.model'; export * from '../models/DryRunRequestDirectoryContentsInner.model'; export * from '../models/DryRunResult.model'; export * from '../models/DryRunResultLogInner.model'; +export * from '../models/DryRunResultLogInnerBody.model'; +export * from '../models/DryRunResultLogInnerBodyAllOf.model'; export * from '../models/Entity.model'; export * from '../models/EntityLink.model'; export * from '../models/EntityMeta.model'; @@ -45,40 +46,19 @@ export * from '../models/RetryRequest.model'; export * from '../models/Scaffold201Response.model'; export * from '../models/Scaffold400Response.model'; export * from '../models/ScaffolderScaffoldOptions.model'; -export * from '../models/Schema.model'; -export * from '../models/SchemaAdditionalItems.model'; -export * from '../models/SchemaDependenciesValue.model'; -export * from '../models/SchemaExclusiveMaximum.model'; -export * from '../models/SchemaItems.model'; -export * from '../models/SchemaRequired.model'; -export * from '../models/SchemaType.model'; export * from '../models/SerializedFile.model'; export * from '../models/SerializedTask.model'; export * from '../models/SerializedTaskEvent.model'; export * from '../models/TaskEventType.model'; export * from '../models/TaskRecoverStrategy.model'; export * from '../models/TaskSecrets.model'; -export * from '../models/TaskSpecV1beta3.model'; -export * from '../models/TaskSpecV1beta3User.model'; +export * from '../models/TaskSecretsAllOf.model'; export * from '../models/TaskStatus.model'; export * from '../models/TaskStep.model'; export * from '../models/TaskStepEach.model'; -export * from '../models/TemplateEntityStepV1beta3.model'; -export * from '../models/TemplateEntityStepV1beta3AllOf.model'; -export * from '../models/TemplateEntityV1beta3.model'; -export * from '../models/TemplateEntityV1beta3AllOf.model'; -export * from '../models/TemplateEntityV1beta3AllOfSpec.model'; -export * from '../models/TemplateEntityV1beta3AllOfSpecParameters.model'; export * from '../models/TemplateInfo.model'; export * from '../models/TemplateInfoEntity.model'; export * from '../models/TemplateParameterSchema.model'; export * from '../models/TemplateParameterSchemaStepsInner.model'; -export * from '../models/TemplateParametersV1beta3.model'; -export * from '../models/TemplatePermissionsV1beta3.model'; -export * from '../models/TemplatePermissionsV1beta3AllOf.model'; -export * from '../models/TemplatePresentationV1beta3.model'; -export * from '../models/TemplatePresentationV1beta3ButtonLabels.model'; -export * from '../models/TemplateRecoveryV1beta3.model'; export * from '../models/ValidationError.model'; export * from '../models/ValidationErrorPathInner.model'; -export * from '../models/ValidationErrorSchema.model'; diff --git a/plugins/scaffolder-common/package.json b/plugins/scaffolder-common/package.json index 50d695cdee..4fb33b8156 100644 --- a/plugins/scaffolder-common/package.json +++ b/plugins/scaffolder-common/package.json @@ -61,8 +61,15 @@ }, "dependencies": { "@backstage/catalog-model": "workspace:^", + "@backstage/core-plugin-api": "workspace:^", + "@backstage/errors": "workspace:^", + "@backstage/integration": "workspace:^", "@backstage/plugin-permission-common": "workspace:^", - "@backstage/types": "workspace:^" + "@backstage/types": "workspace:^", + "@microsoft/fetch-event-source": "^2.0.1", + "json-schema": "^0.4.0", + "qs": "^6.9.4", + "zen-observable": "^0.10.0" }, "devDependencies": { "@backstage/cli": "workspace:^", diff --git a/plugins/scaffolder-common/src/ScaffolderClient.ts b/plugins/scaffolder-common/src/ScaffolderClient.ts new file mode 100644 index 0000000000..44973ca569 --- /dev/null +++ b/plugins/scaffolder-common/src/ScaffolderClient.ts @@ -0,0 +1,430 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { parseEntityRef } from '@backstage/catalog-model'; +import { + DiscoveryApi, + FetchApi, + IdentityApi, +} from '@backstage/core-plugin-api'; +import { ResponseError } from '@backstage/errors'; +import { ScmIntegrationRegistry } from '@backstage/integration'; +import { Observable } from '@backstage/types'; +import { + EventSourceMessage, + fetchEventSource, +} from '@microsoft/fetch-event-source'; +import ObservableImpl from 'zen-observable'; + +import { type TemplateParameterSchema } from './TemplateEntityV1beta3'; +import { + ListActionsResponse, + ListTemplatingExtensionsResponse, + LogEvent, + ScaffolderApi, + ScaffolderDryRunOptions, + ScaffolderDryRunResponse, + ScaffolderGetIntegrationsListOptions, + ScaffolderGetIntegrationsListResponse, + ScaffolderRequestOptions, + ScaffolderScaffoldOptions, + ScaffolderScaffoldResponse, + ScaffolderStreamLogsOptions, + ScaffolderTask, +} from './api'; +import { + DefaultApiClient, + TaskStatus, + TypedResponse, +} from '../client/src/schema/openapi'; + +/** + * An API to interact with the scaffolder backend. + * + * @public + */ +export class ScaffolderClient implements ScaffolderApi { + private readonly apiClient: DefaultApiClient; + private readonly discoveryApi: DiscoveryApi; + private readonly scmIntegrationsApi: ScmIntegrationRegistry; + private readonly fetchApi: FetchApi; + private readonly identityApi?: IdentityApi; + private readonly useLongPollingLogs: boolean; + + constructor(options: { + discoveryApi: DiscoveryApi; + fetchApi: FetchApi; + identityApi?: IdentityApi; + scmIntegrationsApi: ScmIntegrationRegistry; + useLongPollingLogs?: boolean; + }) { + this.apiClient = new DefaultApiClient(options); + this.discoveryApi = options.discoveryApi; + this.fetchApi = options.fetchApi ?? { fetch }; + this.scmIntegrationsApi = options.scmIntegrationsApi; + this.useLongPollingLogs = options.useLongPollingLogs ?? false; + this.identityApi = options.identityApi; + } + + /** + * {@inheritdoc ScaffolderApi.listTasks} + */ + async listTasks( + request: { + filterByOwnership: 'owned' | 'all'; + limit?: number; + offset?: number; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ tasks: ScaffolderTask[]; totalTasks?: number }> { + if (!this.identityApi) { + throw new Error( + 'IdentityApi is not available in the ScaffolderClient, please pass through the IdentityApi to the ScaffolderClient constructor in order to use the listTasks method', + ); + } + + const { userEntityRef } = await this.identityApi.getBackstageIdentity(); + + return await this.requestRequired( + await this.apiClient.listTasks( + { + query: { + createdBy: + request.filterByOwnership === 'owned' + ? [userEntityRef] + : undefined, + limit: request.limit ? [request.limit] : undefined, + offset: request.offset ? [request.offset] : undefined, + }, + }, + options, + ), + ); + } + + async getIntegrationsList( + options: ScaffolderGetIntegrationsListOptions, + ): Promise { + const integrations = [ + ...this.scmIntegrationsApi.azure.list(), + ...this.scmIntegrationsApi.bitbucket + .list() + .filter( + item => + !this.scmIntegrationsApi.bitbucketCloud.byHost(item.config.host) && + !this.scmIntegrationsApi.bitbucketServer.byHost(item.config.host), + ), + ...this.scmIntegrationsApi.bitbucketCloud.list(), + ...this.scmIntegrationsApi.bitbucketServer.list(), + ...this.scmIntegrationsApi.gerrit.list(), + ...this.scmIntegrationsApi.gitea.list(), + ...this.scmIntegrationsApi.github.list(), + ...this.scmIntegrationsApi.gitlab.list(), + ] + .map(c => ({ type: c.type, title: c.title, host: c.config.host })) + .filter(c => options.allowedHosts.includes(c.host)); + + return { + integrations, + }; + } + + /** + * {@inheritdoc ScaffolderApi.getTemplateParameterSchema} + */ + async getTemplateParameterSchema( + templateRef: string, + options?: ScaffolderRequestOptions, + ): Promise { + return await this.requestRequired( + await this.apiClient.getTemplateParameterSchema( + { + path: parseEntityRef(templateRef, { + defaultKind: 'template', + }), + }, + options, + ), + ); + } + + /** + * {@inheritdoc ScaffolderApi.scaffold} + */ + async scaffold( + request: ScaffolderScaffoldOptions, + options?: ScaffolderRequestOptions, + ): Promise { + const response = await this.apiClient.scaffold( + { + body: request, + }, + options, + ); + + if (response.status !== 201) { + const status = `${response.status} ${response.statusText}`; + const body = await response.text(); + throw new Error(`Backend request failed, ${status} ${body.trim()}`); + } + + const { id } = await response.json(); + return { taskId: id }; + } + + /** + * {@inheritdoc ScaffolderApi.getTask} + */ + async getTask( + taskId: string, + options?: ScaffolderRequestOptions, + ): Promise { + return await this.requestRequired( + await this.apiClient.getTask( + { + path: { taskId }, + }, + options, + ), + ); + } + + /** + * {@inheritdoc ScaffolderApi.streamLogs} + */ + streamLogs( + request: ScaffolderStreamLogsOptions, + options?: ScaffolderRequestOptions, + ): Observable { + if (this.useLongPollingLogs) { + return this.streamLogsPolling(request, options); + } + + return this.streamLogsEventStream(request); + } + + /** + * {@inheritdoc ScaffolderApi.dryRun} + */ + async dryRun( + request: ScaffolderDryRunOptions, + options?: ScaffolderRequestOptions, + ): Promise { + return await this.requestRequired( + await this.apiClient.dryRun( + { + body: { + template: request.template, + values: request.values, + secrets: request.secrets, + directoryContents: request.directoryContents, + }, + }, + options, + ), + ); + } + + private streamLogsEventStream({ + isTaskRecoverable, + taskId, + after, + }: ScaffolderStreamLogsOptions): Observable { + return new ObservableImpl(subscriber => { + const params = new URLSearchParams(); + if (after !== undefined) { + params.set('after', String(Number(after))); + } + + this.discoveryApi.getBaseUrl('scaffolder').then( + baseUrl => { + const url = `${baseUrl}/v2/tasks/${encodeURIComponent( + taskId, + )}/eventstream`; + + const processEvent = (event: any) => { + if (event.data) { + try { + subscriber.next(JSON.parse(event.data)); + } catch (ex) { + subscriber.error(ex); + } + } + }; + + const ctrl = new AbortController(); + void fetchEventSource(url, { + fetch: this.fetchApi.fetch, + signal: ctrl.signal, + onmessage(e: EventSourceMessage) { + if (e.event === 'log') { + processEvent(e); + return; + } else if (e.event === 'completion' && !isTaskRecoverable) { + processEvent(e); + subscriber.complete(); + ctrl.abort(); + return; + } + processEvent(e); + }, + onerror(err) { + subscriber.error(err); + }, + }); + }, + error => { + subscriber.error(error); + }, + ); + }); + } + + private streamLogsPolling( + { + taskId, + after: inputAfter, + }: { + taskId: string; + after?: number; + }, + options?: ScaffolderRequestOptions, + ): Observable { + let after = inputAfter; + + return new ObservableImpl(subscriber => { + (async () => { + while (!subscriber.closed) { + const response = await this.apiClient.streamLogsPolling( + { + path: { taskId }, + query: { after }, + }, + options, + ); + + if (!response.ok) { + // wait for one second to not run into an + await new Promise(resolve => setTimeout(resolve, 1000)); + continue; + } + + const logs = (await response.json()) as LogEvent[]; + + for (const event of logs) { + after = Number(event.id); + + subscriber.next(event); + + if (event.type === 'completion') { + subscriber.complete(); + return; + } + } + } + })(); + }); + } + + /** + * {@inheritdoc ScaffolderApi.listActions} + */ + async listActions( + options?: ScaffolderRequestOptions, + ): Promise { + return await this.requestRequired( + await this.apiClient.listActions(null as any, options), + ); + } + + async listTemplatingExtensions(): Promise { + const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); + const response = await this.fetchApi.fetch( + `${baseUrl}/v2/templating-extensions`, + ); + if (!response.ok) { + throw ResponseError.fromResponse(response); + } + return response.json(); + } + + /** + * {@inheritdoc ScaffolderApi.cancelTask} + */ + async cancelTask( + taskId: string, + options?: ScaffolderRequestOptions, + ): Promise<{ status?: TaskStatus }> { + return await this.requestRequired( + await this.apiClient.cancelTask({ path: { taskId } }, options), + ); + } + + /** + * {@inheritdoc ScaffolderApi.retry} + */ + async retry?( + { + secrets, + taskId, + }: { + secrets?: Record; + taskId: string; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ id: string }> { + return await this.requestRequired( + await this.apiClient.retry( + { body: { secrets }, path: { taskId } }, + options, + ), + ); + } + + /** + * {@inheritdoc ScaffolderApi.retry} + */ + async autocomplete({ + token, + resource, + provider, + context, + }: { + token: string; + provider: string; + resource: string; + context: Record; + }): Promise<{ results: { title?: string; id: string }[] }> { + return await this.requestRequired( + await this.apiClient.autocomplete({ + path: { provider, resource }, + body: { token, context }, + }), + ); + } + + // + // Private methods + // + + private async requestRequired(response: TypedResponse): Promise { + if (!response.ok) { + throw await ResponseError.fromResponse(response); + } + + return response.json(); + } +} diff --git a/plugins/scaffolder-common/src/TemplateEntityV1beta3.ts b/plugins/scaffolder-common/src/TemplateEntityV1beta3.ts index 304057af77..1851b7e70f 100644 --- a/plugins/scaffolder-common/src/TemplateEntityV1beta3.ts +++ b/plugins/scaffolder-common/src/TemplateEntityV1beta3.ts @@ -142,6 +142,24 @@ export interface TemplateEntityStepV1beta3 extends JsonObject { 'backstage:permissions'?: TemplatePermissionsV1beta3; } +/** + * The shape of each entry of parameters which gets rendered + * as a separate step in the wizard input + * + * @public + */ +export type TemplateParameterSchema = { + title: string; + description?: string; + presentation?: TemplatePresentationV1beta3; + steps: Array<{ + title: string; + description?: string; + schema: JsonObject; + }>; + EXPERIMENTAL_formDecorators?: { id: string; input?: JsonObject }[]; +}; + /** * Parameter that is part of a Template Entity. * diff --git a/plugins/scaffolder-common/src/api.ts b/plugins/scaffolder-common/src/api.ts new file mode 100644 index 0000000000..f9a5dbcb17 --- /dev/null +++ b/plugins/scaffolder-common/src/api.ts @@ -0,0 +1,362 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { JsonObject, JsonValue, Observable } from '@backstage/types'; +import { JSONSchema7 } from 'json-schema'; +import { TaskSpec, TaskStep } from './TaskSpec'; +import type { + TemplateEntityV1beta3, + TemplateParameterSchema, +} from './TemplateEntityV1beta3'; +import { TaskStatus } from '../client/src/schema/openapi'; + +/** + * Options you can pass into a Scaffolder request for additional information. + * + * @public + */ +export interface ScaffolderRequestOptions { + token?: string; +} + +/** + * The status of each task in a Scaffolder Job + * + * @public + */ +export type ScaffolderTaskStatus = + | 'cancelled' + | 'completed' + | 'failed' + | 'open' + | 'processing' + | 'skipped'; + +/** + * The shape of each task returned from the `scaffolder-backend` + * + * @public + */ +export type ScaffolderTask = { + id: string; + spec: TaskSpec; + status: ScaffolderTaskStatus; + lastHeartbeatAt?: string; + createdAt: string; +}; + +/** + * A single scaffolder usage example + * + * @public + */ +export type ScaffolderUsageExample = { + description?: string; + example: string; + notes?: string; +}; + +/** + * A single action example + * + * @public + * @deprecated in favor of ScaffolderUsageExample + */ +export type ActionExample = { + description: string; + example: string; +}; + +/** + * The response shape for a single action in the `listActions` call to the `scaffolder-backend` + * + * @public + */ +export type Action = { + id: string; + description?: string; + schema?: { + input?: JSONSchema7; + output?: JSONSchema7; + }; + examples?: ActionExample[]; +}; + +/** + * The response shape for the `listActions` call to the `scaffolder-backend` + * + * @public + */ +export type ListActionsResponse = Array; + +/** + * The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend` + * + * @public + */ +export type TemplateFilter = { + description?: string; + schema?: { + input?: JSONSchema7; + arguments?: JSONSchema7[]; + output?: JSONSchema7; + }; + examples?: ScaffolderUsageExample[]; +}; + +/** + * The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend` + * + * @public + */ +export type TemplateGlobalFunction = { + description?: string; + schema?: { + arguments?: JSONSchema7[]; + output?: JSONSchema7; + }; + examples?: ScaffolderUsageExample[]; +}; + +/** + * The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend` + * + * @public + */ +export type TemplateGlobalValue = { + description?: string; + value: JsonValue; +}; + +/** + * The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend` + * + * @public + */ +export type ListTemplatingExtensionsResponse = { + filters: Record; + globals: { + functions: Record; + values: Record; + }; +}; + +/** @public */ +export type ScaffolderOutputLink = { + title?: string; + icon?: string; + url?: string; + entityRef?: string; +}; + +/** @public */ +export type ScaffolderOutputText = { + title?: string; + icon?: string; + content?: string; + default?: boolean; +}; + +/** @public */ +export type ScaffolderTaskOutput = { + links?: ScaffolderOutputLink[]; + text?: ScaffolderOutputText[]; +} & { + [key: string]: unknown; +}; + +/** + * The shape of a `LogEvent` message from the `scaffolder-backend` + * + * @public + */ +export type LogEvent = { + type: 'log' | 'completion' | 'cancelled' | 'recovered'; + body: { + message: string; + stepId?: string; + status?: ScaffolderTaskStatus; + }; + createdAt: string; + id: number; + taskId: string; +}; + +/** + * The input options to the `scaffold` method of the `ScaffolderClient`. + * + * @public + */ +export interface ScaffolderScaffoldOptions { + templateRef: string; + values: Record; + secrets?: Record; +} + +/** + * The response shape of the `scaffold` method of the `ScaffolderClient`. + * + * @public + */ +export interface ScaffolderScaffoldResponse { + taskId: string; +} + +/** + * The arguments for `getIntegrationsList`. + * + * @public + */ +export interface ScaffolderGetIntegrationsListOptions { + allowedHosts: string[]; +} + +/** + * The response shape for `getIntegrationsList`. + * + * @public + */ +export interface ScaffolderGetIntegrationsListResponse { + integrations: { type: string; title: string; host: string }[]; +} + +/** + * The input options to the `streamLogs` method of the `ScaffolderClient`. + * + * @public + */ +export interface ScaffolderStreamLogsOptions { + isTaskRecoverable?: boolean; + taskId: string; + after?: number; +} + +/** @public */ +export interface ScaffolderDryRunOptions { + template: TemplateEntityV1beta3; + values: JsonObject; + secrets?: Record; + directoryContents: { path: string; base64Content: string }[]; +} + +/** @public */ +export interface ScaffolderDryRunResponse { + directoryContents: Array<{ + path: string; + base64Content: string; + executable?: boolean; + }>; + log: Array>; + steps: TaskStep[]; + output: ScaffolderTaskOutput; +} +/** + * An API to interact with the scaffolder backend. + * + * @public + */ +export interface ScaffolderApi { + getTemplateParameterSchema( + templateRef: string, + options?: ScaffolderRequestOptions, + ): Promise; + + /** + * Executes the scaffolding of a component, given a template and its + * parameter values. + * + * @param options - The {@link ScaffolderScaffoldOptions} the scaffolding. + */ + scaffold( + request: ScaffolderScaffoldOptions, + options?: ScaffolderRequestOptions, + ): Promise; + + getTask( + taskId: string, + options?: ScaffolderRequestOptions, + ): Promise; + + /** + * Sends a signal to a task broker to cancel the running task by taskId. + * + * @param taskId - the id of the task + */ + cancelTask( + taskId: string, + options?: ScaffolderRequestOptions, + ): Promise<{ status?: TaskStatus }>; + + /** + * Starts the task again from the point where it failed. + * + * @param taskId - the id of the task + */ + retry?( + { + secrets, + taskId, + }: { + secrets?: Record; + taskId: string; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ id: string }>; + + listTasks?( + request: { + filterByOwnership: 'owned' | 'all'; + limit?: number; + offset?: number; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ tasks: ScaffolderTask[]; totalTasks?: number }>; + + getIntegrationsList( + options: ScaffolderGetIntegrationsListOptions, + ): Promise; + + /** + * Returns a list of all installed actions. + */ + listActions(options?: ScaffolderRequestOptions): Promise; + + /** + * Returns a structure describing the available templating extensions. + */ + listTemplatingExtensions?( + options?: ScaffolderRequestOptions, + ): Promise; + + streamLogs( + request: ScaffolderStreamLogsOptions, + options?: ScaffolderRequestOptions, + ): Observable; + + dryRun?( + request: ScaffolderDryRunOptions, + options?: ScaffolderRequestOptions, + ): Promise; + + autocomplete?( + request: { + token: string; + provider: string; + resource: string; + context: Record; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ results: { title?: string; id: string }[] }>; +} diff --git a/plugins/scaffolder-common/src/index.ts b/plugins/scaffolder-common/src/index.ts index 4d9b5e39c6..ad37973a7b 100644 --- a/plugins/scaffolder-common/src/index.ts +++ b/plugins/scaffolder-common/src/index.ts @@ -30,7 +30,12 @@ export type { TemplatePresentationV1beta3, TemplateEntityV1beta3, TemplateEntityStepV1beta3, + TemplateParameterSchema, TemplateParametersV1beta3, TemplatePermissionsV1beta3, TemplateRecoveryV1beta3, } from './TemplateEntityV1beta3'; + +export * from './ScaffolderClient'; + +export * from './api'; diff --git a/plugins/scaffolder-node/src/tasks/types.ts b/plugins/scaffolder-node/src/tasks/types.ts index b55a2729b7..aaac468fce 100644 --- a/plugins/scaffolder-node/src/tasks/types.ts +++ b/plugins/scaffolder-node/src/tasks/types.ts @@ -39,7 +39,8 @@ export type TaskStatus = | 'completed' | 'failed' | 'open' - | 'processing'; + | 'processing' + | 'skipped'; /** * The state of a completed task. @@ -80,7 +81,11 @@ export type SerializedTaskEvent = { id: number; isTaskRecoverable?: boolean; taskId: string; - body: JsonObject; + body: { + message: string; + stepId?: string; + status?: TaskStatus; + } & JsonObject; type: TaskEventType; createdAt: string; }; diff --git a/plugins/scaffolder-react/src/api/types.ts b/plugins/scaffolder-react/src/api/types.ts index d4a9bbe0f8..b3cb177128 100644 --- a/plugins/scaffolder-react/src/api/types.ts +++ b/plugins/scaffolder-react/src/api/types.ts @@ -13,47 +13,54 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { TaskSpec, TaskStep } from '@backstage/plugin-scaffolder-common'; -import { JsonObject, JsonValue, Observable } from '@backstage/types'; -import { JSONSchema7 } from 'json-schema'; -import { TemplateParameterSchema } from '../types'; + +import { + type ScaffolderApi as _ScaffolderApi, + type ScaffolderDryRunOptions as _ScaffolderDryRunOptions, + type ScaffolderDryRunResponse as _ScaffolderDryRunResponse, + type ScaffolderGetIntegrationsListOptions as _ScaffolderGetIntegrationsListOptions, + type ScaffolderGetIntegrationsListResponse as _ScaffolderGetIntegrationsListResponse, + type ScaffolderScaffoldOptions as _ScaffolderScaffoldOptions, + type ScaffolderScaffoldResponse as _ScaffolderScaffoldResponse, + type ScaffolderStreamLogsOptions as _ScaffolderStreamLogsOptions, + type ScaffolderUsageExample as _ScaffolderUsageExample, + type Action as _Action, + type ListActionsResponse as _ListActionsResponse, + type ListTemplatingExtensionsResponse as _ListTemplatingExtensionsResponse, + type LogEvent as _LogEvent, + type ScaffolderOutputLink as _ScaffolderOutputLink, + type ScaffolderOutputText as _ScaffolderOutputText, + type ScaffolderTask as _ScaffolderTask, + type ScaffolderTaskOutput as _ScaffolderTaskOutput, + type ScaffolderTaskStatus as _ScaffolderTaskStatus, + type TemplateFilter as _TemplateFilter, + type TemplateGlobalFunction as _TemplateGlobalFunction, + type TemplateGlobalValue as _TemplateGlobalValue, +} from '@backstage/plugin-scaffolder-common'; /** * The status of each task in a Scaffolder Job * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTaskStatus} instead as this has now been moved. */ -export type ScaffolderTaskStatus = - | 'cancelled' - | 'completed' - | 'failed' - | 'open' - | 'processing' - | 'skipped'; +export type ScaffolderTaskStatus = _ScaffolderTaskStatus; /** * The shape of each task returned from the `scaffolder-backend` * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTask} instead as this has now been moved. */ -export type ScaffolderTask = { - id: string; - spec: TaskSpec; - status: 'failed' | 'completed' | 'processing' | 'open' | 'cancelled'; - lastHeartbeatAt: string; - createdAt: string; -}; +export type ScaffolderTask = _ScaffolderTask; /** * A single scaffolder usage example * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderUsageExample} instead as this has now been moved. */ -export type ScaffolderUsageExample = { - description?: string; - example: string; - notes?: string; -}; +export type ScaffolderUsageExample = _ScaffolderUsageExample; /** * A single action example @@ -67,249 +74,135 @@ export type ActionExample = ScaffolderUsageExample; * The response shape for a single action in the `listActions` call to the `scaffolder-backend` * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#Action} instead as this has now been moved. */ -export type Action = { - id: string; - description?: string; - schema?: { - input?: JSONSchema7; - output?: JSONSchema7; - }; - examples?: ActionExample[]; -}; +export type Action = _Action; /** * The response shape for the `listActions` call to the `scaffolder-backend` * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ListActionsResponse} instead as this has now been moved. */ -export type ListActionsResponse = Array; +export type ListActionsResponse = _ListActionsResponse; /** * The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend` * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateFilter} instead as this has now been moved. */ -export type TemplateFilter = { - description?: string; - schema?: { - input?: JSONSchema7; - arguments?: JSONSchema7[]; - output?: JSONSchema7; - }; - examples?: ScaffolderUsageExample[]; -}; +export type TemplateFilter = _TemplateFilter; /** * The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend` * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateGlobalFunction} instead as this has now been moved. */ -export type TemplateGlobalFunction = { - description?: string; - schema?: { - arguments?: JSONSchema7[]; - output?: JSONSchema7; - }; - examples?: ScaffolderUsageExample[]; -}; +export type TemplateGlobalFunction = _TemplateGlobalFunction; /** * The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend` * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateGlobalValue} instead as this has now been moved. */ -export type TemplateGlobalValue = { - description?: string; - value: JsonValue; -}; +export type TemplateGlobalValue = _TemplateGlobalValue; /** * The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend` * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ListTemplatingExtensionsResponse} instead as this has now been moved. */ -export type ListTemplatingExtensionsResponse = { - filters: Record; - globals: { - functions: Record; - values: Record; - }; -}; +export type ListTemplatingExtensionsResponse = + _ListTemplatingExtensionsResponse; -/** @public */ -export type ScaffolderOutputLink = { - title?: string; - icon?: string; - url?: string; - entityRef?: string; -}; +/** + * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderOutputLink} instead as this has now been moved. + */ +export type ScaffolderOutputLink = _ScaffolderOutputLink; -/** @public */ -export type ScaffolderOutputText = { - title?: string; - icon?: string; - content?: string; - default?: boolean; -}; +/** + * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderOutputText} instead as this has now been moved. + */ +export type ScaffolderOutputText = _ScaffolderOutputText; -/** @public */ -export type ScaffolderTaskOutput = { - links?: ScaffolderOutputLink[]; - text?: ScaffolderOutputText[]; -} & { - [key: string]: unknown; -}; +/** + * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTaskOutput} instead as this has now been moved. + */ +export type ScaffolderTaskOutput = _ScaffolderTaskOutput; /** * The shape of a `LogEvent` message from the `scaffolder-backend` * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#LogEvent} instead as this has now been moved. */ -export type LogEvent = { - type: 'log' | 'completion' | 'cancelled' | 'recovered'; - body: { - message: string; - stepId?: string; - status?: ScaffolderTaskStatus; - }; - createdAt: string; - id: string; - taskId: string; -}; +export type LogEvent = _LogEvent; /** * The input options to the `scaffold` method of the `ScaffolderClient`. * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderScaffoldOptions} instead as this has now been moved. */ -export interface ScaffolderScaffoldOptions { - templateRef: string; - values: Record; - secrets?: Record; -} +export type ScaffolderScaffoldOptions = _ScaffolderScaffoldOptions; /** * The response shape of the `scaffold` method of the `ScaffolderClient`. * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderScaffoldResponse} instead as this has now been moved. */ -export interface ScaffolderScaffoldResponse { - taskId: string; -} +export type ScaffolderScaffoldResponse = _ScaffolderScaffoldResponse; /** * The arguments for `getIntegrationsList`. * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderGetIntegrationsListOptions} instead as this has now been moved. */ -export interface ScaffolderGetIntegrationsListOptions { - allowedHosts: string[]; -} +export type ScaffolderGetIntegrationsListOptions = + _ScaffolderGetIntegrationsListOptions; /** * The response shape for `getIntegrationsList`. * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderGetIntegrationsListResponse} instead as this has now been moved. */ -export interface ScaffolderGetIntegrationsListResponse { - integrations: { type: string; title: string; host: string }[]; -} +export type ScaffolderGetIntegrationsListResponse = + _ScaffolderGetIntegrationsListResponse; /** * The input options to the `streamLogs` method of the `ScaffolderClient`. * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderStreamLogsOptions} instead as this has now been moved. */ -export interface ScaffolderStreamLogsOptions { - isTaskRecoverable?: boolean; - taskId: string; - after?: number; -} +export type ScaffolderStreamLogsOptions = _ScaffolderStreamLogsOptions; -/** @public */ -export interface ScaffolderDryRunOptions { - template: JsonValue; - values: JsonObject; - secrets?: Record; - directoryContents: { path: string; base64Content: string }[]; -} +/** + * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderDryRunOptions} instead as this has now been moved. + */ +export type ScaffolderDryRunOptions = _ScaffolderDryRunOptions; + +/** + * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderDryRunResponse} instead as this has now been moved. + */ +export type ScaffolderDryRunResponse = _ScaffolderDryRunResponse; -/** @public */ -export interface ScaffolderDryRunResponse { - directoryContents: Array<{ - path: string; - base64Content: string; - executable: boolean; - }>; - log: Array>; - steps: TaskStep[]; - output: ScaffolderTaskOutput; -} /** * An API to interact with the scaffolder backend. * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderApi} instead as this has now been moved. */ -export interface ScaffolderApi { - getTemplateParameterSchema( - templateRef: string, - ): Promise; - - /** - * Executes the scaffolding of a component, given a template and its - * parameter values. - * - * @param options - The {@link ScaffolderScaffoldOptions} the scaffolding. - */ - scaffold( - options: ScaffolderScaffoldOptions, - ): Promise; - - getTask(taskId: string): Promise; - - /** - * Sends a signal to a task broker to cancel the running task by taskId. - * - * @param taskId - the id of the task - */ - cancelTask(taskId: string): Promise; - - /** - * Starts the task again from the point where it failed. - * - * @param taskId - the id of the task - */ - retry?(taskId: string): Promise; - - listTasks?(options: { - filterByOwnership: 'owned' | 'all'; - limit?: number; - offset?: number; - }): Promise<{ tasks: ScaffolderTask[]; totalTasks?: number }>; - - getIntegrationsList( - options: ScaffolderGetIntegrationsListOptions, - ): Promise; - - /** - * Returns a list of all installed actions. - */ - listActions(): Promise; - - /** - * Returns a structure describing the available templating extensions. - */ - listTemplatingExtensions?(): Promise; - - streamLogs(options: ScaffolderStreamLogsOptions): Observable; - - dryRun?(options: ScaffolderDryRunOptions): Promise; - - autocomplete?(options: { - token: string; - provider: string; - resource: string; - context?: Record; - }): Promise<{ results: { title?: string; id: string }[] }>; -} +export type ScaffolderApi = _ScaffolderApi; diff --git a/plugins/scaffolder-react/src/types.ts b/plugins/scaffolder-react/src/types.ts index 5f557198c6..5b724c5871 100644 --- a/plugins/scaffolder-react/src/types.ts +++ b/plugins/scaffolder-react/src/types.ts @@ -14,24 +14,13 @@ * limitations under the License. */ -import { JsonObject } from '@backstage/types'; - -import { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common'; +import { TemplateParameterSchema as _TemplateParameterSchema } from '@backstage/plugin-scaffolder-common'; /** * The shape of each entry of parameters which gets rendered * as a separate step in the wizard input * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateParameterSchema} instead as this has now been moved. */ -export type TemplateParameterSchema = { - title: string; - description?: string; - presentation?: TemplatePresentationV1beta3; - steps: Array<{ - title: string; - description?: string; - schema: JsonObject; - }>; - EXPERIMENTAL_formDecorators?: { id: string; input?: JsonObject }[]; -}; +export type TemplateParameterSchema = _TemplateParameterSchema; diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 6027359335..1b547762ef 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -63,9 +63,7 @@ "@backstage/core-compat-api": "workspace:^", "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", - "@backstage/errors": "workspace:^", "@backstage/frontend-plugin-api": "workspace:^", - "@backstage/integration": "workspace:^", "@backstage/integration-react": "workspace:^", "@backstage/plugin-catalog-common": "workspace:^", "@backstage/plugin-catalog-react": "workspace:^", @@ -79,7 +77,6 @@ "@material-ui/core": "^4.12.2", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.61", - "@microsoft/fetch-event-source": "^2.0.1", "@react-hookz/web": "^24.0.0", "@rjsf/core": "5.23.2", "@rjsf/material-ui": "5.23.2", @@ -90,17 +87,14 @@ "git-url-parse": "^15.0.0", "humanize-duration": "^3.25.1", "idb-keyval": "5.1.5", - "json-schema": "^0.4.0", "json-schema-library": "^9.0.0", "jszip": "^3.10.1", "lodash": "^4.17.21", "luxon": "^3.0.0", - "qs": "^6.9.4", "react-resizable": "^3.0.5", "react-use": "^17.2.4", "react-window": "^1.8.10", "yaml": "^2.0.0", - "zen-observable": "^0.10.0", "zod": "^3.22.4", "zod-to-json-schema": "^3.20.4" }, diff --git a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/DryRunResults/DryRunResultsList.tsx b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/DryRunResults/DryRunResultsList.tsx index 2657565a38..5cbe524d3e 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/DryRunResults/DryRunResultsList.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/DryRunResults/DryRunResultsList.tsx @@ -118,7 +118,7 @@ async function downloadDirectoryContents( directoryContents: { path: string; base64Content: string; - executable: boolean; + executable?: boolean; }[], name: string, ) { diff --git a/plugins/scaffolder/src/api.ts b/plugins/scaffolder/src/api.ts index 4fb3627917..d880521cf2 100644 --- a/plugins/scaffolder/src/api.ts +++ b/plugins/scaffolder/src/api.ts @@ -14,389 +14,12 @@ * limitations under the License. */ -import { parseEntityRef } from '@backstage/catalog-model'; -import { - DiscoveryApi, - FetchApi, - IdentityApi, -} from '@backstage/core-plugin-api'; -import { ResponseError } from '@backstage/errors'; -import { ScmIntegrationRegistry } from '@backstage/integration'; -import { - ListActionsResponse, - ListTemplatingExtensionsResponse, - LogEvent, - ScaffolderApi, - ScaffolderDryRunOptions, - ScaffolderDryRunResponse, - ScaffolderGetIntegrationsListOptions, - ScaffolderGetIntegrationsListResponse, - ScaffolderScaffoldOptions, - ScaffolderScaffoldResponse, - ScaffolderStreamLogsOptions, - ScaffolderTask, - TemplateParameterSchema, -} from '@backstage/plugin-scaffolder-react'; -import { Observable } from '@backstage/types'; -import { - EventSourceMessage, - fetchEventSource, -} from '@microsoft/fetch-event-source'; -import { default as qs, default as queryString } from 'qs'; -import ObservableImpl from 'zen-observable'; +import { ScaffolderClient as _ScaffolderClient } from '@backstage/plugin-scaffolder-common'; /** * An API to interact with the scaffolder backend. * * @public + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderClient} instead as this has now been moved. */ -export class ScaffolderClient implements ScaffolderApi { - private readonly discoveryApi: DiscoveryApi; - private readonly scmIntegrationsApi: ScmIntegrationRegistry; - private readonly fetchApi: FetchApi; - private readonly identityApi?: IdentityApi; - private readonly useLongPollingLogs: boolean; - - constructor(options: { - discoveryApi: DiscoveryApi; - fetchApi: FetchApi; - identityApi?: IdentityApi; - scmIntegrationsApi: ScmIntegrationRegistry; - useLongPollingLogs?: boolean; - }) { - this.discoveryApi = options.discoveryApi; - this.fetchApi = options.fetchApi ?? { fetch }; - this.scmIntegrationsApi = options.scmIntegrationsApi; - this.useLongPollingLogs = options.useLongPollingLogs ?? false; - this.identityApi = options.identityApi; - } - - async listTasks(options: { - filterByOwnership: 'owned' | 'all'; - limit?: number; - offset?: number; - }): Promise<{ tasks: ScaffolderTask[]; totalTasks?: number }> { - if (!this.identityApi) { - throw new Error( - 'IdentityApi is not available in the ScaffolderClient, please pass through the IdentityApi to the ScaffolderClient constructor in order to use the listTasks method', - ); - } - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - const { userEntityRef } = await this.identityApi.getBackstageIdentity(); - - const query = queryString.stringify({ - createdBy: - options.filterByOwnership === 'owned' ? userEntityRef : undefined, - limit: options.limit, - offset: options.offset, - }); - - const response = await this.fetchApi.fetch(`${baseUrl}/v2/tasks?${query}`); - if (!response.ok) { - throw await ResponseError.fromResponse(response); - } - - return await response.json(); - } - - async getIntegrationsList( - options: ScaffolderGetIntegrationsListOptions, - ): Promise { - const integrations = [ - ...this.scmIntegrationsApi.azure.list(), - ...this.scmIntegrationsApi.bitbucket - .list() - .filter( - item => - !this.scmIntegrationsApi.bitbucketCloud.byHost(item.config.host) && - !this.scmIntegrationsApi.bitbucketServer.byHost(item.config.host), - ), - ...this.scmIntegrationsApi.bitbucketCloud.list(), - ...this.scmIntegrationsApi.bitbucketServer.list(), - ...this.scmIntegrationsApi.gerrit.list(), - ...this.scmIntegrationsApi.gitea.list(), - ...this.scmIntegrationsApi.github.list(), - ...this.scmIntegrationsApi.gitlab.list(), - ] - .map(c => ({ type: c.type, title: c.title, host: c.config.host })) - .filter(c => options.allowedHosts.includes(c.host)); - - return { - integrations, - }; - } - - async getTemplateParameterSchema( - templateRef: string, - ): Promise { - const { namespace, kind, name } = parseEntityRef(templateRef, { - defaultKind: 'template', - }); - - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - const templatePath = [namespace, kind, name] - .map(s => encodeURIComponent(s)) - .join('/'); - - const url = `${baseUrl}/v2/templates/${templatePath}/parameter-schema`; - - const response = await this.fetchApi.fetch(url); - if (!response.ok) { - throw await ResponseError.fromResponse(response); - } - - const schema: TemplateParameterSchema = await response.json(); - return schema; - } - - async scaffold( - options: ScaffolderScaffoldOptions, - ): Promise { - const { templateRef, values, secrets = {} } = options; - const url = `${await this.discoveryApi.getBaseUrl('scaffolder')}/v2/tasks`; - const response = await this.fetchApi.fetch(url, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - templateRef, - values: { ...values }, - secrets, - }), - }); - - if (response.status !== 201) { - const status = `${response.status} ${response.statusText}`; - const body = await response.text(); - throw new Error(`Backend request failed, ${status} ${body.trim()}`); - } - - const { id } = (await response.json()) as { id: string }; - return { taskId: id }; - } - - async getTask(taskId: string): Promise { - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}`; - - const response = await this.fetchApi.fetch(url); - if (!response.ok) { - throw await ResponseError.fromResponse(response); - } - - return await response.json(); - } - - streamLogs(options: ScaffolderStreamLogsOptions): Observable { - if (this.useLongPollingLogs) { - return this.streamLogsPolling(options); - } - - return this.streamLogsEventStream(options); - } - - async dryRun( - options: ScaffolderDryRunOptions, - ): Promise { - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - const response = await this.fetchApi.fetch(`${baseUrl}/v2/dry-run`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - template: options.template, - values: options.values, - secrets: options.secrets, - directoryContents: options.directoryContents, - }), - }); - - if (!response.ok) { - throw await ResponseError.fromResponse(response); - } - - return response.json(); - } - - private streamLogsEventStream({ - isTaskRecoverable, - taskId, - after, - }: ScaffolderStreamLogsOptions): Observable { - return new ObservableImpl(subscriber => { - const params = new URLSearchParams(); - if (after !== undefined) { - params.set('after', String(Number(after))); - } - - this.discoveryApi.getBaseUrl('scaffolder').then( - baseUrl => { - const url = `${baseUrl}/v2/tasks/${encodeURIComponent( - taskId, - )}/eventstream`; - - const processEvent = (event: any) => { - if (event.data) { - try { - subscriber.next(JSON.parse(event.data)); - } catch (ex) { - subscriber.error(ex); - } - } - }; - - const ctrl = new AbortController(); - void fetchEventSource(url, { - fetch: this.fetchApi.fetch, - signal: ctrl.signal, - onmessage(e: EventSourceMessage) { - if (e.event === 'log') { - processEvent(e); - return; - } else if (e.event === 'completion' && !isTaskRecoverable) { - processEvent(e); - subscriber.complete(); - ctrl.abort(); - return; - } - processEvent(e); - }, - onerror(err) { - subscriber.error(err); - }, - }); - }, - error => { - subscriber.error(error); - }, - ); - }); - } - - private streamLogsPolling({ - taskId, - after: inputAfter, - }: { - taskId: string; - after?: number; - }): Observable { - let after = inputAfter; - - return new ObservableImpl(subscriber => { - this.discoveryApi.getBaseUrl('scaffolder').then(async baseUrl => { - while (!subscriber.closed) { - const url = `${baseUrl}/v2/tasks/${encodeURIComponent( - taskId, - )}/events?${qs.stringify({ after })}`; - const response = await this.fetchApi.fetch(url); - - if (!response.ok) { - // wait for one second to not run into an - await new Promise(resolve => setTimeout(resolve, 1000)); - continue; - } - - const logs = (await response.json()) as LogEvent[]; - - for (const event of logs) { - after = Number(event.id); - - subscriber.next(event); - - if (event.type === 'completion') { - subscriber.complete(); - return; - } - } - } - }); - }); - } - - async listActions(): Promise { - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - const response = await this.fetchApi.fetch(`${baseUrl}/v2/actions`); - if (!response.ok) { - throw await ResponseError.fromResponse(response); - } - - return await response.json(); - } - - async listTemplatingExtensions(): Promise { - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - const response = await this.fetchApi.fetch( - `${baseUrl}/v2/templating-extensions`, - ); - if (!response.ok) { - throw ResponseError.fromResponse(response); - } - return response.json(); - } - - async cancelTask(taskId: string): Promise { - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/cancel`; - - const response = await this.fetchApi.fetch(url, { - method: 'POST', - }); - - if (!response.ok) { - throw await ResponseError.fromResponse(response); - } - - return await response.json(); - } - - async retry?(taskId: string): Promise { - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/retry`; - - const response = await this.fetchApi.fetch(url, { - method: 'POST', - }); - - if (!response.ok) { - throw await ResponseError.fromResponse(response); - } - - return await response.json(); - } - - async autocomplete({ - token, - resource, - provider, - context, - }: { - token: string; - provider: string; - resource: string; - context?: Record; - }): Promise<{ results: { title?: string; id: string }[] }> { - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - - const url = `${baseUrl}/v2/autocomplete/${provider}/${resource}`; - - const response = await this.fetchApi.fetch(url, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - token, - context: context ?? {}, - }), - }); - - if (!response.ok) { - throw await ResponseError.fromResponse(response); - } - - const { results } = await response.json(); - return { results }; - } -} +export class ScaffolderClient extends _ScaffolderClient {} diff --git a/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx b/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx index bc0d5fe1aa..ce765abb01 100644 --- a/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx +++ b/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx @@ -223,7 +223,7 @@ function OngoingTaskContent(props: { const [, { execute: triggerRetry }] = useAsync(async () => { if (taskId) { analytics.captureEvent('retried', 'Template has been retried'); - await scaffolderApi.retry?.(taskId); + await scaffolderApi.retry?.({ taskId }); } }); diff --git a/plugins/scaffolder/src/components/fields/RepoUrlPicker/BitbucketRepoPicker.tsx b/plugins/scaffolder/src/components/fields/RepoUrlPicker/BitbucketRepoPicker.tsx index 696b33e9d0..f5861d4946 100644 --- a/plugins/scaffolder/src/components/fields/RepoUrlPicker/BitbucketRepoPicker.tsx +++ b/plugins/scaffolder/src/components/fields/RepoUrlPicker/BitbucketRepoPicker.tsx @@ -85,6 +85,7 @@ export const BitbucketRepoPicker = ( scaffolderApi .autocomplete({ + context: {}, token: accessToken, resource: 'workspaces', provider: 'bitbucket-cloud', diff --git a/plugins/scaffolder/src/deprecated.ts b/plugins/scaffolder/src/deprecated.ts index 907871946c..f3230ab287 100644 --- a/plugins/scaffolder/src/deprecated.ts +++ b/plugins/scaffolder/src/deprecated.ts @@ -21,22 +21,8 @@ */ import { - createScaffolderFieldExtension as createScaffolderFieldExtensionTemp, - ScaffolderFieldExtensions as ScaffolderFieldExtensionsTemp, - useTemplateSecrets as useTemplateSecretsTemp, - scaffolderApiRef as scaffolderApiRefTemp, - createScaffolderLayout as createScaffolderLayoutTemp, - ScaffolderLayouts as ScaffolderLayoutsTemp, - type LayoutOptions as LayoutOptionsTemp, - type LayoutTemplate as LayoutTemplateTemp, type ScaffolderApi as ScaffolderApiTemp, - type ScaffolderUseTemplateSecrets as ScaffolderUseTemplateSecretsTemp, type TemplateParameterSchema as TemplateParameterSchemaTemp, - type CustomFieldExtensionSchema as CustomFieldExtensionSchemaTemp, - type CustomFieldValidator as CustomFieldValidatorTemp, - type FieldExtensionOptions as FieldExtensionOptionsTemp, - type FieldExtensionComponentProps as FieldExtensionComponentPropsTemp, - type FieldExtensionComponent as FieldExtensionComponentTemp, type ListActionsResponse as ListActionsResponseTemp, type LogEvent as LogEventTemp, type ScaffolderDryRunOptions as ScaffolderDryRunOptionsTemp, @@ -50,6 +36,23 @@ import { type ScaffolderTask as ScaffolderTaskTemp, type ScaffolderTaskOutput as ScaffolderTaskOutputTemp, type ScaffolderTaskStatus as ScaffolderTaskStatusTemp, +} from '@backstage/plugin-scaffolder-common'; + +import { + createScaffolderFieldExtension as createScaffolderFieldExtensionTemp, + ScaffolderFieldExtensions as ScaffolderFieldExtensionsTemp, + useTemplateSecrets as useTemplateSecretsTemp, + scaffolderApiRef as scaffolderApiRefTemp, + createScaffolderLayout as createScaffolderLayoutTemp, + ScaffolderLayouts as ScaffolderLayoutsTemp, + type LayoutOptions as LayoutOptionsTemp, + type LayoutTemplate as LayoutTemplateTemp, + type ScaffolderUseTemplateSecrets as ScaffolderUseTemplateSecretsTemp, + type CustomFieldExtensionSchema as CustomFieldExtensionSchemaTemp, + type CustomFieldValidator as CustomFieldValidatorTemp, + type FieldExtensionOptions as FieldExtensionOptionsTemp, + type FieldExtensionComponentProps as FieldExtensionComponentPropsTemp, + type FieldExtensionComponent as FieldExtensionComponentTemp, } from '@backstage/plugin-scaffolder-react'; import { rootRouteRef as rootRouteRefTemp } from './routes'; @@ -82,7 +85,7 @@ export const useTemplateSecrets = useTemplateSecretsTemp; export const scaffolderApiRef = scaffolderApiRefTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderApi} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderApi} instead as this has now been moved. */ export type ScaffolderApi = ScaffolderApiTemp; /** @@ -92,7 +95,7 @@ export type ScaffolderApi = ScaffolderApiTemp; export type ScaffolderUseTemplateSecrets = ScaffolderUseTemplateSecretsTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#TemplateParameterSchema} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateParameterSchema} instead as this has now been moved. */ export type TemplateParameterSchema = TemplateParameterSchemaTemp; /** @@ -127,69 +130,69 @@ export type FieldExtensionComponent<_TReturnValue, _TInputProps> = FieldExtensionComponentTemp<_TReturnValue, _TInputProps>; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ListActionsResponse} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ListActionsResponse} instead as this has now been moved. */ export type ListActionsResponse = ListActionsResponseTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#LogEvent} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#LogEvent} instead as this has now been moved. */ export type LogEvent = LogEventTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderDryRunOptions} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderDryRunOptions} instead as this has now been moved. */ export type ScaffolderDryRunOptions = ScaffolderDryRunOptionsTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderDryRunResponse} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderDryRunResponse} instead as this has now been moved. */ export type ScaffolderDryRunResponse = ScaffolderDryRunResponseTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderGetIntegrationsListOptions} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderGetIntegrationsListOptions} instead as this has now been moved. */ export type ScaffolderGetIntegrationsListOptions = ScaffolderGetIntegrationsListOptionsTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderGetIntegrationsListResponse} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderGetIntegrationsListResponse} instead as this has now been moved. */ export type ScaffolderGetIntegrationsListResponse = ScaffolderGetIntegrationsListResponseTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderOutputlink} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderOutputlink} instead as this has now been moved. */ export type ScaffolderOutputlink = ScaffolderOutputLinkTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderScaffoldOptions} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderScaffoldOptions} instead as this has now been moved. */ export type ScaffolderScaffoldOptions = ScaffolderScaffoldOptionsTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderScaffoldResponse} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderScaffoldResponse} instead as this has now been moved. */ export type ScaffolderScaffoldResponse = ScaffolderScaffoldResponseTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderStreamLogsOptions} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderStreamLogsOptions} instead as this has now been moved. */ export type ScaffolderStreamLogsOptions = ScaffolderStreamLogsOptionsTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderTask} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTask} instead as this has now been moved. */ export type ScaffolderTask = ScaffolderTaskTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderTaskOutput} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTaskOutput} instead as this has now been moved. */ export type ScaffolderTaskOutput = ScaffolderTaskOutputTemp; /** * @public - * @deprecated use import from {@link @backstage/plugin-scaffolder-react#ScaffolderTaskStatus} instead as this has now been moved. + * @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTaskStatus} instead as this has now been moved. */ export type ScaffolderTaskStatus = ScaffolderTaskStatusTemp; /** From 9d2bd50113109af24e9f0d23a9dac011bd43d069 Mon Sep 17 00:00:00 2001 From: solimant Date: Fri, 27 Dec 2024 22:38:33 +0000 Subject: [PATCH 18/44] Pull some types from the spec Signed-off-by: solimant --- plugins/scaffolder-common/src/api.ts | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/plugins/scaffolder-common/src/api.ts b/plugins/scaffolder-common/src/api.ts index f9a5dbcb17..c54b090c56 100644 --- a/plugins/scaffolder-common/src/api.ts +++ b/plugins/scaffolder-common/src/api.ts @@ -20,7 +20,12 @@ import type { TemplateEntityV1beta3, TemplateParameterSchema, } from './TemplateEntityV1beta3'; -import { TaskStatus } from '../client/src/schema/openapi'; +import type { + TaskEventType, + TaskStatus as ScaffolderTaskStatus, +} from '../client/src/schema/openapi'; + +export type { ScaffolderTaskStatus }; /** * Options you can pass into a Scaffolder request for additional information. @@ -31,19 +36,6 @@ export interface ScaffolderRequestOptions { token?: string; } -/** - * The status of each task in a Scaffolder Job - * - * @public - */ -export type ScaffolderTaskStatus = - | 'cancelled' - | 'completed' - | 'failed' - | 'open' - | 'processing' - | 'skipped'; - /** * The shape of each task returned from the `scaffolder-backend` * @@ -74,10 +66,7 @@ export type ScaffolderUsageExample = { * @public * @deprecated in favor of ScaffolderUsageExample */ -export type ActionExample = { - description: string; - example: string; -}; +export type ActionExample = ScaffolderUsageExample; /** * The response shape for a single action in the `listActions` call to the `scaffolder-backend` @@ -183,7 +172,7 @@ export type ScaffolderTaskOutput = { * @public */ export type LogEvent = { - type: 'log' | 'completion' | 'cancelled' | 'recovered'; + type: TaskEventType; body: { message: string; stepId?: string; @@ -297,7 +286,7 @@ export interface ScaffolderApi { cancelTask( taskId: string, options?: ScaffolderRequestOptions, - ): Promise<{ status?: TaskStatus }>; + ): Promise<{ status?: ScaffolderTaskStatus }>; /** * Starts the task again from the point where it failed. From 29d8a188413aef0c841f75db18942f2101155c0b Mon Sep 17 00:00:00 2001 From: solimant Date: Sun, 29 Dec 2024 19:33:15 +0000 Subject: [PATCH 19/44] Fix tests Signed-off-by: solimant --- .../src/schema/response-body-validation.ts | 49 +++++++++++++---- .../src/schema/openapi.yaml | 37 ++++++++----- .../openapi/generated/apis/Api.server.ts | 7 +-- .../models/Autocomplete400Response.model.ts | 27 ++++++++++ ...TemplateParameterSchemaStepsInner.model.ts | 5 +- .../generated/models/ValidationError.model.ts | 3 +- .../models/ValidationErrorArgument.model.ts | 24 +++++++++ .../schema/openapi/generated/models/index.ts | 2 + .../src/schema/openapi/generated/router.ts | 52 ++++++++++++++----- .../src/service/router.test.ts | 22 +++++++- .../scaffolder-backend/src/service/router.ts | 14 ++--- .../openapi/generated/apis/Api.client.ts | 6 +-- .../models/Autocomplete400Response.model.ts | 27 ++++++++++ ...TemplateParameterSchemaStepsInner.model.ts | 5 +- .../generated/models/ValidationError.model.ts | 3 +- .../models/ValidationErrorArgument.model.ts | 24 +++++++++ .../schema/openapi/generated/models/index.ts | 2 + plugins/scaffolder-common/package.json | 3 +- .../src/ScaffolderClient.test.ts} | 30 ++++++----- .../scaffolder-common/src/ScaffolderClient.ts | 12 ++--- .../src/types/IdentityApi.ts | 47 +++++++++++++++++ plugins/scaffolder/package.json | 2 + yarn.lock | 14 +++-- 23 files changed, 336 insertions(+), 81 deletions(-) create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete400Response.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete400Response.model.ts create mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts rename plugins/{scaffolder/src/api.test.ts => scaffolder-common/src/ScaffolderClient.test.ts} (97%) create mode 100644 plugins/scaffolder-common/src/types/IdentityApi.ts diff --git a/packages/backend-openapi-utils/src/schema/response-body-validation.ts b/packages/backend-openapi-utils/src/schema/response-body-validation.ts index 71a4512e75..79f659f0d2 100644 --- a/packages/backend-openapi-utils/src/schema/response-body-validation.ts +++ b/packages/backend-openapi-utils/src/schema/response-body-validation.ts @@ -69,16 +69,19 @@ export class ResponseBodyParser const jsonContentType = Object.keys(contentTypes).find(contentType => contentType.split(';').includes('application/json'), ); - if (!jsonContentType) { - throw new OperationError( - this.operation, - `No application/json content type found in response for status code ${statusCode}`, - ); - } else if ('$ref' in contentTypes[jsonContentType].schema) { + const eventStreamContentType = Object.keys(contentTypes).find( + contentType => contentType.split(';').includes('text/event-stream'), + ); + if (jsonContentType && '$ref' in contentTypes[jsonContentType].schema) { throw new OperationError( this.operation, 'Reference objects are not supported', ); + } else if (!jsonContentType && !eventStreamContentType) { + throw new OperationError( + this.operation, + `No valid content type found in response for status code ${statusCode}`, + ); } } } @@ -113,14 +116,20 @@ export class ResponseBodyParser const jsonContentType = Object.keys(contentTypes ?? {}).find(contentType => contentType.split(';').includes('application/json'), ); - if (!jsonContentType) { + const eventStreamContentType = Object.keys(contentTypes ?? {}).find( + contentType => contentType.split(';').includes('text/event-stream'), + ); + if (!jsonContentType && !eventStreamContentType) { throw new OperationResponseError( this.operation, response, - 'No application/json content type found in response', + 'No valid content type found in response', ); } - const schema = responseSchema.content![jsonContentType].schema; + const schema = + (jsonContentType && responseSchema.content![jsonContentType].schema) || + (eventStreamContentType && + responseSchema.content![eventStreamContentType].schema); // This is a bit of type laziness. Ideally, this would be a type-narrowing function, but I wasn't able to get the types to work. if (!schema) { throw new OperationError(this.operation, 'No schema found in response'); @@ -145,6 +154,28 @@ export class ResponseBodyParser } const validate = this.ajv.compile(schema); + + if (eventStreamContentType) { + const eventStreamBody = await response.text(); + + const jsonMatches = [...eventStreamBody.matchAll(/data:\s*(\{.*?\})/g)]; + const jsonObjects = jsonMatches.map(match => { + return match[1] as any as JsonObject; + }); + + const invalid = jsonObjects.some(jsonObject => !validate(jsonObject)); + if (invalid) { + throw new OperationParsingResponseError( + this.operation, + response, + 'Response body', + validate.errors!, + ); + } + + return undefined; + } + const jsonBody = (await response.json()) as JsonObject; const valid = validate(jsonBody); if (!valid) { diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index b1a88c5a49..c6be10aa4c 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -44,10 +44,8 @@ components: required: false allowReserved: true schema: - type: array - items: - type: integer - minimum: 0 + type: integer + minimum: 0 namespace: name: namespace in: path @@ -69,10 +67,8 @@ components: required: false allowReserved: true schema: - type: array - items: - type: integer - minimum: 0 + type: integer + minimum: 0 order: name: order in: query @@ -534,7 +530,7 @@ components: type: string content: type: string - format: byte + # format: byte executable: type: boolean symlink: @@ -869,9 +865,11 @@ components: type: object properties: title: - $ref: '#/components/schemas/JsonValue' + type: string + # $ref: '#/components/schemas/JsonValue' description: - $ref: '#/components/schemas/JsonValue' + type: string + # $ref: '#/components/schemas/JsonValue' schema: type: object # additionalProperties: {} @@ -971,7 +969,11 @@ components: name: type: string argument: - type: object + oneOf: + - type: boolean + - type: number + - type: object + - type: string stack: type: string required: @@ -1324,6 +1326,17 @@ paths: - id required: - results + '400': + description: Unsupported provider. + content: + application/json: + schema: + type: object + properties: + message: + type: string + name: + type: string parameters: - in: path name: provider diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts index d723bf2de3..2e3ea7fa3c 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -21,6 +21,7 @@ // ****************************************************************** import { Action } from '../models/Action.model'; import { Autocomplete200Response } from '../models/Autocomplete200Response.model'; +import { Autocomplete400Response } from '../models/Autocomplete400Response.model'; import { AutocompleteRequest } from '../models/AutocompleteRequest.model'; import { CancelTask200Response } from '../models/CancelTask200Response.model'; import { DryRun200Response } from '../models/DryRun200Response.model'; @@ -43,7 +44,7 @@ export type Autocomplete = { resource: string; }; body: AutocompleteRequest; - response: Autocomplete200Response; + response: Autocomplete200Response | Autocomplete400Response; }; /** * @public @@ -93,8 +94,8 @@ export type ListActions = { export type ListTasks = { query: { createdBy?: Array; - limit?: Array; - offset?: Array; + limit?: number; + offset?: number; order?: Array; status?: Array; }; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete400Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete400Response.model.ts new file mode 100644 index 0000000000..f36f47871e --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete400Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface Autocomplete400Response { + message?: string; + name?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts index 43da448f7f..cf42ba5649 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts @@ -17,13 +17,12 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** -import { JsonValue } from '../models/JsonValue.model'; /** * @public */ export interface TemplateParameterSchemaStepsInner { - title: JsonValue; - description?: JsonValue; + title: string; + description?: string; schema: any; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts index a7c30935df..459babc8bb 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts @@ -17,6 +17,7 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { ValidationErrorArgument } from '../models/ValidationErrorArgument.model'; import { ValidationErrorPathInner } from '../models/ValidationErrorPathInner.model'; /** @@ -30,6 +31,6 @@ export interface ValidationError { message: string; instance: any; name: string; - argument: any; + argument: ValidationErrorArgument; stack: string; } diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts new file mode 100644 index 0000000000..60d2a20a5c --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type ValidationErrorArgument = any | boolean | number | string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts index 41a96e63ae..7f5a2de608 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts @@ -19,6 +19,7 @@ export * from '../models/ActionExample.model'; export * from '../models/ActionSchema.model'; export * from '../models/Autocomplete200Response.model'; export * from '../models/Autocomplete200ResponseResultsInner.model'; +export * from '../models/Autocomplete400Response.model'; export * from '../models/AutocompleteRequest.model'; export * from '../models/CancelTask200Response.model'; export * from '../models/DryRun200Response.model'; @@ -61,4 +62,5 @@ export * from '../models/TemplateInfoEntity.model'; export * from '../models/TemplateParameterSchema.model'; export * from '../models/TemplateParameterSchemaStepsInner.model'; export * from '../models/ValidationError.model'; +export * from '../models/ValidationErrorArgument.model'; export * from '../models/ValidationErrorPathInner.model'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts index 1a94e60653..29c7d9af93 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -80,11 +80,8 @@ export const spec = { required: false, allowReserved: true, schema: { - type: 'array', - items: { - type: 'integer', - minimum: 0, - }, + type: 'integer', + minimum: 0, }, }, namespace: { @@ -112,11 +109,8 @@ export const spec = { required: false, allowReserved: true, schema: { - type: 'array', - items: { - type: 'integer', - minimum: 0, - }, + type: 'integer', + minimum: 0, }, }, order: { @@ -545,7 +539,6 @@ export const spec = { }, content: { type: 'string', - format: 'byte', }, executable: { type: 'boolean', @@ -758,10 +751,10 @@ export const spec = { type: 'object', properties: { title: { - $ref: '#/components/schemas/JsonValue', + type: 'string', }, description: { - $ref: '#/components/schemas/JsonValue', + type: 'string', }, schema: { type: 'object', @@ -805,7 +798,20 @@ export const spec = { type: 'string', }, argument: { - type: 'object', + oneOf: [ + { + type: 'boolean', + }, + { + type: 'number', + }, + { + type: 'object', + }, + { + type: 'string', + }, + ], }, stack: { type: 'string', @@ -1352,6 +1358,24 @@ export const spec = { }, }, }, + '400': { + description: 'Unsupported provider.', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + message: { + type: 'string', + }, + name: { + type: 'string', + }, + }, + }, + }, + }, + }, }, parameters: [ { diff --git a/plugins/scaffolder-backend/src/service/router.test.ts b/plugins/scaffolder-backend/src/service/router.test.ts index a938abe611..38fbbea533 100644 --- a/plugins/scaffolder-backend/src/service/router.test.ts +++ b/plugins/scaffolder-backend/src/service/router.test.ts @@ -16,6 +16,7 @@ import { DatabaseManager } from '@backstage/backend-defaults/database'; import { ConfigReader } from '@backstage/config'; +import express from 'express'; import request from 'supertest'; import ObservableImpl from 'zen-observable'; @@ -65,6 +66,24 @@ import { import { createDefaultFilters } from '../lib/templating/filters/createDefaultFilters'; import { createRouter } from './router'; import { DatabaseTaskStore } from '../scaffolder/tasks/DatabaseTaskStore'; +import { Server } from 'http'; +import { wrapServer } from '@backstage/backend-openapi-utils/testUtils'; + +const mockAccess = jest.fn(); + +jest.mock('fs-extra', () => ({ + ...jest.requireActual('fs-extra'), + access: (...args: any[]) => mockAccess(...args), + promises: { + access: (...args: any[]) => mockAccess(...args), + }, + constants: { + F_OK: 0, + W_OK: 1, + }, + mkdir: jest.fn(), + remove: jest.fn(), +})); function createDatabase(): DatabaseService { return DatabaseManager.fromConfig( @@ -245,7 +264,8 @@ const createTestRouter = async ( }); router.use(mockErrorHandler()); - return { router, logger, taskBroker, permissions, catalog }; + const app = await wrapServer(express().use(router)); + return { router: app, logger, taskBroker, permissions, catalog }; }; describe('scaffolder router', () => { diff --git a/plugins/scaffolder-backend/src/service/router.ts b/plugins/scaffolder-backend/src/service/router.ts index 19dfd8274d..263401f3af 100644 --- a/plugins/scaffolder-backend/src/service/router.ts +++ b/plugins/scaffolder-backend/src/service/router.ts @@ -102,7 +102,6 @@ import { findTemplate, getEntityBaseUrl, getWorkingDirectory, - parseNumberParam, parseStringsParam, } from './helpers'; @@ -404,8 +403,10 @@ export async function createRouter( description: template.metadata.description, 'ui:options': template.metadata['ui:options'], steps: parameters.map(schema => ({ - title: schema.title ?? 'Please enter the following information', - description: schema.description, + title: + (schema.title as string) ?? + 'Please enter the following information', + description: schema.description as string, schema, })), EXPERIMENTAL_formDecorators: @@ -587,8 +588,7 @@ export async function createRouter( }; }); - const limit = parseNumberParam(req.query.limit, 'limit'); - const offset = parseNumberParam(req.query.offset, 'offset'); + const { limit, offset } = req.query; const taskPermissionFilters = await getAuthorizeConditions({ credentials: credentials, @@ -604,8 +604,8 @@ export async function createRouter( }, order, pagination: { - limit: limit ? limit[0] : undefined, - offset: offset ? offset[0] : undefined, + limit, + offset, }, permissionFilters: taskPermissionFilters, }); diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts index ef188b6a4d..600ae7bc86 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts @@ -105,8 +105,8 @@ export type ListActions = {}; export type ListTasks = { query: { createdBy?: Array; - limit?: Array; - offset?: Array; + limit?: number; + offset?: number; order?: Array; status?: Array; }; @@ -339,7 +339,7 @@ export class DefaultApiClient { ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - const uriTemplate = `/v2/tasks{?createdBy*,limit*,offset*,order*,status*}`; + const uriTemplate = `/v2/tasks{?createdBy*,limit,offset,order*,status*}`; const uri = parser.parse(uriTemplate).expand({ ...request.query, diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete400Response.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete400Response.model.ts new file mode 100644 index 0000000000..f36f47871e --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete400Response.model.ts @@ -0,0 +1,27 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface Autocomplete400Response { + message?: string; + name?: string; +} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts index 43da448f7f..cf42ba5649 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts @@ -17,13 +17,12 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** -import { JsonValue } from '../models/JsonValue.model'; /** * @public */ export interface TemplateParameterSchemaStepsInner { - title: JsonValue; - description?: JsonValue; + title: string; + description?: string; schema: any; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts index a7c30935df..459babc8bb 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts @@ -17,6 +17,7 @@ // ****************************************************************** // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** +import { ValidationErrorArgument } from '../models/ValidationErrorArgument.model'; import { ValidationErrorPathInner } from '../models/ValidationErrorPathInner.model'; /** @@ -30,6 +31,6 @@ export interface ValidationError { message: string; instance: any; name: string; - argument: any; + argument: ValidationErrorArgument; stack: string; } diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts new file mode 100644 index 0000000000..60d2a20a5c --- /dev/null +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export type ValidationErrorArgument = any | boolean | number | string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts index 41a96e63ae..7f5a2de608 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts @@ -19,6 +19,7 @@ export * from '../models/ActionExample.model'; export * from '../models/ActionSchema.model'; export * from '../models/Autocomplete200Response.model'; export * from '../models/Autocomplete200ResponseResultsInner.model'; +export * from '../models/Autocomplete400Response.model'; export * from '../models/AutocompleteRequest.model'; export * from '../models/CancelTask200Response.model'; export * from '../models/DryRun200Response.model'; @@ -61,4 +62,5 @@ export * from '../models/TemplateInfoEntity.model'; export * from '../models/TemplateParameterSchema.model'; export * from '../models/TemplateParameterSchemaStepsInner.model'; export * from '../models/ValidationError.model'; +export * from '../models/ValidationErrorArgument.model'; export * from '../models/ValidationErrorPathInner.model'; diff --git a/plugins/scaffolder-common/package.json b/plugins/scaffolder-common/package.json index 4fb33b8156..aa7a86ced6 100644 --- a/plugins/scaffolder-common/package.json +++ b/plugins/scaffolder-common/package.json @@ -61,7 +61,6 @@ }, "dependencies": { "@backstage/catalog-model": "workspace:^", - "@backstage/core-plugin-api": "workspace:^", "@backstage/errors": "workspace:^", "@backstage/integration": "workspace:^", "@backstage/plugin-permission-common": "workspace:^", @@ -73,7 +72,9 @@ }, "devDependencies": { "@backstage/cli": "workspace:^", + "@backstage/test-utils": "workspace:^", "cross-fetch": "^4.0.0", + "msw": "^1.0.0", "uri-template": "^2.0.0" } } diff --git a/plugins/scaffolder/src/api.test.ts b/plugins/scaffolder-common/src/ScaffolderClient.test.ts similarity index 97% rename from plugins/scaffolder/src/api.test.ts rename to plugins/scaffolder-common/src/ScaffolderClient.test.ts index 1df2dacb17..03064d7086 100644 --- a/plugins/scaffolder/src/api.test.ts +++ b/plugins/scaffolder-common/src/ScaffolderClient.test.ts @@ -14,12 +14,15 @@ * limitations under the License. */ -import { ConfigReader } from '@backstage/core-app-api'; import { ScmIntegrations } from '@backstage/integration'; -import { MockFetchApi, registerMswTestHooks } from '@backstage/test-utils'; +import { + MockFetchApi, + mockApis, + registerMswTestHooks, +} from '@backstage/test-utils'; import { rest } from 'msw'; import { setupServer } from 'msw/node'; -import { ScaffolderClient } from './api'; +import { ScaffolderClient } from './ScaffolderClient'; import { fetchEventSource } from '@microsoft/fetch-event-source'; jest.mock('@microsoft/fetch-event-source'); @@ -31,6 +34,17 @@ const server = setupServer(); describe('api', () => { registerMswTestHooks(server); + const githubIntegrationConfig = mockApis.config({ + data: { + integrations: { + github: [ + { + host: 'hello.com', + }, + ], + }, + }, + }); const mockBaseUrl = 'http://backstage/api'; const discoveryApi = { getBaseUrl: async () => mockBaseUrl }; @@ -43,15 +57,7 @@ describe('api', () => { }; const scmIntegrationsApi = ScmIntegrations.fromConfig( - new ConfigReader({ - integrations: { - github: [ - { - host: 'hello.com', - }, - ], - }, - }), + githubIntegrationConfig, ); let apiClient: ScaffolderClient; diff --git a/plugins/scaffolder-common/src/ScaffolderClient.ts b/plugins/scaffolder-common/src/ScaffolderClient.ts index 44973ca569..2a178bf7e7 100644 --- a/plugins/scaffolder-common/src/ScaffolderClient.ts +++ b/plugins/scaffolder-common/src/ScaffolderClient.ts @@ -15,11 +15,6 @@ */ import { parseEntityRef } from '@backstage/catalog-model'; -import { - DiscoveryApi, - FetchApi, - IdentityApi, -} from '@backstage/core-plugin-api'; import { ResponseError } from '@backstage/errors'; import { ScmIntegrationRegistry } from '@backstage/integration'; import { Observable } from '@backstage/types'; @@ -50,6 +45,9 @@ import { TaskStatus, TypedResponse, } from '../client/src/schema/openapi'; +import { DiscoveryApi } from '../client/src/schema/openapi/generated/types/discovery'; +import { FetchApi } from '../client/src/schema/openapi/generated/types/fetch'; +import { IdentityApi } from './types/IdentityApi'; /** * An API to interact with the scaffolder backend. @@ -106,8 +104,8 @@ export class ScaffolderClient implements ScaffolderApi { request.filterByOwnership === 'owned' ? [userEntityRef] : undefined, - limit: request.limit ? [request.limit] : undefined, - offset: request.offset ? [request.offset] : undefined, + limit: request.limit, + offset: request.offset, }, }, options, diff --git a/plugins/scaffolder-common/src/types/IdentityApi.ts b/plugins/scaffolder-common/src/types/IdentityApi.ts new file mode 100644 index 0000000000..5bc8e2401a --- /dev/null +++ b/plugins/scaffolder-common/src/types/IdentityApi.ts @@ -0,0 +1,47 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This is a copy of the BackstageUserIdentity, to avoid importing core-plugin-api. + */ +type BackstageUserIdentity = { + /** + * The type of identity that this structure represents. In the frontend app + * this will currently always be 'user'. + */ + type: 'user'; + + /** + * The entityRef of the user in the catalog. + * For example User:default/sandra + */ + userEntityRef: string; + + /** + * The user and group entities that the user claims ownership through + */ + ownershipEntityRefs: string[]; +}; + +/** + * This is a partial copy of the IdentityApi, to avoid importing core-plugin-api. + */ +export type IdentityApi = { + /** + * User identity information within Backstage. + */ + getBackstageIdentity(): Promise; +}; diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 1b547762ef..3c3e811696 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -87,10 +87,12 @@ "git-url-parse": "^15.0.0", "humanize-duration": "^3.25.1", "idb-keyval": "5.1.5", + "json-schema": "^0.4.0", "json-schema-library": "^9.0.0", "jszip": "^3.10.1", "lodash": "^4.17.21", "luxon": "^3.0.0", + "qs": "^6.9.4", "react-resizable": "^3.0.5", "react-use": "^17.2.4", "react-window": "^1.8.10", diff --git a/yarn.lock b/yarn.lock index 855748a4e4..34a11b612c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7394,8 +7394,18 @@ __metadata: dependencies: "@backstage/catalog-model": "workspace:^" "@backstage/cli": "workspace:^" + "@backstage/errors": "workspace:^" + "@backstage/integration": "workspace:^" "@backstage/plugin-permission-common": "workspace:^" + "@backstage/test-utils": "workspace:^" "@backstage/types": "workspace:^" + "@microsoft/fetch-event-source": "npm:^2.0.1" + cross-fetch: "npm:^4.0.0" + json-schema: "npm:^0.4.0" + msw: "npm:^1.0.0" + qs: "npm:^6.9.4" + uri-template: "npm:^2.0.0" + zen-observable: "npm:^0.10.0" languageName: unknown linkType: soft @@ -7536,9 +7546,7 @@ __metadata: "@backstage/core-components": "workspace:^" "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" - "@backstage/errors": "workspace:^" "@backstage/frontend-plugin-api": "workspace:^" - "@backstage/integration": "workspace:^" "@backstage/integration-react": "workspace:^" "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-common": "workspace:^" @@ -7555,7 +7563,6 @@ __metadata: "@material-ui/core": "npm:^4.12.2" "@material-ui/icons": "npm:^4.9.1" "@material-ui/lab": "npm:4.0.0-alpha.61" - "@microsoft/fetch-event-source": "npm:^2.0.1" "@react-hookz/web": "npm:^24.0.0" "@rjsf/core": "npm:5.23.2" "@rjsf/material-ui": "npm:5.23.2" @@ -7590,7 +7597,6 @@ __metadata: react-window: "npm:^1.8.10" swr: "npm:^2.0.0" yaml: "npm:^2.0.0" - zen-observable: "npm:^0.10.0" zod: "npm:^3.22.4" zod-to-json-schema: "npm:^3.20.4" peerDependencies: From fcd82b14235ba19269df8a34ff6c242177b857ea Mon Sep 17 00:00:00 2001 From: solimant Date: Mon, 30 Dec 2024 17:42:09 +0000 Subject: [PATCH 20/44] Fix dependencies Signed-off-by: solimant --- plugins/scaffolder/package.json | 3 ++- yarn.lock | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 3c3e811696..6f39c60914 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -63,7 +63,9 @@ "@backstage/core-compat-api": "workspace:^", "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", + "@backstage/errors": "workspace:^", "@backstage/frontend-plugin-api": "workspace:^", + "@backstage/integration": "workspace:^", "@backstage/integration-react": "workspace:^", "@backstage/plugin-catalog-common": "workspace:^", "@backstage/plugin-catalog-react": "workspace:^", @@ -116,7 +118,6 @@ "@types/react": "^18.0.0", "@types/react-resizable": "^3.0.8", "@types/react-window": "^1.8.8", - "msw": "^1.0.0", "react": "^18.0.2", "react-dom": "^18.0.2", "react-router-dom": "^6.3.0", diff --git a/yarn.lock b/yarn.lock index 34a11b612c..2a8915d85d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7546,7 +7546,9 @@ __metadata: "@backstage/core-components": "workspace:^" "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" + "@backstage/errors": "workspace:^" "@backstage/frontend-plugin-api": "workspace:^" + "@backstage/integration": "workspace:^" "@backstage/integration-react": "workspace:^" "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-common": "workspace:^" @@ -7587,7 +7589,6 @@ __metadata: jszip: "npm:^3.10.1" lodash: "npm:^4.17.21" luxon: "npm:^3.0.0" - msw: "npm:^1.0.0" qs: "npm:^6.9.4" react: "npm:^18.0.2" react-dom: "npm:^18.0.2" From bd7ae8559dccf15ae0a08997dcc59c31ff58602a Mon Sep 17 00:00:00 2001 From: solimant Date: Mon, 30 Dec 2024 20:00:24 +0000 Subject: [PATCH 21/44] Fix prettier Signed-off-by: solimant --- plugins/scaffolder-backend/src/schema/openapi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index c6be10aa4c..21d344b5bc 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -763,7 +763,7 @@ components: # description: The apiVersion string of the TaskSpec. # kind: # type: string - # enum: + # enum: # - Template # description: The kind of the entity # spec: From 68eca7b9a0d01d18456b9200d625f3df669f0664 Mon Sep 17 00:00:00 2001 From: solimant Date: Mon, 30 Dec 2024 22:28:21 +0000 Subject: [PATCH 22/44] Fix API report Signed-off-by: solimant --- packages/backend-openapi-utils/report.api.md | 2 +- plugins/scaffolder-common/report.api.md | 372 +++++++++++++++++- .../scaffolder-common/src/ScaffolderClient.ts | 29 +- plugins/scaffolder-common/src/api.ts | 2 +- .../src/types/IdentityApi.ts | 47 --- plugins/scaffolder-node/report.api.md | 9 +- plugins/scaffolder-react/report-alpha.api.md | 3 +- plugins/scaffolder-react/report.api.md | 264 +++---------- plugins/scaffolder/report.api.md | 106 +---- 9 files changed, 483 insertions(+), 351 deletions(-) delete mode 100644 plugins/scaffolder-common/src/types/IdentityApi.ts diff --git a/packages/backend-openapi-utils/report.api.md b/packages/backend-openapi-utils/report.api.md index 6606f88b4a..75bf53cdf1 100644 --- a/packages/backend-openapi-utils/report.api.md +++ b/packages/backend-openapi-utils/report.api.md @@ -274,7 +274,7 @@ type EndpointMap = Record< { query?: object; body?: object; - response?: object | void; + response?: object | string | void; path?: object; } >; diff --git a/plugins/scaffolder-common/report.api.md b/plugins/scaffolder-common/report.api.md index 455921c085..d2a5e83672 100644 --- a/plugins/scaffolder-common/report.api.md +++ b/plugins/scaffolder-common/report.api.md @@ -7,15 +7,369 @@ import { Entity } from '@backstage/catalog-model'; import type { EntityMeta } from '@backstage/catalog-model'; import type { JsonArray } from '@backstage/types'; import { JsonObject } from '@backstage/types'; -import type { JsonValue } from '@backstage/types'; +import { JSONSchema7 } from 'json-schema'; +import { JsonValue } from '@backstage/types'; import { KindValidator } from '@backstage/catalog-model'; +import { Observable } from '@backstage/types'; +import { ScmIntegrationRegistry } from '@backstage/integration'; import type { UserEntity } from '@backstage/catalog-model'; +// @public +export type Action = { + id: string; + description?: string; + schema?: { + input?: JSONSchema7; + output?: JSONSchema7; + }; + examples?: ActionExample[]; +}; + +// @public +export interface ActionExample { + // (undocumented) + description: string; + // (undocumented) + example: string; +} + // @public export const isTemplateEntityV1beta3: ( entity: Entity, ) => entity is TemplateEntityV1beta3; +// @public +export type ListActionsResponse = Array; + +// @public +export type LogEvent = { + type: TaskEventType; + body: { + message: string; + stepId?: string; + status?: ScaffolderTaskStatus; + }; + createdAt: string; + id: number; + taskId: string; +}; + +// @public +export interface ScaffolderApi { + // (undocumented) + autocomplete?( + request: { + token: string; + provider: string; + resource: string; + context: Record; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ + results: { + title?: string; + id: string; + }[]; + }>; + cancelTask( + taskId: string, + options?: ScaffolderRequestOptions, + ): Promise<{ + status?: ScaffolderTaskStatus; + }>; + // (undocumented) + dryRun?( + request: ScaffolderDryRunOptions, + options?: ScaffolderRequestOptions, + ): Promise; + // (undocumented) + getIntegrationsList( + options: ScaffolderGetIntegrationsListOptions, + ): Promise; + // (undocumented) + getTask( + taskId: string, + options?: ScaffolderRequestOptions, + ): Promise; + // (undocumented) + getTemplateParameterSchema( + templateRef: string, + options?: ScaffolderRequestOptions, + ): Promise; + listActions(options?: ScaffolderRequestOptions): Promise; + // (undocumented) + listTasks?( + request: { + filterByOwnership: 'owned' | 'all'; + limit?: number; + offset?: number; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ + tasks: ScaffolderTask[]; + totalTasks?: number; + }>; + retry?( + { + secrets, + taskId, + }: { + secrets?: Record; + taskId: string; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ + id: string; + }>; + scaffold( + request: ScaffolderScaffoldOptions, + options?: ScaffolderRequestOptions, + ): Promise; + // (undocumented) + streamLogs( + request: ScaffolderStreamLogsOptions, + options?: ScaffolderRequestOptions, + ): Observable; +} + +// @public +export class ScaffolderClient implements ScaffolderApi { + constructor(options: { + discoveryApi: { + getBaseUrl(pluginId: string): Promise; + }; + fetchApi: { + fetch: typeof fetch; + }; + identityApi?: { + getBackstageIdentity(): Promise<{ + type: 'user'; + userEntityRef: string; + ownershipEntityRefs: string[]; + }>; + }; + scmIntegrationsApi: ScmIntegrationRegistry; + useLongPollingLogs?: boolean; + }); + autocomplete({ + token, + resource, + provider, + context, + }: { + token: string; + provider: string; + resource: string; + context: Record; + }): Promise<{ + results: { + title?: string; + id: string; + }[]; + }>; + cancelTask( + taskId: string, + options?: ScaffolderRequestOptions, + ): Promise<{ + status?: ScaffolderTaskStatus; + }>; + // (undocumented) + dryRun( + request: ScaffolderDryRunOptions, + options?: ScaffolderRequestOptions, + ): Promise; + // (undocumented) + getIntegrationsList( + options: ScaffolderGetIntegrationsListOptions, + ): Promise; + // (undocumented) + getTask( + taskId: string, + options?: ScaffolderRequestOptions, + ): Promise; + // (undocumented) + getTemplateParameterSchema( + templateRef: string, + options?: ScaffolderRequestOptions, + ): Promise; + listActions(options?: ScaffolderRequestOptions): Promise; + // (undocumented) + listTasks( + request: { + filterByOwnership: 'owned' | 'all'; + limit?: number; + offset?: number; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ + tasks: ScaffolderTask[]; + totalTasks?: number; + }>; + retry?( + { + secrets, + taskId, + }: { + secrets?: Record; + taskId: string; + }, + options?: ScaffolderRequestOptions, + ): Promise<{ + id: string; + }>; + scaffold( + request: ScaffolderScaffoldOptions, + options?: ScaffolderRequestOptions, + ): Promise; + // (undocumented) + streamLogs( + request: ScaffolderStreamLogsOptions, + options?: ScaffolderRequestOptions, + ): Observable; +} + +// @public (undocumented) +export interface ScaffolderDryRunOptions { + // (undocumented) + directoryContents: { + path: string; + base64Content: string; + }[]; + // (undocumented) + secrets?: Record; + // (undocumented) + template: TemplateEntityV1beta3; + // (undocumented) + values: JsonObject; +} + +// @public (undocumented) +export interface ScaffolderDryRunResponse { + // (undocumented) + directoryContents: Array<{ + path: string; + base64Content: string; + executable?: boolean; + }>; + // (undocumented) + log: Array>; + // (undocumented) + output: ScaffolderTaskOutput; + // (undocumented) + steps: TaskStep[]; +} + +// @public +export interface ScaffolderGetIntegrationsListOptions { + // (undocumented) + allowedHosts: string[]; +} + +// @public +export interface ScaffolderGetIntegrationsListResponse { + // (undocumented) + integrations: { + type: string; + title: string; + host: string; + }[]; +} + +// @public (undocumented) +export type ScaffolderOutputLink = { + title?: string; + icon?: string; + url?: string; + entityRef?: string; +}; + +// @public (undocumented) +export type ScaffolderOutputText = { + title?: string; + icon?: string; + content?: string; + default?: boolean; +}; + +// @public +export interface ScaffolderRequestOptions { + // (undocumented) + token?: string; +} + +// @public +export interface ScaffolderScaffoldOptions { + // (undocumented) + secrets?: Record; + // (undocumented) + templateRef: string; + // (undocumented) + values: Record; +} + +// @public +export interface ScaffolderScaffoldResponse { + // (undocumented) + taskId: string; +} + +// @public +export interface ScaffolderStreamLogsOptions { + // (undocumented) + after?: number; + // (undocumented) + isTaskRecoverable?: boolean; + // (undocumented) + taskId: string; +} + +// @public +export type ScaffolderTask = { + id: string; + spec: TaskSpec; + status: ScaffolderTaskStatus; + lastHeartbeatAt?: string; + createdAt: string; +}; + +// @public (undocumented) +export type ScaffolderTaskOutput = { + links?: ScaffolderOutputLink[]; + text?: ScaffolderOutputText[]; +} & { + [key: string]: unknown; +}; + +// @public (undocumented) +export type ScaffolderTaskStatus = + | 'cancelled' + | 'completed' + | 'failed' + | 'open' + | 'processing' + | 'skipped'; + +// @public (undocumented) +export const ScaffolderTaskStatus: { + Cancelled: ScaffolderTaskStatus; + Completed: ScaffolderTaskStatus; + Failed: ScaffolderTaskStatus; + Open: ScaffolderTaskStatus; + Processing: ScaffolderTaskStatus; + Skipped: ScaffolderTaskStatus; +}; + +// @public (undocumented) +export type TaskEventType = 'cancelled' | 'completion' | 'log' | 'recovered'; + +// @public (undocumented) +export const TaskEventType: { + Cancelled: TaskEventType; + Completion: TaskEventType; + Log: TaskEventType; + Recovered: TaskEventType; +}; + // @public export type TaskRecoverStrategy = 'none' | 'startOver'; @@ -103,6 +457,22 @@ export type TemplateInfo = { }; }; +// @public +export type TemplateParameterSchema = { + title: string; + description?: string; + presentation?: TemplatePresentationV1beta3; + steps: Array<{ + title: string; + description?: string; + schema: JsonObject; + }>; + EXPERIMENTAL_formDecorators?: { + id: string; + input?: JsonObject; + }[]; +}; + // @public export interface TemplateParametersV1beta3 extends JsonObject { // (undocumented) diff --git a/plugins/scaffolder-common/src/ScaffolderClient.ts b/plugins/scaffolder-common/src/ScaffolderClient.ts index 2a178bf7e7..0e03480283 100644 --- a/plugins/scaffolder-common/src/ScaffolderClient.ts +++ b/plugins/scaffolder-common/src/ScaffolderClient.ts @@ -45,9 +45,6 @@ import { TaskStatus, TypedResponse, } from '../client/src/schema/openapi'; -import { DiscoveryApi } from '../client/src/schema/openapi/generated/types/discovery'; -import { FetchApi } from '../client/src/schema/openapi/generated/types/fetch'; -import { IdentityApi } from './types/IdentityApi'; /** * An API to interact with the scaffolder backend. @@ -56,16 +53,30 @@ import { IdentityApi } from './types/IdentityApi'; */ export class ScaffolderClient implements ScaffolderApi { private readonly apiClient: DefaultApiClient; - private readonly discoveryApi: DiscoveryApi; + private readonly discoveryApi: { + getBaseUrl(pluginId: string): Promise; + }; private readonly scmIntegrationsApi: ScmIntegrationRegistry; - private readonly fetchApi: FetchApi; - private readonly identityApi?: IdentityApi; + private readonly fetchApi: { fetch: typeof fetch }; + private readonly identityApi?: { + getBackstageIdentity(): Promise<{ + type: 'user'; + userEntityRef: string; + ownershipEntityRefs: string[]; + }>; + }; private readonly useLongPollingLogs: boolean; constructor(options: { - discoveryApi: DiscoveryApi; - fetchApi: FetchApi; - identityApi?: IdentityApi; + discoveryApi: { getBaseUrl(pluginId: string): Promise }; + fetchApi: { fetch: typeof fetch }; + identityApi?: { + getBackstageIdentity(): Promise<{ + type: 'user'; + userEntityRef: string; + ownershipEntityRefs: string[]; + }>; + }; scmIntegrationsApi: ScmIntegrationRegistry; useLongPollingLogs?: boolean; }) { diff --git a/plugins/scaffolder-common/src/api.ts b/plugins/scaffolder-common/src/api.ts index c54b090c56..a62729cad5 100644 --- a/plugins/scaffolder-common/src/api.ts +++ b/plugins/scaffolder-common/src/api.ts @@ -25,7 +25,7 @@ import type { TaskStatus as ScaffolderTaskStatus, } from '../client/src/schema/openapi'; -export type { ScaffolderTaskStatus }; +export type { ScaffolderTaskStatus, TaskEventType }; /** * Options you can pass into a Scaffolder request for additional information. diff --git a/plugins/scaffolder-common/src/types/IdentityApi.ts b/plugins/scaffolder-common/src/types/IdentityApi.ts deleted file mode 100644 index 5bc8e2401a..0000000000 --- a/plugins/scaffolder-common/src/types/IdentityApi.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2020 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * This is a copy of the BackstageUserIdentity, to avoid importing core-plugin-api. - */ -type BackstageUserIdentity = { - /** - * The type of identity that this structure represents. In the frontend app - * this will currently always be 'user'. - */ - type: 'user'; - - /** - * The entityRef of the user in the catalog. - * For example User:default/sandra - */ - userEntityRef: string; - - /** - * The user and group entities that the user claims ownership through - */ - ownershipEntityRefs: string[]; -}; - -/** - * This is a partial copy of the IdentityApi, to avoid importing core-plugin-api. - */ -export type IdentityApi = { - /** - * User identity information within Backstage. - */ - getBackstageIdentity(): Promise; -}; diff --git a/plugins/scaffolder-node/report.api.md b/plugins/scaffolder-node/report.api.md index d0fd036f29..6e91a880e2 100644 --- a/plugins/scaffolder-node/report.api.md +++ b/plugins/scaffolder-node/report.api.md @@ -340,7 +340,11 @@ export type SerializedTaskEvent = { id: number; isTaskRecoverable?: boolean; taskId: string; - body: JsonObject; + body: { + message: string; + stepId?: string; + status?: TaskStatus; + } & JsonObject; type: TaskEventType; createdAt: string; }; @@ -485,7 +489,8 @@ export type TaskStatus = | 'completed' | 'failed' | 'open' - | 'processing'; + | 'processing' + | 'skipped'; // @public (undocumented) export type TemplateAction< diff --git a/plugins/scaffolder-react/report-alpha.api.md b/plugins/scaffolder-react/report-alpha.api.md index 2014bff9be..39c8bb987e 100644 --- a/plugins/scaffolder-react/report-alpha.api.md +++ b/plugins/scaffolder-react/report-alpha.api.md @@ -39,6 +39,7 @@ import { TaskStep } from '@backstage/plugin-scaffolder-common'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { TemplateGroupFilter } from '@backstage/plugin-scaffolder-react'; import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; +import { TemplateParameterSchema as TemplateParameterSchema_2 } from '@backstage/plugin-scaffolder-common'; import { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common'; import { TranslationRef } from '@backstage/core-plugin-api/alpha'; import { UiSchema } from '@rjsf/utils'; @@ -486,7 +487,7 @@ export const useFormDataFromQuery: ( // @alpha (undocumented) export const useTemplateParameterSchema: (templateRef: string) => { - manifest?: TemplateParameterSchema; + manifest?: TemplateParameterSchema_2; loading: boolean; error?: Error; }; diff --git a/plugins/scaffolder-react/report.api.md b/plugins/scaffolder-react/report.api.md index d66ec36acb..b5d5b71566 100644 --- a/plugins/scaffolder-react/report.api.md +++ b/plugins/scaffolder-react/report.api.md @@ -3,6 +3,10 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts +/// + +import { Action as Action_2 } from '@backstage/plugin-scaffolder-common'; +import { ActionExample as ActionExample_2 } from '@backstage/plugin-scaffolder-common'; import { ApiHolder } from '@backstage/core-plugin-api'; import { ApiRef } from '@backstage/frontend-plugin-api'; import { ComponentType } from 'react'; @@ -23,9 +27,9 @@ import { IChangeEvent } from '@rjsf/core'; import { IdSchema } from '@rjsf/utils'; import { JsonObject } from '@backstage/types'; import { JSONSchema7 } from 'json-schema'; -import { JsonValue } from '@backstage/types'; -import { JSX as JSX_2 } from 'react/jsx-runtime'; -import { Observable } from '@backstage/types'; +import { ListActionsResponse as ListActionsResponse_2 } from '@backstage/plugin-scaffolder-common'; +import { ListTemplatingExtensionsResponse as ListTemplatingExtensionsResponse_2 } from '@backstage/plugin-scaffolder-common'; +import { LogEvent as LogEvent_2 } from '@backstage/plugin-scaffolder-common'; import { PropsWithChildren } from 'react'; import { ReactNode } from 'react'; import { Ref } from 'react'; @@ -33,30 +37,33 @@ import { Registry } from '@rjsf/utils'; import { RegistryWidgetsType } from '@rjsf/utils'; import { RJSFSchema } from '@rjsf/utils'; import { RJSFValidationError } from '@rjsf/utils'; +import { ScaffolderApi as ScaffolderApi_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderDryRunOptions as ScaffolderDryRunOptions_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderDryRunResponse as ScaffolderDryRunResponse_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderGetIntegrationsListOptions as ScaffolderGetIntegrationsListOptions_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderGetIntegrationsListResponse as ScaffolderGetIntegrationsListResponse_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderOutputLink as ScaffolderOutputLink_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderOutputText as ScaffolderOutputText_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderScaffoldOptions as ScaffolderScaffoldOptions_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderScaffoldResponse as ScaffolderScaffoldResponse_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderStreamLogsOptions as ScaffolderStreamLogsOptions_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderTask as ScaffolderTask_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderTaskOutput as ScaffolderTaskOutput_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderTaskStatus as ScaffolderTaskStatus_2 } from '@backstage/plugin-scaffolder-common'; import { StrictRJSFSchema } from '@rjsf/utils'; -import { TaskSpec } from '@backstage/plugin-scaffolder-common'; -import { TaskStep } from '@backstage/plugin-scaffolder-common'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; -import { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common'; +import { TemplateParameterSchema as TemplateParameterSchema_2 } from '@backstage/plugin-scaffolder-common'; import { TemplatesType } from '@rjsf/utils'; import { UIOptionsType } from '@rjsf/utils'; import { UiSchema } from '@rjsf/utils'; import { ValidatorType } from '@rjsf/utils'; import { z } from 'zod'; -// @public -export type Action = { - id: string; - description?: string; - schema?: { - input?: JSONSchema7; - output?: JSONSchema7; - }; - examples?: ActionExample[]; -}; +// @public @deprecated +export type Action = Action_2; // @public @deprecated -export type ActionExample = ScaffolderUsageExample; +export type ActionExample = ActionExample_2; // @public export function createScaffolderFieldExtension< @@ -162,30 +169,14 @@ export type LayoutTemplate = NonNullable< FormProps_2['uiSchema'] >['ui:ObjectFieldTemplate']; -// @public -export type ListActionsResponse = Array; +// @public @deprecated +export type ListActionsResponse = ListActionsResponse_2; -// @public -export type ListTemplatingExtensionsResponse = { - filters: Record; - globals: { - functions: Record; - values: Record; - }; -}; +// @public @deprecated +export type ListTemplatingExtensionsResponse = ListTemplatingExtensionsResponse_2; -// @public -export type LogEvent = { - type: 'log' | 'completion' | 'cancelled' | 'recovered'; - body: { - message: string; - stepId?: string; - status?: ScaffolderTaskStatus; - }; - createdAt: string; - id: string; - taskId: string; -}; +// @public @deprecated +export type LogEvent = LogEvent_2; // @public (undocumented) export function makeFieldSchema< @@ -210,125 +201,39 @@ export type ReviewStepProps = { }[]; }; -// @public -export interface ScaffolderApi { - // (undocumented) - autocomplete?(options: { - token: string; - provider: string; - resource: string; - context?: Record; - }): Promise<{ - results: { - title?: string; - id: string; - }[]; - }>; - cancelTask(taskId: string): Promise; - // (undocumented) - dryRun?(options: ScaffolderDryRunOptions): Promise; - // (undocumented) - getIntegrationsList( - options: ScaffolderGetIntegrationsListOptions, - ): Promise; - // (undocumented) - getTask(taskId: string): Promise; - // (undocumented) - getTemplateParameterSchema( - templateRef: string, - ): Promise; - listActions(): Promise; - // (undocumented) - listTasks?(options: { - filterByOwnership: 'owned' | 'all'; - limit?: number; - offset?: number; - }): Promise<{ - tasks: ScaffolderTask[]; - totalTasks?: number; - }>; - listTemplatingExtensions?(): Promise; - retry?(taskId: string): Promise; - scaffold( - options: ScaffolderScaffoldOptions, - ): Promise; - // (undocumented) - streamLogs(options: ScaffolderStreamLogsOptions): Observable; -} +// @public @deprecated +export type ScaffolderApi = ScaffolderApi_2; // @public (undocumented) -export const scaffolderApiRef: ApiRef; +export const scaffolderApiRef: ApiRef; -// @public (undocumented) -export interface ScaffolderDryRunOptions { - // (undocumented) - directoryContents: { - path: string; - base64Content: string; - }[]; - // (undocumented) - secrets?: Record; - // (undocumented) - template: JsonValue; - // (undocumented) - values: JsonObject; -} +// @public @deprecated (undocumented) +export type ScaffolderDryRunOptions = ScaffolderDryRunOptions_2; -// @public (undocumented) -export interface ScaffolderDryRunResponse { - // (undocumented) - directoryContents: Array<{ - path: string; - base64Content: string; - executable: boolean; - }>; - // (undocumented) - log: Array>; - // (undocumented) - output: ScaffolderTaskOutput; - // (undocumented) - steps: TaskStep[]; -} +// @public @deprecated (undocumented) +export type ScaffolderDryRunResponse = ScaffolderDryRunResponse_2; // @public export const ScaffolderFieldExtensions: React.ComponentType< React.PropsWithChildren<{}> >; -// @public -export interface ScaffolderGetIntegrationsListOptions { - // (undocumented) - allowedHosts: string[]; -} +// @public @deprecated +export type ScaffolderGetIntegrationsListOptions = + ScaffolderGetIntegrationsListOptions_2; -// @public -export interface ScaffolderGetIntegrationsListResponse { - // (undocumented) - integrations: { - type: string; - title: string; - host: string; - }[]; -} +// @public @deprecated +export type ScaffolderGetIntegrationsListResponse = + ScaffolderGetIntegrationsListResponse_2; // @public export const ScaffolderLayouts: ComponentType>; -// @public (undocumented) -export type ScaffolderOutputLink = { - title?: string; - icon?: string; - url?: string; - entityRef?: string; -}; +// @public @deprecated (undocumented) +export type ScaffolderOutputLink = ScaffolderOutputLink_2; -// @public (undocumented) -export type ScaffolderOutputText = { - title?: string; - icon?: string; - content?: string; - default?: boolean; -}; +// @public @deprecated (undocumented) +export type ScaffolderOutputText = ScaffolderOutputText_2; // @public export type ScaffolderRJSFField< @@ -437,21 +342,11 @@ export type ScaffolderRJSFRegistryFieldsType< [name: string]: ScaffolderRJSFField; }; -// @public -export interface ScaffolderScaffoldOptions { - // (undocumented) - secrets?: Record; - // (undocumented) - templateRef: string; - // (undocumented) - values: Record; -} +// @public @deprecated +export type ScaffolderScaffoldOptions = ScaffolderScaffoldOptions_2; -// @public -export interface ScaffolderScaffoldResponse { - // (undocumented) - taskId: string; -} +// @public @deprecated +export type ScaffolderScaffoldResponse = ScaffolderScaffoldResponse_2; // @public export type ScaffolderStep = { @@ -461,41 +356,17 @@ export type ScaffolderStep = { startedAt?: string; }; -// @public -export interface ScaffolderStreamLogsOptions { - // (undocumented) - after?: number; - // (undocumented) - isTaskRecoverable?: boolean; - // (undocumented) - taskId: string; -} +// @public @deprecated +export type ScaffolderStreamLogsOptions = ScaffolderStreamLogsOptions_2; -// @public -export type ScaffolderTask = { - id: string; - spec: TaskSpec; - status: 'failed' | 'completed' | 'processing' | 'open' | 'cancelled'; - lastHeartbeatAt: string; - createdAt: string; -}; +// @public @deprecated +export type ScaffolderTask = ScaffolderTask_2; -// @public (undocumented) -export type ScaffolderTaskOutput = { - links?: ScaffolderOutputLink[]; - text?: ScaffolderOutputText[]; -} & { - [key: string]: unknown; -}; +// @public @deprecated (undocumented) +export type ScaffolderTaskOutput = ScaffolderTaskOutput_2; -// @public -export type ScaffolderTaskStatus = - | 'cancelled' - | 'completed' - | 'failed' - | 'open' - | 'processing' - | 'skipped'; +// @public @deprecated +export type ScaffolderTaskStatus = ScaffolderTaskStatus_2; // @public export type ScaffolderUsageExample = { @@ -568,21 +439,8 @@ export type TemplateGroupFilter = { filter: (entity: TemplateEntityV1beta3) => boolean; }; -// @public -export type TemplateParameterSchema = { - title: string; - description?: string; - presentation?: TemplatePresentationV1beta3; - steps: Array<{ - title: string; - description?: string; - schema: JsonObject; - }>; - EXPERIMENTAL_formDecorators?: { - id: string; - input?: JsonObject; - }[]; -}; +// @public @deprecated +export type TemplateParameterSchema = TemplateParameterSchema_2; // @public export const useCustomFieldExtensions: < diff --git a/plugins/scaffolder/report.api.md b/plugins/scaffolder/report.api.md index b44889cded..53337c2408 100644 --- a/plugins/scaffolder/report.api.md +++ b/plugins/scaffolder/report.api.md @@ -11,47 +11,43 @@ import { createScaffolderFieldExtension as createScaffolderFieldExtension_2 } fr import { createScaffolderLayout as createScaffolderLayout_2 } from '@backstage/plugin-scaffolder-react'; import { CustomFieldExtensionSchema as CustomFieldExtensionSchema_2 } from '@backstage/plugin-scaffolder-react'; import { CustomFieldValidator as CustomFieldValidator_2 } from '@backstage/plugin-scaffolder-react'; -import { DiscoveryApi } from '@backstage/core-plugin-api'; import { ExternalRouteRef } from '@backstage/core-plugin-api'; -import { FetchApi } from '@backstage/core-plugin-api'; import { FieldExtensionComponent as FieldExtensionComponent_2 } from '@backstage/plugin-scaffolder-react'; import { FieldExtensionComponentProps as FieldExtensionComponentProps_2 } from '@backstage/plugin-scaffolder-react'; import { FieldExtensionOptions as FieldExtensionOptions_2 } from '@backstage/plugin-scaffolder-react'; import { FieldSchema as FieldSchema_2 } from '@backstage/plugin-scaffolder-react'; import { FieldValidation } from '@rjsf/utils'; import { FormProps } from '@backstage/plugin-scaffolder-react'; -import { IdentityApi } from '@backstage/core-plugin-api'; -import { JSX as JSX_2 } from 'react/jsx-runtime'; +import { JSX as JSX_2 } from 'react'; import { LayoutOptions as LayoutOptions_2 } from '@backstage/plugin-scaffolder-react'; import { LayoutTemplate as LayoutTemplate_2 } from '@backstage/plugin-scaffolder-react'; -import { ListActionsResponse as ListActionsResponse_2 } from '@backstage/plugin-scaffolder-react'; -import { ListTemplatingExtensionsResponse } from '@backstage/plugin-scaffolder-react'; -import { LogEvent as LogEvent_2 } from '@backstage/plugin-scaffolder-react'; -import { Observable } from '@backstage/types'; +import { ListActionsResponse as ListActionsResponse_2 } from '@backstage/plugin-scaffolder-common'; +import { LogEvent as LogEvent_2 } from '@backstage/plugin-scaffolder-common'; import { PathParams } from '@backstage/core-plugin-api'; import { PropsWithChildren } from 'react'; import { ReactNode } from 'react'; import { ReviewStepProps } from '@backstage/plugin-scaffolder-react'; import { RouteRef } from '@backstage/core-plugin-api'; -import { ScaffolderApi as ScaffolderApi_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderDryRunOptions as ScaffolderDryRunOptions_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderDryRunResponse as ScaffolderDryRunResponse_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderGetIntegrationsListOptions as ScaffolderGetIntegrationsListOptions_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderGetIntegrationsListResponse as ScaffolderGetIntegrationsListResponse_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderOutputLink } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderScaffoldOptions as ScaffolderScaffoldOptions_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderScaffoldResponse as ScaffolderScaffoldResponse_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderStreamLogsOptions as ScaffolderStreamLogsOptions_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderTask as ScaffolderTask_2 } from '@backstage/plugin-scaffolder-react'; +import { ScaffolderApi as ScaffolderApi_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderClient as ScaffolderClient_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderDryRunOptions as ScaffolderDryRunOptions_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderDryRunResponse as ScaffolderDryRunResponse_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderGetIntegrationsListOptions as ScaffolderGetIntegrationsListOptions_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderGetIntegrationsListResponse as ScaffolderGetIntegrationsListResponse_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderOutputLink } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderScaffoldOptions as ScaffolderScaffoldOptions_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderScaffoldResponse as ScaffolderScaffoldResponse_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderStreamLogsOptions as ScaffolderStreamLogsOptions_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderTask as ScaffolderTask_2 } from '@backstage/plugin-scaffolder-common'; import { ScaffolderTaskOutput as ScaffolderTaskOutput_2 } from '@backstage/plugin-scaffolder-react'; -import { ScaffolderTaskStatus as ScaffolderTaskStatus_2 } from '@backstage/plugin-scaffolder-react'; +import { ScaffolderTaskOutput as ScaffolderTaskOutput_3 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderTaskStatus as ScaffolderTaskStatus_2 } from '@backstage/plugin-scaffolder-common'; import { ScaffolderUseTemplateSecrets as ScaffolderUseTemplateSecrets_2 } from '@backstage/plugin-scaffolder-react'; -import { ScmIntegrationRegistry } from '@backstage/integration'; import { SubRouteRef } from '@backstage/core-plugin-api'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { TemplateGroupFilter } from '@backstage/plugin-scaffolder-react'; import { TemplateListPageProps } from '@backstage/plugin-scaffolder/alpha'; -import { TemplateParameterSchema as TemplateParameterSchema_2 } from '@backstage/plugin-scaffolder-react'; +import { TemplateParameterSchema as TemplateParameterSchema_2 } from '@backstage/plugin-scaffolder-common'; import { TemplateWizardPageProps } from '@backstage/plugin-scaffolder/alpha'; import { z } from 'zod'; @@ -505,70 +501,8 @@ export type ScaffolderApi = ScaffolderApi_2; // @public @deprecated (undocumented) export const scaffolderApiRef: ApiRef; -// @public -export class ScaffolderClient implements ScaffolderApi_2 { - constructor(options: { - discoveryApi: DiscoveryApi; - fetchApi: FetchApi; - identityApi?: IdentityApi; - scmIntegrationsApi: ScmIntegrationRegistry; - useLongPollingLogs?: boolean; - }); - // (undocumented) - autocomplete({ - token, - resource, - provider, - context, - }: { - token: string; - provider: string; - resource: string; - context?: Record; - }): Promise<{ - results: { - title?: string; - id: string; - }[]; - }>; - // (undocumented) - cancelTask(taskId: string): Promise; - // (undocumented) - dryRun( - options: ScaffolderDryRunOptions_2, - ): Promise; - // (undocumented) - getIntegrationsList( - options: ScaffolderGetIntegrationsListOptions_2, - ): Promise; - // (undocumented) - getTask(taskId: string): Promise; - // (undocumented) - getTemplateParameterSchema( - templateRef: string, - ): Promise; - // (undocumented) - listActions(): Promise; - // (undocumented) - listTasks(options: { - filterByOwnership: 'owned' | 'all'; - limit?: number; - offset?: number; - }): Promise<{ - tasks: ScaffolderTask_2[]; - totalTasks?: number; - }>; - // (undocumented) - listTemplatingExtensions(): Promise; - // (undocumented) - retry?(taskId: string): Promise; - // (undocumented) - scaffold( - options: ScaffolderScaffoldOptions_2, - ): Promise; - // (undocumented) - streamLogs(options: ScaffolderStreamLogsOptions_2): Observable; -} +// @public @deprecated +export class ScaffolderClient extends ScaffolderClient_2 {} // @public @deprecated (undocumented) export type ScaffolderDryRunOptions = ScaffolderDryRunOptions_2; @@ -644,7 +578,7 @@ export type ScaffolderStreamLogsOptions = ScaffolderStreamLogsOptions_2; export type ScaffolderTask = ScaffolderTask_2; // @public @deprecated (undocumented) -export type ScaffolderTaskOutput = ScaffolderTaskOutput_2; +export type ScaffolderTaskOutput = ScaffolderTaskOutput_3; // @public @deprecated (undocumented) export type ScaffolderTaskStatus = ScaffolderTaskStatus_2; From ac5613f6354e39203ca2e73daa1f1499b51da68c Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 31 Dec 2024 05:46:28 +0000 Subject: [PATCH 23/44] Fix OpenAPI spec linting Signed-off-by: solimant --- .../src/schema/openapi.yaml | 423 +++++++++--------- .../openapi/generated/models/Entity.model.ts | 45 -- .../generated/models/EntityLink.model.ts | 42 -- .../generated/models/EntityMeta.model.ts | 69 --- .../generated/models/EntityRelation.model.ts | 34 -- .../models/TaskRecoverStrategy.model.ts | 32 -- .../generated/models/TaskStep.model.ts | 46 -- .../generated/models/TaskStepEach.model.ts | 26 -- .../generated/models/TemplateInfo.model.ts | 36 -- .../models/TemplateInfoEntity.model.ts | 28 -- .../schema/openapi/generated/models/index.ts | 9 - .../src/schema/openapi/generated/router.ts | 220 +-------- .../openapi/generated/models/Entity.model.ts | 45 -- .../generated/models/EntityLink.model.ts | 42 -- .../generated/models/EntityMeta.model.ts | 69 --- .../generated/models/EntityRelation.model.ts | 34 -- .../models/TaskRecoverStrategy.model.ts | 32 -- .../generated/models/TaskStep.model.ts | 46 -- .../generated/models/TaskStepEach.model.ts | 26 -- .../generated/models/TemplateInfo.model.ts | 36 -- .../models/TemplateInfoEntity.model.ts | 28 -- .../schema/openapi/generated/models/index.ts | 9 - .../src/ScaffolderClient.test.ts | 27 +- 23 files changed, 226 insertions(+), 1178 deletions(-) delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/Entity.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityLink.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityMeta.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityRelation.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStep.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStepEach.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfo.model.ts delete mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/Entity.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityLink.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityMeta.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityRelation.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStep.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStepEach.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfo.model.ts delete mode 100644 plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 21d344b5bc..36187adb5d 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -28,6 +28,7 @@ components: in: query description: Offset event ID to stream events after. required: false + allowReserved: true schema: type: integer kind: @@ -112,7 +113,7 @@ components: type: string description: type: string - examples: + '''examples''': type: array items: $ref: '#/components/schemas/ActionExample' @@ -170,139 +171,139 @@ components: - log - directoryContents - output - EntityLink: - type: object - properties: - type: - type: string - description: An optional value to categorize links into specific groups - icon: - type: string - description: An optional semantic key that represents a visual icon. - title: - type: string - description: An optional descriptive title for the link. - url: - type: string - description: The url to the external site, document, etc. - required: - - url - description: A link to external information that is related to the entity. - additionalProperties: false - EntityMeta: - type: object - properties: - links: - type: array - items: - $ref: '#/components/schemas/EntityLink' - description: A list of external hyperlinks related to the entity. - tags: - type: array - items: - type: string - description: |- - A list of single-valued strings, to for example classify catalog entities in - various ways. - annotations: - $ref: '#/components/schemas/MapStringString' - labels: - $ref: '#/components/schemas/MapStringString' - description: - type: string - description: |- - A short (typically relatively few words, on one line) description of the - entity. - title: - type: string - description: |- - A display name of the entity, to be presented in user interfaces instead - of the `name` property above, when available. - This field is sometimes useful when the `name` is cumbersome or ends up - being perceived as overly technical. The title generally does not have - as stringent format requirements on it, so it may contain special - characters and be more explanatory. Do keep it very short though, and - avoid situations where a title can be confused with the name of another - entity, or where two entities share a title. - Note that this is only for display purposes, and may be ignored by some - parts of the code. Entity references still always make use of the `name` - property, not the title. - namespace: - type: string - description: The namespace that the entity belongs to. - name: - type: string - description: |- - The name of the entity. - Must be unique within the catalog at any given point in time, for any - given namespace + kind pair. This value is part of the technical - identifier of the entity, and as such it will appear in URLs, database - tables, entity references, and similar. It is subject to restrictions - regarding what characters are allowed. - If you want to use a different, more human readable string with fewer - restrictions on it in user interfaces, see the `title` field below. - etag: - type: string - description: |- - An opaque string that changes for each update operation to any part of - the entity, including metadata. - This field can not be set by the user at creation time, and the server - will reject an attempt to do so. The field will be populated in read - operations. The field can (optionally) be specified when performing - update or delete operations, and the server will then reject the - operation if it does not match the current stored value. - uid: - type: string - description: |- - A globally unique ID for the entity. - This field can not be set by the user at creation time, and the server - will reject an attempt to do so. The field will be populated in read - operations. The field can (optionally) be specified when performing - update or delete operations, but the server is free to reject requests - that do so in such a way that it breaks semantics. - required: - - name - description: Metadata fields common to all versions/kinds of entity. - additionalProperties: {} - EntityRelation: - type: object - properties: - targetRef: - type: string - description: The entity ref of the target of this relation. - type: - type: string - description: The type of the relation. - required: - - targetRef - - type - description: A relation of a specific type to another entity in the catalog. - additionalProperties: false - Entity: - type: object - properties: - relations: - type: array - items: - $ref: '#/components/schemas/EntityRelation' - description: The relations that this entity has with other entities. - spec: - $ref: '#/components/schemas/JsonObject' - metadata: - $ref: '#/components/schemas/EntityMeta' - kind: - type: string - description: The high level entity type being described. - apiVersion: - type: string - description: |- - The version of specification format for this particular entity that - this is written against. - required: - - metadata - - kind - - apiVersion - description: The parts of the format that's common to all versions/kinds of entity. + # EntityLink: + # type: object + # properties: + # type: + # type: string + # description: An optional value to categorize links into specific groups + # icon: + # type: string + # description: An optional semantic key that represents a visual icon. + # title: + # type: string + # description: An optional descriptive title for the link. + # url: + # type: string + # description: The url to the external site, document, etc. + # required: + # - url + # description: A link to external information that is related to the entity. + # additionalProperties: false + # EntityMeta: + # type: object + # properties: + # links: + # type: array + # items: + # $ref: '#/components/schemas/EntityLink' + # description: A list of external hyperlinks related to the entity. + # tags: + # type: array + # items: + # type: string + # description: |- + # A list of single-valued strings, to for example classify catalog entities in + # various ways. + # annotations: + # $ref: '#/components/schemas/MapStringString' + # labels: + # $ref: '#/components/schemas/MapStringString' + # description: + # type: string + # description: |- + # A short (typically relatively few words, on one line) description of the + # entity. + # title: + # type: string + # description: |- + # A display name of the entity, to be presented in user interfaces instead + # of the `name` property above, when available. + # This field is sometimes useful when the `name` is cumbersome or ends up + # being perceived as overly technical. The title generally does not have + # as stringent format requirements on it, so it may contain special + # characters and be more explanatory. Do keep it very short though, and + # avoid situations where a title can be confused with the name of another + # entity, or where two entities share a title. + # Note that this is only for display purposes, and may be ignored by some + # parts of the code. Entity references still always make use of the `name` + # property, not the title. + # namespace: + # type: string + # description: The namespace that the entity belongs to. + # name: + # type: string + # description: |- + # The name of the entity. + # Must be unique within the catalog at any given point in time, for any + # given namespace + kind pair. This value is part of the technical + # identifier of the entity, and as such it will appear in URLs, database + # tables, entity references, and similar. It is subject to restrictions + # regarding what characters are allowed. + # If you want to use a different, more human readable string with fewer + # restrictions on it in user interfaces, see the `title` field below. + # etag: + # type: string + # description: |- + # An opaque string that changes for each update operation to any part of + # the entity, including metadata. + # This field can not be set by the user at creation time, and the server + # will reject an attempt to do so. The field will be populated in read + # operations. The field can (optionally) be specified when performing + # update or delete operations, and the server will then reject the + # operation if it does not match the current stored value. + # uid: + # type: string + # description: |- + # A globally unique ID for the entity. + # This field can not be set by the user at creation time, and the server + # will reject an attempt to do so. The field will be populated in read + # operations. The field can (optionally) be specified when performing + # update or delete operations, but the server is free to reject requests + # that do so in such a way that it breaks semantics. + # required: + # - name + # description: Metadata fields common to all versions/kinds of entity. + # additionalProperties: {} + # EntityRelation: + # type: object + # properties: + # targetRef: + # type: string + # description: The entity ref of the target of this relation. + # type: + # type: string + # description: The type of the relation. + # required: + # - targetRef + # - type + # description: A relation of a specific type to another entity in the catalog. + # additionalProperties: false + # Entity: + # type: object + # properties: + # relations: + # type: array + # items: + # $ref: '#/components/schemas/EntityRelation' + # description: The relations that this entity has with other entities. + # spec: + # $ref: '#/components/schemas/JsonObject' + # metadata: + # $ref: '#/components/schemas/EntityMeta' + # kind: + # type: string + # description: The high level entity type being described. + # apiVersion: + # type: string + # description: |- + # The version of specification format for this particular entity that + # this is written against. + # required: + # - metadata + # - kind + # - apiVersion + # description: The parts of the format that's common to all versions/kinds of entity. Error: type: object properties: @@ -382,12 +383,12 @@ components: required: - tasks description: The response shape for the `listTasks` call to the `scaffolder-backend` - MapStringString: - type: object - properties: {} - additionalProperties: - type: string - description: Construct a type with a set of properties K of type T + # MapStringString: + # type: object + # properties: {} + # additionalProperties: + # type: string + # description: Construct a type with a set of properties K of type T ScaffolderScaffoldOptions: type: object properties: @@ -606,24 +607,24 @@ components: - completion - log - recovered - TaskRecovery: - type: object - # properties: - # EXPERIMENTAL_strategy: - # $ref: '#/components/schemas/TaskRecoverStrategy' - description: |- - When task didn't have a chance to complete due to system restart you can define the strategy what to do with such tasks, - by defining a strategy. + # TaskRecovery: + # type: object + # # properties: + # # EXPERIMENTAL_strategy: + # # $ref: '#/components/schemas/TaskRecoverStrategy' + # description: |- + # When task didn't have a chance to complete due to system restart you can define the strategy what to do with such tasks, + # by defining a strategy. - By default, it is none, what means to not recover but updating the status from 'processing' to 'failed'. - TaskRecoverStrategy: - type: string - description: | - - none: not recover, let the task be marked as failed - - startOver: do recover, start the execution of the task from the first step. - enum: - - none - - startOver + # By default, it is none, what means to not recover but updating the status from 'processing' to 'failed'. + # TaskRecoverStrategy: + # type: string + # description: | + # - none: not recover, let the task be marked as failed + # - startOver: do recover, start the execution of the task from the first step. + # enum: + # - none + # - startOver TaskSecrets: allOf: - type: object @@ -697,37 +698,37 @@ components: - processing - skipped description: The status of each step of the Task - TaskStep: - type: object - properties: - id: - type: string - description: A unique identifier for this step. - name: - type: string - description: A display name to show the user. - action: - type: string - description: The underlying action ID that will be called as part of running this step. - input: - $ref: '#/components/schemas/JsonObject' - description: Additional data that will be passed to the action. - # if: - # oneOf: - # - type: string - # - type: boolean - # description: When this is false, or if the templated value string evaluates to something that is falsy the step will be skipped. - each: - oneOf: - - type: string - - $ref: '#/components/schemas/JsonArray' - description: Run step repeatedly. - required: - - id - - name - - action - description: An individual step of a scaffolder task, as stored in the database. - additionalProperties: {} + # TaskStep: + # type: object + # properties: + # id: + # type: string + # description: A unique identifier for this step. + # name: + # type: string + # description: A display name to show the user. + # action: + # type: string + # description: The underlying action ID that will be called as part of running this step. + # input: + # $ref: '#/components/schemas/JsonObject' + # description: Additional data that will be passed to the action. + # # if: + # # oneOf: + # # - type: string + # # - type: boolean + # # description: When this is false, or if the templated value string evaluates to something that is falsy the step will be skipped. + # each: + # oneOf: + # - type: string + # - $ref: '#/components/schemas/JsonArray' + # description: Run step repeatedly. + # required: + # - id + # - name + # - action + # description: An individual step of a scaffolder task, as stored in the database. + # additionalProperties: {} # TemplateEntityStepV1beta3: # allOf: # - $ref: '#/components/schemas/JsonObject' @@ -825,29 +826,29 @@ components: # description: |- # Backstage catalog Template kind Entity. Templates are used by the Scaffolder # plugin to create new entities, such as Components. - TemplateInfo: - type: object - properties: - entityRef: - type: string - description: The entityRef of the template. - baseUrl: - type: string - description: Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths. - entity: - type: object - properties: - metadata: - $ref: '#/components/schemas/EntityMeta' - description: The metadata of the Template. - required: - - metadata - description: The Template entity. - required: - - entityRef - description: |- - Information about a template that is stored on a task specification. - Includes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition + # TemplateInfo: + # type: object + # properties: + # entityRef: + # type: string + # description: The entityRef of the template. + # baseUrl: + # type: string + # description: Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths. + # entity: + # type: object + # properties: + # metadata: + # $ref: '#/components/schemas/EntityMeta' + # description: The metadata of the Template. + # required: + # - metadata + # description: The Template entity. + # required: + # - entityRef + # description: |- + # Information about a template that is stored on a task specification. + # Includes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition TemplateParameterSchema: type: object properties: diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Entity.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Entity.model.ts deleted file mode 100644 index f386f3dd17..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Entity.model.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { EntityMeta } from '../models/EntityMeta.model'; -import { EntityRelation } from '../models/EntityRelation.model'; - -/** - * The parts of the format that's common to all versions/kinds of entity. - * @public - */ -export interface Entity { - /** - * The relations that this entity has with other entities. - */ - relations?: Array; - /** - * A type representing all allowed JSON object values. - */ - spec?: { [key: string]: any }; - metadata: EntityMeta; - /** - * The high level entity type being described. - */ - kind: string; - /** - * The version of specification format for this particular entity that this is written against. - */ - apiVersion: string; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityLink.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityLink.model.ts deleted file mode 100644 index 53d7d1f9ff..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityLink.model.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * A link to external information that is related to the entity. - * @public - */ -export interface EntityLink { - /** - * An optional value to categorize links into specific groups - */ - type?: string; - /** - * An optional semantic key that represents a visual icon. - */ - icon?: string; - /** - * An optional descriptive title for the link. - */ - title?: string; - /** - * The url to the external site, document, etc. - */ - url: string; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityMeta.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityMeta.model.ts deleted file mode 100644 index cc8dd555a6..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityMeta.model.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { EntityLink } from '../models/EntityLink.model'; - -/** - * Metadata fields common to all versions/kinds of entity. - * @public - */ -export interface EntityMeta { - [key: string]: any; - - /** - * A list of external hyperlinks related to the entity. - */ - links?: Array; - /** - * A list of single-valued strings, to for example classify catalog entities in various ways. - */ - tags?: Array; - /** - * Construct a type with a set of properties K of type T - */ - annotations?: { [key: string]: string }; - /** - * Construct a type with a set of properties K of type T - */ - labels?: { [key: string]: string }; - /** - * A short (typically relatively few words, on one line) description of the entity. - */ - description?: string; - /** - * A display name of the entity, to be presented in user interfaces instead of the `name` property above, when available. This field is sometimes useful when the `name` is cumbersome or ends up being perceived as overly technical. The title generally does not have as stringent format requirements on it, so it may contain special characters and be more explanatory. Do keep it very short though, and avoid situations where a title can be confused with the name of another entity, or where two entities share a title. Note that this is only for display purposes, and may be ignored by some parts of the code. Entity references still always make use of the `name` property, not the title. - */ - title?: string; - /** - * The namespace that the entity belongs to. - */ - namespace?: string; - /** - * The name of the entity. Must be unique within the catalog at any given point in time, for any given namespace + kind pair. This value is part of the technical identifier of the entity, and as such it will appear in URLs, database tables, entity references, and similar. It is subject to restrictions regarding what characters are allowed. If you want to use a different, more human readable string with fewer restrictions on it in user interfaces, see the `title` field below. - */ - name: string; - /** - * An opaque string that changes for each update operation to any part of the entity, including metadata. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, and the server will then reject the operation if it does not match the current stored value. - */ - etag?: string; - /** - * A globally unique ID for the entity. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, but the server is free to reject requests that do so in such a way that it breaks semantics. - */ - uid?: string; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityRelation.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityRelation.model.ts deleted file mode 100644 index fe98a84481..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/EntityRelation.model.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * A relation of a specific type to another entity in the catalog. - * @public - */ -export interface EntityRelation { - /** - * The entity ref of the target of this relation. - */ - targetRef: string; - /** - * The type of the relation. - */ - type: string; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts deleted file mode 100644 index e00b2dfa88..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export type TaskRecoverStrategy = 'none' | 'startOver'; - -/** - * @public - */ -export const TaskRecoverStrategy = { - None: 'none' as TaskRecoverStrategy, - StartOver: 'startOver' as TaskRecoverStrategy, -}; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStep.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStep.model.ts deleted file mode 100644 index c36049b9a6..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStep.model.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TaskStepEach } from '../models/TaskStepEach.model'; - -/** - * An individual step of a scaffolder task, as stored in the database. - * @public - */ -export interface TaskStep { - [key: string]: any; - - /** - * A unique identifier for this step. - */ - id: string; - /** - * A display name to show the user. - */ - name: string; - /** - * The underlying action ID that will be called as part of running this step. - */ - action: string; - /** - * A type representing all allowed JSON object values. - */ - input?: { [key: string]: any }; - each?: TaskStepEach; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStepEach.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStepEach.model.ts deleted file mode 100644 index 398a19ee88..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStepEach.model.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { JsonValue } from '../models/JsonValue.model'; - -/** - * Run step repeatedly. - * @public - */ -export type TaskStepEach = Array | string; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfo.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfo.model.ts deleted file mode 100644 index ea5b9da6e9..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfo.model.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplateInfoEntity } from '../models/TemplateInfoEntity.model'; - -/** - * Information about a template that is stored on a task specification. Includes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition - * @public - */ -export interface TemplateInfo { - /** - * The entityRef of the template. - */ - entityRef: string; - /** - * Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths. - */ - baseUrl?: string; - entity?: TemplateInfoEntity; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts deleted file mode 100644 index 993b995512..0000000000 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { EntityMeta } from '../models/EntityMeta.model'; - -/** - * The Template entity. - * @public - */ -export interface TemplateInfoEntity { - metadata: EntityMeta; -} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts index 7f5a2de608..d9a4ff832c 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts @@ -32,10 +32,6 @@ export * from '../models/DryRunResult.model'; export * from '../models/DryRunResultLogInner.model'; export * from '../models/DryRunResultLogInnerBody.model'; export * from '../models/DryRunResultLogInnerBodyAllOf.model'; -export * from '../models/Entity.model'; -export * from '../models/EntityLink.model'; -export * from '../models/EntityMeta.model'; -export * from '../models/EntityRelation.model'; export * from '../models/ErrorError.model'; export * from '../models/ErrorRequest.model'; export * from '../models/ErrorResponse.model'; @@ -51,14 +47,9 @@ export * from '../models/SerializedFile.model'; export * from '../models/SerializedTask.model'; export * from '../models/SerializedTaskEvent.model'; export * from '../models/TaskEventType.model'; -export * from '../models/TaskRecoverStrategy.model'; export * from '../models/TaskSecrets.model'; export * from '../models/TaskSecretsAllOf.model'; export * from '../models/TaskStatus.model'; -export * from '../models/TaskStep.model'; -export * from '../models/TaskStepEach.model'; -export * from '../models/TemplateInfo.model'; -export * from '../models/TemplateInfoEntity.model'; export * from '../models/TemplateParameterSchema.model'; export * from '../models/TemplateParameterSchemaStepsInner.model'; export * from '../models/ValidationError.model'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts index 29c7d9af93..104bfcd29b 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -60,6 +60,7 @@ export const spec = { in: 'query', description: 'Offset event ID to stream events after.', required: false, + allowReserved: true, schema: { type: 'integer', }, @@ -172,7 +173,7 @@ export const spec = { description: { type: 'string', }, - examples: { + "'examples'": { type: 'array', items: { $ref: '#/components/schemas/ActionExample', @@ -253,139 +254,6 @@ export const spec = { }, required: ['log', 'directoryContents', 'output'], }, - EntityLink: { - type: 'object', - properties: { - type: { - type: 'string', - description: - 'An optional value to categorize links into specific groups', - }, - icon: { - type: 'string', - description: - 'An optional semantic key that represents a visual icon.', - }, - title: { - type: 'string', - description: 'An optional descriptive title for the link.', - }, - url: { - type: 'string', - description: 'The url to the external site, document, etc.', - }, - }, - required: ['url'], - description: - 'A link to external information that is related to the entity.', - additionalProperties: false, - }, - EntityMeta: { - type: 'object', - properties: { - links: { - type: 'array', - items: { - $ref: '#/components/schemas/EntityLink', - }, - description: 'A list of external hyperlinks related to the entity.', - }, - tags: { - type: 'array', - items: { - type: 'string', - }, - description: - 'A list of single-valued strings, to for example classify catalog entities in\nvarious ways.', - }, - annotations: { - $ref: '#/components/schemas/MapStringString', - }, - labels: { - $ref: '#/components/schemas/MapStringString', - }, - description: { - type: 'string', - description: - 'A short (typically relatively few words, on one line) description of the\nentity.', - }, - title: { - type: 'string', - description: - 'A display name of the entity, to be presented in user interfaces instead\nof the `name` property above, when available.\nThis field is sometimes useful when the `name` is cumbersome or ends up\nbeing perceived as overly technical. The title generally does not have\nas stringent format requirements on it, so it may contain special\ncharacters and be more explanatory. Do keep it very short though, and\navoid situations where a title can be confused with the name of another\nentity, or where two entities share a title.\nNote that this is only for display purposes, and may be ignored by some\nparts of the code. Entity references still always make use of the `name`\nproperty, not the title.', - }, - namespace: { - type: 'string', - description: 'The namespace that the entity belongs to.', - }, - name: { - type: 'string', - description: - 'The name of the entity.\nMust be unique within the catalog at any given point in time, for any\ngiven namespace + kind pair. This value is part of the technical\nidentifier of the entity, and as such it will appear in URLs, database\ntables, entity references, and similar. It is subject to restrictions\nregarding what characters are allowed.\nIf you want to use a different, more human readable string with fewer\nrestrictions on it in user interfaces, see the `title` field below.', - }, - etag: { - type: 'string', - description: - 'An opaque string that changes for each update operation to any part of\nthe entity, including metadata.\nThis field can not be set by the user at creation time, and the server\nwill reject an attempt to do so. The field will be populated in read\noperations. The field can (optionally) be specified when performing\nupdate or delete operations, and the server will then reject the\noperation if it does not match the current stored value.', - }, - uid: { - type: 'string', - description: - 'A globally unique ID for the entity.\nThis field can not be set by the user at creation time, and the server\nwill reject an attempt to do so. The field will be populated in read\noperations. The field can (optionally) be specified when performing\nupdate or delete operations, but the server is free to reject requests\nthat do so in such a way that it breaks semantics.', - }, - }, - required: ['name'], - description: 'Metadata fields common to all versions/kinds of entity.', - additionalProperties: {}, - }, - EntityRelation: { - type: 'object', - properties: { - targetRef: { - type: 'string', - description: 'The entity ref of the target of this relation.', - }, - type: { - type: 'string', - description: 'The type of the relation.', - }, - }, - required: ['targetRef', 'type'], - description: - 'A relation of a specific type to another entity in the catalog.', - additionalProperties: false, - }, - Entity: { - type: 'object', - properties: { - relations: { - type: 'array', - items: { - $ref: '#/components/schemas/EntityRelation', - }, - description: - 'The relations that this entity has with other entities.', - }, - spec: { - $ref: '#/components/schemas/JsonObject', - }, - metadata: { - $ref: '#/components/schemas/EntityMeta', - }, - kind: { - type: 'string', - description: 'The high level entity type being described.', - }, - apiVersion: { - type: 'string', - description: - 'The version of specification format for this particular entity that\nthis is written against.', - }, - }, - required: ['metadata', 'kind', 'apiVersion'], - description: - "The parts of the format that's common to all versions/kinds of entity.", - }, Error: { type: 'object', properties: { @@ -502,14 +370,6 @@ export const spec = { description: 'The response shape for the `listTasks` call to the `scaffolder-backend`', }, - MapStringString: { - type: 'object', - properties: {}, - additionalProperties: { - type: 'string', - }, - description: 'Construct a type with a set of properties K of type T', - }, ScaffolderScaffoldOptions: { type: 'object', properties: { @@ -629,17 +489,6 @@ export const spec = { description: 'TaskEventType', enum: ['cancelled', 'completion', 'log', 'recovered'], }, - TaskRecovery: { - type: 'object', - description: - "When task didn't have a chance to complete due to system restart you can define the strategy what to do with such tasks,\nby defining a strategy.\n\nBy default, it is none, what means to not recover but updating the status from 'processing' to 'failed'.", - }, - TaskRecoverStrategy: { - type: 'string', - description: - '- 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', - enum: ['none', 'startOver'], - }, TaskSecrets: { allOf: [ { @@ -671,71 +520,6 @@ export const spec = { ], description: 'The status of each step of the Task', }, - TaskStep: { - type: 'object', - properties: { - id: { - type: 'string', - description: 'A unique identifier for this step.', - }, - name: { - type: 'string', - description: 'A display name to show the user.', - }, - action: { - type: 'string', - description: - 'The underlying action ID that will be called as part of running this step.', - }, - input: { - $ref: '#/components/schemas/JsonObject', - description: 'Additional data that will be passed to the action.', - }, - each: { - oneOf: [ - { - type: 'string', - }, - { - $ref: '#/components/schemas/JsonArray', - }, - ], - description: 'Run step repeatedly.', - }, - }, - required: ['id', 'name', 'action'], - description: - 'An individual step of a scaffolder task, as stored in the database.', - additionalProperties: {}, - }, - TemplateInfo: { - type: 'object', - properties: { - entityRef: { - type: 'string', - description: 'The entityRef of the template.', - }, - baseUrl: { - type: 'string', - description: - 'Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths.', - }, - entity: { - type: 'object', - properties: { - metadata: { - $ref: '#/components/schemas/EntityMeta', - description: 'The metadata of the Template.', - }, - }, - required: ['metadata'], - description: 'The Template entity.', - }, - }, - required: ['entityRef'], - description: - 'Information about a template that is stored on a task specification.\nIncludes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition', - }, TemplateParameterSchema: { type: 'object', properties: { diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Entity.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Entity.model.ts deleted file mode 100644 index f386f3dd17..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Entity.model.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { EntityMeta } from '../models/EntityMeta.model'; -import { EntityRelation } from '../models/EntityRelation.model'; - -/** - * The parts of the format that's common to all versions/kinds of entity. - * @public - */ -export interface Entity { - /** - * The relations that this entity has with other entities. - */ - relations?: Array; - /** - * A type representing all allowed JSON object values. - */ - spec?: { [key: string]: any }; - metadata: EntityMeta; - /** - * The high level entity type being described. - */ - kind: string; - /** - * The version of specification format for this particular entity that this is written against. - */ - apiVersion: string; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityLink.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityLink.model.ts deleted file mode 100644 index 53d7d1f9ff..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityLink.model.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * A link to external information that is related to the entity. - * @public - */ -export interface EntityLink { - /** - * An optional value to categorize links into specific groups - */ - type?: string; - /** - * An optional semantic key that represents a visual icon. - */ - icon?: string; - /** - * An optional descriptive title for the link. - */ - title?: string; - /** - * The url to the external site, document, etc. - */ - url: string; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityMeta.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityMeta.model.ts deleted file mode 100644 index cc8dd555a6..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityMeta.model.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { EntityLink } from '../models/EntityLink.model'; - -/** - * Metadata fields common to all versions/kinds of entity. - * @public - */ -export interface EntityMeta { - [key: string]: any; - - /** - * A list of external hyperlinks related to the entity. - */ - links?: Array; - /** - * A list of single-valued strings, to for example classify catalog entities in various ways. - */ - tags?: Array; - /** - * Construct a type with a set of properties K of type T - */ - annotations?: { [key: string]: string }; - /** - * Construct a type with a set of properties K of type T - */ - labels?: { [key: string]: string }; - /** - * A short (typically relatively few words, on one line) description of the entity. - */ - description?: string; - /** - * A display name of the entity, to be presented in user interfaces instead of the `name` property above, when available. This field is sometimes useful when the `name` is cumbersome or ends up being perceived as overly technical. The title generally does not have as stringent format requirements on it, so it may contain special characters and be more explanatory. Do keep it very short though, and avoid situations where a title can be confused with the name of another entity, or where two entities share a title. Note that this is only for display purposes, and may be ignored by some parts of the code. Entity references still always make use of the `name` property, not the title. - */ - title?: string; - /** - * The namespace that the entity belongs to. - */ - namespace?: string; - /** - * The name of the entity. Must be unique within the catalog at any given point in time, for any given namespace + kind pair. This value is part of the technical identifier of the entity, and as such it will appear in URLs, database tables, entity references, and similar. It is subject to restrictions regarding what characters are allowed. If you want to use a different, more human readable string with fewer restrictions on it in user interfaces, see the `title` field below. - */ - name: string; - /** - * An opaque string that changes for each update operation to any part of the entity, including metadata. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, and the server will then reject the operation if it does not match the current stored value. - */ - etag?: string; - /** - * A globally unique ID for the entity. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, but the server is free to reject requests that do so in such a way that it breaks semantics. - */ - uid?: string; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityRelation.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityRelation.model.ts deleted file mode 100644 index fe98a84481..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/EntityRelation.model.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * A relation of a specific type to another entity in the catalog. - * @public - */ -export interface EntityRelation { - /** - * The entity ref of the target of this relation. - */ - targetRef: string; - /** - * The type of the relation. - */ - type: string; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts deleted file mode 100644 index e00b2dfa88..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskRecoverStrategy.model.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export type TaskRecoverStrategy = 'none' | 'startOver'; - -/** - * @public - */ -export const TaskRecoverStrategy = { - None: 'none' as TaskRecoverStrategy, - StartOver: 'startOver' as TaskRecoverStrategy, -}; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStep.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStep.model.ts deleted file mode 100644 index c36049b9a6..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStep.model.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TaskStepEach } from '../models/TaskStepEach.model'; - -/** - * An individual step of a scaffolder task, as stored in the database. - * @public - */ -export interface TaskStep { - [key: string]: any; - - /** - * A unique identifier for this step. - */ - id: string; - /** - * A display name to show the user. - */ - name: string; - /** - * The underlying action ID that will be called as part of running this step. - */ - action: string; - /** - * A type representing all allowed JSON object values. - */ - input?: { [key: string]: any }; - each?: TaskStepEach; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStepEach.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStepEach.model.ts deleted file mode 100644 index 398a19ee88..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStepEach.model.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { JsonValue } from '../models/JsonValue.model'; - -/** - * Run step repeatedly. - * @public - */ -export type TaskStepEach = Array | string; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfo.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfo.model.ts deleted file mode 100644 index ea5b9da6e9..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfo.model.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { TemplateInfoEntity } from '../models/TemplateInfoEntity.model'; - -/** - * Information about a template that is stored on a task specification. Includes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition - * @public - */ -export interface TemplateInfo { - /** - * The entityRef of the template. - */ - entityRef: string; - /** - * Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths. - */ - baseUrl?: string; - entity?: TemplateInfoEntity; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts deleted file mode 100644 index 993b995512..0000000000 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateInfoEntity.model.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { EntityMeta } from '../models/EntityMeta.model'; - -/** - * The Template entity. - * @public - */ -export interface TemplateInfoEntity { - metadata: EntityMeta; -} diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts index 7f5a2de608..d9a4ff832c 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts @@ -32,10 +32,6 @@ export * from '../models/DryRunResult.model'; export * from '../models/DryRunResultLogInner.model'; export * from '../models/DryRunResultLogInnerBody.model'; export * from '../models/DryRunResultLogInnerBodyAllOf.model'; -export * from '../models/Entity.model'; -export * from '../models/EntityLink.model'; -export * from '../models/EntityMeta.model'; -export * from '../models/EntityRelation.model'; export * from '../models/ErrorError.model'; export * from '../models/ErrorRequest.model'; export * from '../models/ErrorResponse.model'; @@ -51,14 +47,9 @@ export * from '../models/SerializedFile.model'; export * from '../models/SerializedTask.model'; export * from '../models/SerializedTaskEvent.model'; export * from '../models/TaskEventType.model'; -export * from '../models/TaskRecoverStrategy.model'; export * from '../models/TaskSecrets.model'; export * from '../models/TaskSecretsAllOf.model'; export * from '../models/TaskStatus.model'; -export * from '../models/TaskStep.model'; -export * from '../models/TaskStepEach.model'; -export * from '../models/TemplateInfo.model'; -export * from '../models/TemplateInfoEntity.model'; export * from '../models/TemplateParameterSchema.model'; export * from '../models/TemplateParameterSchemaStepsInner.model'; export * from '../models/ValidationError.model'; diff --git a/plugins/scaffolder-common/src/ScaffolderClient.test.ts b/plugins/scaffolder-common/src/ScaffolderClient.test.ts index 03064d7086..eff0356bc9 100644 --- a/plugins/scaffolder-common/src/ScaffolderClient.test.ts +++ b/plugins/scaffolder-common/src/ScaffolderClient.test.ts @@ -365,21 +365,18 @@ describe('api', () => { it('should list tasks with limit and offset', async () => { server.use( - rest.get( - `${mockBaseUrl}/v2/tasks?limit=5&offset=0`, - (_req, res, ctx) => { - return res( - ctx.json([ - { - createdBy: null, - }, - { - createdBy: null, - }, - ]), - ); - }, - ), + rest.get(`${mockBaseUrl}/v2/tasks`, (_req, res, ctx) => { + return res( + ctx.json([ + { + createdBy: null, + }, + { + createdBy: null, + }, + ]), + ); + }), ); const result = await apiClient.listTasks({ From 317fa46bd50794b4a73355148dd83762a4f5a6cc Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 31 Dec 2024 07:07:10 +0000 Subject: [PATCH 24/44] Fix prettier Signed-off-by: solimant --- .../scaffolder-backend/src/schema/openapi.yaml | 2 +- plugins/scaffolder-common/package.json | 1 + yarn.lock | 15 ++++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 36187adb5d..d967912abd 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -113,7 +113,7 @@ components: type: string description: type: string - '''examples''': + "'examples'": type: array items: $ref: '#/components/schemas/ActionExample' diff --git a/plugins/scaffolder-common/package.json b/plugins/scaffolder-common/package.json index aa7a86ced6..6baec94850 100644 --- a/plugins/scaffolder-common/package.json +++ b/plugins/scaffolder-common/package.json @@ -73,6 +73,7 @@ "devDependencies": { "@backstage/cli": "workspace:^", "@backstage/test-utils": "workspace:^", + "@types/json-schema": "^7.0.9", "cross-fetch": "^4.0.0", "msw": "^1.0.0", "uri-template": "^2.0.0" diff --git a/yarn.lock b/yarn.lock index 2a8915d85d..db430e65a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7399,13 +7399,14 @@ __metadata: "@backstage/plugin-permission-common": "workspace:^" "@backstage/test-utils": "workspace:^" "@backstage/types": "workspace:^" - "@microsoft/fetch-event-source": "npm:^2.0.1" - cross-fetch: "npm:^4.0.0" - json-schema: "npm:^0.4.0" - msw: "npm:^1.0.0" - qs: "npm:^6.9.4" - uri-template: "npm:^2.0.0" - zen-observable: "npm:^0.10.0" + "@microsoft/fetch-event-source": ^2.0.1 + "@types/json-schema": ^7.0.9 + cross-fetch: ^4.0.0 + json-schema: ^0.4.0 + msw: ^1.0.0 + qs: ^6.9.4 + uri-template: ^2.0.0 + zen-observable: ^0.10.0 languageName: unknown linkType: soft From b7e98127e6b85bce6ca1f2f12b6a70c361eae0e6 Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 31 Dec 2024 19:47:25 +0000 Subject: [PATCH 25/44] Move deps Signed-off-by: solimant --- plugins/scaffolder-common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scaffolder-common/package.json b/plugins/scaffolder-common/package.json index 6baec94850..9383ca12e4 100644 --- a/plugins/scaffolder-common/package.json +++ b/plugins/scaffolder-common/package.json @@ -66,6 +66,7 @@ "@backstage/plugin-permission-common": "workspace:^", "@backstage/types": "workspace:^", "@microsoft/fetch-event-source": "^2.0.1", + "@types/json-schema": "^7.0.9", "json-schema": "^0.4.0", "qs": "^6.9.4", "zen-observable": "^0.10.0" @@ -73,7 +74,6 @@ "devDependencies": { "@backstage/cli": "workspace:^", "@backstage/test-utils": "workspace:^", - "@types/json-schema": "^7.0.9", "cross-fetch": "^4.0.0", "msw": "^1.0.0", "uri-template": "^2.0.0" From 845e8a1283adbcb36487ef3c33acede9c01337b7 Mon Sep 17 00:00:00 2001 From: solimant Date: Thu, 2 Jan 2025 00:26:13 +0000 Subject: [PATCH 26/44] Skip SSE Signed-off-by: solimant --- .../src/schema/openapi.yaml | 28 ++++++------- .../openapi/generated/apis/Api.server.ts | 14 ------- .../src/schema/openapi/generated/router.ts | 26 ------------- .../openapi/generated/apis/Api.client.ts | 39 ------------------- 4 files changed, 14 insertions(+), 93 deletions(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index d967912abd..c6e832f0e0 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -1163,20 +1163,20 @@ paths: parameters: - $ref: '#/components/parameters/taskId' - /v2/tasks/{taskId}/eventstream: - get: - operationId: StreamLogsEventStream - description: Get event stream for a task by ID. - responses: - '200': - description: Ok - content: - text/event-stream: - schema: - type: string - parameters: - - $ref: '#/components/parameters/eventsAfter' - - $ref: '#/components/parameters/taskId' + # /v2/tasks/{taskId}/eventstream: + # get: + # operationId: StreamLogsEventStream + # description: Get event stream for a task by ID. + # responses: + # '200': + # description: Ok + # content: + # text/event-stream: + # schema: + # type: string + # parameters: + # - $ref: '#/components/parameters/eventsAfter' + # - $ref: '#/components/parameters/taskId' /v2/tasks/{taskId}/events: get: diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts index 2e3ea7fa3c..c81638fdf4 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -118,18 +118,6 @@ export type Scaffold = { body: ScaffolderScaffoldOptions; response: Scaffold201Response | Scaffold400Response; }; -/** - * @public - */ -export type StreamLogsEventStream = { - path: { - taskId: string; - }; - query: { - after?: number; - }; - response: string; -}; /** * @public */ @@ -162,7 +150,5 @@ export type EndpointMap = { '#post|/v2/tasks': Scaffold; - '#get|/v2/tasks/{taskId}/eventstream': StreamLogsEventStream; - '#get|/v2/tasks/{taskId}/events': StreamLogsPolling; }; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts index 104bfcd29b..3078fb9c4b 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -907,32 +907,6 @@ export const spec = { ], }, }, - '/v2/tasks/{taskId}/eventstream': { - get: { - operationId: 'StreamLogsEventStream', - description: 'Get event stream for a task by ID.', - responses: { - '200': { - description: 'Ok', - content: { - 'text/event-stream': { - schema: { - type: 'string', - }, - }, - }, - }, - }, - parameters: [ - { - $ref: '#/components/parameters/eventsAfter', - }, - { - $ref: '#/components/parameters/taskId', - }, - ], - }, - }, '/v2/tasks/{taskId}/events': { get: { operationId: 'StreamLogsPolling', diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts index 600ae7bc86..9bb691b922 100644 --- a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts +++ b/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts @@ -126,17 +126,6 @@ export type Retry = { export type Scaffold = { body: ScaffolderScaffoldOptions; }; -/** - * @public - */ -export type StreamLogsEventStream = { - path: { - taskId: string; - }; - query: { - after?: number; - }; -}; /** * @public */ @@ -407,34 +396,6 @@ export class DefaultApiClient { }); } - /** - * Get event stream for a task by ID. - * @param taskId - - * @param after - Offset event ID to stream events after. - */ - public async streamLogsEventStream( - // @ts-ignore - request: StreamLogsEventStream, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/v2/tasks/{taskId}/eventstream{?after}`; - - const uri = parser.parse(uriTemplate).expand({ - taskId: request.path.taskId, - ...request.query, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } - /** * Get events for a task by ID. * @param taskId - From c475f8c4a0dd3e1472eeec068242f07c8ac07b22 Mon Sep 17 00:00:00 2001 From: solimant Date: Thu, 2 Jan 2025 07:28:05 +0000 Subject: [PATCH 27/44] Revert limit and offset test change Signed-off-by: solimant --- .../src/ScaffolderClient.test.ts | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/plugins/scaffolder-common/src/ScaffolderClient.test.ts b/plugins/scaffolder-common/src/ScaffolderClient.test.ts index eff0356bc9..03064d7086 100644 --- a/plugins/scaffolder-common/src/ScaffolderClient.test.ts +++ b/plugins/scaffolder-common/src/ScaffolderClient.test.ts @@ -365,18 +365,21 @@ describe('api', () => { it('should list tasks with limit and offset', async () => { server.use( - rest.get(`${mockBaseUrl}/v2/tasks`, (_req, res, ctx) => { - return res( - ctx.json([ - { - createdBy: null, - }, - { - createdBy: null, - }, - ]), - ); - }), + rest.get( + `${mockBaseUrl}/v2/tasks?limit=5&offset=0`, + (_req, res, ctx) => { + return res( + ctx.json([ + { + createdBy: null, + }, + { + createdBy: null, + }, + ]), + ); + }, + ), ); const result = await apiClient.listTasks({ From 58d1c084fa6c09effa795080a8bc97df283c974d Mon Sep 17 00:00:00 2001 From: solimant Date: Thu, 2 Jan 2025 07:41:28 +0000 Subject: [PATCH 28/44] Revert ResponseBodyParser changes Signed-off-by: solimant --- .../src/schema/response-body-validation.ts | 49 ++++--------------- 1 file changed, 9 insertions(+), 40 deletions(-) diff --git a/packages/backend-openapi-utils/src/schema/response-body-validation.ts b/packages/backend-openapi-utils/src/schema/response-body-validation.ts index 79f659f0d2..71a4512e75 100644 --- a/packages/backend-openapi-utils/src/schema/response-body-validation.ts +++ b/packages/backend-openapi-utils/src/schema/response-body-validation.ts @@ -69,19 +69,16 @@ export class ResponseBodyParser const jsonContentType = Object.keys(contentTypes).find(contentType => contentType.split(';').includes('application/json'), ); - const eventStreamContentType = Object.keys(contentTypes).find( - contentType => contentType.split(';').includes('text/event-stream'), - ); - if (jsonContentType && '$ref' in contentTypes[jsonContentType].schema) { + if (!jsonContentType) { + throw new OperationError( + this.operation, + `No application/json content type found in response for status code ${statusCode}`, + ); + } else if ('$ref' in contentTypes[jsonContentType].schema) { throw new OperationError( this.operation, 'Reference objects are not supported', ); - } else if (!jsonContentType && !eventStreamContentType) { - throw new OperationError( - this.operation, - `No valid content type found in response for status code ${statusCode}`, - ); } } } @@ -116,20 +113,14 @@ export class ResponseBodyParser const jsonContentType = Object.keys(contentTypes ?? {}).find(contentType => contentType.split(';').includes('application/json'), ); - const eventStreamContentType = Object.keys(contentTypes ?? {}).find( - contentType => contentType.split(';').includes('text/event-stream'), - ); - if (!jsonContentType && !eventStreamContentType) { + if (!jsonContentType) { throw new OperationResponseError( this.operation, response, - 'No valid content type found in response', + 'No application/json content type found in response', ); } - const schema = - (jsonContentType && responseSchema.content![jsonContentType].schema) || - (eventStreamContentType && - responseSchema.content![eventStreamContentType].schema); + const schema = responseSchema.content![jsonContentType].schema; // This is a bit of type laziness. Ideally, this would be a type-narrowing function, but I wasn't able to get the types to work. if (!schema) { throw new OperationError(this.operation, 'No schema found in response'); @@ -154,28 +145,6 @@ export class ResponseBodyParser } const validate = this.ajv.compile(schema); - - if (eventStreamContentType) { - const eventStreamBody = await response.text(); - - const jsonMatches = [...eventStreamBody.matchAll(/data:\s*(\{.*?\})/g)]; - const jsonObjects = jsonMatches.map(match => { - return match[1] as any as JsonObject; - }); - - const invalid = jsonObjects.some(jsonObject => !validate(jsonObject)); - if (invalid) { - throw new OperationParsingResponseError( - this.operation, - response, - 'Response body', - validate.errors!, - ); - } - - return undefined; - } - const jsonBody = (await response.json()) as JsonObject; const valid = validate(jsonBody); if (!valid) { From 3c03a0a4bd891d509cb7fc67f48d309c634c6ed6 Mon Sep 17 00:00:00 2001 From: solimant Date: Thu, 2 Jan 2025 08:17:29 +0000 Subject: [PATCH 29/44] Ignore type for SSE route Signed-off-by: solimant --- plugins/scaffolder-backend/src/service/router.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/scaffolder-backend/src/service/router.ts b/plugins/scaffolder-backend/src/service/router.ts index 263401f3af..ce8e6f072b 100644 --- a/plugins/scaffolder-backend/src/service/router.ts +++ b/plugins/scaffolder-backend/src/service/router.ts @@ -748,6 +748,7 @@ export async function createRouter( throw err; } }) + // @ts-ignore - Skipping SSE for now .get('/v2/tasks/:taskId/eventstream', async (req, res) => { const { taskId } = req.params; @@ -773,6 +774,7 @@ export async function createRouter( }); const after = + // @ts-ignore req.query.after !== undefined ? Number(req.query.after) : undefined; logger.debug(`Event stream observing taskId '${taskId}' opened`); From e8e0f8e276ff7b92e37225008657c7cd411cfdf1 Mon Sep 17 00:00:00 2001 From: solimant Date: Mon, 6 Jan 2025 04:53:17 +0000 Subject: [PATCH 30/44] Relocate client Signed-off-by: solimant --- plugins/scaffolder-common/.eslintrc.js | 2 +- plugins/scaffolder-common/package.json | 6 +++--- plugins/scaffolder-common/src/ScaffolderClient.ts | 6 +----- plugins/scaffolder-common/src/api.ts | 2 +- .../src/schema/openapi/generated/apis/Api.client.ts | 0 .../{client => }/src/schema/openapi/generated/apis/index.ts | 0 .../{client => }/src/schema/openapi/generated/index.ts | 0 .../src/schema/openapi/generated/models/Action.model.ts | 0 .../schema/openapi/generated/models/ActionExample.model.ts | 0 .../schema/openapi/generated/models/ActionSchema.model.ts | 0 .../generated/models/Autocomplete200Response.model.ts | 0 .../models/Autocomplete200ResponseResultsInner.model.ts | 0 .../generated/models/Autocomplete400Response.model.ts | 0 .../openapi/generated/models/AutocompleteRequest.model.ts | 0 .../openapi/generated/models/CancelTask200Response.model.ts | 0 .../openapi/generated/models/DryRun200Response.model.ts | 0 .../generated/models/DryRun200ResponseAllOf.model.ts | 0 .../DryRun200ResponseAllOfDirectoryContentsInner.model.ts | 0 .../models/DryRun200ResponseAllOfStepsInner.model.ts | 0 .../schema/openapi/generated/models/DryRunRequest.model.ts | 0 .../models/DryRunRequestDirectoryContentsInner.model.ts | 0 .../schema/openapi/generated/models/DryRunResult.model.ts | 0 .../openapi/generated/models/DryRunResultLogInner.model.ts | 0 .../generated/models/DryRunResultLogInnerBody.model.ts | 0 .../generated/models/DryRunResultLogInnerBodyAllOf.model.ts | 0 .../src/schema/openapi/generated/models/ErrorError.model.ts | 0 .../schema/openapi/generated/models/ErrorRequest.model.ts | 0 .../schema/openapi/generated/models/ErrorResponse.model.ts | 0 .../schema/openapi/generated/models/JsonPrimitive.model.ts | 0 .../src/schema/openapi/generated/models/JsonValue.model.ts | 0 .../openapi/generated/models/ListTasksResponse.model.ts | 0 .../src/schema/openapi/generated/models/ModelError.model.ts | 0 .../schema/openapi/generated/models/RetryRequest.model.ts | 0 .../openapi/generated/models/Scaffold201Response.model.ts | 0 .../openapi/generated/models/Scaffold400Response.model.ts | 0 .../generated/models/ScaffolderScaffoldOptions.model.ts | 0 .../schema/openapi/generated/models/SerializedFile.model.ts | 0 .../schema/openapi/generated/models/SerializedTask.model.ts | 0 .../openapi/generated/models/SerializedTaskEvent.model.ts | 0 .../schema/openapi/generated/models/TaskEventType.model.ts | 0 .../schema/openapi/generated/models/TaskSecrets.model.ts | 0 .../openapi/generated/models/TaskSecretsAllOf.model.ts | 0 .../src/schema/openapi/generated/models/TaskStatus.model.ts | 0 .../generated/models/TemplateParameterSchema.model.ts | 0 .../models/TemplateParameterSchemaStepsInner.model.ts | 0 .../openapi/generated/models/ValidationError.model.ts | 0 .../generated/models/ValidationErrorArgument.model.ts | 0 .../generated/models/ValidationErrorPathInner.model.ts | 0 .../src/schema/openapi/generated/models/index.ts | 0 .../{client => }/src/schema/openapi/generated/pluginId.ts | 0 .../src/schema/openapi/generated/types/discovery.ts | 0 .../src/schema/openapi/generated/types/fetch.ts | 0 .../{client => }/src/schema/openapi/index.ts | 0 53 files changed, 6 insertions(+), 10 deletions(-) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/apis/Api.client.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/apis/index.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/index.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/Action.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ActionExample.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ActionSchema.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/Autocomplete200Response.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/Autocomplete400Response.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/AutocompleteRequest.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/CancelTask200Response.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRun200Response.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRunRequest.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRunResult.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ErrorError.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ErrorRequest.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ErrorResponse.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/JsonPrimitive.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/JsonValue.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ListTasksResponse.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ModelError.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/RetryRequest.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/Scaffold201Response.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/Scaffold400Response.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/SerializedFile.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/SerializedTask.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/TaskEventType.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/TaskSecrets.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/TaskStatus.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ValidationError.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/models/index.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/pluginId.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/types/discovery.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/generated/types/fetch.ts (100%) rename plugins/scaffolder-common/{client => }/src/schema/openapi/index.ts (100%) diff --git a/plugins/scaffolder-common/.eslintrc.js b/plugins/scaffolder-common/.eslintrc.js index a9d85200c7..c8ec42e57a 100644 --- a/plugins/scaffolder-common/.eslintrc.js +++ b/plugins/scaffolder-common/.eslintrc.js @@ -1,7 +1,7 @@ module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, { overrides: [ { - files: ['client/src/schema/openapi/generated/models/*.model.ts'], + files: ['src/schema/openapi/generated/models/*.model.ts'], rules: { '@typescript-eslint/no-redeclare': 'off', }, diff --git a/plugins/scaffolder-common/package.json b/plugins/scaffolder-common/package.json index 9383ca12e4..c580f1d502 100644 --- a/plugins/scaffolder-common/package.json +++ b/plugins/scaffolder-common/package.json @@ -67,15 +67,15 @@ "@backstage/types": "workspace:^", "@microsoft/fetch-event-source": "^2.0.1", "@types/json-schema": "^7.0.9", + "cross-fetch": "^4.0.0", "json-schema": "^0.4.0", "qs": "^6.9.4", + "uri-template": "^2.0.0", "zen-observable": "^0.10.0" }, "devDependencies": { "@backstage/cli": "workspace:^", "@backstage/test-utils": "workspace:^", - "cross-fetch": "^4.0.0", - "msw": "^1.0.0", - "uri-template": "^2.0.0" + "msw": "^1.0.0" } } diff --git a/plugins/scaffolder-common/src/ScaffolderClient.ts b/plugins/scaffolder-common/src/ScaffolderClient.ts index 0e03480283..aececc0e4b 100644 --- a/plugins/scaffolder-common/src/ScaffolderClient.ts +++ b/plugins/scaffolder-common/src/ScaffolderClient.ts @@ -40,11 +40,7 @@ import { ScaffolderStreamLogsOptions, ScaffolderTask, } from './api'; -import { - DefaultApiClient, - TaskStatus, - TypedResponse, -} from '../client/src/schema/openapi'; +import { DefaultApiClient, TaskStatus, TypedResponse } from './schema/openapi'; /** * An API to interact with the scaffolder backend. diff --git a/plugins/scaffolder-common/src/api.ts b/plugins/scaffolder-common/src/api.ts index a62729cad5..52ae010870 100644 --- a/plugins/scaffolder-common/src/api.ts +++ b/plugins/scaffolder-common/src/api.ts @@ -23,7 +23,7 @@ import type { import type { TaskEventType, TaskStatus as ScaffolderTaskStatus, -} from '../client/src/schema/openapi'; +} from './schema/openapi'; export type { ScaffolderTaskStatus, TaskEventType }; diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts b/plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/apis/Api.client.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/apis/index.ts b/plugins/scaffolder-common/src/schema/openapi/generated/apis/index.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/apis/index.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/apis/index.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/index.ts b/plugins/scaffolder-common/src/schema/openapi/generated/index.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/index.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/index.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Action.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Action.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/Action.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/Action.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionExample.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionExample.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionExample.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ActionExample.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionSchema.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionSchema.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ActionSchema.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ActionSchema.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200Response.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200Response.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200Response.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete400Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete400Response.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/Autocomplete400Response.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete400Response.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/AutocompleteRequest.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/AutocompleteRequest.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/AutocompleteRequest.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/AutocompleteRequest.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/CancelTask200Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/CancelTask200Response.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/CancelTask200Response.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/CancelTask200Response.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200Response.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200Response.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200Response.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequest.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequest.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequest.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResult.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResult.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResult.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResult.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorError.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorError.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorError.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorError.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorRequest.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorRequest.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorRequest.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorRequest.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorResponse.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorResponse.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ErrorResponse.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorResponse.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonPrimitive.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonPrimitive.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonPrimitive.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/JsonPrimitive.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonValue.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonValue.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/JsonValue.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/JsonValue.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTasksResponse.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ListTasksResponse.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ListTasksResponse.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ModelError.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ModelError.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ModelError.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ModelError.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/RetryRequest.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/RetryRequest.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/RetryRequest.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/RetryRequest.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold201Response.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold201Response.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold201Response.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold400Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold400Response.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/Scaffold400Response.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold400Response.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedFile.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedFile.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedFile.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedFile.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTask.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTask.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTask.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskEventType.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecrets.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecrets.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecrets.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/TaskStatus.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationError.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationError.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationError.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/models/index.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/pluginId.ts b/plugins/scaffolder-common/src/schema/openapi/generated/pluginId.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/pluginId.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/pluginId.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/types/discovery.ts b/plugins/scaffolder-common/src/schema/openapi/generated/types/discovery.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/types/discovery.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/types/discovery.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/generated/types/fetch.ts b/plugins/scaffolder-common/src/schema/openapi/generated/types/fetch.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/generated/types/fetch.ts rename to plugins/scaffolder-common/src/schema/openapi/generated/types/fetch.ts diff --git a/plugins/scaffolder-common/client/src/schema/openapi/index.ts b/plugins/scaffolder-common/src/schema/openapi/index.ts similarity index 100% rename from plugins/scaffolder-common/client/src/schema/openapi/index.ts rename to plugins/scaffolder-common/src/schema/openapi/index.ts From 8d7854321be3be82c76a2888846ec0aac17105fb Mon Sep 17 00:00:00 2001 From: solimant Date: Mon, 6 Jan 2025 05:16:40 +0000 Subject: [PATCH 31/44] Refactor type for SSE route Signed-off-by: solimant --- plugins/scaffolder-backend/src/service/router.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/scaffolder-backend/src/service/router.ts b/plugins/scaffolder-backend/src/service/router.ts index ce8e6f072b..e8b9f04797 100644 --- a/plugins/scaffolder-backend/src/service/router.ts +++ b/plugins/scaffolder-backend/src/service/router.ts @@ -747,9 +747,10 @@ export async function createRouter( await auditorEvent?.fail({ error: err }); throw err; } - }) - // @ts-ignore - Skipping SSE for now - .get('/v2/tasks/:taskId/eventstream', async (req, res) => { + }); + (router as express.Router).get( + '/v2/tasks/:taskId/eventstream', + async (req, res) => { const { taskId } = req.params; const auditorEvent = await auditor?.createEvent({ @@ -774,7 +775,6 @@ export async function createRouter( }); const after = - // @ts-ignore req.query.after !== undefined ? Number(req.query.after) : undefined; logger.debug(`Event stream observing taskId '${taskId}' opened`); @@ -825,7 +825,9 @@ export async function createRouter( await auditorEvent?.fail({ error: err }); throw err; } - }) + }, + ); + router .get('/v2/tasks/:taskId/events', async (req, res) => { const { taskId } = req.params; From c08cbc4622640922728ab06f8133a649cf7d542b Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 28 Jan 2025 23:20:03 +0000 Subject: [PATCH 32/44] Add changeset Signed-off-by: solimant --- .changeset/clean-chairs-sit.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changeset/clean-chairs-sit.md diff --git a/.changeset/clean-chairs-sit.md b/.changeset/clean-chairs-sit.md new file mode 100644 index 0000000000..9e76e56887 --- /dev/null +++ b/.changeset/clean-chairs-sit.md @@ -0,0 +1,10 @@ +--- +'@backstage/backend-openapi-utils': minor +'@backstage/plugin-scaffolder-backend': minor +'@backstage/plugin-scaffolder-common': minor +'@backstage/plugin-scaffolder-react': minor +'@backstage/plugin-scaffolder-node': minor +'@backstage/plugin-scaffolder': minor +--- + +Move Scaffolder API to OpenAPI From 67caec27bf577d8bd10fb021020101007308af43 Mon Sep 17 00:00:00 2001 From: solimant Date: Sat, 26 Apr 2025 15:30:57 +0000 Subject: [PATCH 33/44] Fix API reports Signed-off-by: solimant --- plugins/scaffolder-common/package.json | 1 - plugins/scaffolder-react/report-alpha.api.md | 3 +-- plugins/scaffolder-react/report.api.md | 2 -- yarn.lock | 15 +++++++-------- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/plugins/scaffolder-common/package.json b/plugins/scaffolder-common/package.json index c580f1d502..90af23777c 100644 --- a/plugins/scaffolder-common/package.json +++ b/plugins/scaffolder-common/package.json @@ -69,7 +69,6 @@ "@types/json-schema": "^7.0.9", "cross-fetch": "^4.0.0", "json-schema": "^0.4.0", - "qs": "^6.9.4", "uri-template": "^2.0.0", "zen-observable": "^0.10.0" }, diff --git a/plugins/scaffolder-react/report-alpha.api.md b/plugins/scaffolder-react/report-alpha.api.md index 39c8bb987e..2014bff9be 100644 --- a/plugins/scaffolder-react/report-alpha.api.md +++ b/plugins/scaffolder-react/report-alpha.api.md @@ -39,7 +39,6 @@ import { TaskStep } from '@backstage/plugin-scaffolder-common'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { TemplateGroupFilter } from '@backstage/plugin-scaffolder-react'; import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; -import { TemplateParameterSchema as TemplateParameterSchema_2 } from '@backstage/plugin-scaffolder-common'; import { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common'; import { TranslationRef } from '@backstage/core-plugin-api/alpha'; import { UiSchema } from '@rjsf/utils'; @@ -487,7 +486,7 @@ export const useFormDataFromQuery: ( // @alpha (undocumented) export const useTemplateParameterSchema: (templateRef: string) => { - manifest?: TemplateParameterSchema_2; + manifest?: TemplateParameterSchema; loading: boolean; error?: Error; }; diff --git a/plugins/scaffolder-react/report.api.md b/plugins/scaffolder-react/report.api.md index b5d5b71566..9d0404bbe5 100644 --- a/plugins/scaffolder-react/report.api.md +++ b/plugins/scaffolder-react/report.api.md @@ -3,8 +3,6 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -/// - import { Action as Action_2 } from '@backstage/plugin-scaffolder-common'; import { ActionExample as ActionExample_2 } from '@backstage/plugin-scaffolder-common'; import { ApiHolder } from '@backstage/core-plugin-api'; diff --git a/yarn.lock b/yarn.lock index db430e65a7..6c3ac1594d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7399,14 +7399,13 @@ __metadata: "@backstage/plugin-permission-common": "workspace:^" "@backstage/test-utils": "workspace:^" "@backstage/types": "workspace:^" - "@microsoft/fetch-event-source": ^2.0.1 - "@types/json-schema": ^7.0.9 - cross-fetch: ^4.0.0 - json-schema: ^0.4.0 - msw: ^1.0.0 - qs: ^6.9.4 - uri-template: ^2.0.0 - zen-observable: ^0.10.0 + "@microsoft/fetch-event-source": "npm:^2.0.1" + "@types/json-schema": "npm:^7.0.9" + cross-fetch: "npm:^4.0.0" + json-schema: "npm:^0.4.0" + msw: "npm:^1.0.0" + uri-template: "npm:^2.0.0" + zen-observable: "npm:^0.10.0" languageName: unknown linkType: soft From 563ff4da0bd0c18e17162ab98d05014aab0d044b Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 29 Apr 2025 17:25:43 +0000 Subject: [PATCH 34/44] Add ListTemplatingExtensions Signed-off-by: solimant --- .../src/schema/openapi.yaml | 105 ++++++++++++ .../openapi/generated/apis/Api.server.ts | 9 ++ .../ListTemplatingExtensionsResponse.model.ts | 30 ++++ ...mplatingExtensionsResponseGlobals.model.ts | 29 ++++ .../models/ScaffolderUsageExample.model.ts | 29 ++++ .../generated/models/TemplateFilter.model.ts | 31 ++++ .../models/TemplateFilterSchema.model.ts | 34 ++++ .../models/TemplateGlobalFunction.model.ts | 31 ++++ .../TemplateGlobalFunctionSchema.model.ts | 30 ++++ .../models/TemplateGlobalValue.model.ts | 28 ++++ .../schema/openapi/generated/models/index.ts | 8 + .../src/schema/openapi/generated/router.ts | 152 ++++++++++++++++++ plugins/scaffolder-common/report.api.md | 58 ++++++- .../scaffolder-common/src/ScaffolderClient.ts | 16 +- .../openapi/generated/apis/Api.client.ts | 28 ++++ .../ListTemplatingExtensionsResponse.model.ts | 30 ++++ ...mplatingExtensionsResponseGlobals.model.ts | 29 ++++ .../models/ScaffolderUsageExample.model.ts | 29 ++++ .../generated/models/TemplateFilter.model.ts | 31 ++++ .../models/TemplateFilterSchema.model.ts | 34 ++++ .../models/TemplateGlobalFunction.model.ts | 31 ++++ .../TemplateGlobalFunctionSchema.model.ts | 30 ++++ .../models/TemplateGlobalValue.model.ts | 28 ++++ .../schema/openapi/generated/models/index.ts | 8 + plugins/scaffolder-react/report.api.md | 49 ++---- plugins/scaffolder/report.api.md | 2 +- 26 files changed, 870 insertions(+), 49 deletions(-) create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTemplatingExtensionsResponse.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTemplatingExtensionsResponseGlobals.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderUsageExample.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateFilter.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateFilterSchema.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalFunction.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalFunctionSchema.model.ts create mode 100644 plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalValue.model.ts create mode 100644 plugins/scaffolder-common/src/schema/openapi/generated/models/ListTemplatingExtensionsResponse.model.ts create mode 100644 plugins/scaffolder-common/src/schema/openapi/generated/models/ListTemplatingExtensionsResponseGlobals.model.ts create mode 100644 plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderUsageExample.model.ts create mode 100644 plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateFilter.model.ts create mode 100644 plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateFilterSchema.model.ts create mode 100644 plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalFunction.model.ts create mode 100644 plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalFunctionSchema.model.ts create mode 100644 plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalValue.model.ts diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index c6e832f0e0..b7f94d1fed 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -383,6 +383,31 @@ components: required: - tasks description: The response shape for the `listTasks` call to the `scaffolder-backend` + ListTemplatingExtensionsResponse: + type: object + properties: + filters: + type: object + additionalProperties: + $ref: '#/components/schemas/TemplateFilter' + globals: + type: object + properties: + functions: + type: object + additionalProperties: + $ref: '#/components/schemas/TemplateGlobalFunction' + values: + type: object + additionalProperties: + $ref: '#/components/schemas/TemplateGlobalValue' + required: + - functions + - values + required: + - filters + - globals + description: The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend` # MapStringString: # type: object # properties: {} @@ -405,6 +430,18 @@ components: - templateRef - values description: The input options to the `scaffold` method of the `ScaffolderClient`. + ScaffolderUsageExample: + type: object + properties: + description: + type: string + example: + type: string + notes: + type: string + required: + - example + description: A single scaffolder usage example # Schema: # type: object # properties: @@ -826,6 +863,58 @@ components: # description: |- # Backstage catalog Template kind Entity. Templates are used by the Scaffolder # plugin to create new entities, such as Components. + TemplateGlobalFunction: + type: object + properties: + description: + type: string + schema: + type: object + properties: + arguments: + type: array + items: + $ref: '#/components/schemas/JsonObject' + output: + $ref: '#/components/schemas/JsonObject' + "'examples'": + type: array + items: + $ref: '#/components/schemas/ScaffolderUsageExample' + description: The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend` + TemplateGlobalValue: + type: object + properties: + description: + type: string + value: + type: object + nullable: true + # $ref: '#/components/schemas/JsonValue' + required: + - value + description: The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend` + TemplateFilter: + type: object + properties: + description: + type: string + schema: + type: object + properties: + input: + $ref: '#/components/schemas/JsonObject' + arguments: + type: array + items: + $ref: '#/components/schemas/JsonObject' + output: + $ref: '#/components/schemas/JsonObject' + "'examples'": + type: array + items: + $ref: '#/components/schemas/ScaffolderUsageExample' + description: The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend` # TemplateInfo: # type: object # properties: @@ -1351,3 +1440,19 @@ paths: allowReserved: true schema: type: string + + /v2/templating-extensions: + get: + operationId: ListTemplatingExtensions + description: Returns a structure describing the available templating extensions. + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/ListTemplatingExtensionsResponse' + security: + - {} + - JWT: [] + parameters: [] diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts index c81638fdf4..febb63606f 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -27,6 +27,7 @@ import { CancelTask200Response } from '../models/CancelTask200Response.model'; import { DryRun200Response } from '../models/DryRun200Response.model'; import { DryRunRequest } from '../models/DryRunRequest.model'; import { ListTasksResponse } from '../models/ListTasksResponse.model'; +import { ListTemplatingExtensionsResponse } from '../models/ListTemplatingExtensionsResponse.model'; import { RetryRequest } from '../models/RetryRequest.model'; import { Scaffold201Response } from '../models/Scaffold201Response.model'; import { Scaffold400Response } from '../models/Scaffold400Response.model'; @@ -101,6 +102,12 @@ export type ListTasks = { }; response: ListTasksResponse; }; +/** + * @public + */ +export type ListTemplatingExtensions = { + response: ListTemplatingExtensionsResponse; +}; /** * @public */ @@ -146,6 +153,8 @@ export type EndpointMap = { '#get|/v2/tasks': ListTasks; + '#get|/v2/templating-extensions': ListTemplatingExtensions; + '#post|/v2/tasks/{taskId}/retry': Retry; '#post|/v2/tasks': Scaffold; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTemplatingExtensionsResponse.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTemplatingExtensionsResponse.model.ts new file mode 100644 index 0000000000..74b7cd3780 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTemplatingExtensionsResponse.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ListTemplatingExtensionsResponseGlobals } from '../models/ListTemplatingExtensionsResponseGlobals.model'; +import { TemplateFilter } from '../models/TemplateFilter.model'; + +/** + * The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend` + * @public + */ +export interface ListTemplatingExtensionsResponse { + filters: { [key: string]: TemplateFilter }; + globals: ListTemplatingExtensionsResponseGlobals; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTemplatingExtensionsResponseGlobals.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTemplatingExtensionsResponseGlobals.model.ts new file mode 100644 index 0000000000..1f022a0675 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTemplatingExtensionsResponseGlobals.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateGlobalFunction } from '../models/TemplateGlobalFunction.model'; +import { TemplateGlobalValue } from '../models/TemplateGlobalValue.model'; + +/** + * @public + */ +export interface ListTemplatingExtensionsResponseGlobals { + functions: { [key: string]: TemplateGlobalFunction }; + values: { [key: string]: TemplateGlobalValue }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderUsageExample.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderUsageExample.model.ts new file mode 100644 index 0000000000..3e0f4ef866 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderUsageExample.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A single scaffolder usage example + * @public + */ +export interface ScaffolderUsageExample { + description?: string; + example: string; + notes?: string; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateFilter.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateFilter.model.ts new file mode 100644 index 0000000000..7c631978e6 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateFilter.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ScaffolderUsageExample } from '../models/ScaffolderUsageExample.model'; +import { TemplateFilterSchema } from '../models/TemplateFilterSchema.model'; + +/** + * The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend` + * @public + */ +export interface TemplateFilter { + description?: string; + schema?: TemplateFilterSchema; + examples?: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateFilterSchema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateFilterSchema.model.ts new file mode 100644 index 0000000000..5a95a58ead --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateFilterSchema.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface TemplateFilterSchema { + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; + arguments?: Array<{ [key: string]: any }>; + /** + * A type representing all allowed JSON object values. + */ + output?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalFunction.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalFunction.model.ts new file mode 100644 index 0000000000..ee19ce723b --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalFunction.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ScaffolderUsageExample } from '../models/ScaffolderUsageExample.model'; +import { TemplateGlobalFunctionSchema } from '../models/TemplateGlobalFunctionSchema.model'; + +/** + * The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend` + * @public + */ +export interface TemplateGlobalFunction { + description?: string; + schema?: TemplateGlobalFunctionSchema; + examples?: Array; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalFunctionSchema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalFunctionSchema.model.ts new file mode 100644 index 0000000000..b3a39c3b24 --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalFunctionSchema.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface TemplateGlobalFunctionSchema { + arguments?: Array<{ [key: string]: any }>; + /** + * A type representing all allowed JSON object values. + */ + output?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalValue.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalValue.model.ts new file mode 100644 index 0000000000..95d177a05a --- /dev/null +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateGlobalValue.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend` + * @public + */ +export interface TemplateGlobalValue { + description?: string; + value: any | null; +} diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts index d9a4ff832c..17f7907003 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts @@ -38,11 +38,14 @@ export * from '../models/ErrorResponse.model'; export * from '../models/JsonPrimitive.model'; export * from '../models/JsonValue.model'; export * from '../models/ListTasksResponse.model'; +export * from '../models/ListTemplatingExtensionsResponse.model'; +export * from '../models/ListTemplatingExtensionsResponseGlobals.model'; export * from '../models/ModelError.model'; export * from '../models/RetryRequest.model'; export * from '../models/Scaffold201Response.model'; export * from '../models/Scaffold400Response.model'; export * from '../models/ScaffolderScaffoldOptions.model'; +export * from '../models/ScaffolderUsageExample.model'; export * from '../models/SerializedFile.model'; export * from '../models/SerializedTask.model'; export * from '../models/SerializedTaskEvent.model'; @@ -50,6 +53,11 @@ export * from '../models/TaskEventType.model'; export * from '../models/TaskSecrets.model'; export * from '../models/TaskSecretsAllOf.model'; export * from '../models/TaskStatus.model'; +export * from '../models/TemplateFilter.model'; +export * from '../models/TemplateFilterSchema.model'; +export * from '../models/TemplateGlobalFunction.model'; +export * from '../models/TemplateGlobalFunctionSchema.model'; +export * from '../models/TemplateGlobalValue.model'; export * from '../models/TemplateParameterSchema.model'; export * from '../models/TemplateParameterSchemaStepsInner.model'; export * from '../models/ValidationError.model'; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts index 3078fb9c4b..78802491b1 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -370,6 +370,38 @@ export const spec = { description: 'The response shape for the `listTasks` call to the `scaffolder-backend`', }, + ListTemplatingExtensionsResponse: { + type: 'object', + properties: { + filters: { + type: 'object', + additionalProperties: { + $ref: '#/components/schemas/TemplateFilter', + }, + }, + globals: { + type: 'object', + properties: { + functions: { + type: 'object', + additionalProperties: { + $ref: '#/components/schemas/TemplateGlobalFunction', + }, + }, + values: { + type: 'object', + additionalProperties: { + $ref: '#/components/schemas/TemplateGlobalValue', + }, + }, + }, + required: ['functions', 'values'], + }, + }, + required: ['filters', 'globals'], + description: + 'The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend`', + }, ScaffolderScaffoldOptions: { type: 'object', properties: { @@ -391,6 +423,22 @@ export const spec = { description: 'The input options to the `scaffold` method of the `ScaffolderClient`.', }, + ScaffolderUsageExample: { + type: 'object', + properties: { + description: { + type: 'string', + }, + example: { + type: 'string', + }, + notes: { + type: 'string', + }, + }, + required: ['example'], + description: 'A single scaffolder usage example', + }, SerializedFile: { type: 'object', properties: { @@ -520,6 +568,84 @@ export const spec = { ], description: 'The status of each step of the Task', }, + TemplateGlobalFunction: { + type: 'object', + properties: { + description: { + type: 'string', + }, + schema: { + type: 'object', + properties: { + arguments: { + type: 'array', + items: { + $ref: '#/components/schemas/JsonObject', + }, + }, + output: { + $ref: '#/components/schemas/JsonObject', + }, + }, + }, + "'examples'": { + type: 'array', + items: { + $ref: '#/components/schemas/ScaffolderUsageExample', + }, + }, + }, + description: + 'The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend`', + }, + TemplateGlobalValue: { + type: 'object', + properties: { + description: { + type: 'string', + }, + value: { + type: 'object', + nullable: true, + }, + }, + required: ['value'], + description: + 'The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend`', + }, + TemplateFilter: { + type: 'object', + properties: { + description: { + type: 'string', + }, + schema: { + type: 'object', + properties: { + input: { + $ref: '#/components/schemas/JsonObject', + }, + arguments: { + type: 'array', + items: { + $ref: '#/components/schemas/JsonObject', + }, + }, + output: { + $ref: '#/components/schemas/JsonObject', + }, + }, + }, + "'examples'": { + type: 'array', + items: { + $ref: '#/components/schemas/ScaffolderUsageExample', + }, + }, + }, + description: + 'The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend`', + }, TemplateParameterSchema: { type: 'object', properties: { @@ -1157,6 +1283,32 @@ export const spec = { ], }, }, + '/v2/templating-extensions': { + get: { + operationId: 'ListTemplatingExtensions', + description: + 'Returns a structure describing the available templating extensions.', + responses: { + '200': { + description: 'Ok', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/ListTemplatingExtensionsResponse', + }, + }, + }, + }, + }, + security: [ + {}, + { + JWT: [], + }, + ], + parameters: [], + }, + }, }, } as const; export const createOpenApiRouter = async ( diff --git a/plugins/scaffolder-common/report.api.md b/plugins/scaffolder-common/report.api.md index d2a5e83672..1496496450 100644 --- a/plugins/scaffolder-common/report.api.md +++ b/plugins/scaffolder-common/report.api.md @@ -25,13 +25,8 @@ export type Action = { examples?: ActionExample[]; }; -// @public -export interface ActionExample { - // (undocumented) - description: string; - // (undocumented) - example: string; -} +// @public @deprecated +export type ActionExample = ScaffolderUsageExample; // @public export const isTemplateEntityV1beta3: ( @@ -41,6 +36,15 @@ export const isTemplateEntityV1beta3: ( // @public export type ListActionsResponse = Array; +// @public +export type ListTemplatingExtensionsResponse = { + filters: Record; + globals: { + functions: Record; + values: Record; + }; +}; + // @public export type LogEvent = { type: TaskEventType; @@ -109,6 +113,9 @@ export interface ScaffolderApi { tasks: ScaffolderTask[]; totalTasks?: number; }>; + listTemplatingExtensions?( + options?: ScaffolderRequestOptions, + ): Promise; retry?( { secrets, @@ -205,6 +212,9 @@ export class ScaffolderClient implements ScaffolderApi { tasks: ScaffolderTask[]; totalTasks?: number; }>; + listTemplatingExtensions( + options?: ScaffolderRequestOptions, + ): Promise; retry?( { secrets, @@ -359,6 +369,13 @@ export const ScaffolderTaskStatus: { Skipped: ScaffolderTaskStatus; }; +// @public +export type ScaffolderUsageExample = { + description?: string; + example: string; + notes?: string; +}; + // @public (undocumented) export type TaskEventType = 'cancelled' | 'completion' | 'log' | 'recovered'; @@ -448,6 +465,33 @@ export interface TemplateEntityV1beta3 extends Entity { // @public export const templateEntityV1beta3Validator: KindValidator; +// @public +export type TemplateFilter = { + description?: string; + schema?: { + input?: JSONSchema7; + arguments?: JSONSchema7[]; + output?: JSONSchema7; + }; + examples?: ScaffolderUsageExample[]; +}; + +// @public +export type TemplateGlobalFunction = { + description?: string; + schema?: { + arguments?: JSONSchema7[]; + output?: JSONSchema7; + }; + examples?: ScaffolderUsageExample[]; +}; + +// @public +export type TemplateGlobalValue = { + description?: string; + value: JsonValue; +}; + // @public export type TemplateInfo = { entityRef: string; diff --git a/plugins/scaffolder-common/src/ScaffolderClient.ts b/plugins/scaffolder-common/src/ScaffolderClient.ts index aececc0e4b..43bcdb8ce5 100644 --- a/plugins/scaffolder-common/src/ScaffolderClient.ts +++ b/plugins/scaffolder-common/src/ScaffolderClient.ts @@ -355,15 +355,15 @@ export class ScaffolderClient implements ScaffolderApi { ); } - async listTemplatingExtensions(): Promise { - const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); - const response = await this.fetchApi.fetch( - `${baseUrl}/v2/templating-extensions`, + /** + * {@inheritdoc ScaffolderApi.listTemplatingExtensions} + */ + async listTemplatingExtensions( + options?: ScaffolderRequestOptions, + ): Promise { + return await this.requestRequired( + await this.apiClient.listTemplatingExtensions(null as any, options), ); - if (!response.ok) { - throw ResponseError.fromResponse(response); - } - return response.json(); } /** diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts b/plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts index 9bb691b922..0151013378 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts @@ -29,6 +29,7 @@ import { CancelTask200Response } from '../models/CancelTask200Response.model'; import { DryRun200Response } from '../models/DryRun200Response.model'; import { DryRunRequest } from '../models/DryRunRequest.model'; import { ListTasksResponse } from '../models/ListTasksResponse.model'; +import { ListTemplatingExtensionsResponse } from '../models/ListTemplatingExtensionsResponse.model'; import { RetryRequest } from '../models/RetryRequest.model'; import { Scaffold201Response } from '../models/Scaffold201Response.model'; import { ScaffolderScaffoldOptions } from '../models/ScaffolderScaffoldOptions.model'; @@ -111,6 +112,10 @@ export type ListTasks = { status?: Array; }; }; +/** + * @public + */ +export type ListTemplatingExtensions = {}; /** * @public */ @@ -343,6 +348,29 @@ export class DefaultApiClient { }); } + /** + * Returns a structure describing the available templating extensions. + */ + public async listTemplatingExtensions( + // @ts-ignore + request: ListTemplatingExtensions, + options?: RequestOptions, + ): Promise> { + const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); + + const uriTemplate = `/v2/templating-extensions`; + + const uri = parser.parse(uriTemplate).expand({}); + + return await this.fetchApi.fetch(`${baseUrl}${uri}`, { + headers: { + 'Content-Type': 'application/json', + ...(options?.token && { Authorization: `Bearer ${options?.token}` }), + }, + method: 'GET', + }); + } + /** * Starts the task again from the point where it failed. * @param taskId - diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTemplatingExtensionsResponse.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTemplatingExtensionsResponse.model.ts new file mode 100644 index 0000000000..74b7cd3780 --- /dev/null +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTemplatingExtensionsResponse.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ListTemplatingExtensionsResponseGlobals } from '../models/ListTemplatingExtensionsResponseGlobals.model'; +import { TemplateFilter } from '../models/TemplateFilter.model'; + +/** + * The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend` + * @public + */ +export interface ListTemplatingExtensionsResponse { + filters: { [key: string]: TemplateFilter }; + globals: ListTemplatingExtensionsResponseGlobals; +} diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTemplatingExtensionsResponseGlobals.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTemplatingExtensionsResponseGlobals.model.ts new file mode 100644 index 0000000000..1f022a0675 --- /dev/null +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTemplatingExtensionsResponseGlobals.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { TemplateGlobalFunction } from '../models/TemplateGlobalFunction.model'; +import { TemplateGlobalValue } from '../models/TemplateGlobalValue.model'; + +/** + * @public + */ +export interface ListTemplatingExtensionsResponseGlobals { + functions: { [key: string]: TemplateGlobalFunction }; + values: { [key: string]: TemplateGlobalValue }; +} diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderUsageExample.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderUsageExample.model.ts new file mode 100644 index 0000000000..3e0f4ef866 --- /dev/null +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderUsageExample.model.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * A single scaffolder usage example + * @public + */ +export interface ScaffolderUsageExample { + description?: string; + example: string; + notes?: string; +} diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateFilter.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateFilter.model.ts new file mode 100644 index 0000000000..7c631978e6 --- /dev/null +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateFilter.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ScaffolderUsageExample } from '../models/ScaffolderUsageExample.model'; +import { TemplateFilterSchema } from '../models/TemplateFilterSchema.model'; + +/** + * The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend` + * @public + */ +export interface TemplateFilter { + description?: string; + schema?: TemplateFilterSchema; + examples?: Array; +} diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateFilterSchema.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateFilterSchema.model.ts new file mode 100644 index 0000000000..5a95a58ead --- /dev/null +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateFilterSchema.model.ts @@ -0,0 +1,34 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface TemplateFilterSchema { + /** + * A type representing all allowed JSON object values. + */ + input?: { [key: string]: any }; + arguments?: Array<{ [key: string]: any }>; + /** + * A type representing all allowed JSON object values. + */ + output?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalFunction.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalFunction.model.ts new file mode 100644 index 0000000000..ee19ce723b --- /dev/null +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalFunction.model.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** +import { ScaffolderUsageExample } from '../models/ScaffolderUsageExample.model'; +import { TemplateGlobalFunctionSchema } from '../models/TemplateGlobalFunctionSchema.model'; + +/** + * The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend` + * @public + */ +export interface TemplateGlobalFunction { + description?: string; + schema?: TemplateGlobalFunctionSchema; + examples?: Array; +} diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalFunctionSchema.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalFunctionSchema.model.ts new file mode 100644 index 0000000000..b3a39c3b24 --- /dev/null +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalFunctionSchema.model.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * @public + */ +export interface TemplateGlobalFunctionSchema { + arguments?: Array<{ [key: string]: any }>; + /** + * A type representing all allowed JSON object values. + */ + output?: { [key: string]: any }; +} diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalValue.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalValue.model.ts new file mode 100644 index 0000000000..95d177a05a --- /dev/null +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateGlobalValue.model.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** + +/** + * The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend` + * @public + */ +export interface TemplateGlobalValue { + description?: string; + value: any | null; +} diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts index d9a4ff832c..17f7907003 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts @@ -38,11 +38,14 @@ export * from '../models/ErrorResponse.model'; export * from '../models/JsonPrimitive.model'; export * from '../models/JsonValue.model'; export * from '../models/ListTasksResponse.model'; +export * from '../models/ListTemplatingExtensionsResponse.model'; +export * from '../models/ListTemplatingExtensionsResponseGlobals.model'; export * from '../models/ModelError.model'; export * from '../models/RetryRequest.model'; export * from '../models/Scaffold201Response.model'; export * from '../models/Scaffold400Response.model'; export * from '../models/ScaffolderScaffoldOptions.model'; +export * from '../models/ScaffolderUsageExample.model'; export * from '../models/SerializedFile.model'; export * from '../models/SerializedTask.model'; export * from '../models/SerializedTaskEvent.model'; @@ -50,6 +53,11 @@ export * from '../models/TaskEventType.model'; export * from '../models/TaskSecrets.model'; export * from '../models/TaskSecretsAllOf.model'; export * from '../models/TaskStatus.model'; +export * from '../models/TemplateFilter.model'; +export * from '../models/TemplateFilterSchema.model'; +export * from '../models/TemplateGlobalFunction.model'; +export * from '../models/TemplateGlobalFunctionSchema.model'; +export * from '../models/TemplateGlobalValue.model'; export * from '../models/TemplateParameterSchema.model'; export * from '../models/TemplateParameterSchemaStepsInner.model'; export * from '../models/ValidationError.model'; diff --git a/plugins/scaffolder-react/report.api.md b/plugins/scaffolder-react/report.api.md index 9d0404bbe5..4b81a18eb6 100644 --- a/plugins/scaffolder-react/report.api.md +++ b/plugins/scaffolder-react/report.api.md @@ -4,7 +4,6 @@ ```ts import { Action as Action_2 } from '@backstage/plugin-scaffolder-common'; -import { ActionExample as ActionExample_2 } from '@backstage/plugin-scaffolder-common'; import { ApiHolder } from '@backstage/core-plugin-api'; import { ApiRef } from '@backstage/frontend-plugin-api'; import { ComponentType } from 'react'; @@ -25,6 +24,7 @@ import { IChangeEvent } from '@rjsf/core'; import { IdSchema } from '@rjsf/utils'; import { JsonObject } from '@backstage/types'; import { JSONSchema7 } from 'json-schema'; +import { JSX as JSX_2 } from 'react/jsx-runtime'; import { ListActionsResponse as ListActionsResponse_2 } from '@backstage/plugin-scaffolder-common'; import { ListTemplatingExtensionsResponse as ListTemplatingExtensionsResponse_2 } from '@backstage/plugin-scaffolder-common'; import { LogEvent as LogEvent_2 } from '@backstage/plugin-scaffolder-common'; @@ -48,8 +48,12 @@ import { ScaffolderStreamLogsOptions as ScaffolderStreamLogsOptions_2 } from '@b import { ScaffolderTask as ScaffolderTask_2 } from '@backstage/plugin-scaffolder-common'; import { ScaffolderTaskOutput as ScaffolderTaskOutput_2 } from '@backstage/plugin-scaffolder-common'; import { ScaffolderTaskStatus as ScaffolderTaskStatus_2 } from '@backstage/plugin-scaffolder-common'; +import { ScaffolderUsageExample as ScaffolderUsageExample_2 } from '@backstage/plugin-scaffolder-common'; import { StrictRJSFSchema } from '@rjsf/utils'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; +import { TemplateFilter as TemplateFilter_2 } from '@backstage/plugin-scaffolder-common'; +import { TemplateGlobalFunction as TemplateGlobalFunction_2 } from '@backstage/plugin-scaffolder-common'; +import { TemplateGlobalValue as TemplateGlobalValue_2 } from '@backstage/plugin-scaffolder-common'; import { TemplateParameterSchema as TemplateParameterSchema_2 } from '@backstage/plugin-scaffolder-common'; import { TemplatesType } from '@rjsf/utils'; import { UIOptionsType } from '@rjsf/utils'; @@ -61,7 +65,7 @@ import { z } from 'zod'; export type Action = Action_2; // @public @deprecated -export type ActionExample = ActionExample_2; +export type ActionExample = ScaffolderUsageExample; // @public export function createScaffolderFieldExtension< @@ -171,7 +175,8 @@ export type LayoutTemplate = NonNullable< export type ListActionsResponse = ListActionsResponse_2; // @public @deprecated -export type ListTemplatingExtensionsResponse = ListTemplatingExtensionsResponse_2; +export type ListTemplatingExtensionsResponse = + ListTemplatingExtensionsResponse_2; // @public @deprecated export type LogEvent = LogEvent_2; @@ -366,12 +371,8 @@ export type ScaffolderTaskOutput = ScaffolderTaskOutput_2; // @public @deprecated export type ScaffolderTaskStatus = ScaffolderTaskStatus_2; -// @public -export type ScaffolderUsageExample = { - description?: string; - example: string; - notes?: string; -}; +// @public @deprecated +export type ScaffolderUsageExample = ScaffolderUsageExample_2; // @public export interface ScaffolderUseTemplateSecrets { @@ -404,32 +405,14 @@ export type TaskStream = { output?: ScaffolderTaskOutput; }; -// @public -export type TemplateFilter = { - description?: string; - schema?: { - input?: JSONSchema7; - arguments?: JSONSchema7[]; - output?: JSONSchema7; - }; - examples?: ScaffolderUsageExample[]; -}; +// @public @deprecated +export type TemplateFilter = TemplateFilter_2; -// @public -export type TemplateGlobalFunction = { - description?: string; - schema?: { - arguments?: JSONSchema7[]; - output?: JSONSchema7; - }; - examples?: ScaffolderUsageExample[]; -}; +// @public @deprecated +export type TemplateGlobalFunction = TemplateGlobalFunction_2; -// @public -export type TemplateGlobalValue = { - description?: string; - value: JsonValue; -}; +// @public @deprecated +export type TemplateGlobalValue = TemplateGlobalValue_2; // @public (undocumented) export type TemplateGroupFilter = { diff --git a/plugins/scaffolder/report.api.md b/plugins/scaffolder/report.api.md index 53337c2408..fbb73f6225 100644 --- a/plugins/scaffolder/report.api.md +++ b/plugins/scaffolder/report.api.md @@ -18,7 +18,7 @@ import { FieldExtensionOptions as FieldExtensionOptions_2 } from '@backstage/plu import { FieldSchema as FieldSchema_2 } from '@backstage/plugin-scaffolder-react'; import { FieldValidation } from '@rjsf/utils'; import { FormProps } from '@backstage/plugin-scaffolder-react'; -import { JSX as JSX_2 } from 'react'; +import { JSX as JSX_2 } from 'react/jsx-runtime'; import { LayoutOptions as LayoutOptions_2 } from '@backstage/plugin-scaffolder-react'; import { LayoutTemplate as LayoutTemplate_2 } from '@backstage/plugin-scaffolder-react'; import { ListActionsResponse as ListActionsResponse_2 } from '@backstage/plugin-scaffolder-common'; From d9a0381bef9fdb6d3904921b9453689d80ee495d Mon Sep 17 00:00:00 2001 From: solimant Date: Tue, 10 Jun 2025 06:05:52 +0000 Subject: [PATCH 35/44] Clean up openapi.yaml Signed-off-by: solimant --- .../src/schema/openapi.yaml | 576 ------------------ 1 file changed, 576 deletions(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index b7f94d1fed..18f45a4b35 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -171,139 +171,6 @@ components: - log - directoryContents - output - # EntityLink: - # type: object - # properties: - # type: - # type: string - # description: An optional value to categorize links into specific groups - # icon: - # type: string - # description: An optional semantic key that represents a visual icon. - # title: - # type: string - # description: An optional descriptive title for the link. - # url: - # type: string - # description: The url to the external site, document, etc. - # required: - # - url - # description: A link to external information that is related to the entity. - # additionalProperties: false - # EntityMeta: - # type: object - # properties: - # links: - # type: array - # items: - # $ref: '#/components/schemas/EntityLink' - # description: A list of external hyperlinks related to the entity. - # tags: - # type: array - # items: - # type: string - # description: |- - # A list of single-valued strings, to for example classify catalog entities in - # various ways. - # annotations: - # $ref: '#/components/schemas/MapStringString' - # labels: - # $ref: '#/components/schemas/MapStringString' - # description: - # type: string - # description: |- - # A short (typically relatively few words, on one line) description of the - # entity. - # title: - # type: string - # description: |- - # A display name of the entity, to be presented in user interfaces instead - # of the `name` property above, when available. - # This field is sometimes useful when the `name` is cumbersome or ends up - # being perceived as overly technical. The title generally does not have - # as stringent format requirements on it, so it may contain special - # characters and be more explanatory. Do keep it very short though, and - # avoid situations where a title can be confused with the name of another - # entity, or where two entities share a title. - # Note that this is only for display purposes, and may be ignored by some - # parts of the code. Entity references still always make use of the `name` - # property, not the title. - # namespace: - # type: string - # description: The namespace that the entity belongs to. - # name: - # type: string - # description: |- - # The name of the entity. - # Must be unique within the catalog at any given point in time, for any - # given namespace + kind pair. This value is part of the technical - # identifier of the entity, and as such it will appear in URLs, database - # tables, entity references, and similar. It is subject to restrictions - # regarding what characters are allowed. - # If you want to use a different, more human readable string with fewer - # restrictions on it in user interfaces, see the `title` field below. - # etag: - # type: string - # description: |- - # An opaque string that changes for each update operation to any part of - # the entity, including metadata. - # This field can not be set by the user at creation time, and the server - # will reject an attempt to do so. The field will be populated in read - # operations. The field can (optionally) be specified when performing - # update or delete operations, and the server will then reject the - # operation if it does not match the current stored value. - # uid: - # type: string - # description: |- - # A globally unique ID for the entity. - # This field can not be set by the user at creation time, and the server - # will reject an attempt to do so. The field will be populated in read - # operations. The field can (optionally) be specified when performing - # update or delete operations, but the server is free to reject requests - # that do so in such a way that it breaks semantics. - # required: - # - name - # description: Metadata fields common to all versions/kinds of entity. - # additionalProperties: {} - # EntityRelation: - # type: object - # properties: - # targetRef: - # type: string - # description: The entity ref of the target of this relation. - # type: - # type: string - # description: The type of the relation. - # required: - # - targetRef - # - type - # description: A relation of a specific type to another entity in the catalog. - # additionalProperties: false - # Entity: - # type: object - # properties: - # relations: - # type: array - # items: - # $ref: '#/components/schemas/EntityRelation' - # description: The relations that this entity has with other entities. - # spec: - # $ref: '#/components/schemas/JsonObject' - # metadata: - # $ref: '#/components/schemas/EntityMeta' - # kind: - # type: string - # description: The high level entity type being described. - # apiVersion: - # type: string - # description: |- - # The version of specification format for this particular entity that - # this is written against. - # required: - # - metadata - # - kind - # - apiVersion - # description: The parts of the format that's common to all versions/kinds of entity. Error: type: object properties: @@ -408,12 +275,6 @@ components: - filters - globals description: The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend` - # MapStringString: - # type: object - # properties: {} - # additionalProperties: - # type: string - # description: Construct a type with a set of properties K of type T ScaffolderScaffoldOptions: type: object properties: @@ -442,125 +303,6 @@ components: required: - example description: A single scaffolder usage example - # Schema: - # type: object - # properties: - # $id: - # type: string - # id: - # type: string - # $schema: - # type: string - # $ref: - # type: string - # title: - # type: string - # description: - # type: string - # multipleOf: - # type: number - # maximum: - # type: number - # exclusiveMaximum: - # oneOf: - # - type: number - # - type: boolean - # minimum: - # type: number - # exclusiveMinimum: - # oneOf: - # - type: number - # - type: boolean - # maxLength: - # type: integer - # minLength: - # type: integer - # pattern: - # type: object - # additionalItems: - # oneOf: - # - type: boolean - # - $ref: '#/components/schemas/Schema' - # items: - # oneOf: - # - $ref: '#/components/schemas/Schema' - # - type: array - # items: - # $ref: '#/components/schemas/Schema' - # maxItems: - # type: integer - # minItems: - # type: integer - # uniqueItems: - # type: boolean - # maxProperties: - # type: integer - # minProperties: - # type: integer - # required: - # oneOf: - # - type: array - # items: - # type: string - # - type: boolean - # additionalProperties: - # oneOf: - # - type: boolean - # - $ref: '#/components/schemas/Schema' - # definitions: - # type: object - # additionalProperties: - # $ref: '#/components/schemas/Schema' - # properties: - # type: object - # additionalProperties: - # $ref: '#/components/schemas/Schema' - # patternProperties: - # type: object - # additionalProperties: - # $ref: '#/components/schemas/Schema' - # dependencies: - # type: object - # additionalProperties: - # oneOf: - # - $ref: '#/components/schemas/Schema' - # - type: array - # items: - # type: string - # const: - # type: object - # enum: - # type: array - # items: - # type: object - # type: - # oneOf: - # - type: string - # - type: array - # items: - # type: string - # format: - # type: string - # allOf: - # type: array - # items: - # $ref: '#/components/schemas/Schema' - # anyOf: - # type: array - # items: - # $ref: '#/components/schemas/Schema' - # oneOf: - # type: array - # items: - # $ref: '#/components/schemas/Schema' - # not: - # $ref: '#/components/schemas/Schema' - # if: - # $ref: '#/components/schemas/Schema' - # then: - # $ref: '#/components/schemas/Schema' - # else: - # $ref: '#/components/schemas/Schema' SerializedFile: type: object properties: @@ -568,7 +310,6 @@ components: type: string content: type: string - # format: byte executable: type: boolean symlink: @@ -616,7 +357,6 @@ components: type: string spec: type: object - # $ref: '#/components/schemas/TaskSpec' status: $ref: '#/components/schemas/TaskStatus' createdAt: @@ -635,7 +375,6 @@ components: - status - createdAt description: SerializedTask - # additionalProperties: {} TaskEventType: type: string description: TaskEventType @@ -644,24 +383,6 @@ components: - completion - log - recovered - # TaskRecovery: - # type: object - # # properties: - # # EXPERIMENTAL_strategy: - # # $ref: '#/components/schemas/TaskRecoverStrategy' - # description: |- - # When task didn't have a chance to complete due to system restart you can define the strategy what to do with such tasks, - # by defining a strategy. - - # By default, it is none, what means to not recover but updating the status from 'processing' to 'failed'. - # TaskRecoverStrategy: - # type: string - # description: | - # - none: not recover, let the task be marked as failed - # - startOver: do recover, start the execution of the task from the first step. - # enum: - # - none - # - startOver TaskSecrets: allOf: - type: object @@ -672,59 +393,6 @@ components: backstageToken: type: string description: TaskSecrets - # TaskSpec: - # $ref: '#/components/schemas/TaskSpecV1beta3' - # TaskSpecV1beta3: - # type: object - # properties: - # apiVersion: - # type: string - # enum: - # - scaffolder.backstage.io/v1beta3 - # description: The apiVersion string of the TaskSpec. - # parameters: - # $ref: '#/components/schemas/JsonObject' - # description: | - # This is a JSONSchema which is used to render a form in the frontend - # to collect user input and validate it against that schema. This can then be used in the `steps` part below to template - # variables passed from the user into each action in the template. - # steps: - # type: array - # items: - # $ref: '#/components/schemas/TaskStep' - # description: | - # A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying - # javascript action and some optional input parameters that may or may not have been collected from the end user. - # output: - # type: object - # additionalProperties: - # $ref: '#/components/schemas/JsonValue' - # description: | - # The output is an object where template authors can pull out information from template actions and return them in a known standard way. - # templateInfo: - # $ref: '#/components/schemas/TemplateInfo' - # description: Some information about the template that is stored on the task spec. - # user: - # type: object - # properties: - # entity: - # type: object - # description: The decorated entity from the Catalog - # ref: - # type: string - # description: An entity ref for the author of the task - # description: Some decoration of the author of the task that should be available in the context - # EXPERIMENTAL_recovery: - # $ref: '#/components/schemas/TaskRecovery' - # description: How to recover the task after system restart or system crash. - # required: - # - apiVersion - # - parameters - # - steps - # - output - # description: |- - # A scaffolder task as stored in the database, generated from a v1beta3 - # apiVersion Template. TaskStatus: type: string enum: @@ -735,134 +403,6 @@ components: - processing - skipped description: The status of each step of the Task - # TaskStep: - # type: object - # properties: - # id: - # type: string - # description: A unique identifier for this step. - # name: - # type: string - # description: A display name to show the user. - # action: - # type: string - # description: The underlying action ID that will be called as part of running this step. - # input: - # $ref: '#/components/schemas/JsonObject' - # description: Additional data that will be passed to the action. - # # if: - # # oneOf: - # # - type: string - # # - type: boolean - # # description: When this is false, or if the templated value string evaluates to something that is falsy the step will be skipped. - # each: - # oneOf: - # - type: string - # - $ref: '#/components/schemas/JsonArray' - # description: Run step repeatedly. - # required: - # - id - # - name - # - action - # description: An individual step of a scaffolder task, as stored in the database. - # additionalProperties: {} - # TemplateEntityStepV1beta3: - # allOf: - # - $ref: '#/components/schemas/JsonObject' - # - type: object - # properties: - # id: - # type: string - # name: - # type: string - # action: - # type: string - # input: - # $ref: '#/components/schemas/JsonObject' - # if: - # oneOf: - # - type: string - # - type: boolean - # backstage:permissions: - # $ref: '#/components/schemas/TemplatePermissionsV1beta3' - # required: - # - action - # description: Step that is part of a Template Entity. - # additionalProperties: {} - # TemplateEntityV1beta3: - # allOf: - # - $ref: '#/components/schemas/Entity' - # - type: object - # properties: - # apiVersion: - # type: string - # enum: - # - scaffolder.backstage.io/v1beta3 - # description: The apiVersion string of the TaskSpec. - # kind: - # type: string - # enum: - # - Template - # description: The kind of the entity - # spec: - # type: object - # properties: - # type: - # type: string - # description: The type that the Template will create. For example service, website or library. - # presentation: - # $ref: '#/components/schemas/TemplatePresentationV1beta3' - # description: Template specific configuration of the presentation layer. - # EXPERIMENTAL_recovery: - # $ref: '#/components/schemas/TemplateRecoveryV1beta3' - # description: Recovery strategy for the template - # EXPERIMENTAL_formDecorators: - # type: array - # items: - # type: object - # properties: - # id: - # type: string - # input: - # $ref: '#/components/schemas/JsonObject' - # required: - # - id - # parameters: - # oneOf: - # - $ref: '#/components/schemas/TemplateParametersV1beta3' - # - type: array - # items: - # $ref: '#/components/schemas/TemplateParametersV1beta3' - # description: |- - # This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend - # to collect user input and validate it against that schema. This can then be used in the `steps` part below to template - # variables passed from the user into each action in the template. - # steps: - # type: array - # items: - # $ref: '#/components/schemas/TemplateEntityStepV1beta3' - # description: |- - # A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying - # javascript action and some optional input parameters that may or may not have been collected from the end user. - # output: - # type: object - # additionalProperties: - # type: string - # description: The output is an object where template authors can pull out information from template actions and return them in a known standard way. - # owner: - # type: string - # description: The owner entityRef of the TemplateEntity - # required: - # - type - # - steps - # description: The specification of the Template Entity - # required: - # - apiVersion - # - kind - # - spec - # description: |- - # Backstage catalog Template kind Entity. Templates are used by the Scaffolder - # plugin to create new entities, such as Components. TemplateGlobalFunction: type: object properties: @@ -890,7 +430,6 @@ components: value: type: object nullable: true - # $ref: '#/components/schemas/JsonValue' required: - value description: The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend` @@ -915,40 +454,13 @@ components: items: $ref: '#/components/schemas/ScaffolderUsageExample' description: The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend` - # TemplateInfo: - # type: object - # properties: - # entityRef: - # type: string - # description: The entityRef of the template. - # baseUrl: - # type: string - # description: Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths. - # entity: - # type: object - # properties: - # metadata: - # $ref: '#/components/schemas/EntityMeta' - # description: The metadata of the Template. - # required: - # - metadata - # description: The Template entity. - # required: - # - entityRef - # description: |- - # Information about a template that is stored on a task specification. - # Includes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition TemplateParameterSchema: type: object properties: title: type: string - # presentation: - # $ref: '#/components/schemas/TemplatePresentationV1beta3' description: type: string - # 'ui:options': - # $ref: '#/components/schemas/JsonValue' steps: type: array items: @@ -956,27 +468,13 @@ components: properties: title: type: string - # $ref: '#/components/schemas/JsonValue' description: type: string - # $ref: '#/components/schemas/JsonValue' schema: type: object - # additionalProperties: {} required: - title - schema - # EXPERIMENTAL_formDecorators: - # type: array - # items: - # type: object - # properties: - # id: - # type: string - # input: - # $ref: '#/components/schemas/JsonObject' - # required: - # - id required: - title - steps @@ -984,59 +482,6 @@ components: The shape of each entry of parameters which gets rendered as a separate step in the wizard input additionalProperties: {} - # TemplateParametersV1beta3: - # allOf: - # - $ref: '#/components/schemas/JsonObject' - # - type: object - # properties: - # backstage:permissions: - # $ref: '#/components/schemas/TemplatePermissionsV1beta3' - # additionalProperties: {} - # description: Parameter that is part of a Template Entity. - # TemplatePermissionsV1beta3: - # allOf: - # - $ref: '#/components/schemas/JsonObject' - # - type: object - # properties: - # tags: - # type: array - # items: - # type: string - # description: Access control properties for parts of a template. - # TemplatePresentationV1beta3: - # allOf: - # - $ref: '#/components/schemas/JsonObject' - # - type: object - # properties: - # buttonLabels: - # type: object - # properties: - # backButtonText: - # type: string - # description: The text for the button which leads to the previous template page - # createButtonText: - # type: string - # description: The text for the button which starts the execution of the template - # reviewButtonText: - # type: string - # description: The text for the button which opens template's review/summary - # description: Overrides default buttons' text - # description: The presentation of the template. - # additionalProperties: {} - # TemplateRecoveryV1beta3: - # allOf: - # - $ref: '#/components/schemas/JsonObject' - # - type: object - # properties: - # EXPERIMENTAL_strategy: - # type: string - # enum: - # - none - # - startOver - # description: |- - # none - not recover, let the task be marked as failed - # startOver - do recover, start the execution of the task from the first step. - # description: Depends on how you designed your task you might tailor the behaviour for each of them. ValidationError: type: object properties: @@ -1050,10 +495,6 @@ components: type: string message: type: string - # schema: - # oneOf: - # - type: string - # - $ref: '#/components/schemas/Schema' instance: type: object name: @@ -1252,21 +693,6 @@ paths: parameters: - $ref: '#/components/parameters/taskId' - # /v2/tasks/{taskId}/eventstream: - # get: - # operationId: StreamLogsEventStream - # description: Get event stream for a task by ID. - # responses: - # '200': - # description: Ok - # content: - # text/event-stream: - # schema: - # type: string - # parameters: - # - $ref: '#/components/parameters/eventsAfter' - # - $ref: '#/components/parameters/taskId' - /v2/tasks/{taskId}/events: get: operationId: StreamLogsPolling @@ -1297,8 +723,6 @@ paths: properties: template: type: object - # check generation - # additionalProperties: {} values: $ref: '#/components/schemas/JsonObject' secrets: From 182e77ba82d9f40289c485174918f67d8beae494 Mon Sep 17 00:00:00 2001 From: solimant Date: Thu, 12 Jun 2025 05:46:43 +0000 Subject: [PATCH 36/44] Rebase tests Signed-off-by: solimant --- .../src/service/router.test.ts | 49 +++++++++---------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/plugins/scaffolder-backend/src/service/router.test.ts b/plugins/scaffolder-backend/src/service/router.test.ts index 38fbbea533..467b590bed 100644 --- a/plugins/scaffolder-backend/src/service/router.test.ts +++ b/plugins/scaffolder-backend/src/service/router.test.ts @@ -42,6 +42,7 @@ import { TaskSpec } from '@backstage/plugin-scaffolder-common'; import { JsonValue } from '@backstage/types'; import { StorageTaskBroker } from '../scaffolder/tasks/StorageTaskBroker'; import { AuthorizeResult } from '@backstage/plugin-permission-common'; +import { wrapServer } from '@backstage/backend-openapi-utils/testUtils'; import { mockCredentials, mockErrorHandler, @@ -57,6 +58,7 @@ import { } from '@backstage/plugin-scaffolder-node/alpha'; import { catalogServiceMock } from '@backstage/plugin-catalog-node/testUtils'; import { DatabaseService } from '@backstage/backend-plugin-api'; +import { createDebugLogAction } from '../scaffolder/actions/builtin'; import { ScmIntegrations } from '@backstage/integration'; import { extractFilterMetadata, @@ -66,24 +68,6 @@ import { import { createDefaultFilters } from '../lib/templating/filters/createDefaultFilters'; import { createRouter } from './router'; import { DatabaseTaskStore } from '../scaffolder/tasks/DatabaseTaskStore'; -import { Server } from 'http'; -import { wrapServer } from '@backstage/backend-openapi-utils/testUtils'; - -const mockAccess = jest.fn(); - -jest.mock('fs-extra', () => ({ - ...jest.requireActual('fs-extra'), - access: (...args: any[]) => mockAccess(...args), - promises: { - access: (...args: any[]) => mockAccess(...args), - }, - constants: { - F_OK: 0, - W_OK: 1, - }, - mkdir: jest.fn(), - remove: jest.fn(), -})); function createDatabase(): DatabaseService { return DatabaseManager.fromConfig( @@ -260,12 +244,20 @@ const createTestRouter = async ( }, handler: async () => {}, }), + createDebugLogAction(), ], }); router.use(mockErrorHandler()); - const app = await wrapServer(express().use(router)); - return { router: app, logger, taskBroker, permissions, catalog }; + const wrappedRouter = await wrapServer(express().use(router)); + return { + router: wrappedRouter, + unwrappedRouter: router, + logger, + taskBroker, + permissions, + catalog, + }; }; describe('scaffolder router', () => { @@ -281,7 +273,7 @@ describe('scaffolder router', () => { const response = await request(router).get('/v2/actions').send(); expect(response.status).toEqual(200); expect(response.body[0].id).toBeDefined(); - expect(response.body.length).toBe(1); + expect(response.body.length).toBe(2); }); }); @@ -723,7 +715,10 @@ describe('scaffolder router', () => { }, }); - console.log(status, body); + expect(status).toBe(201); + expect(body).toMatchObject({ + id: expect.any(String), + }); expect(logger.info).toHaveBeenCalledTimes(1); expect(logger.info).toHaveBeenCalledWith( 'Scaffolding task for template:default/create-react-app-template created by user:default/mock', @@ -1053,7 +1048,7 @@ describe('scaffolder router', () => { describe('GET /v2/tasks/:taskId/eventstream', () => { it('should return log messages', async () => { - const { router, taskBroker } = await createTestRouter(); + const { unwrappedRouter: router, taskBroker } = await createTestRouter(); (taskBroker.get as jest.Mocked['get']).mockResolvedValue({ id: 'a-random-id', spec: {} as any, @@ -1148,7 +1143,7 @@ data: {"id":1,"taskId":"a-random-id","type":"completion","createdAt":"","body":{ }); it('should return log messages with after query', async () => { - const { router, taskBroker } = await createTestRouter(); + const { unwrappedRouter: router, taskBroker } = await createTestRouter(); (taskBroker.get as jest.Mocked['get']).mockResolvedValue({ id: 'a-random-id', spec: {} as any, @@ -1452,7 +1447,7 @@ data: {"id":1,"taskId":"a-random-id","type":"completion","createdAt":"","body":{ it('should call the autocomplete handler', async () => { const handleAutocompleteRequest = jest.fn().mockResolvedValue({ - results: [{ title: 'blob' }], + results: [{ id: 'a-random-id', title: 'blob' }], }); const { router } = await createTestRouter({ @@ -1473,7 +1468,9 @@ data: {"id":1,"taskId":"a-random-id","type":"completion","createdAt":"","body":{ expect(response.status).toEqual(200); - expect(response.body).toEqual({ results: [{ title: 'blob' }] }); + expect(response.body).toEqual({ + results: [{ id: 'a-random-id', title: 'blob' }], + }); expect(handleAutocompleteRequest).toHaveBeenCalledWith({ token: mockToken, context, From 0afb6e8e4f2f09c499d6c9b94c9c8090de5f5081 Mon Sep 17 00:00:00 2001 From: solimant Date: Wed, 18 Jun 2025 07:19:34 +0000 Subject: [PATCH 37/44] Remove deprecated ActionExample Signed-off-by: solimant --- plugins/scaffolder-common/report.api.md | 5 +---- plugins/scaffolder-common/src/api.ts | 10 +--------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/plugins/scaffolder-common/report.api.md b/plugins/scaffolder-common/report.api.md index 1496496450..03dc3d05ea 100644 --- a/plugins/scaffolder-common/report.api.md +++ b/plugins/scaffolder-common/report.api.md @@ -22,12 +22,9 @@ export type Action = { input?: JSONSchema7; output?: JSONSchema7; }; - examples?: ActionExample[]; + examples?: ScaffolderUsageExample[]; }; -// @public @deprecated -export type ActionExample = ScaffolderUsageExample; - // @public export const isTemplateEntityV1beta3: ( entity: Entity, diff --git a/plugins/scaffolder-common/src/api.ts b/plugins/scaffolder-common/src/api.ts index 52ae010870..c6d6562aff 100644 --- a/plugins/scaffolder-common/src/api.ts +++ b/plugins/scaffolder-common/src/api.ts @@ -60,14 +60,6 @@ export type ScaffolderUsageExample = { notes?: string; }; -/** - * A single action example - * - * @public - * @deprecated in favor of ScaffolderUsageExample - */ -export type ActionExample = ScaffolderUsageExample; - /** * The response shape for a single action in the `listActions` call to the `scaffolder-backend` * @@ -80,7 +72,7 @@ export type Action = { input?: JSONSchema7; output?: JSONSchema7; }; - examples?: ActionExample[]; + examples?: ScaffolderUsageExample[]; }; /** From 90bc74075ddcd74da1487bce031b3b2aba0578e0 Mon Sep 17 00:00:00 2001 From: solimant Date: Fri, 18 Jul 2025 02:06:08 +0000 Subject: [PATCH 38/44] Add generate script Signed-off-by: solimant --- plugins/scaffolder-backend/package.json | 1 + yarn.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index ad0e1c0ed3..0f7816dc51 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -120,6 +120,7 @@ "@backstage/backend-test-utils": "workspace:^", "@backstage/cli": "workspace:^", "@backstage/plugin-scaffolder-node-test-utils": "workspace:^", + "@backstage/repo-tools": "workspace:^", "@types/express": "^4.17.6", "@types/fs-extra": "^11.0.0", "@types/nunjucks": "^3.1.4", diff --git a/yarn.lock b/yarn.lock index 6c3ac1594d..fb5eea39a5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7349,6 +7349,7 @@ __metadata: "@backstage/plugin-scaffolder-common": "workspace:^" "@backstage/plugin-scaffolder-node": "workspace:^" "@backstage/plugin-scaffolder-node-test-utils": "workspace:^" + "@backstage/repo-tools": "workspace:^" "@backstage/types": "workspace:^" "@opentelemetry/api": "npm:^1.9.0" "@types/express": "npm:^4.17.6" From 7127ac9107007a33ab87dcbb51453f847fb50d96 Mon Sep 17 00:00:00 2001 From: solimant Date: Fri, 18 Jul 2025 02:12:35 +0000 Subject: [PATCH 39/44] Fix modelEnum.mustache Signed-off-by: solimant --- .../templates/typescript-backstage-client/modelEnum.mustache | 2 +- .../templates/typescript-backstage-server/modelEnum.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/repo-tools/templates/typescript-backstage-client/modelEnum.mustache b/packages/repo-tools/templates/typescript-backstage-client/modelEnum.mustache index 2461d8c549..09bc5bdbca 100644 --- a/packages/repo-tools/templates/typescript-backstage-client/modelEnum.mustache +++ b/packages/repo-tools/templates/typescript-backstage-client/modelEnum.mustache @@ -17,4 +17,4 @@ export enum {{classname}} { * @public */ export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}}; - +{{/stringEnums}} diff --git a/packages/repo-tools/templates/typescript-backstage-server/modelEnum.mustache b/packages/repo-tools/templates/typescript-backstage-server/modelEnum.mustache index 2461d8c549..09bc5bdbca 100644 --- a/packages/repo-tools/templates/typescript-backstage-server/modelEnum.mustache +++ b/packages/repo-tools/templates/typescript-backstage-server/modelEnum.mustache @@ -17,4 +17,4 @@ export enum {{classname}} { * @public */ export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}}; - +{{/stringEnums}} From 2ea0997446c99d3b5735363c0ce37e8089f7d468 Mon Sep 17 00:00:00 2001 From: solimant Date: Fri, 18 Jul 2025 02:13:51 +0000 Subject: [PATCH 40/44] Capture 403 errors Signed-off-by: solimant --- .../scaffolder-backend/src/schema/openapi.yaml | 4 ++++ .../openapi/generated/apis/Api.server.ts | 4 ++-- .../generated/models/TaskEventType.model.ts | 10 ---------- .../generated/models/TaskStatus.model.ts | 12 ------------ .../src/schema/openapi/generated/router.ts | 8 +++++++- plugins/scaffolder-common/report.api.md | 18 ------------------ .../generated/models/TaskEventType.model.ts | 10 ---------- .../generated/models/TaskStatus.model.ts | 12 ------------ 8 files changed, 13 insertions(+), 65 deletions(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 18f45a4b35..284a478692 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -634,6 +634,8 @@ paths: application/json: schema: $ref: '#/components/schemas/SerializedTask' + '403': + $ref: '#/components/responses/ErrorResponse' security: - {} - JWT: [] @@ -706,6 +708,8 @@ paths: type: array items: $ref: '#/components/schemas/SerializedTaskEvent' + '403': + $ref: '#/components/responses/ErrorResponse' parameters: - $ref: '#/components/parameters/eventsAfter' - $ref: '#/components/parameters/taskId' diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts index febb63606f..6e23ed34c8 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -70,7 +70,7 @@ export type GetTask = { path: { taskId: string; }; - response: SerializedTask; + response: SerializedTask | Error; }; /** * @public @@ -135,7 +135,7 @@ export type StreamLogsPolling = { query: { after?: number; }; - response: Array; + response: Array | Error; }; export type EndpointMap = { diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts index dd3d36d64e..cded96f252 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts @@ -22,13 +22,3 @@ * @public */ export type TaskEventType = 'cancelled' | 'completion' | 'log' | 'recovered'; - -/** - * @public - */ -export const TaskEventType = { - Cancelled: 'cancelled' as TaskEventType, - Completion: 'completion' as TaskEventType, - Log: 'log' as TaskEventType, - Recovered: 'recovered' as TaskEventType, -}; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts index 622aa758c0..ff3d59e0e0 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts @@ -28,15 +28,3 @@ export type TaskStatus = | 'open' | 'processing' | 'skipped'; - -/** - * @public - */ -export const TaskStatus = { - Cancelled: 'cancelled' as TaskStatus, - Completed: 'completed' as TaskStatus, - Failed: 'failed' as TaskStatus, - Open: 'open' as TaskStatus, - Processing: 'processing' as TaskStatus, - Skipped: 'skipped' as TaskStatus, -}; diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts index 78802491b1..0e857d57b1 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -18,7 +18,7 @@ // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * // ****************************************************************** import { createValidatedOpenApiRouterFromGeneratedEndpointMap } from '@backstage/backend-openapi-utils'; -import { EndpointMap } from './'; +import { EndpointMap } from './apis'; export const spec = { openapi: '3.0.3', @@ -931,6 +931,9 @@ export const spec = { }, }, }, + '403': { + $ref: '#/components/responses/ErrorResponse', + }, }, security: [ {}, @@ -1051,6 +1054,9 @@ export const spec = { }, }, }, + '403': { + $ref: '#/components/responses/ErrorResponse', + }, }, parameters: [ { diff --git a/plugins/scaffolder-common/report.api.md b/plugins/scaffolder-common/report.api.md index 03dc3d05ea..2079bb84d9 100644 --- a/plugins/scaffolder-common/report.api.md +++ b/plugins/scaffolder-common/report.api.md @@ -356,16 +356,6 @@ export type ScaffolderTaskStatus = | 'processing' | 'skipped'; -// @public (undocumented) -export const ScaffolderTaskStatus: { - Cancelled: ScaffolderTaskStatus; - Completed: ScaffolderTaskStatus; - Failed: ScaffolderTaskStatus; - Open: ScaffolderTaskStatus; - Processing: ScaffolderTaskStatus; - Skipped: ScaffolderTaskStatus; -}; - // @public export type ScaffolderUsageExample = { description?: string; @@ -376,14 +366,6 @@ export type ScaffolderUsageExample = { // @public (undocumented) export type TaskEventType = 'cancelled' | 'completion' | 'log' | 'recovered'; -// @public (undocumented) -export const TaskEventType: { - Cancelled: TaskEventType; - Completion: TaskEventType; - Log: TaskEventType; - Recovered: TaskEventType; -}; - // @public export type TaskRecoverStrategy = 'none' | 'startOver'; diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts index dd3d36d64e..cded96f252 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts @@ -22,13 +22,3 @@ * @public */ export type TaskEventType = 'cancelled' | 'completion' | 'log' | 'recovered'; - -/** - * @public - */ -export const TaskEventType = { - Cancelled: 'cancelled' as TaskEventType, - Completion: 'completion' as TaskEventType, - Log: 'log' as TaskEventType, - Recovered: 'recovered' as TaskEventType, -}; diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts index 622aa758c0..ff3d59e0e0 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts @@ -28,15 +28,3 @@ export type TaskStatus = | 'open' | 'processing' | 'skipped'; - -/** - * @public - */ -export const TaskStatus = { - Cancelled: 'cancelled' as TaskStatus, - Completed: 'completed' as TaskStatus, - Failed: 'failed' as TaskStatus, - Open: 'open' as TaskStatus, - Processing: 'processing' as TaskStatus, - Skipped: 'skipped' as TaskStatus, -}; From df41cf9557f674090ec60a2576c815c5ec1482a7 Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Tue, 29 Jul 2025 13:24:48 +0200 Subject: [PATCH 41/44] chore: cleanup breaking change Signed-off-by: benjdlambert --- plugins/scaffolder-backend/src/schema/openapi.yaml | 3 ++- .../src/schema/openapi/generated/apis/Api.server.ts | 2 +- .../src/schema/openapi/generated/apis/index.ts | 2 +- .../src/schema/openapi/generated/index.ts | 2 +- .../schema/openapi/generated/models/Action.model.ts | 2 +- .../openapi/generated/models/ActionExample.model.ts | 2 +- .../openapi/generated/models/ActionSchema.model.ts | 2 +- .../models/Autocomplete200Response.model.ts | 2 +- .../Autocomplete200ResponseResultsInner.model.ts | 2 +- .../models/Autocomplete400Response.model.ts | 2 +- .../generated/models/AutocompleteRequest.model.ts | 2 +- .../generated/models/CancelTask200Response.model.ts | 2 +- .../generated/models/DryRun200Response.model.ts | 2 +- .../models/DryRun200ResponseAllOf.model.ts | 2 +- ...n200ResponseAllOfDirectoryContentsInner.model.ts | 2 +- .../DryRun200ResponseAllOfStepsInner.model.ts | 2 +- .../openapi/generated/models/DryRunRequest.model.ts | 2 +- .../DryRunRequestDirectoryContentsInner.model.ts | 2 +- .../openapi/generated/models/DryRunResult.model.ts | 2 +- .../generated/models/DryRunResultLogInner.model.ts | 2 +- .../models/DryRunResultLogInnerBody.model.ts | 2 +- .../models/DryRunResultLogInnerBodyAllOf.model.ts | 2 +- .../openapi/generated/models/ErrorError.model.ts | 2 +- .../openapi/generated/models/ErrorRequest.model.ts | 2 +- .../openapi/generated/models/ErrorResponse.model.ts | 2 +- .../openapi/generated/models/JsonPrimitive.model.ts | 2 +- .../openapi/generated/models/JsonValue.model.ts | 2 +- .../generated/models/ListTasksResponse.model.ts | 2 +- .../openapi/generated/models/ModelError.model.ts | 2 +- .../generated/models/Scaffold201Response.model.ts | 2 +- .../generated/models/Scaffold400Response.model.ts | 2 +- .../models/ScaffolderScaffoldOptions.model.ts | 2 +- .../generated/models/SerializedFile.model.ts | 2 +- .../generated/models/SerializedTask.model.ts | 2 +- .../generated/models/SerializedTaskEvent.model.ts | 2 +- .../openapi/generated/models/TaskEventType.model.ts | 2 +- .../openapi/generated/models/TaskSecrets.model.ts | 2 +- .../generated/models/TaskSecretsAllOf.model.ts | 2 +- .../openapi/generated/models/TaskStatus.model.ts | 2 +- .../models/TemplateParameterSchema.model.ts | 2 +- .../TemplateParameterSchemaStepsInner.model.ts | 2 +- .../generated/models/ValidationError.model.ts | 2 +- .../models/ValidationErrorArgument.model.ts | 2 +- .../models/ValidationErrorPathInner.model.ts | 2 +- .../src/schema/openapi/generated/models/index.ts | 2 +- .../src/schema/openapi/generated/router.ts | 4 ++-- .../scaffolder-backend/src/schema/openapi/index.ts | 2 +- plugins/scaffolder-common/src/ScaffolderClient.ts | 13 ++----------- plugins/scaffolder-common/src/api.ts | 8 +------- .../src/schema/openapi/generated/apis/Api.client.ts | 2 +- .../src/schema/openapi/generated/apis/index.ts | 2 +- .../src/schema/openapi/generated/index.ts | 2 +- .../schema/openapi/generated/models/Action.model.ts | 2 +- .../openapi/generated/models/ActionExample.model.ts | 2 +- .../openapi/generated/models/ActionSchema.model.ts | 2 +- .../models/Autocomplete200Response.model.ts | 2 +- .../Autocomplete200ResponseResultsInner.model.ts | 2 +- .../models/Autocomplete400Response.model.ts | 2 +- .../generated/models/AutocompleteRequest.model.ts | 2 +- .../generated/models/CancelTask200Response.model.ts | 2 +- .../generated/models/DryRun200Response.model.ts | 2 +- .../models/DryRun200ResponseAllOf.model.ts | 2 +- ...n200ResponseAllOfDirectoryContentsInner.model.ts | 2 +- .../DryRun200ResponseAllOfStepsInner.model.ts | 2 +- .../openapi/generated/models/DryRunRequest.model.ts | 2 +- .../DryRunRequestDirectoryContentsInner.model.ts | 2 +- .../openapi/generated/models/DryRunResult.model.ts | 2 +- .../generated/models/DryRunResultLogInner.model.ts | 2 +- .../models/DryRunResultLogInnerBody.model.ts | 2 +- .../models/DryRunResultLogInnerBodyAllOf.model.ts | 2 +- .../openapi/generated/models/ErrorError.model.ts | 2 +- .../openapi/generated/models/ErrorRequest.model.ts | 2 +- .../openapi/generated/models/ErrorResponse.model.ts | 2 +- .../openapi/generated/models/JsonPrimitive.model.ts | 2 +- .../openapi/generated/models/JsonValue.model.ts | 2 +- .../generated/models/ListTasksResponse.model.ts | 2 +- .../openapi/generated/models/ModelError.model.ts | 2 +- .../generated/models/Scaffold201Response.model.ts | 2 +- .../generated/models/Scaffold400Response.model.ts | 2 +- .../models/ScaffolderScaffoldOptions.model.ts | 2 +- .../generated/models/SerializedFile.model.ts | 2 +- .../generated/models/SerializedTask.model.ts | 2 +- .../generated/models/SerializedTaskEvent.model.ts | 2 +- .../openapi/generated/models/TaskEventType.model.ts | 2 +- .../openapi/generated/models/TaskSecrets.model.ts | 2 +- .../generated/models/TaskSecretsAllOf.model.ts | 2 +- .../openapi/generated/models/TaskStatus.model.ts | 2 +- .../models/TemplateParameterSchema.model.ts | 2 +- .../TemplateParameterSchemaStepsInner.model.ts | 2 +- .../generated/models/ValidationError.model.ts | 2 +- .../models/ValidationErrorArgument.model.ts | 2 +- .../models/ValidationErrorPathInner.model.ts | 2 +- .../src/schema/openapi/generated/models/index.ts | 2 +- .../src/schema/openapi/generated/pluginId.ts | 2 +- .../scaffolder-common/src/schema/openapi/index.ts | 2 +- .../src/components/OngoingTask/OngoingTask.tsx | 2 +- 96 files changed, 99 insertions(+), 113 deletions(-) diff --git a/plugins/scaffolder-backend/src/schema/openapi.yaml b/plugins/scaffolder-backend/src/schema/openapi.yaml index 284a478692..b89f54603c 100644 --- a/plugins/scaffolder-backend/src/schema/openapi.yaml +++ b/plugins/scaffolder-backend/src/schema/openapi.yaml @@ -667,7 +667,8 @@ paths: operationId: Retry description: Starts the task again from the point where it failed. requestBody: - required: true + # this should probably be marked as required, but for legacy reasons we're not. + required: false content: application/json: schema: diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts index 6e23ed34c8..c5bd9f0ac2 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/Api.server.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts index a3cdbbebd2..8d81cbaf39 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/apis/index.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/index.ts index 69c39313c6..dec4b8804e 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/index.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Action.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Action.model.ts index 8e86b8b338..f9c028f3e3 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Action.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Action.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionExample.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionExample.model.ts index cf2ffeaf8a..50550e2883 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionExample.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionExample.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionSchema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionSchema.model.ts index 037d2fff44..35d2014181 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionSchema.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ActionSchema.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts index b104dcbcc2..e3eec0aa20 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts index 68e8a77723..00ccb41b0f 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete400Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete400Response.model.ts index f36f47871e..1456babb96 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete400Response.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Autocomplete400Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/AutocompleteRequest.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/AutocompleteRequest.model.ts index d9ab409224..769a929918 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/AutocompleteRequest.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/AutocompleteRequest.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/CancelTask200Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/CancelTask200Response.model.ts index 745ca8074e..f29c509d41 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/CancelTask200Response.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/CancelTask200Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts index 963b71135f..62e3689d5d 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts index 85d99f90cf..5b6c2ff9c7 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts index 27174b9b0e..2646ca49f9 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts index 5a2c0639db..2a462edefa 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts index c9f10fd0b0..212b36c26b 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequest.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts index edf90d403d..ddcae4fd9d 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResult.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResult.model.ts index 66e35bd9e5..6e2ad23ef4 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResult.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResult.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts index f0da311b91..4c6b786d82 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts index a675d4b1ae..e3b19be045 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts index 665213a954..e67240ee54 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorError.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorError.model.ts index fe5811628d..e0265e95d7 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorError.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorError.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts index d44dcb66d9..3eb5e15740 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorRequest.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts index 91c120483d..edbcc32df7 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ErrorResponse.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonPrimitive.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonPrimitive.model.ts index 6ca5d5144b..6aa6394c14 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonPrimitive.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonPrimitive.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonValue.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonValue.model.ts index 9527b6828d..9fe2ac9de3 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonValue.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/JsonValue.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts index a61f35d3e6..9347c766a9 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ListTasksResponse.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ModelError.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ModelError.model.ts index 5526d703e6..958fde7d0b 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ModelError.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ModelError.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts index 8c0185ca58..1271642e81 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold201Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold400Response.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold400Response.model.ts index 515c5b6de3..e3cb7eaa45 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold400Response.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/Scaffold400Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts index d02f776ebc..93f4ae71c0 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedFile.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedFile.model.ts index d2bdfc72de..65a3c714a7 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedFile.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedFile.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts index f661fe07c7..67cbf14279 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTask.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts index cc75de3a0f..6e4ddaa296 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts index cded96f252..d32d77a448 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskEventType.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts index 74da6527a4..c78c39c1ec 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecrets.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts index 7c1e5d2e9e..0b33852cc9 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts index ff3d59e0e0..1f209a3656 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TaskStatus.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts index 20e9e5c121..8638ee8114 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts index cf42ba5649..2f7892fd41 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts index 459babc8bb..7e762f616c 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationError.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts index 60d2a20a5c..85c9576fd0 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts index 397ccab3f2..4535c735db 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts index 17f7907003..1bc447fa3d 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/models/index.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts index 0e857d57b1..669dd63878 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/generated/router.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -988,7 +988,7 @@ export const spec = { operationId: 'Retry', description: 'Starts the task again from the point where it failed.', requestBody: { - required: true, + required: false, content: { 'application/json': { schema: { diff --git a/plugins/scaffolder-backend/src/schema/openapi/index.ts b/plugins/scaffolder-backend/src/schema/openapi/index.ts index db98243cbf..196aad553a 100644 --- a/plugins/scaffolder-backend/src/schema/openapi/index.ts +++ b/plugins/scaffolder-backend/src/schema/openapi/index.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/ScaffolderClient.ts b/plugins/scaffolder-common/src/ScaffolderClient.ts index 43bcdb8ce5..d40f7a4637 100644 --- a/plugins/scaffolder-common/src/ScaffolderClient.ts +++ b/plugins/scaffolder-common/src/ScaffolderClient.ts @@ -382,20 +382,11 @@ export class ScaffolderClient implements ScaffolderApi { * {@inheritdoc ScaffolderApi.retry} */ async retry?( - { - secrets, - taskId, - }: { - secrets?: Record; - taskId: string; - }, + taskId: string, options?: ScaffolderRequestOptions, ): Promise<{ id: string }> { return await this.requestRequired( - await this.apiClient.retry( - { body: { secrets }, path: { taskId } }, - options, - ), + await this.apiClient.retry({ body: {}, path: { taskId } }, options), ); } diff --git a/plugins/scaffolder-common/src/api.ts b/plugins/scaffolder-common/src/api.ts index c6d6562aff..5425607d34 100644 --- a/plugins/scaffolder-common/src/api.ts +++ b/plugins/scaffolder-common/src/api.ts @@ -286,13 +286,7 @@ export interface ScaffolderApi { * @param taskId - the id of the task */ retry?( - { - secrets, - taskId, - }: { - secrets?: Record; - taskId: string; - }, + taskId: string, options?: ScaffolderRequestOptions, ): Promise<{ id: string }>; diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts b/plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts index 0151013378..ca5ae10b8f 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/apis/Api.client.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/apis/index.ts b/plugins/scaffolder-common/src/schema/openapi/generated/apis/index.ts index af52f9db46..fc7c83b736 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/apis/index.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/apis/index.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/index.ts b/plugins/scaffolder-common/src/schema/openapi/generated/index.ts index bb399e97a0..dc3055033d 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/index.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/index.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/Action.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Action.model.ts index 8e86b8b338..f9c028f3e3 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/Action.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/Action.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionExample.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionExample.model.ts index cf2ffeaf8a..50550e2883 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionExample.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionExample.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionSchema.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionSchema.model.ts index 037d2fff44..35d2014181 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionSchema.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ActionSchema.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200Response.model.ts index b104dcbcc2..e3eec0aa20 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200Response.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts index 68e8a77723..00ccb41b0f 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete200ResponseResultsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete400Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete400Response.model.ts index f36f47871e..1456babb96 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete400Response.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/Autocomplete400Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/AutocompleteRequest.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/AutocompleteRequest.model.ts index d9ab409224..769a929918 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/AutocompleteRequest.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/AutocompleteRequest.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/CancelTask200Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/CancelTask200Response.model.ts index 745ca8074e..f29c509d41 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/CancelTask200Response.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/CancelTask200Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200Response.model.ts index 963b71135f..62e3689d5d 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200Response.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts index 85d99f90cf..5b6c2ff9c7 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOf.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts index 27174b9b0e..2646ca49f9 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfDirectoryContentsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts index 5a2c0639db..2a462edefa 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRun200ResponseAllOfStepsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequest.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequest.model.ts index c9f10fd0b0..212b36c26b 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequest.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequest.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts index edf90d403d..ddcae4fd9d 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunRequestDirectoryContentsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResult.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResult.model.ts index 66e35bd9e5..6e2ad23ef4 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResult.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResult.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts index f0da311b91..4c6b786d82 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts index a675d4b1ae..e3b19be045 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBody.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts index 665213a954..e67240ee54 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/DryRunResultLogInnerBodyAllOf.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorError.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorError.model.ts index fe5811628d..e0265e95d7 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorError.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorError.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorRequest.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorRequest.model.ts index d44dcb66d9..3eb5e15740 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorRequest.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorRequest.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorResponse.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorResponse.model.ts index 91c120483d..edbcc32df7 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorResponse.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ErrorResponse.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonPrimitive.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonPrimitive.model.ts index 6ca5d5144b..6aa6394c14 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonPrimitive.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonPrimitive.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonValue.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonValue.model.ts index 9527b6828d..9fe2ac9de3 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonValue.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/JsonValue.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTasksResponse.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTasksResponse.model.ts index a61f35d3e6..9347c766a9 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTasksResponse.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ListTasksResponse.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ModelError.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ModelError.model.ts index 5526d703e6..958fde7d0b 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ModelError.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ModelError.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold201Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold201Response.model.ts index 8c0185ca58..1271642e81 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold201Response.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold201Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold400Response.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold400Response.model.ts index 515c5b6de3..e3cb7eaa45 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold400Response.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/Scaffold400Response.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts index d02f776ebc..93f4ae71c0 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ScaffolderScaffoldOptions.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedFile.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedFile.model.ts index d2bdfc72de..65a3c714a7 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedFile.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedFile.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTask.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTask.model.ts index f661fe07c7..67cbf14279 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTask.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTask.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts index cc75de3a0f..6e4ddaa296 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/SerializedTaskEvent.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts index cded96f252..d32d77a448 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskEventType.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecrets.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecrets.model.ts index 74da6527a4..c78c39c1ec 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecrets.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecrets.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts index 7c1e5d2e9e..0b33852cc9 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskSecretsAllOf.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts index ff3d59e0e0..1f209a3656 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TaskStatus.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts index 20e9e5c121..8638ee8114 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchema.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts index cf42ba5649..2f7892fd41 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/TemplateParameterSchemaStepsInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationError.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationError.model.ts index 459babc8bb..7e762f616c 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationError.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationError.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts index 60d2a20a5c..85c9576fd0 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorArgument.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts index 397ccab3f2..4535c735db 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/ValidationErrorPathInner.model.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts b/plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts index 17f7907003..1bc447fa3d 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/models/index.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/generated/pluginId.ts b/plugins/scaffolder-common/src/schema/openapi/generated/pluginId.ts index 313bbbc7d5..b898028be5 100644 --- a/plugins/scaffolder-common/src/schema/openapi/generated/pluginId.ts +++ b/plugins/scaffolder-common/src/schema/openapi/generated/pluginId.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder-common/src/schema/openapi/index.ts b/plugins/scaffolder-common/src/schema/openapi/index.ts index db98243cbf..196aad553a 100644 --- a/plugins/scaffolder-common/src/schema/openapi/index.ts +++ b/plugins/scaffolder-common/src/schema/openapi/index.ts @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * Copyright 2025 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx b/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx index ce765abb01..bc0d5fe1aa 100644 --- a/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx +++ b/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx @@ -223,7 +223,7 @@ function OngoingTaskContent(props: { const [, { execute: triggerRetry }] = useAsync(async () => { if (taskId) { analytics.captureEvent('retried', 'Template has been retried'); - await scaffolderApi.retry?.({ taskId }); + await scaffolderApi.retry?.(taskId); } }); From 225d7c237c3a22e4f5611f800b7b1b3a89304115 Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Tue, 29 Jul 2025 13:25:46 +0200 Subject: [PATCH 42/44] chore: changeset for repo tools Signed-off-by: benjdlambert --- .changeset/spotty-clowns-lose.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spotty-clowns-lose.md diff --git a/.changeset/spotty-clowns-lose.md b/.changeset/spotty-clowns-lose.md new file mode 100644 index 0000000000..e550fe48de --- /dev/null +++ b/.changeset/spotty-clowns-lose.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +Added `stringEnums` to `mustache` templates From 4f99e102ad08317bf1caa581d209b1841d4d192e Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Tue, 29 Jul 2025 13:31:48 +0200 Subject: [PATCH 43/44] chore: added a seperate callout for -react package deprecations Signed-off-by: benjdlambert --- .changeset/clean-chairs-sit-2.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .changeset/clean-chairs-sit-2.md diff --git a/.changeset/clean-chairs-sit-2.md b/.changeset/clean-chairs-sit-2.md new file mode 100644 index 0000000000..6fb7d6c844 --- /dev/null +++ b/.changeset/clean-chairs-sit-2.md @@ -0,0 +1,9 @@ +--- +'@backstage/plugin-scaffolder-react': minor +--- + +**DEPRECATION**: The following types have been deprecated from this package and moved into `@backstage/plugin-scaffolder-common` and should be imported from there instead. + +`Action`, `ListActionsResponse`, `LogEvent`, `ScaffolderApi`, `ScaffolderDryRunOptions`, `ScaffolderDryRunResponse`, `ScaffolderGetIntegrationsListOptions`, `ScaffolderGetIntegrationsListResponse`, +`ScaffolderOutputLink`, `ScaffolderOutputText`, `ScaffolderScaffoldOptions`, `ScaffolderScaffoldResponse`, `ScaffolderStreamLogsOptions`, `ScaffolderTask`, `ScaffolderTaskOutput`, `ScaffolderTaskStatus`, +`ScaffolderUsageExample`, `TemplateFilter`, `TemplateGlobalFunction`, `TemplateGlobalValue`, `TemplateParameterSchema`. From 4dd4fa6be3f6912f49ac78a95a9cdcfc7c90b7a9 Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Tue, 29 Jul 2025 14:21:23 +0200 Subject: [PATCH 44/44] chore: fixing implementation of the retry Signed-off-by: benjdlambert --- plugins/scaffolder-common/report.api.md | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/plugins/scaffolder-common/report.api.md b/plugins/scaffolder-common/report.api.md index 2079bb84d9..c6c5141cf2 100644 --- a/plugins/scaffolder-common/report.api.md +++ b/plugins/scaffolder-common/report.api.md @@ -114,13 +114,7 @@ export interface ScaffolderApi { options?: ScaffolderRequestOptions, ): Promise; retry?( - { - secrets, - taskId, - }: { - secrets?: Record; - taskId: string; - }, + taskId: string, options?: ScaffolderRequestOptions, ): Promise<{ id: string; @@ -213,13 +207,7 @@ export class ScaffolderClient implements ScaffolderApi { options?: ScaffolderRequestOptions, ): Promise; retry?( - { - secrets, - taskId, - }: { - secrets?: Record; - taskId: string; - }, + taskId: string, options?: ScaffolderRequestOptions, ): Promise<{ id: string;