libshv-js 11.0.3 → 11.0.5
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/ws-client.js +7 -2
- package/package.json +3 -3
package/dist/ws-client.js
CHANGED
|
@@ -131,9 +131,14 @@ export var ShvApiVersion;
|
|
|
131
131
|
})(ShvApiVersion || (ShvApiVersion = {}));
|
|
132
132
|
export const pathMatchesSubscription = (subscriptionPath, signalPath, apiVersion) => {
|
|
133
133
|
if (apiVersion === ShvApiVersion.V2) {
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
// SHV2 path matching works as if there were a globstar at the end of the path (i.e. it just checks the prefix).
|
|
135
|
+
// Users of the library might still add the globstart at the end, so we'll remove it for them, so that they do
|
|
136
|
+
// not have to worry about this.
|
|
137
|
+
const recursivePathPrefix = subscriptionPath.endsWith('/**') ? subscriptionPath.slice(0, -3) : subscriptionPath;
|
|
138
|
+
const remainder = signalPath.slice(recursivePathPrefix.length);
|
|
139
|
+
return signalPath.startsWith(recursivePathPrefix) && (remainder.length === 0 || remainder.startsWith('/'));
|
|
136
140
|
}
|
|
141
|
+
// SHV3 globstar at the end allows for no fragments at the end, so we'll check both.
|
|
137
142
|
const recursivePathPrefix = subscriptionPath.endsWith('/**') ? subscriptionPath.slice(0, -3) : undefined;
|
|
138
143
|
return (recursivePathPrefix !== undefined && minimatch(signalPath, recursivePathPrefix)) || minimatch(signalPath, subscriptionPath);
|
|
139
144
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libshv-js",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.5",
|
|
4
4
|
"description": "Typescript implementation of libshv",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"@typescript-eslint/parser": "^8.56.1",
|
|
42
42
|
"@eslint/js": "^10.0.1",
|
|
43
43
|
"eslint": "^10.0.0",
|
|
44
|
-
"eslint-config-xo": "^
|
|
44
|
+
"eslint-config-xo": "^7.0.0",
|
|
45
45
|
"eslint-formatter-unix": "^9.0.1",
|
|
46
|
-
"eslint-plugin-unicorn": "^
|
|
46
|
+
"eslint-plugin-unicorn": "^79.0.0",
|
|
47
47
|
"typescript": "^6.0.2",
|
|
48
48
|
"typescript-eslint": "^8.46.1"
|
|
49
49
|
},
|