@inditextech/weave-store-azure-web-pubsub 0.71.0 → 0.72.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/dist/server.cjs CHANGED
@@ -20814,7 +20814,7 @@ function readRequestBody(req) {
20814
20814
  //#endregion
20815
20815
  //#region ../../node_modules/@typespec/ts-http-runtime/dist/esm/logger/log.js
20816
20816
  function log(message, ...args) {
20817
- node_process.stderr.write(`${node_util.default.format(message, ...args)}${node_os.EOL}`);
20817
+ node_process.default.stderr.write(`${node_util.default.format(message, ...args)}${node_os.EOL}`);
20818
20818
  }
20819
20819
 
20820
20820
  //#endregion
@@ -20837,18 +20837,74 @@ function enable(namespaces) {
20837
20837
  enabledString = namespaces;
20838
20838
  enabledNamespaces = [];
20839
20839
  skippedNamespaces = [];
20840
- const wildcard = /\*/g;
20841
- const namespaceList = namespaces.split(",").map((ns) => ns.trim().replace(wildcard, ".*?"));
20842
- for (const ns of namespaceList) if (ns.startsWith("-")) skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`));
20843
- else enabledNamespaces.push(new RegExp(`^${ns}$`));
20840
+ const namespaceList = namespaces.split(",").map((ns) => ns.trim());
20841
+ for (const ns of namespaceList) if (ns.startsWith("-")) skippedNamespaces.push(ns.substring(1));
20842
+ else enabledNamespaces.push(ns);
20844
20843
  for (const instance of debuggers) instance.enabled = enabled(instance.namespace);
20845
20844
  }
20846
20845
  function enabled(namespace) {
20847
20846
  if (namespace.endsWith("*")) return true;
20848
- for (const skipped of skippedNamespaces) if (skipped.test(namespace)) return false;
20849
- for (const enabledNamespace of enabledNamespaces) if (enabledNamespace.test(namespace)) return true;
20847
+ for (const skipped of skippedNamespaces) if (namespaceMatches(namespace, skipped)) return false;
20848
+ for (const enabledNamespace of enabledNamespaces) if (namespaceMatches(namespace, enabledNamespace)) return true;
20850
20849
  return false;
20851
20850
  }
20851
+ /**
20852
+ * Given a namespace, check if it matches a pattern.
20853
+ * Patterns only have a single wildcard character which is *.
20854
+ * The behavior of * is that it matches zero or more other characters.
20855
+ */
20856
+ function namespaceMatches(namespace, patternToMatch) {
20857
+ if (patternToMatch.indexOf("*") === -1) return namespace === patternToMatch;
20858
+ let pattern = patternToMatch;
20859
+ if (patternToMatch.indexOf("**") !== -1) {
20860
+ const patternParts = [];
20861
+ let lastCharacter = "";
20862
+ for (const character of patternToMatch) if (character === "*" && lastCharacter === "*") continue;
20863
+ else {
20864
+ lastCharacter = character;
20865
+ patternParts.push(character);
20866
+ }
20867
+ pattern = patternParts.join("");
20868
+ }
20869
+ let namespaceIndex = 0;
20870
+ let patternIndex = 0;
20871
+ const patternLength = pattern.length;
20872
+ const namespaceLength = namespace.length;
20873
+ let lastWildcard = -1;
20874
+ let lastWildcardNamespace = -1;
20875
+ while (namespaceIndex < namespaceLength && patternIndex < patternLength) if (pattern[patternIndex] === "*") {
20876
+ lastWildcard = patternIndex;
20877
+ patternIndex++;
20878
+ if (patternIndex === patternLength) return true;
20879
+ while (namespace[namespaceIndex] !== pattern[patternIndex]) {
20880
+ namespaceIndex++;
20881
+ if (namespaceIndex === namespaceLength) return false;
20882
+ }
20883
+ lastWildcardNamespace = namespaceIndex;
20884
+ namespaceIndex++;
20885
+ patternIndex++;
20886
+ continue;
20887
+ } else if (pattern[patternIndex] === namespace[namespaceIndex]) {
20888
+ patternIndex++;
20889
+ namespaceIndex++;
20890
+ } else if (lastWildcard >= 0) {
20891
+ patternIndex = lastWildcard + 1;
20892
+ namespaceIndex = lastWildcardNamespace + 1;
20893
+ if (namespaceIndex === namespaceLength) return false;
20894
+ while (namespace[namespaceIndex] !== pattern[patternIndex]) {
20895
+ namespaceIndex++;
20896
+ if (namespaceIndex === namespaceLength) return false;
20897
+ }
20898
+ lastWildcardNamespace = namespaceIndex;
20899
+ namespaceIndex++;
20900
+ patternIndex++;
20901
+ continue;
20902
+ } else return false;
20903
+ const namespaceDone = namespaceIndex === namespace.length;
20904
+ const patternDone = patternIndex === pattern.length;
20905
+ const trailingWildCard = patternIndex === pattern.length - 1 && pattern[patternIndex] === "*";
20906
+ return namespaceDone && (patternDone || trailingWildCard);
20907
+ }
20852
20908
  function disable() {
20853
20909
  const result = enabledString || "";
20854
20910
  enable("");
@@ -21442,7 +21498,7 @@ var CloudEventsDispatcher = class {
21442
21498
  switch (eventType) {
21443
21499
  case EventType.Connect: {
21444
21500
  const connectRequest = isMqtt ? await readSystemEventRequest(request$1, origin) : await readSystemEventRequest(request$1, origin);
21445
- connectRequest.queries = connectRequest.query;
21501
+ connectRequest.queries = connectRequest.queries ?? {};
21446
21502
  logger.verbose(connectRequest);
21447
21503
  this.eventHandler.handleConnect(connectRequest, getConnectResponseHandler(connectRequest, response$1));
21448
21504
  return true;
package/dist/server.js CHANGED
@@ -8,7 +8,7 @@ import * as Y$1 from "yjs";
8
8
  import * as Y from "yjs";
9
9
  import { URL as URL$1 } from "node:url";
10
10
  import { EOL } from "node:os";
11
- import * as process$1 from "node:process";
11
+ import process$1 from "node:process";
12
12
 
13
13
  //#region rolldown:runtime
14
14
  var __create = Object.create;
@@ -20841,18 +20841,74 @@ function enable(namespaces) {
20841
20841
  enabledString = namespaces;
20842
20842
  enabledNamespaces = [];
20843
20843
  skippedNamespaces = [];
20844
- const wildcard = /\*/g;
20845
- const namespaceList = namespaces.split(",").map((ns) => ns.trim().replace(wildcard, ".*?"));
20846
- for (const ns of namespaceList) if (ns.startsWith("-")) skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`));
20847
- else enabledNamespaces.push(new RegExp(`^${ns}$`));
20844
+ const namespaceList = namespaces.split(",").map((ns) => ns.trim());
20845
+ for (const ns of namespaceList) if (ns.startsWith("-")) skippedNamespaces.push(ns.substring(1));
20846
+ else enabledNamespaces.push(ns);
20848
20847
  for (const instance of debuggers) instance.enabled = enabled(instance.namespace);
