Skip to content

Commit

Permalink
feat: simplify api, add events iterator (#74)
Browse files Browse the repository at this point in the history
- callbacks input is not `MaybeResult` anymore just the the data directly. Any error parsing from server is emitted async
- add iterator version of network events

closes #71
  • Loading branch information
hugomrdias authored Dec 4, 2023
1 parent 4476e29 commit 653f71f
Show file tree
Hide file tree
Showing 8 changed files with 733 additions and 602 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"devDependencies": {
"@fission-codes/eslint-config": "workspace:^",
"depcheck": "^1.4.7",
"lint-staged": "^15.0.2",
"lint-staged": "^15.2.0",
"prettier": "3.1.0",
"simple-git-hooks": "^2.9.0",
"typedoc": "^0.25.4",
Expand Down
8 changes: 4 additions & 4 deletions packages/homestar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@
"@bytecodealliance/componentize-js": "^0.4.1",
"@types/get-value": "^3.0.5",
"@types/json-templates": "^3.0.3",
"@types/node": "^20.10.0",
"@types/node": "^20.10.3",
"@types/object-path": "^0.11.4",
"execa": "^8.0.1",
"homestar-runtime": "^0.0.8",
"homestar-runtime": "rc",
"iso-base": "^2.0.1",
"kubo-rpc-client": "^3.0.1",
"kubo-rpc-client": "^3.0.2",
"p-defer": "^4.0.0",
"playwright-test": "^14.0.0",
"tempy": "^3.1.0",
"testcontainers": "^10.3.2",
"type-fest": "^4.8.2",
"type-fest": "^4.8.3",
"unws": "^0.2.4",
"ws": "^8.14.2"
},
Expand Down
40 changes: 16 additions & 24 deletions packages/homestar/pw-test.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,17 @@ async function startHomestar(httpPort) {
await fs.writeFile(
config1,
`
[monitoring]
process_collector_interval = 500
console_subscriber_port = 5600
[node]
[node.network.metrics]
port = 4020
[node.network.rpc]
port = 9820
[node.network]
metrics_port = 4060
events_buffer_len = 1000
rpc_port = 9840
webserver_port = 8060
[node.network.webserver]
port = 8020
[node.network.ipfs]
host = '127.0.0.1'
port = ${httpPort}
`
)
Expand All @@ -131,21 +127,17 @@ port = ${httpPort}
await fs.writeFile(
config2,
`
[monitoring]
process_collector_interval = 500
console_subscriber_port = 5600
[node]
[node.network.metrics]
port = 4030
[node.network.rpc]
port = 9830
[node.network]
metrics_port = 4070
events_buffer_len = 1000
rpc_port = 9850
webserver_port = 8070
[node.network.webserver]
port = 8030
[node.network.ipfs]
host = '127.0.0.1'
port = ${httpPort}
`
)
Expand All @@ -159,8 +151,8 @@ port = ${httpPort}
return {
hs1,
hs2,
hs1Url: 'ws://localhost:8060',
hs2Url: 'ws://localhost:8070',
hs1Url: 'ws://127.0.0.1:8020',
hs2Url: 'ws://127.0.0.1:8030',
}
}
/**
Expand Down
4 changes: 4 additions & 0 deletions packages/homestar/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const hs = new Homestar({
}),
})

hs.on('error', (error) => {
console.error(error)
})

const { error, result } = await hs.metrics()
if (error) {
console.error(error)
Expand Down
Loading

0 comments on commit 653f71f

Please sign in to comment.