portkey-admin-mcp 0.3.3 → 0.3.4
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/build/index.js +3 -1
- package/build/server.js +17 -3
- package/package.json +1 -1
package/build/index.js
CHANGED
package/build/server.js
CHANGED
|
@@ -242,7 +242,9 @@ var BaseService = class {
|
|
|
242
242
|
requestId,
|
|
243
243
|
method,
|
|
244
244
|
path,
|
|
245
|
-
metadata: {
|
|
245
|
+
metadata: {
|
|
246
|
+
paramKeys: options.params ? Object.keys(options.params) : []
|
|
247
|
+
}
|
|
246
248
|
});
|
|
247
249
|
try {
|
|
248
250
|
const response = await fetchWithTimeout(url, {
|
|
@@ -8637,6 +8639,15 @@ function getServerConfig() {
|
|
|
8637
8639
|
// src/lib/event-store.ts
|
|
8638
8640
|
import { createClient } from "redis";
|
|
8639
8641
|
var EVENT_STORE_CLEANUP_INTERVAL_MS = 3e4;
|
|
8642
|
+
var SAFE_EVENT_ID_PATTERN = /^[\w-]{1,128}$/;
|
|
8643
|
+
function assertSafeRedisId(id, kind) {
|
|
8644
|
+
if (!SAFE_EVENT_ID_PATTERN.test(id)) {
|
|
8645
|
+
throw new Error(
|
|
8646
|
+
`Invalid ${kind} for event store key: ${JSON.stringify(id)}`
|
|
8647
|
+
);
|
|
8648
|
+
}
|
|
8649
|
+
return id;
|
|
8650
|
+
}
|
|
8640
8651
|
var InMemoryEventStore = class {
|
|
8641
8652
|
sequence = 0;
|
|
8642
8653
|
ttlMs;
|
|
@@ -8763,10 +8774,10 @@ var RedisEventStore = class {
|
|
|
8763
8774
|
return `${this.keyPrefix}:counter`;
|
|
8764
8775
|
}
|
|
8765
8776
|
eventKey(eventId) {
|
|
8766
|
-
return `${this.keyPrefix}:event:${eventId}`;
|
|
8777
|
+
return `${this.keyPrefix}:event:${assertSafeRedisId(eventId, "eventId")}`;
|
|
8767
8778
|
}
|
|
8768
8779
|
streamEventsKey(streamId) {
|
|
8769
|
-
return `${this.keyPrefix}:stream:${streamId}:events`;
|
|
8780
|
+
return `${this.keyPrefix}:stream:${assertSafeRedisId(streamId, "streamId")}:events`;
|
|
8770
8781
|
}
|
|
8771
8782
|
async ensureConnected() {
|
|
8772
8783
|
if (this.client.isOpen) {
|
|
@@ -8800,6 +8811,9 @@ var RedisEventStore = class {
|
|
|
8800
8811
|
return eventId;
|
|
8801
8812
|
}
|
|
8802
8813
|
async getStreamIdForEventId(eventId) {
|
|
8814
|
+
if (!SAFE_EVENT_ID_PATTERN.test(eventId)) {
|
|
8815
|
+
return void 0;
|
|
8816
|
+
}
|
|
8803
8817
|
await this.ensureConnected();
|
|
8804
8818
|
const streamId = await this.client.hGet(this.eventKey(eventId), "streamId");
|
|
8805
8819
|
return streamId || void 0;
|