mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-29 16:11:01 +03:00
feat(meta-compile,meta-decompile): состав плана обмена — Content.xml (v1.42/v0.31)
Соседний Ext/Content.xml (состав плана обмена: объекты-участники + признак
авторегистрации) был вне скоупа раундтрипа → при декомпиляции→компиляции состав
терялся (компилятор писал пустой <ExchangePlanContent/>, декомпилятор не захватывал).
DSL content/Состав: массив MDObjectRef — строка "Type.Name" (AutoRecord=Deny,
дефолт) / "Type.Name: autoRecord" (Allow; токен-признак autoRecord/АвтоРегистрация,
регистронезав.; прощающе : Allow/: Разрешить) ЛИБО объект {metadata, autoRecord:
bool|Allow/Deny/Разрешить/Запретить} (синонимы Метаданные/объект, АвтоРегистрация).
Декомпилятор пишет короткую строковую форму.
Class-2 фикс заголовка: пустой <ExchangePlanContent/> писался с 2 namespace,
реальный 1С — с 4 (+xmlns:xs/xsi); чинил и пустой шаблон.
Роундтрип 42 ЭП (acc+erp): match 39/42, TOTAL 146 без новых диффов (остаток —
известный хвост TS-LineNumber/FillValue-пробелы). Регресс 48/48 ps1+py, ps1↔py
identical. 1С-cert ✓ (пустой 4-ns корень + непустой состав); verify-snapshots
расширен: getStructuralDeps стабит объекты состава ЭП по MDObjectRef + стаб Constant.
spec §7.2a, кейс exchange-plan-content.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
126ce0bbd8
commit
11e7abfc3f
@@ -1,4 +1,4 @@
|
||||
# meta-decompile v0.30 — XML объекта метаданных 1С → JSON-черновик формата meta-compile
|
||||
# meta-decompile v0.31 — XML объекта метаданных 1С → JSON-черновик формата meta-compile
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
#
|
||||
# Поддержаны: Catalog, ExchangePlan, ChartOfCharacteristicTypes, ChartOfAccounts. Инверс meta-compile (omit-on-default: ключ эмитим только
|
||||
@@ -898,6 +898,27 @@ if (Test-Path -LiteralPath $predefPath) {
|
||||
if ($rootItems.Count -gt 0) { $dsl['predefined'] = $rootItems }
|
||||
}
|
||||
|
||||
# --- Состав плана обмена (соседний Ext/Content.xml) → DSL content (ExchangePlan).
|
||||
# Каждый <Item>{<Metadata>MDRef</Metadata><AutoRecord>Deny|Allow</AutoRecord>}.
|
||||
# Deny (дефолт) → строка "MDRef"; Allow → "MDRef: autoRecord". ---
|
||||
if ($objType -eq 'ExchangePlan') {
|
||||
$contentPath = Join-Path (Join-Path (Join-Path $objDir $objName) 'Ext') 'Content.xml'
|
||||
if (Test-Path -LiteralPath $contentPath) {
|
||||
$cdoc = New-Object System.Xml.XmlDocument
|
||||
$cdoc.Load($contentPath)
|
||||
$contentItems = [System.Collections.ArrayList]@()
|
||||
foreach ($it in @($cdoc.DocumentElement.SelectNodes("*[local-name()='Item']"))) {
|
||||
$mdEl = $it.SelectSingleNode("*[local-name()='Metadata']")
|
||||
if (-not $mdEl -or -not $mdEl.InnerText) { continue }
|
||||
$ref = $mdEl.InnerText
|
||||
$arEl = $it.SelectSingleNode("*[local-name()='AutoRecord']")
|
||||
$ar = if ($arEl) { $arEl.InnerText } else { 'Deny' }
|
||||
if ($ar -eq 'Allow') { [void]$contentItems.Add("${ref}: autoRecord") } else { [void]$contentItems.Add($ref) }
|
||||
}
|
||||
if ($contentItems.Count -gt 0) { $dsl['content'] = $contentItems }
|
||||
}
|
||||
}
|
||||
|
||||
# === Вывод ===
|
||||
$json = ConvertTo-CompactJson $dsl 0
|
||||
if ($OutputPath) {
|
||||
|
||||
Reference in New Issue
Block a user