@openscd/scl-lib 2.0.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/LICENCE +201 -0
- package/README.md +20 -0
- package/dist/foundation/codecomponents/nsds.d.ts +5 -0
- package/dist/foundation/codecomponents/nsds.js +22435 -0
- package/dist/foundation/codecomponents/nsds.js.map +1 -0
- package/dist/foundation/nsd.json +137748 -0
- package/dist/foundation/uniqueElementName.d.ts +2 -0
- package/dist/foundation/uniqueElementName.js +18 -0
- package/dist/foundation/uniqueElementName.js.map +1 -0
- package/dist/foundation/utils.d.ts +20 -0
- package/dist/foundation/utils.js +14 -0
- package/dist/foundation/utils.js.map +1 -0
- package/dist/generator/appIdGenerator.d.ts +21 -0
- package/dist/generator/appIdGenerator.js +53 -0
- package/dist/generator/appIdGenerator.js.map +1 -0
- package/dist/generator/lnInstGenerator.d.ts +16 -0
- package/dist/generator/lnInstGenerator.js +41 -0
- package/dist/generator/lnInstGenerator.js.map +1 -0
- package/dist/generator/macAddressGenerator.d.ts +14 -0
- package/dist/generator/macAddressGenerator.js +39 -0
- package/dist/generator/macAddressGenerator.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/tAddress/changeGseOrSmvAddress.d.ts +14 -0
- package/dist/tAddress/changeGseOrSmvAddress.js +43 -0
- package/dist/tAddress/changeGseOrSmvAddress.js.map +1 -0
- package/dist/tBaseElement/find.d.ts +6 -0
- package/dist/tBaseElement/find.js +529 -0
- package/dist/tBaseElement/find.js.map +1 -0
- package/dist/tBaseElement/getChildren.d.ts +5 -0
- package/dist/tBaseElement/getChildren.js +12 -0
- package/dist/tBaseElement/getChildren.js.map +1 -0
- package/dist/tBaseElement/getReference.d.ts +9 -0
- package/dist/tBaseElement/getReference.js +31 -0
- package/dist/tBaseElement/getReference.js.map +1 -0
- package/dist/tBaseElement/identity.d.ts +2 -0
- package/dist/tBaseElement/identity.js +566 -0
- package/dist/tBaseElement/identity.js.map +1 -0
- package/dist/tBaseElement/isPublic.d.ts +2 -0
- package/dist/tBaseElement/isPublic.js +5 -0
- package/dist/tBaseElement/isPublic.js.map +1 -0
- package/dist/tBaseElement/parentTags.d.ts +3 -0
- package/dist/tBaseElement/parentTags.js +8 -0
- package/dist/tBaseElement/parentTags.js.map +1 -0
- package/dist/tBaseElement/tags.d.ts +8 -0
- package/dist/tBaseElement/tags.js +807 -0
- package/dist/tBaseElement/tags.js.map +1 -0
- package/dist/tBay/updateBay.d.ts +5 -0
- package/dist/tBay/updateBay.js +81 -0
- package/dist/tBay/updateBay.js.map +1 -0
- package/dist/tControl/controlBlockGseOrSmv.d.ts +7 -0
- package/dist/tControl/controlBlockGseOrSmv.js +26 -0
- package/dist/tControl/controlBlockGseOrSmv.js.map +1 -0
- package/dist/tControl/controlBlockObjRef.d.ts +2 -0
- package/dist/tControl/controlBlockObjRef.js +14 -0
- package/dist/tControl/controlBlockObjRef.js.map +1 -0
- package/dist/tControl/controlBlocks.d.ts +2 -0
- package/dist/tControl/controlBlocks.js +9 -0
- package/dist/tControl/controlBlocks.js.map +1 -0
- package/dist/tControl/findControlSubscription.d.ts +2 -0
- package/dist/tControl/findControlSubscription.js +8 -0
- package/dist/tControl/findControlSubscription.js.map +1 -0
- package/dist/tControl/pathId.d.ts +1 -0
- package/dist/tControl/pathId.js +9 -0
- package/dist/tControl/pathId.js.map +1 -0
- package/dist/tControl/removeControlBlock.d.ts +14 -0
- package/dist/tControl/removeControlBlock.js +35 -0
- package/dist/tControl/removeControlBlock.js.map +1 -0
- package/dist/tControl/updateConfRev.d.ts +2 -0
- package/dist/tControl/updateConfRev.js +8 -0
- package/dist/tControl/updateConfRev.js.map +1 -0
- package/dist/tControl/updateDatSet.d.ts +6 -0
- package/dist/tControl/updateDatSet.js +22 -0
- package/dist/tControl/updateDatSet.js.map +1 -0
- package/dist/tControlWithIEDName/connctedAp.d.ts +2 -0
- package/dist/tControlWithIEDName/connctedAp.js +7 -0
- package/dist/tControlWithIEDName/connctedAp.js.map +1 -0
- package/dist/tDataSet/canAddDataSet.d.ts +4 -0
- package/dist/tDataSet/canAddDataSet.js +44 -0
- package/dist/tDataSet/canAddDataSet.js.map +1 -0
- package/dist/tDataSet/createDataSet.d.ts +9 -0
- package/dist/tDataSet/createDataSet.js +33 -0
- package/dist/tDataSet/createDataSet.js.map +1 -0
- package/dist/tDataSet/removeDataSet.d.ts +10 -0
- package/dist/tDataSet/removeDataSet.js +27 -0
- package/dist/tDataSet/removeDataSet.js.map +1 -0
- package/dist/tDataSet/updateDataSet.d.ts +7 -0
- package/dist/tDataSet/updateDataSet.js +28 -0
- package/dist/tDataSet/updateDataSet.js.map +1 -0
- package/dist/tDataTypeTemplates/foundation.d.ts +2 -0
- package/dist/tDataTypeTemplates/foundation.js +118 -0
- package/dist/tDataTypeTemplates/foundation.js.map +1 -0
- package/dist/tDataTypeTemplates/importLNodeType.d.ts +13 -0
- package/dist/tDataTypeTemplates/importLNodeType.js +88 -0
- package/dist/tDataTypeTemplates/importLNodeType.js.map +1 -0
- package/dist/tDataTypeTemplates/insertSelectedLNodeType.d.ts +20 -0
- package/dist/tDataTypeTemplates/insertSelectedLNodeType.js +187 -0
- package/dist/tDataTypeTemplates/insertSelectedLNodeType.js.map +1 -0
- package/dist/tDataTypeTemplates/lNodeTypeToSelection.d.ts +8 -0
- package/dist/tDataTypeTemplates/lNodeTypeToSelection.js +67 -0
- package/dist/tDataTypeTemplates/lNodeTypeToSelection.js.map +1 -0
- package/dist/tDataTypeTemplates/nsdToJson.d.ts +101 -0
- package/dist/tDataTypeTemplates/nsdToJson.js +433 -0
- package/dist/tDataTypeTemplates/nsdToJson.js.map +1 -0
- package/dist/tDataTypeTemplates/removeDataType.d.ts +12 -0
- package/dist/tDataTypeTemplates/removeDataType.js +62 -0
- package/dist/tDataTypeTemplates/removeDataType.js.map +1 -0
- package/dist/tDataTypeTemplates/updateLNodeType.d.ts +2 -0
- package/dist/tDataTypeTemplates/updateLNodeType.js +22 -0
- package/dist/tDataTypeTemplates/updateLNodeType.js.map +1 -0
- package/dist/tExtRef/doesFcdaMeetExtRefRestrictions.d.ts +16 -0
- package/dist/tExtRef/doesFcdaMeetExtRefRestrictions.js +52 -0
- package/dist/tExtRef/doesFcdaMeetExtRefRestrictions.js.map +1 -0
- package/dist/tExtRef/extRefTypeRestrictions.d.ts +17 -0
- package/dist/tExtRef/extRefTypeRestrictions.js +32 -0
- package/dist/tExtRef/extRefTypeRestrictions.js.map +1 -0
- package/dist/tExtRef/isSubscribed.d.ts +7 -0
- package/dist/tExtRef/isSubscribed.js +23 -0
- package/dist/tExtRef/isSubscribed.js.map +1 -0
- package/dist/tExtRef/matchDataAttributes.d.ts +2 -0
- package/dist/tExtRef/matchDataAttributes.js +13 -0
- package/dist/tExtRef/matchDataAttributes.js.map +1 -0
- package/dist/tExtRef/matchSrcAttributes.d.ts +2 -0
- package/dist/tExtRef/matchSrcAttributes.js +28 -0
- package/dist/tExtRef/matchSrcAttributes.js.map +1 -0
- package/dist/tExtRef/sourceControlBlock.d.ts +8 -0
- package/dist/tExtRef/sourceControlBlock.js +52 -0
- package/dist/tExtRef/sourceControlBlock.js.map +1 -0
- package/dist/tExtRef/subscribe.d.ts +47 -0
- package/dist/tExtRef/subscribe.js +187 -0
- package/dist/tExtRef/subscribe.js.map +1 -0
- package/dist/tExtRef/unsubscribe.d.ts +27 -0
- package/dist/tExtRef/unsubscribe.js +55 -0
- package/dist/tExtRef/unsubscribe.js.map +1 -0
- package/dist/tFCDA/canAddFCDA.d.ts +10 -0
- package/dist/tFCDA/canAddFCDA.js +42 -0
- package/dist/tFCDA/canAddFCDA.js.map +1 -0
- package/dist/tFCDA/fcdaBaseTypes.d.ts +11 -0
- package/dist/tFCDA/fcdaBaseTypes.js +56 -0
- package/dist/tFCDA/fcdaBaseTypes.js.map +1 -0
- package/dist/tFCDA/removeFCDA.d.ts +8 -0
- package/dist/tFCDA/removeFCDA.js +33 -0
- package/dist/tFCDA/removeFCDA.js.map +1 -0
- package/dist/tGSE/changeGSEContent.d.ts +17 -0
- package/dist/tGSE/changeGSEContent.js +53 -0
- package/dist/tGSE/changeGSEContent.js.map +1 -0
- package/dist/tGSE/createGSE.d.ts +20 -0
- package/dist/tGSE/createGSE.js +44 -0
- package/dist/tGSE/createGSE.js.map +1 -0
- package/dist/tGSEControl/canAddGSEControl.d.ts +4 -0
- package/dist/tGSEControl/canAddGSEControl.js +27 -0
- package/dist/tGSEControl/canAddGSEControl.js.map +1 -0
- package/dist/tGSEControl/createGSEControl.d.ts +49 -0
- package/dist/tGSEControl/createGSEControl.js +65 -0
- package/dist/tGSEControl/createGSEControl.js.map +1 -0
- package/dist/tGSEControl/updateGSEControl.d.ts +15 -0
- package/dist/tGSEControl/updateGSEControl.js +61 -0
- package/dist/tGSEControl/updateGSEControl.js.map +1 -0
- package/dist/tIED/insertIED.d.ts +13 -0
- package/dist/tIED/insertIED.js +245 -0
- package/dist/tIED/insertIED.js.map +1 -0
- package/dist/tIED/removeIED.d.ts +14 -0
- package/dist/tIED/removeIED.js +70 -0
- package/dist/tIED/removeIED.js.map +1 -0
- package/dist/tIED/updateIED.d.ts +17 -0
- package/dist/tIED/updateIED.js +185 -0
- package/dist/tIED/updateIED.js.map +1 -0
- package/dist/tInputs/removeInputs.d.ts +7 -0
- package/dist/tInputs/removeInputs.js +25 -0
- package/dist/tInputs/removeInputs.js.map +1 -0
- package/dist/tLN/removeSubscriptionSupervision.d.ts +7 -0
- package/dist/tLN/removeSubscriptionSupervision.js +94 -0
- package/dist/tLN/removeSubscriptionSupervision.js.map +1 -0
- package/dist/tLN/supervision/canInstantiateSubscriptionSupervision.d.ts +13 -0
- package/dist/tLN/supervision/canInstantiateSubscriptionSupervision.js +116 -0
- package/dist/tLN/supervision/canInstantiateSubscriptionSupervision.js.map +1 -0
- package/dist/tLN/supervision/createSupervisionEdit.d.ts +20 -0
- package/dist/tLN/supervision/createSupervisionEdit.js +129 -0
- package/dist/tLN/supervision/createSupervisionEdit.js.map +1 -0
- package/dist/tLN/supervision/findControlBlockOnSrcAttributes.d.ts +10 -0
- package/dist/tLN/supervision/findControlBlockOnSrcAttributes.js +13 -0
- package/dist/tLN/supervision/findControlBlockOnSrcAttributes.js.map +1 -0
- package/dist/tLN/supervision/foundation.d.ts +37 -0
- package/dist/tLN/supervision/foundation.js +43 -0
- package/dist/tLN/supervision/foundation.js.map +1 -0
- package/dist/tLN/supervision/insertSubscriptionSupervisions.d.ts +11 -0
- package/dist/tLN/supervision/insertSubscriptionSupervisions.js +98 -0
- package/dist/tLN/supervision/insertSubscriptionSupervisions.js.map +1 -0
- package/dist/tLN/supervision/instantiateSubscriptionSupervision.d.ts +10 -0
- package/dist/tLN/supervision/instantiateSubscriptionSupervision.js +36 -0
- package/dist/tLN/supervision/instantiateSubscriptionSupervision.js.map +1 -0
- package/dist/tLN/supervision/removeSupervision.d.ts +7 -0
- package/dist/tLN/supervision/removeSupervision.js +39 -0
- package/dist/tLN/supervision/removeSupervision.js.map +1 -0
- package/dist/tReportControl/canAddReportControl.d.ts +11 -0
- package/dist/tReportControl/canAddReportControl.js +24 -0
- package/dist/tReportControl/canAddReportControl.js.map +1 -0
- package/dist/tReportControl/createReportControl.d.ts +68 -0
- package/dist/tReportControl/createReportControl.js +78 -0
- package/dist/tReportControl/createReportControl.js.map +1 -0
- package/dist/tReportControl/numberReportControlInstances.d.ts +5 -0
- package/dist/tReportControl/numberReportControlInstances.js +19 -0
- package/dist/tReportControl/numberReportControlInstances.js.map +1 -0
- package/dist/tReportControl/updateReportControl.d.ts +5 -0
- package/dist/tReportControl/updateReportControl.js +24 -0
- package/dist/tReportControl/updateReportControl.js.map +1 -0
- package/dist/tSMV/changeSMVContent.d.ts +3 -0
- package/dist/tSMV/changeSMVContent.js +5 -0
- package/dist/tSMV/changeSMVContent.js.map +1 -0
- package/dist/tSMV/createSMV.d.ts +16 -0
- package/dist/tSMV/createSMV.js +32 -0
- package/dist/tSMV/createSMV.js.map +1 -0
- package/dist/tSampledValueControl/canAddSampledValueControl.d.ts +4 -0
- package/dist/tSampledValueControl/canAddSampledValueControl.js +27 -0
- package/dist/tSampledValueControl/canAddSampledValueControl.js.map +1 -0
- package/dist/tSampledValueControl/createSampledValueControl.d.ts +66 -0
- package/dist/tSampledValueControl/createSampledValueControl.js +74 -0
- package/dist/tSampledValueControl/createSampledValueControl.js.map +1 -0
- package/dist/tSampledValueControl/updateSampledValueControl.d.ts +14 -0
- package/dist/tSampledValueControl/updateSampledValueControl.js +60 -0
- package/dist/tSampledValueControl/updateSampledValueControl.js.map +1 -0
- package/dist/tServices/tConfReportControl/maxReportControl.d.ts +9 -0
- package/dist/tServices/tConfReportControl/maxReportControl.js +14 -0
- package/dist/tServices/tConfReportControl/maxReportControl.js.map +1 -0
- package/dist/tSubstation/removeProcessElement.d.ts +9 -0
- package/dist/tSubstation/removeProcessElement.js +50 -0
- package/dist/tSubstation/removeProcessElement.js.map +1 -0
- package/dist/tSubstation/updateLnType.d.ts +8 -0
- package/dist/tSubstation/updateLnType.js +96 -0
- package/dist/tSubstation/updateLnType.js.map +1 -0
- package/dist/tSubstation/updateSubstation.d.ts +5 -0
- package/dist/tSubstation/updateSubstation.js +75 -0
- package/dist/tSubstation/updateSubstation.js.map +1 -0
- package/dist/tVoltageLevel/updateVoltageLevel.d.ts +5 -0
- package/dist/tVoltageLevel/updateVoltageLevel.js +83 -0
- package/dist/tVoltageLevel/updateVoltageLevel.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @returns Unique element name with [[`tagName`]] within [[`parent`]] */
|
|
2
|
+
export function uniqueElementName(parent, tagName) {
|
|
3
|
+
const nameCore = `new${tagName}`;
|
|
4
|
+
const siblingNames = Array.from(parent.querySelectorAll(`:scope > ${tagName}`)).map((child) => child.getAttribute("name") ?? child.tagName);
|
|
5
|
+
if (!siblingNames.length)
|
|
6
|
+
return `${nameCore}_001`;
|
|
7
|
+
let newName = "";
|
|
8
|
+
let i = 1;
|
|
9
|
+
newName = `${nameCore}_${i.toString().padStart(3, "0")}`;
|
|
10
|
+
while (i < siblingNames.length + 1) {
|
|
11
|
+
if (!siblingNames.includes(newName))
|
|
12
|
+
break;
|
|
13
|
+
i += 1;
|
|
14
|
+
newName = `${nameCore}_${i.toString().padStart(3, "0")}`;
|
|
15
|
+
}
|
|
16
|
+
return newName;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=uniqueElementName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniqueElementName.js","sourceRoot":"","sources":["../../foundation/uniqueElementName.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,UAAU,iBAAiB,CAAC,MAAe,EAAE,OAAe;IAChE,MAAM,QAAQ,GAAG,MAAM,OAAO,EAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAC7B,MAAM,CAAC,gBAAgB,CAAC,YAAY,OAAO,EAAE,CAAC,CAC/C,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9D,IAAI,CAAC,YAAY,CAAC,MAAM;QAAE,OAAO,GAAG,QAAQ,MAAM,CAAC;IAEnD,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,GAAG,GAAG,QAAQ,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IACzD,OAAO,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;QAClC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,MAAM;QAE3C,CAAC,IAAI,CAAC,CAAC;QACP,OAAO,GAAG,GAAG,QAAQ,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;KAC1D;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** User selection of a data structure
|
|
2
|
+
* @example
|
|
3
|
+
* user selects data object `Beh` to be enum `on` and `test`
|
|
4
|
+
* ```ts
|
|
5
|
+
* {
|
|
6
|
+
* Beh: {
|
|
7
|
+
* stVal: {on: {}, test: {}}
|
|
8
|
+
* q: {}
|
|
9
|
+
* t: {}
|
|
10
|
+
* }
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export type TreeSelection = {
|
|
15
|
+
[name: string]: TreeSelection;
|
|
16
|
+
};
|
|
17
|
+
/** Utility function to create element with `tagName` and its`attributes` */
|
|
18
|
+
export declare function createElement(doc: XMLDocument, tag: string, attrs: Record<string, string | null | undefined>): Element;
|
|
19
|
+
/** @returns the cartesian product of `arrays` */
|
|
20
|
+
export declare function crossProduct<T>(...arrays: T[][]): T[][];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Utility function to create element with `tagName` and its`attributes` */
|
|
2
|
+
export function createElement(doc, tag, attrs) {
|
|
3
|
+
const element = doc.createElementNS(doc.documentElement.namespaceURI, tag);
|
|
4
|
+
Object.entries(attrs)
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
+
.filter(([_, value]) => typeof value === "string")
|
|
7
|
+
.forEach(([name, value]) => element.setAttribute(name, value));
|
|
8
|
+
return element;
|
|
9
|
+
}
|
|
10
|
+
/** @returns the cartesian product of `arrays` */
|
|
11
|
+
export function crossProduct(...arrays) {
|
|
12
|
+
return arrays.reduce((a, b) => a.flatMap((d) => b.map((e) => [d, e].flat())), [[]]);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../foundation/utils.ts"],"names":[],"mappings":"AAiBA,4EAA4E;AAC5E,MAAM,UAAU,aAAa,CAC3B,GAAgB,EAChB,GAAW,EACX,KAAgD;IAEhD,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAC3E,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QACnB,6DAA6D;SAC5D,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;SACjD,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,KAAM,CAAC,CAAC,CAAC;IAElE,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,YAAY,CAAI,GAAG,MAAa;IAC9C,OAAO,MAAM,CAAC,MAAM,CAClB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAC9D,CAAC,EAAE,CAAC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Generator function returning unique `APPID` within `doc`. Defined once it
|
|
2
|
+
* can generate unique `APPID`s without the need to update the `doc` in-between
|
|
3
|
+
* ```md
|
|
4
|
+
* GSE: 0x0000 - 0x3FFF
|
|
5
|
+
* GSE Type1A: 0x8000 - 0xBFFF
|
|
6
|
+
* SMV: 0x4000 - 0x7FFF
|
|
7
|
+
* ```
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const appIdGen = appIdGenerator(doc,"GSE");
|
|
11
|
+
* const appId1 = appIdGen(); //0001
|
|
12
|
+
* const appId2 = appIdGen(); //000A
|
|
13
|
+
* ```
|
|
14
|
+
* @param doc - Project SCL as XMLDocument
|
|
15
|
+
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
16
|
+
* @param type1A - Whether the GOOSE is a Trip GOOSE resulting
|
|
17
|
+
* in different APPID range - default false
|
|
18
|
+
* @returns A function generating increasing unused `APPID` within `doc`
|
|
19
|
+
* on subsequent invocations
|
|
20
|
+
*/
|
|
21
|
+
export declare function appIdGenerator(doc: XMLDocument, serviceType: "SMV" | "GSE", type1A?: boolean): () => string | null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const maxGseAppId = 0x3fff;
|
|
2
|
+
const minGseAppId = 0x0000;
|
|
3
|
+
// APPID range for Type1A(Trip) GOOSE acc. IEC 61850-8-1
|
|
4
|
+
const maxGseTripAppId = 0xbfff;
|
|
5
|
+
const minGseTripAppId = 0x8000;
|
|
6
|
+
const maxSmvAppId = 0x7fff;
|
|
7
|
+
const minSmvAppId = 0x4000;
|
|
8
|
+
const gseAppIdRange = Array(maxGseAppId - minGseAppId)
|
|
9
|
+
.fill(1)
|
|
10
|
+
.map((_, i) => (minGseAppId + i).toString(16).toUpperCase().padStart(4, "0"));
|
|
11
|
+
const gseTripAppIdRange = Array(maxGseTripAppId - minGseTripAppId)
|
|
12
|
+
.fill(1)
|
|
13
|
+
.map((_, i) => (minGseTripAppId + i).toString(16).toUpperCase().padStart(4, "0"));
|
|
14
|
+
const smvAppIdRange = Array(maxSmvAppId - minSmvAppId)
|
|
15
|
+
.fill(1)
|
|
16
|
+
.map((_, i) => (minSmvAppId + i).toString(16).toUpperCase().padStart(4, "0"));
|
|
17
|
+
/** Generator function returning unique `APPID` within `doc`. Defined once it
|
|
18
|
+
* can generate unique `APPID`s without the need to update the `doc` in-between
|
|
19
|
+
* ```md
|
|
20
|
+
* GSE: 0x0000 - 0x3FFF
|
|
21
|
+
* GSE Type1A: 0x8000 - 0xBFFF
|
|
22
|
+
* SMV: 0x4000 - 0x7FFF
|
|
23
|
+
* ```
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const appIdGen = appIdGenerator(doc,"GSE");
|
|
27
|
+
* const appId1 = appIdGen(); //0001
|
|
28
|
+
* const appId2 = appIdGen(); //000A
|
|
29
|
+
* ```
|
|
30
|
+
* @param doc - Project SCL as XMLDocument
|
|
31
|
+
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
32
|
+
* @param type1A - Whether the GOOSE is a Trip GOOSE resulting
|
|
33
|
+
* in different APPID range - default false
|
|
34
|
+
* @returns A function generating increasing unused `APPID` within `doc`
|
|
35
|
+
* on subsequent invocations
|
|
36
|
+
*/
|
|
37
|
+
export function appIdGenerator(doc, serviceType, type1A = false) {
|
|
38
|
+
const appIds = new Set(Array.from(doc.querySelectorAll(`${serviceType} > Address > P[type="APPID"]`)).map((appId) => appId.textContent));
|
|
39
|
+
const range =
|
|
40
|
+
// eslint-disable-next-line no-nested-ternary
|
|
41
|
+
serviceType === "SMV"
|
|
42
|
+
? smvAppIdRange
|
|
43
|
+
: type1A
|
|
44
|
+
? gseTripAppIdRange
|
|
45
|
+
: gseAppIdRange;
|
|
46
|
+
return () => {
|
|
47
|
+
const uniqueAppId = range.find((appId) => !appIds.has(appId));
|
|
48
|
+
if (uniqueAppId)
|
|
49
|
+
appIds.add(uniqueAppId);
|
|
50
|
+
return uniqueAppId ?? null;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=appIdGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appIdGenerator.js","sourceRoot":"","sources":["../../generator/appIdGenerator.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,WAAW,GAAG,MAAM,CAAC;AAE3B,wDAAwD;AACxD,MAAM,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AAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAY,CAAC,CACrC,CAAC;IAEF,MAAM,KAAK;IACT,6CAA6C;IAC7C,WAAW,KAAK,KAAK;QACnB,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,MAAM;YACN,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,aAAa,CAAC;IAEtB,OAAO,GAAG,EAAE;QACV,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9D,IAAI,WAAW;YAAE,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzC,OAAO,WAAW,IAAI,IAAI,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function getChildElementsByTagName(element: Element, tag: string): Element[];
|
|
2
|
+
/**
|
|
3
|
+
* Generator function returning unique `inst` or `lnInst` attribute for element
|
|
4
|
+
* [[`tagName`]] within [[`parent`]].
|
|
5
|
+
* ```md
|
|
6
|
+
* Valid range for both `inst` and `lnInst` is between 1 and 99
|
|
7
|
+
* ```
|
|
8
|
+
* @param parent - The parent element to be scanned for `inst` or `lnInst`
|
|
9
|
+
* values already in use. Be sure to create a new generator every time the
|
|
10
|
+
* children of this element change in SCL.
|
|
11
|
+
* @param tagName - Tag name of the child elements containing the
|
|
12
|
+
* `lnInst` or `inst` attribute
|
|
13
|
+
* @returns a function generating increasing unused `inst` or `lnInst` values
|
|
14
|
+
* element with [[`tagName`]] within [[`parent`]] on subsequent invocations
|
|
15
|
+
*/
|
|
16
|
+
export declare function lnInstGenerator(parent: Element, tagName: "LN" | "LNode"): (lnClass: string) => string | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function getChildElementsByTagName(element, tag) {
|
|
2
|
+
return Array.from(element.children).filter((element) => element.tagName === tag);
|
|
3
|
+
}
|
|
4
|
+
/** maximum value for `lnInst` attribute */
|
|
5
|
+
const maxLnInst = 99;
|
|
6
|
+
const lnInstRange = Array(maxLnInst)
|
|
7
|
+
.fill(1)
|
|
8
|
+
.map((_, i) => `${i + 1}`);
|
|
9
|
+
/**
|
|
10
|
+
* Generator function returning unique `inst` or `lnInst` attribute for element
|
|
11
|
+
* [[`tagName`]] within [[`parent`]].
|
|
12
|
+
* ```md
|
|
13
|
+
* Valid range for both `inst` and `lnInst` is between 1 and 99
|
|
14
|
+
* ```
|
|
15
|
+
* @param parent - The parent element to be scanned for `inst` or `lnInst`
|
|
16
|
+
* values already in use. Be sure to create a new generator every time the
|
|
17
|
+
* children of this element change in SCL.
|
|
18
|
+
* @param tagName - Tag name of the child elements containing the
|
|
19
|
+
* `lnInst` or `inst` attribute
|
|
20
|
+
* @returns a function generating increasing unused `inst` or `lnInst` values
|
|
21
|
+
* element with [[`tagName`]] within [[`parent`]] on subsequent invocations
|
|
22
|
+
*/
|
|
23
|
+
export function lnInstGenerator(parent, tagName) {
|
|
24
|
+
const generators = new Map();
|
|
25
|
+
const generatedAttribute = tagName === "LN" ? "inst" : "lnInst";
|
|
26
|
+
return (lnClass) => {
|
|
27
|
+
if (!generators.has(lnClass)) {
|
|
28
|
+
const lnInstOrInst = new Set(getChildElementsByTagName(parent, tagName)
|
|
29
|
+
.filter((element) => element.getAttribute("lnClass") === lnClass)
|
|
30
|
+
.map((element) => element.getAttribute(generatedAttribute)));
|
|
31
|
+
generators.set(lnClass, () => {
|
|
32
|
+
const uniqueLnInstOrInst = lnInstRange.find((lnInst) => !lnInstOrInst.has(lnInst));
|
|
33
|
+
if (uniqueLnInstOrInst)
|
|
34
|
+
lnInstOrInst.add(uniqueLnInstOrInst);
|
|
35
|
+
return uniqueLnInstOrInst;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return generators.get(lnClass)();
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+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AC,OAAO,EAAE,GAAG,EAAE;gBAC3B,MAAM,kBAAkB,GAAG,WAAW,CAAC,IAAI,CACzC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CACtC,CAAC;gBACF,IAAI,kBAAkB;oBAAE,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;gBAC7D,OAAO,kBAAkB,CAAC;YAC5B,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,UAAU,CAAC,GAAG,CAAC,OAAO,CAAE,EAAE,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Generator function returning `MAC-Address` within `doc`. Defined once it can
|
|
2
|
+
* generate unique `MAC-address` without the need to update the `doc` in-between:
|
|
3
|
+
* @example
|
|
4
|
+
* ```ts
|
|
5
|
+
* const macGenerator = macAddressGenerator(doc,"GSE");
|
|
6
|
+
* const mac1 = macGenerator(); //01-0C-CD-01-00-09
|
|
7
|
+
* const mac2 = macGenerator(); //01-0C-CD-01-00-0A
|
|
8
|
+
* ```
|
|
9
|
+
* @param doc - Project SCL as XMLDocument
|
|
10
|
+
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
11
|
+
* @returns A function generating increasing unused `MAC-Address` within `doc`
|
|
12
|
+
* on subsequent invocations
|
|
13
|
+
*/
|
|
14
|
+
export declare function macAddressGenerator(doc: XMLDocument, serviceType: "SMV" | "GSE"): () => string | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const maxGseMacAddress = 0x010ccd0101ff;
|
|
2
|
+
const minGseMacAddress = 0x010ccd010000;
|
|
3
|
+
const maxSmvMacAddress = 0x010ccd0401ff;
|
|
4
|
+
const minSmvMacAddress = 0x010ccd040000;
|
|
5
|
+
function convertToMac(mac) {
|
|
6
|
+
const str = 0 + mac.toString(16).toUpperCase();
|
|
7
|
+
const arr = str.match(/.{1,2}/g);
|
|
8
|
+
return arr.join("-");
|
|
9
|
+
}
|
|
10
|
+
const gseMacRange = Array(maxGseMacAddress - minGseMacAddress)
|
|
11
|
+
.fill(1)
|
|
12
|
+
.map((_, i) => convertToMac(minGseMacAddress + i));
|
|
13
|
+
const smvMacRange = Array(maxSmvMacAddress - minSmvMacAddress)
|
|
14
|
+
.fill(1)
|
|
15
|
+
.map((_, i) => convertToMac(minSmvMacAddress + i));
|
|
16
|
+
/** Generator function returning `MAC-Address` within `doc`. Defined once it can
|
|
17
|
+
* generate unique `MAC-address` without the need to update the `doc` in-between:
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const macGenerator = macAddressGenerator(doc,"GSE");
|
|
21
|
+
* const mac1 = macGenerator(); //01-0C-CD-01-00-09
|
|
22
|
+
* const mac2 = macGenerator(); //01-0C-CD-01-00-0A
|
|
23
|
+
* ```
|
|
24
|
+
* @param doc - Project SCL as XMLDocument
|
|
25
|
+
* @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)
|
|
26
|
+
* @returns A function generating increasing unused `MAC-Address` within `doc`
|
|
27
|
+
* on subsequent invocations
|
|
28
|
+
*/
|
|
29
|
+
export function macAddressGenerator(doc, serviceType) {
|
|
30
|
+
const macs = new Set(Array.from(doc.querySelectorAll(`${serviceType} > Address > P[type="MAC-Address"]`)).map((mac) => mac.textContent));
|
|
31
|
+
const range = serviceType === "SMV" ? smvMacRange : gseMacRange;
|
|
32
|
+
return () => {
|
|
33
|
+
const uniqueMAC = range.find((mac) => !macs.has(mac));
|
|
34
|
+
if (uniqueMAC)
|
|
35
|
+
macs.add(uniqueMAC);
|
|
36
|
+
return uniqueMAC ?? null;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=macAddressGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"macAddressGenerator.js","sourceRoot":"","sources":["../../generator/macAddressGenerator.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,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AAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACtD,IAAI,SAAS;YAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,SAAS,IAAI,IAAI,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export { TreeSelection, } from "./foundation/utils.js";
|
|
2
|
+
export { updateBay } from "./tBay/updateBay.js";
|
|
3
|
+
export { updateVoltageLevel } from "./tVoltageLevel/updateVoltageLevel.js";
|
|
4
|
+
export { updateSubstation } from "./tSubstation/updateSubstation.js";
|
|
5
|
+
export { removeProcessElement } from "./tSubstation/removeProcessElement.js";
|
|
6
|
+
export { updateLnType } from "./tSubstation/updateLnType.js";
|
|
7
|
+
export { InsertIedOptions, insertIed } from "./tIED/insertIED.js";
|
|
8
|
+
export { updateIED } from "./tIED/updateIED.js";
|
|
9
|
+
export { removeIED } from "./tIED/removeIED.js";
|
|
10
|
+
export { findControlBlockSubscription } from "./tControl/findControlSubscription.js";
|
|
11
|
+
export { controlBlockObjRef } from "./tControl/controlBlockObjRef.js";
|
|
12
|
+
export { controlBlockGseOrSmv } from "./tControl/controlBlockGseOrSmv.js";
|
|
13
|
+
export { removeControlBlock } from "./tControl/removeControlBlock.js";
|
|
14
|
+
export { CreateReportControlOptions } from "./tReportControl/createReportControl.js";
|
|
15
|
+
export { updateReportControl } from "./tReportControl/updateReportControl.js";
|
|
16
|
+
export { createReportControl } from "./tReportControl/createReportControl.js";
|
|
17
|
+
export { createGSEControl } from "./tGSEControl/createGSEControl.js";
|
|
18
|
+
export { updateGSEControl } from "./tGSEControl/updateGSEControl.js";
|
|
19
|
+
export { changeGSEContent, ChangeGSEContentOptions, } from "./tGSE/changeGSEContent.js";
|
|
20
|
+
export { createGSE } from "./tGSE/createGSE.js";
|
|
21
|
+
export { CreateSampledValueControlOptions, createSampledValueControl, } from "./tSampledValueControl/createSampledValueControl.js";
|
|
22
|
+
export { updateSampledValueControl } from "./tSampledValueControl/updateSampledValueControl.js";
|
|
23
|
+
export { ChangeGseOrSmvAddressOptions } from "./tAddress/changeGseOrSmvAddress.js";
|
|
24
|
+
export { changeSMVContent } from "./tSMV/changeSMVContent.js";
|
|
25
|
+
export { createSMV } from "./tSMV/createSMV.js";
|
|
26
|
+
export { CreateDataSetOptions, createDataSet, } from "./tDataSet/createDataSet.js";
|
|
27
|
+
export { removeDataSet } from "./tDataSet/removeDataSet.js";
|
|
28
|
+
export { updateDataSet } from "./tDataSet/updateDataSet.js";
|
|
29
|
+
export { removeFCDA } from "./tFCDA/removeFCDA.js";
|
|
30
|
+
export { macAddressGenerator } from "./generator/macAddressGenerator.js";
|
|
31
|
+
export { appIdGenerator } from "./generator/appIdGenerator.js";
|
|
32
|
+
export { lnInstGenerator } from "./generator/lnInstGenerator.js";
|
|
33
|
+
export { matchDataAttributes } from "./tExtRef/matchDataAttributes.js";
|
|
34
|
+
export { matchSrcAttributes } from "./tExtRef/matchSrcAttributes.js";
|
|
35
|
+
export { UnsubscribeOptions } from "./tExtRef/unsubscribe.js";
|
|
36
|
+
export { unsubscribe } from "./tExtRef/unsubscribe.js";
|
|
37
|
+
export { Connection } from "./tExtRef/subscribe.js";
|
|
38
|
+
export { SubscribeOptions } from "./tExtRef/subscribe.js";
|
|
39
|
+
export { subscribe } from "./tExtRef/subscribe.js";
|
|
40
|
+
export { extRefTypeRestrictions } from "./tExtRef/extRefTypeRestrictions.js";
|
|
41
|
+
export { DoesFcdaMeetExtRefRestrictionsOptions, doesFcdaMeetExtRefRestrictions, } from "./tExtRef/doesFcdaMeetExtRefRestrictions.js";
|
|
42
|
+
export { sourceControlBlock } from "./tExtRef/sourceControlBlock.js";
|
|
43
|
+
export { isSubscribed } from "./tExtRef/isSubscribed.js";
|
|
44
|
+
export { LNodeDescription, NameSpaceDescription, nsdToJson, } from "./tDataTypeTemplates/nsdToJson.js";
|
|
45
|
+
export { insertSelectedLNodeType } from "./tDataTypeTemplates/insertSelectedLNodeType.js";
|
|
46
|
+
export { removeDataType, RemoveDataTypeOptions } from "./tDataTypeTemplates/removeDataType.js";
|
|
47
|
+
export { importLNodeType } from "./tDataTypeTemplates/importLNodeType.js";
|
|
48
|
+
export { updateLNodeType } from "./tDataTypeTemplates/updateLNodeType.js";
|
|
49
|
+
export { lNodeTypeToSelection } from "./tDataTypeTemplates/lNodeTypeToSelection.js";
|
|
50
|
+
export { Supervision, SupervisionOptions, } from "./tLN/supervision/foundation.js";
|
|
51
|
+
export { canInstantiateSubscriptionSupervision } from "./tLN/supervision/canInstantiateSubscriptionSupervision.js";
|
|
52
|
+
export { instantiateSubscriptionSupervision } from "./tLN/supervision/instantiateSubscriptionSupervision.js";
|
|
53
|
+
export { insertSubscriptionSupervisions } from "./tLN/supervision/insertSubscriptionSupervisions.js";
|
|
54
|
+
export { removeSupervisionOptions, removeSupervision, } from "./tLN/supervision/removeSupervision.js";
|
|
55
|
+
export { maxAttributes, canAddFCDA } from "./tFCDA/canAddFCDA.js";
|
|
56
|
+
export { fcdaBaseTypes } from "./tFCDA/fcdaBaseTypes.js";
|
|
57
|
+
export { find } from "./tBaseElement/find.js";
|
|
58
|
+
export { getReference } from "./tBaseElement/getReference.js";
|
|
59
|
+
export { getChildren } from "./tBaseElement/getChildren.js";
|
|
60
|
+
export { identity } from "./tBaseElement/identity.js";
|
|
61
|
+
export { isPublic } from "./tBaseElement/isPublic.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export { updateBay } from "./tBay/updateBay.js";
|
|
2
|
+
export { updateVoltageLevel } from "./tVoltageLevel/updateVoltageLevel.js";
|
|
3
|
+
export { updateSubstation } from "./tSubstation/updateSubstation.js";
|
|
4
|
+
export { removeProcessElement } from "./tSubstation/removeProcessElement.js";
|
|
5
|
+
export { updateLnType } from "./tSubstation/updateLnType.js";
|
|
6
|
+
export { insertIed } from "./tIED/insertIED.js";
|
|
7
|
+
export { updateIED } from "./tIED/updateIED.js";
|
|
8
|
+
export { removeIED } from "./tIED/removeIED.js";
|
|
9
|
+
export { findControlBlockSubscription } from "./tControl/findControlSubscription.js";
|
|
10
|
+
export { controlBlockObjRef } from "./tControl/controlBlockObjRef.js";
|
|
11
|
+
export { controlBlockGseOrSmv } from "./tControl/controlBlockGseOrSmv.js";
|
|
12
|
+
export { removeControlBlock } from "./tControl/removeControlBlock.js";
|
|
13
|
+
export { updateReportControl } from "./tReportControl/updateReportControl.js";
|
|
14
|
+
export { createReportControl } from "./tReportControl/createReportControl.js";
|
|
15
|
+
export { createGSEControl } from "./tGSEControl/createGSEControl.js";
|
|
16
|
+
export { updateGSEControl } from "./tGSEControl/updateGSEControl.js";
|
|
17
|
+
export { changeGSEContent, } from "./tGSE/changeGSEContent.js";
|
|
18
|
+
export { createGSE } from "./tGSE/createGSE.js";
|
|
19
|
+
export { createSampledValueControl, } from "./tSampledValueControl/createSampledValueControl.js";
|
|
20
|
+
export { updateSampledValueControl } from "./tSampledValueControl/updateSampledValueControl.js";
|
|
21
|
+
export { changeSMVContent } from "./tSMV/changeSMVContent.js";
|
|
22
|
+
export { createSMV } from "./tSMV/createSMV.js";
|
|
23
|
+
export { createDataSet, } from "./tDataSet/createDataSet.js";
|
|
24
|
+
export { removeDataSet } from "./tDataSet/removeDataSet.js";
|
|
25
|
+
export { updateDataSet } from "./tDataSet/updateDataSet.js";
|
|
26
|
+
export { removeFCDA } from "./tFCDA/removeFCDA.js";
|
|
27
|
+
export { macAddressGenerator } from "./generator/macAddressGenerator.js";
|
|
28
|
+
export { appIdGenerator } from "./generator/appIdGenerator.js";
|
|
29
|
+
export { lnInstGenerator } from "./generator/lnInstGenerator.js";
|
|
30
|
+
export { matchDataAttributes } from "./tExtRef/matchDataAttributes.js";
|
|
31
|
+
export { matchSrcAttributes } from "./tExtRef/matchSrcAttributes.js";
|
|
32
|
+
export { unsubscribe } from "./tExtRef/unsubscribe.js";
|
|
33
|
+
export { subscribe } from "./tExtRef/subscribe.js";
|
|
34
|
+
export { extRefTypeRestrictions } from "./tExtRef/extRefTypeRestrictions.js";
|
|
35
|
+
export { doesFcdaMeetExtRefRestrictions, } from "./tExtRef/doesFcdaMeetExtRefRestrictions.js";
|
|
36
|
+
export { sourceControlBlock } from "./tExtRef/sourceControlBlock.js";
|
|
37
|
+
export { isSubscribed } from "./tExtRef/isSubscribed.js";
|
|
38
|
+
export { nsdToJson, } from "./tDataTypeTemplates/nsdToJson.js";
|
|
39
|
+
export { insertSelectedLNodeType } from "./tDataTypeTemplates/insertSelectedLNodeType.js";
|
|
40
|
+
export { removeDataType } from "./tDataTypeTemplates/removeDataType.js";
|
|
41
|
+
export { importLNodeType } from "./tDataTypeTemplates/importLNodeType.js";
|
|
42
|
+
export { updateLNodeType } from "./tDataTypeTemplates/updateLNodeType.js";
|
|
43
|
+
export { lNodeTypeToSelection } from "./tDataTypeTemplates/lNodeTypeToSelection.js";
|
|
44
|
+
export { canInstantiateSubscriptionSupervision } from "./tLN/supervision/canInstantiateSubscriptionSupervision.js";
|
|
45
|
+
export { instantiateSubscriptionSupervision } from "./tLN/supervision/instantiateSubscriptionSupervision.js";
|
|
46
|
+
export { insertSubscriptionSupervisions } from "./tLN/supervision/insertSubscriptionSupervisions.js";
|
|
47
|
+
export { removeSupervision, } from "./tLN/supervision/removeSupervision.js";
|
|
48
|
+
export { maxAttributes, canAddFCDA } from "./tFCDA/canAddFCDA.js";
|
|
49
|
+
export { fcdaBaseTypes } from "./tFCDA/fcdaBaseTypes.js";
|
|
50
|
+
export { find } from "./tBaseElement/find.js";
|
|
51
|
+
export { getReference } from "./tBaseElement/getReference.js";
|
|
52
|
+
export { getChildren } from "./tBaseElement/getChildren.js";
|
|
53
|
+
export { identity } from "./tBaseElement/identity.js";
|
|
54
|
+
export { isPublic } from "./tBaseElement/isPublic.js";
|
|
55
|
+
//# sourceMapp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,CAAC;AAC7G,OAAO,EAAE,8BAA8B,EAAE,MAAM,qDAAqD,CAAC;AACrG,OAAO,EAEL,iBAAiB,GAClB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Insert, Remove } from "@openscd/oscd-api";
|
|
2
|
+
export type ChangeGseOrSmvAddressOptions = {
|
|
3
|
+
/** MAC-Address within `P` element in the `GSE` or `SMV` element */
|
|
4
|
+
mac?: string;
|
|
5
|
+
/** APPID within `P` element in the `GSE` or `SMV` element */
|
|
6
|
+
appId?: string;
|
|
7
|
+
/** VLAN-ID within `P` element in the `GSE` or `SMV` element */
|
|
8
|
+
vlanId?: string;
|
|
9
|
+
/** VLAN-PRIORITY within `P` element in the `GSE` or `SMV` element */
|
|
10
|
+
vlanPriority?: string;
|
|
11
|
+
/** Whether xsi:type attributes shall be set */
|
|
12
|
+
instType?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function changeGseOrSmvAddress(gseOrSmv: Element, options: ChangeGseOrSmvAddressOptions): (Insert | Remove)[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createElement } from "../foundation/utils.js";
|
|
2
|
+
import { getReference } from "../tBaseElement/getReference.js";
|
|
3
|
+
export function changeGseOrSmvAddress(gseOrSmv, options) {
|
|
4
|
+
const edits = [];
|
|
5
|
+
const newAddress = createElement(gseOrSmv.ownerDocument, "Address", {});
|
|
6
|
+
const attributes = {};
|
|
7
|
+
if (options.mac)
|
|
8
|
+
attributes["MAC-Address"] = options.mac;
|
|
9
|
+
if (options.appId)
|
|
10
|
+
attributes.APPID = options.appId;
|
|
11
|
+
if (options.vlanId)
|
|
12
|
+
attributes["VLAN-ID"] = options.vlanId;
|
|
13
|
+
if (options.vlanPriority)
|
|
14
|
+
attributes["VLAN-PRIORITY"] = options.vlanPriority;
|
|
15
|
+
Object.entries(attributes)
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
|
+
.filter(([_, value]) => value !== null)
|
|
18
|
+
.forEach(([type, value]) => {
|
|
19
|
+
const child = createElement(gseOrSmv.ownerDocument, "P", { type });
|
|
20
|
+
if (options.instType === undefined) {
|
|
21
|
+
// take over old xsi:type
|
|
22
|
+
const existXsiType = gseOrSmv
|
|
23
|
+
.querySelector(`:scope > Address > P[type="${type}"]`)
|
|
24
|
+
?.hasAttribute("xsi:type");
|
|
25
|
+
if (existXsiType)
|
|
26
|
+
child.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:type", `tP_${type}`);
|
|
27
|
+
}
|
|
28
|
+
else if (options.instType)
|
|
29
|
+
child.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:type", `tP_${type}`);
|
|
30
|
+
child.textContent = value;
|
|
31
|
+
newAddress.appendChild(child);
|
|
32
|
+
});
|
|
33
|
+
edits.push({
|
|
34
|
+
parent: gseOrSmv,
|
|
35
|
+
node: newAddress,
|
|
36
|
+
reference: getReference(gseOrSmv, "Address"),
|
|
37
|
+
});
|
|
38
|
+
const oldAddress = gseOrSmv.querySelector("Address");
|
|
39
|
+
if (oldAddress)
|
|
40
|
+
edits.push({ node: oldAddress });
|
|
41
|
+
return edits;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=changeGseOrSmvAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeGseOrS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CAAC,UAAU,CAAC,CAAC;YAE7B,IAAI,YAAY;gBACd,KAAK,CAAC,cAAc,CAClB,2CAA2C,EAC3C,UAAU,EACV,MAAM,IAAI,EAAE,CACb,CAAC;SACL;aAAM,IAAI,OAAO,CAAC,QAAQ;YACzB,KAAK,CAAC,cAAc,CAClB,2CAA2C,EAC3C,UAAU,EACV,MAAM,IAAI,EAAE,CACb,CAAC;QAEJ,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;QAC1B,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEL,KAAK,CAAC,IAAI,CAAC;QACT,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC;KAC7C,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACrD,IAAI,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IAEjD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SCLTag } from "./tags.js";
|
|
2
|
+
export declare const voidSelector = ":not(*)";
|
|
3
|
+
type SelectorFunction = (tagName: SCLTag, identity: string) => string;
|
|
4
|
+
export declare const selectorTags: Record<SCLTag, SelectorFunction>;
|
|
5
|
+
export declare function find(root: XMLDocument | Element | DocumentFragment, tagName: string, identity: string | number): Element | null;
|
|
6
|
+
export {};
|