@g1cloud/bpmn-modeler-next 5.0.0-alpha.3 → 5.0.0-alpha.4

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.
@@ -1,6 +1,7 @@
1
1
  import { BpmnDocumentModelerLike } from '../core/modelerLike';
2
2
  import { SymbolicOp } from './symbolicOp';
3
3
  import { ResolveIssue } from './resolver';
4
+ import { GeometryFinding } from './geometryAudit';
4
5
  /** op 출처 — 감사·정책 분기용. `gui` = 호스트 채팅 패널, `rest` = 외부 브리지. */
5
6
  export type BpmnOpOrigin = 'agent' | 'gui' | 'rest';
6
7
  export interface BpmnOpBatch {
@@ -29,10 +30,17 @@ export declare function buildBpmnOpBatch(documentId: string, baseVersion: number
29
30
  * - `conflict` → 에이전트가 read 부터 다시(재-ground 후 재생성). op 재전송은 무의미
30
31
  * - `rejected` → 어휘·참조 문제라 op 를 고쳐 재전송
31
32
  */
32
- export type ApplyBatchOutcome = {
33
+ export type ApplyBatchOutcome =
34
+ /**
35
+ * `findings` = 이 배치가 **새로 만든** 기하 결함(B-9). 거부가 아니라 품질 소견이라
36
+ * `rejected` 로 가지 않는다 — 문서는 이미 적용됐고 고칠지는 읽는 쪽이 정한다.
37
+ * 선재 결함은 담기지 않는다(하강 전후 diff). 문서 전체 감사는 `auditBpmnGeometry`.
38
+ */
39
+ {
33
40
  status: 'applied';
34
41
  version: number;
35
42
  xml: string;
43
+ findings: GeometryFinding[];
36
44
  } | {
37
45
  status: 'conflict';
38
46
  baseVersion: number;
@@ -0,0 +1,78 @@
1
+ import { default as ElementRegistry } from 'diagram-js/lib/core/ElementRegistry';
2
+ import { ModdleElement, ParseWarning } from '../adapter/xml';
3
+ export interface GeometryPoint {
4
+ x: number;
5
+ y: number;
6
+ }
7
+ export interface GeometryShape {
8
+ id: string;
9
+ /** bpmn 타입(`bpmn:Task` 등) — 판정 제외 규칙과 보고 맥락에 쓴다. */
10
+ type: string;
11
+ x: number;
12
+ y: number;
13
+ width: number;
14
+ height: number;
15
+ /** 다른 요소를 담는 도형(풀·레인·그룹·확장 서브프로세스) — 판정 대상에서 제외된다. */
16
+ container: boolean;
17
+ /** 경계 이벤트처럼 **호스트에 붙는 것이 정상**인 도형 — 겹침 판정에서 제외된다. */
18
+ attached: boolean;
19
+ }
20
+ export interface GeometryEdge {
21
+ id: string;
22
+ type: string;
23
+ waypoints: GeometryPoint[];
24
+ /** 이 간선이 자기 끝점으로 삼는 도형 id 들 — 그 도형과의 교차는 도킹이라 관통이 아니다. */
25
+ endpoints: readonly string[];
26
+ }
27
+ /** 판정기가 대면하는 최소 입력 — 좌표만 담는다(의미론 없음). */
28
+ export interface GeometryScene {
29
+ shapes: GeometryShape[];
30
+ edges: GeometryEdge[];
31
+ }
32
+ export type GeometryFinding =
33
+ /**
34
+ * 간선이 자기 끝점이 아닌 도형을 관통한다. 원인은 대개 **라우팅**이지 힌트가 아니다 —
35
+ * bpmn-js 는 장애물을 회피하지 않으므로 두 노드가 같은 축에 놓이면 그 사이를 지나간다.
36
+ */
37
+ {
38
+ kind: 'edge-crosses-shape';
39
+ edge: string;
40
+ shape: string;
41
+ }
42
+ /**
43
+ * 두 도형이 겹친다. `identical` = bounds 가 완전히 같다 — **사람 눈으로 볼 수 없는**
44
+ * 클래스라 따로 표시한다(하나가 다른 하나를 가린다).
45
+ */
46
+ | {
47
+ kind: 'shape-overlap';
48
+ shapes: [string, string];
49
+ identical: boolean;
50
+ };
51
+ /** 발견을 전후 비교(배치가 새로 만든 것 가려내기)할 수 있게 하는 안정 키. */
52
+ export declare function geometryFindingKey(finding: GeometryFinding): string;
53
+ /**
54
+ * 기하 판정 (순수). 결과는 **결정론적 순서**로 정렬해 반환한다 — 전후 diff·골든 비교·회귀
55
+ * 고정이 전부 순서에 의존한다.
56
+ *
57
+ * 복잡도는 O(간선×구간×도형 + 도형²) 이고 공간 색인을 두지 않았다. 실측 규모(도형 23·간선 25)
58
+ * 에서 무시할 수준이고, 색인은 실제로 큰 문서가 관찰될 때 넣는다(조기 최적화 회피).
59
+ */
60
+ export declare function auditGeometry(scene: GeometryScene): GeometryFinding[];
61
+ /**
62
+ * moddle `definitions` → 장면. 입력은 `describeProcess` 와 같은 트리라 캔버스·헤드리스 양쪽
63
+ * 에서 같은 것을 준다(A-6 입력 계약 동형).
64
+ */
65
+ export declare function sceneFromDefinitions(definitions: ModdleElement): GeometryScene;
66
+ /** 저장 진실 기준 전수 판정 — 그 문서에 있는 **전부**(선재 결함 포함). */
67
+ export declare function auditBpmnGeometry(definitions: ModdleElement): GeometryFinding[];
68
+ export interface AuditBpmnGeometryXmlResult {
69
+ findings: GeometryFinding[];
70
+ warnings: ParseWarning[];
71
+ }
72
+ /** XML 문자열 입력 래퍼 (`describeProcessXml` 대칭) — 호스트가 저장본을 그대로 감사한다. */
73
+ export declare function auditBpmnGeometryXml(xml: string): Promise<AuditBpmnGeometryXmlResult>;
74
+ /**
75
+ * 하강 직후의 실제 상태. DI 는 `BpmnUpdater` 가 커맨드마다 동기화하지만, 하강 경로에서는
76
+ * **registry 가 1차 진실**이므로 그쪽을 읽는다(한 단계 덜 거친다).
77
+ */
78
+ export declare function sceneFromRegistry(registry: ElementRegistry): GeometryScene;
@@ -10,6 +10,15 @@ export interface DocumentIndex {
10
10
  lanesOf(participantId: string): readonly string[];
11
11
  /** 플로우 노드가 속한 참여자 id (풀 없는 단일 프로세스 문서면 undefined) */
12
12
  participantOf(nodeId: string): string | undefined;
13
+ /**
14
+ * 연결의 현재 양 끝점 id — 끝점 재배선(`sequenceFlow.update` 의 source/target)에서
15
+ * **한쪽만 지정한 경우** 나머지 끝을 알아야 풀 정합을 검증할 수 있다.
16
+ * undefined = 그 id 가 문서에 없거나 연결이 아님. 끝점이 없는 연결은 필드가 undefined.
17
+ */
18
+ endpointsOf(connectionId: string): {
19
+ source?: string;
20
+ target?: string;
21
+ } | undefined;
13
22
  }
14
23
  /** elementRegistry 어댑터 — 하강 직전 실문서 상태를 대변한다. */
15
24
  export declare function buildRegistryIndex(registry: ElementRegistry): DocumentIndex;
@@ -1,6 +1,7 @@
1
1
  import { BpmnModelerLike } from '../../core/modelerLike';
2
2
  import { SymbolicOp } from '../symbolicOp';
3
3
  import { ResolveIssue } from './issues';
4
+ import { GeometryFinding } from '../geometryAudit';
4
5
  import { lowerOps } from './lower';
5
6
  export type { ResolveIssue } from './issues';
6
7
  export type { DocumentIndex, ElementCategory } from './documentIndex';
@@ -10,5 +11,14 @@ export { lowerOps, resolverServicesOf, type ResolverServices } from './lower';
10
11
  export interface ApplyBpmnOpsResult {
11
12
  ok: boolean;
12
13
  issues: ResolveIssue[];
14
+ /**
15
+ * 이 배치가 **새로 만든** 기하 결함(B-9). `issues` 와 채널이 다른 이유는 성격이 다르기
16
+ * 때문이다 — issue 는 "하강할 수 없다"(→ `ok: false` → 롤백)이고 finding 은 유효하게
17
+ * 적용된 뒤의 품질 소견이다. 여기 값이 있어도 `ok` 는 참이고 문서는 이미 바뀌었다.
18
+ *
19
+ * **전후 diff 라 선재 결함은 담기지 않는다** — 남의 결함까지 돌려주면 에이전트가 그것을
20
+ * 자기 배치 탓으로 읽고 무한 교정에 빠진다. 문서 전체 감사는 `auditBpmnGeometry`.
21
+ */
22
+ findings: GeometryFinding[];
13
23
  }
14
24
  export declare function applyBpmnOps(modeler: BpmnModelerLike, ops: readonly SymbolicOp[], lower?: typeof lowerOps): ApplyBpmnOpsResult;
@@ -62,11 +62,23 @@ export type SymbolicOp =
62
62
  name?: string | null;
63
63
  lane?: string;
64
64
  type?: IrFlowNodeType;
65
- } | {
65
+ }
66
+ /**
67
+ * `source`/`target` = 끝점 재배선(B-6 승격). 한쪽만 줘도 되고(나머지 보존) 새 끝점은
68
+ * **같은 배치에서 추가한 노드여도 된다** — 중간 삽입("A 다음에 X 를 넣어라")이 이것 하나로
69
+ * 표현되어 `element.remove` + 재연결 배치를 강요하지 않는다. resolver 는 `modeling.reconnect`
70
+ * 로 하강하고 경로는 라우터가 재산출한다(기존 벤드포인트는 버린다).
71
+ *
72
+ * ⚠ `messageFlow.update` 에는 아직 없다 — 끝점 이동 수요가 sequenceFlow 로만 관측됐고
73
+ * 어휘는 additive-only(불변식 5)라 나중에 붙이는 비용이 같다.
74
+ */
75
+ | {
66
76
  kind: 'sequenceFlow.update';
67
77
  id: string;
68
78
  name?: string | null;
69
79
  condition?: IrFlowCondition | null;
80
+ source?: string;
81
+ target?: string;
70
82
  } | {
71
83
  kind: 'messageFlow.update';
72
84
  id: string;