Skip to content

Commit c2ab98d

Browse files
committed
add ShapeUtil.artifactKinds
1 parent b1e7b2c commit c2ab98d

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/model/bpmn/internal/shape/utils.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,18 @@ export class ShapeUtil {
118118
return kind == ShapeBpmnElementKind.POOL || kind == ShapeBpmnElementKind.LANE;
119119
}
120120

121+
/**
122+
* @since 0.48.0
123+
*/
124+
static artifactKinds(): ShapeBpmnElementKind[] {
125+
return [...ARTIFACT_KINDS];
126+
}
127+
121128
/**
122129
* @since 0.48.0
123130
*/
124131
static isArtifact(kind: ShapeBpmnElementKind | string): boolean {
125-
return kind === ShapeBpmnElementKind.GROUP || kind === ShapeBpmnElementKind.TEXT_ANNOTATION;
132+
return ARTIFACT_KINDS.includes(kind as ShapeBpmnElementKind);
126133
}
127134
}
128135

@@ -149,6 +156,8 @@ const FLOW_NODE_WITH_DEFAULT_SEQUENCE_FLOW_KINDS = new Set([
149156
ShapeBpmnElementKind.GATEWAY_COMPLEX,
150157
]);
151158

159+
const ARTIFACT_KINDS = [ShapeBpmnElementKind.GROUP, ShapeBpmnElementKind.TEXT_ANNOTATION];
160+
152161
/**
153162
* Elements that are effectively used in BPMN diagram as base for eventDefinition i.e all {@link ShapeBpmnEventDefinitionKind} elements except {@link ShapeBpmnEventDefinitionKind.NONE}
154163
* @internal

test/unit/model/bpmn/internal/shape/utils.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ describe('ShapeUtil', () => {
3737
expect(flowNodeKinds).not.toContain(ShapeBpmnElementKind.POOL);
3838
});
3939

40+
it('artifact kinds', () => {
41+
const artifacts = ShapeUtil.artifactKinds();
42+
expect(artifacts).toContain(ShapeBpmnElementKind.GROUP);
43+
expect(artifacts).toContain(ShapeBpmnElementKind.TEXT_ANNOTATION);
44+
});
45+
4046
describe('Is pool or lane?', () => {
4147
it.each([
4248
[ShapeBpmnElementKind.CALL_ACTIVITY],
@@ -98,6 +104,7 @@ describe('ShapeUtil', () => {
98104
it.each`
99105
kind | kindsFunction
100106
${'activities'} | ${() => ShapeUtil.activityKinds()}
107+
${'artifacts'} | ${() => ShapeUtil.artifactKinds()}
101108
${'events'} | ${() => ShapeUtil.eventKinds()}
102109
${'flow nodes'} | ${() => ShapeUtil.flowNodeKinds()}
103110
${'gateways'} | ${() => ShapeUtil.gatewayKinds()}

0 commit comments

Comments
 (0)