node-opcua-status-code 2.52.0 → 2.62.7
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/_generated_status_codes.js +1245 -250
- package/dist/_generated_status_codes.js.map +1 -1
- package/dist/opcua_status_code.d.ts +5 -3
- package/dist/opcua_status_code.js +3 -4
- package/dist/opcua_status_code.js.map +1 -1
- package/package.json +7 -5
- package/source/_generated_status_codes.ts +1521 -504
- package/source/opcua_status_code.ts +11 -12
|
@@ -9,7 +9,7 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
|
9
9
|
function warnLog(...args: [any?, ...any[]]) {
|
|
10
10
|
/* istanbul ignore next */
|
|
11
11
|
// tslint:disable-next-line:no-console
|
|
12
|
-
console.warn
|
|
12
|
+
console.warn(...args);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -237,7 +237,7 @@ Object.defineProperty(ConstantStatusCode.prototype, "value", { enumerable: true
|
|
|
237
237
|
Object.defineProperty(ConstantStatusCode.prototype, "description", { enumerable: true });
|
|
238
238
|
Object.defineProperty(ConstantStatusCode.prototype, "name", { enumerable: true });
|
|
239
239
|
|
|
240
|
-
export function encodeStatusCode(statusCode: StatusCode | ConstantStatusCode, stream: OutputBinaryStream) {
|
|
240
|
+
export function encodeStatusCode(statusCode: StatusCode | ConstantStatusCode, stream: OutputBinaryStream): void {
|
|
241
241
|
stream.writeUInt32(statusCode.value);
|
|
242
242
|
}
|
|
243
243
|
|
|
@@ -249,7 +249,7 @@ const statusCodesReversedMap: any = {};
|
|
|
249
249
|
* @note: if code is not known , then StatusCodes.Bad will be returned
|
|
250
250
|
* @param code
|
|
251
251
|
*/
|
|
252
|
-
export function getStatusCodeFromCode(code: number) {
|
|
252
|
+
export function getStatusCodeFromCode(code: number): StatusCode {
|
|
253
253
|
const codeWithoutInfoBits = (code & 0xffff0000) >>> 0;
|
|
254
254
|
const infoBits = code & 0x0000ffff;
|
|
255
255
|
let sc = statusCodesReversedMap[codeWithoutInfoBits];
|
|
@@ -272,7 +272,7 @@ export function getStatusCodeFromCode(code: number) {
|
|
|
272
272
|
return sc;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
export function decodeStatusCode(stream: BinaryStream, _value?: StatusCode) {
|
|
275
|
+
export function decodeStatusCode(stream: BinaryStream, _value?: StatusCode): StatusCode {
|
|
276
276
|
const code = stream.readUInt32();
|
|
277
277
|
return getStatusCodeFromCode(code);
|
|
278
278
|
}
|
|
@@ -291,15 +291,15 @@ export class ModifiableStatusCode extends StatusCode {
|
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
public get value() {
|
|
294
|
+
public get value(): number {
|
|
295
295
|
return this._base.value + this._extraBits;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
public get name() {
|
|
298
|
+
public get name(): string {
|
|
299
299
|
return this._base.name + this._getExtraName();
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
public get description() {
|
|
302
|
+
public get description(): string {
|
|
303
303
|
return this._base.description;
|
|
304
304
|
}
|
|
305
305
|
|
|
@@ -344,10 +344,9 @@ export class ModifiableStatusCode extends StatusCode {
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
private _getExtraName() {
|
|
347
|
-
const self = this;
|
|
348
347
|
const str: string[] = [];
|
|
349
348
|
for (const [key, value] of Object.entries(extraStatusCodeBits)) {
|
|
350
|
-
if ((
|
|
349
|
+
if ((this._extraBits & value) === value) {
|
|
351
350
|
str.push(key);
|
|
352
351
|
}
|
|
353
352
|
}
|
|
@@ -367,12 +366,12 @@ Object.defineProperty(ModifiableStatusCode.prototype, "_extraBits", { enumerable
|
|
|
367
366
|
import { StatusCodes } from "./_generated_status_codes";
|
|
368
367
|
export { StatusCodes } from "./_generated_status_codes";
|
|
369
368
|
|
|
370
|
-
export function coerceStatusCode(statusCode:
|
|
369
|
+
export function coerceStatusCode(statusCode: StatusCode | number | string | { value: number }): StatusCode {
|
|
371
370
|
if (statusCode instanceof StatusCode) {
|
|
372
371
|
return statusCode;
|
|
373
372
|
}
|
|
374
|
-
if (
|
|
375
|
-
return getStatusCodeFromCode(statusCode.value);
|
|
373
|
+
if (Object.prototype.hasOwnProperty.call(statusCode, "value")) {
|
|
374
|
+
return getStatusCodeFromCode((statusCode as { value: number }).value);
|
|
376
375
|
}
|
|
377
376
|
if (typeof statusCode === "number") {
|
|
378
377
|
return getStatusCodeFromCode(statusCode);
|