node-red-contrib-homekit-bridged 2.0.0-dev.0 → 2.0.0-dev.10

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 (125) hide show
  1. package/build/lib/HAPHostNode.js +185 -148
  2. package/build/lib/HAPServiceNode.js +200 -177
  3. package/build/lib/HAPServiceNode2.js +208 -177
  4. package/build/lib/NRCHKBError.js +23 -2
  5. package/build/lib/PairingQRCode.js +62 -0
  6. package/build/lib/Storage.js +152 -90
  7. package/build/lib/api.js +654 -291
  8. package/build/lib/camera/CameraControl.js +125 -0
  9. package/build/lib/camera/CameraDelegate.js +507 -0
  10. package/build/lib/camera/MP4StreamingServer.js +159 -0
  11. package/build/lib/hap/HAPCharacteristic.js +25 -4
  12. package/build/lib/hap/HAPService.js +25 -4
  13. package/build/lib/hap/eve-app/EveCharacteristics.js +124 -81
  14. package/build/lib/hap/eve-app/EveServices.js +50 -17
  15. package/build/lib/hap/hap-nodejs.js +32 -0
  16. package/build/lib/migration/HomeKitService2Migration.js +34 -0
  17. package/build/lib/migration/NodeMigration.js +75 -0
  18. package/build/lib/types/AccessoryInformationType.js +15 -1
  19. package/build/lib/types/CameraConfigType.js +15 -1
  20. package/build/lib/types/CustomCharacteristicType.js +15 -1
  21. package/build/lib/types/HAPHostConfigType.js +15 -1
  22. package/build/lib/types/HAPHostNodeType.js +15 -1
  23. package/build/lib/types/HAPService2ConfigType.js +15 -1
  24. package/build/lib/types/HAPService2NodeType.js +15 -1
  25. package/build/lib/types/HAPServiceConfigType.js +15 -1
  26. package/build/lib/types/HAPServiceNodeType.js +15 -1
  27. package/build/lib/types/HAPStatusConfigType.js +15 -1
  28. package/build/lib/types/HAPStatusNodeType.js +15 -1
  29. package/build/lib/types/HostType.js +28 -7
  30. package/build/lib/types/NodeType.js +15 -1
  31. package/build/lib/types/PublishTimersType.js +15 -1
  32. package/build/lib/types/UniFiControllerConfigType.js +16 -0
  33. package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.js +28 -7
  34. package/build/lib/types/hap-nodejs/HapCategories.js +64 -43
  35. package/build/lib/types/storage/SerializedHostType.js +15 -1
  36. package/build/lib/types/storage/StorageType.js +34 -10
  37. package/build/lib/unifi/ProtectDiscovery.js +80 -0
  38. package/build/lib/utils/AccessoryUtils.js +152 -110
  39. package/build/lib/utils/BridgeUtils.js +95 -39
  40. package/build/lib/utils/CharacteristicUtils.js +5 -49
  41. package/build/lib/utils/CharacteristicUtils2.js +5 -49
  42. package/build/lib/utils/CharacteristicUtilsBase.js +81 -0
  43. package/build/lib/utils/NodeStatusUtils.js +89 -40
  44. package/build/lib/utils/ServiceUtils.js +433 -371
  45. package/build/lib/utils/ServiceUtils2.js +519 -305
  46. package/build/lib/utils/index.js +11 -12
  47. package/build/nodes/bridge.html +206 -168
  48. package/build/nodes/bridge.js +27 -9
  49. package/build/nodes/locales/en-US/node-red-contrib-homekit-bridged.json +22 -0
  50. package/build/nodes/nrchkb.html +1753 -117
  51. package/build/nodes/nrchkb.js +66 -88
  52. package/build/nodes/plugin-instance.html +509 -0
  53. package/build/nodes/plugin-instance.js +46 -0
  54. package/build/nodes/service.html +557 -306
  55. package/build/nodes/service.js +5 -6
  56. package/build/nodes/service2.html +1735 -455
  57. package/build/nodes/service2.js +5 -8
  58. package/build/nodes/standalone.html +208 -176
  59. package/build/nodes/standalone.js +27 -9
  60. package/build/nodes/status.html +51 -18
  61. package/build/nodes/status.js +47 -41
  62. package/build/nodes/unifi-controller.html +92 -0
  63. package/build/nodes/unifi-controller.js +20 -0
  64. package/build/plugins/embedded/homebridge-camera-ffmpeg/index.js +479 -0
  65. package/build/plugins/embedded/homebridge-unifi-protect/index.js +521 -0
  66. package/build/plugins/embedded/index.js +58 -0
  67. package/build/plugins/nrchkb-homekit-plugins.js +17 -0
  68. package/build/plugins/registry/index.js +203 -0
  69. package/build/plugins/registry/types.js +16 -0
  70. package/build/scripts/migrate-homekit-service-flows.js +47 -0
  71. package/examples/demo/01 - ALL Demos single import.json +1885 -2139
  72. package/examples/demo/02 - Air Purifier.json +12 -61
  73. package/examples/demo/03 - Air Quality sensor with Battery.json +8 -36
  74. package/examples/demo/04 - Dimmable Bulb.json +4 -21
  75. package/examples/demo/05 - Color Bulb (HSV).json +5 -26
  76. package/examples/demo/06 - Fan (simple, 3 speeds).json +6 -31
  77. package/examples/demo/07 - Fan (with speed, oscillate, rotation direction).json +4 -21
  78. package/examples/demo/08 - CO2 detector.json +8 -39
  79. package/examples/demo/09 - CO (carbon monoxide) example.json +9 -44
  80. package/examples/demo/10 - Door window contact sensor.json +8 -39
  81. package/examples/demos (advanced)/01 - Television with inputs and speaker.json +19 -85
  82. package/examples/switch/01 - Plain Switch.json +179 -199
  83. package/package.json +48 -34
  84. package/build/lib/HAPHostNode.d.ts +0 -1
  85. package/build/lib/HAPServiceNode.d.ts +0 -1
  86. package/build/lib/HAPServiceNode2.d.ts +0 -1
  87. package/build/lib/NRCHKBError.d.ts +0 -3
  88. package/build/lib/Storage.d.ts +0 -30
  89. package/build/lib/api.d.ts +0 -1
  90. package/build/lib/hap/HAPCharacteristic.d.ts +0 -9
  91. package/build/lib/hap/HAPService.d.ts +0 -6
  92. package/build/lib/hap/eve-app/EveCharacteristics.d.ts +0 -20
  93. package/build/lib/hap/eve-app/EveServices.d.ts +0 -5
  94. package/build/lib/types/AccessoryInformationType.d.ts +0 -11
  95. package/build/lib/types/CameraConfigType.d.ts +0 -24
  96. package/build/lib/types/CustomCharacteristicType.d.ts +0 -6
  97. package/build/lib/types/HAPHostConfigType.d.ts +0 -22
  98. package/build/lib/types/HAPHostNodeType.d.ts +0 -14
  99. package/build/lib/types/HAPService2ConfigType.d.ts +0 -6
  100. package/build/lib/types/HAPService2NodeType.d.ts +0 -7
  101. package/build/lib/types/HAPServiceConfigType.d.ts +0 -26
  102. package/build/lib/types/HAPServiceNodeType.d.ts +0 -38
  103. package/build/lib/types/HAPStatusConfigType.d.ts +0 -5
  104. package/build/lib/types/HAPStatusNodeType.d.ts +0 -12
  105. package/build/lib/types/HostType.d.ts +0 -5
  106. package/build/lib/types/NodeType.d.ts +0 -3
  107. package/build/lib/types/PublishTimersType.d.ts +0 -4
  108. package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.d.ts +0 -5
  109. package/build/lib/types/hap-nodejs/HapCategories.d.ts +0 -41
  110. package/build/lib/types/storage/SerializedHostType.d.ts +0 -5
  111. package/build/lib/types/storage/StorageType.d.ts +0 -8
  112. package/build/lib/utils/AccessoryUtils.d.ts +0 -1
  113. package/build/lib/utils/BridgeUtils.d.ts +0 -1
  114. package/build/lib/utils/CharacteristicUtils.d.ts +0 -1
  115. package/build/lib/utils/CharacteristicUtils2.d.ts +0 -1
  116. package/build/lib/utils/NodeStatusUtils.d.ts +0 -17
  117. package/build/lib/utils/ServiceUtils.d.ts +0 -1
  118. package/build/lib/utils/ServiceUtils2.d.ts +0 -1
  119. package/build/lib/utils/index.d.ts +0 -1
  120. package/build/nodes/bridge.d.ts +0 -1
  121. package/build/nodes/nrchkb.d.ts +0 -1
  122. package/build/nodes/service.d.ts +0 -1
  123. package/build/nodes/service2.d.ts +0 -1
  124. package/build/nodes/standalone.d.ts +0 -1
  125. package/build/nodes/status.d.ts +0 -1
