![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@mesg/application
Advanced tools
[Website](https://mesg.com/) - [Docs](https://docs.mesg.com/) - [Forum](https://forum.mesg.com/) - [Chat](https://discordapp.com/invite/SaZ5HcE) - [Blog](https://blog.mesg.com)
Website - Docs - Forum - Chat - Blog
This library lets you connect to the MESG engine to listen for any event or result that you might be interested too. It also allows you to execute a task, either synchronously or asynchronously.
npm install @mesg/application
Require mesg-js as an application:
const Application = require('@mesg/application')
const mesg = new Application()
By default, the library connects to the MESG Engine from the endpoint localhost:50052
.
Instead of hard-coding runnerHash
in your application's env, your application can resolve dynamically using the service's SID.
const runnerHash = await mesg.resolveRunner('SID_OF_THE_SERVICE')
const result = await mesg.executeTaskAndWaitResult({
executorHash: runnerHash,
.....
})
Listen events from a service.
const instanceHash = await mesg.resolve('SID_OF_THE_SERVICE')
mesg.listenEvent({
filter: {
instanceHash: instanceHash,
key: 'EVENT_KEY' // optional
}
})
.on('data', (event) => {
console.log('an event received:', event.key, mesg.decodeData(event.data))
})
Listen results from a service.
const runnerHash = await mesg.resolveRunner('SID_OF_THE_SERVICE')
mesg.listenResult({
filter: {
executorHash: runnerHash,
taskKey: 'TASK_KEY_FILTER', // optional
tags: ['TAG_FILTER'] // optional
}
})
.on('data', (result) => {
if (result.error) {
console.error('an error has occurred:', result.error)
return
}
console.log('a result received:', mesg.decodeData(result.outputs))
})
Execute task on a service.
const runnerHash = await mesg.resolveRunner('SID_OF_THE_SERVICE')
const execution = await mesg.executeTask({
executorHash: runnerHash,
eventHash: event.hash,
taskKey: 'TASK_KEY',
inputs: mesg.encodeData({ key: 'INPUT_DATA' }),
tags: ['ASSOCIATE_TAG'] // optional
})
console.log('task in progress with execution:', execution.hash)
Execute task on a service and wait for its result.
This can be considered as a shortcut for using both executeTask()
and listenResult()
at same time.
const runnerHash = await mesg.resolveRunner('SID_OF_THE_SERVICE')
const result = await mesg.executeTaskAndWaitResult({
executorHash: runnerHash,
eventHash: event.hash,
taskKey: 'TASK_KEY',
inputs: mesg.encodeData({ key: 'INPUT_DATA' }),
tags: ['ASSOCIATE_TAG'] // optional
})
if (result.error) {
console.error('an error has occurred:', result.error)
throw new Error(result.error)
}
console.log('a result received:', mesg.decodeData(result.outputs))
FAQs
[Website](https://mesg.com/) - [Docs](https://docs.mesg.com/) - [Forum](https://forum.mesg.com/) - [Chat](https://discordapp.com/invite/SaZ5HcE) - [Blog](https://blog.mesg.com)
The npm package @mesg/application receives a total of 2 weekly downloads. As such, @mesg/application popularity was classified as not popular.
We found that @mesg/application demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.