20849
20848
  }
20850
20849
  function enabled(namespace) {
20851
20850
  if (namespace.endsWith("*")) return true;
20852
- for (const skipped of skippedNamespaces) if (skipped.test(namespace)) return false;
20853
- for (const enabledNamespace of enabledNamespaces) if (enabledNamespace.test(namespace)) return true;
20851
+ for (const skipped of skippedNamespaces) if (namespaceMatches(namespace, skipped)) return false;
20852
+ for (const enabledNamespace of enabledNamespaces) if (namespaceMatches(namespace, enabledNamespace)) return true;
20854
20853
  return false;
20855
20854
  }
20855
+ /**
20856
+ * Given a namespace, check if it matches a pattern.
20857
+ * Patterns only have a single wildcard character which is *.
20858
+ * The behavior of * is that it matches zero or more other characters.
20859
+ */
20860
+ function namespaceMatches(namespace, patternToMatch) {
20861
+ if (patternToMatch.indexOf("*") === -1) return namespace === patternToMatch;
20862
+ let pattern = patternToMatch;
20863
+ if (patternToMatch.indexOf("**") !== -1) {
20864
+ const patternParts = [];
20865
+ let lastCharacter = "";
20866
+ for (const character of patternToMatch) if (character === "*" && lastCharacter === "*") continue;
20867
+ else {
20868
+ lastCharacter = character;
20869
+ patternParts.push(character);
20870
+ }
20871
+ pattern = patternParts.join("");
20872
+ }
20873
+ let namespaceIndex = 0;
20874
+ let patternIndex = 0;
20875
+ const patternLength = pattern.length;
20876
+ const namespaceLength = namespace.length;
20877
+ let lastWildcard = -1;
20878
+ let lastWildcardNamespace = -1;
20879
+ while (namespaceIndex < namespaceLength && patternIndex < patternLength) if (pattern[patternIndex] === "*") {
20880
+ lastWildcard = patternIndex;
20881
+ patternIndex++;
20882
+ if (patternIndex === patternLength) return true;
20883
+ while (namespace[namespaceIndex] !== pattern[patternIndex]) {
20884
+ namespaceIndex++;
20885
+ if (namespaceIndex === namespaceLength) return false;
20886
+ }
20887
+ lastWildcardNamespace = namespaceIndex;
20888
+ namespaceIndex++;
20889
+ patternIndex++;
20890
+ continue;
20891
+ } else if (pattern[patternIndex] === namespace[namespaceIndex]) {
20892
+ patternIndex++;
20893
+ namespaceIndex++;
20894
+ } else if (lastWildcard >= 0) {
20895
+ patternIndex = lastWildcard + 1;
20896
+ namespaceIndex = lastWildcardNamespace + 1;
20897
+ if (namespaceIndex === namespaceLength) return false;
20898
+ while (namespace[namespaceIndex] !== pattern[patternIndex]) {
20899
+ namespaceIndex++;
20900
+ if (namespaceIndex === namespaceLength) return false;
20901
+ }
20902
+ lastWildcardNamespace = namespaceIndex;
20903
+ namespaceIndex++;
20904
+ patternIndex++;
20905
+ continue;
20906
+ } else return false;
20907
+ const namespaceDone = namespaceIndex === namespace.length;
20908
+ const patternDone = patternIndex === pattern.length;
20909
+ const trailingWildCard = patternIndex === pattern.length - 1 && pattern[patternIndex] === "*";
20910
+ return namespaceDone && (patternDone || trailingWildCard);
20911
+ }
20856
20912
  function disable() {
20857
20913
  const result = enabledString || "";
20858
20914
  enable("");
@@ -21446,7 +21502,7 @@ var CloudEventsDispatcher = class {
21446
21502
  switch (eventType) {
21447
21503
  case EventType.Connect: {
21448
21504
  const connectRequest = isMqtt ? await readSystemEventRequest(request$1, origin) : await readSystemEventRequest(request$1, origin);
21449
- connectRequest.queries = connectRequest.query;
21505
+ connectRequest.queries = connectRequest.queries ?? {};
21450
21506
  logger.verbose(connectRequest);
21451
21507
  this.eventHandler.handleConnect(connectRequest, getConnectResponseHandler(connectRequest, response$1));
21452
21508
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inditextech/weave-store-azure-web-pubsub",
3
- "version": "0.71.0",
3
+ "version": "0.72.1",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
@@ -61,7 +61,7 @@
61
61
  "yjs": "13.6.27"
62
62
  },
63
63
  "devDependencies": {
64
- "@inditextech/weave-sdk": "0.71.0",
64
+ "@inditextech/weave-sdk": "0.72.1",
65
65
  "@koa/cors": "^5.0.0",
66
66
  "@types/express": "^5.0.1",
67
67
  "@types/ioredis": "^4.28.10",
@@ -72,8 +72,8 @@
72
72
  "@types/ws": "^8.18.0",
73
73
  "@typescript-eslint/eslint-plugin": "8.26.0",
74
74
  "@typescript-eslint/parser": "8.26.0",
75
- "@vitest/coverage-v8": "1.6.0",
76
- "@vitest/ui": "1.6.0",
75
+ "@vitest/coverage-v8": "1.6.1",
76
+ "@vitest/ui": "1.6.1",
77
77
  "cors": "^2.8.5",
78
78
  "emittery": "^1.1.0",
79
79
  "eslint": "8.57.1",
@@ -86,11 +86,11 @@
86
86
  "tsdown": "^0.10.2",
87
87
  "tsx": "^4.19.3",
88
88
  "typescript-eslint": "8.22.0",
89
- "vite": "5.2.9",
89
+ "vite": "5.4.20",
90
90
  "vite-bundle-visualizer": "1.1.0",
91
91
  "vite-plugin-compression2": "1.0.0",
92
92
  "vite-plugin-dts": "4.0.3",
93
- "vitest": "1.6.0",
93
+ "vitest": "1.6.1",
94
94
  "vitest-sonar-reporter": "2.0.0"
95
95
  },
96
96
  "peerDependencies": {