@transitive-sdk/utils-web 0.16.0 → 0.16.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/utils-web.js +13 -6
  2. package/package.json +1 -1
package/dist/utils-web.js CHANGED
@@ -406,8 +406,10 @@ var require_common = __commonJS({
406
406
  callback && callback(count);
407
407
  }, delay);
408
408
  };
409
- var storageRequestToSelector = (topic) => pathToTopic2(topicToPath2(topic).map((value) => value == "$store" ? "+" : value).map((value) => value == "$storeTail" ? "#" : value));
410
- var selectorToStorageRequest = (topic) => pathToTopic2(topicToPath2(topic).map((value) => value[0] == "+" ? "$store" : value).map((value) => value[0] == "#" ? "$storeTail" : value));
409
+ var metaPathToSelectorPath = (path) => path.map((value) => value[0] == "$" ? decodeURIComponent(value.slice(1)) : value);
410
+ var metaTopicToSelector = (topic) => pathToTopic2(metaPathToSelectorPath(topicToPath2(topic)));
411
+ var selectorPathToMetaPath = (path) => path.map((value) => ["+", "#"].includes(value[0]) ? `$${encodeURIComponent(value)}` : value);
412
+ var selectorToMetaTopic = (topic) => pathToTopic2(selectorPathToMetaPath(topicToPath2(topic)));
411
413
  var getRandomId = (bytes = 6) => {
412
414
  const buffer = new Uint8Array(bytes);
413
415
  crypto.getRandomValues(buffer);
@@ -497,8 +499,11 @@ var require_common = __commonJS({
497
499
  tryJSONParse,
498
500
  decodeJWT: decodeJWT3,
499
501
  visitAncestor,
500
- storageRequestToSelector,
501
- selectorToStorageRequest
502
+ // storageRequestToSelector, selectorToStorageRequest
503
+ metaPathToSelectorPath,
504
+ selectorPathToMetaPath,
505
+ metaTopicToSelector,
506
+ selectorToMetaTopic
502
507
  };
503
508
  }
504
509
  });
@@ -718,7 +723,7 @@ var require_MqttSync = __commonJS({
718
723
  encodeTopicElement,
719
724
  visitAncestor,
720
725
  getRandomId,
721
- selectorToStorageRequest
726
+ selectorPathToMetaPath
722
727
  } = require_common();
723
728
  var { DataCache } = require_DataCache();
724
729
  var log2 = getLogger2("MqttSync");
@@ -1307,7 +1312,9 @@ var require_MqttSync = __commonJS({
1307
1312
  * service is running -- as it usually is inside the
1308
1313
  * transitiverobotics/clickhouse docker image). */
1309
1314
  requestHistoryStorage(topic, ttl = 1) {
1310
- const storageRequest = selectorToStorageRequest(topic);
1315
+ const path = selectorPathToMetaPath(topicToPath2(topic));
1316
+ path.splice(5, 0, "$store");
1317
+ const storageRequest = pathToTopic2(path);
1311
1318
  this.mqtt.publish(storageRequest, String(ttl), { retain: true });
1312
1319
  }
1313
1320
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transitive-sdk/utils-web",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Web utils for the Transitive framework",
5
5
  "homepage": "https://transitiverobotics.com",
6
6
  "repository": {