Comparing version 1.1.0 to 1.1.1
@@ -74,2 +74,3 @@ /** | ||
protected initMap(value?: T): void; | ||
private readonly findActivatedNode; | ||
} |
@@ -32,2 +32,14 @@ "use strict"; | ||
var _this = this; | ||
this.findActivatedNode = function (hi) { | ||
/* istanbul ignore if */ | ||
if (!hi) { | ||
// NOTES: this should not happen | ||
// the root-node is always activated and all other nodes should have a valid trigger-node (`triggerHook`) | ||
return _this.idHookMap.get(ROOT_ID); | ||
} | ||
if (hi.activated) { | ||
return hi; | ||
} | ||
return _this.findActivatedNode(hi.triggerHook); | ||
}; | ||
this.initMap(); | ||
@@ -41,3 +53,3 @@ this.hookFuncs = { | ||
// NOTES: this should not happen | ||
// nodeproc._rawDebug(`init: id: ${id}: WARNING: triggerId is not defined`); | ||
nodeproc._rawDebug("init: id: " + id + ": WARNING: triggerId is not defined"); | ||
triggerId = _this._currId; | ||
@@ -52,12 +64,2 @@ } | ||
} | ||
else { | ||
while (triggerHook.type === 'PROMISE' && !triggerHook.activated && | ||
_this.idHookMap.has(triggerHook.triggerId)) { | ||
// NOTES: this is expected | ||
// nodeproc._rawDebug( | ||
// `init: id: ${id}: WARNING: changing trigger from ${triggerId} to ${triggerHook.triggerId}`); | ||
triggerId = triggerHook.triggerId; | ||
triggerHook = _this.idHookMap.get(triggerId); | ||
} | ||
} | ||
_this.idHookMap.set(id, { id: id, type: type, triggerId: triggerId, oriTriggerId: oriTriggerId, triggerHook: triggerHook, activated: false }); | ||
@@ -73,3 +75,8 @@ // this.debugId('init', id); | ||
if (!hi.activated) { | ||
hi.data = hi.triggerHook ? hi.triggerHook.data : undefined; | ||
var ancestor = _this.findActivatedNode(hi.triggerHook); | ||
if (ancestor) { | ||
hi.triggerHook = ancestor; | ||
hi.triggerId = ancestor.id; | ||
hi.data = ancestor.data; | ||
} | ||
} | ||
@@ -76,0 +83,0 @@ hi.activated = true; |
{ | ||
"name": "asyncctx", | ||
"version": "1.1.0", | ||
"version": "1.1.01", | ||
"description": "an asynchronous execution context for TypeScript/JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -55,2 +55,3 @@ [](https://badge.fury.io/js/asyncctx) | ||
| --------- | --------------------------------------------------------------------------------------- | | ||
| 1.1.01 | fixed loosing context; thanks to Pasi Tuominen | | ||
| 2.0.00 | targeting es6; dropped support for nodejs < v8 | | ||
@@ -57,0 +58,0 @@ | | please use asyncctx@<2.0 for nodejs v4 - v11 support | |
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
111310
2533
68