@dialecte/scl 0.2.22 → 0.2.24

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.
Files changed (19) hide show
  1. package/dist/{extensions-DDF6FezI.js → extensions-DY4WzfhV.js} +491 -397
  2. package/dist/v2019C1/extensions/data-model/transaction/import-types.d.ts +6 -1
  3. package/dist/v2019C1/extensions/data-model/transaction/import-types.d.ts.map +1 -1
  4. package/dist/v2019C1/extensions/data-model/transaction/import-types.types.d.ts +2 -0
  5. package/dist/v2019C1/extensions/data-model/transaction/import-types.types.d.ts.map +1 -1
  6. package/dist/v2019C1/extensions/extraction/transaction/deep.d.ts +7 -7
  7. package/dist/v2019C1/extensions/extraction/transaction/deep.d.ts.map +1 -1
  8. package/dist/v2019C1/extensions/extraction/transaction/deep.types.d.ts +4 -9
  9. package/dist/v2019C1/extensions/extraction/transaction/deep.types.d.ts.map +1 -1
  10. package/dist/v2019C1/extensions/extraction/transaction/primitives/clone-referenced.d.ts +19 -3
  11. package/dist/v2019C1/extensions/extraction/transaction/primitives/clone-referenced.d.ts.map +1 -1
  12. package/dist/v2019C1/extensions/extraction/transaction/recipes/asd/clone-application.d.ts.map +1 -1
  13. package/dist/v2019C1/extensions/extraction/transaction/recipes/shared/clone-function.d.ts +1 -1
  14. package/dist/v2019C1/extensions/extraction/transaction/recipes/shared/clone-function.d.ts.map +1 -1
  15. package/dist/v2019C1/extensions/extraction/transaction/recipes/shared/resolve-structure-ref.d.ts +16 -0
  16. package/dist/v2019C1/extensions/extraction/transaction/recipes/shared/resolve-structure-ref.d.ts.map +1 -1
  17. package/dist/v2019C1/index.js +1 -1
  18. package/dist/v2019C1/test.js +1 -1
  19. package/package.json +1 -1
@@ -9,7 +9,12 @@ export type { ImportTypesParams, ImportTypesResult, ImportTypesStats } from './i
9
9
  * - **R1** structurally-equal type already in the target → reuse its id (dedup);
10
10
  * - **R2** no match and the source id is free → clone, preserving the id;
11
11
  * - **R3** no match but the id is taken by different content → fork under a new
12
- * content-hash id (`<forkPrefix><id>_<hash>`) and propagate the fork upward.
12
+ * content-hash id (`<forkPrefix><id>_<hash>`) and propagate the fork upward; then,
13
+ * if the displaced target type is left with **no** file-wide referrers (an update
14
+ * whose old version is no longer consumed), prune that orphan and reclaim its id
15
+ * for the fork. Pruning is refcount-based and cascades to descendants only where
16
+ * their own referrer count hits zero, so a child type still shared elsewhere keeps
17
+ * its fork.
13
18
  *
14
19
  * Child type references inside the imported types — and the `lnType` of the
15
20
  * instances in `cloneMappings` (the caller's instance clone) — are repointed to
@@ -1 +1 @@
1
- {"version":3,"file":"import-types.d.ts","sourceRoot":"","sources":["../../../../../src/v2019C1/extensions/data-model/transaction/import-types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,iBAAiB,EACjB,iBAAiB,EAGjB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAElG;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAChC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,iBAAiB,GACvB,OAAO,CAAC,iBAAiB,CAAC,CAuE5B"}
1
+ {"version":3,"file":"import-types.d.ts","sourceRoot":"","sources":["../../../../../src/v2019C1/extensions/data-model/transaction/import-types.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACX,iBAAiB,EACjB,iBAAiB,EAGjB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAc3C,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAElG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAChC,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,iBAAiB,GACvB,OAAO,CAAC,iBAAiB,CAAC,CA8F5B"}
@@ -6,6 +6,8 @@ export type ImportTypesStats = {
6
6
  reused: number;
7
7
  preserved: number;
8
8
  forked: number;
9
+ /** Forks whose id was reclaimed from a now-orphaned superseded type. */
10
+ reclaimed: number;
9
11
  };
10
12
  export type ImportTypesResult = {
11
13
  /** source type id -> target type id (reused, preserved, or forked). */
@@ -1 +1 @@
1
- {"version":3,"file":"import-types.types.d.ts","sourceRoot":"","sources":["../../../../../src/v2019C1/extensions/data-model/transaction/import-types.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C,gEAAgE;AAChE,MAAM,MAAM,UAAU,GACnB,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,GAC7B,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,GAC3B,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,GAC3B,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;AAEjC,MAAM,MAAM,gBAAgB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,uEAAuE;IACvE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,KAAK,EAAE,gBAAgB,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,OAAO,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,CAAA;IACjE;;;;;OAKG;IACH,aAAa,CAAC,EAAE,GAAG,CAAC,YAAY,EAAE,CAAA;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA"}
1
+ {"version":3,"file":"import-types.types.d.ts","sourceRoot":"","sources":["../../../../../src/v2019C1/extensions/data-model/transaction/import-types.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C,gEAAgE;AAChE,MAAM,MAAM,UAAU,GACnB,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,GAC7B,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,GAC3B,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,GAC3B,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;AAEjC,MAAM,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,uEAAuE;IACvE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,KAAK,EAAE,gBAAgB,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,OAAO,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,CAAA;IACjE;;;;;OAKG;IACH,aAAa,CAAC,EAAE,GAAG,CAAC,YAAY,EAAE,CAAA;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA"}
@@ -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,CA4B3B"}
@@ -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,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,sFAAsF;IACtF,WAAW,CAAC,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,4CAA4C;IAC5C,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACrC,sEAAsE;IACtE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC5B,CAAA"}
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,+DAA+D;IAC/D,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,sFAAsF;IACtF,WAAW,CAAC,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,4CAA4C;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,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;CACrB,GACC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAkC5B;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,SAAS,UAAU,EAAE,MAAM,SAAS,QAAQ,CAAC,GAAG,CAAC,EAChG,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,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACrC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;CAC1B,GACC,OAAO,CAAC,IAAI,CAAC,CAaf;AAkBD;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC9C,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE;IACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,YAAY,EAAE,GAAG,CAAC,UAAU,CAAA;IAC5B,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACjC,YAAY,EAAE,GAAG,CAAC,GAAG,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,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAA;AAEpG;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,SAAS,UAAU,EAAE,MAAM,SAAS,QAAQ,CAAC,GAAG,CAAC,EAChG,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,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACnC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;CAC1B,GACC,OAAO,CAAC,IAAI,CAAC,CAuBf;AAmBD;;;;;;;;;;GAUG;AACH,wBAAsB,yBAAyB,CAC9C,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE;IACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,YAAY,EAAE,GAAG,CAAC,UAAU,CAAA;IAC5B,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACjC,mBAAmB,EAAE,mBAAmB,CAAA;IACxC,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACnC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;CAC1B,GACC,OAAO,CAAC,IAAI,CAAC,CAgCf"}
@@ -1 +1 @@
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,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-DY4WzfhV.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-DY4WzfhV.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.22",
3
+ "version": "0.2.24",
4
4
  "description": "Dialecte - SCL (Substation Configuration Language) sdk",
5
5
  "license": "MIT",
6
6
  "repository": {