diff --git a/openapi/api.yaml b/openapi/api.yaml index 1d714d8..cdabdc7 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -482,17 +482,19 @@ paths: requestBody: required: true content: - application/xml: + multipart/form-data: schema: - type: string - format: xml - example: | - - - - ... - - + type: object + required: + - resource + properties: + resource: + type: string + format: binary + description: BPMN process definition file (.bpmn format only, max 4MB) + encoding: + resource: + contentType: application/octet-stream responses: 201: description: Process definition deployed @@ -561,14 +563,9 @@ paths: in: query schema: type: string - enum: [name, bpmnProcessId, bpmnResourceName, version, key] + enum: [name, bpmnProcessId, bpmnProcessName, version, key] description: Sort field - - name: sortOrder - in: query - schema: - type: string - enum: [asc, desc] - description: Sort direction + - $ref: "#/components/parameters/sortOrder" - name: bpmnProcessId in: query schema: @@ -2861,3 +2858,11 @@ components: unresolved: type: integer description: Number of unresolved incidents + parameters: + sortOrder: + name: sortOrder + in: query + schema: + type: string + enum: [asc, desc] + description: "Sort direction" \ No newline at end of file diff --git a/package.json b/package.json index 57ecc8d..83ea53d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "prebuild": "orval", "predev": "pnpm prebuild", - "dev": "vite --mode mocks", + "dev": "vite", "dev:mocks": "pnpm dev --mode mocks", "dev:live": "pnpm dev --mode live", "build": "tsc -b && vite build", diff --git a/src/base/api/processDefinitions.ts b/src/base/api/processDefinitions.ts index a9bc7c1..006edcc 100644 --- a/src/base/api/processDefinitions.ts +++ b/src/base/api/processDefinitions.ts @@ -7,8 +7,11 @@ import type { ProcessDefinitionDetail, ProcessDefinitionSimple, ProcessDefinitionsPage, + CreateProcessDefinitionBody } from '@base/openapi'; +import { createProcessDefinition as createProcessDefinitionApi } from '@base/openapi'; + export type { ProcessDefinitionDetail, ProcessDefinitionSimple, ProcessDefinitionsPage }; // Statistics types @@ -82,8 +85,18 @@ export const getProcessDefinition = async ( * Deploy a process definition */ export const createProcessDefinition = async (xml: string): Promise => { - const response = await AXIOS_INSTANCE.post('/process-definitions', xml, { - headers: { 'Content-Type': 'application/xml' }, - }); - return response.data; + // Convert XML string to Blob + const blob = new Blob([xml], { type: 'application/xml' }); + + // Create request body for the generated client + const requestBody: CreateProcessDefinitionBody = { + resource: blob + }; + + // Call the generated client + const response = await createProcessDefinitionApi(requestBody); + const processDefinitionKey = response.processDefinitionKey; + + const detailResponse = await getProcessDefinition(processDefinitionKey); + return detailResponse; }; diff --git a/vite.config.ts b/vite.config.ts index c1cd45e..02a75ca 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -16,10 +16,10 @@ export default defineConfig({ server: { port: 3000, proxy: { - '/api': { + '/v1': { target: 'http://localhost:8080', changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, '/v1'), + // rewrite: (path) => path.replace(/^\/api/, '/v1'), }, }, },