@dialecte/scl 0.2.21 → 0.2.23

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.
@@ -26305,92 +26305,33 @@ async function Y(e, t) {
26305
26305
  }), await e.deepClone(a, d);
26306
26306
  }
26307
26307
  //#endregion
26308
- //#region src/v2019C1/extensions/extraction/transaction/primitives/clone-referenced.ts
26309
- async function on(e, t) {
26310
- let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a } = t, o = A[i][0].attribute.uuid, { [i]: s = [] } = await n.findDescendants(r, { collect: i }), c = /* @__PURE__ */ new Set();
26311
- for (let e of s) {
26312
- let t = e.attributes.find((e) => e.name === o)?.value;
26313
- t && c.add(t);
26314
- }
26315
- let l = [];
26316
- for (let t of c) {
26317
- let r = { uuid: t }, [i] = await e.findByAttributes({
26318
- tagName: a,
26319
- attributes: r
26320
- });
26321
- if (i) continue;
26322
- let [o] = await n.findByAttributes({
26323
- tagName: a,
26324
- attributes: r
26325
- });
26326
- o && l.push({
26327
- tagName: a,
26328
- id: o.id
26329
- });
26330
- }
26331
- return l;
26332
- }
26333
- async function sn(e, t) {
26334
- let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, targetParent: o, omit: s } = t, c = await on(e, {
26335
- sourceQuery: n,
26336
- scopeRef: r,
26337
- refTagName: i,
26338
- targetTagName: a
26339
- });
26340
- for (let t of c) await Y(e, {
26341
- sourceQuery: n,
26342
- ref: t,
26343
- targetParent: o,
26344
- omit: s
26345
- });
26346
- }
26347
- async function cn(e, t) {
26348
- let { sourceQuery: n, scopeTagName: r, scopeRef: i, targetParent: a, skip: o = /* @__PURE__ */ new Set(), omit: s } = t, c = (d[r] ?? []).filter((e) => e in A && !o.has(e)), l = sn;
26349
- for (let t of c) for (let r of A[t]) for (let o of r.target) await l(e, {
26350
- sourceQuery: n,
26351
- scopeRef: i,
26352
- refTagName: t,
26353
- targetTagName: o,
26354
- targetParent: a,
26355
- omit: s
26356
- });
26357
- }
26358
- //#endregion
26359
26308
  //#region src/v2019C1/extensions/extraction/transaction/deep.ts
