opcjs-base 0.1.18-alpha → 0.1.20-alpha

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/index.cjs CHANGED
@@ -1368,6 +1368,32 @@ var StatusCode = /* @__PURE__ */ ((StatusCode2) => {
1368
1368
  StatusCode2[StatusCode2["BadMaxConnectionsReached"] = 2159476736] = "BadMaxConnectionsReached";
1369
1369
  return StatusCode2;
1370
1370
  })(StatusCode || {});
1371
+ function StatusCodeToString(statusCode) {
1372
+ if (statusCode === void 0) {
1373
+ return "Unknown";
1374
+ }
1375
+ const baseCode = statusCode & 4294901760;
1376
+ const name = Object.entries(StatusCode).find(([, v]) => v === baseCode)?.[0];
1377
+ return name ?? `0x${baseCode.toString(16).toUpperCase().padStart(8, "0")}`;
1378
+ }
1379
+ function StatusCodeToStringNumber(statusCode) {
1380
+ if (statusCode === void 0) {
1381
+ return "0xUNKNOWN";
1382
+ }
1383
+ return `0x${statusCode.toString(16).toUpperCase().padStart(8, "0")}`;
1384
+ }
1385
+ function StatusCodeGetFlagBits(statusCode) {
1386
+ const flagBits = (statusCode ?? 0) & 65535;
1387
+ const limitBits = flagBits >> 9 & 3;
1388
+ return {
1389
+ StructureChanged: (flagBits & 32768) !== 0,
1390
+ SemanticsChanged: (flagBits & 16384) !== 0,
1391
+ Overflow: (flagBits & 2048) !== 0,
1392
+ LimitLow: limitBits === 1,
1393
+ LimitHigh: limitBits === 2,
1394
+ LimitConstant: limitBits === 3
1395
+ };
1396
+ }
1371
1397
 
1372
1398
  // src/types/dataValue.ts
1373
1399
  var DataValue = class _DataValue {
@@ -17503,6 +17529,7 @@ var SecureChannelFacade = class {
17503
17529
  const response = value.body;
17504
17530
  if (response instanceof ServiceFault) {
17505
17531
  this.pending.failAll(
17532
+ // todo: create a human readable error message based on the ServiceFault content
17506
17533
  new Error(`ServiceFault: ${JSON.stringify(response)}`)
17507
17534
  );
17508
17535
  } else {
@@ -18183,6 +18210,9 @@ exports.StandaloneSubscribedDataSetDataType = StandaloneSubscribedDataSetDataTyp
18183
18210
  exports.StandaloneSubscribedDataSetRefDataType = StandaloneSubscribedDataSetRefDataType;
18184
18211
  exports.StatusChangeNotification = StatusChangeNotification;
18185
18212
  exports.StatusCode = StatusCode;
18213
+ exports.StatusCodeGetFlagBits = StatusCodeGetFlagBits;
18214
+ exports.StatusCodeToString = StatusCodeToString;
18215
+ exports.StatusCodeToStringNumber = StatusCodeToStringNumber;
18186
18216
  exports.StatusResult = StatusResult;
18187
18217
  exports.Structure = Structure;
18188
18218
  exports.StructureDefinition = StructureDefinition;