@dialecte/scl 0.2.4 → 0.2.5
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/v2019C1/index.js
CHANGED
|
@@ -1,594 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { b as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
for (const e of a) {
|
|
9
|
-
const n = await t.getAttribute(e, { name: "iedName" });
|
|
10
|
-
if (!n || n === "None") continue;
|
|
11
|
-
const [o] = await t.findByAttributes({
|
|
12
|
-
tagName: "IED",
|
|
13
|
-
attributes: { name: n }
|
|
14
|
-
});
|
|
15
|
-
o || await nt(t, e);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
async function nt(t, a) {
|
|
19
|
-
const e = await t.getChild(a, "LNodeSpecNaming");
|
|
20
|
-
if (e) {
|
|
21
|
-
const n = await t.getAttribute(e, { name: "sLnClass" }), o = await t.getAttribute(e, { name: "sLnInst" }), i = await t.getAttribute(e, { name: "sPrefix" });
|
|
22
|
-
await t.update(e, {
|
|
23
|
-
attributes: { sIedName: "None", sLdInst: void 0 }
|
|
24
|
-
}), await t.update(a, {
|
|
25
|
-
attributes: {
|
|
26
|
-
iedName: "None",
|
|
27
|
-
ldInst: void 0,
|
|
28
|
-
lnUuid: void 0,
|
|
29
|
-
templateUuid: void 0,
|
|
30
|
-
lnClass: n || void 0,
|
|
31
|
-
lnInst: o || void 0,
|
|
32
|
-
prefix: i || void 0
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
} else
|
|
36
|
-
await t.update(a, {
|
|
37
|
-
attributes: {
|
|
38
|
-
iedName: "None",
|
|
39
|
-
ldInst: void 0,
|
|
40
|
-
lnUuid: void 0,
|
|
41
|
-
templateUuid: void 0,
|
|
42
|
-
lnClass: void 0,
|
|
43
|
-
lnInst: void 0,
|
|
44
|
-
prefix: void 0
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
async function at(t) {
|
|
49
|
-
const a = [...Object.values(Y).flat(), "Private"];
|
|
50
|
-
for (const e of a) {
|
|
51
|
-
const n = await t.getRecordsByTagName(e);
|
|
52
|
-
for (const o of n)
|
|
53
|
-
o.children.length === 0 && await t.delete(o);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
async function ot(t) {
|
|
57
|
-
const a = Object.keys(w);
|
|
58
|
-
for (const e of a) {
|
|
59
|
-
const n = w[e], o = await t.getRecordsByTagName(e);
|
|
60
|
-
for (const i of o) {
|
|
61
|
-
let r = !1, s = !1;
|
|
62
|
-
const c = {};
|
|
63
|
-
for (const f of n) {
|
|
64
|
-
const l = await t.getAttribute(i, {
|
|
65
|
-
name: f.attribute.uuid
|
|
66
|
-
});
|
|
67
|
-
if (!l) continue;
|
|
68
|
-
if (r = !0, await it(t, l, f.target))
|
|
69
|
-
s = !0;
|
|
70
|
-
else {
|
|
71
|
-
c[f.attribute.uuid] = void 0, c[f.attribute.path] = void 0;
|
|
72
|
-
for (const p of f.companions)
|
|
73
|
-
c[p.name] = void 0;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
Object.keys(c).length > 0 && await t.update(i, { attributes: c });
|
|
77
|
-
const u = W.has(e);
|
|
78
|
-
r && !s && !u && await t.delete(i);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
async function it(t, a, e) {
|
|
83
|
-
for (const n of e) {
|
|
84
|
-
const [o] = await t.findByAttributes({
|
|
85
|
-
tagName: n,
|
|
86
|
-
attributes: { uuid: a }
|
|
87
|
-
});
|
|
88
|
-
if (o) return !0;
|
|
89
|
-
}
|
|
90
|
-
return !1;
|
|
91
|
-
}
|
|
92
|
-
const st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
93
|
-
__proto__: null,
|
|
94
|
-
orphanUuidRefs: ot,
|
|
95
|
-
pruneEmptyContainers: at,
|
|
96
|
-
resetLNode: et
|
|
97
|
-
}, Symbol.toStringTag, { value: "Module" })), N = {
|
|
98
|
-
transaction: st
|
|
99
|
-
};
|
|
100
|
-
async function H(t, a) {
|
|
101
|
-
const { records: e } = a, n = {
|
|
102
|
-
lnodeTypes: /* @__PURE__ */ new Map(),
|
|
103
|
-
doTypes: /* @__PURE__ */ new Map(),
|
|
104
|
-
daTypes: /* @__PURE__ */ new Map(),
|
|
105
|
-
enumTypes: /* @__PURE__ */ new Map()
|
|
106
|
-
};
|
|
107
|
-
for (const o of e) {
|
|
108
|
-
const i = await t.getAttribute(o, { name: "lnType" });
|
|
109
|
-
if (!i) continue;
|
|
110
|
-
const [r] = await t.findByAttributes({
|
|
111
|
-
tagName: "LNodeType",
|
|
112
|
-
attributes: { id: i }
|
|
113
|
-
});
|
|
114
|
-
if (M(r, {
|
|
115
|
-
key: "ELEMENT_NOT_FOUND",
|
|
116
|
-
detail: `LNodeType not found for lnType="${i}"`
|
|
117
|
-
}), !y(n.lnodeTypes, i, r)) continue;
|
|
118
|
-
const s = r.children.filter((u) => b(u, "DO")), c = await t.getRecords(s);
|
|
119
|
-
for (const u of c) {
|
|
120
|
-
if (!u) continue;
|
|
121
|
-
const d = await t.getAttribute(u, { name: "type" });
|
|
122
|
-
if (!d) continue;
|
|
123
|
-
const [f] = await t.findByAttributes({
|
|
124
|
-
tagName: "DOType",
|
|
125
|
-
attributes: { id: d }
|
|
126
|
-
});
|
|
127
|
-
f && y(n.doTypes, d, f) && await h({ query: t, parent: f, dataModelMap: n });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
lnodeTypes: Array.from(n.lnodeTypes.values()),
|
|
132
|
-
doTypes: Array.from(n.doTypes.values()),
|
|
133
|
-
daTypes: Array.from(n.daTypes.values()),
|
|
134
|
-
enumTypes: Array.from(n.enumTypes.values())
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function y(t, a, e) {
|
|
138
|
-
return t.has(a) ? !1 : (t.set(a, e), !0);
|
|
139
|
-
}
|
|
140
|
-
async function h(t) {
|
|
141
|
-
const { query: a, parent: e, dataModelMap: n } = t, o = e.tagName === "DOType" ? await a.getRecords(e.children.filter((i) => b(i, "DA"))) : await a.getRecords(e.children.filter((i) => b(i, "BDA")));
|
|
142
|
-
for (const i of o) {
|
|
143
|
-
if (!i) continue;
|
|
144
|
-
const r = await a.getAttribute(i, { name: "bType" }), s = await a.getAttribute(i, { name: "type" });
|
|
145
|
-
if (s) {
|
|
146
|
-
if (r === "Enum") {
|
|
147
|
-
const [c] = await a.findByAttributes({
|
|
148
|
-
tagName: "EnumType",
|
|
149
|
-
attributes: { id: s }
|
|
150
|
-
});
|
|
151
|
-
c && y(n.enumTypes, s, c);
|
|
152
|
-
} else if (r === "Struct") {
|
|
153
|
-
const [c] = await a.findByAttributes({
|
|
154
|
-
tagName: "DAType",
|
|
155
|
-
attributes: { id: s }
|
|
156
|
-
});
|
|
157
|
-
c && y(n.daTypes, s, c) && await h({ query: a, parent: c, dataModelMap: n });
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (e.tagName === "DOType") {
|
|
162
|
-
const i = e.children.filter((s) => b(s, "SDO")), r = await a.getRecords(i);
|
|
163
|
-
for (const s of r) {
|
|
164
|
-
const c = await a.getAttribute(s, { name: "type" });
|
|
165
|
-
if (!c) continue;
|
|
166
|
-
const [u] = await a.findByAttributes({
|
|
167
|
-
tagName: "DOType",
|
|
168
|
-
attributes: { id: c }
|
|
169
|
-
});
|
|
170
|
-
u && y(n.doTypes, c, u) && await h({ query: a, parent: u, dataModelMap: n });
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
175
|
-
__proto__: null,
|
|
176
|
-
resolve: H
|
|
177
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
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
|
-
tagName: "DataTypeTemplates",
|
|
181
|
-
attributes: {}
|
|
182
|
-
});
|
|
183
|
-
for (const c of i) {
|
|
184
|
-
const u = await e.getAttribute(c, { name: "id" });
|
|
185
|
-
if (!u) continue;
|
|
186
|
-
const [d] = await t.findByAttributes({
|
|
187
|
-
tagName: c.tagName,
|
|
188
|
-
attributes: { id: u }
|
|
189
|
-
});
|
|
190
|
-
if (d) continue;
|
|
191
|
-
const f = await e.getTree(c);
|
|
192
|
-
f && await t.deepClone(s, f);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function ut(t) {
|
|
196
|
-
return [...t.lnodeTypes, ...t.doTypes, ...t.daTypes, ...t.enumTypes];
|
|
197
|
-
}
|
|
198
|
-
const dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
199
|
-
__proto__: null,
|
|
200
|
-
extract: ct
|
|
201
|
-
}, Symbol.toStringTag, { value: "Module" })), U = {
|
|
202
|
-
query: rt,
|
|
203
|
-
transaction: dt
|
|
204
|
-
};
|
|
205
|
-
async function B(t) {
|
|
206
|
-
const a = await t.getRecord({ tagName: "History" });
|
|
207
|
-
if (!a) return [];
|
|
208
|
-
const { Hitem: e = [] } = await t.findDescendants(a, { collect: "Hitem" });
|
|
209
|
-
function n(i, r) {
|
|
210
|
-
return Number(i.attributes.find((s) => s.name === r)?.value || 0);
|
|
211
|
-
}
|
|
212
|
-
return [...e].sort((i, r) => {
|
|
213
|
-
const s = n(i, "version") - n(r, "version");
|
|
214
|
-
return s !== 0 ? s : n(i, "revision") - n(r, "revision");
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
async function j(t) {
|
|
218
|
-
return (await B(t)).at(-1);
|
|
219
|
-
}
|
|
220
|
-
const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
221
|
-
__proto__: null,
|
|
222
|
-
getLatestHitem: j,
|
|
223
|
-
getSortedHitems: B
|
|
224
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
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
|
-
tagName: "Header",
|
|
228
|
-
attributes: {
|
|
229
|
-
id: i ?? e.replace(/\.[^.]+$/, "").toLowerCase().replace(/\s+/g, "_"),
|
|
230
|
-
toolID: u,
|
|
231
|
-
fileType: r,
|
|
232
|
-
...s ? { nameStructure: s } : {},
|
|
233
|
-
version: "0",
|
|
234
|
-
revision: "1",
|
|
235
|
-
uuid: crypto.randomUUID()
|
|
236
|
-
}
|
|
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
|
-
});
|
|
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
|
-
tagName: "Hitem",
|
|
244
|
-
attributes: {
|
|
245
|
-
version: v,
|
|
246
|
-
revision: E,
|
|
247
|
-
when: K,
|
|
248
|
-
who: d,
|
|
249
|
-
what: f,
|
|
250
|
-
why: l
|
|
251
|
-
}
|
|
252
|
-
}), await t.update(S, {
|
|
253
|
-
attributes: { version: v, revision: E }
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
const mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
257
|
-
__proto__: null,
|
|
258
|
-
addEntry: lt
|
|
259
|
-
}, Symbol.toStringTag, { value: "Module" })), L = {
|
|
260
|
-
query: ft,
|
|
261
|
-
transaction: mt
|
|
262
|
-
}, pt = {
|
|
263
|
-
LNode: ["prefix", "lnClass", "lnInst"],
|
|
264
|
-
LN: ["prefix", "lnClass", "inst"],
|
|
265
|
-
LN0: ["prefix", "lnClass", "inst"],
|
|
266
|
-
LDevice: ["inst"],
|
|
267
|
-
ConnectedAP: ["iedName", "apName"],
|
|
268
|
-
GSE: ["ldInst", "cbName"],
|
|
269
|
-
SMV: ["ldInst", "cbName"],
|
|
270
|
-
Private: ["type"],
|
|
271
|
-
EnumVal: ["ord"],
|
|
272
|
-
Association: ["associationID"],
|
|
273
|
-
ConnectivityNode: ["pathName"],
|
|
274
|
-
ControlRef: ["output", "outputInst"],
|
|
275
|
-
SourceRef: ["input", "inputInst"],
|
|
276
|
-
FunctionRoleContent: ["roleInst"],
|
|
277
|
-
Resource: ["resInst"],
|
|
278
|
-
Hitem: ["version", "revision"],
|
|
279
|
-
History: ["version", "revision"]
|
|
280
|
-
}, gt = {
|
|
281
|
-
ConnectedAP: " / ",
|
|
282
|
-
GSE: "/",
|
|
283
|
-
SMV: "/",
|
|
284
|
-
Hitem: ".",
|
|
285
|
-
History: ".",
|
|
286
|
-
ControlRef: "/",
|
|
287
|
-
SourceRef: "/"
|
|
288
|
-
};
|
|
289
|
-
async function yt(t, a) {
|
|
290
|
-
const e = await t.getRecord(a);
|
|
291
|
-
if (!e) return "";
|
|
292
|
-
const n = e.tagName, o = await t.any.getAttributes(e), i = pt[n];
|
|
293
|
-
if (i) {
|
|
294
|
-
const u = gt[n] ?? "", d = i.map((f) => o[f]).filter(Boolean);
|
|
295
|
-
return d.length > 0 ? d.join(u) : n;
|
|
296
|
-
}
|
|
297
|
-
const s = q[n]?.attributes?.identityFields, c = s?.find((u) => u === "name" || u === "id") ?? s?.[0];
|
|
298
|
-
return c ? o[c] || n : o.name || n;
|
|
299
|
-
}
|
|
300
|
-
const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
301
|
-
__proto__: null,
|
|
302
|
-
extractElementTitle: yt
|
|
303
|
-
}, Symbol.toStringTag, { value: "Module" })), bt = {
|
|
304
|
-
query: wt
|
|
305
|
-
};
|
|
306
|
-
async function F(t) {
|
|
307
|
-
const a = await t.getRoot(), e = await t.ensureChild(a, {
|
|
308
|
-
tagName: "Substation",
|
|
309
|
-
attributes: { name: "TEMPLATE" }
|
|
310
|
-
}), n = await t.ensureChild(e, {
|
|
311
|
-
tagName: "VoltageLevel",
|
|
312
|
-
attributes: { name: "TEMPLATE" }
|
|
313
|
-
}), o = await t.ensureChild(n, {
|
|
314
|
-
tagName: "Bay",
|
|
315
|
-
attributes: { name: "TEMPLATE" }
|
|
316
|
-
});
|
|
317
|
-
return {
|
|
318
|
-
Substation: e,
|
|
319
|
-
VoltageLevel: n,
|
|
320
|
-
Bay: o
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
const Nt = {
|
|
324
|
-
scope: "tree",
|
|
325
|
-
attributes: ["templateUuid", "originUuid"]
|
|
326
|
-
};
|
|
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
|
-
if (!c) return;
|
|
330
|
-
const u = r && c.tagName === r.from ? { ...c, tagName: r.to } : c;
|
|
331
|
-
let d = u;
|
|
332
|
-
s && (d = s.scope === "tree" ? x(u, s.attributes) : {
|
|
333
|
-
...u,
|
|
334
|
-
attributes: u.attributes.filter((f) => !s.attributes.includes(f.name))
|
|
335
|
-
}), await t.deepClone(o, d);
|
|
336
|
-
}
|
|
337
|
-
async function Tt(t, a) {
|
|
338
|
-
const { sourceQuery: e, scopeRef: n } = a, { LNode: o = [] } = await e.findDescendants(n, {
|
|
339
|
-
collect: "LNode"
|
|
340
|
-
});
|
|
341
|
-
o.length > 0 && await U.transaction.extract(t, { sourceQuery: e, records: o });
|
|
342
|
-
}
|
|
343
|
-
async function D(t, a, e) {
|
|
344
|
-
const o = (await t.findAncestors(a, { stopAtTagName: "Substation" })).find((r) => r.tagName in e);
|
|
345
|
-
M(o, {
|
|
346
|
-
key: "ELEMENT_NOT_FOUND",
|
|
347
|
-
detail: `No Substation/VoltageLevel/Bay ancestor found for ${a.tagName}`
|
|
348
|
-
});
|
|
349
|
-
const i = e[o.tagName];
|
|
350
|
-
return { tagName: i.tagName, id: i.id };
|
|
351
|
-
}
|
|
352
|
-
async function V(t, a) {
|
|
353
|
-
const { sourceQuery: e, functionRef: n, targetParentRef: o, omit: i, stripRootAttributes: r } = a, s = r?.length ? { scope: "root", attributes: [...r] } : !1;
|
|
354
|
-
await R(t, {
|
|
355
|
-
sourceQuery: e,
|
|
356
|
-
ref: n,
|
|
357
|
-
targetParent: o,
|
|
358
|
-
omit: i,
|
|
359
|
-
promoteRoot: { from: "SubFunction", to: "Function" },
|
|
360
|
-
strip: s
|
|
361
|
-
}), await Tt(t, { sourceQuery: e, scopeRef: n });
|
|
362
|
-
}
|
|
363
|
-
async function k(t, a) {
|
|
364
|
-
const { sourceQuery: e, functionRef: n, structure: o, stripCategoriesUuid: i = !0 } = a, r = await Rt(e, n);
|
|
365
|
-
for (const s of r) {
|
|
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
|
-
sourceQuery: e,
|
|
370
|
-
ref: u,
|
|
371
|
-
targetParent: d,
|
|
372
|
-
...i ? {} : { strip: !1 }
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
async function Rt(t, a) {
|
|
377
|
-
const e = await St(t, a), n = /* @__PURE__ */ new Set();
|
|
378
|
-
for (const { container: o } of e)
|
|
379
|
-
o && n.add(o.id);
|
|
380
|
-
return n;
|
|
381
|
-
}
|
|
382
|
-
async function St(t, a) {
|
|
383
|
-
const e = await C.query.findRefsPointingTo(t, {
|
|
384
|
-
target: a,
|
|
385
|
-
containerTagName: "FunctionCategory"
|
|
386
|
-
}), { SubFunction: n = [] } = await t.findDescendants(a, {
|
|
387
|
-
collect: "SubFunction"
|
|
388
|
-
});
|
|
389
|
-
for (const o of n) {
|
|
390
|
-
const i = await C.query.findRefsPointingTo(t, {
|
|
391
|
-
target: { tagName: "SubFunction", id: o.id },
|
|
392
|
-
containerTagName: "FunctionCategory"
|
|
393
|
-
});
|
|
394
|
-
e.push(...i);
|
|
395
|
-
}
|
|
396
|
-
return e;
|
|
397
|
-
}
|
|
398
|
-
async function At(t, a, e) {
|
|
399
|
-
const n = await a.getRecord({
|
|
400
|
-
tagName: "FunctionCategory",
|
|
401
|
-
id: e
|
|
402
|
-
});
|
|
403
|
-
if (!n) return !1;
|
|
404
|
-
const o = await a.getAttribute(n, { name: "name" });
|
|
405
|
-
if (!o) return !1;
|
|
406
|
-
const [i] = await t.findByAttributes({
|
|
407
|
-
tagName: "FunctionCategory",
|
|
408
|
-
attributes: { name: o }
|
|
409
|
-
});
|
|
410
|
-
return !!i;
|
|
411
|
-
}
|
|
412
|
-
async function Q(t, a) {
|
|
413
|
-
const { sourceQuery: e, scopeRef: n, refTagName: o, targetTagName: i } = a, r = w[o][0].attribute.uuid, s = await e.findDescendants(n, {
|
|
414
|
-
collect: o
|
|
415
|
-
}), { [o]: c = [] } = s, u = /* @__PURE__ */ new Set();
|
|
416
|
-
for (const f of c) {
|
|
417
|
-
const l = f.attributes.find(
|
|
418
|
-
(m) => m.name === r
|
|
419
|
-
)?.value;
|
|
420
|
-
l && u.add(l);
|
|
421
|
-
}
|
|
422
|
-
const d = [];
|
|
423
|
-
for (const f of u) {
|
|
424
|
-
const l = { uuid: f }, [m] = await t.findByAttributes({ tagName: i, attributes: l });
|
|
425
|
-
if (m) continue;
|
|
426
|
-
const [p] = await e.findByAttributes({
|
|
427
|
-
tagName: i,
|
|
428
|
-
attributes: l
|
|
429
|
-
});
|
|
430
|
-
p && d.push({ tagName: i, id: p.id });
|
|
431
|
-
}
|
|
432
|
-
return d;
|
|
433
|
-
}
|
|
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
|
-
sourceQuery: e,
|
|
437
|
-
scopeRef: n,
|
|
438
|
-
refTagName: o,
|
|
439
|
-
targetTagName: i
|
|
440
|
-
});
|
|
441
|
-
for (const u of c)
|
|
442
|
-
await R(t, { sourceQuery: e, ref: u, targetParent: r, omit: s });
|
|
443
|
-
}
|
|
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
|
-
(d) => d in w && !r.has(d)
|
|
447
|
-
), u = vt;
|
|
448
|
-
for (const d of c)
|
|
449
|
-
for (const f of w[d])
|
|
450
|
-
for (const l of f.target)
|
|
451
|
-
await u(t, {
|
|
452
|
-
sourceQuery: e,
|
|
453
|
-
scopeRef: o,
|
|
454
|
-
refTagName: d,
|
|
455
|
-
targetTagName: l,
|
|
456
|
-
targetParent: i,
|
|
457
|
-
omit: s
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
const T = [
|
|
461
|
-
"FunctionSclRef",
|
|
462
|
-
"ApplicationSclRef",
|
|
463
|
-
"GeneralEquipment",
|
|
464
|
-
"ConductingEquipment"
|
|
465
|
-
], _t = [
|
|
466
|
-
...T,
|
|
467
|
-
"DOS",
|
|
468
|
-
"Labels",
|
|
469
|
-
"LNodeInputs",
|
|
470
|
-
"LNodeOutputs",
|
|
471
|
-
"ProcessResources",
|
|
472
|
-
"PowerSystemRelations",
|
|
473
|
-
"BehaviorDescription",
|
|
474
|
-
"Variable"
|
|
475
|
-
];
|
|
476
|
-
async function Ct(t, a) {
|
|
477
|
-
const { sourceQuery: e, applicationRef: n, structure: o } = a, i = {
|
|
478
|
-
tagName: "Substation",
|
|
479
|
-
id: o.Substation.id
|
|
480
|
-
}, r = await Q(t, {
|
|
481
|
-
sourceQuery: e,
|
|
482
|
-
scopeRef: n,
|
|
483
|
-
refTagName: "FunctionRef",
|
|
484
|
-
targetTagName: "Function"
|
|
485
|
-
});
|
|
486
|
-
for (const u of r) {
|
|
487
|
-
const d = await D(e, u, o);
|
|
488
|
-
await V(t, {
|
|
489
|
-
sourceQuery: e,
|
|
490
|
-
functionRef: u,
|
|
491
|
-
targetParentRef: d,
|
|
492
|
-
omit: T
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
for (const u of r)
|
|
496
|
-
await k(t, {
|
|
497
|
-
sourceQuery: e,
|
|
498
|
-
functionRef: u,
|
|
499
|
-
structure: o,
|
|
500
|
-
stripCategoriesUuid: !1
|
|
501
|
-
});
|
|
502
|
-
await Et(t, {
|
|
503
|
-
sourceQuery: e,
|
|
504
|
-
scopeTagName: "Application",
|
|
505
|
-
scopeRef: n,
|
|
506
|
-
targetParent: i,
|
|
507
|
-
skip: /* @__PURE__ */ new Set(["FunctionRef", "FunctionCategoryRef"]),
|
|
508
|
-
omit: T
|
|
509
|
-
});
|
|
510
|
-
const c = await D(e, n, o);
|
|
511
|
-
await R(t, { sourceQuery: e, ref: n, targetParent: c, omit: T });
|
|
512
|
-
}
|
|
513
|
-
async function $(t) {
|
|
514
|
-
await N.transaction.orphanUuidRefs(t), await N.transaction.resetLNode(t), await N.transaction.pruneEmptyContainers(t);
|
|
515
|
-
}
|
|
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
|
-
await L.transaction.addEntry(t, {
|
|
519
|
-
filename: `ASD_${c.replace(/\s+/g, "_")}`,
|
|
520
|
-
header: {
|
|
521
|
-
fileType: "ASD",
|
|
522
|
-
version: "keep",
|
|
523
|
-
tool: o,
|
|
524
|
-
...r ? { nameStructure: r } : {}
|
|
525
|
-
},
|
|
526
|
-
item: {
|
|
527
|
-
who: i,
|
|
528
|
-
what: "ASD initialization",
|
|
529
|
-
why: "Application was extracted from a previous file"
|
|
530
|
-
}
|
|
531
|
-
}), await Ct(t, { sourceQuery: e, applicationRef: n, structure: s }), await $(t);
|
|
532
|
-
}
|
|
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
|
-
tagName: s.Substation.tagName,
|
|
536
|
-
id: s.Substation.id
|
|
537
|
-
}, u = await e.getAttribute(n, { name: "name" }) || "Unnamed Function";
|
|
538
|
-
await L.transaction.addEntry(t, {
|
|
539
|
-
filename: `FSD_${u.replace(/\s+/g, "_")}`,
|
|
540
|
-
header: {
|
|
541
|
-
fileType: "FSD",
|
|
542
|
-
version: "keep",
|
|
543
|
-
tool: o,
|
|
544
|
-
...r ? { nameStructure: r } : {}
|
|
545
|
-
},
|
|
546
|
-
item: {
|
|
547
|
-
who: i,
|
|
548
|
-
what: "FSD initialization",
|
|
549
|
-
why: "Function was extracted from a previous file"
|
|
550
|
-
}
|
|
551
|
-
}), await V(t, {
|
|
552
|
-
sourceQuery: e,
|
|
553
|
-
functionRef: n,
|
|
554
|
-
targetParentRef: c,
|
|
555
|
-
omit: _t,
|
|
556
|
-
stripRootAttributes: ["templateUuid"]
|
|
557
|
-
}), await k(t, {
|
|
558
|
-
sourceQuery: e,
|
|
559
|
-
functionRef: n,
|
|
560
|
-
structure: s
|
|
561
|
-
}), await $(t);
|
|
562
|
-
}
|
|
563
|
-
const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
564
|
-
__proto__: null,
|
|
565
|
-
ensureSubstationTemplateStructure: F,
|
|
566
|
-
extractToAsd: ht,
|
|
567
|
-
extractToFsd: Dt
|
|
568
|
-
}, Symbol.toStringTag, { value: "Module" })), Ft = {
|
|
569
|
-
transaction: Lt
|
|
570
|
-
}, Ot = {
|
|
571
|
-
cleanUp: N,
|
|
572
|
-
dataModel: U,
|
|
573
|
-
history: L,
|
|
574
|
-
reference: C,
|
|
575
|
-
template: Ft,
|
|
576
|
-
presentation: bt
|
|
577
|
-
};
|
|
578
|
-
function Bt(t) {
|
|
579
|
-
const { storage: a = { type: "local" }, extensions: e } = t ?? {};
|
|
580
|
-
return new tt({
|
|
581
|
-
configs: { scl: J },
|
|
1
|
+
import { H as t, S as r, a as S } from "../index-CZZLOr5V.js";
|
|
2
|
+
import { b as O, c as f, d as i } from "../index-CZZLOr5V.js";
|
|
3
|
+
import { Project as a } from "@dialecte/core";
|
|
4
|
+
function C(o) {
|
|
5
|
+
const { storage: s = { type: "local" }, extensions: e } = o ?? {};
|
|
6
|
+
return new a({
|
|
7
|
+
configs: { scl: S },
|
|
582
8
|
defaultConfigKey: "scl",
|
|
583
|
-
storage:
|
|
584
|
-
extensions: { base:
|
|
585
|
-
hooks:
|
|
9
|
+
storage: s,
|
|
10
|
+
extensions: { base: r, custom: e },
|
|
11
|
+
hooks: t
|
|
586
12
|
});
|
|
587
13
|
}
|
|
588
14
|
export {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
15
|
+
O as SCL_DATABASE_CONFIG,
|
|
16
|
+
S as SCL_DIALECTE_CONFIG,
|
|
17
|
+
f as SCL_IO_CONFIG,
|
|
18
|
+
i as SCL_NAMESPACES,
|
|
19
|
+
C as createSclProject
|
|
594
20
|
};
|
|
@@ -4,11 +4,53 @@ export declare const XMLNS_SCL_NAMESPACE = "xmlns=\"http://www.iec.ch/61850/2003
|
|
|
4
4
|
export declare const XMLNS_SCL_6_100_NAMESPACE = "xmlns:eIEC61850-6-100=\"http://www.iec.ch/61850/2019/SCL/6-100\"";
|
|
5
5
|
export declare const ALL_XMLNS_NAMESPACES: string;
|
|
6
6
|
export { CUSTOM_RECORD_ID_ATTRIBUTE, CUSTOM_RECORD_ID_ATTRIBUTE_NAME };
|
|
7
|
-
export declare const runSclTestCases: import('@dialecte/core/test').TestRunner<Config
|
|
7
|
+
export declare const runSclTestCases: import('@dialecte/core/test').TestRunner<Config, {
|
|
8
|
+
cleanUp: {
|
|
9
|
+
transaction: typeof import("../extensions/clean-up/transaction");
|
|
10
|
+
};
|
|
11
|
+
dataModel: {
|
|
12
|
+
query: typeof import("../extensions/data-model/query");
|
|
13
|
+
transaction: typeof import("../extensions/data-model/transaction");
|
|
14
|
+
};
|
|
15
|
+
history: {
|
|
16
|
+
query: typeof import("../extensions/history/query");
|
|
17
|
+
transaction: typeof import("../extensions/history/transaction");
|
|
18
|
+
};
|
|
19
|
+
reference: {
|
|
20
|
+
query: typeof import("../extensions/reference/query");
|
|
21
|
+
};
|
|
22
|
+
template: {
|
|
23
|
+
transaction: typeof import("../extensions/template/transaction");
|
|
24
|
+
};
|
|
25
|
+
presentation: {
|
|
26
|
+
query: typeof import("../extensions/presentation/query");
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
8
29
|
export declare function createSclTestProject(params: {
|
|
9
30
|
sourceXml: string;
|
|
10
31
|
targetXml?: string;
|
|
11
|
-
}): Promise<import('@dialecte/core/test').TestProjectResult<Config
|
|
32
|
+
}): Promise<import('@dialecte/core/test').TestProjectResult<Config, {
|
|
33
|
+
cleanUp: {
|
|
34
|
+
transaction: typeof import("../extensions/clean-up/transaction");
|
|
35
|
+
};
|
|
36
|
+
dataModel: {
|
|
37
|
+
query: typeof import("../extensions/data-model/query");
|
|
38
|
+
transaction: typeof import("../extensions/data-model/transaction");
|
|
39
|
+
};
|
|
40
|
+
history: {
|
|
41
|
+
query: typeof import("../extensions/history/query");
|
|
42
|
+
transaction: typeof import("../extensions/history/transaction");
|
|
43
|
+
};
|
|
44
|
+
reference: {
|
|
45
|
+
query: typeof import("../extensions/reference/query");
|
|
46
|
+
};
|
|
47
|
+
template: {
|
|
48
|
+
transaction: typeof import("../extensions/template/transaction");
|
|
49
|
+
};
|
|
50
|
+
presentation: {
|
|
51
|
+
query: typeof import("../extensions/presentation/query");
|
|
52
|
+
};
|
|
53
|
+
}>>;
|
|
12
54
|
export declare const createSclTestRecord: {
|
|
13
55
|
(params: {
|
|
14
56
|
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;
|
|
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;AAapG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAI9D,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;AAItE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;EAI1B,CAAA;AAEF,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;IAU3F;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;CAAuD,CAAA;AACvF,eAAO,MAAQ,4BAA4B;;;YAAE,8BAA8B;;;UAI1E,CAAA"}
|