@attraccess/plugin-wago 0.1.0-nightly.951.1 → 0.1.0-nightly.952.1

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51671,6 +51671,13 @@ var CONFIGURATION_CAPABILITY = `configuration-v${CONFIGURATION_PROTOCOL_VERSION}
51671
51671
  var REQUIRED_CAPABILITIES = ["claim", "heartbeat", CONFIGURATION_CAPABILITY];
51672
51672
  var SUPPORTED_PROTOCOL_MAJOR = 1;
51673
51673
  function parseAnnouncement(payload) {
51674
+ const heartbeat = parseHeartbeat(payload);
51675
+ const input = JSON.parse(payload.toString("utf8"));
51676
+ if (typeof input.pairingCode !== "string" || !input.pairingCode.trim())
51677
+ throw new Error("announcement pairingCode is required");
51678
+ return { ...heartbeat, pairingCode: input.pairingCode.trim() };
51679
+ }
51680
+ function parseHeartbeat(payload) {
51674
51681
  let value;
51675
51682
  try {
51676
51683
  value = JSON.parse(payload.toString("utf8"));
@@ -51679,7 +51686,7 @@ function parseAnnouncement(payload) {
51679
51686
  }
51680
51687
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("announcement must be an object");
51681
51688
  const input = value;
51682
- const required = ["hardwareId", "pairingCode", "protocolVersion", "runtimeVersion"];
51689
+ const required = ["hardwareId", "protocolVersion", "runtimeVersion"];
51683
51690
  for (const key of required)
51684
51691
  if (typeof input[key] !== "string" || !input[key].trim()) throw new Error(`announcement ${key} is required`);
51685
51692
  if (!Array.isArray(input.capabilities) || input.capabilities.some((item) => typeof item !== "string"))
@@ -51688,7 +51695,6 @@ function parseAnnouncement(payload) {
51688
51695
  throw new Error("announcement sequence must be a non-negative integer");
51689
51696
  return {
51690
51697
  hardwareId: input.hardwareId.trim(),
51691
- pairingCode: input.pairingCode.trim(),
51692
51698
  enrollmentSecret: typeof input.enrollmentSecret === "string" ? input.enrollmentSecret.trim() : void 0,
51693
51699
  fingerprint: typeof input.fingerprint === "string" ? input.fingerprint.trim() : void 0,
51694
51700
  protocolVersion: input.protocolVersion.trim(),
@@ -53429,7 +53435,7 @@ var WagoService = class {
53429
53435
  async onHeartbeat(hardwareId, payload) {
53430
53436
  let heartbeat;
53431
53437
  try {
53432
- heartbeat = parseAnnouncement(payload);
53438
+ heartbeat = parseHeartbeat(payload);
53433
53439
  } catch (error) {
53434
53440
  this.context.logger.warn(
53435
53441
  `Ignoring invalid WAGO heartbeat: ${error instanceof Error ? error.message : String(error)}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attraccess/plugin-wago",
3
- "version": "0.1.0-nightly.951.1",
3
+ "version": "0.1.0-nightly.952.1",
4
4
  "description": "Official Attraccess integration for WAGO CC100 controllers.",
5
5
  "keywords": [
6
6
  "attraccess-plugin",