@g1cloud/entity-modeler-next 5.0.0-beta.49 → 5.0.0-beta.50

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.
@@ -20,3 +20,17 @@ export declare function resolveEffectiveColumn(attr: Attribute, col: DbColumn, i
20
20
  * FK도 물리명 미지정 시 부모 PK 컬럼명을 그대로 쓰므로 자식 자기 컬럼과 충돌할 수 있다.
21
21
  */
22
22
  export declare function resolveColumnPhysicalName(attr: Attribute, col: DbColumn, index: number, entity: Entity | undefined, model: LogicalModel, ctx?: ColumnResolveContext): string;
23
+ /**
24
+ * 서브컬럼의 **선언 필드명** — 다중 컬럼 속성을 컬럼 단위로 표시할 때 각 슬롯이 선언원의 어느 필드인지.
25
+ *
26
+ * 축을 EMBED 두 종으로 한정하는 이유: 이 이름은 장식이 아니라 **`embeddableOverrides`의 키와 같은 축**이다
27
+ * (AI 경로가 `{field:"currency", …}`로 서브컬럼을 지목한다 — `agent/resolver.ts`). 그 op이 EMBED_PREDEF
28
+ * 에만 적용되므로 카탈로그 필드명이 곧 계약이고, EMBED_OWN 은 임베더블 소스 속성명(JPA 필드명)이 그에
29
+ * 대응한다. FK 등 나머지는 슬롯을 지목하는 어휘가 없고 **물리명이 곧 식별자**라 undefined 를 돌려준다
30
+ * (호출자가 물리명으로 폴백한다 — 없는 이름을 지어내지 않는다).
31
+ *
32
+ * ⚠️평탄화 순서는 `inheritedSlotOf`의 EMBED_OWN 분기와 **반드시 같아야** 한다(선언순 dbAttrs 이어붙이기).
33
+ * 어긋나면 라벨과 값이 서로 다른 슬롯을 가리키는 조용한 오답이 된다. 소스 속성이 다중 컬럼이면 그 이름이
34
+ * 슬롯 여럿에 반복되는데, 그것이 실제 구조(한 필드가 여러 컬럼)라 구분자를 덧붙이지 않는다.
35
+ */
36
+ export declare function slotFieldName(attr: Attribute, index: number, model: LogicalModel, ctx?: ColumnResolveContext): string | undefined;
@@ -0,0 +1,16 @@
1
+ import { Entity, IndexColumn, ModelId } from './types';
2
+ /** 한 인덱스의 정리 결과 — `columns` 는 정리 **후** 전량(패치가 통째 교체이므로). */
3
+ export type IndexColumnCleanup = {
4
+ indexRef: ModelId;
5
+ columns: IndexColumn[];
6
+ };
7
+ /**
8
+ * `entity` 에서 `removedAttributeIds` 가 사라질 때 정리해야 할 인덱스 목록.
9
+ *
10
+ * 고아가 되는 ref = 사라지는 속성의 **속성 modelId + 그 dbAttr modelId 전부**(두 표기 모두 유입 가능).
11
+ * 변화가 없는 인덱스는 결과에 넣지 않는다(빈 패치 방출 = INV-5 멱등 위배).
12
+ *
13
+ * ⚠️한 조작에서 여러 속성이 사라지면 **한 번에** 넘길 것 — 속성마다 따로 호출하면 각 산출이 원본 기준이라
14
+ * 나중 패치가 앞의 정리를 되돌린다.
15
+ */
16
+ export declare function planIndexColumnCleanup(entity: Entity, removedAttributeIds: readonly ModelId[]): IndexColumnCleanup[];
@@ -0,0 +1,27 @@
1
+ import { Attribute, DbColumn, ModelId } from './types';
2
+ /** 한 엔티티의 인덱스 columnRef 해소기. 두 표기(속성 modelId / dbAttr modelId)를 모두 받는다. */
3
+ export type IndexRefResolver = {
4
+ /** 이 ref 가 속한 속성(표시용). 다중 컬럼 속성 ref 도 여기선 해소된다. */
5
+ attributeOf(ref: ModelId): Attribute | undefined;
6
+ /**
7
+ * 이 ref 가 **특정하는 물리 컬럼**. undefined 면 컬럼이 특정되지 않은 것이다(다중 컬럼 속성 ref /
8
+ * 상속 · dangling). ⚠️`attributeOf` 가 있는데 이것이 없다 = *대상은 있으나 어느 컬럼인지 미지정*.
9
+ */
10
+ columnOf(ref: ModelId): DbColumn | undefined;
11
+ /**
12
+ * 비교용 정규 키 — **컬럼이 특정되면** 그 dbAttr modelId, 아니면 원문 그대로.
13
+ * 원문이 그대로 나오는 경우는 셋이다: 이미 dbAttr 표기 / 다중 컬럼 속성 ref(모호) / 상속·dangling.
14
+ */
15
+ canon(ref: ModelId): ModelId;
16
+ };
17
+ /**
18
+ * 엔티티 속성 목록으로 해소기를 만든다. 인덱스는 **엔티티 로컬**이므로 그 엔티티 속성만 넘긴다
19
+ * (전역 맵을 쓰면 실 데이터의 modelId 중복[N-2 레거시 유입]에서 남의 엔티티 컬럼으로 해소된다 —
20
+ * `ddl.ts`의 `ownCols`가 같은 이유로 테이블 로컬이다).
21
+ */
22
+ export declare function indexRefResolver(attributes: readonly Attribute[]): IndexRefResolver;
23
+ /**
24
+ * 미해소 ref 의 진단 라벨 — 산출물(DDL 생략 주석·코드젠 fillIn)이 **고칠 자리를 지목**하도록 한다.
25
+ * ref 원문(UUID)만 내면 사용자가 어느 컬럼인지 찾을 수 없다.
26
+ */
27
+ export declare function describeIndexRef(r: IndexRefResolver, ref: ModelId): string;
@@ -1,4 +1,5 @@
1
1
  import { DisplayMode, LogicalModel } from './types';
2
+ import { ColumnResolveContext } from './columnResolve';
2
3
  /**
3
4
  * 표시 모드별 라벨(평문) — Diagram Explorer 트리/캡션 공용.
4
5
  * EntityNode의 labelSegs와 동일 의미 규칙: '논리'는 업무 논리명이며 없으면 '(논리명)'
@@ -8,4 +9,4 @@ import { DisplayMode, LogicalModel } from './types';
8
9
  * (`em.node.logicalMissing`)을 주입하고, 미주입 시 ko 기본값으로 폴백(codegen/테스트 무회귀).
9
10
  */
10
11
  export declare function displayLabel(mode: DisplayMode, code: string, logical: string | undefined, physical: string | undefined, logicalFallback?: string): string;
11
- export declare function entityModelToText(logical: LogicalModel): string;
12
+ export declare function entityModelToText(logical: LogicalModel, ctx?: ColumnResolveContext): string;
@@ -1,6 +1,30 @@
1
1
  import { Command, EditorState } from '../command/types';
2
2
  import { ReconcilePlan } from '../core/propagation';
3
3
  import { Attribute, DbColumn, Entity, LogicalModel, ModelId, Point } from '../core/types';
4
+ /**
5
+ * 한 조작이 지우는 속성의 누산기 — 인덱스 컬럼 정리를 **조작당 한 번**만 방출하기 위한 것.
6
+ *
7
+ * ★왜 누산해야 하나: 정리 패치(`index.update`)는 `columns` 배열을 **통째로 교체**하고, 계획은
8
+ * 구성 시점에 고정된다(결정적 redo). 그래서 같은 엔티티의 속성을 두 경로가 각각 지우면서 각자
9
+ * 정리를 내면 **뒤 패치가 앞 정리를 되돌린다** — 자기참조 관계가 정확히 그 형상이다(관계 삭제 시
10
+ * 부모 inverse nav 제거와 자식 FK reconcile 제거가 *같은 엔티티*에 떨어진다). 사이트마다 이 배열을
11
+ * 넘기고 마지막에 `indexCleanupCommands`를 한 번 부르면 그 충돌이 구조적으로 불가능해진다
12
+ * (resolver 가 `OrderAllocator`·`removedAttrDedup`을 스레딩하는 것과 같은 관용구).
13
+ */
14
+ export type RemovedAttributes = {
15
+ entityId: ModelId;
16
+ attributeId: ModelId;
17
+ }[];
18
+ /**
19
+ * 속성 제거 명령 — **`cmd.removeAttribute`를 직접 부르지 않고 항상 이것을 쓴다.** 제거 사실을
20
+ * `removed`에 기록해 인덱스 정리가 빠지지 않게 한다(그 누락이 이 트랙이 고치는 결함이다).
21
+ */
22
+ export declare function removeAttributeCommands(entityId: ModelId, attributeIds: readonly ModelId[], removed: RemovedAttributes): Command[];
23
+ /**
24
+ * 누산된 제거가 남길 인덱스 dangling 정리 명령 — 조작의 서브명령 **맨 끝**에 한 번 붙인다.
25
+ * `logical`은 제거 **전** 상태여야 한다(사라지는 속성의 dbAttr modelId를 알아야 하므로).
26
+ */
27
+ export declare function indexCleanupCommands(logical: LogicalModel, removed: RemovedAttributes): Command[];
4
28
  /**
5
29
  * 식별자 전파 reconcile 계획을 자식 엔터티 대상 서브명령 배열로 변환.
6
30
  * 1차 변경(관계 생성/삭제 등)과 함께 composite로 묶으면 전파 FK 동기화가 하나의 undo/redo
@@ -31,7 +55,7 @@ import { Attribute, DbColumn, Entity, LogicalModel, ModelId, Point } from '../co
31
55
  * 서버에 clear로 도달한다. 즉 위 판단은 이제 **전송 제약이 아니라 도메인 판단**으로만 서 있다(해제해도
32
56
  * 무해하지만 얻는 것이 없다). 해제로 전환하려면 CC-3 복구 트랙에서 함께 결정할 것.
33
57
  */
34
- export declare function reconcilePlanToCommands(logical: LogicalModel, childId: ModelId, plan: ReconcilePlan): Command[];
58
+ export declare function reconcilePlanToCommands(logical: LogicalModel, childId: ModelId, plan: ReconcilePlan, removed: RemovedAttributes): Command[];
35
59
  /** logical을 얕게 복제하되 한 엔터티의 attributes만 transform 결과로 교체(읽기 전용 전파 계획 입력용). */
36
60
  export declare function withEntityAttributes(logical: LogicalModel, entityId: ModelId, transform: (attrs: Attribute[]) => Attribute[]): LogicalModel;
37
61
  /**
@@ -44,14 +68,14 @@ export declare function withEntityAttributes(logical: LogicalModel, entityId: Mo
44
68
  * 이 seam을 고른 이유: 속성 추가·수정·삭제·임베더블 전환의 모든 진입점이 이미 여기를 지나므로
45
69
  * 트리거를 한 곳에만 두면 되고, 서브명령이 같은 composite에 실려 **undo가 원자적**이다.
46
70
  */
47
- export declare function cascadeCommands(futureLogical: LogicalModel, parentId: ModelId): Command[];
71
+ export declare function cascadeCommands(futureLogical: LogicalModel, parentId: ModelId, removed: RemovedAttributes): Command[];
48
72
  /**
49
73
  * "자식의 FK 집합이 직접 바뀌는" 트리거(관계 삭제·identifying 토글)용 연쇄 서브명령.
50
74
  * 1) seed 자식을 직접 reconcile(FK 증감/플립), 2) 그 변화를 적용한 상태로 후손 cascade.
51
75
  * (부모 식별자 자체가 바뀌는 트리거는 부모 자신 reconcile이 불필요해 cascadeCommands를 직접 쓴다.)
52
76
  * futureLogical은 트리거 변경이 이미 반영된 상태여야 한다(construction 시점 계획 고정).
53
77
  */
54
- export declare function childReconcileWithCascade(futureLogical: LogicalModel, childId: ModelId): Command[];
78
+ export declare function childReconcileWithCascade(futureLogical: LogicalModel, childId: ModelId, removed: RemovedAttributes): Command[];
55
79
  export declare function flattenEmbeddableColumns(embeddable: Entity): DbColumn[];
56
80
  /**
57
81
  * 임베더블 → 일반 엔터티 역전환의 부수 명령(stereotype update 명령에 합성).