26360
- async function ln(e, t) {
26361
- let { sourceQuery: n, ref: r, targetParent: i, withTypes: a = !0, withReferences: o = !0, skipReferences: s, omit: c, strip: l = !1, promoteRoot: u } = t;
26362
- o && await cn(e, {
26363
- sourceQuery: n,
26364
- scopeTagName: r.tagName,
26365
- scopeRef: r,
26366
- targetParent: i,
26367
- skip: s,
26368
- omit: c
26369
- });
26370
- let d = await Y(e, {
26309
+ async function on(e, t) {
26310
+ let { sourceQuery: n, ref: r, targetParent: i, withTypes: a = !0, omit: o, strip: s = !1, promoteRoot: c } = t, l = await Y(e, {
26371
26311
  sourceQuery: n,
26372
26312
  ref: r,
26373
26313
  targetParent: i,
26374
- omit: c,
26375
- strip: l,
26376
- promoteRoot: u
26314
+ omit: o,
26315
+ strip: s,
26316
+ promoteRoot: c
26377
26317
  });
26378
- if (!d) throw Error(`extraction.deep: source element not found: ${r.tagName}#${r.id}`);
26379
- let f = /* @__PURE__ */ new Map();
26318
+ if (!l) throw Error(`extraction.deep: source element not found: ${r.tagName}#${r.id}`);
26319
+ let u = /* @__PURE__ */ new Map();
26380
26320
  if (a) {
26381
- let t = await un(n, r);
26382
- t.length > 0 && (f = (await Jt(e, {
26321
+ let t = await sn(n, r);
26322
+ t.length > 0 && (u = (await Jt(e, {
26383
26323
  sourceQuery: n,
26384
26324
  records: t,
26385
- cloneMappings: d.mappings
26325
+ cloneMappings: l.mappings
26386
26326
  })).idRemap);
26387
26327
  }
26388
26328
  return {
26389
- record: d.record,
26390
- idRemap: f
26329
+ record: l.record,
26330
+ typeIdRemap: u,
26331
+ recordMappings: l.mappings
26391
26332
  };
26392
26333
  }
26393
- async function un(e, t) {
26334
+ async function sn(e, t) {
26394
26335
  let { LNode: n = [] } = await e.findDescendants(t, { collect: "LNode" }), { LN: r = [] } = await e.findDescendants(t, { collect: "LN" });
26395
26336
  return [...n, ...r];
26396
26337
  }
@@ -26415,10 +26356,63 @@ async function X(e) {
26415
26356
  }
26416
26357
  //#endregion
26417
26358
  //#region src/v2019C1/extensions/extraction/transaction/recipes/shared/post-extraction-cleanup.ts
26418
- async function dn(e) {
26359
+ async function cn(e) {
26419
26360
  await W.transaction.orphanUuidRefs(e), await W.transaction.resetLNode(e), await W.transaction.pruneEmptyContainers(e);
26420
26361
  }
26421
26362
  //#endregion
26363
+ //#region src/v2019C1/extensions/extraction/transaction/primitives/clone-referenced.ts
26364
+ async function ln(e, t) {
26365
+ let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, alreadyCloned: o } = t, s = A[i][0].attribute.uuid, { [i]: c = [] } = await n.findDescendants(r, { collect: i }), l = /* @__PURE__ */ new Set();
26366
+ for (let e of c) {
26367
+ let t = e.attributes.find((e) => e.name === s)?.value;
26368
+ t && l.add(t);
26369
+ }
26370
+ let u = [];
26371
+ for (let t of l) {
26372
+ let r = { uuid: t }, [i] = await n.findByAttributes({
26373
+ tagName: a,
26374
+ attributes: r
26375
+ });
26376
+ if (!i || o?.has(i.id)) continue;
26377
+ let [s] = await e.findByAttributes({
26378
+ tagName: a,
26379
+ attributes: r
26380
+ });
26381
+ s || u.push({
26382
+ tagName: a,
26383
+ id: i.id
26384
+ });
26385
+ }
26386
+ return u;
26387
+ }
26388
+ async function un(e, t) {
26389
+ let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, resolveTargetParent: o, alreadyCloned: s, omit: c } = t, l = await ln(e, {
26390
+ sourceQuery: n,
26391
+ scopeRef: r,
26392
+ refTagName: i,
26393
+ targetTagName: a,
26394
+ alreadyCloned: s
26395
+ });
26396
+ for (let t of l) await Y(e, {
26397
+ sourceQuery: n,
26398
+ ref: t,
26399
+ targetParent: await o(t),
26400
+ omit: c
26401
+ });
26402
+ }
26403
+ async function dn(e, t) {
26404
+ let { sourceQuery: n, scopeTagName: r, scopeRef: i, resolveTargetParent: a, alreadyCloned: o, skip: s = /* @__PURE__ */ new Set(), omit: c } = t, l = (d[r] ?? []).filter((e) => e in A && !s.has(e)), u = un;
26405
+ for (let t of l) for (let r of A[t]) for (let s of r.target) await u(e, {
26406
+ sourceQuery: n,
26407
+ scopeRef: i,
26408
+ refTagName: t,
26409
+ targetTagName: s,
26410
+ resolveTargetParent: a,
26411
+ alreadyCloned: o,
26412
+ omit: c
26413
+ });
26414
+ }
26415
+ //#endregion
26422
26416
  //#region src/v2019C1/extensions/extraction/transaction/recipes/shared/resolve-structure-ref.ts
26423
26417
  async function Z(e, t, n) {
26424
26418
  let r = (await e.findAncestors(t, { stopAtTagName: "Substation" })).find((e) => e.tagName in n);
@@ -26432,11 +26426,31 @@ async function Z(e, t, n) {
26432
26426
  id: i.id
26433
26427
  };
26434
26428
  }
26429
+ function fn(e) {
26430
+ let { sourceQuery: t, structure: n, cloneIndex: r } = e;
26431
+ return async function(e) {
26432
+ let i = await t.findAncestors(e, { stopAtTagName: "Substation" });
26433
+ for (let e of i) {
26434
+ let t = r.get(e.id);
26435
+ if (t) return t;
26436
+ if (e.tagName in n) {
26437
+ let t = n[e.tagName];
26438
+ return {
26439
+ tagName: t.tagName,
26440
+ id: t.id
26441
+ };
26442
+ }
26443
+ }
26444
+ a(!1, {
26445
+ key: "ELEMENT_NOT_FOUND",
26446
+ detail: `No clone-mapped or structural ancestor found for ${e.tagName}`
26447
+ });
26448
+ };
26449
+ }
26435
26450
  //#endregion
26436
26451
  //#region src/v2019C1/extensions/extraction/transaction/recipes/shared/clone-function.ts
26437
- async function fn(e, t) {
26438
- let { sourceQuery: n, functionRef: r, targetParentRef: i, omit: a, stripRootAttributes: o } = t;
26439
- await ln(e, {
26452
+ async function pn(e, t) {
26453
+ let { sourceQuery: n, functionRef: r, targetParentRef: i, omit: a, stripRootAttributes: o } = t, { recordMappings: s } = await on(e, {
26440
26454
  sourceQuery: n,
26441
26455
  ref: r,
26442
26456
  targetParent: i,
@@ -26449,14 +26463,14 @@ async function fn(e, t) {
26449
26463
  from: "SubFunction",
26450
26464
  to: "Function"
26451
26465
  },
26452
- withTypes: !0,
26453
- withReferences: !1
26466
+ withTypes: !0
26454
26467
  });
26468
+ return s;
26455
26469
  }
26456
- async function pn(e, t) {
26457
- let { sourceQuery: n, functionRef: r, structure: i, stripCategoriesUuid: a = !0 } = t, o = await mn(n, r);
26470
+ async function mn(e, t) {
26471
+ let { sourceQuery: n, functionRef: r, structure: i, stripCategoriesUuid: a = !0 } = t, o = await hn(n, r);
26458
26472
  for (let t of o) {
26459
- if (await gn(e, n, t)) continue;
26473
+ if (await _n(e, n, t)) continue;
26460
26474
  let r = {
26461
26475
  tagName: "FunctionCategory",
26462
26476
  id: t
@@ -26469,12 +26483,12 @@ async function pn(e, t) {
26469
26483
  });
26470
26484
  }
26471
26485
  }
26472
- async function mn(e, t) {
26473
- let n = await hn(e, t), r = /* @__PURE__ */ new Set();
26486
+ async function hn(e, t) {
26487
+ let n = await gn(e, t), r = /* @__PURE__ */ new Set();
26474
26488
  for (let { container: e } of n) e && r.add(e.id);
26475
26489
  return r;
26476
26490
  }
26477
- async function hn(e, t) {
26491
+ async function gn(e, t) {
26478
26492
  let n = await R.query.findRefsPointingTo(e, {
26479
26493
  target: t,
26480
26494
  containerTagName: "FunctionCategory"
@@ -26491,7 +26505,7 @@ async function hn(e, t) {
26491
26505
  }
26492
26506
  return n;
26493
26507
  }
26494
- async function gn(e, t, n) {
26508
+ async function _n(e, t, n) {
26495
26509
  let r = await t.getRecord({
26496
26510
  tagName: "FunctionCategory",
26497
26511
  id: n
@@ -26515,34 +26529,40 @@ var Q = [
26515
26529
  ];
26516
26530
  //#endregion
26517
26531
  //#region src/v2019C1/extensions/extraction/transaction/recipes/asd/clone-application.ts
26518
- async function _n(e, t) {
26519
- let { sourceQuery: n, applicationRef: r, structure: i } = t, a = {
26520
- tagName: "Substation",
26521
- id: i.Substation.id
26522
- }, o = await on(e, {
26532
+ async function vn(e, t) {
26533
+ let { sourceQuery: n, applicationRef: r, structure: i } = t, a = /* @__PURE__ */ new Map(), o = await ln(e, {
26523
26534
  sourceQuery: n,
26524
26535
  scopeRef: r,
26525
26536
  refTagName: "FunctionRef",
26526
26537
  targetTagName: "Function"
26527
26538
  });
26528
- for (let t of o) await fn(e, {
26529
- sourceQuery: n,
26530
- functionRef: t,
26531
- targetParentRef: await Z(n, t, i),
26532
- omit: Q
26533
- });
26534
- for (let t of o) await pn(e, {
26539
+ for (let t of o) {
26540
+ let r = await pn(e, {
26541
+ sourceQuery: n,
26542
+ functionRef: t,
26543
+ targetParentRef: await Z(n, t, i),
26544
+ omit: Q
26545
+ });
26546
+ for (let e of r) e.source.id && a.set(e.source.id, e.target);
26547
+ }
26548
+ for (let t of o) await mn(e, {
26535
26549
  sourceQuery: n,
26536
26550
  functionRef: t,
26537
26551
  structure: i,
26538
26552
  stripCategoriesUuid: !1
26539
26553
  });
26540
- await cn(e, {
26554
+ let s = new Set(["FunctionRef", "FunctionCategoryRef"]);
26555
+ await dn(e, {
26541
26556
  sourceQuery: n,
26542
26557
  scopeTagName: "Application",
26543
26558
  scopeRef: r,
26544
- targetParent: a,
26545
- skip: new Set(["FunctionRef", "FunctionCategoryRef"]),
26559
+ resolveTargetParent: fn({
26560
+ sourceQuery: n,
26561
+ structure: i,
26562
+ cloneIndex: a
26563
+ }),
26564
+ alreadyCloned: new Set(a.keys()),
26565
+ skip: s,
26546
26566
  omit: Q
26547
26567
  }), await Y(e, {
26548
26568
  sourceQuery: n,
@@ -26553,7 +26573,7 @@ async function _n(e, t) {
26553
26573
  }
26554
26574
  //#endregion
26555
26575
  //#region src/v2019C1/extensions/history/query/get-sorted-hitem.ts
26556
- async function vn(e) {
26576
+ async function yn(e) {
26557
26577
  let t = await e.getRecord({ tagName: "History" });
26558
26578
  if (!t) return [];
26559
26579
  let { Hitem: n = [] } = await e.findDescendants(t, { collect: "Hitem" });
@@ -26567,18 +26587,18 @@ async function vn(e) {
26567
26587
  }
26568
26588
  //#endregion
26569
26589
  //#region src/v2019C1/extensions/history/query/get-latest-hitem.ts
26570
- async function yn(e) {
26571
- return (await vn(e)).at(-1);
26590
+ async function bn(e) {
26591
+ return (await yn(e)).at(-1);
26572
26592
  }
26573
26593
  //#endregion
26574
26594
  //#region src/v2019C1/extensions/history/query/index.ts
26575
- var bn = /* @__PURE__ */ s({
26576
- getLatestHitem: () => yn,
26577
- getSortedHitems: () => vn
26595
+ var xn = /* @__PURE__ */ s({
26596
+ getLatestHitem: () => bn,
26597
+ getSortedHitems: () => yn
26578
26598
  });
26579
26599
  //#endregion
26580
26600
  //#region src/v2019C1/extensions/history/transaction/add-entry.ts
26581
- async function xn(e, t) {
26601
+ async function Sn(e, t) {
26582
26602
  let { filename: n, header: r, item: i } = t, { id: a, fileType: o, nameStructure: s, version: c, tool: l } = r, { who: u, what: d, why: f } = i, p = await e.getRoot(), m = await e.getRecord({ tagName: "Header" }) ?? await e.addChild(p, {
26583
26603
  tagName: "Header",
26584
26604
  attributes: {
@@ -26593,7 +26613,7 @@ async function xn(e, t) {
26593
26613
  }), h = await e.getRecord({ tagName: "History" }) ?? await e.addChild(m, {
26594
26614
  tagName: "History",
26595
26615
  attributes: {}
26596
- }), g = await yn(e), _ = g?.attributes.find((e) => e.name === "version")?.value, v = g?.attributes.find((e) => e.name === "revision")?.value, y = c === "keep" ? _ ?? "0" : _ ? String(Number(_) + 1) : "0", b = v ? String(Number(v) + 1) : "1";
26616
+ }), g = await bn(e), _ = g?.attributes.find((e) => e.name === "version")?.value, v = g?.attributes.find((e) => e.name === "revision")?.value, y = c === "keep" ? _ ?? "0" : _ ? String(Number(_) + 1) : "0", b = v ? String(Number(v) + 1) : "1";
26597
26617
  await e.update(m, { attributes: {
26598
26618
  version: y,
26599
26619
  revision: b
@@ -26617,12 +26637,12 @@ async function xn(e, t) {
26617
26637
  //#endregion
26618
26638
  //#region src/v2019C1/extensions/history/index.ts
26619
26639
  var $ = {
26620
- query: bn,
26621
- transaction: /* @__PURE__ */ s({ addEntry: () => xn })
26640
+ query: xn,
26641
+ transaction: /* @__PURE__ */ s({ addEntry: () => Sn })
26622
26642
  };
26623
26643
  //#endregion
26624
26644
  //#region src/v2019C1/extensions/extraction/transaction/recipes/asd/to-asd.ts
26625
- async function Sn(e, t) {
26645
+ async function Cn(e, t) {
26626
26646
  let { sourceQuery: n, applicationRef: r, tool: i, who: a, nameStructure: o } = t, s = await X(e), c = await e.getAttribute(r, { name: "name" }) || "Unnamed Application";
26627
26647
  await $.transaction.addEntry(e, {
26628
26648
  filename: `ASD_${c.replace(/\s+/g, "_")}`,
@@ -26637,15 +26657,15 @@ async function Sn(e, t) {
26637
26657
  what: "ASD initialization",
26638
26658
  why: "Application was extracted from a previous file"
26639
26659
  }
26640
- }), await _n(e, {
26660
+ }), await vn(e, {
26641
26661
  sourceQuery: n,
26642
26662
  applicationRef: r,
26643
26663
  structure: s
26644
- }), await dn(e);
26664
+ }), await cn(e);
26645
26665
  }
26646
26666
  //#endregion
26647
26667
  //#region src/v2019C1/extensions/extraction/transaction/recipes/fsd/omit.ts
26648
- var Cn = [
26668
+ var wn = [
26649
26669
  ...Q,
26650
26670
  "DOS",
26651
26671
  "Labels",
@@ -26658,7 +26678,7 @@ var Cn = [
26658
26678
  ];
26659
26679
  //#endregion
26660
26680
  //#region src/v2019C1/extensions/extraction/transaction/recipes/fsd/to-fsd.ts
26661
- async function wn(e, t) {
26681
+ async function Tn(e, t) {
26662
26682
  let { sourceQuery: n, functionRef: r, tool: i, who: a, nameStructure: o } = t, s = await X(e), c = {
26663
26683
  tagName: s.Substation.tagName,
26664
26684
  id: s.Substation.id
@@ -26676,26 +26696,26 @@ async function wn(e, t) {
26676
26696
  what: "FSD initialization",
26677
26697
  why: "Function was extracted from a previous file"
26678
26698
  }
26679
- }), await fn(e, {
26699
+ }), await pn(e, {
26680
26700
  sourceQuery: n,
26681
26701
  functionRef: r,
26682
26702
  targetParentRef: c,
26683
- omit: Cn,
26703
+ omit: wn,
26684
26704
  stripRootAttributes: ["templateUuid"]
26685
- }), await pn(e, {
26705
+ }), await mn(e, {
26686
26706
  sourceQuery: n,
26687
26707
  functionRef: r,
26688
26708
  structure: s
26689
- }), await dn(e);
26709
+ }), await cn(e);
26690
26710
  }
26691
26711
  //#endregion
26692
26712
  //#region src/v2019C1/extensions/extraction/index.ts
26693
- var Tn = { transaction: /* @__PURE__ */ s({
26694
- deep: () => ln,
26713
+ var En = { transaction: /* @__PURE__ */ s({
26714
+ deep: () => on,
26695
26715
  ensureSubstationTemplateStructure: () => X,
26696
- toAsd: () => Sn,
26697
- toFsd: () => wn
26698
- }) }, En = {
26716
+ toAsd: () => Cn,
26717
+ toFsd: () => Tn
26718
+ }) }, Dn = {
26699
26719
  LNode: {
26700
26720
  compact: [
26701
26721
  "prefix",
@@ -26782,13 +26802,13 @@ var Tn = { transaction: /* @__PURE__ */ s({
26782
26802
  };
26783
26803
  //#endregion
26784
26804
  //#region src/v2019C1/extensions/presentation/query/extract-element-title.ts
26785
- async function Dn(e, t, n = {}) {
26805
+ async function On(e, t, n = {}) {
26786
26806
  let r = await e.getRecord(t);
26787
26807
  if (!r) return n.withLabels ? {
26788
26808
  title: "",
26789
26809
  labels: {}
26790
26810
  } : "";
26791
- let i = r.tagName, a = On({
26811
+ let i = r.tagName, a = kn({
26792
26812
  tag: i,
26793
26813
  mode: n.mode ?? "compact",
26794
26814
  attributes: await e.any.getAttributes(r),
@@ -26796,13 +26816,13 @@ async function Dn(e, t, n = {}) {
26796
26816
  });
26797
26817
  return n.withLabels ? {
26798
26818
  title: a,
26799
- labels: await kn(e, r)
26819
+ labels: await An(e, r)
26800
26820
  } : a;
26801
26821
  }
26802
- function On(e) {
26803
- let { tag: t, mode: n, attributes: r, value: i } = e, a = En[t];
26822
+ function kn(e) {
26823
+ let { tag: t, mode: n, attributes: r, value: i } = e, a = Dn[t];
26804
26824
  if (a) {
26805
- let e = Mn(a, r, n);
26825
+ let e = Nn(a, r, n);
26806
26826
  if (e) return e;
26807
26827
  }
26808
26828
  let o = (i ?? "").trim();
@@ -26810,10 +26830,10 @@ function On(e) {
26810
26830
  let s = h[t]?.attributes?.identityFields, c = s?.find((e) => e === "name" || e === "id") ?? s?.[0];
26811
26831
  return c && r[c] ? r[c] : r.name || t;
26812
26832
  }
26813
- async function kn(e, t) {
26814
- return jn(await An(e, t));
26815
- }
26816
26833
  async function An(e, t) {
26834
+ return Mn(await jn(e, t));
26835
+ }
26836
+ async function jn(e, t) {
26817
26837
  let n = [], r = await e.any.getChildren(t, "Labels");
26818
26838
  for (let t of r) {
26819
26839
  let r = await e.any.getChildren(t, "Label");
@@ -26828,30 +26848,30 @@ async function An(e, t) {
26828
26848
  }
26829
26849
  return n;
26830
26850
  }
26831
- function jn(e) {
26851
+ function Mn(e) {
26832
26852
  let t = {};
26833
26853
  for (let { lang: n, id: r, text: i } of e) (t[n] ??= {})[r] = i;
26834
26854
  return t;
26835
26855
  }
26836
- function Mn(e, t, n) {
26856
+ function Nn(e, t, n) {
26837
26857
  let r = n === "full" && e.full !== void 0, i = r ? e.full : e.compact, a = r ? e.fullSeparator ?? e.separator ?? "" : e.separator ?? "";
26838
- if (typeof i == "string") return Nn(i, t);
26858
+ if (typeof i == "string") return Pn(i, t);
26839
26859
  let o = i.map((e) => t[e]).filter(Boolean);
26840
26860
  return o.length > 0 ? o.join(a) : "";
26841
26861
  }
26842
- function Nn(e, t) {
26862
+ function Pn(e, t) {
26843
26863
  return e.replace(/\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g, (e, n) => t[n] ?? "").replace(/\[\]/g, "").replace(/\(\)/g, "").split("/").map((e) => e.split(".").filter((e) => e !== "").join(".")).filter((e) => e !== "").join("/");
26844
26864
  }
26845
26865
  //#endregion
26846
26866
  //#region src/v2019C1/extensions/index.ts
26847
- var Pn = {
26867
+ var Fn = {
26848
26868
  cleanUp: W,
26849
26869
  dataModel: rn,
26850
- extraction: Tn,
26870
+ extraction: En,
26851
26871
  history: $,
26852
26872
  reference: R,
26853
26873
  signature: { query: qt },
26854
- presentation: { query: /* @__PURE__ */ s({ extractElementTitle: () => Dn }) }
26874
+ presentation: { query: /* @__PURE__ */ s({ extractElementTitle: () => On }) }
26855
26875
  };
26856
26876
  //#endregion
26857
- export { S, Ie as _, Dt as a, k as b, Re as c, Fe as d, P as f, F as g, I as h, U as i, L as l, N as m, It as n, H as o, M as p, Ot as r, Et as s, Pn as t, Le as u, j as v, C as x, A as y };
26877
+ export { S, Ie as _, Dt as a, k as b, Re as c, Fe as d, P as f, F as g, I as h, U as i, L as l, N as m, It as n, H as o, M as p, Ot as r, Et as s, Fn as t, Le as u, j as v, C as x, A as y };
@@ -2,18 +2,18 @@ import { ImportDeepParams, ImportDeepResult } from './deep.types';
2
2
  import { Config } from '../../../config';
3
3
  import type * as Core from '@dialecte/core';
4
4
  /**
5
- * Import an element subtree into a target document together with its closures:
5
+ * Import an element subtree into a target document together with its type closure:
6
6
  *
7
- * 1. `withReferences` (default `true`) — forward uuid-reference closure: clone
8
- * referenced satellites that are missing in the target (create-if-missing).
9
- * Done first so the cloned subtree's references remap onto the new satellites;
10
- * 2. clone the subtree under `targetParent` (with optional `omit` / `strip` /
7
+ * 1. clone the subtree under `targetParent` (with optional `omit` / `strip` /
11
8
  * `promoteRoot`);
12
- * 3. `withTypes` (default `true`) — content-addressed **type** closure: reconcile
9
+ * 2. `withTypes` (default `true`) — content-addressed **type** closure: reconcile
13
10
  * the LN/LNode type closure (reuse / preserve / fork) and repoint the cloned
14
11
  * instances' `lnType` through the clone mappings.
15
12
  *
16
- * Uuid references inside the clone are remapped by the `afterDeepClone` hook.
13
+ * `deep` is a faithful subtree copy: it does **not** follow forward uuid references.
14
+ * Reference rewiring is the caller's responsibility (recipes place same-domain
15
+ * satellites by ancestry; cross-domain/lineage rewiring is plan-driven). Uuid
16
+ * references inside the clone are remapped by the `afterDeepClone` hook.
17
17
  */
18
18
  export declare function deep(tx: Core.Transaction<Config>, params: ImportDeepParams): Promise<ImportDeepResult>;
19
19
  //# sourceMappingURL=deep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deep.d.ts","sourceRoot":"","sources":["../../../../../src/v2019C1/extensions/extraction/transaction/deep.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C;;;;;;;;;;;;;GAaG;AACH,wBAAsB,IAAI,CACzB,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,gBAAgB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAqC3B"}
1
+ {"version":3,"file":"deep.d.ts","sourceRoot":"","sources":["../../../../../src/v2019C1/extensions/extraction/transaction/deep.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C;;;;;;;;;;;;;GAaG;AACH,wBAAsB,IAAI,CACzB,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,gBAAgB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAwB3B"}
@@ -10,13 +10,6 @@ export type ImportDeepParams = {
10
10
  targetParent: Scl.Ref<Scl.ElementsOf>;
11
11
  /** Import the referenced **type** closure (content-addressed). Default `true`. */
12
12
  withTypes?: boolean;
13
- /**
14
- * Import the forward **uuid-reference** closure — clone referenced satellites
15
- * that are missing in the target (create-if-missing). Default `true`.
16
- */
17
- withReferences?: boolean;
18
- /** Ref tag names to skip while resolving the uuid-reference closure. */
19
- skipReferences?: ReadonlySet<string>;
20
13
  /** Child element tag names to drop from the cloned subtree. */
21
14
  omit?: OmitEntry<Config>[];
22
15
  /**
@@ -30,7 +23,9 @@ export type ImportDeepParams = {
30
23
  export type ImportDeepResult = {
31
24
  /** The cloned root record in the target. */
32
25
  record: Scl.RawRecord<Scl.ElementsOf>;
33
- /** source type id -> target type id, from the type reconciliation. */
34
- idRemap: Map<string, string>;
26
+ /** source type id -> reconciled target type id, from the data-model type reconciliation. */
27
+ typeIdRemap: Map<string, string>;
28
+ /** Full source-record -> target-record structural mapping for the cloned subtree. */
29
+ recordMappings: Scl.CloneMapping[];
35
30
  };
36
31
  //# sourceMappingURL=deep.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deep.types.d.ts","sourceRoot":"","sources":["../../../../../src/v2019C1/extensions/extraction/transaction/deep.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AACnF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,MAAM,gBAAgB,GAAG;IAC9B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,qCAAqC;IACrC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAC5B,iDAAiD;IACjD,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACrC,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,wEAAwE;IACxE,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACpC,+DAA+D;IAC/D,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;IAC1B;;;OAGG;IACH,K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CAA4C;IAC5C,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACrC,4FAA4F;IAC5F,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,qFAAqF;IACrF,cAAc,EAAE,GAAG,CAAC,YAAY,EAAE,CAAA;CAClC,CAAA"}
@@ -13,13 +13,23 @@ export declare function findMissingReferencedRecords<Ref extends RefTagName, Tar
13
13
  scopeRef: Scl.Ref<Scl.AncestorsOf<Ref>>;
14
14
  refTagName: Ref;
15
15
  targetTagName: Target;
16
+ /**
17
+ * Source record ids already cloned earlier in this extraction (e.g. as part of
18
+ * a function subtree). Their clones carry remapped uuids, so the source-uuid
19
+ * existence check below cannot see them — skip by source id to avoid cloning
20
+ * a misplaced duplicate.
21
+ */
22
+ alreadyCloned?: ReadonlySet<string>;
16
23
  }): Promise<Scl.Ref<Target>[]>;
24
+ /** Resolves the target parent each missing satellite is cloned under. */
25
+ export type ResolveTargetParent = (ref: Scl.Ref<Scl.ElementsOf>) => Promise<Scl.Ref<Scl.ElementsOf>>;
17
26
  /**
18
27
  * Generic satellite-clone helper.
19
28
  *
20
29
  * Scans `scopeRef` descendants for `refTagName` elements, collects unique uuid
21
30
  * values (derived from the UUID_REFERENCE_PAIRS constant), skips records
22
- * already present in the target, clones each missing one into `targetParent`.
31
+ * already present in the target, clones each missing one under the parent
32
+ * returned by `resolveTargetParent` (mirroring the source hierarchy).
23
33
  * UUID remapping is handled by afterDeepClone hook via cumulativeCloneMappings.
24
34
  */
25
35
  export declare function cloneReferencedRecords<Ref extends RefTagName, Target extends TargetOf<Ref>>(tx: Core.Transaction<Config>, params: {
@@ -27,13 +37,18 @@ export declare function cloneReferencedRecords<Ref extends RefTagName, Target ex
27
37
  scopeRef: Scl.Ref<Scl.AncestorsOf<Ref>>;
28
38
  refTagName: Ref;
29
39
  targetTagName: Target;
30
- targetParent: Scl.Ref<Scl.ElementsOf>;
40
+ resolveTargetParent: ResolveTargetParent;
41
+ alreadyCloned?: ReadonlySet<string>;
31
42
  omit?: OmitEntry<Config>[];
32
43
  }): Promise<void>;
33
44
  /**
34
45
  * Clones all referenced targets for ref types derived from
35
46
  * `DESCENDANTS[scopeTagName] ∩ UUID_REFERENCE_PAIRS`, skipping those in `skip`.
36
47
  *
48
+ * Each missing target is cloned under the parent returned by `resolveTargetParent`,
49
+ * which mirrors the source hierarchy so satellites that live under a `Function` are
50
+ * not flattened to `Substation`.
51
+ *
37
52
  * Targets already present in the target tx are skipped (dedup via findMissingReferencedRecords).
38
53
  * UUID remapping is handled by afterDeepClone hook via cumulativeCloneMappings.
39
54
  */
@@ -41,7 +56,8 @@ export declare function cloneAllReferencedTargets(tx: Core.Transaction<Config>,
41
56
  sourceQuery: Core.Query<Config>;
42
57
  scopeTagName: Scl.ElementsOf;
43
58
  scopeRef: Scl.Ref<Scl.ElementsOf>;
44
- targetParent: Scl.Ref<Scl.ElementsOf>;
59
+ resolveTargetParent: ResolveTargetParent;
60
+ alreadyCloned?: ReadonlySet<string>;
45
61
  skip?: ReadonlySet<string>;
46
62
  omit?: OmitEntry<Config>[];
47
63
  }): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"clone-referenced.d.ts","sourceRoot":"","sources":["../../../../../../src/v2019C1/extensions/extraction/transaction/primitives/clone-referenced.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI/C;;;;;GAKG;AACH,wBAAsB,4BAA4B,CACjD,GAAG,SAAS,UAAU,EACtB,MAAM,SAAS,QAAQ,CAAC,GAAG,CAAC,EAE5B,EAAE,EAAE,IAA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AG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACrC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;CAC1B,GACC,OAAO,CAAC,IAAI,CAAC,CAuBf"}
1
+ {"version":3,"file":"clone-referenced.d.ts","sourceRoot":"","sources":["../../../../../../src/v2019C1/extensions/extraction/transaction/primitives/clone-referenced.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI/C;;;;;GAKG;AACH,wBAAsB,4BAA4B,CACjD,GAAG,SAAS,UAAU,EACtB,MAAM,SAAS,QAAQ,CAAC,GAAG,CAAC,EAE5B,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE;IACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IACvC,UAAU,EAAE,GAAG,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CACnC,GACC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAmC5B;AAED,yEAAyE;AACzE,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,GA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ts","sourceRoot":"","sources":["../../../../../../../src/v2019C1/extensions/extraction/transaction/recipes/asd/clone-application.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC5C,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE;IACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,cAAc,EAAE,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACtC,SAAS,EAAE,iBAAiB,CAAA;CAC5B,GACC,OAAO,CAAC,IAAI,CAAC,CAgDf"}
1
+ {"version":3,"file":"clone-application.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2019C1/extensions/extraction/transaction/recipes/asd/clone-application.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC5C,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE;IACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,cAAc,EAAE,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACtC,SAAS,EAAE,iBAAiB,CAAA;CAC5B,GACC,OAAO,CAAC,IAAI,CAAC,CAsDf"}
@@ -17,7 +17,7 @@ export declare function cloneFunction(tx: Core.Transaction<Config>, params: {
17
17
  targetParentRef: Scl.Ref<'Substation'> | Scl.Ref<'VoltageLevel'> | Scl.Ref<'Bay'>;
18
18
  omit?: OmitEntry<Config>[];
19
19
  stripRootAttributes?: readonly string[];
20
- }): Promise<void>;
20
+ }): Promise<Scl.CloneMapping[]>;
21
21
  /**
22
22
  * Clones FunctionCategory trees that reference the given function (or its SubFunctions).
23
23
  * Each category is placed at its source-side structural level in the TEMPLATE structure.
@@ -1 +1 @@
1
- {"version":3,"file":"clone-function.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2019C1/extensions/extraction/transaction/recipes/shared/clone-function.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI/C;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAClC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE;IACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACzD,eAAe,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACjF,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;IAC1B,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC,GACC,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC5C,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE;IACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACzD,SAAS,EAAE,iBAAiB,CAAA;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC7B,GACC,OAAO,CAAC,IAAI,CAAC,CAmBf"}
1
+ {"version":3,"file":"clone-function.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2019C1/extensions/extraction/transaction/recipes/shared/clone-function.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAI/C;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAClC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE;IACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACzD,eAAe,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACjF,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;IAC1B,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC,GACC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAsB7B;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC5C,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE;IACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACzD,SAAS,EAAE,iBAAiB,CAAA;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC7B,GACC,OAAO,CAAC,IAAI,CAAC,CAmBf"}
@@ -1,3 +1,4 @@
1
+ import { ResolveTargetParent } from '../../primitives/clone-referenced';
1
2
  import { TemplateStructure } from './shared.types';
2
3
  import { Scl, Config } from '../../../../../config';
3
4
  import type * as Core from '@dialecte/core';
@@ -6,4 +7,19 @@ import type * as Core from '@dialecte/core';
6
7
  * and returns the matching target-side structural ref from the template structure.
7
8
  */
8
9
  export declare function resolveStructureRef(sourceQuery: Core.Query<Config>, ref: Scl.Ref<Scl.ElementsOf>, structure: TemplateStructure): Promise<Scl.Ref<'Substation'> | Scl.Ref<'VoltageLevel'> | Scl.Ref<'Bay'>>;
10
+ /**
11
+ * Builds a {@link ResolveTargetParent} that places each satellite by **mirroring
12
+ * the source ancestor chain** into the target.
13
+ *
14
+ * The returned resolver walks the source ancestors nearest-first and returns the
15
+ * first that already exists in the target: a previously-cloned `Function`/`SubFunction`
16
+ * (via `cloneIndex`, keyed by source record id) takes precedence over the structural
17
+ * `Substation`/`VoltageLevel`/`Bay` levels — so a `ProcessResource` that lives under a
18
+ * `Function` is cloned back under that function's clone, not flat at `Substation`.
19
+ */
20
+ export declare function createAncestryResolver(context: {
21
+ sourceQuery: Core.Query<Config>;
22
+ structure: TemplateStructure;
23
+ cloneIndex: ReadonlyMap<string, Scl.Ref<Scl.ElementsOf>>;
24
+ }): ResolveTargetParent;
9
25
  //# sourceMappingURL=resolve-structure-ref.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-structure-ref.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2019C1/extensions/extraction/transaction/recipes/shared/resolve-structure-ref.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAC/B,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,EAC5B,SAAS,EAAE,iBAAiB,GAC1B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAc3E"}
1
+ {"version":3,"file":"resolve-structure-ref.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2019C1/extensions/extraction/transaction/recipes/shared/resolve-structure-ref.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAC/B,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,EAC5B,SAAS,EAAE,iBAAiB,GAC1B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAc3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC/C,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,SAAS,EAAE,iBAAiB,CAAA;IAC5B,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAA;CACxD,GAAG,mBAAmB,CAqBtB"}
@@ -1,4 +1,4 @@
1
- import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, x as b, y as x } from "../extensions-DDF6FezI.js";
1
+ import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, x as b, y as x } from "../extensions-DzEZ0dCq.js";
2
2
  import { Project as S } from "@dialecte/core";
3
3
  //#region src/v2019C1/dialecte.ts
4
4
  function C(e) {
@@ -1,4 +1,4 @@
1
- import { i as e, s as t, t as n } from "../extensions-DDF6FezI.js";
1
+ import { i as e, s as t, t as n } from "../extensions-DzEZ0dCq.js";
2
2
  import { CUSTOM_RECORD_ID_ATTRIBUTE as r, CUSTOM_RECORD_ID_ATTRIBUTE_NAME as i, XMLNS_XSI_NAMESPACE as a } from "@dialecte/core/helpers";
3
3
  import { XMLNS_DEV_NAMESPACE as o, createTestProject as s, createTestRecordFactory as c, createTestRunner as l, createXmlAssertions as u } from "@dialecte/core/test";
4
4
  //#region src/v2019C1/test/hydrated-test.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dialecte/scl",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
4
4
  "description": "Dialecte - SCL (Substation Configuration Language) sdk",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -53,13 +53,13 @@
53
53
  "prepare": "husky"
54
54
  },
55
55
  "dependencies": {
56
- "@dialecte/core": "0.2.21"
56
+ "@dialecte/core": "0.2.22"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@dialecte/cli": "0.0.1",
60
60
  "@tsconfig/node24": "^24.0.4",
61
61
  "@types/node": "^24.12.4",
62
- "@vitest/browser-playwright": "^4.1.8",
62
+ "@vitest/browser-playwright": "4.1.8",
63
63
  "husky": "^9.1.7",
64
64
  "jiti": "^2.4.2",
65
65
  "npm-run-all2": "^8.0.4",
@@ -69,11 +69,11 @@
69
69
  "playwright": "^1.60.0",
70
70
  "tsx": "^4.22.4",
71
71
  "typescript": "^6.0.3",
72
- "vite": "^8.0.16",
72
+ "vite": "8.0.16",
73
73
  "vite-plugin-dts": "^5.0.2",
74
74
  "vitepress": "^2.0.0-alpha.17",
75
75
  "vitepress-mermaid-renderer": "^1.1.21",
76
76
  "vitepress-plugin-llms": "^1.13.1",
77
- "vitest": "^4.1.8"
77
+ "vitest": "4.1.8"
78
78
  }
79
79
  }