Gathering detailed insights and metrics for @mondaydotcomorg/node-execution-context
Gathering detailed insights and metrics for @mondaydotcomorg/node-execution-context
Gathering detailed insights and metrics for @mondaydotcomorg/node-execution-context
Gathering detailed insights and metrics for @mondaydotcomorg/node-execution-context
npm install @mondaydotcomorg/node-execution-context
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
37 Stars
11 Commits
5 Forks
14 Watchers
2 Branches
13 Contributors
Updated on Mar 18, 2025
Latest Version
1.0.4
Package Id
@mondaydotcomorg/node-execution-context@1.0.4
Unpacked Size
15.84 kB
Size
4.73 kB
File Count
12
NPM Version
6.11.2
Node Version
8.12.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
A simple, straightforward library that allows you to create persistent request-level execution context using the async_hooks module that will be accessible anywhere in the code scoped to the current request you're handling at any given moment.
$ npm install @mondaydotcomorg/node-execution-context
or with yarn:
$ yarn add @mondaydotcomorg/node-execution-context
Let's create a service that will use our library in order to create and get context.
1const contextProvider = require('@mondaydotcomorg/node-execution-context'); 2 3function createExecutionContext(contextData) { 4 contextProvider.createExecutionContext(contextData); 5}; 6 7function getExecutionContext() { 8 const context = contextProvider.getExecutionContext(); 9 return context; 10}; 11 12module.exports = { 13 getExecutionContext, 14 createExecutionContext 15};
Now wherever we want in our code we can pass an object to createExecutionContext and it will be saved and accesible for any async resources descendant from that place forward.
For example let's do this in a middleware that is the first thing that runs on a new request.
1const executionContextService = require('services/execution-context-service'); 2 3async function authenticationMiddleware(req, res, next) { 4 const { accountPermissions } = req.body 5 6 executionContextService.createExecutionContext({ 7 accountPermissions, 8 method: req.method, 9 }); 10 11 next(); 12}
Now we can use this context later and be certain that the request being handled is the same one for which we are getting our context.
1const executionContextService = require('services/execution-context-service'); 2const eventModelService = require('services/event-model-service'); 3 4async function createNewEvent(eventData) { 5 const { accountPermissions } = executionContextService.getExecutionContext(); 6 eventModelService.createEvent(accountPermissions, eventData); 7}
Creates an execution context identified by the asyncId of the current asyncResource. This will be available anywhere in the execution that is inside the async chain of this resource. Context passed must be an object. You cannot create an execution context twice within the same async resource. If you want to update after creation use set ot update. This check will fail only in non-prod environments for performance purposes.
Optional Params: traceOptions can be passed if you want to set some initial trace data into the trace and have the context add a trace detailing async Id and resource type each time context is updated. If you do not pass this object the trace is never created. This can be used for debugging or for enriching logs, however should not be passed if not needed as this will be added fro every async resource created.
Returns only the context object given as the first param to createExecutionContext.
Returns only the trace array collected if enabled in traceOptions.
Returns entire context data including both context object and trace array.
Allows you to completly override context saved for current async resource.
Allows you update specific keys in the context saved for current async resource.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/10 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
31 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More