PhoenixKitCatalogue. Import. Pro100TemplateLoader
(PhoenixKitCatalogue v0.19.1)
Copy Markdown
View Source
Applies a Pro100TemplatePlan to the catalogue.
Safe to run twice. Identity is resolved at every level, because the one question nobody can answer — whether PRO100 regenerates its guids on each export — decides whether a second run updates or duplicates:
folder by name
catalogue by data["pro100"]["template_guid"], else by (folder, name)
category by (catalogue, parent, name)
item by data["pro100"]["template_guid"], else by (category, name)
and only when that item carries no guid of its ownThe last condition is what stops a renamed line from overwriting an unrelated item that happens to share its new name: if the candidate already has a guid, it belongs to a different line, and the incoming row is reported instead.
Nothing is ever deleted. Items in a catalogue with no line in the file are
reported as :absent, which is the only signal that a position was dropped
upstream.
dry_run: true performs every lookup and decision and writes nothing.
Every write inside the transaction is muted (broadcast: false); once it
has committed the loader emits one :folder event if it created the
folder and one :catalogue roll-up per catalogue it touched — the same
discipline as Import.Executor, so open index/detail pages refresh once,
after the data is really there, instead of on every pre-commit row.