@ngn-net/nestjs-telescope 0.3.13 → 0.3.15
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/ui/index.html +9 -1
- package/dist/ui/manifest.json +2 -2
- package/dist/watchers/rabbitmq.watcher.js +50 -13
- package/package.json +1 -1
- package/ui/index.html +9 -1
package/dist/ui/index.html
CHANGED
|
@@ -896,7 +896,15 @@
|
|
|
896
896
|
const [totalEntries, setTotalEntries] = useState(0);
|
|
897
897
|
const [perPage, setPerPage] = useState(50);
|
|
898
898
|
|
|
899
|
-
const prefixPath =
|
|
899
|
+
const prefixPath = (() => {
|
|
900
|
+
const path = window.location.pathname;
|
|
901
|
+
// Detect the telescope base path from the URL
|
|
902
|
+
// e.g. /telescope → 'telescope', /api/telescope → 'api/telescope'
|
|
903
|
+
const segments = path.split('/').filter(Boolean);
|
|
904
|
+
const telescopeIdx = segments.findIndex(s => s === 'telescope');
|
|
905
|
+
if (telescopeIdx === -1) return 'telescope';
|
|
906
|
+
return segments.slice(0, telescopeIdx + 1).join('/');
|
|
907
|
+
})();
|
|
900
908
|
|
|
901
909
|
// Load entries when dependencies change
|
|
902
910
|
useEffect(() => {
|
package/dist/ui/manifest.json
CHANGED
|
@@ -69,35 +69,72 @@ try {
|
|
|
69
69
|
return result;
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
// Patch
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
AmqpConnection.prototype.
|
|
76
|
-
const
|
|
77
|
-
|
|
72
|
+
// Patch setupSubscriberChannel for incoming (subscribe handlers)
|
|
73
|
+
const origSetupSubscriber = AmqpConnection.prototype.setupSubscriberChannel;
|
|
74
|
+
if (origSetupSubscriber) {
|
|
75
|
+
AmqpConnection.prototype.setupSubscriberChannel = async function (handler, msgOptions, channel, originalHandlerName) {
|
|
76
|
+
const queue = msgOptions?.queue || '';
|
|
77
|
+
const exchange = msgOptions?.exchange || '';
|
|
78
|
+
const routingKey = msgOptions?.routingKey || '';
|
|
79
|
+
const wrappedHandler = async (msg, rawMsg, headers) => {
|
|
80
|
+
if (rawMsg && rawMsg.content && telescopeRef) {
|
|
78
81
|
let parsed;
|
|
79
82
|
try {
|
|
80
|
-
parsed = JSON.parse(
|
|
83
|
+
parsed = JSON.parse(rawMsg.content.toString());
|
|
81
84
|
}
|
|
82
85
|
catch {
|
|
83
|
-
parsed =
|
|
86
|
+
parsed = rawMsg.content.toString();
|
|
84
87
|
}
|
|
85
88
|
telescopeRef.record({
|
|
86
89
|
type: entry_type_enum_1.EntryType.RABBITMQ,
|
|
87
90
|
content: {
|
|
88
91
|
direction: 'incoming',
|
|
89
92
|
queue,
|
|
90
|
-
exchange:
|
|
91
|
-
routingKey:
|
|
93
|
+
exchange: rawMsg.fields?.exchange || exchange,
|
|
94
|
+
routingKey: rawMsg.fields?.routingKey || routingKey,
|
|
92
95
|
message: sanitizeMessage(parsed),
|
|
93
|
-
deliveryTag:
|
|
96
|
+
deliveryTag: rawMsg.fields?.deliveryTag,
|
|
97
|
+
handler: originalHandlerName,
|
|
94
98
|
timestamp: new Date().toISOString(),
|
|
95
99
|
},
|
|
96
100
|
}).catch(() => { });
|
|
97
101
|
}
|
|
98
|
-
return handler(msg);
|
|
102
|
+
return handler(msg, rawMsg, headers);
|
|
99
103
|
};
|
|
100
|
-
return
|
|
104
|
+
return origSetupSubscriber.call(this, wrappedHandler, msgOptions, channel, originalHandlerName);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
// Patch setupBatchSubscriberChannel for incoming (batch subscribe handlers)
|
|
108
|
+
const origSetupBatch = AmqpConnection.prototype.setupBatchSubscriberChannel;
|
|
109
|
+
if (origSetupBatch) {
|
|
110
|
+
AmqpConnection.prototype.setupBatchSubscriberChannel = async function (handler, msgOptions, channel) {
|
|
111
|
+
const queue = msgOptions?.queue || '';
|
|
112
|
+
const wrappedHandler = async (msgs, rawMsgs, headers) => {
|
|
113
|
+
if (telescopeRef && rawMsgs && rawMsgs.length > 0) {
|
|
114
|
+
const firstMsg = rawMsgs[0];
|
|
115
|
+
let parsed;
|
|
116
|
+
try {
|
|
117
|
+
parsed = JSON.parse(firstMsg.content.toString());
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
parsed = firstMsg.content.toString();
|
|
121
|
+
}
|
|
122
|
+
telescopeRef.record({
|
|
123
|
+
type: entry_type_enum_1.EntryType.RABBITMQ,
|
|
124
|
+
content: {
|
|
125
|
+
direction: 'incoming',
|
|
126
|
+
queue,
|
|
127
|
+
exchange: firstMsg.fields?.exchange || '',
|
|
128
|
+
routingKey: firstMsg.fields?.routingKey || queue,
|
|
129
|
+
message: sanitizeMessage(parsed),
|
|
130
|
+
batchSize: msgs.length,
|
|
131
|
+
timestamp: new Date().toISOString(),
|
|
132
|
+
},
|
|
133
|
+
}).catch(() => { });
|
|
134
|
+
}
|
|
135
|
+
return handler(msgs, rawMsgs, headers);
|
|
136
|
+
};
|
|
137
|
+
return origSetupBatch.call(this, wrappedHandler, msgOptions, channel);
|
|
101
138
|
};
|
|
102
139
|
}
|
|
103
140
|
}
|
package/package.json
CHANGED
package/ui/index.html
CHANGED
|
@@ -896,7 +896,15 @@
|
|
|
896
896
|
const [totalEntries, setTotalEntries] = useState(0);
|
|
897
897
|
const [perPage, setPerPage] = useState(50);
|
|
898
898
|
|
|
899
|
-
const prefixPath =
|
|
899
|
+
const prefixPath = (() => {
|
|
900
|
+
const path = window.location.pathname;
|
|
901
|
+
// Detect the telescope base path from the URL
|
|
902
|
+
// e.g. /telescope → 'telescope', /api/telescope → 'api/telescope'
|
|
903
|
+
const segments = path.split('/').filter(Boolean);
|
|
904
|
+
const telescopeIdx = segments.findIndex(s => s === 'telescope');
|
|
905
|
+
if (telescopeIdx === -1) return 'telescope';
|
|
906
|
+
return segments.slice(0, telescopeIdx + 1).join('/');
|
|
907
|
+
})();
|
|
900
908
|
|
|
901
909
|
// Load entries when dependencies change
|
|
902
910
|
useEffect(() => {
|