@btravstack/amqp-worker 0.11.0 → 0.12.0
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/dist/index.cjs +1 -12
- package/dist/index.mjs +1 -12
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -62,7 +62,7 @@ const messageUnits = (host, observers) => (args, next) => {
|
|
|
62
62
|
const metaFor = (raw) => {
|
|
63
63
|
const id = (0, node_crypto.randomUUID)();
|
|
64
64
|
const parent = raw.properties.headers?.["traceparent"];
|
|
65
|
-
const fromParent = typeof parent === "string" ? traceIdOfTraceparent(parent) : void 0;
|
|
65
|
+
const fromParent = typeof parent === "string" ? (0, _btravstack_core.traceIdOfTraceparent)(parent) : void 0;
|
|
66
66
|
const inbound = [raw.properties.messageId, raw.properties.correlationId].map((value) => value?.trim() ?? "").find((value) => value !== "");
|
|
67
67
|
return {
|
|
68
68
|
kind: "delivery",
|
|
@@ -70,17 +70,6 @@ const metaFor = (raw) => {
|
|
|
70
70
|
traceId: fromParent ?? inbound ?? id
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
|
-
/**
|
|
74
|
-
* The trace id inside a W3C `traceparent` header, which outranks `messageId`
|
|
75
|
-
* because it is the one value minted to span processes. Only the trace-id field
|
|
76
|
-
* is taken: `traceId` is a correlation id, not a span context, so the parent's
|
|
77
|
-
* span id is dropped rather than half-carried. The all-zero id is the spec's own
|
|
78
|
-
* "invalid" and is refused like a malformed header.
|
|
79
|
-
*/
|
|
80
|
-
const traceIdOfTraceparent = (header) => {
|
|
81
|
-
const traceId = /^[\da-f]{2}-([\da-f]{32})-[\da-f]{16}-[\da-f]{2}$/.exec(header.trim())?.[1];
|
|
82
|
-
return traceId === void 0 || /^0{32}$/.test(traceId) ? void 0 : traceId;
|
|
83
|
-
};
|
|
84
73
|
//#endregion
|
|
85
74
|
//#region src/amqp-runtime.ts
|
|
86
75
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Module, Port, Provider } from "@btravstack/di";
|
|
2
2
|
import { TypedAmqpWorker } from "@amqp-contract/worker";
|
|
3
3
|
import { Config, Env } from "@btravstack/config";
|
|
4
|
-
import { Observers, RuntimePort, RuntimeStartFailed, noObserver, observe, releasedBy } from "@btravstack/core";
|
|
4
|
+
import { Observers, RuntimePort, RuntimeStartFailed, noObserver, observe, releasedBy, traceIdOfTraceparent } from "@btravstack/core";
|
|
5
5
|
import { P } from "unthrown";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
//#region src/handler.ts
|
|
@@ -69,17 +69,6 @@ const metaFor = (raw) => {
|
|
|
69
69
|
traceId: fromParent ?? inbound ?? id
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
/**
|
|
73
|
-
* The trace id inside a W3C `traceparent` header, which outranks `messageId`
|
|
74
|
-
* because it is the one value minted to span processes. Only the trace-id field
|
|
75
|
-
* is taken: `traceId` is a correlation id, not a span context, so the parent's
|
|
76
|
-
* span id is dropped rather than half-carried. The all-zero id is the spec's own
|
|
77
|
-
* "invalid" and is refused like a malformed header.
|
|
78
|
-
*/
|
|
79
|
-
const traceIdOfTraceparent = (header) => {
|
|
80
|
-
const traceId = /^[\da-f]{2}-([\da-f]{32})-[\da-f]{16}-[\da-f]{2}$/.exec(header.trim())?.[1];
|
|
81
|
-
return traceId === void 0 || /^0{32}$/.test(traceId) ? void 0 : traceId;
|
|
82
|
-
};
|
|
83
72
|
//#endregion
|
|
84
73
|
//#region src/amqp-runtime.ts
|
|
85
74
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btravstack/amqp-worker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "The AMQP starter for @btravstack/core: the handlers as a port, one unit per delivery, and a drain the kernel's deadline releases",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"amqp",
|
|
@@ -57,19 +57,19 @@
|
|
|
57
57
|
"unthrown": "5.7.0",
|
|
58
58
|
"vitest": "4.1.11",
|
|
59
59
|
"zod": "4.5.3",
|
|
60
|
-
"@btravstack/config": "0.
|
|
61
|
-
"@btravstack/core": "0.
|
|
62
|
-
"@btravstack/di": "0.
|
|
60
|
+
"@btravstack/config": "0.12.0",
|
|
61
|
+
"@btravstack/core": "0.12.0",
|
|
62
|
+
"@btravstack/di": "0.12.0",
|
|
63
63
|
"@btravstack/internal-test-infra": "0.0.0",
|
|
64
|
-
"@btravstack/testing": "0.
|
|
64
|
+
"@btravstack/testing": "0.12.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@amqp-contract/worker": "^3.0.0-beta.7",
|
|
68
68
|
"@opentelemetry/api": "^1",
|
|
69
69
|
"unthrown": "^5.0.0",
|
|
70
|
-
"@btravstack/config": "^0.
|
|
71
|
-
"@btravstack/core": "^0.
|
|
72
|
-
"@btravstack/di": "^0.
|
|
70
|
+
"@btravstack/config": "^0.12.0",
|
|
71
|
+
"@btravstack/core": "^0.12.0",
|
|
72
|
+
"@btravstack/di": "^0.12.0"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=22"
|