Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// A Server may not expose the SamplingIntervalDiagnosticsArray if it does not use fixed sampling rates.
// because we are not using fixed sampling rate, we need to remove the optional SamplingIntervalDiagnosticsArray
// component
const samplingIntervalDiagnosticsArray =
serverDiagnostics.getComponentByName("SamplingIntervalDiagnosticsArray");
if (samplingIntervalDiagnosticsArray) {
addressSpace.deleteNode(samplingIntervalDiagnosticsArray);
const s = serverDiagnostics.getComponents();
// xx console.log(s.map((x) => x.browseName.toString()).join(" "));
}
const subscriptionDiagnosticsArray =
serverDiagnostics.getComponentByName("SubscriptionDiagnosticsArray")! as
UADynamicVariableArray;
assert(subscriptionDiagnosticsArray.nodeClass === NodeClass.Variable);
bindExtObjArrayNode(subscriptionDiagnosticsArray,
"SubscriptionDiagnosticsType", "subscriptionId");
const sessionsDiagnosticsSummary = serverDiagnostics.getComponentByName("SessionsDiagnosticsSummary")!;
const sessionDiagnosticsArray =
sessionsDiagnosticsSummary.getComponentByName("SessionDiagnosticsArray")! as
UADynamicVariableArray;
assert(sessionDiagnosticsArray.nodeClass === NodeClass.Variable);
bindExtObjArrayNode(sessionDiagnosticsArray, "SessionDiagnosticsVariableType", "sessionId");
const varType = addressSpace.findVariableType("SessionSecurityDiagnosticsType");
if (!varType) {
console.log("Warning cannot find SessionSecurityDiagnosticsType variable Type");
} else {
const sessionSecurityDiagnosticsArray =
return;
}
// create SessionsDiagnosticsSummary
const serverDiagnostics = server.getComponentByName("ServerDiagnostics");
if (!serverDiagnostics) {
return;
}
const subscriptionDiagnosticsArray = serverDiagnostics.getComponentByName("SubscriptionDiagnosticsArray");
assert(subscriptionDiagnosticsArray instanceof UAVariable);
eoan.bindExtObjArrayNode(subscriptionDiagnosticsArray, "SubscriptionDiagnosticsType", "subscriptionId");
const sessionDiagnosticsArray = serverDiagnostics.getComponentByName("SessionsDiagnosticsSummary").getComponentByName("SessionDiagnosticsArray");
assert(sessionDiagnosticsArray instanceof UAVariable);
eoan.bindExtObjArrayNode(sessionDiagnosticsArray, "SessionDiagnosticsVariableType", "sessionId");
}
}
const server = addressSpace.rootFolder.objects.server;
if (!server) {
return;
}
// create SessionsDiagnosticsSummary
const serverDiagnostics = server.getComponentByName("ServerDiagnostics");
if (!serverDiagnostics) {
return;
}
const subscriptionDiagnosticsArray = serverDiagnostics.getComponentByName("SubscriptionDiagnosticsArray");
assert(subscriptionDiagnosticsArray instanceof UAVariable);
eoan.bindExtObjArrayNode(subscriptionDiagnosticsArray, "SubscriptionDiagnosticsType", "subscriptionId");
const sessionDiagnosticsArray = serverDiagnostics.getComponentByName("SessionsDiagnosticsSummary").getComponentByName("SessionDiagnosticsArray");
assert(sessionDiagnosticsArray instanceof UAVariable);
eoan.bindExtObjArrayNode(sessionDiagnosticsArray, "SessionDiagnosticsVariableType", "sessionId");
}
const subscriptionDiagnosticsArray =
serverDiagnostics.getComponentByName("SubscriptionDiagnosticsArray")! as
UADynamicVariableArray;
assert(subscriptionDiagnosticsArray.nodeClass === NodeClass.Variable);
bindExtObjArrayNode(subscriptionDiagnosticsArray,
"SubscriptionDiagnosticsType", "subscriptionId");
const sessionsDiagnosticsSummary = serverDiagnostics.getComponentByName("SessionsDiagnosticsSummary")!;
const sessionDiagnosticsArray =
sessionsDiagnosticsSummary.getComponentByName("SessionDiagnosticsArray")! as
UADynamicVariableArray;
assert(sessionDiagnosticsArray.nodeClass === NodeClass.Variable);
bindExtObjArrayNode(sessionDiagnosticsArray, "SessionDiagnosticsVariableType", "sessionId");
const varType = addressSpace.findVariableType("SessionSecurityDiagnosticsType");
if (!varType) {
console.log("Warning cannot find SessionSecurityDiagnosticsType variable Type");
} else {
const sessionSecurityDiagnosticsArray =
sessionsDiagnosticsSummary.getComponentByName("SessionSecurityDiagnosticsArray")! as
UADynamicVariableArray;
assert(sessionSecurityDiagnosticsArray.nodeClass === NodeClass.Variable);
bindExtObjArrayNode(sessionSecurityDiagnosticsArray, "SessionSecurityDiagnosticsType", "sessionId");
ensureObjectIsSecure(sessionSecurityDiagnosticsArray);
}
}
const sessionDiagnosticsArray =
sessionsDiagnosticsSummary.getComponentByName("SessionDiagnosticsArray")! as
UADynamicVariableArray;
assert(sessionDiagnosticsArray.nodeClass === NodeClass.Variable);
bindExtObjArrayNode(sessionDiagnosticsArray, "SessionDiagnosticsVariableType", "sessionId");
const varType = addressSpace.findVariableType("SessionSecurityDiagnosticsType");
if (!varType) {
console.log("Warning cannot find SessionSecurityDiagnosticsType variable Type");
} else {
const sessionSecurityDiagnosticsArray =
sessionsDiagnosticsSummary.getComponentByName("SessionSecurityDiagnosticsArray")! as
UADynamicVariableArray;
assert(sessionSecurityDiagnosticsArray.nodeClass === NodeClass.Variable);
bindExtObjArrayNode(sessionSecurityDiagnosticsArray, "SessionSecurityDiagnosticsType", "sessionId");
ensureObjectIsSecure(sessionSecurityDiagnosticsArray);
}
}