diff --git a/rfcs/bpm_abstraction.md b/rfcs/bpm_abstraction.md new file mode 100644 index 0000000..aba375c --- /dev/null +++ b/rfcs/bpm_abstraction.md @@ -0,0 +1,46 @@ +# BPM Abstraction + +| Status | (Proposed / Accepted / Implemented / Obsolete) | +:-------------- |:---------------------------------------------------- | +| **RFC PR #** | [NNN](https://github.com/AOT-Technologies/forms-flow-ai/pull/NNN) (update when you have PR #)| +| **Author(s)** | Sumesh Kariyil (sumesh.pk@aot-technologies.com) | + + +## Objective + +Build an abstraction layer between BPM engine and other components + +## Motivation + +formsflow.ai currently relies on non-BPM features provided by BPM engine to fulfill some requirements. + +## Design Proposal + +- Come up with an API spec for the BPM ReST layer. [Ref](./bpm_abstraction/bpm_api_spec.yaml) +- Build an abstraction REST layer on the BPM engine to transform default requests and responses to match with API spec above. +- Change all components on formsflow.ai to work with a known API spec for BPM engine. +- Move non BPM features used from BPM engine to formsflow API. + +![BPM Integration](./bpm_abstraction/before_after.png "BPM Integration") + + + +### Alternatives Considered + +### Performance Implications +- Some of the API calls to BPM may need to call Web API + +### Dependencies + + + +### Compatibility (Existing implementation Impact) +- Need to create migration scripts to move existing metadata in BPM layer to Web API. + +## Detailed Design + +TBD + +## Thanks + +Thanks to tensforflow, react RFC templates. \ No newline at end of file diff --git a/rfcs/bpm_abstraction/before_after.png b/rfcs/bpm_abstraction/before_after.png new file mode 100644 index 0000000..dbd7476 Binary files /dev/null and b/rfcs/bpm_abstraction/before_after.png differ diff --git a/rfcs/bpm_abstraction/bpm_api_spec.yaml b/rfcs/bpm_abstraction/bpm_api_spec.yaml new file mode 100644 index 0000000..a3f409f --- /dev/null +++ b/rfcs/bpm_abstraction/bpm_api_spec.yaml @@ -0,0 +1,531 @@ +openapi: 3.1.0 +info: + title: BPM API Spec + version: '1.0' + summary: API Specification for the BPM layer + description: API Specification for the BPM layer + contact: + name: AOT Technologies + url: 'https://formsflow.ai/' + email: info@formsflow.ai + license: + name: Apache 2.0 + url: 'https://github.com/AOT-Technologies/forms-flow-ai' +servers: [] +basePath: /engine-rest-ext/v1/ +paths: + '/process-definition/key/{process-key}/start?tenantId={tenantId}': + parameters: + - schema: + type: string + name: process-key + in: path + required: true + description: Process Key + - schema: + type: string + name: tenantId + in: query + description: tenantId for tenant instance + post: + summary: Start a process instance + operationId: post-engine-rest-ext-v1-process-definition-key-process-key-start + responses: + '200': + description: OK + description: Start process instance + requestBody: + content: + application/json: + schema: + type: object + properties: {} + examples: + example-1: + value: + firstName: John + lastName: Doe + yearOfBirth: 1980 + isActive: true + description: '' + '/process-definition/key/{process-key}/xml?tenantId={tenantId}': + parameters: + - schema: + type: string + name: process-key + in: path + required: true + description: Process Key + - schema: + type: string + name: tenantId + in: path + required: true + - schema: + type: string + name: tenantId + in: query + description: tenantId for tenant process + get: + summary: Get process instance xml + operationId: post-engine-rest-ext-v1-process-definition-key-process-key-start + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ProcessXml' + examples: {} + description: Get process instance xml + requestBody: + content: + application/json: + schema: + type: object + properties: {} + examples: + example-1: + value: + firstName: John + lastName: Doe + yearOfBirth: 1980 + isActive: true + description: '' + '/process-definition/{id}': + parameters: + - schema: + type: string + name: id + in: path + description: Process definition id + required: true + get: + summary: Get process definition by id + tags: [] + responses: + '200': + description: User Found + content: + application/json: + schema: + $ref: '#/components/schemas/Process%20Definition' + examples: {} + '404': + description: User Not Found + operationId: get-process-definitions + description: Retrieve process definition + /process-definition: + get: + summary: List process definitions + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Process%20Definition' + operationId: get-engine-rest-ext-v1-process-definition + parameters: [] + '/process-instance/{id}/variables': + parameters: + - schema: + type: string + name: id + in: path + required: true + get: + summary: Get process instance variables + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: {} + examples: + example-1: + value: + firstName: John + lastName: Doe + yearOfBirth: 1980 + isActive: true + operationId: get-process-instance-id + '/process-instance/{id}': + parameters: + - schema: + type: string + name: id + in: path + required: true + get: + summary: Get process instance + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Process-Instance' + operationId: get-process-instance-id + '/process-instance/{id}/activity-instances': + parameters: + - schema: + type: string + name: id + in: path + required: true + get: + summary: TODO - is it needed ? Get activity instances for the diagram + tags: [] + responses: {} + operationId: get-process-instance-id-instances + /filters/tasks: + post: + summary: search filtered tasks + operationId: search-filters-tasks + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Task' + requestBody: + content: + application/json: + schema: + type: object + properties: {} + /tenant/authorization: + parameters: [] + post: + summary: '' + operationId: post-tenant-authorization + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TenantAuthorization' + /deployment/create: + post: + summary: Create a deployment + operationId: post-deployment-create + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Deployment' + '/task/{id}/submit': + parameters: + - schema: + type: string + name: id + in: path + required: true + post: + summary: Submit task + operationId: post-task-id-submit + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TaskSubmit' + '/task/{id}/unclaim': + parameters: + - schema: + type: string + name: id + in: path + required: true + post: + summary: '' + operationId: post-task-id-unclaim + responses: + '200': + description: OK + '/task/{id}/claim': + parameters: + - schema: + type: string + name: id + in: path + required: true + post: + summary: '' + operationId: post-task-id-claim + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TaskClaim' + '/task/{id}': + parameters: + - schema: + type: string + name: id + in: path + required: true + get: + summary: GET Task by id + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + operationId: get-task-id + '/task/{id}/variables': + parameters: + - schema: + type: string + name: id + in: path + required: true + get: + summary: Your GET endpoint + tags: [] + responses: {} + operationId: get-task-id-variables + '/task/{id}/identity-links': + parameters: + - schema: + type: string + name: id + in: path + required: true + get: + summary: Get candidate/identity links for a task + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TaskCandidateLink' + operationId: get-task-id-candidate + delete: + summary: Delete identity link from a task + operationId: delete-task-id-identity-links + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TaskCandidateLink' + post: + summary: '' + operationId: post-task-id-identity-links + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TaskCandidateLink' + /message: + post: + summary: Submit a message + operationId: post-message + responses: + '200': + description: OK + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Message' +components: + schemas: + Process Definition: + title: Process Definition + type: object + description: '' + examples: + - id: 142 + firstName: Alice + lastName: Smith + email: alice.smith@gmail.com + dateOfBirth: '1997-10-31' + emailVerified: true + signUpDate: '2019-08-24' + properties: + id: + type: string + description: Unique identifier for the given user. + key: + type: string + tenantId: + type: string + name: + type: string + format: email + description: + type: string + version: + type: integer + format: date + example: '1997-10-31' + resourceUri: + type: string + description: Set to true if the user's email has been verified. + deploymentId: + type: string + format: date + description: The date that the user was created. + suspended: + type: boolean + required: + - id + - key + - name + - description + - resourceUri + ProcessXml: + title: ProcessXml + type: object + properties: + xml: + type: string + Process-Instance: + title: Process-Instance + type: object + properties: + id: + type: string + processDefinitionUrl: + type: string + tenantId: + type: string + Task: + title: Task + type: object + properties: + id: + type: string + name: + type: string + assignee: + type: string + created: + type: string + due: + type: string + followUp: + type: string + description: + type: string + parentTaskId: + type: string + priority: + type: string + processDefinitionId: + type: string + processInstanceId: + type: string + taskDefinitionKey: + type: string + tenantId: + type: string + TenantAuthorization: + title: TenantAuthorization + type: object + properties: + tenantId: + type: string + adminRoles: + type: array + items: + type: string + designerRoles: + type: array + items: + type: string + clientRoles: + type: array + items: + type: string + reviewerRoles: + type: array + items: + type: string + Deployment: + title: Deployment + type: object + properties: + deploymentName: + type: string + deploymentSource: + type: string + tenantId: + type: string + enableDuplicateFiltering: + type: boolean + upload: + type: object + TaskSubmit: + title: TaskSubmit + type: object + properties: + formUrl: + type: string + applicationId: + type: string + webFormUrl: + type: string + action: + type: string + TaskClaim: + title: TaskClaim + type: object + properties: + userId: + type: string + TaskCandidateLink: + title: TaskCandidate + type: object + properties: + groupId: + type: string + type: + type: string + userId: + type: string + Message: + title: Message + type: object + properties: + messageName: + type: string + processInstanceId: + type: string + securitySchemes: + jwt: + type: openIdConnect + description: '' +security: + - jwt: []