Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// and sessionDiagnostics.currentSubscriptionsCount ( with an s)
assert(this.serverDiagnosticsSummary.hasOwnProperty("currentSubscriptionCount"));
(this.serverDiagnosticsSummary as any).__defineGetter__("currentSubscriptionCount", () => {
// currentSubscriptionCount returns the total number of subscriptions
// that are currently active on all sessions
let counter = 0;
_.values(this._sessions).forEach((session: ServerSession) => {
counter += session.currentSubscriptionCount;
});
return counter;
});
this.status = "creating";
this.setServerState(ServerState.NoConfiguration);
this.addressSpace = null;
this._shutdownTask = [];
this._applicationUri = "";
if (typeof options.applicationUri === "function") {
(this as any).__defineGetter__("_applicationUri", options.applicationUri);
} else {
this._applicationUri = options.applicationUri || "";
}
options.serverDiagnosticsEnabled = options.hasOwnProperty("serverDiagnosticsEnable")
? options.serverDiagnosticsEnabled : true;
this.serverDiagnosticsEnabled = options.serverDiagnosticsEnabled!;
EventEmitter.apply(this, arguments);
const engine = this;
ServerEngine.registry.register(engine);
engine._sessions = {};
engine._closedSessions = {};
engine._orphanPublishEngine = null; // will be constructed on demand
engine.isAuditing = _.isBoolean(options.isAuditing) ? options.isAuditing : false;
options.buildInfo.buildDate = options.buildInfo.buildDate || new Date();
// ---------------------------------------------------- ServerStatus
engine.serverStatus = new ServerStatus({
startTime: new Date(),
currentTime: new Date(),
state: ServerState.NoConfiguration,
buildInfo: options.buildInfo,
secondsTillShutdown: 0,
shutdownReason: {text: ""}
});
// --------------------------------------------------- ServerCapabilities
options.serverCapabilities = options.serverCapabilities || {};
options.serverCapabilities.serverProfileArray = options.serverCapabilities.serverProfileArray || [
"Standard UA Server Profile",
"Embedded UA Server Profile",
"Micro Embedded Device Server Profile",
"Nano Embedded Device Server Profile"
];
options.serverCapabilities.localeIdArray = options.serverCapabilities.localeIdArray || ["en-EN", "fr-FR"];
// and sessionDiagnostics.currentSubscriptionsCount ( with an s)
assert(engine.serverDiagnosticsSummary.hasOwnProperty("currentSubscriptionCount"));
engine.serverDiagnosticsSummary.__defineGetter__("currentSubscriptionCount", function () {
// currentSubscriptionCount returns the total number of subscriptions
// that are currently active on all sessions
let counter = 0;
_.values(engine._sessions).forEach(function (session) {
counter += session.currentSubscriptionCount;
});
return counter;
});
engine.status = "creating";
engine.setServerState(ServerState.NoConfiguration);
engine.addressSpace = null;
engine._shutdownTask = [];
engine._applicationUri = options.applicationUri || "";
options.serverDiagnosticsEnabled = options.hasOwnProperty("serverDiagnosticsEnable")
? options.serverDiagnosticsEnabled : true;
engine.serverDiagnosticsEnabled = options.serverDiagnosticsEnabled;
}
this._sessions = {};
this._closedSessions = {};
this._orphanPublishEngine = undefined; // will be constructed on demand
this.isAuditing = _.isBoolean(options.isAuditing) ? options.isAuditing : false;
options.buildInfo.buildDate = options.buildInfo.buildDate || new Date();
// ---------------------------------------------------- ServerStatusDataType
this.serverStatus = new ServerStatusDataType({
buildInfo: options.buildInfo,
currentTime: new Date(),
secondsTillShutdown: 0,
shutdownReason: { text: "" },
startTime: new Date(),
state: ServerState.NoConfiguration
});
// --------------------------------------------------- ServerCapabilities
options.serverCapabilities = options.serverCapabilities || {};
options.serverCapabilities.serverProfileArray = options.serverCapabilities.serverProfileArray || [
"Standard UA Server Profile",
"Embedded UA Server Profile",
"Micro Embedded Device Server Profile",
"Nano Embedded Device Server Profile"
];
options.serverCapabilities.localeIdArray = options.serverCapabilities.localeIdArray || ["en-EN", "fr-FR"];
this.serverCapabilities = new ServerCapabilities(options.serverCapabilities);
// to do when spec is clear about what goes here!
// spec 1.04 says (in Part 4 7.33 SignedSoftwareCertificate