bpmn-moddle 0.12.3 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.travis.yml +2 -5
  2. package/lib/simple.js +3 -2
  3. package/package.json +5 -5
  4. package/resources/bpmn/json/bpmn.json +9 -7
  5. package/resources/bpmn/json/bpmndi.json +1 -1
  6. package/resources/bpmn-io/json/bioc.json +41 -0
  7. package/.npmignore +0 -6
  8. package/test/expect.js +0 -7
  9. package/test/fixtures/bpmn/activity-children.bpmn +0 -23
  10. package/test/fixtures/bpmn/callActivity-calledElement.part.bpmn +0 -7
  11. package/test/fixtures/bpmn/catch-event-dataOutputAssociations.part.bpmn +0 -5
  12. package/test/fixtures/bpmn/category.bpmn +0 -28
  13. package/test/fixtures/bpmn/complex.bpmn +0 -3680
  14. package/test/fixtures/bpmn/conversation-children.bpmn +0 -23
  15. package/test/fixtures/bpmn/data-object-reference.bpmn +0 -17
  16. package/test/fixtures/bpmn/definitions-children.bpmn +0 -13
  17. package/test/fixtures/bpmn/di/bpmnDiagram-extension.part.bpmn +0 -17
  18. package/test/fixtures/bpmn/di/bpmnDiagram.part.bpmn +0 -12
  19. package/test/fixtures/bpmn/di/bpmnEdge-waypoint.part.bpmn +0 -4
  20. package/test/fixtures/bpmn/di/bpmnEdge.part.bpmn +0 -5
  21. package/test/fixtures/bpmn/di/bpmnShape.part.bpmn +0 -4
  22. package/test/fixtures/bpmn/di-extension.bpmn +0 -26
  23. package/test/fixtures/bpmn/documentation-extension-elements.bpmn +0 -15
  24. package/test/fixtures/bpmn/documentation.bpmn +0 -11
  25. package/test/fixtures/bpmn/empty-definitions-default-ns.bpmn +0 -4
  26. package/test/fixtures/bpmn/empty-definitions.bpmn +0 -5
  27. package/test/fixtures/bpmn/error/binary.png +0 -0
  28. package/test/fixtures/bpmn/error/categoryValue.bpmn +0 -27
  29. package/test/fixtures/bpmn/error/di-no-bpmn-element.bpmn +0 -13
  30. package/test/fixtures/bpmn/error/duplicate-ids.bpmn +0 -8
  31. package/test/fixtures/bpmn/error/extension-definition-missing.bpmn +0 -6
  32. package/test/fixtures/bpmn/error/no-xml.txt +0 -1
  33. package/test/fixtures/bpmn/error/undeclared-ns-child.bpmn +0 -6
  34. package/test/fixtures/bpmn/error/unrecognized-child.bpmn +0 -6
  35. package/test/fixtures/bpmn/escalation-error.bpmn +0 -6
  36. package/test/fixtures/bpmn/event-references.part.bpmn +0 -6
  37. package/test/fixtures/bpmn/extension/camunda/inputOutput-list.part.bpmn +0 -9
  38. package/test/fixtures/bpmn/extension/camunda/inputOutput-map.part.bpmn +0 -12
  39. package/test/fixtures/bpmn/extension/camunda/inputOutput-mixed.part.bpmn +0 -13
  40. package/test/fixtures/bpmn/extension/camunda/inputOutput-plain.part.bpmn +0 -3
  41. package/test/fixtures/bpmn/extension/camunda/inputOutput-script.part.bpmn +0 -9
  42. package/test/fixtures/bpmn/extension/camunda/inputOutput.bpmn +0 -22
  43. package/test/fixtures/bpmn/extension/drools.part.bpmn +0 -9
  44. package/test/fixtures/bpmn/extension-attributes.bpmn +0 -20
  45. package/test/fixtures/bpmn/extension-elements.bpmn +0 -9
  46. package/test/fixtures/bpmn/inputOutputSpecification-children.bpmn +0 -19
  47. package/test/fixtures/bpmn/interface-implementationRef.part.bpmn +0 -2
  48. package/test/fixtures/bpmn/itemDefinition-structureRef.part.bpmn +0 -2
  49. package/test/fixtures/bpmn/lane-childLaneSets.part.bpmn +0 -8
  50. package/test/fixtures/bpmn/lane-children.bpmn +0 -46
  51. package/test/fixtures/bpmn/multiInstanceLoopCharacteristics-completionCondition.part.bpmn +0 -5
  52. package/test/fixtures/bpmn/multiInstanceLoopCharacteristics.bpmn +0 -181
  53. package/test/fixtures/bpmn/operation-implementationRef.part.bpmn +0 -2
  54. package/test/fixtures/bpmn/operation-messageRef.bpmn +0 -12
  55. package/test/fixtures/bpmn/participant-interfaceRef.bpmn +0 -20
  56. package/test/fixtures/bpmn/potentialOwner.bpmn +0 -11
  57. package/test/fixtures/bpmn/process-children.bpmn +0 -24
  58. package/test/fixtures/bpmn/scriptTask-script.part.bpmn +0 -4
  59. package/test/fixtures/bpmn/sequenceFlow-conditionExpression.part.bpmn +0 -5
  60. package/test/fixtures/bpmn/simple-default-ns.bpmn +0 -31
  61. package/test/fixtures/bpmn/simple.bpmn +0 -31
  62. package/test/fixtures/bpmn/sub-process-flow-nodes.part.bpmn +0 -8
  63. package/test/fixtures/bpmn/sub-process.part.bpmn +0 -10
  64. package/test/fixtures/bpmn/subprocess-flow-nodes-outgoing.part.bpmn +0 -16
  65. package/test/fixtures/bpmn/throw-event-dataInputAssociations.part.bpmn +0 -5
  66. package/test/fixtures/bpmn/timerEventDefinition.part.bpmn +0 -5
  67. package/test/fixtures/bpmn/vendor/signavio-complex-no-extensions.bpmn +0 -2151
  68. package/test/fixtures/bpmn/vendor/yaoqiang-event-definitions.bpmn +0 -396
  69. package/test/fixtures/bpmn/vendor.xsd +0 -14
  70. package/test/fixtures/bpmn/xsi-type.bpmn +0 -61
  71. package/test/fixtures/json/model/camunda.json +0 -224
  72. package/test/fixtures/json/model/drools.json +0 -24
  73. package/test/fixtures/xsd/BPMN20.xsd +0 -39
  74. package/test/fixtures/xsd/Vendor.xsd +0 -14
  75. package/test/helper.js +0 -23
  76. package/test/integration/camunda/read.js +0 -203
  77. package/test/integration/camunda/roundtrip.js +0 -48
  78. package/test/integration/camunda/write.js +0 -249
  79. package/test/integration/misc.js +0 -107
  80. package/test/matchers.js +0 -19
  81. package/test/spec/adapter/cmof/builder.js +0 -194
  82. package/test/spec/adapter/cmof/generate-simple.js +0 -548
  83. package/test/spec/bpmn-moddle.js +0 -208
  84. package/test/spec/xml/edit.js +0 -76
  85. package/test/spec/xml/read.js +0 -986
  86. package/test/spec/xml/roundtrip.js +0 -497
  87. package/test/spec/xml/write.js +0 -927
  88. package/test/xml-helper.js +0 -39
