-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REFACTOR] Remove json2typescript dependency #443
Changes from all commits
b84fdbd
080a1f5
a641b0c
b0baa07
c552e36
1d31f6b
6bbe134
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,9 @@ | |
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { JsonConverter } from 'json2typescript'; | ||
import { AbstractConverter, ensureIsArray } from './AbstractConverter'; | ||
import ShapeBpmnElement, { ShapeBpmnBoundaryEvent, ShapeBpmnEvent, ShapeBpmnSubProcess } from '../../../../model/bpmn/shape/ShapeBpmnElement'; | ||
import { ShapeBpmnElementKind } from '../../../../model/bpmn/shape/ShapeBpmnElementKind'; | ||
import { Process } from '../Definitions'; | ||
import { AssociationFlow, SequenceFlow } from '../../../../model/bpmn/edge/Flow'; | ||
import { ShapeBpmnEventKind, supportedBpmnEventKinds } from '../../../../model/bpmn/shape/ShapeBpmnEventKind'; | ||
import ShapeUtil, { BpmnEventKind } from '../../../../model/bpmn/shape/ShapeUtil'; | ||
|
@@ -68,10 +66,9 @@ interface EventDefinition { | |
counter: number; | ||
} | ||
|
||
@JsonConverter | ||
export default class ProcessConverter extends AbstractConverter<Process> { | ||
export default class ProcessConverter extends AbstractConverter<void> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ I thought that we would have been able to remove global 'converted' arrays and encapsulate them in a dedicated processing short life instance to avoid any side effect/concurrent accesses? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't think about that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so in another PR, later 😺 |
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
deserialize(processes: string | TProcess | (string | TProcess)[]): Process { | ||
deserialize(processes: string | TProcess | (string | TProcess)[]): void { | ||
try { | ||
// Deletes everything in the array, which does hit other references. For better performance. | ||
convertedFlowNodeBpmnElements.length = 0; | ||
|
@@ -82,8 +79,6 @@ export default class ProcessConverter extends AbstractConverter<Process> { | |
defaultSequenceFlowIds.length = 0; | ||
|
||
ensureIsArray(processes).forEach(process => this.parseProcess(process)); | ||
|
||
return {}; | ||
} catch (e) { | ||
// TODO error management | ||
console.error(e as Error); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,7 @@ function executeEventCommonTests( | |
}); | ||
|
||
it(`should NOT convert, when there are several '${eventDefinitionKind}EventDefinition' in the same element${specificTitle}, ${titleForEventDefinitionIsAttributeOf}`, () => { | ||
const eventDefinition = [{}, {}]; | ||
const eventDefinition = ['', {}]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normally, it was in the previous PR, but I think there was a problem in the rebase 😕 |
||
const json = buildDefinitionsAndProcessWithTask(); | ||
addEvent(json, bpmnKind, { ...buildEventDefinitionParameter, eventDefinition }, specificBuildEventParameter); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ import { TFlowNode } from '../../../../../src/component/parser/xml/bpmn-json-mod | |
import { BPMNPlane, BPMNShape } from '../../../../../src/component/parser/xml/bpmn-json-model/BPMNDI'; | ||
|
||
type BPMNTEvent = TCatchEvent | TThrowEvent | TBoundaryEvent; | ||
type BPMNEventDefinition = string | TEventDefinition | TEventDefinition[]; | ||
type BPMNEventDefinition = string | TEventDefinition | (string | TEventDefinition)[]; | ||
|
||
export enum EventDefinitionOn { | ||
NONE, | ||
|
@@ -140,7 +140,7 @@ export function addEventDefinitionsOnDefinition(jsonModel: BpmnJsonModel, buildP | |
const eventDefinition = buildParameter.eventDefinition ? buildParameter.eventDefinition : { id: 'event_definition_id' }; | ||
addEventDefinitions(jsonModel.definitions, { ...buildParameter, eventDefinition }); | ||
if (Array.isArray(eventDefinition)) { | ||
event.eventDefinitionRef = eventDefinition.map(eventDefinition => eventDefinition.id); | ||
event.eventDefinitionRef = eventDefinition.map(eventDefinition => (typeof eventDefinition === 'string' ? eventDefinition : eventDefinition.id)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as previous comment |
||
} else { | ||
event.eventDefinitionRef = (eventDefinition as TEventDefinition).id; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for the check removal