27 Commits

Author SHA1 Message Date
3d0fc6adc5 2.1.0 2025-01-18 23:52:44 +01:00
d16e3b613c feat(ci): Add GitHub Actions workflows for CI/CD 2025-01-18 23:52:44 +01:00
af18c2f57a update description 2024-05-29 14:11:16 +02:00
9476ad8129 update tsconfig 2024-04-14 13:39:41 +02:00
d1284024d5 update npmextra.json: githost 2024-04-01 21:33:20 +02:00
0114de2690 update npmextra.json: githost 2024-04-01 19:57:28 +02:00
011f8427c1 update npmextra.json: githost 2024-03-30 21:46:24 +01:00
3866cb9580 switch to new org scheme 2023-07-11 00:01:09 +02:00
31140af566 switch to new org scheme 2023-07-10 02:41:36 +02:00
c4b9833145 2.0.0 2023-01-12 11:59:41 +01:00
3c6d217563 BREAKING CHANGE(switch to esm): update 2023-01-12 11:59:41 +01:00
8524299d39 1.0.29 2023-01-12 11:58:35 +01:00
227931b0d3 fix(core): update 2023-01-12 11:58:34 +01:00
e3be31bb93 1.0.28 2021-09-17 19:34:27 +02:00
3babab347f fix(core): update 2021-09-17 19:34:27 +02:00
765b388889 1.0.27 2021-09-17 19:21:35 +02:00
80b0bdd663 fix(core): update 2021-09-17 19:21:34 +02:00
185baac511 1.0.26 2020-07-20 19:55:01 +00:00
2ed9210da9 fix(core): update 2020-07-20 19:55:01 +00:00
7b969943dc 1.0.25 2020-07-20 19:51:10 +00:00
fb8a908a31 fix(core): update 2020-07-20 19:51:09 +00:00
472ca0fcbb 1.0.24 2020-07-20 12:32:14 +00:00
4d47187b1e fix(core): update 2020-07-20 12:32:13 +00:00
e176cadd19 1.0.23 2020-07-20 11:57:20 +00:00
a5dabd17cc fix(core): update 2020-07-20 11:57:20 +00:00
cfe8a5f81a 1.0.22 2018-03-09 00:01:31 +01:00
ea18170427 update license in readme 2018-03-09 00:01:27 +01:00
23 changed files with 10471 additions and 718 deletions

View File

@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -0,0 +1,124 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @ship.zone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

18
.gitignore vendored
View File

@ -1,5 +1,19 @@
.nogit/
node_modules/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
#------# custom

View File

@ -1,95 +0,0 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- trigger
- pages
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
snyk:
stage: security
script:
- npmci command yarn global add snyk
- npmci command yarn install --ignore-scripts
- npmci command snyk test
tags:
- docker
testLEGACY:
stage: test
script:
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci npm prepare
- npmci npm publish
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
script:
- npmci command yarn global add npmpage
- npmci command npmpage
tags:
- docker
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public

11
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

57
changelog.md Normal file
View File

@ -0,0 +1,57 @@
# Changelog
## 2025-01-18 - 2.1.0 - feat(ci)
Add GitHub Actions workflows for CI/CD
- Introduce GitHub Actions workflows to handle CI/CD processes for different events and branch types.
- Remove GitLab CI configuration in favor of GitHub Actions.
- Ensure security audits and tests are run as part of the CI pipeline.
## 2024-05-29 to 2024-03-30 - 2.0.0 - Configuration Updates
Improvements and updates to configuration files.
- Updated project description
- Modified TypeScript configuration
- Updated npmextra.json for githost details
## 2023-07-11 to 2023-07-10 - 2.0.0 - Organizational Change
Transitioned to a new organizational scheme for improved project structure.
- Implemented new organizational scheme
## 2023-01-12 - 1.0.29 - Breaking Change
Important breaking changes introduced, switched project to ECMAScript Module (ESM) format.
- Switched to ECMAScript Module (ESM)
- Core functionality updated
## 2021-09-17 to 2020-07-20 - 1.0.28 to 1.0.23 - Core Fixes
Multiple core improvements and bug fixes across several versions.
- Core functionality updates across versions
## 2018-03-09 to 2018-03-05 - 1.0.21 to 1.0.20 - Documentation Updates
Enhancements and updates to project documentation.
- License information updated in README
- General README updates
## 2018-03-05 - 1.0.19 - Standards Update
Updated project to comply with the latest coding standards.
- Applied latest standard updates
## 2018-03-03 - 1.0.18 - Initial Working Version
Initial release with all dependencies configured.
- First working project version with dependencies
## 2017-10-16 - 1.0.2 - Documentation
Initial project documentation added.
- Added initial README file
## 2017-10-16 - 1.0.1 - Initial Release
The initial release of the project.
- Project setup and initial commit

