@lensmcp/node-instrumentation 1.18.10 → 1.18.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,8 +5,19 @@
5
5
  * fetch from a service), reading the same ALS at call time yields the
6
6
  * flowId/requestId that stitches the tap event into the request's trace.
7
7
  *
8
- * The module is ESM and this lib is CJS, so the getter is resolved once via
9
- * dynamic import (primed at install; resolved long before the first request).
8
+ * The module is ESM and this lib is CJS, so the getter is resolved via
9
+ * `require(esm)` — SYNCHRONOUSLY, not a dynamic `import()`. This ran fire-
10
+ * and-forget async until it caused a real crash: `install()` runs this at
11
+ * PRELOAD (before the host's bundle even starts), so its dynamic import was
12
+ * still in flight the instant a host's own top-level
13
+ * `require('@lensmcp/nest-instrumentation')` (any Nest service built with
14
+ * `createLensmcpNestApp`) executed moments later — two concurrent loaders
15
+ * (one sync `require`, one async `import()`) racing the SAME not-yet-settled
16
+ * ESM module is exactly what Node's `require(esm)` cannot tolerate, and it
17
+ * threw `ERR_INTERNAL_ASSERTION: Unexpected module status 0` on every boot.
18
+ * A synchronous `require()` here puts BOTH loaders on the same serialized
19
+ * path — the second one just hits Node's module cache — so the race is
20
+ * structurally impossible instead of merely unlikely.
10
21
  */
11
22
  import type { FlowCtx } from './emit';
12
23
  interface LiveCtx {
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var r=(e,t)=>l(e,"name",{value:t,configurable:!0});var o=Object.defineProperty,n=r((e,t)=>o(e,"name",{value:t,configurable:!0}),"n");Object.defineProperty(exports,"__esModule",{value:!0}),exports.primeFlowContext=primeFlowContext,exports.runInFlowContext=runInFlowContext,exports.liveFlowContext=liveFlowContext,exports.flowContext=flowContext;let getCtx=null,runWith=null;function primeFlowContext(){import("@lensmcp/nest-instrumentation").then(e=>{getCtx=e.currentLensmcpContext,runWith=e.runInLensmcpContext}).catch(()=>{})}r(primeFlowContext,"primeFlowContext"),n(primeFlowContext,"primeFlowContext");function runInFlowContext(e,t){if(!runWith)return t();try{return runWith({sessionId:"pending",requestId:e.requestId,...e.flowId?{flowId:e.flowId}:{}},t)}catch{return t()}}r(runInFlowContext,"runInFlowContext"),n(runInFlowContext,"runInFlowContext");function liveFlowContext(){try{return getCtx?.()}catch{return}}r(liveFlowContext,"liveFlowContext"),n(liveFlowContext,"liveFlowContext");function flowContext(){const e=liveFlowContext();if(e)return{...e.flowId?{flowId:e.flowId}:{},...e.requestId?{requestId:e.requestId}:{},...e.originNodeId?{originNodeId:e.originNodeId}:{}}}r(flowContext,"flowContext"),n(flowContext,"flowContext");
1
+ "use strict";var l=Object.defineProperty;var r=(e,t)=>l(e,"name",{value:t,configurable:!0});var o=Object.defineProperty,n=r((e,t)=>o(e,"name",{value:t,configurable:!0}),"n");Object.defineProperty(exports,"__esModule",{value:!0}),exports.primeFlowContext=primeFlowContext,exports.runInFlowContext=runInFlowContext,exports.liveFlowContext=liveFlowContext,exports.flowContext=flowContext;let getCtx=null,runWith=null;function primeFlowContext(){try{const e=require("@lensmcp/nest-instrumentation");getCtx=e.currentLensmcpContext,runWith=e.runInLensmcpContext}catch{}}r(primeFlowContext,"primeFlowContext"),n(primeFlowContext,"primeFlowContext");function runInFlowContext(e,t){if(!runWith)return t();try{return runWith({sessionId:"pending",requestId:e.requestId,...e.flowId?{flowId:e.flowId}:{}},t)}catch{return t()}}r(runInFlowContext,"runInFlowContext"),n(runInFlowContext,"runInFlowContext");function liveFlowContext(){try{return getCtx?.()}catch{return}}r(liveFlowContext,"liveFlowContext"),n(liveFlowContext,"liveFlowContext");function flowContext(){const e=liveFlowContext();if(e)return{...e.flowId?{flowId:e.flowId}:{},...e.requestId?{requestId:e.requestId}:{},...e.originNodeId?{originNodeId:e.originNodeId}:{}}}r(flowContext,"flowContext"),n(flowContext,"flowContext");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/node-instrumentation",
3
- "version": "1.18.10",
3
+ "version": "1.18.12",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -15,7 +15,7 @@
15
15
  }
16
16
  },
17
17
  "dependencies": {
18
- "@lensmcp/nest-instrumentation": "1.18.10",
18
+ "@lensmcp/nest-instrumentation": "1.18.12",
19
19
  "tslib": "^2.3.0"
20
20
  },
21
21
  "optionalDependencies": {