4 Commits

5 changed files with 68 additions and 56 deletions

View File

@ -1,5 +1,17 @@
# Changelog # Changelog
## 2025-01-19 - 2.1.5 - fix(dependencies)
Update dependencies for improved compatibility
- Updated @types/node to version ^22.10.7
- Updated @types/shortid to version 2.2.0
- Updated simple-async-context to version ^0.0.15
## 2025-01-19 - 2.1.4 - fix(documentation)
Remove unnecessary conclusion section from the README for better clarity.
- Removed the 'Conclusion' header which was redundant in the README.
## 2025-01-19 - 2.1.3 - fix(readme) ## 2025-01-19 - 2.1.3 - fix(readme)
Update README.md for better clarity and examples. Update README.md for better clarity and examples.

View File

@ -1,6 +1,6 @@
{ {
"name": "@push.rocks/smartcontext", "name": "@push.rocks/smartcontext",
"version": "2.1.3", "version": "2.1.5",
"description": "A module providing advanced asynchronous context management to enrich logs with context and manage scope effectively in Node.js applications.", "description": "A module providing advanced asynchronous context management to enrich logs with context and manage scope effectively in Node.js applications.",
"exports": { "exports": {
".": "./dist_ts/index.js" ".": "./dist_ts/index.js"
@ -20,14 +20,14 @@
"@git.zone/tstest": "^1.0.57", "@git.zone/tstest": "^1.0.57",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/tapbundle": "^5.0.4", "@push.rocks/tapbundle": "^5.0.4",
"@types/node": "^18.11.18" "@types/node": "^22.10.7"
}, },
"dependencies": { "dependencies": {
"@push.rocks/lik": "^6.0.0", "@push.rocks/lik": "^6.0.0",
"@push.rocks/smartcls": "^1.0.9", "@push.rocks/smartcls": "^1.0.9",
"@push.rocks/smartunique": "^3.0.3", "@push.rocks/smartunique": "^3.0.3",
"@types/shortid": "0.0.29", "@types/shortid": "2.2.0",
"simple-async-context": "^0.0.13" "simple-async-context": "^0.0.15"
}, },
"private": false, "private": false,
"browserslist": [ "browserslist": [

98
pnpm-lock.yaml generated
View File

@ -18,11 +18,11 @@ importers:
specifier: ^3.0.3 specifier: ^3.0.3
version: 3.0.9 version: 3.0.9
'@types/shortid': '@types/shortid':
specifier: 0.0.29 specifier: 2.2.0
version: 0.0.29 version: 2.2.0
simple-async-context: simple-async-context:
specifier: ^0.0.13 specifier: ^0.0.15
version: 0.0.13 version: 0.0.15
devDependencies: devDependencies:
'@git.zone/tsbuild': '@git.zone/tsbuild':
specifier: ^2.1.27 specifier: ^2.1.27
@ -43,8 +43,8 @@ importers:
specifier: ^5.0.4 specifier: ^5.0.4
version: 5.5.4(@aws-sdk/credential-providers@3.731.1)(socks@2.8.3) version: 5.5.4(@aws-sdk/credential-providers@3.731.1)(socks@2.8.3)
'@types/node': '@types/node':
specifier: ^18.11.18 specifier: ^22.10.7
version: 18.19.71 version: 22.10.7
packages: packages:
@ -1422,8 +1422,8 @@ packages:
'@types/node-forge@1.3.11': '@types/node-forge@1.3.11':
resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==}
'@types/node@18.19.71': '@types/node@22.10.7':
resolution: {integrity: sha512-evXpcgtZm8FY4jqBSN8+DmOTcVkkvTmAayeo4Wf3m1xAruyVGzGuDh/Fb/WWX2yLItUiho42ozyJjB0dw//Tkw==} resolution: {integrity: sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==}
'@types/parse5@6.0.3': '@types/parse5@6.0.3':
resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}
@ -1455,8 +1455,8 @@ packages:
'@types/serve-static@1.15.7': '@types/serve-static@1.15.7':
resolution: {integrity: sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==} resolution: {integrity: sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==}
'@types/shortid@0.0.29': '@types/shortid@2.2.0':
resolution: {integrity: sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=} resolution: {integrity: sha512-jBG2FgBxcaSf0h662YloTGA32M8UtNbnTPekUr/eCmWXq0JWQXgNEQ/P5Gf05Cv66QZtE1Ttr83I1AJBPdzCBg==}
'@types/sinon-chai@3.2.12': '@types/sinon-chai@3.2.12':
resolution: {integrity: sha512-9y0Gflk3b0+NhQZ/oxGtaAJDvRywCa5sIyaVnounqLvmf93yBF4EgIRspePtkMs3Tr844nCclYMlcCNmLCvjuQ==} resolution: {integrity: sha512-9y0Gflk3b0+NhQZ/oxGtaAJDvRywCa5sIyaVnounqLvmf93yBF4EgIRspePtkMs3Tr844nCclYMlcCNmLCvjuQ==}
@ -3643,8 +3643,8 @@ packages:
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
engines: {node: '>=14'} engines: {node: '>=14'}
simple-async-context@0.0.13: simple-async-context@0.0.15:
resolution: {integrity: sha512-dD45zmw9HBlSyWVQJ38VTP5RpuVED8zIiwHrouimeHxDIlNxt66j+iWHQIvbTrsd1SnWVRaLwbPvsVsy+rfjpw==} resolution: {integrity: sha512-NJKVyA89zo0LVAPy2AjeVndjh/gWQhI9F2mnZvhQSbxithPJpbKOd6YA5VOsy90QIE7TV3bhzHNpod2EgMCmWw==}
simple-swizzle@0.2.2: simple-swizzle@0.2.2:
resolution: {integrity: sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=} resolution: {integrity: sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=}
@ -3922,8 +3922,8 @@ packages:
unbzip2-stream@1.4.3: unbzip2-stream@1.4.3:
resolution: {integrity: sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==} resolution: {integrity: sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==}
undici-types@5.26.5: undici-types@6.20.0:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==}
unified@11.0.5: unified@11.0.5:
resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}
@ -5086,7 +5086,7 @@ snapshots:
'@jest/schemas': 29.6.3 '@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4 '@types/istanbul-reports': 3.0.4
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/yargs': 17.0.33 '@types/yargs': 17.0.33
chalk: 4.1.2 chalk: 4.1.2
@ -6378,14 +6378,14 @@ snapshots:
'@types/accepts@1.3.7': '@types/accepts@1.3.7':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/babel__code-frame@7.0.6': {} '@types/babel__code-frame@7.0.6': {}
'@types/body-parser@1.19.5': '@types/body-parser@1.19.5':
dependencies: dependencies:
'@types/connect': 3.4.38 '@types/connect': 3.4.38
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/buffer-json@2.0.3': {} '@types/buffer-json@2.0.3': {}
@ -6401,17 +6401,17 @@ snapshots:
'@types/clean-css@4.2.11': '@types/clean-css@4.2.11':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
source-map: 0.6.1 source-map: 0.6.1
'@types/co-body@6.1.3': '@types/co-body@6.1.3':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/qs': 6.9.18 '@types/qs': 6.9.18
'@types/connect@3.4.38': '@types/connect@3.4.38':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/content-disposition@0.5.8': {} '@types/content-disposition@0.5.8': {}
@ -6424,11 +6424,11 @@ snapshots:
'@types/connect': 3.4.38 '@types/connect': 3.4.38
'@types/express': 5.0.0 '@types/express': 5.0.0
'@types/keygrip': 1.0.6 '@types/keygrip': 1.0.6
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/cors@2.8.17': '@types/cors@2.8.17':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/debounce@1.2.4': {} '@types/debounce@1.2.4': {}
@ -6442,14 +6442,14 @@ snapshots:
'@types/express-serve-static-core@4.19.6': '@types/express-serve-static-core@4.19.6':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/qs': 6.9.18 '@types/qs': 6.9.18
'@types/range-parser': 1.2.7 '@types/range-parser': 1.2.7
'@types/send': 0.17.4 '@types/send': 0.17.4
'@types/express-serve-static-core@5.0.5': '@types/express-serve-static-core@5.0.5':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/qs': 6.9.18 '@types/qs': 6.9.18
'@types/range-parser': 1.2.7 '@types/range-parser': 1.2.7
'@types/send': 0.17.4 '@types/send': 0.17.4
@ -6474,30 +6474,30 @@ snapshots:
'@types/from2@2.3.5': '@types/from2@2.3.5':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/fs-extra@11.0.4': '@types/fs-extra@11.0.4':
dependencies: dependencies:
'@types/jsonfile': 6.1.4 '@types/jsonfile': 6.1.4
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/fs-extra@9.0.13': '@types/fs-extra@9.0.13':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/glob@7.2.0': '@types/glob@7.2.0':
dependencies: dependencies:
'@types/minimatch': 5.1.2 '@types/minimatch': 5.1.2
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/glob@8.1.0': '@types/glob@8.1.0':
dependencies: dependencies:
'@types/minimatch': 5.1.2 '@types/minimatch': 5.1.2
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/gunzip-maybe@1.4.2': '@types/gunzip-maybe@1.4.2':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/hast@3.0.4': '@types/hast@3.0.4':
dependencies: dependencies:
@ -6531,7 +6531,7 @@ snapshots:
'@types/jsonfile@6.1.4': '@types/jsonfile@6.1.4':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/keygrip@1.0.6': {} '@types/keygrip@1.0.6': {}
@ -6548,7 +6548,7 @@ snapshots:
'@types/http-errors': 2.0.4 '@types/http-errors': 2.0.4
'@types/keygrip': 1.0.6 '@types/keygrip': 1.0.6
'@types/koa-compose': 3.2.8 '@types/koa-compose': 3.2.8
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/mdast@4.0.4': '@types/mdast@4.0.4':
dependencies: dependencies:
@ -6566,11 +6566,11 @@ snapshots:
'@types/node-forge@1.3.11': '@types/node-forge@1.3.11':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/node@18.19.71': '@types/node@22.10.7':
dependencies: dependencies:
undici-types: 5.26.5 undici-types: 6.20.0
'@types/parse5@6.0.3': {} '@types/parse5@6.0.3': {}
@ -6586,22 +6586,22 @@ snapshots:
'@types/s3rver@3.7.4': '@types/s3rver@3.7.4':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/semver@7.5.8': {} '@types/semver@7.5.8': {}
'@types/send@0.17.4': '@types/send@0.17.4':
dependencies: dependencies:
'@types/mime': 1.3.5 '@types/mime': 1.3.5
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/serve-static@1.15.7': '@types/serve-static@1.15.7':
dependencies: dependencies:
'@types/http-errors': 2.0.4 '@types/http-errors': 2.0.4
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/send': 0.17.4 '@types/send': 0.17.4
'@types/shortid@0.0.29': {} '@types/shortid@2.2.0': {}
'@types/sinon-chai@3.2.12': '@types/sinon-chai@3.2.12':
dependencies: dependencies:
@ -6620,11 +6620,11 @@ snapshots:
'@types/tar-stream@2.2.3': '@types/tar-stream@2.2.3':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/through2@2.0.41': '@types/through2@2.0.41':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/triple-beam@1.3.5': {} '@types/triple-beam@1.3.5': {}
@ -6648,7 +6648,7 @@ snapshots:
'@types/whatwg-url@8.2.2': '@types/whatwg-url@8.2.2':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/webidl-conversions': 7.0.3 '@types/webidl-conversions': 7.0.3
'@types/which@2.0.2': {} '@types/which@2.0.2': {}
@ -6657,11 +6657,11 @@ snapshots:
'@types/ws@7.4.7': '@types/ws@7.4.7':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/ws@8.5.13': '@types/ws@8.5.13':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
'@types/yargs-parser@21.0.3': {} '@types/yargs-parser@21.0.3': {}
@ -6671,7 +6671,7 @@ snapshots:
'@types/yauzl@2.10.3': '@types/yauzl@2.10.3':
dependencies: dependencies:
'@types/node': 18.19.71 '@types/node': 22.10.7
optional: true optional: true
'@ungap/structured-clone@1.2.1': {} '@ungap/structured-clone@1.2.1': {}
@ -7256,7 +7256,7 @@ snapshots:
dependencies: dependencies:
'@types/cookie': 0.4.1 '@types/cookie': 0.4.1
'@types/cors': 2.8.17 '@types/cors': 2.8.17
'@types/node': 18.19.71 '@types/node': 22.10.7
accepts: 1.3.8 accepts: 1.3.8
base64id: 2.0.0 base64id: 2.0.0
cookie: 0.4.2 cookie: 0.4.2
@ -7977,7 +7977,7 @@ snapshots:
jest-util@29.7.0: jest-util@29.7.0:
dependencies: dependencies:
'@jest/types': 29.6.3 '@jest/types': 29.6.3
'@types/node': 18.19.71 '@types/node': 22.10.7
chalk: 4.1.2 chalk: 4.1.2
ci-info: 3.9.0 ci-info: 3.9.0
graceful-fs: 4.2.11 graceful-fs: 4.2.11
@ -9190,7 +9190,7 @@ snapshots:
signal-exit@4.1.0: {} signal-exit@4.1.0: {}
simple-async-context@0.0.13: {} simple-async-context@0.0.15: {}
simple-swizzle@0.2.2: simple-swizzle@0.2.2:
dependencies: dependencies:
@ -9493,7 +9493,7 @@ snapshots:
buffer: 5.7.1 buffer: 5.7.1
through: 2.3.8 through: 2.3.8
undici-types@5.26.5: {} undici-types@6.20.0: {}
unified@11.0.5: unified@11.0.5:
dependencies: dependencies:

View File

@ -2,6 +2,8 @@
A module to enrich logs with context, featuring async log contexts and scope management. A module to enrich logs with context, featuring async log contexts and scope management.
Special thanks to Ilias Bhallil for his awesome simple-async-context library.
## Install ## Install
Make sure you have Node.js and npm installed, then run: Make sure you have Node.js and npm installed, then run:
@ -195,8 +197,6 @@ export default tap.start();
``` ```
### Conclusion
With this updated `runScoped` design, theres no need to explicitly instantiate or manage child stores. The context automatically switches from the parent store to the child store while within the callback, then reverts back to the parent store afterwards. This structure makes it easy to: With this updated `runScoped` design, theres no need to explicitly instantiate or manage child stores. The context automatically switches from the parent store to the child store while within the callback, then reverts back to the parent store afterwards. This structure makes it easy to:
- Keep each async operations state isolated - Keep each async operations state isolated

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartcontext', name: '@push.rocks/smartcontext',
version: '2.1.3', version: '2.1.5',
description: 'A module providing advanced asynchronous context management to enrich logs with context and manage scope effectively in Node.js applications.' description: 'A module providing advanced asynchronous context management to enrich logs with context and manage scope effectively in Node.js applications.'
} }