View File

@ -1,7 +1,31 @@
{
"gitzone": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "logcontext",
"description": "A module providing advanced asynchronous context management to enrich logs with context and manage scope effectively in Node.js applications.",
"npmPackagename": "@push.rocks/logcontext",
"license": "MIT",
"keywords": [
"logging",
"context management",
"context enrichment",
"asynchronous",
"scope management",
"typescript",
"nodejs",
"module",
"async log contexts"
]
}
},
"npmci": {
"npmGlobalTools": [
"npmts"
]
"npmAccessLevel": "public",
"npmGlobalTools": []
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -1,23 +1,67 @@
{
"name": "logcontext",
"version": "1.0.21",
"description": "enrich logs with context",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"name": "@push.rocks/smartcontext",
"version": "2.1.0",
"description": "A module providing advanced asynchronous context management to enrich logs with context and manage scope effectively in Node.js applications.",
"exports": {
".": "./dist_ts/index.js"
},
"type": "module",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(npmts)"
"test": "(tstest test/)",
"build": "(tsbuild --web)",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@types/node": "^9.4.6",
"smartdelay": "^1.0.4",
"tapbundle": "^2.0.0"
"@git.zone/tsbuild": "^2.1.27",
"@git.zone/tsbundle": "^2.0.7",
"@git.zone/tsrun": "^1.2.39",
"@git.zone/tstest": "^1.0.57",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/tapbundle": "^5.0.4",
"@types/node": "^18.11.18"
},
"dependencies": {
"@types/shortid": "^0.0.29",
"lik": "^2.0.5",
"shortid": "^2.2.8",
"smartcls": "^1.0.4"
"@push.rocks/lik": "^6.0.0",
"@push.rocks/smartcls": "^1.0.9",
"@push.rocks/smartunique": "^3.0.3",
"@types/shortid": "0.0.29",
"simple-async-context": "^0.0.13"
},
"private": false,
"browserslist": [
"last 1 chrome versions"
],
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"keywords": [
"logging",
"context management",
"context enrichment",
"asynchronous",
"scope management",
"typescript",
"nodejs",
"module",
"async log contexts"
],
"homepage": "https://code.foss.global/push.rocks/logcontext#readme",
"repository": {
"type": "git",
"url": "git+https://code.foss.global/push.rocks/logcontext.git"
},
"bugs": {
"url": "https://code.foss.global/push.rocks/logcontext/issues"
}
}

9682
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

289
readme.md
View File

