@roottale/cms-core 0.58.0 → 0.60.0
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.
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs +11 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -12
- package/dist/index.d.ts +17 -12
- package/dist/index.js +11 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @roottale/cms-core
|
|
2
2
|
|
|
3
|
+
## 0.60.0
|
|
4
|
+
|
|
5
|
+
## 0.59.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- c0b3679: 공통 블록 배치 규칙의 유형 키를 컬렉션(`collectionKey`)에서 콘텐츠 모델(`modelKey`)로 바꾼다
|
|
10
|
+
(ADR-0109 Amendment 1 · ADR-0105). `SitePatternPlacementRule.modelKey`,
|
|
11
|
+
`findSitePatternPlacementRule`/`setSitePatternPlacementRule`/`resolvePatternSlots` 가 `modelKey` 를
|
|
12
|
+
받는다. 저장된 옛 규칙의 `collectionKey` 필드는 `readSitePatternPlacements` 가 `modelKey` 로 읽는다.
|
|
13
|
+
공개 API 응답 모양(`pattern_slots`)은 그대로이며, 계산 근거가 글의 `model_key` 로 바뀐다 —
|
|
14
|
+
컬렉션 설정이 없는 사이트 글·2단계 분류 모델(FAQ)·모델 key 와 컬렉션 key 가 다른 글도 유형별
|
|
15
|
+
규칙을 받는다. cms-mcp `api-reference.md` 의 `pattern_slots` 설명을 맞춘다.
|
|
16
|
+
|
|
3
17
|
## 0.58.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1566,34 +1566,31 @@ function readSitePatternPlacements(raw) {
|
|
|
1566
1566
|
if (!isRecord(item)) continue;
|
|
1567
1567
|
const slot = typeof item.slot === "string" ? item.slot : "";
|
|
1568
1568
|
if (!isSitePatternSlotKey(slot)) continue;
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1569
|
+
const modelKey = readNullableKey(
|
|
1570
|
+
item.modelKey === void 0 ? item.collectionKey : item.modelKey
|
|
1571
|
+
);
|
|
1572
|
+
if (modelKey === void 0) continue;
|
|
1571
1573
|
const patternKey = readNullableKey(item.patternKey);
|
|
1572
1574
|
if (patternKey === void 0) continue;
|
|
1573
1575
|
if (patternKey !== null && !isValidSitePatternKey(patternKey)) continue;
|
|
1574
|
-
byTarget.set(`${slot}\0${
|
|
1576
|
+
byTarget.set(`${slot}\0${modelKey ?? ""}`, {
|
|
1575
1577
|
slot,
|
|
1576
|
-
|
|
1578
|
+
modelKey,
|
|
1577
1579
|
patternKey
|
|
1578
1580
|
});
|
|
1579
1581
|
}
|
|
1580
1582
|
return { rules: [...byTarget.values()] };
|
|
1581
1583
|
}
|
|
1582
|
-
function findSitePatternPlacementRule(placements, slot,
|
|
1583
|
-
return placements.rules.find(
|
|
1584
|
-
(rule) => rule.slot === slot && rule.collectionKey === collectionKey
|
|
1585
|
-
);
|
|
1584
|
+
function findSitePatternPlacementRule(placements, slot, modelKey) {
|
|
1585
|
+
return placements.rules.find((rule) => rule.slot === slot && rule.modelKey === modelKey);
|
|
1586
1586
|
}
|
|
1587
1587
|
function setSitePatternPlacementRule(placements, target, patternKey) {
|
|
1588
1588
|
const rest = placements.rules.filter(
|
|
1589
|
-
(rule) => !(rule.slot === target.slot && rule.
|
|
1589
|
+
(rule) => !(rule.slot === target.slot && rule.modelKey === target.modelKey)
|
|
1590
1590
|
);
|
|
1591
1591
|
if (patternKey === void 0) return { rules: rest };
|
|
1592
1592
|
return {
|
|
1593
|
-
rules: [
|
|
1594
|
-
...rest,
|
|
1595
|
-
{ slot: target.slot, collectionKey: target.collectionKey, patternKey }
|
|
1596
|
-
]
|
|
1593
|
+
rules: [...rest, { slot: target.slot, modelKey: target.modelKey, patternKey }]
|
|
1597
1594
|
};
|
|
1598
1595
|
}
|
|
1599
1596
|
function emptyPatternSlots() {
|
|
@@ -1602,7 +1599,7 @@ function emptyPatternSlots() {
|
|
|
1602
1599
|
function resolvePatternSlots(post, placements, publishedKeys) {
|
|
1603
1600
|
const slots = emptyPatternSlots();
|
|
1604
1601
|
for (const slot of SITE_PATTERN_SLOTS) {
|
|
1605
|
-
const specific = post.
|
|
1602
|
+
const specific = post.modelKey !== null ? findSitePatternPlacementRule(placements, slot.key, post.modelKey) : void 0;
|
|
1606
1603
|
const rule = specific ?? findSitePatternPlacementRule(placements, slot.key, null);
|
|
1607
1604
|
const key = rule?.patternKey ?? null;
|
|
1608
1605
|
slots[slot.key] = key !== null && publishedKeys.has(key) ? key : null;
|