mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-26 21:19:42 +03:00
Merge branch 'dev' into feature/web-test-runner
This commit is contained in:
@@ -241,6 +241,8 @@ powershell.exe -NoProfile -File .claude/skills/form-compile/scripts/form-compile
|
||||
|
||||
### Система типов
|
||||
|
||||
**Примитивные:**
|
||||
|
||||
| DSL | XML |
|
||||
|------------------------|----------------------------------------|
|
||||
| `"string"` / `"string(100)"` | `xs:string` + StringQualifiers |
|
||||
@@ -248,11 +250,38 @@ powershell.exe -NoProfile -File .claude/skills/form-compile/scripts/form-compile
|
||||
| `"decimal(10,0,nonneg)"` | с AllowedSign=Nonnegative |
|
||||
| `"boolean"` | `xs:boolean` |
|
||||
| `"date"` / `"dateTime"` / `"time"` | `xs:dateTime` + DateFractions |
|
||||
| `"CatalogRef.XXX"` | `cfg:CatalogRef.XXX` |
|
||||
| `"DocumentRef.XXX"` | `cfg:DocumentRef.XXX` |
|
||||
| `"ValueTable"` | `v8:ValueTable` |
|
||||
| `"ValueList"` | `v8:ValueListType` |
|
||||
| `"Type1 \| Type2"` | составной тип |
|
||||
|
||||
**Ссылочные и объектные (`cfg:Prefix.Name`):**
|
||||
|
||||
| DSL | Описание |
|
||||
|-----|----------|
|
||||
| `"CatalogRef.XXX"` / `"CatalogObject.XXX"` | Справочник |
|
||||
| `"DocumentRef.XXX"` / `"DocumentObject.XXX"` | Документ |
|
||||
| `"EnumRef.XXX"` | Перечисление |
|
||||
| `"DataProcessorObject.XXX"` / `"ReportObject.XXX"` | Обработка / Отчёт |
|
||||
| `"InformationRegisterRecordSet.XXX"` | Набор записей регистра сведений |
|
||||
| `"AccumulationRegisterRecordSet.XXX"` | Набор записей регистра накопления |
|
||||
| `"DynamicList"` | Динамический список |
|
||||
|
||||
Также допустимы: `ChartOfAccountsRef/Object`, `ChartOfCharacteristicTypesRef/Object`, `ChartOfCalculationTypesRef/Object`, `ExchangePlanRef/Object`, `BusinessProcessRef/Object`, `TaskRef/Object`, `AccountingRegisterRecordSet`, `InformationRegisterRecordManager`, `ConstantsSet`.
|
||||
|
||||
**Платформенные:**
|
||||
|
||||
| DSL | XML |
|
||||
|-----|-----|
|
||||
| `"ValueTable"` | `v8:ValueTable` |
|
||||
| `"ValueTree"` | `v8:ValueTree` |
|
||||
| `"ValueList"` | `v8:ValueListType` |
|
||||
| `"TypeDescription"` | `v8:TypeDescription` |
|
||||
| `"UUID"` | `v8:UUID` |
|
||||
| `"FormattedString"` | `v8ui:FormattedString` |
|
||||
| `"Picture"` / `"Color"` / `"Font"` | `v8ui:*` |
|
||||
| `"DataCompositionSettings"` | `dcsset:DataCompositionSettings` |
|
||||
| `"Type1 \| Type2"` | составной тип (несколько `<v8:Type>`) |
|
||||
|
||||
**Недопустимые типы (XDTO-ошибка при загрузке):**
|
||||
|
||||
> `FormDataStructure`, `FormDataCollection`, `FormDataTree` — runtime-типы 1С, не существуют в XML-схеме. Вместо них используйте `CatalogObject.XXX`, `DocumentObject.XXX`, `DataProcessorObject.XXX`, `ValueTable`, `ValueTree`.
|
||||
|
||||
## Связки: элемент + реквизит
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.0 — Compile 1C managed form from JSON
|
||||
# form-compile v1.1 — Compile 1C managed form from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
@@ -80,6 +80,20 @@ $script:formTypeSynonyms["бизнеспроцессссылка"] = "
|
||||
$script:formTypeSynonyms["задачассылка"] = "TaskRef"
|
||||
$script:formTypeSynonyms["определяемыйтип"] = "DefinedType"
|
||||
|
||||
# Known invalid types (runtime/UI types that don't exist in XDTO schema)
|
||||
$script:knownInvalidTypes = @{
|
||||
"FormDataStructure" = "Runtime type. Use cfg:*Object.XXX (e.g. CatalogObject.XXX)"
|
||||
"FormDataCollection" = "Runtime type. Use ValueTable"
|
||||
"FormDataTree" = "Runtime type. Use ValueTree"
|
||||
"FormDataTreeItem" = "Runtime type, not valid in XML"
|
||||
"FormDataCollectionItem"= "Runtime type, not valid in XML"
|
||||
"FormGroup" = "UI element type, not a data type"
|
||||
"FormField" = "UI element type, not a data type"
|
||||
"FormButton" = "UI element type, not a data type"
|
||||
"FormDecoration" = "UI element type, not a data type"
|
||||
"FormTable" = "UI element type, not a data type"
|
||||
}
|
||||
|
||||
function Resolve-TypeStr {
|
||||
param([string]$typeStr)
|
||||
if (-not $typeStr) { return $typeStr }
|
||||
@@ -219,15 +233,21 @@ function Emit-SingleType {
|
||||
}
|
||||
|
||||
# cfg: references (CatalogRef.XXX, DocumentObject.XXX, etc.)
|
||||
if ($typeStr -match '^(CatalogRef|CatalogObject|DocumentRef|DocumentObject|EnumRef|ChartOfAccountsRef|ChartOfCharacteristicTypesRef|ChartOfCalculationTypesRef|ExchangePlanRef|BusinessProcessRef|TaskRef|InformationRegisterRecordSet|AccumulationRegisterRecordSet|DataProcessorObject)\.') {
|
||||
if ($typeStr -match '^(CatalogRef|CatalogObject|DocumentRef|DocumentObject|EnumRef|ChartOfAccountsRef|ChartOfAccountsObject|ChartOfCharacteristicTypesRef|ChartOfCharacteristicTypesObject|ChartOfCalculationTypesRef|ChartOfCalculationTypesObject|ExchangePlanRef|ExchangePlanObject|BusinessProcessRef|BusinessProcessObject|TaskRef|TaskObject|InformationRegisterRecordSet|InformationRegisterRecordManager|AccumulationRegisterRecordSet|AccountingRegisterRecordSet|ConstantsSet|DataProcessorObject|ReportObject)\.') {
|
||||
X "$indent<v8:Type>cfg:$typeStr</v8:Type>"
|
||||
return
|
||||
}
|
||||
|
||||
# Fallback: emit as-is with cfg: prefix if contains dot, otherwise v8:
|
||||
# Fallback with validation
|
||||
if ($script:knownInvalidTypes.ContainsKey($typeStr)) {
|
||||
Write-Warning "Type '$typeStr': $($script:knownInvalidTypes[$typeStr])"
|
||||
}
|
||||
if ($typeStr.Contains('.')) {
|
||||
X "$indent<v8:Type>cfg:$typeStr</v8:Type>"
|
||||
} else {
|
||||
if (-not $script:knownInvalidTypes.ContainsKey($typeStr)) {
|
||||
Write-Warning "Unrecognized bare type '$typeStr' — will be emitted without namespace prefix"
|
||||
}
|
||||
X "$indent<v8:Type>$typeStr</v8:Type>"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.0 — Compile 1C managed form from JSON
|
||||
# form-compile v1.1 — Compile 1C managed form from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -202,11 +202,27 @@ DCS_MAP = {
|
||||
|
||||
CFG_REF_PATTERN = re.compile(
|
||||
r'^(CatalogRef|CatalogObject|DocumentRef|DocumentObject|EnumRef|'
|
||||
r'ChartOfAccountsRef|ChartOfCharacteristicTypesRef|ChartOfCalculationTypesRef|'
|
||||
r'ExchangePlanRef|BusinessProcessRef|TaskRef|'
|
||||
r'InformationRegisterRecordSet|AccumulationRegisterRecordSet|DataProcessorObject)\.'
|
||||
r'ChartOfAccountsRef|ChartOfAccountsObject|ChartOfCharacteristicTypesRef|ChartOfCharacteristicTypesObject|'
|
||||
r'ChartOfCalculationTypesRef|ChartOfCalculationTypesObject|'
|
||||
r'ExchangePlanRef|ExchangePlanObject|BusinessProcessRef|BusinessProcessObject|TaskRef|TaskObject|'
|
||||
r'InformationRegisterRecordSet|InformationRegisterRecordManager|'
|
||||
r'AccumulationRegisterRecordSet|AccountingRegisterRecordSet|'
|
||||
r'ConstantsSet|DataProcessorObject|ReportObject)\.'
|
||||
)
|
||||
|
||||
KNOWN_INVALID_TYPES = {
|
||||
'FormDataStructure': 'Runtime type. Use cfg:*Object.XXX (e.g. CatalogObject.XXX)',
|
||||
'FormDataCollection': 'Runtime type. Use ValueTable',
|
||||
'FormDataTree': 'Runtime type. Use ValueTree',
|
||||
'FormDataTreeItem': 'Runtime type, not valid in XML',
|
||||
'FormDataCollectionItem': 'Runtime type, not valid in XML',
|
||||
'FormGroup': 'UI element type, not a data type',
|
||||
'FormField': 'UI element type, not a data type',
|
||||
'FormButton': 'UI element type, not a data type',
|
||||
'FormDecoration': 'UI element type, not a data type',
|
||||
'FormTable': 'UI element type, not a data type',
|
||||
}
|
||||
|
||||
|
||||
_FORM_TYPE_SYNONYMS = {
|
||||
"строка": "string", "число": "decimal", "булево": "boolean",
|
||||
@@ -312,10 +328,14 @@ def emit_single_type(lines, type_str, indent):
|
||||
lines.append(f'{indent}<v8:Type>cfg:{type_str}</v8:Type>')
|
||||
return
|
||||
|
||||
# Fallback
|
||||
# Fallback with validation
|
||||
if type_str in KNOWN_INVALID_TYPES:
|
||||
print(f"WARNING: Type '{type_str}': {KNOWN_INVALID_TYPES[type_str]}", file=sys.stderr)
|
||||
if '.' in type_str:
|
||||
lines.append(f'{indent}<v8:Type>cfg:{type_str}</v8:Type>')
|
||||
else:
|
||||
if type_str not in KNOWN_INVALID_TYPES:
|
||||
print(f"WARNING: Unrecognized bare type '{type_str}' — will be emitted without namespace prefix", file=sys.stderr)
|
||||
lines.append(f'{indent}<v8:Type>{type_str}</v8:Type>')
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# form-validate v1.1 — Validate 1C managed form
|
||||
# form-validate v1.2 — Validate 1C managed form
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
@@ -667,6 +667,75 @@ if (-not $stopped -and -not $isExtension) {
|
||||
}
|
||||
}
|
||||
|
||||
# --- Check 12: Type values validation ---
|
||||
|
||||
$knownInvalidTypes = @(
|
||||
"FormDataStructure","FormDataCollection","FormDataTree","FormDataTreeItem","FormDataCollectionItem"
|
||||
"FormGroup","FormField","FormButton","FormDecoration","FormTable"
|
||||
)
|
||||
$validClosedTypes = @(
|
||||
"xs:boolean","xs:string","xs:decimal","xs:dateTime","xs:binary"
|
||||
"v8:FillChecking","v8:Null","v8:StandardPeriod","v8:StandardBeginningDate","v8:Type"
|
||||
"v8:TypeDescription","v8:UUID","v8:ValueListType","v8:ValueTable","v8:ValueTree"
|
||||
"v8:Universal","v8:FixedArray","v8:FixedStructure"
|
||||
"v8ui:Color","v8ui:Font","v8ui:FormattedString","v8ui:HorizontalAlign"
|
||||
"v8ui:Picture","v8ui:SizeChangeMode","v8ui:VerticalAlign"
|
||||
"dcsset:DataCompositionComparisonType","dcsset:DataCompositionFieldPlacement"
|
||||
"dcsset:Filter","dcsset:SettingsComposer","dcsset:DataCompositionSettings"
|
||||
"dcssch:DataCompositionSchema"
|
||||
"dcscor:DataCompositionComparisonType","dcscor:DataCompositionGroupType"
|
||||
"dcscor:DataCompositionPeriodAdditionType","dcscor:DataCompositionSortDirection","dcscor:Field"
|
||||
"ent:AccountType","ent:AccumulationRecordType","ent:AccountingRecordType"
|
||||
)
|
||||
$validCfgPrefixes = @(
|
||||
"AccountingRegisterRecordSet","AccumulationRegisterRecordSet"
|
||||
"BusinessProcessObject","BusinessProcessRef"
|
||||
"CatalogObject","CatalogRef"
|
||||
"ChartOfAccountsObject","ChartOfAccountsRef"
|
||||
"ChartOfCalculationTypesObject","ChartOfCalculationTypesRef"
|
||||
"ChartOfCharacteristicTypesObject","ChartOfCharacteristicTypesRef"
|
||||
"ConstantsSet","DataProcessorObject","DocumentObject","DocumentRef"
|
||||
"DynamicList","EnumRef","ExchangePlanObject","ExchangePlanRef"
|
||||
"InformationRegisterRecordManager","InformationRegisterRecordSet"
|
||||
"ReportObject","TaskObject","TaskRef"
|
||||
)
|
||||
|
||||
if (-not $stopped) {
|
||||
$typeNodes = $root.SelectNodes("//v8:Type", $nsMgr)
|
||||
$typeOk = $true
|
||||
$typeChecked = 0
|
||||
$typeInvalid = 0
|
||||
foreach ($tn in $typeNodes) {
|
||||
$tv = $tn.InnerText.Trim()
|
||||
if (-not $tv) { continue }
|
||||
$typeChecked++
|
||||
if ($tv -in $knownInvalidTypes) {
|
||||
Report-Error "12. Type '$tv': invalid runtime/UI type (not valid in XDTO schema)"
|
||||
$typeOk = $false; $typeInvalid++
|
||||
continue
|
||||
}
|
||||
if ($tv -in $validClosedTypes) { continue }
|
||||
if ($tv -match '^cfg:(.+)$') {
|
||||
$cfgVal = $Matches[1]
|
||||
if ($cfgVal -eq "DynamicList") { continue }
|
||||
if ($cfgVal -match '^([^.]+)\.') {
|
||||
if ($Matches[1] -in $validCfgPrefixes) { continue }
|
||||
}
|
||||
Report-Warn "12. Type '$tv': unrecognized cfg prefix"
|
||||
$typeOk = $false
|
||||
continue
|
||||
}
|
||||
if ($tv -match ':') { continue }
|
||||
Report-Warn "12. Type '$tv': bare type without namespace prefix"
|
||||
$typeOk = $false
|
||||
}
|
||||
if ($typeChecked -eq 0) {
|
||||
Report-OK "12. Types: no type values to check"
|
||||
} elseif ($typeOk) {
|
||||
Report-OK "12. Types: $typeChecked values, all valid"
|
||||
}
|
||||
}
|
||||
|
||||
# --- Summary ---
|
||||
|
||||
$checks = $script:okCount + $errors + $warnings
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-validate v1.1 — Validate 1C managed form
|
||||
# form-validate v1.2 — Validate 1C managed form
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import argparse
|
||||
@@ -13,6 +13,40 @@ V8_NS = "http://v8.1c.ru/8.1/data/core"
|
||||
|
||||
NSMAP = {"f": F_NS, "v8": V8_NS}
|
||||
|
||||
KNOWN_INVALID_TYPES = {
|
||||
'FormDataStructure', 'FormDataCollection', 'FormDataTree',
|
||||
'FormDataTreeItem', 'FormDataCollectionItem',
|
||||
'FormGroup', 'FormField', 'FormButton', 'FormDecoration', 'FormTable',
|
||||
}
|
||||
|
||||
VALID_CLOSED_TYPES = {
|
||||
'xs:boolean', 'xs:string', 'xs:decimal', 'xs:dateTime', 'xs:binary',
|
||||
'v8:FillChecking', 'v8:Null', 'v8:StandardPeriod', 'v8:StandardBeginningDate', 'v8:Type',
|
||||
'v8:TypeDescription', 'v8:UUID', 'v8:ValueListType', 'v8:ValueTable', 'v8:ValueTree',
|
||||
'v8:Universal', 'v8:FixedArray', 'v8:FixedStructure',
|
||||
'v8ui:Color', 'v8ui:Font', 'v8ui:FormattedString', 'v8ui:HorizontalAlign',
|
||||
'v8ui:Picture', 'v8ui:SizeChangeMode', 'v8ui:VerticalAlign',
|
||||
'dcsset:DataCompositionComparisonType', 'dcsset:DataCompositionFieldPlacement',
|
||||
'dcsset:Filter', 'dcsset:SettingsComposer', 'dcsset:DataCompositionSettings',
|
||||
'dcssch:DataCompositionSchema',
|
||||
'dcscor:DataCompositionComparisonType', 'dcscor:DataCompositionGroupType',
|
||||
'dcscor:DataCompositionPeriodAdditionType', 'dcscor:DataCompositionSortDirection', 'dcscor:Field',
|
||||
'ent:AccountType', 'ent:AccumulationRecordType', 'ent:AccountingRecordType',
|
||||
}
|
||||
|
||||
VALID_CFG_PREFIXES = {
|
||||
'AccountingRegisterRecordSet', 'AccumulationRegisterRecordSet',
|
||||
'BusinessProcessObject', 'BusinessProcessRef',
|
||||
'CatalogObject', 'CatalogRef',
|
||||
'ChartOfAccountsObject', 'ChartOfAccountsRef',
|
||||
'ChartOfCalculationTypesObject', 'ChartOfCalculationTypesRef',
|
||||
'ChartOfCharacteristicTypesObject', 'ChartOfCharacteristicTypesRef',
|
||||
'ConstantsSet', 'DataProcessorObject', 'DocumentObject', 'DocumentRef',
|
||||
'DynamicList', 'EnumRef', 'ExchangePlanObject', 'ExchangePlanRef',
|
||||
'InformationRegisterRecordManager', 'InformationRegisterRecordSet',
|
||||
'ReportObject', 'TaskObject', 'TaskRef',
|
||||
}
|
||||
|
||||
|
||||
def localname(el):
|
||||
return etree.QName(el.tag).localname
|
||||
@@ -588,6 +622,45 @@ def main():
|
||||
if call_type_without_base:
|
||||
report_warn("callType attributes found but no BaseForm \u2014 possible incorrect structure")
|
||||
|
||||
# --- Check 12: Type validation ---
|
||||
if not stopped:
|
||||
type_nodes = root.xpath('//v8:Type', namespaces={'v8': V8_NS})
|
||||
type_error_count = 0
|
||||
type_warn_count = 0
|
||||
type_count = len(type_nodes)
|
||||
|
||||
for tn in type_nodes:
|
||||
if stopped:
|
||||
break
|
||||
tv = (tn.text or "").strip()
|
||||
if not tv:
|
||||
continue
|
||||
|
||||
if tv in KNOWN_INVALID_TYPES:
|
||||
report_error(f'12. Type "{tv}": invalid runtime/UI type (not valid in XDTO schema)')
|
||||
type_error_count += 1
|
||||
elif tv in VALID_CLOSED_TYPES:
|
||||
pass # OK
|
||||
elif tv.startswith("cfg:"):
|
||||
suffix = tv[4:] # after "cfg:"
|
||||
prefix = suffix.split(".")[0]
|
||||
if prefix in VALID_CFG_PREFIXES or suffix == "DynamicList":
|
||||
pass # OK
|
||||
else:
|
||||
report_warn(f'12. Type "{tv}": unrecognized cfg prefix')
|
||||
type_warn_count += 1
|
||||
elif ":" in tv:
|
||||
pass # unknown namespace, pass through
|
||||
else:
|
||||
report_warn(f'12. Type "{tv}": bare type without namespace prefix')
|
||||
type_warn_count += 1
|
||||
|
||||
if type_error_count == 0 and type_warn_count == 0:
|
||||
if type_count > 0:
|
||||
report_ok(f'12. Types: {type_count} values, all valid')
|
||||
else:
|
||||
report_ok('12. Types: no type values to check')
|
||||
|
||||
# --- Finalize ---
|
||||
checks = ok_count + errors + warnings
|
||||
if errors == 0 and warnings == 0 and not detailed:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# interface-edit v1.1 — Edit 1C CommandInterface.xml
|
||||
# interface-edit v1.2 — Edit 1C CommandInterface.xml
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$CIPath,
|
||||
@@ -202,9 +202,59 @@ function Find-CommandByName($section, [string]$cmdName) {
|
||||
return $null
|
||||
}
|
||||
|
||||
# --- Command name normalization (plural/Russian type prefix → singular English) ---
|
||||
$script:typeNormMap = @{
|
||||
"Catalogs"="Catalog"; "Documents"="Document"; "Enums"="Enum"; "Constants"="Constant"
|
||||
"Reports"="Report"; "DataProcessors"="DataProcessor"
|
||||
"InformationRegisters"="InformationRegister"; "AccumulationRegisters"="AccumulationRegister"
|
||||
"AccountingRegisters"="AccountingRegister"; "CalculationRegisters"="CalculationRegister"
|
||||
"ChartsOfAccounts"="ChartOfAccounts"; "ChartsOfCharacteristicTypes"="ChartOfCharacteristicTypes"
|
||||
"ChartsOfCalculationTypes"="ChartOfCalculationTypes"
|
||||
"BusinessProcesses"="BusinessProcess"; "Tasks"="Task"
|
||||
"ExchangePlans"="ExchangePlan"; "DocumentJournals"="DocumentJournal"
|
||||
"CommonModules"="CommonModule"; "CommonCommands"="CommonCommand"
|
||||
"CommonForms"="CommonForm"; "CommonPictures"="CommonPicture"
|
||||
"CommonTemplates"="CommonTemplate"; "CommonAttributes"="CommonAttribute"
|
||||
"CommandGroups"="CommandGroup"; "Roles"="Role"
|
||||
"Subsystems"="Subsystem"; "StyleItems"="StyleItem"
|
||||
# Russian singular
|
||||
"Справочник"="Catalog"; "Документ"="Document"; "Перечисление"="Enum"
|
||||
"Константа"="Constant"; "Отчёт"="Report"; "Отчет"="Report"; "Обработка"="DataProcessor"
|
||||
"РегистрСведений"="InformationRegister"; "РегистрНакопления"="AccumulationRegister"
|
||||
"РегистрБухгалтерии"="AccountingRegister"
|
||||
"ПланСчетов"="ChartOfAccounts"; "ПланВидовХарактеристик"="ChartOfCharacteristicTypes"
|
||||
"БизнесПроцесс"="BusinessProcess"; "Задача"="Task"
|
||||
"ПланОбмена"="ExchangePlan"; "ЖурналДокументов"="DocumentJournal"
|
||||
"ОбщийМодуль"="CommonModule"; "ОбщаяКоманда"="CommonCommand"
|
||||
"ОбщаяФорма"="CommonForm"; "Подсистема"="Subsystem"
|
||||
# Russian plural
|
||||
"Справочники"="Catalog"; "Документы"="Document"; "Перечисления"="Enum"
|
||||
"Константы"="Constant"; "Отчёты"="Report"; "Отчеты"="Report"; "Обработки"="DataProcessor"
|
||||
"РегистрыСведений"="InformationRegister"; "РегистрыНакопления"="AccumulationRegister"
|
||||
"РегистрыБухгалтерии"="AccountingRegister"
|
||||
"ПланыСчетов"="ChartOfAccounts"; "ПланыВидовХарактеристик"="ChartOfCharacteristicTypes"
|
||||
"БизнесПроцессы"="BusinessProcess"; "Задачи"="Task"
|
||||
"ПланыОбмена"="ExchangePlan"; "ЖурналыДокументов"="DocumentJournal"
|
||||
"Подсистемы"="Subsystem"
|
||||
}
|
||||
|
||||
function Normalize-CmdName([string]$name) {
|
||||
if (-not $name -or -not $name.Contains('.')) { return $name }
|
||||
$dotIdx = $name.IndexOf('.')
|
||||
$first = $name.Substring(0, $dotIdx)
|
||||
$rest = $name.Substring($dotIdx)
|
||||
if ($script:typeNormMap.ContainsKey($first)) {
|
||||
$normalized = "$($script:typeNormMap[$first])$rest"
|
||||
if ($normalized -ne $name) { Write-Host "[NORM] Command: $name -> $normalized" }
|
||||
return $normalized
|
||||
}
|
||||
return $name
|
||||
}
|
||||
|
||||
# --- Operations ---
|
||||
|
||||
function Do-Hide([string[]]$commands) {
|
||||
$commands = @($commands | ForEach-Object { Normalize-CmdName $_ })
|
||||
$section = Ensure-Section "CommandsVisibility"
|
||||
$sectionIndent = Get-ChildIndent $section
|
||||
|
||||
@@ -244,6 +294,7 @@ function Do-Hide([string[]]$commands) {
|
||||
}
|
||||
|
||||
function Do-Show([string[]]$commands) {
|
||||
$commands = @($commands | ForEach-Object { Normalize-CmdName $_ })
|
||||
$section = $null
|
||||
foreach ($child in $root.ChildNodes) {
|
||||
if ($child.NodeType -eq 'Element' -and $child.LocalName -eq "CommandsVisibility") {
|
||||
@@ -292,7 +343,7 @@ function Do-Show([string[]]$commands) {
|
||||
|
||||
function Do-Place([string]$jsonVal) {
|
||||
$def = $jsonVal | ConvertFrom-Json
|
||||
$cmdName = "$($def.command)"
|
||||
$cmdName = Normalize-CmdName "$($def.command)"
|
||||
$groupName = "$($def.group)"
|
||||
if (-not $cmdName -or -not $groupName) { Write-Error "place requires {command, group}"; exit 1 }
|
||||
|
||||
@@ -326,7 +377,7 @@ function Do-Place([string]$jsonVal) {
|
||||
function Do-Order([string]$jsonVal) {
|
||||
$def = $jsonVal | ConvertFrom-Json
|
||||
$groupName = "$($def.group)"
|
||||
$commands = @($def.commands | ForEach-Object { "$_" })
|
||||
$commands = @($def.commands | ForEach-Object { Normalize-CmdName "$_" })
|
||||
if (-not $groupName -or $commands.Count -eq 0) { Write-Error "order requires {group, commands:[...]}"; exit 1 }
|
||||
|
||||
$section = Ensure-Section "CommandsOrder"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# interface-edit v1.1 — Edit 1C CommandInterface.xml
|
||||
# interface-edit v1.2 — Edit 1C CommandInterface.xml
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import argparse
|
||||
@@ -103,6 +103,56 @@ def save_xml_bom(tree, path):
|
||||
f.write(xml_bytes)
|
||||
|
||||
|
||||
TYPE_NORM_MAP = {
|
||||
'Catalogs': 'Catalog', 'Documents': 'Document', 'Enums': 'Enum',
|
||||
'Constants': 'Constant', 'Reports': 'Report', 'DataProcessors': 'DataProcessor',
|
||||
'InformationRegisters': 'InformationRegister', 'AccumulationRegisters': 'AccumulationRegister',
|
||||
'AccountingRegisters': 'AccountingRegister', 'CalculationRegisters': 'CalculationRegister',
|
||||
'ChartsOfAccounts': 'ChartOfAccounts', 'ChartsOfCharacteristicTypes': 'ChartOfCharacteristicTypes',
|
||||
'ChartsOfCalculationTypes': 'ChartOfCalculationTypes',
|
||||
'BusinessProcesses': 'BusinessProcess', 'Tasks': 'Task',
|
||||
'ExchangePlans': 'ExchangePlan', 'DocumentJournals': 'DocumentJournal',
|
||||
'CommonModules': 'CommonModule', 'CommonCommands': 'CommonCommand',
|
||||
'CommonForms': 'CommonForm', 'CommonPictures': 'CommonPicture',
|
||||
'CommonTemplates': 'CommonTemplate', 'CommonAttributes': 'CommonAttribute',
|
||||
'CommandGroups': 'CommandGroup', 'Roles': 'Role',
|
||||
'Subsystems': 'Subsystem', 'StyleItems': 'StyleItem',
|
||||
# Russian singular
|
||||
'Справочник': 'Catalog', 'Документ': 'Document', 'Перечисление': 'Enum',
|
||||
'Константа': 'Constant', 'Отчёт': 'Report', 'Отчет': 'Report', 'Обработка': 'DataProcessor',
|
||||
'РегистрСведений': 'InformationRegister', 'РегистрНакопления': 'AccumulationRegister',
|
||||
'РегистрБухгалтерии': 'AccountingRegister',
|
||||
'ПланСчетов': 'ChartOfAccounts', 'ПланВидовХарактеристик': 'ChartOfCharacteristicTypes',
|
||||
'БизнесПроцесс': 'BusinessProcess', 'Задача': 'Task',
|
||||
'ПланОбмена': 'ExchangePlan', 'ЖурналДокументов': 'DocumentJournal',
|
||||
'ОбщийМодуль': 'CommonModule', 'ОбщаяКоманда': 'CommonCommand',
|
||||
'ОбщаяФорма': 'CommonForm', 'Подсистема': 'Subsystem',
|
||||
# Russian plural
|
||||
'Справочники': 'Catalog', 'Документы': 'Document', 'Перечисления': 'Enum',
|
||||
'Константы': 'Constant', 'Отчёты': 'Report', 'Отчеты': 'Report', 'Обработки': 'DataProcessor',
|
||||
'РегистрыСведений': 'InformationRegister', 'РегистрыНакопления': 'AccumulationRegister',
|
||||
'РегистрыБухгалтерии': 'AccountingRegister',
|
||||
'ПланыСчетов': 'ChartOfAccounts', 'ПланыВидовХарактеристик': 'ChartOfCharacteristicTypes',
|
||||
'БизнесПроцессы': 'BusinessProcess', 'Задачи': 'Task',
|
||||
'ПланыОбмена': 'ExchangePlan', 'ЖурналыДокументов': 'DocumentJournal',
|
||||
'Подсистемы': 'Subsystem',
|
||||
}
|
||||
|
||||
|
||||
def normalize_cmd_name(name):
|
||||
if not name or '.' not in name:
|
||||
return name
|
||||
dot_idx = name.index('.')
|
||||
first = name[:dot_idx]
|
||||
rest = name[dot_idx:]
|
||||
if first in TYPE_NORM_MAP:
|
||||
normalized = TYPE_NORM_MAP[first] + rest
|
||||
if normalized != name:
|
||||
print(f'[NORM] Command: {name} -> {normalized}')
|
||||
return normalized
|
||||
return name
|
||||
|
||||
|
||||
def find_command_by_name(section, cmd_name):
|
||||
for child in section:
|
||||
if isinstance(child.tag, str) and localname(child) == "Command":
|
||||
@@ -207,6 +257,7 @@ def main():
|
||||
|
||||
def do_hide(commands):
|
||||
nonlocal add_count, modify_count
|
||||
commands = [normalize_cmd_name(c) for c in commands]
|
||||
section = ensure_section("CommandsVisibility")
|
||||
section_indent = get_child_indent(section)
|
||||
|
||||
@@ -238,6 +289,7 @@ def main():
|
||||
|
||||
def do_show(commands):
|
||||
nonlocal add_count, modify_count
|
||||
commands = [normalize_cmd_name(c) for c in commands]
|
||||
section = None
|
||||
for child in root:
|
||||
if isinstance(child.tag, str) and localname(child) == "CommandsVisibility":
|
||||
@@ -277,7 +329,7 @@ def main():
|
||||
def do_place(json_val):
|
||||
nonlocal add_count, modify_count
|
||||
defn = json_val if isinstance(json_val, dict) else json.loads(json_val)
|
||||
cmd_name = str(defn["command"])
|
||||
cmd_name = normalize_cmd_name(str(defn["command"]))
|
||||
group_name = str(defn["group"])
|
||||
if not cmd_name or not group_name:
|
||||
print("place requires {command, group}", file=sys.stderr)
|
||||
@@ -306,7 +358,7 @@ def main():
|
||||
nonlocal add_count, remove_count
|
||||
defn = json_val if isinstance(json_val, dict) else json.loads(json_val)
|
||||
group_name = str(defn["group"])
|
||||
commands = [str(c) for c in defn["commands"]]
|
||||
commands = [normalize_cmd_name(str(c)) for c in defn["commands"]]
|
||||
if not group_name or not commands:
|
||||
print("order requires {group, commands:[...]}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# subsystem-compile v1.1 — Create 1C subsystem from JSON definition
|
||||
# subsystem-compile v1.2 — Create 1C subsystem from JSON definition
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -85,7 +85,155 @@ function New-Guid-String {
|
||||
return [System.Guid]::NewGuid().ToString()
|
||||
}
|
||||
|
||||
# --- 3. Resolve defaults ---
|
||||
# --- 3. Content type normalization (plural→singular, Russian→English) ---
|
||||
$script:contentTypeMap = @{
|
||||
# Plural English → Singular
|
||||
"Catalogs" = "Catalog"
|
||||
"Documents" = "Document"
|
||||
"Enums" = "Enum"
|
||||
"Constants" = "Constant"
|
||||
"Reports" = "Report"
|
||||
"DataProcessors" = "DataProcessor"
|
||||
"InformationRegisters" = "InformationRegister"
|
||||
"AccumulationRegisters" = "AccumulationRegister"
|
||||
"AccountingRegisters" = "AccountingRegister"
|
||||
"CalculationRegisters" = "CalculationRegister"
|
||||
"ChartsOfAccounts" = "ChartOfAccounts"
|
||||
"ChartsOfCharacteristicTypes" = "ChartOfCharacteristicTypes"
|
||||
"ChartsOfCalculationTypes" = "ChartOfCalculationTypes"
|
||||
"BusinessProcesses" = "BusinessProcess"
|
||||
"Tasks" = "Task"
|
||||
"ExchangePlans" = "ExchangePlan"
|
||||
"DocumentJournals" = "DocumentJournal"
|
||||
"CommonModules" = "CommonModule"
|
||||
"CommonCommands" = "CommonCommand"
|
||||
"CommonForms" = "CommonForm"
|
||||
"CommonPictures" = "CommonPicture"
|
||||
"CommonTemplates" = "CommonTemplate"
|
||||
"CommonAttributes" = "CommonAttribute"
|
||||
"CommandGroups" = "CommandGroup"
|
||||
"Roles" = "Role"
|
||||
"SessionParameters" = "SessionParameter"
|
||||
"FilterCriteria" = "FilterCriterion"
|
||||
"XDTOPackages" = "XDTOPackage"
|
||||
"WebServices" = "WebService"
|
||||
"HTTPServices" = "HTTPService"
|
||||
"WSReferences" = "WSReference"
|
||||
"EventSubscriptions" = "EventSubscription"
|
||||
"ScheduledJobs" = "ScheduledJob"
|
||||
"SettingsStorages" = "SettingsStorage"
|
||||
"FunctionalOptions" = "FunctionalOption"
|
||||
"FunctionalOptionsParameters" = "FunctionalOptionsParameter"
|
||||
"DefinedTypes" = "DefinedType"
|
||||
"DocumentNumerators" = "DocumentNumerator"
|
||||
"Sequences" = "Sequence"
|
||||
"Subsystems" = "Subsystem"
|
||||
"StyleItems" = "StyleItem"
|
||||
"IntegrationServices" = "IntegrationService"
|
||||
# Russian singular → English
|
||||
"Справочник" = "Catalog"
|
||||
"Каталог" = "Catalog"
|
||||
"Документ" = "Document"
|
||||
"Перечисление" = "Enum"
|
||||
"Константа" = "Constant"
|
||||
"Отчёт" = "Report"
|
||||
"Отчет" = "Report"
|
||||
"Обработка" = "DataProcessor"
|
||||
"РегистрСведений" = "InformationRegister"
|
||||
"РегистрНакопления" = "AccumulationRegister"
|
||||
"РегистрБухгалтерии" = "AccountingRegister"
|
||||
"РегистрРасчёта" = "CalculationRegister"
|
||||
"РегистрРасчета" = "CalculationRegister"
|
||||
"ПланСчетов" = "ChartOfAccounts"
|
||||
"ПланВидовХарактеристик" = "ChartOfCharacteristicTypes"
|
||||
"ПланВидовРасчёта" = "ChartOfCalculationTypes"
|
||||
"ПланВидовРасчета" = "ChartOfCalculationTypes"
|
||||
"БизнесПроцесс" = "BusinessProcess"
|
||||
"Задача" = "Task"
|
||||
"ПланОбмена" = "ExchangePlan"
|
||||
"ЖурналДокументов" = "DocumentJournal"
|
||||
"ОбщийМодуль" = "CommonModule"
|
||||
"ОбщаяКоманда" = "CommonCommand"
|
||||
"ОбщаяФорма" = "CommonForm"
|
||||
"ОбщаяКартинка" = "CommonPicture"
|
||||
"ОбщийМакет" = "CommonTemplate"
|
||||
"ОбщийРеквизит" = "CommonAttribute"
|
||||
"ГруппаКоманд" = "CommandGroup"
|
||||
"Роль" = "Role"
|
||||
"ПараметрСеанса" = "SessionParameter"
|
||||
"КритерийОтбора" = "FilterCriterion"
|
||||
"ПакетXDTO" = "XDTOPackage"
|
||||
"ВебСервис" = "WebService"
|
||||
"HTTPСервис" = "HTTPService"
|
||||
"WSСсылка" = "WSReference"
|
||||
"ПодпискаНаСобытие" = "EventSubscription"
|
||||
"РегламентноеЗадание" = "ScheduledJob"
|
||||
"ХранилищеНастроек" = "SettingsStorage"
|
||||
"ФункциональнаяОпция" = "FunctionalOption"
|
||||
"ПараметрФункциональныхОпций" = "FunctionalOptionsParameter"
|
||||
"ОпределяемыйТип" = "DefinedType"
|
||||
"НумераторДокументов" = "DocumentNumerator"
|
||||
"Последовательность" = "Sequence"
|
||||
"Подсистема" = "Subsystem"
|
||||
"ЭлементСтиля" = "StyleItem"
|
||||
"СервисИнтеграции" = "IntegrationService"
|
||||
# Russian plural → English
|
||||
"Справочники" = "Catalog"
|
||||
"Документы" = "Document"
|
||||
"Перечисления" = "Enum"
|
||||
"Константы" = "Constant"
|
||||
"Отчёты" = "Report"
|
||||
"Отчеты" = "Report"
|
||||
"Обработки" = "DataProcessor"
|
||||
"РегистрыСведений" = "InformationRegister"
|
||||
"РегистрыНакопления" = "AccumulationRegister"
|
||||
"РегистрыБухгалтерии" = "AccountingRegister"
|
||||
"РегистрыРасчёта" = "CalculationRegister"
|
||||
"РегистрыРасчета" = "CalculationRegister"
|
||||
"ПланыСчетов" = "ChartOfAccounts"
|
||||
"ПланыВидовХарактеристик" = "ChartOfCharacteristicTypes"
|
||||
"ПланыВидовРасчёта" = "ChartOfCalculationTypes"
|
||||
"ПланыВидовРасчета" = "ChartOfCalculationTypes"
|
||||
"БизнесПроцессы" = "BusinessProcess"
|
||||
"Задачи" = "Task"
|
||||
"ПланыОбмена" = "ExchangePlan"
|
||||
"ЖурналыДокументов" = "DocumentJournal"
|
||||
"ОбщиеМодули" = "CommonModule"
|
||||
"ОбщиеКоманды" = "CommonCommand"
|
||||
"ОбщиеФормы" = "CommonForm"
|
||||
"ОбщиеКартинки" = "CommonPicture"
|
||||
"ОбщиеМакеты" = "CommonTemplate"
|
||||
"ОбщиеРеквизиты" = "CommonAttribute"
|
||||
"ГруппыКоманд" = "CommandGroup"
|
||||
"Роли" = "Role"
|
||||
"ПараметрыСеанса" = "SessionParameter"
|
||||
"КритерииОтбора" = "FilterCriterion"
|
||||
"ПакетыXDTO" = "XDTOPackage"
|
||||
"ВебСервисы" = "WebService"
|
||||
"HTTPСервисы" = "HTTPService"
|
||||
"WSСсылки" = "WSReference"
|
||||
"ПодпискиНаСобытия" = "EventSubscription"
|
||||
"РегламентныеЗадания" = "ScheduledJob"
|
||||
"ХранилищаНастроек" = "SettingsStorage"
|
||||
"ФункциональныеОпции" = "FunctionalOption"
|
||||
"ОпределяемыеТипы" = "DefinedType"
|
||||
"Подсистемы" = "Subsystem"
|
||||
"ЭлементыСтиля" = "StyleItem"
|
||||
"СервисыИнтеграции" = "IntegrationService"
|
||||
}
|
||||
|
||||
function Normalize-ContentRef([string]$ref) {
|
||||
if (-not $ref -or -not $ref.Contains('.')) { return $ref }
|
||||
$dotIdx = $ref.IndexOf('.')
|
||||
$typePart = $ref.Substring(0, $dotIdx)
|
||||
$namePart = $ref.Substring($dotIdx + 1)
|
||||
if ($script:contentTypeMap.ContainsKey($typePart)) {
|
||||
$typePart = $script:contentTypeMap[$typePart]
|
||||
}
|
||||
return "$typePart.$namePart"
|
||||
}
|
||||
|
||||
# --- 4. Resolve defaults ---
|
||||
$synonym = if ($def.synonym) { "$($def.synonym)" } else { Split-CamelCase $objName }
|
||||
$comment = if ($def.comment) { "$($def.comment)" } else { "" }
|
||||
$includeHelpInContents = "true"
|
||||
@@ -98,8 +246,20 @@ $picture = if ($def.picture) { "$($def.picture)" } else { "" }
|
||||
if (-not $def.content -and $def.objects) { $def | Add-Member -NotePropertyName content -NotePropertyValue $def.objects }
|
||||
|
||||
$contentItems = @()
|
||||
$normalizedCount = 0
|
||||
if ($def.content) {
|
||||
foreach ($c in $def.content) { $contentItems += "$c" }
|
||||
foreach ($c in $def.content) {
|
||||
$raw = "$c"
|
||||
$normalized = Normalize-ContentRef $raw
|
||||
if ($normalized -ne $raw) {
|
||||
Write-Host "[NORM] Content: $raw -> $normalized"
|
||||
$normalizedCount++
|
||||
}
|
||||
$contentItems += $normalized
|
||||
}
|
||||
}
|
||||
if ($normalizedCount -gt 0) {
|
||||
Write-Host "[INFO] Normalized $normalizedCount content reference(s) to singular English form"
|
||||
}
|
||||
|
||||
$children = @()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# subsystem-compile v1.1 — Create 1C subsystem from JSON definition
|
||||
# subsystem-compile v1.2 — Create 1C subsystem from JSON definition
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -88,7 +88,88 @@ def main():
|
||||
if not os.path.isabs(output_dir):
|
||||
output_dir = os.path.join(os.getcwd(), output_dir)
|
||||
|
||||
# --- 2. Resolve defaults ---
|
||||
# --- 2. Content type normalization (plural→singular, Russian→English) ---
|
||||
CONTENT_TYPE_MAP = {
|
||||
# Plural English → Singular
|
||||
'Catalogs': 'Catalog', 'Documents': 'Document', 'Enums': 'Enum',
|
||||
'Constants': 'Constant', 'Reports': 'Report', 'DataProcessors': 'DataProcessor',
|
||||
'InformationRegisters': 'InformationRegister', 'AccumulationRegisters': 'AccumulationRegister',
|
||||
'AccountingRegisters': 'AccountingRegister', 'CalculationRegisters': 'CalculationRegister',
|
||||
'ChartsOfAccounts': 'ChartOfAccounts', 'ChartsOfCharacteristicTypes': 'ChartOfCharacteristicTypes',
|
||||
'ChartsOfCalculationTypes': 'ChartOfCalculationTypes',
|
||||
'BusinessProcesses': 'BusinessProcess', 'Tasks': 'Task',
|
||||
'ExchangePlans': 'ExchangePlan', 'DocumentJournals': 'DocumentJournal',
|
||||
'CommonModules': 'CommonModule', 'CommonCommands': 'CommonCommand',
|
||||
'CommonForms': 'CommonForm', 'CommonPictures': 'CommonPicture',
|
||||
'CommonTemplates': 'CommonTemplate', 'CommonAttributes': 'CommonAttribute',
|
||||
'CommandGroups': 'CommandGroup', 'Roles': 'Role',
|
||||
'SessionParameters': 'SessionParameter', 'FilterCriteria': 'FilterCriterion',
|
||||
'XDTOPackages': 'XDTOPackage', 'WebServices': 'WebService',
|
||||
'HTTPServices': 'HTTPService', 'WSReferences': 'WSReference',
|
||||
'EventSubscriptions': 'EventSubscription', 'ScheduledJobs': 'ScheduledJob',
|
||||
'SettingsStorages': 'SettingsStorage', 'FunctionalOptions': 'FunctionalOption',
|
||||
'FunctionalOptionsParameters': 'FunctionalOptionsParameter',
|
||||
'DefinedTypes': 'DefinedType', 'DocumentNumerators': 'DocumentNumerator',
|
||||
'Sequences': 'Sequence', 'Subsystems': 'Subsystem',
|
||||
'StyleItems': 'StyleItem', 'IntegrationServices': 'IntegrationService',
|
||||
# Russian singular → English
|
||||
'Справочник': 'Catalog', 'Каталог': 'Catalog', 'Документ': 'Document',
|
||||
'Перечисление': 'Enum', 'Константа': 'Constant',
|
||||
'Отчёт': 'Report', 'Отчет': 'Report', 'Обработка': 'DataProcessor',
|
||||
'РегистрСведений': 'InformationRegister', 'РегистрНакопления': 'AccumulationRegister',
|
||||
'РегистрБухгалтерии': 'AccountingRegister',
|
||||
'РегистрРасчёта': 'CalculationRegister', 'РегистрРасчета': 'CalculationRegister',
|
||||
'ПланСчетов': 'ChartOfAccounts', 'ПланВидовХарактеристик': 'ChartOfCharacteristicTypes',
|
||||
'ПланВидовРасчёта': 'ChartOfCalculationTypes', 'ПланВидовРасчета': 'ChartOfCalculationTypes',
|
||||
'БизнесПроцесс': 'BusinessProcess', 'Задача': 'Task',
|
||||
'ПланОбмена': 'ExchangePlan', 'ЖурналДокументов': 'DocumentJournal',
|
||||
'ОбщийМодуль': 'CommonModule', 'ОбщаяКоманда': 'CommonCommand',
|
||||
'ОбщаяФорма': 'CommonForm', 'ОбщаяКартинка': 'CommonPicture',
|
||||
'ОбщийМакет': 'CommonTemplate', 'ОбщийРеквизит': 'CommonAttribute',
|
||||
'ГруппаКоманд': 'CommandGroup', 'Роль': 'Role',
|
||||
'ПараметрСеанса': 'SessionParameter', 'КритерийОтбора': 'FilterCriterion',
|
||||
'ПакетXDTO': 'XDTOPackage', 'ВебСервис': 'WebService',
|
||||
'HTTPСервис': 'HTTPService', 'WSСсылка': 'WSReference',
|
||||
'ПодпискаНаСобытие': 'EventSubscription', 'РегламентноеЗадание': 'ScheduledJob',
|
||||
'ХранилищеНастроек': 'SettingsStorage', 'ФункциональнаяОпция': 'FunctionalOption',
|
||||
'ПараметрФункциональныхОпций': 'FunctionalOptionsParameter',
|
||||
'ОпределяемыйТип': 'DefinedType', 'НумераторДокументов': 'DocumentNumerator',
|
||||
'Последовательность': 'Sequence', 'Подсистема': 'Subsystem',
|
||||
'ЭлементСтиля': 'StyleItem', 'СервисИнтеграции': 'IntegrationService',
|
||||
# Russian plural → English
|
||||
'Справочники': 'Catalog', 'Документы': 'Document', 'Перечисления': 'Enum',
|
||||
'Константы': 'Constant', 'Отчёты': 'Report', 'Отчеты': 'Report',
|
||||
'Обработки': 'DataProcessor', 'РегистрыСведений': 'InformationRegister',
|
||||
'РегистрыНакопления': 'AccumulationRegister', 'РегистрыБухгалтерии': 'AccountingRegister',
|
||||
'РегистрыРасчёта': 'CalculationRegister', 'РегистрыРасчета': 'CalculationRegister',
|
||||
'ПланыСчетов': 'ChartOfAccounts', 'ПланыВидовХарактеристик': 'ChartOfCharacteristicTypes',
|
||||
'ПланыВидовРасчёта': 'ChartOfCalculationTypes', 'ПланыВидовРасчета': 'ChartOfCalculationTypes',
|
||||
'БизнесПроцессы': 'BusinessProcess', 'Задачи': 'Task',
|
||||
'ПланыОбмена': 'ExchangePlan', 'ЖурналыДокументов': 'DocumentJournal',
|
||||
'ОбщиеМодули': 'CommonModule', 'ОбщиеКоманды': 'CommonCommand',
|
||||
'ОбщиеФормы': 'CommonForm', 'ОбщиеКартинки': 'CommonPicture',
|
||||
'ОбщиеМакеты': 'CommonTemplate', 'ОбщиеРеквизиты': 'CommonAttribute',
|
||||
'ГруппыКоманд': 'CommandGroup', 'Роли': 'Role',
|
||||
'ПараметрыСеанса': 'SessionParameter', 'КритерииОтбора': 'FilterCriterion',
|
||||
'ПакетыXDTO': 'XDTOPackage', 'ВебСервисы': 'WebService',
|
||||
'HTTPСервисы': 'HTTPService', 'WSСсылки': 'WSReference',
|
||||
'ПодпискиНаСобытия': 'EventSubscription', 'РегламентныеЗадания': 'ScheduledJob',
|
||||
'ХранилищаНастроек': 'SettingsStorage', 'ФункциональныеОпции': 'FunctionalOption',
|
||||
'ОпределяемыеТипы': 'DefinedType', 'Подсистемы': 'Subsystem',
|
||||
'ЭлементыСтиля': 'StyleItem', 'СервисыИнтеграции': 'IntegrationService',
|
||||
}
|
||||
|
||||
def normalize_content_ref(ref):
|
||||
if not ref or '.' not in ref:
|
||||
return ref
|
||||
dot_idx = ref.index('.')
|
||||
type_part = ref[:dot_idx]
|
||||
name_part = ref[dot_idx + 1:]
|
||||
if type_part in CONTENT_TYPE_MAP:
|
||||
type_part = CONTENT_TYPE_MAP[type_part]
|
||||
return f'{type_part}.{name_part}'
|
||||
|
||||
# --- 3. Resolve defaults ---
|
||||
synonym = str(defn['synonym']) if defn.get('synonym') else split_camel_case(obj_name)
|
||||
comment = str(defn['comment']) if defn.get('comment') else ''
|
||||
include_help_in_contents = 'true'
|
||||
@@ -102,9 +183,17 @@ def main():
|
||||
defn['content'] = defn['objects']
|
||||
|
||||
content_items = []
|
||||
normalized_count = 0
|
||||
if defn.get('content'):
|
||||
for c in defn['content']:
|
||||
content_items.append(str(c))
|
||||
raw = str(c)
|
||||
normalized = normalize_content_ref(raw)
|
||||
if normalized != raw:
|
||||
print(f'[NORM] Content: {raw} -> {normalized}')
|
||||
normalized_count += 1
|
||||
content_items.append(normalized)
|
||||
if normalized_count > 0:
|
||||
print(f'[INFO] Normalized {normalized_count} content reference(s) to singular English form')
|
||||
|
||||
children = []
|
||||
if defn.get('children'):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# subsystem-edit v1.0 — Edit existing 1C subsystem XML
|
||||
# subsystem-edit v1.1 — Edit existing 1C subsystem XML
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$SubsystemPath,
|
||||
@@ -12,6 +12,86 @@ param(
|
||||
$ErrorActionPreference = "Stop"
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
|
||||
# --- Content type normalization (plural→singular, Russian→English) ---
|
||||
$script:contentTypeMap = @{
|
||||
"Catalogs"="Catalog"; "Documents"="Document"; "Enums"="Enum"; "Constants"="Constant"
|
||||
"Reports"="Report"; "DataProcessors"="DataProcessor"
|
||||
"InformationRegisters"="InformationRegister"; "AccumulationRegisters"="AccumulationRegister"
|
||||
"AccountingRegisters"="AccountingRegister"; "CalculationRegisters"="CalculationRegister"
|
||||
"ChartsOfAccounts"="ChartOfAccounts"; "ChartsOfCharacteristicTypes"="ChartOfCharacteristicTypes"
|
||||
"ChartsOfCalculationTypes"="ChartOfCalculationTypes"
|
||||
"BusinessProcesses"="BusinessProcess"; "Tasks"="Task"
|
||||
"ExchangePlans"="ExchangePlan"; "DocumentJournals"="DocumentJournal"
|
||||
"CommonModules"="CommonModule"; "CommonCommands"="CommonCommand"
|
||||
"CommonForms"="CommonForm"; "CommonPictures"="CommonPicture"
|
||||
"CommonTemplates"="CommonTemplate"; "CommonAttributes"="CommonAttribute"
|
||||
"CommandGroups"="CommandGroup"; "Roles"="Role"
|
||||
"SessionParameters"="SessionParameter"; "FilterCriteria"="FilterCriterion"
|
||||
"XDTOPackages"="XDTOPackage"; "WebServices"="WebService"
|
||||
"HTTPServices"="HTTPService"; "WSReferences"="WSReference"
|
||||
"EventSubscriptions"="EventSubscription"; "ScheduledJobs"="ScheduledJob"
|
||||
"SettingsStorages"="SettingsStorage"; "FunctionalOptions"="FunctionalOption"
|
||||
"FunctionalOptionsParameters"="FunctionalOptionsParameter"
|
||||
"DefinedTypes"="DefinedType"; "DocumentNumerators"="DocumentNumerator"
|
||||
"Sequences"="Sequence"; "Subsystems"="Subsystem"
|
||||
"StyleItems"="StyleItem"; "IntegrationServices"="IntegrationService"
|
||||
# Russian singular
|
||||
"Справочник"="Catalog"; "Каталог"="Catalog"; "Документ"="Document"
|
||||
"Перечисление"="Enum"; "Константа"="Constant"
|
||||
"Отчёт"="Report"; "Отчет"="Report"; "Обработка"="DataProcessor"
|
||||
"РегистрСведений"="InformationRegister"; "РегистрНакопления"="AccumulationRegister"
|
||||
"РегистрБухгалтерии"="AccountingRegister"
|
||||
"РегистрРасчёта"="CalculationRegister"; "РегистрРасчета"="CalculationRegister"
|
||||
"ПланСчетов"="ChartOfAccounts"; "ПланВидовХарактеристик"="ChartOfCharacteristicTypes"
|
||||
"ПланВидовРасчёта"="ChartOfCalculationTypes"; "ПланВидовРасчета"="ChartOfCalculationTypes"
|
||||
"БизнесПроцесс"="BusinessProcess"; "Задача"="Task"
|
||||
"ПланОбмена"="ExchangePlan"; "ЖурналДокументов"="DocumentJournal"
|
||||
"ОбщийМодуль"="CommonModule"; "ОбщаяКоманда"="CommonCommand"
|
||||
"ОбщаяФорма"="CommonForm"; "ОбщаяКартинка"="CommonPicture"
|
||||
"ОбщийМакет"="CommonTemplate"; "ОбщийРеквизит"="CommonAttribute"
|
||||
"ГруппаКоманд"="CommandGroup"; "Роль"="Role"
|
||||
"ПараметрСеанса"="SessionParameter"; "КритерийОтбора"="FilterCriterion"
|
||||
"ПакетXDTO"="XDTOPackage"; "ВебСервис"="WebService"
|
||||
"HTTPСервис"="HTTPService"; "WSСсылка"="WSReference"
|
||||
"ПодпискаНаСобытие"="EventSubscription"; "РегламентноеЗадание"="ScheduledJob"
|
||||
"ХранилищеНастроек"="SettingsStorage"; "ФункциональнаяОпция"="FunctionalOption"
|
||||
"ПараметрФункциональныхОпций"="FunctionalOptionsParameter"
|
||||
"ОпределяемыйТип"="DefinedType"; "Подсистема"="Subsystem"
|
||||
"ЭлементСтиля"="StyleItem"; "СервисИнтеграции"="IntegrationService"
|
||||
# Russian plural
|
||||
"Справочники"="Catalog"; "Документы"="Document"; "Перечисления"="Enum"
|
||||
"Константы"="Constant"; "Отчёты"="Report"; "Отчеты"="Report"
|
||||
"Обработки"="DataProcessor"; "РегистрыСведений"="InformationRegister"
|
||||
"РегистрыНакопления"="AccumulationRegister"; "РегистрыБухгалтерии"="AccountingRegister"
|
||||
"РегистрыРасчёта"="CalculationRegister"; "РегистрыРасчета"="CalculationRegister"
|
||||
"ПланыСчетов"="ChartOfAccounts"; "ПланыВидовХарактеристик"="ChartOfCharacteristicTypes"
|
||||
"ПланыВидовРасчёта"="ChartOfCalculationTypes"; "ПланыВидовРасчета"="ChartOfCalculationTypes"
|
||||
"БизнесПроцессы"="BusinessProcess"; "Задачи"="Task"
|
||||
"ПланыОбмена"="ExchangePlan"; "ЖурналыДокументов"="DocumentJournal"
|
||||
"ОбщиеМодули"="CommonModule"; "ОбщиеКоманды"="CommonCommand"
|
||||
"ОбщиеФормы"="CommonForm"; "ОбщиеКартинки"="CommonPicture"
|
||||
"ОбщиеМакеты"="CommonTemplate"; "ОбщиеРеквизиты"="CommonAttribute"
|
||||
"ГруппыКоманд"="CommandGroup"; "Роли"="Role"
|
||||
"ПараметрыСеанса"="SessionParameter"; "КритерииОтбора"="FilterCriterion"
|
||||
"ПакетыXDTO"="XDTOPackage"; "ВебСервисы"="WebService"
|
||||
"HTTPСервисы"="HTTPService"; "WSСсылки"="WSReference"
|
||||
"ПодпискиНаСобытия"="EventSubscription"; "РегламентныеЗадания"="ScheduledJob"
|
||||
"ХранилищаНастроек"="SettingsStorage"; "ФункциональныеОпции"="FunctionalOption"
|
||||
"ОпределяемыеТипы"="DefinedType"; "Подсистемы"="Subsystem"
|
||||
"ЭлементыСтиля"="StyleItem"; "СервисыИнтеграции"="IntegrationService"
|
||||
}
|
||||
|
||||
function Normalize-ContentRef([string]$ref) {
|
||||
if (-not $ref -or -not $ref.Contains('.')) { return $ref }
|
||||
$dotIdx = $ref.IndexOf('.')
|
||||
$typePart = $ref.Substring(0, $dotIdx)
|
||||
$namePart = $ref.Substring($dotIdx + 1)
|
||||
if ($script:contentTypeMap.ContainsKey($typePart)) {
|
||||
$typePart = $script:contentTypeMap[$typePart]
|
||||
}
|
||||
return "$typePart.$namePart"
|
||||
}
|
||||
|
||||
# --- Mode validation ---
|
||||
if ($DefinitionFile -and $Operation) { Write-Error "Cannot use both -DefinitionFile and -Operation"; exit 1 }
|
||||
if (-not $DefinitionFile -and -not $Operation) { Write-Error "Either -DefinitionFile or -Operation is required"; exit 1 }
|
||||
@@ -194,7 +274,9 @@ function Do-AddContent([string[]]$items) {
|
||||
$contentIndent = Get-ChildIndent $contentEl
|
||||
}
|
||||
|
||||
foreach ($item in $items) {
|
||||
foreach ($rawItem in $items) {
|
||||
$item = Normalize-ContentRef $rawItem
|
||||
if ($item -ne $rawItem) { Write-Host "[NORM] Content: $rawItem -> $item" }
|
||||
if ($item -in $existing) {
|
||||
Warn "Content already contains: $item"
|
||||
continue
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# subsystem-edit v1.0 — Edit existing 1C subsystem XML
|
||||
# subsystem-edit v1.1 — Edit existing 1C subsystem XML
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import argparse
|
||||
@@ -24,6 +24,86 @@ NSMAP_WRAPPER = {
|
||||
}
|
||||
|
||||
|
||||
CONTENT_TYPE_MAP = {
|
||||
'Catalogs': 'Catalog', 'Documents': 'Document', 'Enums': 'Enum',
|
||||
'Constants': 'Constant', 'Reports': 'Report', 'DataProcessors': 'DataProcessor',
|
||||
'InformationRegisters': 'InformationRegister', 'AccumulationRegisters': 'AccumulationRegister',
|
||||
'AccountingRegisters': 'AccountingRegister', 'CalculationRegisters': 'CalculationRegister',
|
||||
'ChartsOfAccounts': 'ChartOfAccounts', 'ChartsOfCharacteristicTypes': 'ChartOfCharacteristicTypes',
|
||||
'ChartsOfCalculationTypes': 'ChartOfCalculationTypes',
|
||||
'BusinessProcesses': 'BusinessProcess', 'Tasks': 'Task',
|
||||
'ExchangePlans': 'ExchangePlan', 'DocumentJournals': 'DocumentJournal',
|
||||
'CommonModules': 'CommonModule', 'CommonCommands': 'CommonCommand',
|
||||
'CommonForms': 'CommonForm', 'CommonPictures': 'CommonPicture',
|
||||
'CommonTemplates': 'CommonTemplate', 'CommonAttributes': 'CommonAttribute',
|
||||
'CommandGroups': 'CommandGroup', 'Roles': 'Role',
|
||||
'SessionParameters': 'SessionParameter', 'FilterCriteria': 'FilterCriterion',
|
||||
'XDTOPackages': 'XDTOPackage', 'WebServices': 'WebService',
|
||||
'HTTPServices': 'HTTPService', 'WSReferences': 'WSReference',
|
||||
'EventSubscriptions': 'EventSubscription', 'ScheduledJobs': 'ScheduledJob',
|
||||
'SettingsStorages': 'SettingsStorage', 'FunctionalOptions': 'FunctionalOption',
|
||||
'FunctionalOptionsParameters': 'FunctionalOptionsParameter',
|
||||
'DefinedTypes': 'DefinedType', 'DocumentNumerators': 'DocumentNumerator',
|
||||
'Sequences': 'Sequence', 'Subsystems': 'Subsystem',
|
||||
'StyleItems': 'StyleItem', 'IntegrationServices': 'IntegrationService',
|
||||
# Russian singular
|
||||
'Справочник': 'Catalog', 'Каталог': 'Catalog', 'Документ': 'Document',
|
||||
'Перечисление': 'Enum', 'Константа': 'Constant',
|
||||
'Отчёт': 'Report', 'Отчет': 'Report', 'Обработка': 'DataProcessor',
|
||||
'РегистрСведений': 'InformationRegister', 'РегистрНакопления': 'AccumulationRegister',
|
||||
'РегистрБухгалтерии': 'AccountingRegister',
|
||||
'РегистрРасчёта': 'CalculationRegister', 'РегистрРасчета': 'CalculationRegister',
|
||||
'ПланСчетов': 'ChartOfAccounts', 'ПланВидовХарактеристик': 'ChartOfCharacteristicTypes',
|
||||
'ПланВидовРасчёта': 'ChartOfCalculationTypes', 'ПланВидовРасчета': 'ChartOfCalculationTypes',
|
||||
'БизнесПроцесс': 'BusinessProcess', 'Задача': 'Task',
|
||||
'ПланОбмена': 'ExchangePlan', 'ЖурналДокументов': 'DocumentJournal',
|
||||
'ОбщийМодуль': 'CommonModule', 'ОбщаяКоманда': 'CommonCommand',
|
||||
'ОбщаяФорма': 'CommonForm', 'ОбщаяКартинка': 'CommonPicture',
|
||||
'ОбщийМакет': 'CommonTemplate', 'ОбщийРеквизит': 'CommonAttribute',
|
||||
'ГруппаКоманд': 'CommandGroup', 'Роль': 'Role',
|
||||
'ПараметрСеанса': 'SessionParameter', 'КритерийОтбора': 'FilterCriterion',
|
||||
'ПакетXDTO': 'XDTOPackage', 'ВебСервис': 'WebService',
|
||||
'HTTPСервис': 'HTTPService', 'WSСсылка': 'WSReference',
|
||||
'ПодпискаНаСобытие': 'EventSubscription', 'РегламентноеЗадание': 'ScheduledJob',
|
||||
'ХранилищеНастроек': 'SettingsStorage', 'ФункциональнаяОпция': 'FunctionalOption',
|
||||
'ПараметрФункциональныхОпций': 'FunctionalOptionsParameter',
|
||||
'ОпределяемыйТип': 'DefinedType', 'Подсистема': 'Subsystem',
|
||||
'ЭлементСтиля': 'StyleItem', 'СервисИнтеграции': 'IntegrationService',
|
||||
# Russian plural
|
||||
'Справочники': 'Catalog', 'Документы': 'Document', 'Перечисления': 'Enum',
|
||||
'Константы': 'Constant', 'Отчёты': 'Report', 'Отчеты': 'Report',
|
||||
'Обработки': 'DataProcessor', 'РегистрыСведений': 'InformationRegister',
|
||||
'РегистрыНакопления': 'AccumulationRegister', 'РегистрыБухгалтерии': 'AccountingRegister',
|
||||
'РегистрыРасчёта': 'CalculationRegister', 'РегистрыРасчета': 'CalculationRegister',
|
||||
'ПланыСчетов': 'ChartOfAccounts', 'ПланыВидовХарактеристик': 'ChartOfCharacteristicTypes',
|
||||
'ПланыВидовРасчёта': 'ChartOfCalculationTypes', 'ПланыВидовРасчета': 'ChartOfCalculationTypes',
|
||||
'БизнесПроцессы': 'BusinessProcess', 'Задачи': 'Task',
|
||||
'ПланыОбмена': 'ExchangePlan', 'ЖурналыДокументов': 'DocumentJournal',
|
||||
'ОбщиеМодули': 'CommonModule', 'ОбщиеКоманды': 'CommonCommand',
|
||||
'ОбщиеФормы': 'CommonForm', 'ОбщиеКартинки': 'CommonPicture',
|
||||
'ОбщиеМакеты': 'CommonTemplate', 'ОбщиеРеквизиты': 'CommonAttribute',
|
||||
'ГруппыКоманд': 'CommandGroup', 'Роли': 'Role',
|
||||
'ПараметрыСеанса': 'SessionParameter', 'КритерииОтбора': 'FilterCriterion',
|
||||
'ПакетыXDTO': 'XDTOPackage', 'ВебСервисы': 'WebService',
|
||||
'HTTPСервисы': 'HTTPService', 'WSСсылки': 'WSReference',
|
||||
'ПодпискиНаСобытия': 'EventSubscription', 'РегламентныеЗадания': 'ScheduledJob',
|
||||
'ХранилищаНастроек': 'SettingsStorage', 'ФункциональныеОпции': 'FunctionalOption',
|
||||
'ОпределяемыеТипы': 'DefinedType', 'Подсистемы': 'Subsystem',
|
||||
'ЭлементыСтиля': 'StyleItem', 'СервисыИнтеграции': 'IntegrationService',
|
||||
}
|
||||
|
||||
|
||||
def normalize_content_ref(ref):
|
||||
if not ref or '.' not in ref:
|
||||
return ref
|
||||
dot_idx = ref.index('.')
|
||||
type_part = ref[:dot_idx]
|
||||
name_part = ref[dot_idx + 1:]
|
||||
if type_part in CONTENT_TYPE_MAP:
|
||||
type_part = CONTENT_TYPE_MAP[type_part]
|
||||
return f'{type_part}.{name_part}'
|
||||
|
||||
|
||||
def localname(el):
|
||||
return etree.QName(el.tag).localname
|
||||
|
||||
@@ -239,7 +319,10 @@ def main():
|
||||
expand_self_closing(content_el, props_indent)
|
||||
content_indent = get_child_indent(content_el)
|
||||
|
||||
for item in items:
|
||||
for raw_item in items:
|
||||
item = normalize_content_ref(raw_item)
|
||||
if item != raw_item:
|
||||
print(f'[NORM] Content: {raw_item} -> {item}')
|
||||
if item in existing:
|
||||
warn(f"Content already contains: {item}")
|
||||
continue
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# subsystem-validate v1.1 — Validate 1C subsystem XML structure
|
||||
# subsystem-validate v1.2 — Validate 1C subsystem XML structure
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$SubsystemPath,
|
||||
@@ -65,6 +65,19 @@ function Report-Warn([string]$msg) {
|
||||
$guidPattern = '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
|
||||
$identPattern = '^[A-Za-z\u0410-\u042F\u0401\u0430-\u044F\u0451_][A-Za-z0-9\u0410-\u042F\u0401\u0430-\u044F\u0451_]*$'
|
||||
|
||||
# Known plural forms that are NOT valid in subsystem Content (platform expects singular)
|
||||
$knownPluralTypes = @(
|
||||
"Catalogs","Documents","Enums","Constants","Reports","DataProcessors"
|
||||
"InformationRegisters","AccumulationRegisters","AccountingRegisters","CalculationRegisters"
|
||||
"ChartsOfAccounts","ChartsOfCharacteristicTypes","ChartsOfCalculationTypes"
|
||||
"BusinessProcesses","Tasks","ExchangePlans","DocumentJournals"
|
||||
"CommonModules","CommonCommands","CommonForms","CommonPictures","CommonTemplates"
|
||||
"CommonAttributes","CommandGroups","Roles","SessionParameters","FilterCriteria"
|
||||
"XDTOPackages","WebServices","HTTPServices","WSReferences","EventSubscriptions"
|
||||
"ScheduledJobs","SettingsStorages","FunctionalOptions","FunctionalOptionsParameters"
|
||||
"DefinedTypes","DocumentNumerators","Sequences","Subsystems","StyleItems","IntegrationServices"
|
||||
)
|
||||
|
||||
# --- 1. XML well-formedness + root structure ---
|
||||
$xmlDoc = $null
|
||||
try {
|
||||
@@ -190,6 +203,13 @@ if (-not $script:stopped) {
|
||||
Report-Error "6. Content item `"$text`": invalid format (expected Type.Name or UUID)"
|
||||
$contentOk = $false
|
||||
}
|
||||
if ($text -match '^([A-Za-z]+)\.') {
|
||||
$typePart = $Matches[1]
|
||||
if ($typePart -in $knownPluralTypes) {
|
||||
Report-Error "6. Content item `"$text`": uses plural form `"$typePart`" (platform requires singular, e.g. Catalog not Catalogs)"
|
||||
$contentOk = $false
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($contentOk) { Report-OK "6. Content: $($xrItems.Count) items, all valid MDObjectRef format" }
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# subsystem-validate v1.1 — Validate 1C subsystem XML structure
|
||||
# subsystem-validate v1.2 — Validate 1C subsystem XML structure
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
"""Validates subsystem XML file structure, properties, content items, child objects."""
|
||||
import sys, os, argparse, re
|
||||
@@ -20,6 +20,18 @@ IDENT_PATTERN = re.compile(
|
||||
r'[A-Za-z0-9\u0410-\u042F\u0401\u0430-\u044F\u0451_]*$'
|
||||
)
|
||||
|
||||
KNOWN_PLURAL_TYPES = {
|
||||
'Catalogs', 'Documents', 'Enums', 'Constants', 'Reports', 'DataProcessors',
|
||||
'InformationRegisters', 'AccumulationRegisters', 'AccountingRegisters', 'CalculationRegisters',
|
||||
'ChartsOfAccounts', 'ChartsOfCharacteristicTypes', 'ChartsOfCalculationTypes',
|
||||
'BusinessProcesses', 'Tasks', 'ExchangePlans', 'DocumentJournals',
|
||||
'CommonModules', 'CommonCommands', 'CommonForms', 'CommonPictures', 'CommonTemplates',
|
||||
'CommonAttributes', 'CommandGroups', 'Roles', 'SessionParameters', 'FilterCriteria',
|
||||
'XDTOPackages', 'WebServices', 'HTTPServices', 'WSReferences', 'EventSubscriptions',
|
||||
'ScheduledJobs', 'SettingsStorages', 'FunctionalOptions', 'FunctionalOptionsParameters',
|
||||
'DefinedTypes', 'DocumentNumerators', 'Sequences', 'Subsystems', 'StyleItems', 'IntegrationServices',
|
||||
}
|
||||
|
||||
|
||||
class Reporter:
|
||||
def __init__(self, max_errors, detailed=False):
|
||||
@@ -234,6 +246,10 @@ def main():
|
||||
if not re.match(r'^[A-Za-z]+\..+$', text) and not GUID_PATTERN.match(text):
|
||||
r.error(f'6. Content item "{text}": invalid format (expected Type.Name or UUID)')
|
||||
content_ok = False
|
||||
m = re.match(r'^([A-Za-z]+)\.', text)
|
||||
if m and m.group(1) in KNOWN_PLURAL_TYPES:
|
||||
r.error(f'6. Content item "{text}": uses plural form "{m.group(1)}" (platform requires singular, e.g. Catalog not Catalogs)')
|
||||
content_ok = False
|
||||
if content_ok:
|
||||
r.ok(f'6. Content: {len(xr_items)} items, all valid MDObjectRef format')
|
||||
else:
|
||||
|
||||
@@ -958,7 +958,19 @@ ChildItems
|
||||
| `cfg:BusinessProcessRef.<Имя>` | — | Ссылка на бизнес-процесс |
|
||||
| `cfg:TaskRef.<Имя>` | — | Ссылка на задачу |
|
||||
| `cfg:InformationRegisterRecordSet.<Имя>` | — | Набор записей регистра сведений |
|
||||
| `cfg:InformationRegisterRecordManager.<Имя>` | — | Менеджер записи регистра сведений |
|
||||
| `cfg:AccumulationRegisterRecordSet.<Имя>` | — | Набор записей регистра накопления |
|
||||
| `cfg:AccountingRegisterRecordSet.<Имя>` | — | Набор записей регистра бухгалтерии |
|
||||
| `cfg:ChartOfAccountsObject.<Имя>` | — | Объект плана счетов |
|
||||
| `cfg:ChartOfCharacteristicTypesObject.<Имя>` | — | Объект ПВХ |
|
||||
| `cfg:ChartOfCalculationTypesObject.<Имя>` | — | Объект плана видов расчёта |
|
||||
| `cfg:ExchangePlanObject.<Имя>` | — | Объект плана обмена |
|
||||
| `cfg:BusinessProcessObject.<Имя>` | — | Объект бизнес-процесса |
|
||||
| `cfg:TaskObject.<Имя>` | — | Объект задачи |
|
||||
| `cfg:ConstantsSet` | — | Набор констант |
|
||||
| `cfg:DataProcessorObject.<Имя>` | — | Объект обработки |
|
||||
| `cfg:ReportObject.<Имя>` | — | Объект отчёта |
|
||||
| `cfg:DynamicList` | — | Динамический список |
|
||||
|
||||
#### Платформенные типы (v8:*)
|
||||
|
||||
@@ -971,6 +983,12 @@ ChildItems
|
||||
| `v8:Universal` | Произвольный тип |
|
||||
| `v8:FixedArray` | Фиксированный массив |
|
||||
| `v8:FixedStructure` | Фиксированная структура |
|
||||
| `v8:FillChecking` | Проверка заполнения |
|
||||
| `v8:Null` | Null |
|
||||
| `v8:StandardPeriod` | Стандартный период |
|
||||
| `v8:StandardBeginningDate` | Стандартная начальная дата |
|
||||
| `v8:Type` | Тип |
|
||||
| `v8:UUID` | Уникальный идентификатор |
|
||||
|
||||
#### UI-типы (v8ui:*)
|
||||
|
||||
@@ -980,6 +998,9 @@ ChildItems
|
||||
| `v8ui:Picture` | Картинка |
|
||||
| `v8ui:Color` | Цвет |
|
||||
| `v8ui:Font` | Шрифт |
|
||||
| `v8ui:SizeChangeMode` | Режим изменения размера |
|
||||
| `v8ui:VerticalAlign` | Вертикальное выравнивание |
|
||||
| `v8ui:HorizontalAlign` | Горизонтальное выравнивание |
|
||||
|
||||
#### Типы СКД (dcs*:*)
|
||||
|
||||
@@ -988,6 +1009,21 @@ ChildItems
|
||||
| `dcsset:DataCompositionSettings` | Настройки СКД |
|
||||
| `dcssch:DataCompositionSchema` | Схема СКД |
|
||||
| `dcscor:DataCompositionComparisonType` | Тип сравнения СКД |
|
||||
| `dcsset:Filter` | Отбор СКД |
|
||||
| `dcsset:SettingsComposer` | Компоновщик настроек |
|
||||
| `dcsset:DataCompositionFieldPlacement` | Размещение поля СКД |
|
||||
| `dcscor:DataCompositionGroupType` | Тип группировки |
|
||||
| `dcscor:DataCompositionPeriodAdditionType` | Тип дополнения периода |
|
||||
| `dcscor:DataCompositionSortDirection` | Направление сортировки |
|
||||
| `dcscor:Field` | Поле СКД |
|
||||
|
||||
#### Типы предприятия (ent:*)
|
||||
|
||||
| Тип | Описание |
|
||||
|-----|----------|
|
||||
| `ent:AccountType` | Тип счёта (Активный/Пассивный/АктивноПассивный) |
|
||||
| `ent:AccumulationRecordType` | Тип движения регистра накопления (Приход/Расход) |
|
||||
| `ent:AccountingRecordType` | Тип бухгалтерской записи |
|
||||
|
||||
#### Пустой тип
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<Attributes>
|
||||
<Attribute name="Объект" id="1">
|
||||
<Type>
|
||||
<v8:Type>FormDataStructure</v8:Type>
|
||||
<v8:Type>cfg:CatalogObject.Товары</v8:Type>
|
||||
</Type>
|
||||
<MainAttribute>true</MainAttribute>
|
||||
</Attribute>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
},
|
||||
{
|
||||
"script": "form-compile/scripts/form-compile",
|
||||
"input": { "title": "Тест", "attributes": [{ "name": "Объект", "type": "FormDataStructure", "main": true }], "elements": [{ "type": "InputField", "dataPath": "Объект.Наименование" }] },
|
||||
"input": { "title": "Тест", "attributes": [{ "name": "Объект", "type": "CatalogObject.Товары", "main": true }], "elements": [{ "type": "InputField", "dataPath": "Объект.Наименование" }] },
|
||||
"args": { "-JsonPath": "{inputFile}", "-OutputPath": "{workDir}/Catalogs/Товары/Forms/Форма/Ext/Form.xml" }
|
||||
}
|
||||
],
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Explanation/>
|
||||
<Picture/>
|
||||
<Content>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalogs.Товары</xr:Item>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalog.Товары</xr:Item>
|
||||
</Content>
|
||||
</Properties>
|
||||
<ChildObjects/>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Explanation/>
|
||||
<Picture/>
|
||||
<Content>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalogs.Товары</xr:Item>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalog.Товары</xr:Item>
|
||||
</Content>
|
||||
</Properties>
|
||||
<ChildObjects/>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Explanation/>
|
||||
<Picture/>
|
||||
<Content>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalogs.Товары</xr:Item>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalog.Товары</xr:Item>
|
||||
</Content>
|
||||
</Properties>
|
||||
<ChildObjects/>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Explanation/>
|
||||
<Picture/>
|
||||
<Content>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalogs.Товары</xr:Item>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalog.Товары</xr:Item>
|
||||
</Content>
|
||||
</Properties>
|
||||
<ChildObjects/>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Explanation/>
|
||||
<Picture/>
|
||||
<Content>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalogs.Товары</xr:Item>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalog.Товары</xr:Item>
|
||||
</Content>
|
||||
</Properties>
|
||||
<ChildObjects/>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Explanation/>
|
||||
<Picture/>
|
||||
<Content>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalogs.Товары</xr:Item>
|
||||
<xr:Item xsi:type="xr:MDObjectRef">Catalog.Товары</xr:Item>
|
||||
</Content>
|
||||
</Properties>
|
||||
<ChildObjects/>
|
||||
|
||||
Reference in New Issue
Block a user