@dialecte/scl 0.1.18 → 0.1.19
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.
|
@@ -22354,7 +22354,7 @@ async function at(a) {
|
|
|
22354
22354
|
for (const r of Object.values(n))
|
|
22355
22355
|
for (const u of r) {
|
|
22356
22356
|
if (u.id === e.id) continue;
|
|
22357
|
-
const c = await t.
|
|
22357
|
+
const c = await t.any.getAttribute(u, { name: "uuid" });
|
|
22358
22358
|
if (!c) continue;
|
|
22359
22359
|
const l = N(u.tagName);
|
|
22360
22360
|
if (l.length === 0) continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-sorted-hitem.d.ts","sourceRoot":"","sources":["../../../../../src/v2019C1/extensions/history/query/get-sorted-hitem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C;;;GAGG;AACH,wBAAsB,eAAe,CACpC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GACvB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"get-sorted-hitem.d.ts","sourceRoot":"","sources":["../../../../../src/v2019C1/extensions/history/query/get-sorted-hitem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAE3C;;;GAGG;AACH,wBAAsB,eAAe,CACpC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GACvB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAwBvC"}
|
package/dist/v2019C1/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as q, U as
|
|
2
|
-
import { b as Xt, c as Yt, d as Wt } from "../index-
|
|
3
|
-
import { isChildOf as
|
|
1
|
+
import { R as q, U as w, K as Z, D as J, r as _, a as x, H, S as R } from "../index-ChFpcq4k.js";
|
|
2
|
+
import { b as Xt, c as Yt, d as Wt } from "../index-ChFpcq4k.js";
|
|
3
|
+
import { isChildOf as b, stripAttributes as tt } from "@dialecte/core/helpers";
|
|
4
4
|
import { invariant as U } from "@dialecte/core/utils";
|
|
5
5
|
import { createDialecteDocument as et, openDialecteDocument as nt, importXmlFiles as at, exportXmlFile as ot } from "@dialecte/core";
|
|
6
6
|
async function it(t) {
|
|
@@ -54,19 +54,19 @@ async function rt(t) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
async function ct(t) {
|
|
57
|
-
const a = Object.keys(
|
|
57
|
+
const a = Object.keys(w);
|
|
58
58
|
for (const e of a) {
|
|
59
|
-
const n =
|
|
59
|
+
const n = w[e], o = await t.getRecordsByTagName(e);
|
|
60
60
|
for (const i of o) {
|
|
61
|
-
let
|
|
61
|
+
let r = !1, s = !1;
|
|
62
62
|
const c = {};
|
|
63
63
|
for (const f of n) {
|
|
64
64
|
const l = await t.getAttribute(i, {
|
|
65
65
|
name: f.attribute.uuid
|
|
66
66
|
});
|
|
67
67
|
if (!l) continue;
|
|
68
|
-
if (
|
|
69
|
-
|
|
68
|
+
if (r = !0, await ut(t, l, f.target))
|
|
69
|
+
s = !0;
|
|
70
70
|
else {
|
|
71
71
|
c[f.attribute.uuid] = void 0, c[f.attribute.path] = void 0;
|
|
72
72
|
for (const p of f.companions)
|
|
@@ -74,8 +74,8 @@ async function ct(t) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
Object.keys(c).length > 0 && await t.update(i, { attributes: c });
|
|
77
|
-
const
|
|
78
|
-
|
|
77
|
+
const u = Z.has(e);
|
|
78
|
+
r && !s && !u && await t.delete(i);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -97,7 +97,7 @@ const dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
97
97
|
}, Symbol.toStringTag, { value: "Module" })), N = {
|
|
98
98
|
transaction: dt
|
|
99
99
|
};
|
|
100
|
-
async function
|
|
100
|
+
async function B(t, a) {
|
|
101
101
|
const { records: e } = a, n = {
|
|
102
102
|
lnodeTypes: /* @__PURE__ */ new Map(),
|
|
103
103
|
doTypes: /* @__PURE__ */ new Map(),
|
|
@@ -107,24 +107,24 @@ async function H(t, a) {
|
|
|
107
107
|
for (const o of e) {
|
|
108
108
|
const i = await t.getAttribute(o, { name: "lnType" });
|
|
109
109
|
if (!i) continue;
|
|
110
|
-
const [
|
|
110
|
+
const [r] = await t.findByAttributes({
|
|
111
111
|
tagName: "LNodeType",
|
|
112
112
|
attributes: { id: i }
|
|
113
113
|
});
|
|
114
|
-
if (U(
|
|
114
|
+
if (U(r, {
|
|
115
115
|
key: "ELEMENT_NOT_FOUND",
|
|
116
116
|
detail: `LNodeType not found for lnType="${i}"`
|
|
117
|
-
}), !y(n.lnodeTypes, i,
|
|
118
|
-
const
|
|
119
|
-
for (const
|
|
120
|
-
if (!
|
|
121
|
-
const d = await t.getAttribute(
|
|
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
122
|
if (!d) continue;
|
|
123
123
|
const [f] = await t.findByAttributes({
|
|
124
124
|
tagName: "DOType",
|
|
125
125
|
attributes: { id: d }
|
|
126
126
|
});
|
|
127
|
-
f && y(n.doTypes, d, f) && await
|
|
127
|
+
f && y(n.doTypes, d, f) && await h({ query: t, parent: f, dataModelMap: n });
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
return {
|
|
@@ -137,59 +137,59 @@ async function H(t, a) {
|
|
|
137
137
|
function y(t, a, e) {
|
|
138
138
|
return t.has(a) ? !1 : (t.set(a, e), !0);
|
|
139
139
|
}
|
|
140
|
-
async function
|
|
141
|
-
const { query: a, parent: e, dataModelMap: n } = t, o = e.tagName === "DOType" ? await a.getRecords(e.children.filter((i) =>
|
|
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
142
|
for (const i of o) {
|
|
143
143
|
if (!i) continue;
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
146
|
-
if (
|
|
144
|
+
const r = await a.getAttribute(i, { name: "bType" }), s = await a.getAttribute(i, { name: "type" });
|
|
145
|
+
if (s) {
|
|
146
|
+
if (r === "Enum") {
|
|
147
147
|
const [c] = await a.findByAttributes({
|
|
148
148
|
tagName: "EnumType",
|
|
149
|
-
attributes: { id:
|
|
149
|
+
attributes: { id: s }
|
|
150
150
|
});
|
|
151
|
-
c && y(n.enumTypes,
|
|
152
|
-
} else if (
|
|
151
|
+
c && y(n.enumTypes, s, c);
|
|
152
|
+
} else if (r === "Struct") {
|
|
153
153
|
const [c] = await a.findByAttributes({
|
|
154
154
|
tagName: "DAType",
|
|
155
|
-
attributes: { id:
|
|
155
|
+
attributes: { id: s }
|
|
156
156
|
});
|
|
157
|
-
c && y(n.daTypes,
|
|
157
|
+
c && y(n.daTypes, s, c) && await h({ query: a, parent: c, dataModelMap: n });
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
if (e.tagName === "DOType") {
|
|
162
|
-
const i = e.children.filter((
|
|
163
|
-
for (const
|
|
164
|
-
const c = await a.getAttribute(
|
|
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
165
|
if (!c) continue;
|
|
166
|
-
const [
|
|
166
|
+
const [u] = await a.findByAttributes({
|
|
167
167
|
tagName: "DOType",
|
|
168
168
|
attributes: { id: c }
|
|
169
169
|
});
|
|
170
|
-
|
|
170
|
+
u && y(n.doTypes, c, u) && await h({ query: a, parent: u, dataModelMap: n });
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
175
175
|
__proto__: null,
|
|
176
|
-
resolve:
|
|
176
|
+
resolve: B
|
|
177
177
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
178
178
|
async function lt(t, a) {
|
|
179
|
-
const { sourceQuery: e, records: n } = a, o = await
|
|
179
|
+
const { sourceQuery: e, records: n } = a, o = await B(e, { records: n }), i = mt(o), r = await t.getRoot(), s = await t.ensureChild(r, {
|
|
180
180
|
tagName: "DataTypeTemplates",
|
|
181
181
|
attributes: {}
|
|
182
182
|
});
|
|
183
183
|
for (const c of i) {
|
|
184
|
-
const
|
|
185
|
-
if (!
|
|
184
|
+
const u = await e.getAttribute(c, { name: "id" });
|
|
185
|
+
if (!u) continue;
|
|
186
186
|
const [d] = await t.findByAttributes({
|
|
187
187
|
tagName: c.tagName,
|
|
188
|
-
attributes: { id:
|
|
188
|
+
attributes: { id: u }
|
|
189
189
|
});
|
|
190
190
|
if (d) continue;
|
|
191
191
|
const f = await e.getTree(c);
|
|
192
|
-
f && await t.deepClone(
|
|
192
|
+
f && await t.deepClone(s, f);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
function mt(t) {
|
|
@@ -202,63 +202,64 @@ const pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
202
202
|
query: ft,
|
|
203
203
|
transaction: pt
|
|
204
204
|
};
|
|
205
|
-
async function
|
|
205
|
+
async function V(t) {
|
|
206
206
|
const a = await t.getRecord({ tagName: "History" });
|
|
207
207
|
if (!a) return [];
|
|
208
|
-
const { Hitem: e = [] } = await t.findDescendants(a);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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");
|
|
214
215
|
});
|
|
215
216
|
}
|
|
216
|
-
async function
|
|
217
|
-
return (await
|
|
217
|
+
async function k(t) {
|
|
218
|
+
return (await V(t)).at(-1);
|
|
218
219
|
}
|
|
219
220
|
const gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
220
221
|
__proto__: null,
|
|
221
|
-
getLatestHitem:
|
|
222
|
-
getSortedHitems:
|
|
222
|
+
getLatestHitem: k,
|
|
223
|
+
getSortedHitems: V
|
|
223
224
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
224
225
|
async function yt(t, a) {
|
|
225
|
-
const { filename: e, header: n, item: o } = a, { id: i, fileType:
|
|
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(), A = await t.getRecord({ tagName: "Header" }) ?? await t.addChild(m, {
|
|
226
227
|
tagName: "Header",
|
|
227
228
|
attributes: {
|
|
228
229
|
id: i ?? e.replace(/\.[^.]+$/, "").toLowerCase().replace(/\s+/g, "_"),
|
|
229
|
-
toolID:
|
|
230
|
-
fileType:
|
|
231
|
-
...
|
|
230
|
+
toolID: u,
|
|
231
|
+
fileType: r,
|
|
232
|
+
...s ? { nameStructure: s } : {},
|
|
232
233
|
version: "0",
|
|
233
234
|
revision: "1",
|
|
234
235
|
uuid: crypto.randomUUID()
|
|
235
236
|
}
|
|
236
|
-
}), X = await t.getRecord({ tagName: "History" }) ?? await t.addChild(A, { tagName: "History", attributes: {} }), O = await
|
|
237
|
+
}), X = await t.getRecord({ tagName: "History" }) ?? await t.addChild(A, { tagName: "History", attributes: {} }), O = await k(t), v = O?.attributes.find((E) => E.name === "version")?.value, P = O?.attributes.find((E) => E.name === "revision")?.value, C = c === "keep" ? v ?? "0" : v ? String(Number(v) + 1) : "0", D = P ? String(Number(P) + 1) : "1";
|
|
237
238
|
await t.update(A, {
|
|
238
|
-
attributes: { version: C, revision:
|
|
239
|
+
attributes: { version: C, revision: D }
|
|
239
240
|
});
|
|
240
241
|
const M = /* @__PURE__ */ new Date(), g = M.toString().split(" "), Y = M.toLocaleString("en", { timeZoneName: "short" }).split(" ").pop(), W = `${g[0]} ${g[1]} ${g[2]} ${g[4]} ${Y} ${g[3]}`;
|
|
241
242
|
await t.addChild(X, {
|
|
242
243
|
tagName: "Hitem",
|
|
243
244
|
attributes: {
|
|
244
245
|
version: C,
|
|
245
|
-
revision:
|
|
246
|
+
revision: D,
|
|
246
247
|
when: W,
|
|
247
248
|
who: d,
|
|
248
249
|
what: f,
|
|
249
250
|
why: l
|
|
250
251
|
}
|
|
251
252
|
}), await t.update(A, {
|
|
252
|
-
attributes: { version: C, revision:
|
|
253
|
+
attributes: { version: C, revision: D }
|
|
253
254
|
});
|
|
254
255
|
}
|
|
255
|
-
const
|
|
256
|
+
const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
256
257
|
__proto__: null,
|
|
257
258
|
addEntry: yt
|
|
258
259
|
}, Symbol.toStringTag, { value: "Module" })), L = {
|
|
259
260
|
query: gt,
|
|
260
|
-
transaction:
|
|
261
|
-
},
|
|
261
|
+
transaction: wt
|
|
262
|
+
}, bt = {
|
|
262
263
|
LNode: ["prefix", "lnClass", "lnInst"],
|
|
263
264
|
LN: ["prefix", "lnClass", "inst"],
|
|
264
265
|
LN0: ["prefix", "lnClass", "inst"],
|
|
@@ -288,12 +289,12 @@ const bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
288
289
|
async function Tt(t, a) {
|
|
289
290
|
const e = await t.getRecord(a);
|
|
290
291
|
if (!e) return "";
|
|
291
|
-
const n = e.tagName, o = await t.
|
|
292
|
+
const n = e.tagName, o = await t.any.getAttributes(e), i = bt[n];
|
|
292
293
|
if (i) {
|
|
293
|
-
const
|
|
294
|
-
return d.length > 0 ? d.join(
|
|
294
|
+
const u = Nt[n] ?? "", d = i.map((f) => o[f]).filter(Boolean);
|
|
295
|
+
return d.length > 0 ? d.join(u) : n;
|
|
295
296
|
}
|
|
296
|
-
const
|
|
297
|
+
const s = J[n]?.attributes?.identityFields, c = s?.find((u) => u === "name" || u === "id") ?? s?.[0];
|
|
297
298
|
return c ? o[c] || n : o.name || n;
|
|
298
299
|
}
|
|
299
300
|
const Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -324,13 +325,13 @@ const At = {
|
|
|
324
325
|
attributes: ["templateUuid", "originUuid"]
|
|
325
326
|
};
|
|
326
327
|
async function S(t, a) {
|
|
327
|
-
const { sourceQuery: e, ref: n, targetParent: o, omit: i, promoteRoot:
|
|
328
|
+
const { sourceQuery: e, ref: n, targetParent: o, omit: i, promoteRoot: r, strip: s = At } = a, c = await e.getTree(n, { omit: i });
|
|
328
329
|
if (!c) return;
|
|
329
|
-
const
|
|
330
|
-
let d =
|
|
331
|
-
|
|
332
|
-
...
|
|
333
|
-
attributes:
|
|
330
|
+
const u = r && c.tagName === r.from ? { ...c, tagName: r.to } : c;
|
|
331
|
+
let d = u;
|
|
332
|
+
s && (d = s.scope === "tree" ? tt(u, s.attributes) : {
|
|
333
|
+
...u,
|
|
334
|
+
attributes: u.attributes.filter((f) => !s.attributes.includes(f.name))
|
|
334
335
|
}), await t.deepClone(o, d);
|
|
335
336
|
}
|
|
336
337
|
async function vt(t, a) {
|
|
@@ -340,7 +341,7 @@ async function vt(t, a) {
|
|
|
340
341
|
o.length > 0 && await j.transaction.extract(t, { sourceQuery: e, records: o });
|
|
341
342
|
}
|
|
342
343
|
async function F(t, a, e) {
|
|
343
|
-
const o = (await t.findAncestors(a, { stopAtTagName: "Substation" })).find((
|
|
344
|
+
const o = (await t.findAncestors(a, { stopAtTagName: "Substation" })).find((r) => r.tagName in e);
|
|
344
345
|
U(o, {
|
|
345
346
|
key: "ELEMENT_NOT_FOUND",
|
|
346
347
|
detail: `No Substation/VoltageLevel/Bay ancestor found for ${a.tagName}`
|
|
@@ -349,44 +350,44 @@ async function F(t, a, e) {
|
|
|
349
350
|
return { tagName: i.tagName, id: i.id };
|
|
350
351
|
}
|
|
351
352
|
async function Q(t, a) {
|
|
352
|
-
const { sourceQuery: e, functionRef: n, targetParentRef: o, omit: i, stripRootAttributes:
|
|
353
|
+
const { sourceQuery: e, functionRef: n, targetParentRef: o, omit: i, stripRootAttributes: r } = a, s = r?.length ? { scope: "root", attributes: [...r] } : !1;
|
|
353
354
|
await S(t, {
|
|
354
355
|
sourceQuery: e,
|
|
355
356
|
ref: n,
|
|
356
357
|
targetParent: o,
|
|
357
358
|
omit: i,
|
|
358
359
|
promoteRoot: { from: "SubFunction", to: "Function" },
|
|
359
|
-
strip:
|
|
360
|
+
strip: s
|
|
360
361
|
}), await vt(t, { sourceQuery: e, scopeRef: n });
|
|
361
362
|
}
|
|
362
363
|
async function $(t, a) {
|
|
363
|
-
const { sourceQuery: e, functionRef: n, structure: o, stripCategoriesUuid: i = !0 } = a,
|
|
364
|
-
for (const
|
|
365
|
-
if (await
|
|
366
|
-
const
|
|
364
|
+
const { sourceQuery: e, functionRef: n, structure: o, stripCategoriesUuid: i = !0 } = a, r = await Ct(e, n);
|
|
365
|
+
for (const s of r) {
|
|
366
|
+
if (await Et(t, e, s)) continue;
|
|
367
|
+
const u = { tagName: "FunctionCategory", id: s }, d = await F(e, u, o);
|
|
367
368
|
await S(t, {
|
|
368
369
|
sourceQuery: e,
|
|
369
|
-
ref:
|
|
370
|
+
ref: u,
|
|
370
371
|
targetParent: d,
|
|
371
372
|
...i ? {} : { strip: !1 }
|
|
372
373
|
});
|
|
373
374
|
}
|
|
374
375
|
}
|
|
375
376
|
async function Ct(t, a) {
|
|
376
|
-
const e = await
|
|
377
|
+
const e = await Dt(t, a), n = /* @__PURE__ */ new Set();
|
|
377
378
|
for (const { container: o } of e)
|
|
378
379
|
o && n.add(o.id);
|
|
379
380
|
return n;
|
|
380
381
|
}
|
|
381
|
-
async function
|
|
382
|
-
const e = await
|
|
382
|
+
async function Dt(t, a) {
|
|
383
|
+
const e = await _.query.findRefsPointingTo(t, {
|
|
383
384
|
target: a,
|
|
384
385
|
containerTagName: "FunctionCategory"
|
|
385
386
|
}), { SubFunction: n = [] } = await t.findDescendants(a, {
|
|
386
387
|
collect: "SubFunction"
|
|
387
388
|
});
|
|
388
389
|
for (const o of n) {
|
|
389
|
-
const i = await
|
|
390
|
+
const i = await _.query.findRefsPointingTo(t, {
|
|
390
391
|
target: { tagName: "SubFunction", id: o.id },
|
|
391
392
|
containerTagName: "FunctionCategory"
|
|
392
393
|
});
|
|
@@ -394,7 +395,7 @@ async function Et(t, a) {
|
|
|
394
395
|
}
|
|
395
396
|
return e;
|
|
396
397
|
}
|
|
397
|
-
async function
|
|
398
|
+
async function Et(t, a, e) {
|
|
398
399
|
const n = await a.getRecord({
|
|
399
400
|
tagName: "FunctionCategory",
|
|
400
401
|
id: e
|
|
@@ -409,17 +410,17 @@ async function _t(t, a, e) {
|
|
|
409
410
|
return !!i;
|
|
410
411
|
}
|
|
411
412
|
async function z(t, a) {
|
|
412
|
-
const { sourceQuery: e, scopeRef: n, refTagName: o, targetTagName: i } = a,
|
|
413
|
+
const { sourceQuery: e, scopeRef: n, refTagName: o, targetTagName: i } = a, r = w[o][0].attribute.uuid, s = await e.findDescendants(n, {
|
|
413
414
|
collect: o
|
|
414
|
-
}), { [o]: c = [] } =
|
|
415
|
+
}), { [o]: c = [] } = s, u = /* @__PURE__ */ new Set();
|
|
415
416
|
for (const f of c) {
|
|
416
417
|
const l = f.attributes.find(
|
|
417
|
-
(m) => m.name ===
|
|
418
|
+
(m) => m.name === r
|
|
418
419
|
)?.value;
|
|
419
|
-
l &&
|
|
420
|
+
l && u.add(l);
|
|
420
421
|
}
|
|
421
422
|
const d = [];
|
|
422
|
-
for (const f of
|
|
423
|
+
for (const f of u) {
|
|
423
424
|
const l = { uuid: f }, [m] = await t.findByAttributes({ tagName: i, attributes: l });
|
|
424
425
|
if (m) continue;
|
|
425
426
|
const [p] = await e.findByAttributes({
|
|
@@ -430,30 +431,30 @@ async function z(t, a) {
|
|
|
430
431
|
}
|
|
431
432
|
return d;
|
|
432
433
|
}
|
|
433
|
-
async function
|
|
434
|
-
const { sourceQuery: e, scopeRef: n, refTagName: o, targetTagName: i, targetParent:
|
|
434
|
+
async function _t(t, a) {
|
|
435
|
+
const { sourceQuery: e, scopeRef: n, refTagName: o, targetTagName: i, targetParent: r, omit: s } = a, c = await z(t, {
|
|
435
436
|
sourceQuery: e,
|
|
436
437
|
scopeRef: n,
|
|
437
438
|
refTagName: o,
|
|
438
439
|
targetTagName: i
|
|
439
440
|
});
|
|
440
|
-
for (const
|
|
441
|
-
await S(t, { sourceQuery: e, ref:
|
|
441
|
+
for (const u of c)
|
|
442
|
+
await S(t, { sourceQuery: e, ref: u, targetParent: r, omit: s });
|
|
442
443
|
}
|
|
443
|
-
async function
|
|
444
|
-
const { sourceQuery: e, scopeTagName: n, scopeRef: o, targetParent: i, skip:
|
|
445
|
-
(d) => d in
|
|
446
|
-
),
|
|
444
|
+
async function ht(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 = _t;
|
|
447
448
|
for (const d of c)
|
|
448
|
-
for (const f of
|
|
449
|
+
for (const f of w[d])
|
|
449
450
|
for (const l of f.target)
|
|
450
|
-
await
|
|
451
|
+
await u(t, {
|
|
451
452
|
sourceQuery: e,
|
|
452
453
|
scopeRef: o,
|
|
453
454
|
refTagName: d,
|
|
454
455
|
targetTagName: l,
|
|
455
456
|
targetParent: i,
|
|
456
|
-
omit:
|
|
457
|
+
omit: s
|
|
457
458
|
});
|
|
458
459
|
}
|
|
459
460
|
const T = [
|
|
@@ -476,29 +477,29 @@ async function Lt(t, a) {
|
|
|
476
477
|
const { sourceQuery: e, applicationRef: n, structure: o } = a, i = {
|
|
477
478
|
tagName: "Substation",
|
|
478
479
|
id: o.Substation.id
|
|
479
|
-
},
|
|
480
|
+
}, r = await z(t, {
|
|
480
481
|
sourceQuery: e,
|
|
481
482
|
scopeRef: n,
|
|
482
483
|
refTagName: "FunctionRef",
|
|
483
484
|
targetTagName: "Function"
|
|
484
485
|
});
|
|
485
|
-
for (const
|
|
486
|
-
const d = await F(e,
|
|
486
|
+
for (const u of r) {
|
|
487
|
+
const d = await F(e, u, o);
|
|
487
488
|
await Q(t, {
|
|
488
489
|
sourceQuery: e,
|
|
489
|
-
functionRef:
|
|
490
|
+
functionRef: u,
|
|
490
491
|
targetParentRef: d,
|
|
491
492
|
omit: T
|
|
492
493
|
});
|
|
493
494
|
}
|
|
494
|
-
for (const
|
|
495
|
+
for (const u of r)
|
|
495
496
|
await $(t, {
|
|
496
497
|
sourceQuery: e,
|
|
497
|
-
functionRef:
|
|
498
|
+
functionRef: u,
|
|
498
499
|
structure: o,
|
|
499
500
|
stripCategoriesUuid: !1
|
|
500
501
|
});
|
|
501
|
-
await
|
|
502
|
+
await ht(t, {
|
|
502
503
|
sourceQuery: e,
|
|
503
504
|
scopeTagName: "Application",
|
|
504
505
|
scopeRef: n,
|
|
@@ -513,34 +514,34 @@ async function G(t) {
|
|
|
513
514
|
await N.transaction.orphanUuidRefs(t), await N.transaction.resetLNode(t), await N.transaction.pruneEmptyContainers(t);
|
|
514
515
|
}
|
|
515
516
|
async function It(t, a) {
|
|
516
|
-
const { sourceQuery: e, applicationRef: n, tool: o, who: i, nameStructure:
|
|
517
|
+
const { sourceQuery: e, applicationRef: n, tool: o, who: i, nameStructure: r } = a, s = await I(t), c = await t.getAttribute(n, { name: "name" }) || "Unnamed Application";
|
|
517
518
|
await L.transaction.addEntry(t, {
|
|
518
519
|
filename: `ASD_${c.replace(/\s+/g, "_")}`,
|
|
519
520
|
header: {
|
|
520
521
|
fileType: "ASD",
|
|
521
522
|
version: "keep",
|
|
522
523
|
tool: o,
|
|
523
|
-
...
|
|
524
|
+
...r ? { nameStructure: r } : {}
|
|
524
525
|
},
|
|
525
526
|
item: {
|
|
526
527
|
who: i,
|
|
527
528
|
what: "ASD initialization",
|
|
528
529
|
why: "Application was extracted from a previous file"
|
|
529
530
|
}
|
|
530
|
-
}), await Lt(t, { sourceQuery: e, applicationRef: n, structure:
|
|
531
|
+
}), await Lt(t, { sourceQuery: e, applicationRef: n, structure: s }), await G(t);
|
|
531
532
|
}
|
|
532
533
|
async function Ot(t, a) {
|
|
533
|
-
const { sourceQuery: e, functionRef: n, tool: o, who: i, nameStructure:
|
|
534
|
-
tagName:
|
|
535
|
-
id:
|
|
536
|
-
},
|
|
534
|
+
const { sourceQuery: e, functionRef: n, tool: o, who: i, nameStructure: r } = a, s = await I(t), c = {
|
|
535
|
+
tagName: s.Substation.tagName,
|
|
536
|
+
id: s.Substation.id
|
|
537
|
+
}, u = await e.getAttribute(n, { name: "name" }) || "Unnamed Function";
|
|
537
538
|
await L.transaction.addEntry(t, {
|
|
538
|
-
filename: `FSD_${
|
|
539
|
+
filename: `FSD_${u.replace(/\s+/g, "_")}`,
|
|
539
540
|
header: {
|
|
540
541
|
fileType: "FSD",
|
|
541
542
|
version: "keep",
|
|
542
543
|
tool: o,
|
|
543
|
-
...
|
|
544
|
+
...r ? { nameStructure: r } : {}
|
|
544
545
|
},
|
|
545
546
|
item: {
|
|
546
547
|
who: i,
|
|
@@ -556,7 +557,7 @@ async function Ot(t, a) {
|
|
|
556
557
|
}), await $(t, {
|
|
557
558
|
sourceQuery: e,
|
|
558
559
|
functionRef: n,
|
|
559
|
-
structure:
|
|
560
|
+
structure: s
|
|
560
561
|
}), await G(t);
|
|
561
562
|
}
|
|
562
563
|
const Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -570,17 +571,17 @@ const Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
570
571
|
cleanUp: N,
|
|
571
572
|
dataModel: j,
|
|
572
573
|
history: L,
|
|
573
|
-
reference:
|
|
574
|
+
reference: _,
|
|
574
575
|
template: Mt,
|
|
575
576
|
presentation: St
|
|
576
577
|
};
|
|
577
|
-
function
|
|
578
|
+
function kt(t) {
|
|
578
579
|
const { storage: a, extensions: e } = t;
|
|
579
580
|
return nt({
|
|
580
581
|
config: R,
|
|
581
582
|
storage: a,
|
|
582
583
|
extensions: { base: K, custom: e },
|
|
583
|
-
hooks:
|
|
584
|
+
hooks: H
|
|
584
585
|
});
|
|
585
586
|
}
|
|
586
587
|
async function Qt(t) {
|
|
@@ -589,7 +590,7 @@ async function Qt(t) {
|
|
|
589
590
|
config: R,
|
|
590
591
|
storage: a,
|
|
591
592
|
extensions: { base: K, custom: e },
|
|
592
|
-
hooks:
|
|
593
|
+
hooks: H
|
|
593
594
|
});
|
|
594
595
|
}
|
|
595
596
|
function $t(t) {
|
|
@@ -618,5 +619,5 @@ export {
|
|
|
618
619
|
Qt as createSclDocument,
|
|
619
620
|
zt as exportSclFile,
|
|
620
621
|
$t as importSclFiles,
|
|
621
|
-
|
|
622
|
+
kt as openSclDocument
|
|
622
623
|
};
|
package/dist/v2019C1/test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CUSTOM_RECORD_ID_ATTRIBUTE as R, CUSTOM_RECORD_ID_ATTRIBUTE_NAME as D } from "@dialecte/core/helpers";
|
|
2
2
|
import { createTestRunner as r, createTestRecordFactory as n, createXmlAssertions as a, XMLNS_DEV_NAMESPACE as o, createTestDialecte as S } from "@dialecte/core/test";
|
|
3
|
-
import { S as e, H as t } from "../index-
|
|
3
|
+
import { S as e, H as t } from "../index-ChFpcq4k.js";
|
|
4
4
|
const E = 'xmlns="http://www.iec.ch/61850/2003/SCL"', _ = 'xmlns:eIEC61850-6-100="http://www.iec.ch/61850/2019/SCL/6-100"', i = `${E} ${_} ${o}`, A = r(e, t);
|
|
5
5
|
async function m(s) {
|
|
6
6
|
const { xmlString: c } = s;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dialecte/scl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "Dialecte - SCL (Substation Configuration Language) sdk",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"prepare": "husky"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@dialecte/core": "0.1.
|
|
50
|
+
"@dialecte/core": "0.1.21",
|
|
51
51
|
"dexie": "4.2.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|