Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot 18cf0fd19c chore(release): 0.0.2-develop.5 [skip ci]
## [0.0.2-develop.5](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.4...v0.0.2-develop.5) (2023-07-05)

### Bug Fixes

* need to loop over all protomux message args and await any promises ([3a4cfd4](3a4cfd45a6))
2023-07-05 03:05:21 +00:00
Derrick Hammer af224e742a
Merge remote-tracking branch 'origin/develop' into develop 2023-07-04 23:04:01 -04:00
Derrick Hammer 3a4cfd45a6
fix: need to loop over all protomux message args and await any promises 2023-07-04 23:03:49 -04:00
4 changed files with 26 additions and 4 deletions

View File

@ -1,3 +1,10 @@
## [0.0.2-develop.5](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.4...v0.0.2-develop.5) (2023-07-05)
### Bug Fixes
* need to loop over all protomux message args and await any promises ([3a4cfd4](https://git.lumeweb.com/LumeWeb/kernel-swarm/commit/3a4cfd45a6515fac5a4205d0c2503864efbd33bf))
## [0.0.2-develop.4](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.3...v0.0.2-develop.4) (2023-07-05) ## [0.0.2-develop.4](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.3...v0.0.2-develop.4) (2023-07-05)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@lumeweb/kernel-swarm", "name": "@lumeweb/kernel-swarm",
"version": "0.0.2-develop.4", "version": "0.0.2-develop.5",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@lumeweb/kernel-swarm", "name": "@lumeweb/kernel-swarm",
"version": "0.0.2-develop.4", "version": "0.0.2-develop.5",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"@lumeweb/hyperswarm-web": "0.0.2-develop.7", "@lumeweb/hyperswarm-web": "0.0.2-develop.7",

View File

@ -38,6 +38,6 @@
"patch-package": "^7.0.0", "patch-package": "^7.0.0",
"presetter": "*" "presetter": "*"
}, },
"version": "0.0.2-develop.4", "version": "0.0.2-develop.5",
"readme": "ERROR: No README data found!" "readme": "ERROR: No README data found!"
} }

View File

@ -576,10 +576,17 @@ async function handleCreateProtomuxMessage(aq: ActiveQuery) {
}); });
if (data.onmessage) { if (data.onmessage) {
data.onmessage = (...args: any) => { data.onmessage = async (...args: any) => {
for (let i = 0; i < args.length; i++) {
if (isPromise(args[i])) {
args[i] = await args[i];
}
}
args = args.filter( args = args.filter(
(item: any) => item?.constructor.name.toLowerCase() !== "channel", (item: any) => item?.constructor.name.toLowerCase() !== "channel",
); );
aq.sendUpdate({ aq.sendUpdate({
action: "onmessage", action: "onmessage",
args, args,
@ -622,3 +629,11 @@ function getSwarmToSwarmId(swarm: any) {
} }
function noop() {} function noop() {}
function isPromise(obj: Promise<any>) {
return (
!!obj &&
(typeof obj === "object" || typeof obj === "function") &&
typeof obj.then === "function"
);
}