@@ -1,548 +0,0 @@
1
- 'use strict';
2
-
3
- var Builder = require('./builder');
4
-
5
-
6
- function makeStringRef(desc) {
7
- desc.type = 'String';
8
- delete desc.isReference;
9
- }
10
-
11
- describe('moddle BPMN 2.0 json', function() {
12
-
13
- describe('generate simple model', function() {
14
-
15
- it('transform BPMN20.cmof', function(done) {
16
-
17
- var builder = new Builder();
18
-
19
- builder.parse('resources/bpmn/cmof/BPMN20.cmof', function(pkg, cmof) {
20
-
21
- builder.cleanIDs();
22
- builder.cleanAssociations();
23
-
24
- // remove associations
25
- pkg.associations = [];
26
-
27
- pkg.xml = {
28
- tagAlias: 'lowerCase',
29
- typePrefix: 't'
30
- };
31
-
32
- builder.alter('BaseElement#id', {
33
- isId: true
34
- });
35
-
36
- // perform a translation from
37
- //
38
- // BaseElement
39
- // - extensionValues = [ ExtensionAttributeValue#value = ... ]
40
- //
41
- // to
42
- //
43
- // BaseElement
44
- // - extensionElements: ExtensionElements#values = [ ... ]
45
- //
46
- builder.alter('ExtensionAttributeValue#value', {
47
- name: 'values',
48
- isMany: true
49
- });
50
-
51
- builder.alter('BaseElement#extensionValues', function(p) {
52
- p.name = 'extensionElements';
53
-
54
- delete p.isMany;
55
- });
56
-
57
- builder.rename('extensionAttributeValue', 'extensionElements');
58
-
59
- builder.rename('extensionValues', 'extensionElements');
60
-
61
- builder.rename('ExtensionAttributeValue', 'ExtensionElements');
62
-
63
-
64
- // fix cryptic bpmn:Extension reference
65
- builder.alter('Extension#definition', {
66
- isAttr: true,
67
- isReference: true
68
- });
69
-
70
-
71
- // fix documentation being first element
72
-
73
- builder.alter('BaseElement', function(desc) {
74
- builder.reorderProperties(desc, [ 'id', 'documentation' ]);
75
- });
76
-
77
- // fix definitions children order
78
-
79
- builder.alter('Definitions', function(desc) {
80
- builder.reorderProperties(desc, [
81
- 'rootElements',
82
- 'diagrams',
83
- 'relationships'
84
- ]);
85
- });
86
-
87
- // fix ioSpec children order
88
-
89
- builder.alter('InputOutputSpecification', function(desc) {
90
- builder.reorderProperties(desc, [
91
- 'dataInputs',
92
- 'dataOutputs',
93
- 'inputSets',
94
- 'outputSets'
95
- ]);
96
- });
97
-
98
- builder.alter('Relationship#sources', function(desc) {
99
- desc.name = 'source';
100
- });
101
-
102
- builder.alter('Relationship#targets', function(desc) {
103
- desc.name = 'target';
104
- });
105
-
106
-
107
- // fix event dataInput/dataOutput associations
108
-
109
- builder.alter('CatchEvent#dataOutputAssociation', function(desc) {
110
- desc.name = 'dataOutputAssociations';
111
- });
112
-
113
- builder.alter('ThrowEvent#dataInputAssociation', function(desc) {
114
- desc.name = 'dataInputAssociations';
115
- });
116
-
117
- // fix catchEvent children order
118
-
119
- builder.alter('CatchEvent', function(desc) {
120
- builder.reorderProperties(desc, [
121
- 'dataOutputs',
122
- 'dataOutputAssociations',
123
- 'outputSet',
124
- 'eventDefinitions',
125
- 'eventDefinitionRefs',
126
- ]);
127
- });
128
-
129
- // fix throwEvent children order
130
-
131
- builder.alter('ThrowEvent', function(desc) {
132
- builder.reorderProperties(desc, [
133
- 'dataInputs',
134
- 'dataInputAssociations',
135
- 'inputSet',
136
- 'eventDefinitions',
137
- 'eventDefinitionRefs',
138
- ]);
139
- });
140
-
141
- // fix Collaboration child element order
142
- builder.alter('Collaboration', function(desc) {
143
-
144
- builder.reorderProperties(desc, [
145
- 'participants',
146
- 'messageFlows',
147
- 'artifacts',
148
- 'conversations',
149
- 'conversationAssociations',
150
- 'participantAssociations',
151
- 'messageFlowAssociations',
152
- 'correlationKeys',
153
- 'choreographyRef',
154
- 'conversationLinks'
155
- ]);
156
- });
157
-
158
- // fix PotentialOwner#resourceRef
159
-
160
- builder.alter('ResourceRole#resourceRef', function(desc) {
161
- delete desc.isAttr;
162
- });
163
-
164
- // fix missing ResourceAssignmentExpression parent
165
-
166
- builder.alter('ResourceAssignmentExpression', function(desc) {
167
- desc.superClass = [ 'BaseElement' ];
168
- });
169
-
170
-
171
- // fix positioning of elements
172
-
173
- builder.alter('FlowElementsContainer', function(desc) {
174
- builder.swapProperties(desc, 'laneSets', 'flowElements');
175
- });
176
-
177
- builder.alter('FlowNode', function(desc) {
178
- builder.swapProperties(desc, 'targetRef', 'sourceRef');
179
- builder.swapProperties(desc, 'incoming', 'outgoing');
180
- });
181
-
182
- builder.alter('DataAssociation', function(desc) {
183
- builder.reorderProperties(desc, [
184
- 'sourceRef',
185
- 'targetRef',
186
- 'transformation'
187
- ]);
188
- });
189
-
190
- builder.alter('DataAssociation#transformation', function(desc) {
191
- desc.xml = {
192
- 'serialize': 'property'
193
- };
194
- });
195
-
196
-
197
- // fix Activity order serialization
198
-
199
- builder.alter('Activity', function(desc) {
200
- builder.reorderProperties(desc, [
201
- 'ioSpecification',
202
- 'properties',
203
- 'dataInputAssociations',
204
- 'dataOutputAssociations',
205
- 'resources',
206
- 'loopCharacteristics'
207
- ]);
208
- });
209
-
210
-
211
- // fix *Refs -> Ref
212
-
213
- builder.alter('CallableElement#supportedInterfaceRefs', {
214
- name: 'supportedInterfaceRef'
215
- });
216
-
217
- builder.alter('Participant#interfaceRefs', {
218
- name: 'interfaceRef'
219
- });
220
-
221
- builder.alter('Operation#errorRefs', {
222
- name: 'errorRef'
223
- });
224
-
225
- builder.alter('ThrowEvent#eventDefinitionRefs', {
226
- name: 'eventDefinitionRef'
227
- });
228
-
229
- builder.alter('CatchEvent#eventDefinitionRefs', {
230
- name: 'eventDefinitionRef'
231
- });
232
-
233
- builder.alter('DataInput#inputSetRefs', {
234
- name: 'inputSetRef'
235
- });
236
-
237
- builder.alter('DataOutput#outputSetRefs', {
238
- name: 'outputSetRef'
239
- });
240
-
241
-
242
- builder.alter('Process', function(desc) {
243
-
244
- desc.properties.push({
245
- "name": "laneSets",
246
- "type": "LaneSet",
247
- "isMany": true,
248
- "replaces": "FlowElementsContainer#laneSets"
249
- });
250
-
251
- desc.properties.push({
252
- "name": "flowElements",
253
- "type": "FlowElement",
254
- "isMany": true,
255
- "replaces": "FlowElementsContainer#flowElements"
256
- });
257
-
258
- builder.reorderProperties(desc, [
259
- 'auditing',
260
- 'monitoring',
261
- 'properties',
262
- 'laneSets',
263
- 'flowElements',
264
- 'artifacts',
265
- 'resources',
266
- 'correlationSubscriptions',
267
- 'supports'
268
- ]);
269
- });
270
-
271
-
272
- builder.alter('SubProcess', function(desc) {
273
- desc.superClass.push('InteractionNode');
274
- });
275
-
276
- builder.alter('Documentation#text', function(prop) {
277
- prop.isBody = true;
278
- delete prop.isAttr;
279
- });
280
-
281
- builder.alter('ScriptTask#script', function(desc) {
282
- delete desc.isAttr;
283
- });
284
-
285
- builder.alter('TextAnnotation#text', function(desc) {
286
- delete desc.isAttr;
287
- });
288
-
289
- builder.alter('Expression', {
290
- isAbstract: true
291
- });
292
-
293
- // serialize Expression as xsi:type
294
- pkg.types.forEach(function(t) {
295
- (t.properties || []).forEach(function(p) {
296
- if (p.type === 'Expression') {
297
- p.xml = { serialize: 'xsi:type' };
298
- }
299
- });
300
- });
301
-
302
- // fix MultiMultiInstanceLoopCharacteristics
303
-
304
- builder.alter('MultiInstanceLoopCharacteristics#loopDataInputRef', function(desc) {
305
- delete desc.isAttr;
306
- });
307
-
308
- builder.alter('MultiInstanceLoopCharacteristics#loopDataOutputRef', function(desc) {
309
- delete desc.isAttr;
310
- });
311
-
312
- builder.alter('MultiInstanceLoopCharacteristics#inputDataItem', function(desc) {
313
- desc.xml = { serialize: 'property' };
314
- });
315
-
316
- builder.alter('MultiInstanceLoopCharacteristics#outputDataItem', function(desc) {
317
- desc.xml = { serialize: 'property' };
318
- });
319
-
320
- builder.alter('MultiInstanceLoopCharacteristics', function(desc) {
321
- builder.reorderProperties(desc, [
322
- 'outputDataItem',
323
- 'complexBehaviorDefinition',
324
- 'completionCondition'
325
- ]);
326
- });
327
-
328
-
329
- // make some references strings rather than references
330
- // (this way we are able to import it properly)
331
-
332
- builder.alter('Operation#implementationRef', function(desc) {
333
- desc.isAttr = true;
334
- makeStringRef(desc);
335
- });
336
-
337
- builder.alter('Interface#implementationRef', function(desc) {
338
- desc.isAttr = true;
339
- makeStringRef(desc);
340
- });
341
-
342
- builder.alter('ItemDefinition#structureRef', function(desc) {
343
- desc.isAttr = true;
344
- makeStringRef(desc);
345
- });
346
-
347
- builder.alter('CallActivity#calledElementRef', function(desc) {
348
- desc.name = 'calledElement';
349
- makeStringRef(desc);
350
- });
351
-
352
- builder.alter('Gateway#gatewayDirection', function(desc) {
353
- desc.default = 'Unspecified';
354
- });
355
-
356
- builder.alter('EventBasedGateway#eventGatewayType', function(desc) {
357
- desc.default = 'Exclusive';
358
- });
359
-
360
- builder.alter('CatchEvent#parallelMultiple', function(desc) {
361
- desc.default = false;
362
- });
363
-
364
- builder.alter('ParticipantMultiplicity#minimum', function(desc) {
365
- desc.default = 0;
366
- });
367
-
368
- builder.alter('ParticipantMultiplicity#maximum', function(desc) {
369
- desc.default = 1;
370
- });
371
-
372
- builder.alter('Activity#startQuantity', function(desc) {
373
- desc.default = 1;
374
- });
375
-
376
- builder.alter('Activity#completionQuantity', function(desc) {
377
- desc.default = 1;
378
- });
379
-
380
- builder.alter('DataAssociation#targetRef', function(desc) {
381
- delete desc.isAttr;
382
- });
383
-
384
- builder.alter('Lane#flowNodeRefs', {
385
- name: 'flowNodeRef'
386
- });
387
-
388
- builder.alter('Lane#childLaneSet', {
389
- xml: { serialize: 'xsi:type' }
390
- });
391
-
392
- builder.alter('Lane', function(desc) {
393
- builder.reorderProperties(desc, [
394
- 'partitionElement',
395
- 'flowNodeRef',
396
- 'childLaneSet'
397
- ]);
398
- });
399
-
400
- builder.alter('Escalation', {
401
- superClass: [ 'RootElement' ]
402
- });
403
-
404
- builder.alter('FormalExpression#body', {
405
- 'type': 'String',
406
- 'isBody': true
407
- });
408
-
409
- builder.alter('CallableElement#ioSpecification', function(desc) {
410
- desc.xml = { serialize: 'property' };
411
- });
412
-
413
- builder.alter('CallableElement#ioBinding', function(desc) {
414
- desc.xml = { serialize: 'property' };
415
- });
416
-
417
- builder.alter('Activity#ioSpecification', function(desc) {
418
- desc.xml = { serialize: 'property' };
419
- });
420
-
421
- // fix Operation attributes issue
422
- builder.alter('Operation#inMessageRef', function(desc) {
423
- delete desc.isAttr;
424
- });
425
-
426
- builder.alter('Operation#outMessageRef', function(desc) {
427
- delete desc.isAttr;
428
- });
429
-
430
- builder.exportTo('resources/bpmn/json/bpmn.json');
431
- }, done);
432
-
433
- });
434
-
435
-
436
- it('transform BPMNDI.cmof', function(done) {
437
-
438
- var builder = new Builder();
439
-
440
- builder.parse('resources/bpmn/cmof/BPMNDI.cmof', function(pkg) {
441
-
442
- builder.cleanIDs();
443
- builder.cleanAssociations();
444
-
445
- // remove associations
446
- pkg.associations = [];
447
-
448
- builder.alter('BPMNEdge#messageVisibleKind', function(desc) {
449
- desc.default = 'initiating';
450
- });
451
-
452
- builder.exportTo('resources/bpmn/json/bpmndi.json');
453
- }, done);
454
-
455
- });
456
-
457
-
458
- it('transform DI.cmof', function(done) {
459
-
460
- var builder = new Builder();
461
-
462
- builder.parse('resources/bpmn/cmof/DI.cmof', function(pkg, cmof) {
463
-
464
- builder.cleanIDs();
465
- builder.cleanAssociations();
466
-
467
- pkg.xml = {
468
- tagAlias: 'lowerCase'
469
- };
470
-
471
- // remove associations
472
- pkg.associations = [];
473
-
474
- pkg.types.push({
475
- name: 'Extension',
476
- properties: [
477
- {
478
- name: 'values',
479
- type: 'Element',
480
- isMany: true
481
- }
482
- ]
483
- });
484
-
485
- builder.alter('DiagramElement', function(data) {
486
-
487
- data.properties.unshift({
488
- name: 'extension',
489
- type: 'Extension'
490
- });
491
-
492
- data.properties.unshift({
493
- name: 'id',
494
- type: 'String',
495
- isAttr: true,
496
- isId: true
497
- });
498
- });
499
-
500
- builder.alter('Diagram', function(data) {
501
- data.properties.unshift({
502
- name: 'id',
503
- type: 'String',
504
- isAttr: true,
505
- isId: true
506
- });
507
- });
508
-
509
-
510
- builder.alter('Style', function(data) {
511
- (data.properties = data.properties || []).unshift({
512
- name: 'id',
513
- type: 'String',
514
- isAttr: true,
515
- isId: true
516
- });
517
- });
518
-
519
- builder.alter('Edge#waypoint', {
520
- xml: { serialize: 'xsi:type' }
521
- });
522
-
523
- builder.exportTo('resources/bpmn/json/di.json');
524
- }, done);
525
-
526
- });
527
-
528
-
529
- it('transform DC.cmof', function(done) {
530
-
531
- var builder = new Builder();
532
-
533
- builder.parse('resources/bpmn/cmof/DC.cmof', function(pkg, cmof) {
534
-
535
- builder.cleanIDs();
536
- builder.cleanAssociations();
537
-
538
- // remove associations
539
- pkg.associations = [];
540
-
541
- builder.exportTo('resources/bpmn/json/dc.json');
542
- }, done);
543
-
544
- });
545
-
546
- });
547
-
548
- });