@ -1,75 +1,252 @@
# logcontext
enrich logs with context
# @push.rocks/smartcontext
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/logcontext)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/logcontext)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/logcontext)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/logcontext/)
A module to enrich logs with context, featuring async log contexts and scope management.
## Status for master
[![build status](https://GitLab.com/pushrocks/logcontext/badges/master/build.svg)](https://GitLab.com/pushrocks/logcontext/commits/master)
[![coverage report](https://GitLab.com/pushrocks/logcontext/badges/master/coverage.svg)](https://GitLab.com/pushrocks/logcontext/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/logcontext.svg)](https://www.npmjs.com/package/logcontext)
[![Dependency Status](https://david-dm.org/pushrocks/logcontext.svg)](https://david-dm.org/pushrocks/logcontext)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/logcontext/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/logcontext/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/logcontext/badges/code.svg)](https://www.bithound.io/github/pushrocks/logcontext)
[![Known Vulnerabilities](https://snyk.io/test/npm/logcontext/badge.svg)](https://snyk.io/test/npm/logcontext)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Install
To install the `@push.rocks/smartcontext` module, you can use npm. Make sure you have Node.js and npm installed on your system. Navigate to your project directory and run the following command:
```bash
npm install @push.rocks/smartcontext
```
This command will download and install the module and its dependencies into your project's `node_modules` directory.
## Usage
Use TypeScript for best in class instellisense.
the logconext module exposes an easy to use syntax for nodejs style async logcontexts.
The `@push.rocks/smartcontext` module provides an efficient way to enrich your logging with contextual information. It features asynchronous log contexts and scope management, especially useful in complex asynchronous workflows in Node.js applications. This documentation will guide you through its core components: `AsyncContext` and `AsyncStore`.
### Setting Up and Basic Usage
First, import the necessary classes from the module in your TypeScript application:
```typescript
let testLogger = new logcontext.Logger('testNamespace');
import { AsyncContext, AsyncStore } from '@push.rocks/smartcontext';
```
testLogger.scope(async () => {
testLogger.addData('id1', {
someData: 'someValue'
#### Creating a Context
You can create an `AsyncContext` for managing scope-based data sharing. Each context maintains a top-level `AsyncStore` instance. Lets create a simple context and store some data:
```typescript
const mainContext = new AsyncContext();
// Add some data to the store
mainContext.store.add('username', 'john_doe');
mainContext.store.add('role', 'admin');
console.log(mainContext.store.get('username')); // Outputs: 'john_doe'
console.log(mainContext.store.get('role')); // Outputs: 'admin'
```
This `mainContext` acts as a container for contextual data throughout the lifecycle of your application or a specific code block.
### Scoping with `runScoped`
The `runScoped` method allows you to run a function within a specific child `AsyncStore` scope. This is vital for isolating child data during asynchronous operations, while still having access to any relevant parent data:
```typescript
await mainContext.runScoped(async (childStore: AsyncStore) => {
childStore.add('transactionId', 'txn_123456');
console.log(childStore.get('transactionId')); // Outputs: 'txn_123456'
// Child store can also access data from the parent context:
console.log(childStore.get('username')); // Outputs: 'john_doe'
console.log(childStore.get('role')); // Outputs: 'admin'
});
```
Changes made within this child store do not leak back to the parent unless explicitly intended.
#### Isolating Data in Scoped Functions
Data added within a child scope is only stored locally, unless you decide to propagate it to the parent. Additionally, you can delete data in the child without affecting the parent:
```typescript
await mainContext.runScoped(async (childStore: AsyncStore) => {
childStore.add('temporaryData', 'tempValue');
console.log(childStore.get('temporaryData')); // Outputs: 'tempValue'
// Delete data in child scope
childStore.delete('temporaryData');
console.log(childStore.get('temporaryData')); // Outputs: undefined
});
```
In this example, `temporaryData` is never propagated to the parent. Once deleted within the scope, its gone for that child context.
### Advanced Usage
Below are some patterns to demonstrate more advanced scenarios.
#### Handling Complex Asynchronous Flows
Consider a scenario where you process a list of user requests asynchronously, assigning each request its own temporary data:
```typescript
import { AsyncContext } from '@push.rocks/smartcontext';
import { v4 as uuidv4 } from 'uuid';
async function processUserRequests(users: string[], asyncContext: AsyncContext) {
for (const user of users) {
await asyncContext.runScoped(async (childStore: AsyncStore) => {
// Assign a unique request ID
const requestId = uuidv4();
childStore.add('currentUser', user);
childStore.add('requestId', requestId);
console.log(`Processing user: ${childStore.get('currentUser')} with Request ID: ${childStore.get('requestId')}`);
// Simulate an async operation
await new Promise((resolve) => setTimeout(resolve, 1000));
console.log(`Completed processing for user: ${childStore.get('currentUser')}`);
});
}
}
const mainContext = new AsyncContext();
processUserRequests(['alice', 'bob'], mainContext);
```
Each users scope remains neatly contained while still sharing any parent data (if present). This is highly beneficial in servers that handle multiple requests or tasks in parallel.
#### Sharing Data Across Scopes
Occasionally, you may want the child scope to add or modify data that persists in the parent. By default, `childStore` only extends the parent for lookup; changes remain local to the child. If you need truly shared data, you can write data directly to the parent store as well:
```typescript
const newContext = new AsyncContext();
await newContext.runScoped(async (childStore: AsyncStore) => {
// This affects only the child store
childStore.add('childMessage', 'I am a child.');
// Directly manipulate the parent store if needed:
newContext.store.add('parentMessage', 'I am the parent (updated).');
});
// Checking the parent store:
console.log(newContext.store.get('parentMessage')); // Outputs: 'I am the parent (updated)'
console.log(newContext.store.get('childMessage')); // Outputs: undefined (child-only)
```
This approach helps you maintain clarity on what data belongs to the parent vs. a transient child operation.
#### Parallel Scopes
When dealing with parallel asynchronous operations, each scope can be maintained independently. For instance, multiple login operations can be handled by the same parent context yet remain separate at runtime:
```typescript
import { AsyncContext } from '@push.rocks/smartcontext';
const userContext = new AsyncContext();
userContext.store.add('appVersion', '1.2.0');
async function handleUserLogin(userId: string, context: AsyncContext) {
await context.runScoped(async (childStore: AsyncStore) => {
childStore.add('sessionUser', userId);
console.log(`User: ${childStore.get('sessionUser')}, App: ${childStore.get('appVersion')}`);
// More processing for the user...
});
testLogger.log('hi');
testLogger.error(new Error('custom error message'));
setTimeout(() => {
outsideFunction(); // log scope will travel through callbacks and promises
}, 2000);
});
}
let outsideFunction = () => {
// Note:
// the below testLogger reference will have different contexts
// depending from which scope "outsideFunction" was called".
testLogger.log('some message');
};
await Promise.all([
handleUserLogin('user123', userContext),
handleUserLogin('user456', userContext),
]);
```
## class Logger
In this example, the `userContext` store data (like `appVersion`) is accessible within each child scope, but each user session remains isolated. The parents data is shared and read-only for the children, unless children write specifically to the parent context.
#### Error Handling and Context-Enriched Logging
By leveraging contextual data, your logs can capture additional diagnostic details automatically:
```typescript
import { Logger } from 'logcontext';
async function performTaskWithLogging(taskId: string, context: AsyncContext) {
try {
await context.runScoped(async (childStore: AsyncStore) => {
childStore.add('taskId', taskId);
// Simulate some failing operation
throw new Error('Task failed due to unexpected error');
});
} catch (error) {
console.error(`[Error] Task ID: ${context.store.get('taskId')}, Error: ${error.message}`);
}
}
// instantiate new Logger
// argument optional, if left empty auto generated shortid will be used
let myLogger = new Logger('myNamespace');
// create a scope
myLogger.scope(async () => {
// everything that is appended to the call stack from inside here will have all appended context data available
// add some scoped context information
myLogger.addData('customerId', '12345678');
// will log something with priviously appended context of this scope in place
myLoger.log('awesomeText');
});
const loggingContext = new AsyncContext();
performTaskWithLogging('task_789', loggingContext);
```
For further information read the linked docs at the top of this README.
In the example above, we track `taskId` in the context store, ensuring that any error logs or additional logging statements automatically include that identifying information.
> licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
### Managing Contexts Across Modules
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
In large applications, you might want different modules to read or update shared context data without tight coupling between modules. One pattern is to define an `AsyncContext` in a root or shared location and pass it as needed:
```typescript
// main.ts
import { AsyncContext } from '@push.rocks/smartcontext';
import { userModule } from './userModule';
import { billingModule } from './billingModule';
const globalContext = new AsyncContext();
globalContext.store.add('appName', 'SmartContextApp');
userModule(globalContext);
billingModule(globalContext);
```
Then, each module file can utilize that shared context:
```typescript
// userModule.ts
export async function userModule(context: AsyncContext) {
await context.runScoped(async (childStore) => {
childStore.add('moduleName', 'UserModule');
console.log(`[UserModule] appName: ${childStore.get('appName')}`);
});
}
```
```typescript
// billingModule.ts
export async function billingModule(context: AsyncContext) {
await context.runScoped(async (childStore) => {
childStore.add('moduleName', 'BillingModule');
console.log(`[BillingModule] appName: ${childStore.get('appName')}`);
});
}
```
This approach keeps the code cleaner and ensures each module has access to shared data while retaining isolation where needed.
`@push.rocks/smartcontext` equips developers with a sophisticated asynchronous context management system, helping maintain clarity and consistency in logging and context sharing. Heres a recap of the benefits:
- **Scoped Data**: Run logical operations within isolated child scopes, reducing contamination of global or parent-level data.
- **Asynchronous Safety**: Each asynchronous operation can track its own context, preventing race conditions on shared state.
- **Enhanced Logging**: Include relevant contextual data in your logs automatically for easier debugging and tracing.
- **Module-Friendly**: Share contexts without introducing deep module interdependencies.
These features simplify building robust Node.js applications, where concurrency and context tracking can otherwise become unwieldy. Enjoy exploring the breadth of this modules functionality, and tailor it to meet your projects unique challenges.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District Court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

View File

@ -1,53 +1,87 @@
import { expect, tap } from 'tapbundle';
import * as logcontext from '../ts/index';
import * as smartdelay from 'smartdelay';
import { tap, expect } from '@push.rocks/tapbundle';
import { AsyncContext } from '../ts/logcontext.classes.asynccontext.js';
import { AsyncStore } from '../ts/logcontext.classes.asyncstore.js';
let testLogger = new logcontext.Logger('testNamespace');
/**
* This test file demonstrates how to use the AsyncContext and ensures
* that runScoped() properly creates child AsyncStore contexts and merges parent data.
*/
tap.test('should log for .error()', async () => {
testLogger.error(new Error('first error message'));
});
const parentContext = new AsyncContext();
tap.test('should log for .fatal()', async () => {
testLogger.fatal('this is fatal');
});
tap.test('should run a scoped function and add data to a child store', async () => {
// add some default data to the parent store
parentContext.store.add('parentKey', 'parentValue');
expect(parentContext.store.get('parentKey')).toEqual('parentValue');
// set up independent log context
tap.testParallel('should create an async LogContext', async tools => {
testLogger.scope(async () => {
testLogger.logmap.addData('id1', {
someData: 'someValue'
});
await tools.delayFor(10).then(async () => {
testLogger.log('hi');
testLogger.error(new Error('custom error message'));
});
// now run a child scope, add some data, and check that parent's data is still accessible
await parentContext.runScoped(async (childStore: AsyncStore) => {
childStore.add('childKey', 'childValue');
// child should see its own data
expect(childStore.get('childKey')).toEqual('childValue');
// child should also see parent data
expect(childStore.get('parentKey')).toEqual('parentValue');
});
});
tap.testParallel('should create a new scope', async () => {
testLogger.scope(async () => {
testLogger.logmap.addData('id1', {
someData: 'otherValue'
});
testLogger.info('anything');
tap.test('should not contaminate the parent store with child-only data', async () => {
// create a new child scope
await parentContext.runScoped(async (childStore: AsyncStore) => {
childStore.add('temporaryKey', 'temporaryValue');
expect(childStore.get('temporaryKey')).toEqual('temporaryValue');
});
// after the child scope finishes, 'temporaryKey' should not exist in the parent
expect(parentContext.store.get('temporaryKey')).toBeUndefined();
});
tap.test('should allow adding data in multiple scopes independently', async () => {
// add data in first scope
await parentContext.runScoped(async (childStore: AsyncStore) => {
childStore.add('childKey1', 'childValue1');
expect(childStore.get('childKey1')).toEqual('childValue1');
});
// add data in second scope
await parentContext.runScoped(async (childStore: AsyncStore) => {
childStore.add('childKey2', 'childValue2');
expect(childStore.get('childKey2')).toEqual('childValue2');
});
// neither childKey1 nor childKey2 should exist in the parent store
expect(parentContext.store.get('childKey1')).toBeUndefined();
expect(parentContext.store.get('childKey2')).toBeUndefined();
});
tap.test('should allow deleting data in a child store without removing it from the parent store', async () => {
// ensure parent has some data
parentContext.store.add('deletableKey', 'iShouldStayInParent');
await parentContext.runScoped(async (childStore: AsyncStore) => {
// child sees the parent's data
expect(childStore.get('deletableKey')).toEqual('iShouldStayInParent');
// attempt to delete it in the child
childStore.delete('deletableKey');
// child no longer sees it
expect(childStore.get('deletableKey')).toBeUndefined();
// but parent still has it
expect(parentContext.store.get('deletableKey')).toEqual('iShouldStayInParent');
});
});
tap.test('should log within default scope', async tools => {
await tools.delayFor(3000);
testLogger.log('message without context');
});
tap.test('should allow multiple child scopes to share the same parent store data', async () => {
// add a key to the parent store
parentContext.store.add('sharedKey', 'sharedValue');
expect(parentContext.store.get('sharedKey')).toEqual('sharedValue');
tap.test('should not expose memory leak', async tools => {
await tools.checkIterationLeak(async () => {
testLogger.scope(() => {
testLogger.addData(
'someid',
'wow this is an awesome string with a lot of text, so increases actually matter'
);
testLogger.log('hi');
});
// first child scope
await parentContext.runScoped(async (firstChild: AsyncStore) => {
expect(firstChild.get('sharedKey')).toEqual('sharedValue');
});
// second child scope
await parentContext.runScoped(async (secondChild: AsyncStore) => {
expect(secondChild.get('sharedKey')).toEqual('sharedValue');
});
});

8
ts/00_commitinfo_data.ts Normal file
View File

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

View File

@ -1 +1 @@
export * from './logcontext.classes.logger';
export * from './logcontext.classes.asynccontext.js';

View File

@ -0,0 +1,13 @@
import * as plugins from './logcontext.plugins.js';
import { AsyncStore } from './logcontext.classes.asyncstore.js';
export class AsyncContext {
private context = new plugins.simpleAsyncContext.AsyncContext.Variable<AsyncStore>();
public store = new AsyncStore();
public runScoped(functionArg: (storeArg: AsyncStore) => Promise<void>) {
this.context.run(this.store, async () => {
const childStore = new AsyncStore(this.store);
functionArg(childStore)
});
}
}

View File

@ -0,0 +1,50 @@
import * as plugins from './logcontext.plugins.js';
export class AsyncStore {
private parentStore?: AsyncStore;
private deletedKeys: string[] = [];
private dataObject: {[key: string]: any} = {};
constructor(parentStore?: AsyncStore) {
this.parentStore = parentStore;
}
private cleanUp() {
for (const key of this.deletedKeys) {
if (this.parentStore && this.parentStore.get(key)) {
// ok still valid
} else {
delete this.deletedKeys[key];
}
}
}
public add(keyArg: string, objectArg: any) {
this.cleanUp();
if (this.deletedKeys.includes(keyArg)) {
this.deletedKeys = this.deletedKeys.filter((key) => key !== keyArg);
}
this.dataObject[keyArg] = objectArg;
}
public delete(paramName: string) {
this.cleanUp();
if (this.parentStore.get(paramName)) {
this.deletedKeys.push(paramName);
}
delete this.dataObject[paramName];
}
public get(paramName: string) {
this.cleanUp();
if (this.deletedKeys.includes(paramName)) {
return undefined;
}
return this.dataObject[paramName] || this.parentStore?.get(paramName);
}
public getAll() {
this.cleanUp();
return {...this.dataObject, ...(this.parentStore?.getAll() || {})};
}
}

View File

@ -1,124 +0,0 @@
import * as plugins from './logcontext.plugins';
import { LogMap } from './logcontext.classes.logmap';
export class Logger {
namespaceString: string;
clsNameSpace: plugins.smartcls.Namespace;
logmap: LogMap;
thirdPartyLogger: any;
child: any;
settings = {
enableScope: () => {
this.settingsParams.scope = true;
},
disableScope: () => {
this.settingsParams.scope = false;
},
enableAddData: () => {
this.settingsParams.addData = true;
},
disableAddData: () => {
this.settingsParams.addData = false;
}
};
private settingsParams: { scope: boolean; addData: boolean } = {
scope: true,
addData: true
};
constructor(namespaceArg: string = plugins.shortid()) {
this.namespaceString = namespaceArg;
this.clsNameSpace = plugins.smartcls.createNamespace(this.namespaceString);
this.logmap = new LogMap(this.clsNameSpace);
}
addData(paramNameArg: string, dataArg: any) {
if (this.settingsParams.addData) {
this.logmap.addData(paramNameArg, dataArg);
}
}
addThirdPartyLogger(thirdPartyLoggerArg) {
this.thirdPartyLogger = thirdPartyLoggerArg;
}
/**
* debug
* @param logMessageArg
*/
debug(logMessageArg) {
this.routeLog('debug', logMessageArg);
}
/**
* log
* @param logMessageArg
*/
log(logMessageArg) {
this.routeLog('log', logMessageArg);
}
/**
* info
* @param logObjectArg
*/
info(logObjectArg) {
this.routeLog('info', logObjectArg);
}
/**
* error
* @param logMessageArg
* @param args
*/
error(logMessageArg, ...args) {
this.routeLog('error', logMessageArg, ...args);
}
/**
* warn
* @param logMessageArg
* @param args
*/
warn(logMessageArg, ...args) {
this.routeLog('warn', logMessageArg, ...args);
}
/**
* fatal
* @param logMessageArg
* @param args
*/
fatal(logMessageArg, ...args) {
this.routeLog('fatal', logMessageArg, ...args);
}
// creates a new async scope
scope(funcArg: any) {
// create node continuation scope
if (this.settingsParams.scope) {
this.clsNameSpace.run(funcArg);
} else {
funcArg();
}
}
/**
* routes the log according to whats available in the environment
* @param {string} logMethod
* @param {any} message
* @param {any[]} ...args
*/
private routeLog(logMethod, message, ...args) {
let logObject = {
message: message,
type: logMethod,
logContext: this.logmap.getAllData()
};
if (this.thirdPartyLogger && this.thirdPartyLogger[logMethod]) {
this.thirdPartyLogger[logMethod](logObject, ...args);
} else {
console.log(logObject);
}
}
}

View File

@ -1,34 +0,0 @@
import * as plugins from './logcontext.plugins';
import { Namespace } from 'smartcls';
import { Stringmap } from 'lik';
export class LogMap {
clsNamespace: Namespace;
paramMap = new plugins.lik.Stringmap();
constructor(clsNamespaceArg: Namespace) {
this.clsNamespace = clsNamespaceArg;
}
addData(paramName: string, logData) {
this.paramMap.addString(paramName);
this.clsNamespace.set(paramName, logData);
}
deleteData(paramName: string) {
this.clsNamespace.set(paramName, null);
}
getData(paramName: string) {
return this.clsNamespace.get(paramName);
}
getAllData() {
let returnObject = {};
for (let stringArg of this.paramMap.getStringArray()) {
returnObject[stringArg] = this.clsNamespace.get(stringArg);
}
return returnObject;
}
}

View File

@ -1,7 +1,10 @@
import 'typings-global';
// pushrocks scope
import * as lik from '@push.rocks/lik';
import * as smartunique from '@push.rocks/smartunique';
import * as lik from 'lik';
import * as smartcls from 'smartcls';
import * as shortid from 'shortid';
export { lik, smartunique };
export { lik, smartcls, shortid };
// third party scope
import simpleAsyncContext from 'simple-async-context';
export { simpleAsyncContext };

16
tsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"baseUrl": ".",
"paths": {}
},
"exclude": [
"dist_*/**/*.d.ts"
]
}

View File

@ -1,3 +0,0 @@
{
"extends": "tslint-config-standard"
}

341
yarn.lock
View File

@ -1,341 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@types/chai-as-promised@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.0.tgz#010b04cde78eacfb6e72bfddb3e58fe23c2e78b9"
dependencies:
"@types/chai" "*"
"@types/chai-string@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.4.0.tgz#c8b78deb9ae53e86c05a446c256138faeaff53c1"
dependencies:
"@types/chai" "*"
"@types/chai@*", "@types/chai@^4.1.2":
version "4.1.2"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.2.tgz#f1af664769cfb50af805431c407425ed619daa21"
"@types/continuation-local-storage@^3.2.1":
version "3.2.1"
resolved "https://registry.yarnpkg.com/@types/continuation-local-storage/-/continuation-local-storage-3.2.1.tgz#a33e0df9dce9b424d1c98fc4fdebd8578dceec7e"
dependencies:
"@types/node" "*"
"@types/lodash@^4.14.97":
version "4.14.104"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.104.tgz#53ee2357fa2e6e68379341d92eb2ecea4b11bb80"
"@types/minimatch@^3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
"@types/node@*", "@types/node@^9.4.6":
version "9.4.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.4.6.tgz#d8176d864ee48753d053783e4e463aec86b8d82e"
"@types/shortid@^0.0.29":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/shortid/-/shortid-0.0.29.tgz#8093ee0416a6e2bf2aa6338109114b3fbffa0e9b"
ansi-256-colors@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
assertion-error@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
async-listener@^0.6.0:
version "0.6.9"
resolved "https://registry.yarnpkg.com/async-listener/-/async-listener-0.6.9.tgz#51bc95e41095417f33922fb4dee4f232b3226488"
dependencies:
semver "^5.3.0"
shimmer "^1.1.0"
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
beautycolor@^1.0.7:
version "1.0.11"
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.11.tgz#71c5568d5a7ed5c144d3a54f753ad1b08862aea5"
dependencies:
ansi-256-colors "^1.1.0"
typings-global "^1.0.14"
bindings@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
chai-as-promised@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.1.tgz#08645d825deb8696ee61725dbf590c012eb00ca0"
dependencies:
check-error "^1.0.2"
chai-string@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.4.0.tgz#359140c051d36a4e4b1a5fc6b910152f438a8d49"
chai@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c"
dependencies:
assertion-error "^1.0.1"
check-error "^1.0.1"
deep-eql "^3.0.0"
get-func-name "^2.0.0"
pathval "^1.0.0"
type-detect "^4.0.0"
check-error@^1.0.1, check-error@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
continuation-local-storage@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/continuation-local-storage/-/continuation-local-storage-3.2.1.tgz#11f613f74e914fe9b34c92ad2d28fe6ae1db7ffb"
dependencies:
async-listener "^0.6.0"
emitter-listener "^1.1.1"
deep-eql@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df"
dependencies:
type-detect "^4.0.0"
define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
dependencies:
foreach "^2.0.5"
object-keys "^1.0.8"
early@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
dependencies:
beautycolor "^1.0.7"
smartq "^1.1.1"
typings-global "^1.0.16"
emitter-listener@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/emitter-listener/-/emitter-listener-1.1.1.tgz#e8bbbe8244bc8e0d0b4ef71cd14294c7f241c7ec"
dependencies:
shimmer "^1.2.0"
es-abstract@^1.5.1:
version "1.10.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.1"
has "^1.0.1"
is-callable "^1.1.3"
is-regex "^1.0.4"
es-to-primitive@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
dependencies:
is-callable "^1.1.1"
is-date-object "^1.0.1"
is-symbol "^1.0.1"
es6-error@^4.0.2:
version "4.1.1"
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
foreach@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
function-bind@^1.0.2, function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
get-func-name@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
has@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
dependencies:
function-bind "^1.0.2"
is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2"
is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
is-regex@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
dependencies:
has "^1.0.1"
is-symbol@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
leakage@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
dependencies:
es6-error "^4.0.2"
left-pad "^1.1.3"
memwatch-next "^0.3.0"
minimist "^1.2.0"
pretty-bytes "^4.0.2"
left-pad@^1.1.3:
version "1.2.0"
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee"
lik@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/lik/-/lik-2.0.5.tgz#1338a3201828b557fa91a5b8a6013743ff720e10"
dependencies:
"@types/lodash" "^4.14.97"
"@types/minimatch" "^3.0.3"
lodash "^4.17.4"
minimatch "^3.0.4"
smartq "^1.1.6"
symbol-tree "^3.2.2"
lodash@^4.17.4:
version "4.17.5"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
memwatch-next@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
dependencies:
bindings "^1.2.1"
nan "^2.3.2"
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
brace-expansion "^1.1.7"
minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
nan@^2.3.2:
version "2.9.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.9.2.tgz#f564d75f5f8f36a6d9456cca7a6c4fe488ab7866"
object-keys@^1.0.8:
version "1.0.11"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
object.getownpropertydescriptors@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.5.1"
pathval@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0"
pretty-bytes@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
semver@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
shimmer@^1.1.0, shimmer@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shimmer/-/shimmer-1.2.0.tgz#f966f7555789763e74d8841193685a5e78736665"
shortid@^2.2.8:
version "2.2.8"
resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.8.tgz#033b117d6a2e975804f6f0969dbe7d3d0b355131"
smartchai@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-2.0.1.tgz#d20f17221f0e3c6c3473600b78ddfba0ab0ea762"
dependencies:
"@types/chai" "^4.1.2"
"@types/chai-as-promised" "^7.1.0"
"@types/chai-string" "^1.4.0"
chai "^4.1.2"
chai-as-promised "^7.1.1"
chai-string "^1.4.0"
smartcls@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/smartcls/-/smartcls-1.0.4.tgz#d0acba1356748a560d9c1fac2ce9d7c890fe98bf"
dependencies:
"@types/continuation-local-storage" "^3.2.1"
continuation-local-storage "^3.2.1"
smartdelay@^1.0.3, smartdelay@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.4.tgz#791c1a4ee6770494064c10b1d2d2b8e6f3105b82"
dependencies:
smartq "^1.1.1"
typings-global "^1.0.16"
smartq@^1.1.1, smartq@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
dependencies:
typings-global "^1.0.19"
util.promisify "^1.0.0"
symbol-tree@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6"
tapbundle@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-2.0.0.tgz#79fce68ff185c786fabaf6eb589a4afc7d2714b7"
dependencies:
early "^2.1.1"
leakage "^0.3.0"
smartchai "^2.0.0"
smartdelay "^1.0.3"
smartq "^1.1.1"
type-detect@^4.0.0:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19:
version "1.0.28"
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.28.tgz#e28cc965476564cbc00e438739e0aa0735d323d4"
util.promisify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
dependencies:
define-properties "^1.1.2"
object.getownpropertydescriptors "^2.0.3"