@blamejs/core 0.9.28 → 0.9.38

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.
package/lib/tracing.js CHANGED
@@ -304,6 +304,41 @@ function create(opts) {
304
304
  return span(name, fn, sopts);
305
305
  }
306
306
 
307
+ // Start a span with manual end() lifecycle. Used by b.agent.trace
308
+ // when the caller needs to hold the span across an async boundary
309
+ // (queue publish → consumer pickup) that span(name, fn) can't model.
310
+ // Real OTel path uses tracer.startSpan + setSpan context; passthrough
311
+ // uses the same underlying tracer.startSpan + manual stack push/pop.
312
+ function manualSpan(name, sopts) {
313
+ if (typeof name !== "string" || name.length === 0) {
314
+ throw new TracingError("tracing/bad-name",
315
+ "span name must be a non-empty string");
316
+ }
317
+ sopts = sopts || {};
318
+ var tracer = _tracer();
319
+ var otel = _getOtel();
320
+ var spanInst = tracer.startSpan(name, otel ? {
321
+ kind: _kindFromString(otel, sopts.kind),
322
+ attributes: sopts.attributes,
323
+ } : sopts);
324
+ if (sopts.attributes && typeof spanInst.setAttributes === "function") {
325
+ try { spanInst.setAttributes(sopts.attributes); }
326
+ catch (_e) { /* best-effort */ }
327
+ }
328
+ var ended = false;
329
+ var origEnd = spanInst.end ? spanInst.end.bind(spanInst) : function () {};
330
+ spanInst.end = function () {
331
+ if (ended) return;
332
+ ended = true;
333
+ try { tracer._pop && tracer._pop(); } // allow:try-catch-non-error — passthrough tracer lifecycle
334
+ catch (_e) { /* best-effort */ }
335
+ try { origEnd(); }
336
+ catch (_e) { /* best-effort */ }
337
+ };
338
+ if (tracer._push) tracer._push(spanInst);
339
+ return spanInst;
340
+ }
341
+
307
342
  function currentSpan() {
308
343
  var otel = _getOtel();
309
344
  if (otel) {
@@ -428,6 +463,7 @@ function create(opts) {
428
463
  var registry = {
429
464
  span: span,
430
465
  spanSync: spanSync,
466
+ manualSpan: manualSpan,
431
467
  currentSpan: currentSpan,
432
468
  setAttributes: setAttributes,
433
469
  recordException: recordException,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/core",
3
- "version": "0.9.28",
3
+ "version": "0.9.38",
4
4
  "description": "The Node framework that owns its stack.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "blamejs contributors",
package/sbom.cdx.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
3
3
  "bomFormat": "CycloneDX",
4
4
  "specVersion": "1.6",
5
- "serialNumber": "urn:uuid:16ede553-d8b4-4690-b8b3-506468a16e3f",
5
+ "serialNumber": "urn:uuid:6b9a6fd7-b1f8-4d51-9ad8-b6edd98b31e5",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-05-15T00:18:30.842Z",
8
+ "timestamp": "2026-05-15T09:16:43.370Z",
9
9
  "lifecycles": [
10
10
  {
11
11
  "phase": "build"
@@ -19,14 +19,14 @@
19
19
  }
20
20
  ],
21
21
  "component": {
22
- "bom-ref": "@blamejs/core@0.9.28",
22
+ "bom-ref": "@blamejs/core@0.9.38",
23
23
  "type": "library",
24
24
  "name": "blamejs",
25
- "version": "0.9.28",
25
+ "version": "0.9.38",
26
26
  "scope": "required",
27
27
  "author": "blamejs contributors",
28
28
  "description": "The Node framework that owns its stack.",
29
- "purl": "pkg:npm/%40blamejs/core@0.9.28",
29
+ "purl": "pkg:npm/%40blamejs/core@0.9.38",
30
30
  "properties": [],
31
31
  "externalReferences": [
32
32
  {
@@ -54,7 +54,7 @@
54
54
  "components": [],
55
55
  "dependencies": [
56
56
  {
57
- "ref": "@blamejs/core@0.9.28",
57
+ "ref": "@blamejs/core@0.9.38",
58
58
  "dependsOn": []
59
59
  }
60
60
  ]