@@ -1,154 +1,191 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
13
15
  };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const hap_nodejs_1 = require("@homebridge/hap-nodejs");
16
- const logger_1 = require("@nrchkb/logger");
17
- const semver_1 = require("semver");
18
- const preload_1 = __importDefault(require("semver/preload"));
19
- const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
20
- const HapCategories_1 = __importDefault(require("./types/hap-nodejs/HapCategories"));
21
- const HostType_1 = __importDefault(require("./types/HostType"));
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var import_hap_nodejs = require("@homebridge/hap-nodejs");
25
+ var import_logger = require("@nrchkb/logger");
26
+ var import_semver = require("semver");
27
+ var import_preload = __toESM(require("semver/preload"));
28
+ var import_NRCHKBError = __toESM(require("./NRCHKBError"));
29
+ var import_HostType = __toESM(require("./types/HostType"));
30
+ var import_HapCategories = __toESM(require("./types/hap-nodejs/HapCategories"));
22
31
  module.exports = (RED, hostType) => {
23
- const init = function (config) {
24
- var _a, _b, _c;
25
- const self = this;
26
- const log = (0, logger_1.logger)('NRCHKB', 'HAPHostNode', config.bridgeName, self);
27
- self.hostType = hostType;
28
- RED.nodes.createNode(self, config);
29
- self.config = config;
30
- self.name = config.bridgeName;
31
- if (!hostNameValidator(config.bridgeName)) {
32
- log.error('Host name is incorrect', false);
33
- return new NRCHKBError_1.default('Host name is incorrect');
34
- }
35
- if (preload_1.default.parse(config.firmwareRev) == null) {
36
- config.firmwareRev = new semver_1.SemVer('0.0.0');
37
- }
38
- self.accessoryCategory = (self.hostType == HostType_1.default.BRIDGE
39
- ? HapCategories_1.default.BRIDGE
40
- : self.config.accessoryCategory);
41
- self.published = false;
42
- try {
43
- self.bridgeUsername = macify(self.id);
44
- }
45
- catch (error) {
46
- log.error(error);
47
- return error;
48
- }
49
- const hostUUID = hap_nodejs_1.uuid.generate(self.id);
50
- const hostTypeName = self.hostType == HostType_1.default.BRIDGE ? 'Bridge' : 'Standalone Accessory';
51
- log.debug(`Creating ${hostTypeName} with UUID ${hostUUID}`);
52
- if (self.hostType == HostType_1.default.BRIDGE) {
53
- self.host = new hap_nodejs_1.Bridge(self.name, hostUUID);
54
- }
55
- else {
56
- self.host = new hap_nodejs_1.Accessory(self.name, hostUUID);
57
- }
58
- self.publish = function () {
59
- var _a, _b;
60
- if (self.hostType == HostType_1.default.BRIDGE) {
61
- log.debug(`Publishing ${hostTypeName} with pin code ${self.config.pinCode} and ${self.host.bridgedAccessories.length} accessories`);
62
- }
63
- else {
64
- log.debug(`Publishing ${hostTypeName} with pin code ${self.config.pinCode}`);
65
- }
66
- if (self.config.port && self.config.port == 1880) {
67
- log.error(`Cannot publish on ${hostTypeName} port 1880 as it is reserved for node-red`);
68
- self.published = false;
69
- return false;
70
- }
71
- let oldPinCode = self.config.pinCode;
72
- if ((oldPinCode.match(/-/g) || []).length == 1) {
73
- oldPinCode = oldPinCode.replace(/-/g, '');
74
- oldPinCode = `${oldPinCode.slice(0, 3)}-${oldPinCode.slice(3, 5)}-${oldPinCode.slice(5, 8)}`;
75
- }
76
- let bind;
77
- if (((_a = self.config.bind) === null || _a === void 0 ? void 0 : _a.length) && self.config.bindType) {
78
- if (self.config.bindType == 'str') {
79
- bind = self.config.bind;
80
- }
81
- else if (self.config.bindType == 'json') {
82
- bind = JSON.parse(self.config.bind);
83
- }
84
- }
85
- self.host.publish({
86
- username: self.bridgeUsername,
87
- port: self.config.port && !isNaN(self.config.port)
88
- ? self.config.port
89
- : 0,
90
- pincode: oldPinCode,
91
- category: self.accessoryCategory,
92
- bind: bind,
93
- advertiser: (_b = self.config.advertiser) !== null && _b !== void 0 ? _b : "bonjour-hap",
94
- }, self.config.allowInsecureRequest);
95
- self.published = true;
96
- return true;
97
- };
98
- self.on('close', function (removed, done) {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- if (removed) {
101
- log.debug('This node has been deleted');
102
- yield self.host.destroy();
103
- }
104
- else {
105
- log.debug('This node is being restarted');
106
- yield self.host.unpublish();
107
- }
108
- self.published = false;
109
- done();
110
- });
111
- });
112
- self.host.on('identify', function (paired, callback) {
113
- if (paired) {
114
- log.debug(`Identify called on paired ${hostTypeName}`);
115
- }
116
- else {
117
- log.debug(`Identify called on unpaired ${hostTypeName}`);
118
- }
119
- callback();
120
- });
121
- const accessoryInformationService = self.host.getService(hap_nodejs_1.Service.AccessoryInformation) ||
122
- self.host.addService(hap_nodejs_1.Service.AccessoryInformation);
123
- accessoryInformationService
124
- .setCharacteristic(hap_nodejs_1.Characteristic.Manufacturer, self.config.manufacturer)
125
- .setCharacteristic(hap_nodejs_1.Characteristic.SerialNumber, self.config.serialNo)
126
- .setCharacteristic(hap_nodejs_1.Characteristic.Model, self.config.model)
127
- .setCharacteristic(hap_nodejs_1.Characteristic.FirmwareRevision, (_a = self.config.firmwareRev) === null || _a === void 0 ? void 0 : _a.toString())
128
- .setCharacteristic(hap_nodejs_1.Characteristic.HardwareRevision, (_b = self.config.hardwareRev) === null || _b === void 0 ? void 0 : _b.toString())
129
- .setCharacteristic(hap_nodejs_1.Characteristic.SoftwareRevision, (_c = self.config.softwareRev) === null || _c === void 0 ? void 0 : _c.toString());
130
- };
131
- const macify = (nodeId) => {
132
- if (nodeId) {
133
- const noDecimalStr = nodeId.replace('.', '');
134
- const paddedStr = noDecimalStr.padEnd(12, '0');
135
- const match = paddedStr.match(/.{1,2}/g);
136
- if (match) {
137
- return match.join(':').substr(0, 17).toUpperCase();
138
- }
139
- else {
140
- throw new NRCHKBError_1.default(`match failed in macify process for padded string ${paddedStr}`);
141
- }
142
- }
143
- else {
144
- throw new NRCHKBError_1.default('nodeId cannot be empty in macify process');
32
+ const normalizePort = (port) => {
33
+ if (port === void 0 || port === null || port === "") {
34
+ return 0;
35
+ }
36
+ const normalizedPort = Number(port);
37
+ return Number.isNaN(normalizedPort) ? 0 : normalizedPort;
38
+ };
39
+ const init = function(config) {
40
+ const log = (0, import_logger.logger)("NRCHKB", "HAPHostNode", config.bridgeName, this);
41
+ this.hostType = hostType;
42
+ RED.nodes.createNode(this, config);
43
+ this.config = config;
44
+ this.name = config.bridgeName;
45
+ if (!hostNameValidator(config.bridgeName)) {
46
+ log.error("Host name is incorrect", false);
47
+ return new import_NRCHKBError.default("Host name is incorrect");
48
+ }
49
+ if (import_preload.default.parse(config.firmwareRev) == null) {
50
+ config.firmwareRev = new import_semver.SemVer("0.0.0");
51
+ }
52
+ if (!config.bind?.length && config.customMdnsConfig) {
53
+ log.error(
54
+ "Custom mDNS configuration is deprecated and ignored by HAP-NodeJS 2.x. Use Bind and Advertiser instead."
55
+ );
56
+ }
57
+ this.accessoryCategory = this.hostType == import_HostType.default.BRIDGE ? import_HapCategories.default.BRIDGE : this.config.accessoryCategory;
58
+ this.published = false;
59
+ this.paired = false;
60
+ try {
61
+ this.bridgeUsername = macify(this.id);
62
+ } catch (error) {
63
+ log.error(error);
64
+ return error;
65
+ }
66
+ const hostUUID = import_hap_nodejs.uuid.generate(this.id);
67
+ const hostTypeName = this.hostType == import_HostType.default.BRIDGE ? "Bridge" : "Standalone Accessory";
68
+ log.debug(`Creating ${hostTypeName} with UUID ${hostUUID}`);
69
+ if (this.hostType == import_HostType.default.BRIDGE) {
70
+ this.host = new import_hap_nodejs.Bridge(this.name, hostUUID);
71
+ } else {
72
+ this.host = new import_hap_nodejs.Accessory(this.name, hostUUID);
73
+ }
74
+ this.publish = () => {
75
+ if (this.hostType == import_HostType.default.BRIDGE) {
76
+ log.debug(
77
+ `Publishing ${hostTypeName} with pin code ${this.config.pinCode} and ${this.host.bridgedAccessories.length} accessories`
78
+ );
79
+ } else {
80
+ log.debug(
81
+ `Publishing ${hostTypeName} with pin code ${this.config.pinCode}`
82
+ );
83
+ }
84
+ const port = normalizePort(this.config.port);
85
+ if (port === 1880) {
86
+ log.error(
87
+ `Cannot publish on ${hostTypeName} port 1880 as it is reserved for node-red`
88
+ );
89
+ this.published = false;
90
+ return false;
91
+ }
92
+ let oldPinCode = this.config.pinCode;
93
+ if ((oldPinCode.match(/-/g) || []).length === 1) {
94
+ oldPinCode = oldPinCode.replace(/-/g, "");
95
+ oldPinCode = `${oldPinCode.slice(0, 3)}-${oldPinCode.slice(3, 5)}-${oldPinCode.slice(5, 8)}`;
96
+ }
97
+ let bind;
98
+ if (this.config.bind?.length && this.config.bindType) {
99
+ if (this.config.bindType === "str") {
100
+ bind = this.config.bind;
101
+ } else if (this.config.bindType === "json") {
102
+ try {
103
+ bind = JSON.parse(this.config.bind);
104
+ } catch (error) {
105
+ log.error(`Invalid bind JSON: ${error}`);
106
+ this.published = false;
107
+ return false;
108
+ }
145
109
  }
110
+ }
111
+ this.host.publish(
112
+ {
113
+ username: this.bridgeUsername,
114
+ port,
115
+ pincode: oldPinCode,
116
+ category: this.accessoryCategory,
117
+ bind,
118
+ advertiser: this.config.advertiser ?? import_hap_nodejs.MDNSAdvertiser.BONJOUR
119
+ },
120
+ this.config.allowInsecureRequest
121
+ );
122
+ this.published = true;
123
+ this.paired = !!this.host._accessoryInfo?.paired();
124
+ return true;
146
125
  };
147
- const hostNameValidator = function (hostName) {
148
- return hostName ? /^[^.]{1,64}$/.test(hostName) : false;
149
- };
150
- return {
151
- init,
152
- macify,
153
- };
126
+ this.on("close", async (removed, done) => {
127
+ if (removed) {
128
+ log.debug("This node has been deleted");
129
+ await this.host.destroy();
130
+ } else {
131
+ log.debug("This node is being restarted");
132
+ await this.host.unpublish();
133
+ }
134
+ this.published = false;
135
+ this.paired = false;
136
+ done();
137
+ });
138
+ this.host.on("identify", (paired, callback) => {
139
+ if (paired) {
140
+ log.debug(`Identify called on paired ${hostTypeName}`);
141
+ } else {
142
+ log.debug(`Identify called on unpaired ${hostTypeName}`);
143
+ }
144
+ callback();
145
+ });
146
+ this.host.on("paired", () => {
147
+ this.paired = true;
148
+ });
149
+ this.host.on("unpaired", () => {
150
+ this.paired = false;
151
+ });
152
+ const accessoryInformationService = this.host.getService(import_hap_nodejs.Service.AccessoryInformation) || this.host.addService(import_hap_nodejs.Service.AccessoryInformation);
153
+ accessoryInformationService.setCharacteristic(
154
+ import_hap_nodejs.Characteristic.Manufacturer,
155
+ this.config.manufacturer
156
+ ).setCharacteristic(
157
+ import_hap_nodejs.Characteristic.SerialNumber,
158
+ this.config.serialNo
159
+ ).setCharacteristic(import_hap_nodejs.Characteristic.Model, this.config.model).setCharacteristic(
160
+ import_hap_nodejs.Characteristic.FirmwareRevision,
161
+ this.config.firmwareRev?.toString()
162
+ ).setCharacteristic(
163
+ import_hap_nodejs.Characteristic.HardwareRevision,
164
+ this.config.hardwareRev?.toString()
165
+ ).setCharacteristic(
166
+ import_hap_nodejs.Characteristic.SoftwareRevision,
167
+ this.config.softwareRev?.toString()
168
+ );
169
+ };
170
+ const macify = (nodeId) => {
171
+ if (nodeId) {
172
+ const noDecimalStr = nodeId.replace(/\./g, "");
173
+ const paddedStr = noDecimalStr.padEnd(12, "0");
174
+ const match = paddedStr.match(/.{1,2}/g);
175
+ if (match) {
176
+ return match.join(":").slice(0, 17).toUpperCase();
177
+ } else {
178
+ throw new import_NRCHKBError.default(
179
+ `match failed in macify process for padded string ${paddedStr}`
180
+ );
181
+ }
182
+ } else {
183
+ throw new import_NRCHKBError.default("nodeId cannot be empty in macify process");
184
+ }
185
+ };
186
+ const hostNameValidator = (hostName) => hostName ? /^[^.]{1,64}$/.test(hostName) : false;
187
+ return {
188
+ init,
189
+ macify
190
+ };
154
191
  };