matterbridge 3.3.1-dev-20251011-c8b30f8 → 3.3.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.
- package/CHANGELOG.md +3 -3
- package/dist/broadcastServer.d.ts +105 -0
- package/dist/broadcastServer.d.ts.map +1 -0
- package/dist/broadcastServer.js +86 -1
- package/dist/broadcastServer.js.map +1 -0
- package/dist/broadcastServerTypes.d.ts +717 -0
- package/dist/broadcastServerTypes.d.ts.map +1 -0
- package/dist/broadcastServerTypes.js +24 -0
- package/dist/broadcastServerTypes.js.map +1 -0
- package/dist/cli.d.ts +26 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +147 -6
- package/dist/cli.js.map +1 -0
- package/dist/cliEmitter.d.ts +50 -0
- package/dist/cliEmitter.d.ts.map +1 -0
- package/dist/cliEmitter.js +37 -0
- package/dist/cliEmitter.js.map +1 -0
- package/dist/cliHistory.d.ts +70 -0
- package/dist/cliHistory.d.ts.map +1 -0
- package/dist/cliHistory.js +89 -14
- package/dist/cliHistory.js.map +1 -0
- package/dist/clusters/export.d.ts +2 -0
- package/dist/clusters/export.d.ts.map +1 -0
- package/dist/clusters/export.js +2 -0
- package/dist/clusters/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +28 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +24 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +117 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +124 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/devices/airConditioner.d.ts +98 -0
- package/dist/devices/airConditioner.d.ts.map +1 -0
- package/dist/devices/airConditioner.js +57 -0
- package/dist/devices/airConditioner.js.map +1 -0
- package/dist/devices/batteryStorage.d.ts +48 -0
- package/dist/devices/batteryStorage.d.ts.map +1 -0
- package/dist/devices/batteryStorage.js +48 -1
- package/dist/devices/batteryStorage.js.map +1 -0
- package/dist/devices/cooktop.d.ts +60 -0
- package/dist/devices/cooktop.d.ts.map +1 -0
- package/dist/devices/cooktop.js +55 -0
- package/dist/devices/cooktop.js.map +1 -0
- package/dist/devices/dishwasher.d.ts +71 -0
- package/dist/devices/dishwasher.d.ts.map +1 -0
- package/dist/devices/dishwasher.js +57 -0
- package/dist/devices/dishwasher.js.map +1 -0
- package/dist/devices/evse.d.ts +75 -0
- package/dist/devices/evse.d.ts.map +1 -0
- package/dist/devices/evse.js +74 -10
- package/dist/devices/evse.js.map +1 -0
- package/dist/devices/export.d.ts +17 -0
- package/dist/devices/export.d.ts.map +1 -0
- package/dist/devices/export.js +5 -0
- package/dist/devices/export.js.map +1 -0
- package/dist/devices/extractorHood.d.ts +46 -0
- package/dist/devices/extractorHood.d.ts.map +1 -0
- package/dist/devices/extractorHood.js +42 -0
- package/dist/devices/extractorHood.js.map +1 -0
- package/dist/devices/heatPump.d.ts +47 -0
- package/dist/devices/heatPump.d.ts.map +1 -0
- package/dist/devices/heatPump.js +50 -2
- package/dist/devices/heatPump.js.map +1 -0
- package/dist/devices/laundryDryer.d.ts +67 -0
- package/dist/devices/laundryDryer.d.ts.map +1 -0
- package/dist/devices/laundryDryer.js +62 -3
- package/dist/devices/laundryDryer.js.map +1 -0
- package/dist/devices/laundryWasher.d.ts +81 -0
- package/dist/devices/laundryWasher.d.ts.map +1 -0
- package/dist/devices/laundryWasher.js +70 -4
- package/dist/devices/laundryWasher.js.map +1 -0
- package/dist/devices/microwaveOven.d.ts +168 -0
- package/dist/devices/microwaveOven.d.ts.map +1 -0
- package/dist/devices/microwaveOven.js +88 -5
- package/dist/devices/microwaveOven.js.map +1 -0
- package/dist/devices/oven.d.ts +105 -0
- package/dist/devices/oven.d.ts.map +1 -0
- package/dist/devices/oven.js +85 -0
- package/dist/devices/oven.js.map +1 -0
- package/dist/devices/refrigerator.d.ts +118 -0
- package/dist/devices/refrigerator.d.ts.map +1 -0
- package/dist/devices/refrigerator.js +102 -0
- package/dist/devices/refrigerator.js.map +1 -0
- package/dist/devices/roboticVacuumCleaner.d.ts +112 -0
- package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/devices/roboticVacuumCleaner.js +100 -9
- package/dist/devices/roboticVacuumCleaner.js.map +1 -0
- package/dist/devices/solarPower.d.ts +40 -0
- package/dist/devices/solarPower.d.ts.map +1 -0
- package/dist/devices/solarPower.js +38 -0
- package/dist/devices/solarPower.js.map +1 -0
- package/dist/devices/speaker.d.ts +87 -0
- package/dist/devices/speaker.d.ts.map +1 -0
- package/dist/devices/speaker.js +84 -0
- package/dist/devices/speaker.js.map +1 -0
- package/dist/devices/temperatureControl.d.ts +166 -0
- package/dist/devices/temperatureControl.d.ts.map +1 -0
- package/dist/devices/temperatureControl.js +25 -3
- package/dist/devices/temperatureControl.js.map +1 -0
- package/dist/devices/waterHeater.d.ts +111 -0
- package/dist/devices/waterHeater.d.ts.map +1 -0
- package/dist/devices/waterHeater.js +82 -2
- package/dist/devices/waterHeater.js.map +1 -0
- package/dist/dgram/coap.d.ts +205 -0
- package/dist/dgram/coap.d.ts.map +1 -0
- package/dist/dgram/coap.js +126 -13
- package/dist/dgram/coap.js.map +1 -0
- package/dist/dgram/dgram.d.ts +141 -0
- package/dist/dgram/dgram.d.ts.map +1 -0
- package/dist/dgram/dgram.js +114 -2
- package/dist/dgram/dgram.js.map +1 -0
- package/dist/dgram/mb_coap.d.ts +24 -0
- package/dist/dgram/mb_coap.d.ts.map +1 -0
- package/dist/dgram/mb_coap.js +41 -3
- package/dist/dgram/mb_coap.js.map +1 -0
- package/dist/dgram/mb_mdns.d.ts +24 -0
- package/dist/dgram/mb_mdns.d.ts.map +1 -0
- package/dist/dgram/mb_mdns.js +80 -15
- package/dist/dgram/mb_mdns.js.map +1 -0
- package/dist/dgram/mdns.d.ts +290 -0
- package/dist/dgram/mdns.d.ts.map +1 -0
- package/dist/dgram/mdns.js +299 -137
- package/dist/dgram/mdns.js.map +1 -0
- package/dist/dgram/multicast.d.ts +67 -0
- package/dist/dgram/multicast.d.ts.map +1 -0
- package/dist/dgram/multicast.js +62 -1
- package/dist/dgram/multicast.js.map +1 -0
- package/dist/dgram/unicast.d.ts +56 -0
- package/dist/dgram/unicast.d.ts.map +1 -0
- package/dist/dgram/unicast.js +54 -0
- package/dist/dgram/unicast.js.map +1 -0
- package/dist/frontend.d.ts +234 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +402 -29
- package/dist/frontend.js.map +1 -0
- package/dist/frontendTypes.d.ts +522 -0
- package/dist/frontendTypes.d.ts.map +1 -0
- package/dist/frontendTypes.js +45 -0
- package/dist/frontendTypes.js.map +1 -0
- package/dist/helpers.d.ts +48 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +53 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/behaviors.d.ts +2 -0
- package/dist/matter/behaviors.d.ts.map +1 -0
- package/dist/matter/behaviors.js +2 -0
- package/dist/matter/behaviors.js.map +1 -0
- package/dist/matter/clusters.d.ts +2 -0
- package/dist/matter/clusters.d.ts.map +1 -0
- package/dist/matter/clusters.js +2 -0
- package/dist/matter/clusters.js.map +1 -0
- package/dist/matter/devices.d.ts +2 -0
- package/dist/matter/devices.d.ts.map +1 -0
- package/dist/matter/devices.js +2 -0
- package/dist/matter/devices.js.map +1 -0
- package/dist/matter/endpoints.d.ts +2 -0
- package/dist/matter/endpoints.d.ts.map +1 -0
- package/dist/matter/endpoints.js +2 -0
- package/dist/matter/endpoints.js.map +1 -0
- package/dist/matter/export.d.ts +5 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +3 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matter/types.d.ts +3 -0
- package/dist/matter/types.d.ts.map +1 -0
- package/dist/matter/types.js +3 -0
- package/dist/matter/types.js.map +1 -0
- package/dist/matterbridge.d.ts +469 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +795 -45
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +36 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +1747 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +65 -5
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +761 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +630 -17
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +36 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1534 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1398 -58
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +407 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +345 -12
- package/dist/matterbridgeEndpointHelpers.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +402 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +341 -1
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +209 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +26 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/pluginManager.d.ts +353 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +325 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/shelly.d.ts +174 -0
- package/dist/shelly.d.ts.map +1 -0
- package/dist/shelly.js +168 -7
- package/dist/shelly.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/update.d.ts +75 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +69 -0
- package/dist/update.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +99 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +97 -2
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/commandLine.d.ts +59 -0
- package/dist/utils/commandLine.d.ts.map +1 -0
- package/dist/utils/commandLine.js +54 -0
- package/dist/utils/commandLine.js.map +1 -0
- package/dist/utils/copyDirectory.d.ts +33 -0
- package/dist/utils/copyDirectory.d.ts.map +1 -0
- package/dist/utils/copyDirectory.js +38 -1
- package/dist/utils/copyDirectory.js.map +1 -0
- package/dist/utils/createDirectory.d.ts +34 -0
- package/dist/utils/createDirectory.d.ts.map +1 -0
- package/dist/utils/createDirectory.js +33 -0
- package/dist/utils/createDirectory.js.map +1 -0
- package/dist/utils/createZip.d.ts +39 -0
- package/dist/utils/createZip.d.ts.map +1 -0
- package/dist/utils/createZip.js +47 -2
- package/dist/utils/createZip.js.map +1 -0
- package/dist/utils/deepCopy.d.ts +32 -0
- package/dist/utils/deepCopy.d.ts.map +1 -0
- package/dist/utils/deepCopy.js +39 -0
- package/dist/utils/deepCopy.js.map +1 -0
- package/dist/utils/deepEqual.d.ts +54 -0
- package/dist/utils/deepEqual.d.ts.map +1 -0
- package/dist/utils/deepEqual.js +72 -1
- package/dist/utils/deepEqual.js.map +1 -0
- package/dist/utils/error.d.ts +44 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +41 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/export.d.ts +13 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/hex.d.ts +89 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +124 -0
- package/dist/utils/hex.js.map +1 -0
- package/dist/utils/isvalid.d.ts +103 -0
- package/dist/utils/isvalid.d.ts.map +1 -0
- package/dist/utils/isvalid.js +101 -0
- package/dist/utils/isvalid.js.map +1 -0
- package/dist/utils/jestHelpers.d.ts +137 -0
- package/dist/utils/jestHelpers.d.ts.map +1 -0
- package/dist/utils/jestHelpers.js +153 -3
- package/dist/utils/jestHelpers.js.map +1 -0
- package/dist/utils/network.d.ts +115 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +108 -5
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/spawn.d.ts +35 -0
- package/dist/utils/spawn.d.ts.map +1 -0
- package/dist/utils/spawn.js +71 -0
- package/dist/utils/spawn.js.map +1 -0
- package/dist/utils/wait.d.ts +54 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +60 -8
- package/dist/utils/wait.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the validation functions.
|
|
3
|
+
*
|
|
4
|
+
* @file isvalid.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2025-02-16
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a given string is a valid IPv4 address.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} ipv4Address - The string to be checked.
|
|
28
|
+
* @returns {boolean} - Returns true if the string is a valid IPv4 address, otherwise returns false.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isValidIpv4Address(ipv4Address: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a value is a valid number within the specified range.
|
|
33
|
+
*
|
|
34
|
+
* @param {any} value - The value to be checked.
|
|
35
|
+
* @param {number} min - The minimum value allowed (optional).
|
|
36
|
+
* @param {number} max - The maximum value allowed (optional).
|
|
37
|
+
* @returns {value is number} Returns true if the value is a valid number within the specified range, otherwise false.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isValidNumber(value: any, min?: number, max?: number): value is number;
|
|
40
|
+
/**
|
|
41
|
+
* Checks if a value is a valid boolean.
|
|
42
|
+
*
|
|
43
|
+
* @param {any} value - The value to be checked.
|
|
44
|
+
* @returns {value is boolean} `true` if the value is a valid boolean, `false` otherwise.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isValidBoolean(value: any): value is boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Checks if a value is a valid string.
|
|
49
|
+
*
|
|
50
|
+
* @param {any} value - The value to be checked.
|
|
51
|
+
* @param {number} minLength - The min string length (optional).
|
|
52
|
+
* @param {number} maxLength - The max string length (optional).
|
|
53
|
+
* @returns {value is string} A boolean indicating whether the value is a valid string.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isValidString(value: any, minLength?: number, maxLength?: number): value is string;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if a value is a valid RegExp.
|
|
58
|
+
*
|
|
59
|
+
* @param {any} value - The value to be checked.
|
|
60
|
+
* @returns {value is RegExp} A boolean indicating whether the value is a valid RegExp.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isValidRegExp(value: any): value is RegExp;
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a value is a valid object.
|
|
65
|
+
*
|
|
66
|
+
* @param {any} value - The value to be checked.
|
|
67
|
+
* @param {number} minLength - The min number of keys (optional).
|
|
68
|
+
* @param {number} maxLength - The max number of keys (optional).
|
|
69
|
+
* @returns {value is object} A boolean indicating whether the value is a valid object.
|
|
70
|
+
*/
|
|
71
|
+
export declare function isValidObject(value: any, minLength?: number, maxLength?: number): value is object;
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a value is a valid array.
|
|
74
|
+
*
|
|
75
|
+
* @param {any} value - The value to be checked.
|
|
76
|
+
* @param {number} minLength - The min number of elements (optional).
|
|
77
|
+
* @param {number} maxLength - The max number of elements (optional).
|
|
78
|
+
* @returns {value is unknown[]} A boolean indicating whether the value is a valid array.
|
|
79
|
+
*/
|
|
80
|
+
export declare function isValidArray(value: any, minLength?: number, maxLength?: number): value is unknown[];
|
|
81
|
+
/**
|
|
82
|
+
* Checks if the given value is null.
|
|
83
|
+
*
|
|
84
|
+
* @param {any} value - The value to check.
|
|
85
|
+
* @returns {value is null} `true` if the value is null, `false` otherwise.
|
|
86
|
+
*/
|
|
87
|
+
export declare function isValidNull(value: any): value is null;
|
|
88
|
+
/**
|
|
89
|
+
* Checks if a value is undefined.
|
|
90
|
+
*
|
|
91
|
+
* @param {any} value - The value to check.
|
|
92
|
+
* @returns {value is undefined} `true` if the value is undefined, `false` otherwise.
|
|
93
|
+
*/
|
|
94
|
+
export declare function isValidUndefined(value: any): value is undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Converts a semantic version string like "6.11.0-1011-raspi" to a numeric version code like 61100.
|
|
97
|
+
* Format: major * 10000 + minor * 100 + patch
|
|
98
|
+
*
|
|
99
|
+
* @param {string} versionString The version string to parse
|
|
100
|
+
* @returns {number | undefined} A numeric version code or undefined if parsing fails
|
|
101
|
+
*/
|
|
102
|
+
export declare function parseVersionString(versionString: string): number | undefined;
|
|
103
|
+
//# sourceMappingURL=isvalid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isvalid.d.ts","sourceRoot":"","sources":["../../src/utils/isvalid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAG/D;AAED;;;;;;;GAOG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,IAAI,MAAM,CAKrF;AAED;;;;;GAKG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,CAE3D;AAED;;;;;;;GAOG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,IAAI,MAAM,CAKjG;AAED;;;;;GAKG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAEzD;AAED;;;;;;;GAOG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,IAAI,MAAM,CAMjG;AAED;;;;;;;GAOG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,IAAI,OAAO,EAAE,CAKnG;AAED;;;;;GAKG;AAEH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,IAAI,CAErD;AAED;;;;;GAKG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB5E"}
|
package/dist/utils/isvalid.js
CHANGED
|
@@ -1,7 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the validation functions.
|
|
3
|
+
*
|
|
4
|
+
* @file isvalid.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2025-02-16
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a given string is a valid IPv4 address.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} ipv4Address - The string to be checked.
|
|
28
|
+
* @returns {boolean} - Returns true if the string is a valid IPv4 address, otherwise returns false.
|
|
29
|
+
*/
|
|
1
30
|
export function isValidIpv4Address(ipv4Address) {
|
|
2
31
|
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
3
32
|
return ipv4Regex.test(ipv4Address);
|
|
4
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a value is a valid number within the specified range.
|
|
36
|
+
*
|
|
37
|
+
* @param {any} value - The value to be checked.
|
|
38
|
+
* @param {number} min - The minimum value allowed (optional).
|
|
39
|
+
* @param {number} max - The maximum value allowed (optional).
|
|
40
|
+
* @returns {value is number} Returns true if the value is a valid number within the specified range, otherwise false.
|
|
41
|
+
*/
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
43
|
export function isValidNumber(value, min, max) {
|
|
6
44
|
if (value === undefined || value === null || typeof value !== 'number' || Number.isNaN(value) || !Number.isFinite(value))
|
|
7
45
|
return false;
|
|
@@ -11,9 +49,25 @@ export function isValidNumber(value, min, max) {
|
|
|
11
49
|
return false;
|
|
12
50
|
return true;
|
|
13
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Checks if a value is a valid boolean.
|
|
54
|
+
*
|
|
55
|
+
* @param {any} value - The value to be checked.
|
|
56
|
+
* @returns {value is boolean} `true` if the value is a valid boolean, `false` otherwise.
|
|
57
|
+
*/
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
59
|
export function isValidBoolean(value) {
|
|
15
60
|
return value !== undefined && value !== null && typeof value === 'boolean';
|
|
16
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Checks if a value is a valid string.
|
|
64
|
+
*
|
|
65
|
+
* @param {any} value - The value to be checked.
|
|
66
|
+
* @param {number} minLength - The min string length (optional).
|
|
67
|
+
* @param {number} maxLength - The max string length (optional).
|
|
68
|
+
* @returns {value is string} A boolean indicating whether the value is a valid string.
|
|
69
|
+
*/
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
71
|
export function isValidString(value, minLength, maxLength) {
|
|
18
72
|
if (value === undefined || value === null || typeof value !== 'string')
|
|
19
73
|
return false;
|
|
@@ -23,9 +77,25 @@ export function isValidString(value, minLength, maxLength) {
|
|
|
23
77
|
return false;
|
|
24
78
|
return true;
|
|
25
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Checks if a value is a valid RegExp.
|
|
82
|
+
*
|
|
83
|
+
* @param {any} value - The value to be checked.
|
|
84
|
+
* @returns {value is RegExp} A boolean indicating whether the value is a valid RegExp.
|
|
85
|
+
*/
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
87
|
export function isValidRegExp(value) {
|
|
27
88
|
return value !== undefined && value !== null && value instanceof RegExp;
|
|
28
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks if a value is a valid object.
|
|
92
|
+
*
|
|
93
|
+
* @param {any} value - The value to be checked.
|
|
94
|
+
* @param {number} minLength - The min number of keys (optional).
|
|
95
|
+
* @param {number} maxLength - The max number of keys (optional).
|
|
96
|
+
* @returns {value is object} A boolean indicating whether the value is a valid object.
|
|
97
|
+
*/
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
99
|
export function isValidObject(value, minLength, maxLength) {
|
|
30
100
|
if (value === undefined || value === null || typeof value !== 'object' || Array.isArray(value))
|
|
31
101
|
return false;
|
|
@@ -36,6 +106,15 @@ export function isValidObject(value, minLength, maxLength) {
|
|
|
36
106
|
return false;
|
|
37
107
|
return true;
|
|
38
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Checks if a value is a valid array.
|
|
111
|
+
*
|
|
112
|
+
* @param {any} value - The value to be checked.
|
|
113
|
+
* @param {number} minLength - The min number of elements (optional).
|
|
114
|
+
* @param {number} maxLength - The max number of elements (optional).
|
|
115
|
+
* @returns {value is unknown[]} A boolean indicating whether the value is a valid array.
|
|
116
|
+
*/
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
118
|
export function isValidArray(value, minLength, maxLength) {
|
|
40
119
|
if (value === undefined || value === null || !Array.isArray(value))
|
|
41
120
|
return false;
|
|
@@ -45,12 +124,33 @@ export function isValidArray(value, minLength, maxLength) {
|
|
|
45
124
|
return false;
|
|
46
125
|
return true;
|
|
47
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Checks if the given value is null.
|
|
129
|
+
*
|
|
130
|
+
* @param {any} value - The value to check.
|
|
131
|
+
* @returns {value is null} `true` if the value is null, `false` otherwise.
|
|
132
|
+
*/
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
134
|
export function isValidNull(value) {
|
|
49
135
|
return value === null;
|
|
50
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Checks if a value is undefined.
|
|
139
|
+
*
|
|
140
|
+
* @param {any} value - The value to check.
|
|
141
|
+
* @returns {value is undefined} `true` if the value is undefined, `false` otherwise.
|
|
142
|
+
*/
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
144
|
export function isValidUndefined(value) {
|
|
52
145
|
return value === undefined;
|
|
53
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Converts a semantic version string like "6.11.0-1011-raspi" to a numeric version code like 61100.
|
|
149
|
+
* Format: major * 10000 + minor * 100 + patch
|
|
150
|
+
*
|
|
151
|
+
* @param {string} versionString The version string to parse
|
|
152
|
+
* @returns {number | undefined} A numeric version code or undefined if parsing fails
|
|
153
|
+
*/
|
|
54
154
|
export function parseVersionString(versionString) {
|
|
55
155
|
if (!isValidString(versionString))
|
|
56
156
|
return undefined;
|
|
@@ -67,3 +167,4 @@ export function parseVersionString(versionString) {
|
|
|
67
167
|
}
|
|
68
168
|
return major * 10000 + minor *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AG,GAAG,GAAG,KAAK,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description This file contains the Jest helpers.
|
|
3
|
+
* @file src/helpers.test.ts
|
|
4
|
+
* @author Luca Liguori
|
|
5
|
+
* @created 2025-09-03
|
|
6
|
+
* @version 1.0.5
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
import { jest } from '@jest/globals';
|
|
24
|
+
import { Endpoint, Environment, ServerNode } from '@matter/main';
|
|
25
|
+
import { AggregatorEndpoint } from '@matter/main/endpoints';
|
|
26
|
+
import { AnsiLogger } from 'node-ansi-logger';
|
|
27
|
+
export declare let loggerLogSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.log>;
|
|
28
|
+
export declare let consoleLogSpy: jest.SpiedFunction<typeof console.log>;
|
|
29
|
+
export declare let consoleDebugSpy: jest.SpiedFunction<typeof console.log>;
|
|
30
|
+
export declare let consoleInfoSpy: jest.SpiedFunction<typeof console.log>;
|
|
31
|
+
export declare let consoleWarnSpy: jest.SpiedFunction<typeof console.log>;
|
|
32
|
+
export declare let consoleErrorSpy: jest.SpiedFunction<typeof console.log>;
|
|
33
|
+
/**
|
|
34
|
+
* Setup the Jest environment:
|
|
35
|
+
* - it will remove any existing home directory
|
|
36
|
+
* - setup the spies for logging
|
|
37
|
+
*
|
|
38
|
+
* @param {string} name The name of the test suite.
|
|
39
|
+
* @param {boolean} debug If true, the logging is not mocked.
|
|
40
|
+
*
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { consoleDebugSpy, consoleErrorSpy, consoleInfoSpy, consoleLogSpy, consoleWarnSpy, loggerLogSpy, setDebug, setupTest } from './jestHelpers.js';
|
|
43
|
+
*
|
|
44
|
+
* // Setup the test environment
|
|
45
|
+
* setupTest(NAME, false);
|
|
46
|
+
*
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function setupTest(name: string, debug?: boolean): void;
|
|
50
|
+
/**
|
|
51
|
+
* Set or unset the debug mode.
|
|
52
|
+
*
|
|
53
|
+
* @param {boolean} debug If true, the logging is not mocked.
|
|
54
|
+
*/
|
|
55
|
+
export declare function setDebug(debug: boolean): void;
|
|
56
|
+
/**
|
|
57
|
+
* Create a matter Environment for testing:
|
|
58
|
+
* - it will remove any existing home directory
|
|
59
|
+
* - setup the matter environment with homeDir, debug logging and ANSI format
|
|
60
|
+
*
|
|
61
|
+
* @param {string} homeDir Home directory for the environment.
|
|
62
|
+
* @returns {Environment} The default matter environment.
|
|
63
|
+
*/
|
|
64
|
+
export declare function createTestEnvironment(homeDir: string): Environment;
|
|
65
|
+
/**
|
|
66
|
+
* Advance the Node.js event loop deterministically to allow chained asynchronous work (Promises scheduled in
|
|
67
|
+
* microtasks and follow‑up macrotasks) to complete inside tests without adding arbitrary long timeouts.
|
|
68
|
+
*
|
|
69
|
+
* NOTE: This does not guarantee OS level network IO completion—only JavaScript task queue progression inside the
|
|
70
|
+
* current process.
|
|
71
|
+
*
|
|
72
|
+
* @param {number} ticks Number of macrotask (setImmediate) turns to yield (default 3).
|
|
73
|
+
* @param {number} microTurns Number of microtask drains (Promise.resolve chains) after macrotask yielding (default 10).
|
|
74
|
+
* @param {number} pause Final timer delay in ms; set 0 to disable (default 100ms).
|
|
75
|
+
* @returns {Promise<void>} Resolves after the requested event loop advancement has completed.
|
|
76
|
+
*/
|
|
77
|
+
export declare function flushAsync(ticks?: number, microTurns?: number, pause?: number): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Flush (await) the lazy endpoint number persistence mechanism used by matter.js.
|
|
80
|
+
*
|
|
81
|
+
* Background:
|
|
82
|
+
* assignNumber() batches persistence (store.saveNumber + updating __nextNumber__) via an internal promise (#numbersPersisted).
|
|
83
|
+
* Calling endpointStores.close() waits for the current batch only. If new endpoints were added in the same macrotask
|
|
84
|
+
* cycle additional micro/macro turns might be needed to ensure the batch started. We defensively yield macrotasks
|
|
85
|
+
* (setImmediate) and then await close() multiple rounds.
|
|
86
|
+
*
|
|
87
|
+
* @param {ServerNode} targetServer The server whose endpoint numbering persistence should be flushed.
|
|
88
|
+
* @param {number} rounds Number of macrotask + close cycles to run (2 is usually sufficient; 1 often works).
|
|
89
|
+
* @returns {Promise<void>} Resolves when pending number persistence batches have completed.
|
|
90
|
+
*/
|
|
91
|
+
export declare function flushAllEndpointNumberPersistence(targetServer: ServerNode, rounds?: number): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Assert that every endpoint attached to the server has an assigned and (batch-)persisted endpoint number.
|
|
94
|
+
*
|
|
95
|
+
* This waits for any outstanding number persistence batch (endpointStores.close()), then traverses the endpoint
|
|
96
|
+
* graph and asserts:
|
|
97
|
+
* - Root endpoint: number is 0 (allowing undefined to coerce to 0 via nullish coalescing check).
|
|
98
|
+
* - All other endpoints: number > 0.
|
|
99
|
+
*
|
|
100
|
+
* @param {ServerNode} targetServer The server whose endpoint numbers are verified.
|
|
101
|
+
* @returns {Promise<void>} Resolves when assertions complete.
|
|
102
|
+
*/
|
|
103
|
+
export declare function assertAllEndpointNumbersPersisted(targetServer: ServerNode): Promise<number>;
|
|
104
|
+
/**
|
|
105
|
+
* Start a matter server node for testing.
|
|
106
|
+
*
|
|
107
|
+
* @param {string} name Name of the server (used for logging and product description).
|
|
108
|
+
* @param {number} port TCP port to listen on.
|
|
109
|
+
* @returns {Promise<[ServerNode<ServerNode.RootEndpoint>, Endpoint<AggregatorEndpoint>]>} Resolves to an array containing the created ServerNode and its AggregatorNode.
|
|
110
|
+
*/
|
|
111
|
+
export declare function startServerNode(name: string, port: number): Promise<[ServerNode<ServerNode.RootEndpoint>, Endpoint<AggregatorEndpoint>]>;
|
|
112
|
+
/**
|
|
113
|
+
* Stop a matter server node.
|
|
114
|
+
*
|
|
115
|
+
* @param {ServerNode<ServerNode.RootEndpoint>} server The server to stop.
|
|
116
|
+
* @returns {Promise<void>} Resolves when the server has stopped.
|
|
117
|
+
*/
|
|
118
|
+
export declare function stopServerNode(server: ServerNode<ServerNode.RootEndpoint>): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Add a device (endpoint) to a matter server node or an aggregator.
|
|
121
|
+
*
|
|
122
|
+
* @param {ServerNode<ServerNode.RootEndpoint> | Endpoint<AggregatorEndpoint>} owner The server or aggregator to add the device to.
|
|
123
|
+
* @param {Endpoint} device The device to add.
|
|
124
|
+
* @param {number} pause The pause time in milliseconds after addition (default 10ms).
|
|
125
|
+
* @returns {Promise<void>} Resolves when the device has been added and is ready.
|
|
126
|
+
*/
|
|
127
|
+
export declare function addDevice(owner: ServerNode<ServerNode.RootEndpoint> | Endpoint<AggregatorEndpoint>, device: Endpoint, pause?: number): Promise<boolean>;
|
|
128
|
+
/**
|
|
129
|
+
* Delete a device (endpoint) from a matter server node or an aggregator.
|
|
130
|
+
*
|
|
131
|
+
* @param {ServerNode<ServerNode.RootEndpoint> | Endpoint<AggregatorEndpoint>} owner The server or aggregator to remove the device from.
|
|
132
|
+
* @param {Endpoint} device The device to remove.
|
|
133
|
+
* @param {number} pause The pause time in milliseconds after deletion (default 10ms).
|
|
134
|
+
* @returns {Promise<void>} Resolves when the device has been removed and is no longer ready.
|
|
135
|
+
*/
|
|
136
|
+
export declare function deleteDevice(owner: ServerNode<ServerNode.RootEndpoint> | Endpoint<AggregatorEndpoint>, device: Endpoint, pause?: number): Promise<boolean>;
|
|
137
|
+
//# sourceMappingURL=jestHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jestHelpers.d.ts","sourceRoot":"","sources":["../../src/utils/jestHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAgB,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAkG,MAAM,cAAc,CAAC;AAC/K,OAAO,EAAE,kBAAkB,EAAgB,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU9C,eAAO,IAAI,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAC7E,eAAO,IAAI,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AACjE,eAAO,IAAI,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AACnE,eAAO,IAAI,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AAClE,eAAO,IAAI,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AAClE,eAAO,IAAI,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AAEnE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,IAAI,CAuBpE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAsB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