@dialecte/scl 0.1.20 → 0.2.0
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.
- package/dist/{index-uvKv9uth.js → dialecte.config-BkqCz0VE.js} +765 -757
- package/dist/v2019C1/config/dialecte.config.d.ts +14 -0
- package/dist/v2019C1/config/dialecte.config.d.ts.map +1 -1
- package/dist/v2019C1/config/hydrated.types.d.ts +1 -0
- package/dist/v2019C1/config/hydrated.types.d.ts.map +1 -1
- package/dist/v2019C1/dialecte.d.ts +9 -50
- package/dist/v2019C1/dialecte.d.ts.map +1 -1
- package/dist/v2019C1/extensions/template/transaction/shared/clone-function.d.ts.map +1 -1
- package/dist/v2019C1/hooks/index.d.ts +2 -0
- package/dist/v2019C1/hooks/index.d.ts.map +1 -1
- package/dist/v2019C1/hooks/io/index.d.ts.map +1 -0
- package/dist/v2019C1/{io/hooks → hooks/io}/io-hooks.d.ts.map +1 -1
- package/dist/v2019C1/{io/hooks → hooks/io}/io-hooks.types.d.ts.map +1 -1
- package/dist/v2019C1/index.d.ts +0 -1
- package/dist/v2019C1/index.d.ts.map +1 -1
- package/dist/v2019C1/index.js +138 -164
- package/dist/v2019C1/test/hydrated-test.d.ts +4 -14
- package/dist/v2019C1/test/hydrated-test.d.ts.map +1 -1
- package/dist/v2019C1/test/hydrated-test.types.d.ts +3 -1
- package/dist/v2019C1/test/hydrated-test.types.d.ts.map +1 -1
- package/dist/v2019C1/test.js +20 -19
- package/package.json +2 -2
- package/dist/v2019C1/io/export.d.ts +0 -11
- package/dist/v2019C1/io/export.d.ts.map +0 -1
- package/dist/v2019C1/io/hooks/index.d.ts.map +0 -1
- package/dist/v2019C1/io/import.d.ts +0 -5
- package/dist/v2019C1/io/import.d.ts.map +0 -1
- package/dist/v2019C1/io/index.d.ts +0 -3
- package/dist/v2019C1/io/index.d.ts.map +0 -1
- /package/dist/v2019C1/{io/hooks → hooks/io}/index.d.ts +0 -0
- /package/dist/v2019C1/{io/hooks → hooks/io}/io-hooks.d.ts +0 -0
- /package/dist/v2019C1/{io/hooks → hooks/io}/io-hooks.types.d.ts +0 -0
package/dist/v2019C1/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
import { b as
|
|
3
|
-
import { isChildOf as b, stripAttributes as
|
|
4
|
-
import { invariant as
|
|
5
|
-
import {
|
|
6
|
-
async function
|
|
1
|
+
import { R as Y, U as w, K as W, D as q, r as C, a as X, H as Z, S as J } from "../dialecte.config-BkqCz0VE.js";
|
|
2
|
+
import { b as kt, c as Qt, d as $t } from "../dialecte.config-BkqCz0VE.js";
|
|
3
|
+
import { isChildOf as b, stripAttributes as x } from "@dialecte/core/helpers";
|
|
4
|
+
import { invariant as M } from "@dialecte/core/utils";
|
|
5
|
+
import { Project as tt } from "@dialecte/core";
|
|
6
|
+
async function et(t) {
|
|
7
7
|
const a = await t.getRecordsByTagName("LNode");
|
|
8
8
|
for (const e of a) {
|
|
9
9
|
const n = await t.getAttribute(e, { name: "iedName" });
|
|
@@ -12,10 +12,10 @@ async function it(t) {
|
|
|
12
12
|
tagName: "IED",
|
|
13
13
|
attributes: { name: n }
|
|
14
14
|
});
|
|
15
|
-
o || await
|
|
15
|
+
o || await nt(t, e);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
async function
|
|
18
|
+
async function nt(t, a) {
|
|
19
19
|
const e = await t.getChild(a, "LNodeSpecNaming");
|
|
20
20
|
if (e) {
|
|
21
21
|
const n = await t.getAttribute(e, { name: "sLnClass" }), o = await t.getAttribute(e, { name: "sLnInst" }), i = await t.getAttribute(e, { name: "sPrefix" });
|
|
@@ -45,15 +45,15 @@ async function st(t, a) {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
async function
|
|
49
|
-
const a = [...Object.values(
|
|
48
|
+
async function at(t) {
|
|
49
|
+
const a = [...Object.values(Y).flat(), "Private"];
|
|
50
50
|
for (const e of a) {
|
|
51
51
|
const n = await t.getRecordsByTagName(e);
|
|
52
52
|
for (const o of n)
|
|
53
53
|
o.children.length === 0 && await t.delete(o);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
async function
|
|
56
|
+
async function ot(t) {
|
|
57
57
|
const a = Object.keys(w);
|
|
58
58
|
for (const e of a) {
|
|
59
59
|
const n = w[e], o = await t.getRecordsByTagName(e);
|
|
@@ -65,7 +65,7 @@ async function ct(t) {
|
|
|
65
65
|
name: f.attribute.uuid
|
|
66
66
|
});
|
|
67
67
|
if (!l) continue;
|
|
68
|
-
if (r = !0, await
|
|
68
|
+
if (r = !0, await it(t, l, f.target))
|
|
69
69
|
s = !0;
|
|
70
70
|
else {
|
|
71
71
|
c[f.attribute.uuid] = void 0, c[f.attribute.path] = void 0;
|
|
@@ -74,12 +74,12 @@ async function ct(t) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
Object.keys(c).length > 0 && await t.update(i, { attributes: c });
|
|
77
|
-
const u =
|
|
77
|
+
const u = W.has(e);
|
|
78
78
|
r && !s && !u && await t.delete(i);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
async function
|
|
82
|
+
async function it(t, a, e) {
|
|
83
83
|
for (const n of e) {
|
|
84
84
|
const [o] = await t.findByAttributes({
|
|
85
85
|
tagName: n,
|
|
@@ -89,15 +89,15 @@ async function ut(t, a, e) {
|
|
|
89
89
|
}
|
|
90
90
|
return !1;
|
|
91
91
|
}
|
|
92
|
-
const
|
|
92
|
+
const st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
93
93
|
__proto__: null,
|
|
94
|
-
orphanUuidRefs:
|
|
95
|
-
pruneEmptyContainers:
|
|
96
|
-
resetLNode:
|
|
94
|
+
orphanUuidRefs: ot,
|
|
95
|
+
pruneEmptyContainers: at,
|
|
96
|
+
resetLNode: et
|
|
97
97
|
}, Symbol.toStringTag, { value: "Module" })), N = {
|
|
98
|
-
transaction:
|
|
98
|
+
transaction: st
|
|
99
99
|
};
|
|
100
|
-
async function
|
|
100
|
+
async function H(t, a) {
|
|
101
101
|
const { records: e } = a, n = {
|
|
102
102
|
lnodeTypes: /* @__PURE__ */ new Map(),
|
|
103
103
|
doTypes: /* @__PURE__ */ new Map(),
|
|
@@ -111,7 +111,7 @@ async function B(t, a) {
|
|
|
111
111
|
tagName: "LNodeType",
|
|
112
112
|
attributes: { id: i }
|
|
113
113
|
});
|
|
114
|
-
if (
|
|
114
|
+
if (M(r, {
|
|
115
115
|
key: "ELEMENT_NOT_FOUND",
|
|
116
116
|
detail: `LNodeType not found for lnType="${i}"`
|
|
117
117
|
}), !y(n.lnodeTypes, i, r)) continue;
|
|
@@ -171,12 +171,12 @@ async function h(t) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
const
|
|
174
|
+
const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
175
175
|
__proto__: null,
|
|
176
|
-
resolve:
|
|
176
|
+
resolve: H
|
|
177
177
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
178
|
-
async function
|
|
179
|
-
const { sourceQuery: e, records: n } = a, o = await
|
|
178
|
+
async function ct(t, a) {
|
|
179
|
+
const { sourceQuery: e, records: n } = a, o = await H(e, { records: n }), i = ut(o), r = await t.getRoot(), s = await t.ensureChild(r, {
|
|
180
180
|
tagName: "DataTypeTemplates",
|
|
181
181
|
attributes: {}
|
|
182
182
|
});
|
|
@@ -192,17 +192,17 @@ async function lt(t, a) {
|
|
|
192
192
|
f && await t.deepClone(s, f);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function ut(t) {
|
|
196
196
|
return [...t.lnodeTypes, ...t.doTypes, ...t.daTypes, ...t.enumTypes];
|
|
197
197
|
}
|
|
198
|
-
const
|
|
198
|
+
const dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
199
199
|
__proto__: null,
|
|
200
|
-
extract:
|
|
201
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
202
|
-
query:
|
|
203
|
-
transaction:
|
|
200
|
+
extract: ct
|
|
201
|
+
}, Symbol.toStringTag, { value: "Module" })), U = {
|
|
202
|
+
query: rt,
|
|
203
|
+
transaction: dt
|
|
204
204
|
};
|
|
205
|
-
async function
|
|
205
|
+
async function B(t) {
|
|
206
206
|
const a = await t.getRecord({ tagName: "History" });
|
|
207
207
|
if (!a) return [];
|
|
208
208
|
const { Hitem: e = [] } = await t.findDescendants(a, { collect: "Hitem" });
|
|
@@ -214,16 +214,16 @@ async function V(t) {
|
|
|
214
214
|
return s !== 0 ? s : n(i, "revision") - n(r, "revision");
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
|
-
async function
|
|
218
|
-
return (await
|
|
217
|
+
async function j(t) {
|
|
218
|
+
return (await B(t)).at(-1);
|
|
219
219
|
}
|
|
220
|
-
const
|
|
220
|
+
const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
221
221
|
__proto__: null,
|
|
222
|
-
getLatestHitem:
|
|
223
|
-
getSortedHitems:
|
|
222
|
+
getLatestHitem: j,
|
|
223
|
+
getSortedHitems: B
|
|
224
224
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
225
|
-
async function
|
|
226
|
-
const { filename: e, header: n, item: o } = a, { id: i, fileType: r, nameStructure: s, version: c, tool: u } = n, { who: d, what: f, why: l } = o, m = await t.getRoot(),
|
|
225
|
+
async function lt(t, a) {
|
|
226
|
+
const { filename: e, header: n, item: o } = a, { id: i, fileType: r, nameStructure: s, version: c, tool: u } = n, { who: d, what: f, why: l } = o, m = await t.getRoot(), S = await t.getRecord({ tagName: "Header" }) ?? await t.addChild(m, {
|
|
227
227
|
tagName: "Header",
|
|
228
228
|
attributes: {
|
|
229
229
|
id: i ?? e.replace(/\.[^.]+$/, "").toLowerCase().replace(/\s+/g, "_"),
|
|
@@ -234,32 +234,32 @@ async function yt(t, a) {
|
|
|
234
234
|
revision: "1",
|
|
235
235
|
uuid: crypto.randomUUID()
|
|
236
236
|
}
|
|
237
|
-
}),
|
|
238
|
-
await t.update(
|
|
239
|
-
attributes: { version:
|
|
237
|
+
}), z = await t.getRecord({ tagName: "History" }) ?? await t.addChild(S, { tagName: "History", attributes: {} }), O = await j(t), A = O?.attributes.find((_) => _.name === "version")?.value, I = O?.attributes.find((_) => _.name === "revision")?.value, v = c === "keep" ? A ?? "0" : A ? String(Number(A) + 1) : "0", E = I ? String(Number(I) + 1) : "1";
|
|
238
|
+
await t.update(S, {
|
|
239
|
+
attributes: { version: v, revision: E }
|
|
240
240
|
});
|
|
241
|
-
const
|
|
242
|
-
await t.addChild(
|
|
241
|
+
const P = /* @__PURE__ */ new Date(), g = P.toString().split(" "), G = P.toLocaleString("en", { timeZoneName: "short" }).split(" ").pop(), K = `${g[0]} ${g[1]} ${g[2]} ${g[4]} ${G} ${g[3]}`;
|
|
242
|
+
await t.addChild(z, {
|
|
243
243
|
tagName: "Hitem",
|
|
244
244
|
attributes: {
|
|
245
|
-
version:
|
|
246
|
-
revision:
|
|
247
|
-
when:
|
|
245
|
+
version: v,
|
|
246
|
+
revision: E,
|
|
247
|
+
when: K,
|
|
248
248
|
who: d,
|
|
249
249
|
what: f,
|
|
250
250
|
why: l
|
|
251
251
|
}
|
|
252
|
-
}), await t.update(
|
|
253
|
-
attributes: { version:
|
|
252
|
+
}), await t.update(S, {
|
|
253
|
+
attributes: { version: v, revision: E }
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
|
-
const
|
|
256
|
+
const mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
257
257
|
__proto__: null,
|
|
258
|
-
addEntry:
|
|
258
|
+
addEntry: lt
|
|
259
259
|
}, Symbol.toStringTag, { value: "Module" })), L = {
|
|
260
|
-
query:
|
|
261
|
-
transaction:
|
|
262
|
-
},
|
|
260
|
+
query: ft,
|
|
261
|
+
transaction: mt
|
|
262
|
+
}, pt = {
|
|
263
263
|
LNode: ["prefix", "lnClass", "lnInst"],
|
|
264
264
|
LN: ["prefix", "lnClass", "inst"],
|
|
265
265
|
LN0: ["prefix", "lnClass", "inst"],
|
|
@@ -277,7 +277,7 @@ const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
277
277
|
Resource: ["resInst"],
|
|
278
278
|
Hitem: ["version", "revision"],
|
|
279
279
|
History: ["version", "revision"]
|
|
280
|
-
},
|
|
280
|
+
}, gt = {
|
|
281
281
|
ConnectedAP: " / ",
|
|
282
282
|
GSE: "/",
|
|
283
283
|
SMV: "/",
|
|
@@ -286,24 +286,24 @@ const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
286
286
|
ControlRef: "/",
|
|
287
287
|
SourceRef: "/"
|
|
288
288
|
};
|
|
289
|
-
async function
|
|
289
|
+
async function yt(t, a) {
|
|
290
290
|
const e = await t.getRecord(a);
|
|
291
291
|
if (!e) return "";
|
|
292
|
-
const n = e.tagName, o = await t.any.getAttributes(e), i =
|
|
292
|
+
const n = e.tagName, o = await t.any.getAttributes(e), i = pt[n];
|
|
293
293
|
if (i) {
|
|
294
|
-
const u =
|
|
294
|
+
const u = gt[n] ?? "", d = i.map((f) => o[f]).filter(Boolean);
|
|
295
295
|
return d.length > 0 ? d.join(u) : n;
|
|
296
296
|
}
|
|
297
|
-
const s =
|
|
297
|
+
const s = q[n]?.attributes?.identityFields, c = s?.find((u) => u === "name" || u === "id") ?? s?.[0];
|
|
298
298
|
return c ? o[c] || n : o.name || n;
|
|
299
299
|
}
|
|
300
|
-
const
|
|
300
|
+
const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
301
301
|
__proto__: null,
|
|
302
|
-
extractElementTitle:
|
|
303
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
304
|
-
query:
|
|
302
|
+
extractElementTitle: yt
|
|
303
|
+
}, Symbol.toStringTag, { value: "Module" })), bt = {
|
|
304
|
+
query: wt
|
|
305
305
|
};
|
|
306
|
-
async function
|
|
306
|
+
async function F(t) {
|
|
307
307
|
const a = await t.getRoot(), e = await t.ensureChild(a, {
|
|
308
308
|
tagName: "Substation",
|
|
309
309
|
attributes: { name: "TEMPLATE" }
|
|
@@ -320,52 +320,52 @@ async function I(t) {
|
|
|
320
320
|
Bay: o
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
const
|
|
323
|
+
const Nt = {
|
|
324
324
|
scope: "tree",
|
|
325
325
|
attributes: ["templateUuid", "originUuid"]
|
|
326
326
|
};
|
|
327
|
-
async function
|
|
328
|
-
const { sourceQuery: e, ref: n, targetParent: o, omit: i, promoteRoot: r, strip: s =
|
|
327
|
+
async function R(t, a) {
|
|
328
|
+
const { sourceQuery: e, ref: n, targetParent: o, omit: i, promoteRoot: r, strip: s = Nt } = a, c = await e.getTree(n, { omit: i });
|
|
329
329
|
if (!c) return;
|
|
330
330
|
const u = r && c.tagName === r.from ? { ...c, tagName: r.to } : c;
|
|
331
331
|
let d = u;
|
|
332
|
-
s && (d = s.scope === "tree" ?
|
|
332
|
+
s && (d = s.scope === "tree" ? x(u, s.attributes) : {
|
|
333
333
|
...u,
|
|
334
334
|
attributes: u.attributes.filter((f) => !s.attributes.includes(f.name))
|
|
335
335
|
}), await t.deepClone(o, d);
|
|
336
336
|
}
|
|
337
|
-
async function
|
|
337
|
+
async function Tt(t, a) {
|
|
338
338
|
const { sourceQuery: e, scopeRef: n } = a, { LNode: o = [] } = await e.findDescendants(n, {
|
|
339
339
|
collect: "LNode"
|
|
340
340
|
});
|
|
341
|
-
o.length > 0 && await
|
|
341
|
+
o.length > 0 && await U.transaction.extract(t, { sourceQuery: e, records: o });
|
|
342
342
|
}
|
|
343
|
-
async function
|
|
343
|
+
async function D(t, a, e) {
|
|
344
344
|
const o = (await t.findAncestors(a, { stopAtTagName: "Substation" })).find((r) => r.tagName in e);
|
|
345
|
-
|
|
345
|
+
M(o, {
|
|
346
346
|
key: "ELEMENT_NOT_FOUND",
|
|
347
347
|
detail: `No Substation/VoltageLevel/Bay ancestor found for ${a.tagName}`
|
|
348
348
|
});
|
|
349
349
|
const i = e[o.tagName];
|
|
350
350
|
return { tagName: i.tagName, id: i.id };
|
|
351
351
|
}
|
|
352
|
-
async function
|
|
352
|
+
async function V(t, a) {
|
|
353
353
|
const { sourceQuery: e, functionRef: n, targetParentRef: o, omit: i, stripRootAttributes: r } = a, s = r?.length ? { scope: "root", attributes: [...r] } : !1;
|
|
354
|
-
await
|
|
354
|
+
await R(t, {
|
|
355
355
|
sourceQuery: e,
|
|
356
356
|
ref: n,
|
|
357
357
|
targetParent: o,
|
|
358
358
|
omit: i,
|
|
359
359
|
promoteRoot: { from: "SubFunction", to: "Function" },
|
|
360
360
|
strip: s
|
|
361
|
-
}), await
|
|
361
|
+
}), await Tt(t, { sourceQuery: e, scopeRef: n });
|
|
362
362
|
}
|
|
363
|
-
async function
|
|
364
|
-
const { sourceQuery: e, functionRef: n, structure: o, stripCategoriesUuid: i = !0 } = a, r = await
|
|
363
|
+
async function k(t, a) {
|
|
364
|
+
const { sourceQuery: e, functionRef: n, structure: o, stripCategoriesUuid: i = !0 } = a, r = await Rt(e, n);
|
|
365
365
|
for (const s of r) {
|
|
366
|
-
if (await
|
|
367
|
-
const u = { tagName: "FunctionCategory", id: s }, d = await
|
|
368
|
-
await
|
|
366
|
+
if (await At(t, e, s)) continue;
|
|
367
|
+
const u = { tagName: "FunctionCategory", id: s }, d = await D(e, u, o);
|
|
368
|
+
await R(t, {
|
|
369
369
|
sourceQuery: e,
|
|
370
370
|
ref: u,
|
|
371
371
|
targetParent: d,
|
|
@@ -373,21 +373,21 @@ async function $(t, a) {
|
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
async function
|
|
377
|
-
const e = await
|
|
376
|
+
async function Rt(t, a) {
|
|
377
|
+
const e = await St(t, a), n = /* @__PURE__ */ new Set();
|
|
378
378
|
for (const { container: o } of e)
|
|
379
379
|
o && n.add(o.id);
|
|
380
380
|
return n;
|
|
381
381
|
}
|
|
382
|
-
async function
|
|
383
|
-
const e = await
|
|
382
|
+
async function St(t, a) {
|
|
383
|
+
const e = await C.query.findRefsPointingTo(t, {
|
|
384
384
|
target: a,
|
|
385
385
|
containerTagName: "FunctionCategory"
|
|
386
386
|
}), { SubFunction: n = [] } = await t.findDescendants(a, {
|
|
387
387
|
collect: "SubFunction"
|
|
388
388
|
});
|
|
389
389
|
for (const o of n) {
|
|
390
|
-
const i = await
|
|
390
|
+
const i = await C.query.findRefsPointingTo(t, {
|
|
391
391
|
target: { tagName: "SubFunction", id: o.id },
|
|
392
392
|
containerTagName: "FunctionCategory"
|
|
393
393
|
});
|
|
@@ -395,7 +395,7 @@ async function Dt(t, a) {
|
|
|
395
395
|
}
|
|
396
396
|
return e;
|
|
397
397
|
}
|
|
398
|
-
async function
|
|
398
|
+
async function At(t, a, e) {
|
|
399
399
|
const n = await a.getRecord({
|
|
400
400
|
tagName: "FunctionCategory",
|
|
401
401
|
id: e
|
|
@@ -409,7 +409,7 @@ async function Et(t, a, e) {
|
|
|
409
409
|
});
|
|
410
410
|
return !!i;
|
|
411
411
|
}
|
|
412
|
-
async function
|
|
412
|
+
async function Q(t, a) {
|
|
413
413
|
const { sourceQuery: e, scopeRef: n, refTagName: o, targetTagName: i } = a, r = w[o][0].attribute.uuid, s = await e.findDescendants(n, {
|
|
414
414
|
collect: o
|
|
415
415
|
}), { [o]: c = [] } = s, u = /* @__PURE__ */ new Set();
|
|
@@ -431,20 +431,20 @@ async function z(t, a) {
|
|
|
431
431
|
}
|
|
432
432
|
return d;
|
|
433
433
|
}
|
|
434
|
-
async function
|
|
435
|
-
const { sourceQuery: e, scopeRef: n, refTagName: o, targetTagName: i, targetParent: r, omit: s } = a, c = await
|
|
434
|
+
async function vt(t, a) {
|
|
435
|
+
const { sourceQuery: e, scopeRef: n, refTagName: o, targetTagName: i, targetParent: r, omit: s } = a, c = await Q(t, {
|
|
436
436
|
sourceQuery: e,
|
|
437
437
|
scopeRef: n,
|
|
438
438
|
refTagName: o,
|
|
439
439
|
targetTagName: i
|
|
440
440
|
});
|
|
441
441
|
for (const u of c)
|
|
442
|
-
await
|
|
442
|
+
await R(t, { sourceQuery: e, ref: u, targetParent: r, omit: s });
|
|
443
443
|
}
|
|
444
|
-
async function
|
|
445
|
-
const { sourceQuery: e, scopeTagName: n, scopeRef: o, targetParent: i, skip: r = /* @__PURE__ */ new Set(), omit: s } = a, c =
|
|
444
|
+
async function Et(t, a) {
|
|
445
|
+
const { sourceQuery: e, scopeTagName: n, scopeRef: o, targetParent: i, skip: r = /* @__PURE__ */ new Set(), omit: s } = a, c = X[n].filter(
|
|
446
446
|
(d) => d in w && !r.has(d)
|
|
447
|
-
), u =
|
|
447
|
+
), u = vt;
|
|
448
448
|
for (const d of c)
|
|
449
449
|
for (const f of w[d])
|
|
450
450
|
for (const l of f.target)
|
|
@@ -462,7 +462,7 @@ const T = [
|
|
|
462
462
|
"ApplicationSclRef",
|
|
463
463
|
"GeneralEquipment",
|
|
464
464
|
"ConductingEquipment"
|
|
465
|
-
],
|
|
465
|
+
], _t = [
|
|
466
466
|
...T,
|
|
467
467
|
"DOS",
|
|
468
468
|
"Labels",
|
|
@@ -473,19 +473,19 @@ const T = [
|
|
|
473
473
|
"BehaviorDescription",
|
|
474
474
|
"Variable"
|
|
475
475
|
];
|
|
476
|
-
async function
|
|
476
|
+
async function Ct(t, a) {
|
|
477
477
|
const { sourceQuery: e, applicationRef: n, structure: o } = a, i = {
|
|
478
478
|
tagName: "Substation",
|
|
479
479
|
id: o.Substation.id
|
|
480
|
-
}, r = await
|
|
480
|
+
}, r = await Q(t, {
|
|
481
481
|
sourceQuery: e,
|
|
482
482
|
scopeRef: n,
|
|
483
483
|
refTagName: "FunctionRef",
|
|
484
484
|
targetTagName: "Function"
|
|
485
485
|
});
|
|
486
486
|
for (const u of r) {
|
|
487
|
-
const d = await
|
|
488
|
-
await
|
|
487
|
+
const d = await D(e, u, o);
|
|
488
|
+
await V(t, {
|
|
489
489
|
sourceQuery: e,
|
|
490
490
|
functionRef: u,
|
|
491
491
|
targetParentRef: d,
|
|
@@ -493,13 +493,13 @@ async function Lt(t, a) {
|
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
for (const u of r)
|
|
496
|
-
await
|
|
496
|
+
await k(t, {
|
|
497
497
|
sourceQuery: e,
|
|
498
498
|
functionRef: u,
|
|
499
499
|
structure: o,
|
|
500
500
|
stripCategoriesUuid: !1
|
|
501
501
|
});
|
|
502
|
-
await
|
|
502
|
+
await Et(t, {
|
|
503
503
|
sourceQuery: e,
|
|
504
504
|
scopeTagName: "Application",
|
|
505
505
|
scopeRef: n,
|
|
@@ -507,14 +507,14 @@ async function Lt(t, a) {
|
|
|
507
507
|
skip: /* @__PURE__ */ new Set(["FunctionRef", "FunctionCategoryRef"]),
|
|
508
508
|
omit: T
|
|
509
509
|
});
|
|
510
|
-
const c = await
|
|
511
|
-
await
|
|
510
|
+
const c = await D(e, n, o);
|
|
511
|
+
await R(t, { sourceQuery: e, ref: n, targetParent: c, omit: T });
|
|
512
512
|
}
|
|
513
|
-
async function
|
|
513
|
+
async function $(t) {
|
|
514
514
|
await N.transaction.orphanUuidRefs(t), await N.transaction.resetLNode(t), await N.transaction.pruneEmptyContainers(t);
|
|
515
515
|
}
|
|
516
|
-
async function
|
|
517
|
-
const { sourceQuery: e, applicationRef: n, tool: o, who: i, nameStructure: r } = a, s = await
|
|
516
|
+
async function ht(t, a) {
|
|
517
|
+
const { sourceQuery: e, applicationRef: n, tool: o, who: i, nameStructure: r } = a, s = await F(t), c = await t.getAttribute(n, { name: "name" }) || "Unnamed Application";
|
|
518
518
|
await L.transaction.addEntry(t, {
|
|
519
519
|
filename: `ASD_${c.replace(/\s+/g, "_")}`,
|
|
520
520
|
header: {
|
|
@@ -528,10 +528,10 @@ async function It(t, a) {
|
|
|
528
528
|
what: "ASD initialization",
|
|
529
529
|
why: "Application was extracted from a previous file"
|
|
530
530
|
}
|
|
531
|
-
}), await
|
|
531
|
+
}), await Ct(t, { sourceQuery: e, applicationRef: n, structure: s }), await $(t);
|
|
532
532
|
}
|
|
533
|
-
async function
|
|
534
|
-
const { sourceQuery: e, functionRef: n, tool: o, who: i, nameStructure: r } = a, s = await
|
|
533
|
+
async function Dt(t, a) {
|
|
534
|
+
const { sourceQuery: e, functionRef: n, tool: o, who: i, nameStructure: r } = a, s = await F(t), c = {
|
|
535
535
|
tagName: s.Substation.tagName,
|
|
536
536
|
id: s.Substation.id
|
|
537
537
|
}, u = await e.getAttribute(n, { name: "name" }) || "Unnamed Function";
|
|
@@ -548,76 +548,50 @@ async function Ot(t, a) {
|
|
|
548
548
|
what: "FSD initialization",
|
|
549
549
|
why: "Function was extracted from a previous file"
|
|
550
550
|
}
|
|
551
|
-
}), await
|
|
551
|
+
}), await V(t, {
|
|
552
552
|
sourceQuery: e,
|
|
553
553
|
functionRef: n,
|
|
554
554
|
targetParentRef: c,
|
|
555
|
-
omit:
|
|
555
|
+
omit: _t,
|
|
556
556
|
stripRootAttributes: ["templateUuid"]
|
|
557
|
-
}), await
|
|
557
|
+
}), await k(t, {
|
|
558
558
|
sourceQuery: e,
|
|
559
559
|
functionRef: n,
|
|
560
560
|
structure: s
|
|
561
|
-
}), await
|
|
561
|
+
}), await $(t);
|
|
562
562
|
}
|
|
563
|
-
const
|
|
563
|
+
const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
564
564
|
__proto__: null,
|
|
565
|
-
ensureSubstationTemplateStructure:
|
|
566
|
-
extractToAsd:
|
|
567
|
-
extractToFsd:
|
|
568
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
569
|
-
transaction:
|
|
570
|
-
},
|
|
565
|
+
ensureSubstationTemplateStructure: F,
|
|
566
|
+
extractToAsd: ht,
|
|
567
|
+
extractToFsd: Dt
|
|
568
|
+
}, Symbol.toStringTag, { value: "Module" })), Ft = {
|
|
569
|
+
transaction: Lt
|
|
570
|
+
}, Ot = {
|
|
571
571
|
cleanUp: N,
|
|
572
|
-
dataModel:
|
|
572
|
+
dataModel: U,
|
|
573
573
|
history: L,
|
|
574
|
-
reference:
|
|
575
|
-
template:
|
|
576
|
-
presentation:
|
|
574
|
+
reference: C,
|
|
575
|
+
template: Ft,
|
|
576
|
+
presentation: bt
|
|
577
577
|
};
|
|
578
|
-
function
|
|
579
|
-
const { storage: a, extensions: e } = t;
|
|
580
|
-
return
|
|
581
|
-
|
|
578
|
+
function Bt(t) {
|
|
579
|
+
const { storage: a = { type: "local" }, extensions: e } = t ?? {};
|
|
580
|
+
return new tt({
|
|
581
|
+
configs: { scl: J },
|
|
582
|
+
defaultConfigKey: "scl",
|
|
582
583
|
storage: a,
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
const { storage: a, extensions: e } = t;
|
|
589
|
-
return et({
|
|
590
|
-
config: R,
|
|
591
|
-
storage: a,
|
|
592
|
-
extensions: { base: K, custom: e },
|
|
593
|
-
hooks: H
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
function $t(t) {
|
|
597
|
-
const { files: a, useCustomRecordsIds: e = !1 } = t;
|
|
598
|
-
return at({
|
|
599
|
-
files: a,
|
|
600
|
-
dialecteConfig: R,
|
|
601
|
-
useCustomRecordsIds: e
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
function zt(t) {
|
|
605
|
-
const { databaseName: a, extension: e, withDownload: n, withDatabaseIds: o } = t;
|
|
606
|
-
return ot({
|
|
607
|
-
dialecteConfig: R,
|
|
608
|
-
databaseName: a,
|
|
609
|
-
extension: e,
|
|
610
|
-
withDownload: n,
|
|
611
|
-
withDatabaseIds: o
|
|
584
|
+
extensionsRegistry: {
|
|
585
|
+
...Ot,
|
|
586
|
+
...e
|
|
587
|
+
},
|
|
588
|
+
hooks: Z
|
|
612
589
|
});
|
|
613
590
|
}
|
|
614
591
|
export {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
zt as exportSclFile,
|
|
621
|
-
$t as importSclFiles,
|
|
622
|
-
kt as openSclDocument
|
|
592
|
+
kt as SCL_DATABASE_CONFIG,
|
|
593
|
+
J as SCL_DIALECTE_CONFIG,
|
|
594
|
+
Qt as SCL_IO_CONFIG,
|
|
595
|
+
$t as SCL_NAMESPACES,
|
|
596
|
+
Bt as createSclProject
|
|
623
597
|
};
|
|
@@ -5,20 +5,10 @@ export declare const XMLNS_SCL_6_100_NAMESPACE = "xmlns:eIEC61850-6-100=\"http:/
|
|
|
5
5
|
export declare const ALL_XMLNS_NAMESPACES: string;
|
|
6
6
|
export { CUSTOM_RECORD_ID_ATTRIBUTE, CUSTOM_RECORD_ID_ATTRIBUTE_NAME };
|
|
7
7
|
export declare const runSclTestCases: import('@dialecte/core/test').TestRunner<Config>;
|
|
8
|
-
export declare function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
databaseName: string;
|
|
13
|
-
cleanup: () => Promise<void>;
|
|
14
|
-
exportCurrentTest: (params?: {
|
|
15
|
-
extension?: string | undefined;
|
|
16
|
-
withDatabaseIds?: boolean;
|
|
17
|
-
} | undefined) => Promise<{
|
|
18
|
-
xmlDocument: XMLDocument;
|
|
19
|
-
filename: string;
|
|
20
|
-
}>;
|
|
21
|
-
}>;
|
|
8
|
+
export declare function createSclTestProject(params: {
|
|
9
|
+
sourceXml: string;
|
|
10
|
+
targetXml?: string;
|
|
11
|
+
}): Promise<import('@dialecte/core/test').TestProjectResult<Config>>;
|
|
22
12
|
export declare const createSclTestRecord: {
|
|
23
13
|
(params: {
|
|
24
14
|
record: import('@dialecte/core/test').TestRecord<Config>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrated-test.d.ts","sourceRoot":"","sources":["../../../src/v2019C1/test/hydrated-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAA;AAYpG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAE9D,eAAO,MAAM,mBAAmB,+CAA6C,CAAA;AAC7E,eAAO,MAAM,yBAAyB,qEAAmE,CAAA;AACzG,eAAO,MAAM,oBAAoB,QAA+E,CAAA;AAChH,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,CAAA;AAEtE,eAAO,MAAM,eAAe,kDAA+C,CAAA;AAE3E,wBAAsB,
|
|
1
|
+
{"version":3,"file":"hydrated-test.d.ts","sourceRoot":"","sources":["../../../src/v2019C1/test/hydrated-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAA;AAYpG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAE9D,eAAO,MAAM,mBAAmB,+CAA6C,CAAA;AAC7E,eAAO,MAAM,yBAAyB,qEAAmE,CAAA;AACzG,eAAO,MAAM,oBAAoB,QAA+E,CAAA;AAChH,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,CAAA;AAEtE,eAAO,MAAM,eAAe,kDAA+C,CAAA;AAE3E,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,oEAS3F;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;CAAuD,CAAA;AACvF,eAAO,MAAQ,4BAA4B;;;YAAE,8BAA8B;;;UAI1E,CAAA"}
|
|
@@ -4,7 +4,9 @@ export declare namespace SclTest {
|
|
|
4
4
|
type BaseTestCase = CoreTest.BaseTestCase;
|
|
5
5
|
type BaseXmlTestCase = CoreTest.BaseXmlTestCase;
|
|
6
6
|
type TestCases<T extends BaseTestCase = BaseXmlTestCase> = Record<string, T>;
|
|
7
|
-
type
|
|
7
|
+
type TestDocument = CoreTest.TestDocument<Config>;
|
|
8
|
+
type TestProjectResult = CoreTest.TestProjectResult<Config>;
|
|
9
|
+
type TestRecord = CoreTest.TestRecord<Config>;
|
|
8
10
|
type ActParams<T extends CoreTest.BaseXmlTestCase> = CoreTest.ActParams<Config, T>;
|
|
9
11
|
type ActResult = CoreTest.ActResult;
|
|
10
12
|
type TestRunner = CoreTest.TestRunner<Config>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrated-test.types.d.ts","sourceRoot":"","sources":["../../../src/v2019C1/test/hydrated-test.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,KAAK,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAEpD,yBAAiB,OAAO,CAAC;IACxB,KAAY,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAA;IAChD,KAAY,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAA;IACtD,KAAY,SAAS,CAAC,CAAC,SAAS,YAAY,GAAG,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IACnF,KAAY,
|
|
1
|
+
{"version":3,"file":"hydrated-test.types.d.ts","sourceRoot":"","sources":["../../../src/v2019C1/test/hydrated-test.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,KAAK,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAEpD,yBAAiB,OAAO,CAAC;IACxB,KAAY,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAA;IAChD,KAAY,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAA;IACtD,KAAY,SAAS,CAAC,CAAC,SAAS,YAAY,GAAG,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IACnF,KAAY,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;IACxD,KAAY,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAClE,KAAY,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IACpD,KAAY,SAAS,CAAC,CAAC,SAAS,QAAQ,CAAC,eAAe,IAAI,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IACzF,KAAY,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAA;IAC1C,KAAY,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;CACpD"}
|