@transitive-sdk/utils-web 0.12.3 → 0.12.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/client/hooks.jsx +1 -1
- package/dist/utils-web.js +11 -9
- package/package.json +1 -1
package/client/hooks.jsx
CHANGED
|
@@ -224,7 +224,7 @@ export const useCapability = ({ capability, name, userId, deviceId,
|
|
|
224
224
|
listeners[name] = [done];
|
|
225
225
|
|
|
226
226
|
const baseUrl = `http${ssl ? 's' : ''}://portal.${host}`;
|
|
227
|
-
const params = new URLSearchParams({userId, deviceId});
|
|
227
|
+
const params = new URLSearchParams({ userId, deviceId });
|
|
228
228
|
// filename without extension as we'll try multiple
|
|
229
229
|
const fileBasename = `${baseUrl}/running/${capability}/dist/${name}`;
|
|
230
230
|
|
package/dist/utils-web.js
CHANGED
|
@@ -729,25 +729,27 @@ var require_MqttSync = __commonJS({
|
|
|
729
729
|
if (this.heartbeats == 1 && !migrate && onReady)
|
|
730
730
|
onReady();
|
|
731
731
|
this.heartbeats++;
|
|
732
|
-
} else
|
|
732
|
+
} else {
|
|
733
|
+
const json = mqttParsePayload(payload);
|
|
733
734
|
let path = topicToPath2(topic);
|
|
734
735
|
log2.debug("processing message", topic, path);
|
|
735
736
|
if (sliceTopic) {
|
|
736
737
|
path = path.slice(sliceTopic);
|
|
737
738
|
topic = pathToTopic2(path);
|
|
738
739
|
}
|
|
739
|
-
const json = mqttParsePayload(payload);
|
|
740
740
|
if (this.rpcHandlers[topic]) {
|
|
741
741
|
this.handleRPCRequest(topic, json);
|
|
742
742
|
} else if (this.rpcCallbacks[topic]) {
|
|
743
743
|
this.handleRPCResponse(topic, json);
|
|
744
|
-
} else if (
|
|
745
|
-
this.
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
744
|
+
} else if (packet.retain || ignoreRetain) {
|
|
745
|
+
if (this.isPublished(topic)) {
|
|
746
|
+
this.publishedMessages.updateFromArray([...path, specialKey], json);
|
|
747
|
+
this.data.update(topic, json, { external: true });
|
|
748
|
+
} else if (this.isSubscribed(topic)) {
|
|
749
|
+
log2.debug("applying received update", topic);
|
|
750
|
+
const changes = this.data.update(topic, json);
|
|
751
|
+
onChange && Object.keys(changes).length > 0 && onChange(changes);
|
|
752
|
+
}
|
|
751
753
|
}
|
|
752
754
|
}
|
|
753
755
|
});
|