@mastra/redis 1.4.12-alpha.0 → 1.4.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.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +9 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -18
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { MastraStorage, MemoryStorage, RunFenceConflictError, ScoresStorage, TAB
|
|
|
4
4
|
import { saveScorePayloadSchema } from "@mastra/core/evals";
|
|
5
5
|
import { createClient } from "redis";
|
|
6
6
|
import { MastraServerCache } from "@mastra/core/cache";
|
|
7
|
-
|
|
7
|
+
// src/storage/domains/utils.ts
|
|
8
8
|
/**
|
|
9
9
|
* Generate a Redis key from table name and key parts.
|
|
10
10
|
*
|
|
@@ -48,8 +48,7 @@ function processRecord(tableName, record) {
|
|
|
48
48
|
processedRecord
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
//#region src/storage/db/index.ts
|
|
51
|
+
// src/storage/db/index.ts
|
|
53
52
|
var RedisDB = class {
|
|
54
53
|
client;
|
|
55
54
|
constructor({ client }) {
|
|
@@ -129,8 +128,7 @@ var RedisDB = class {
|
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
};
|
|
132
|
-
|
|
133
|
-
//#region src/storage/domains/run-fencing.ts
|
|
131
|
+
// src/storage/domains/run-fencing.ts
|
|
134
132
|
/**
|
|
135
133
|
* A claim expires after this long without a claim, renewal or release, and a
|
|
136
134
|
* fence this long after it was retired. A running execution renews every few
|
|
@@ -360,8 +358,7 @@ function writeBatch(client, check) {
|
|
|
360
358
|
async function assertRunFence(client, check) {
|
|
361
359
|
if (check) await new FencedWriteBatch(client, check).exec();
|
|
362
360
|
}
|
|
363
|
-
|
|
364
|
-
//#region src/storage/domains/memory/index.ts
|
|
361
|
+
// src/storage/domains/memory/index.ts
|
|
365
362
|
var StoreMemoryRedis = class extends MemoryStorage {
|
|
366
363
|
supportsPartialThreadUpdate = true;
|
|
367
364
|
client;
|
|
@@ -1292,8 +1289,7 @@ function getMessageScore(message) {
|
|
|
1292
1289
|
const index = typeof message._index === "number" ? message._index : 0;
|
|
1293
1290
|
return createdAtScore * 1e3 + index;
|
|
1294
1291
|
}
|
|
1295
|
-
|
|
1296
|
-
//#region src/storage/domains/scores/index.ts
|
|
1292
|
+
// src/storage/domains/scores/index.ts
|
|
1297
1293
|
/** Returns true when a row matches the multi-tenant scope filters (or none provided). */
|
|
1298
1294
|
function matchesTenancy(row, filters) {
|
|
1299
1295
|
if (filters?.organizationId !== void 0 && row.organizationId !== filters.organizationId) return false;
|
|
@@ -1443,8 +1439,7 @@ var ScoresRedis = class extends ScoresStorage {
|
|
|
1443
1439
|
};
|
|
1444
1440
|
}
|
|
1445
1441
|
};
|
|
1446
|
-
|
|
1447
|
-
//#region src/storage/domains/workflows/index.ts
|
|
1442
|
+
// src/storage/domains/workflows/index.ts
|
|
1448
1443
|
function parseWorkflowRun(row) {
|
|
1449
1444
|
let parsedSnapshot = row.snapshot;
|
|
1450
1445
|
if (typeof parsedSnapshot === "string") try {
|
|
@@ -1812,16 +1807,14 @@ var WorkflowsRedis = class extends WorkflowsStorage {
|
|
|
1812
1807
|
}
|
|
1813
1808
|
}
|
|
1814
1809
|
};
|
|
1815
|
-
|
|
1816
|
-
//#region src/storage/utils.ts
|
|
1810
|
+
// src/storage/utils.ts
|
|
1817
1811
|
function isClientConfig(config) {
|
|
1818
1812
|
return "client" in config;
|
|
1819
1813
|
}
|
|
1820
1814
|
function isConnectionStringConfig(config) {
|
|
1821
1815
|
return "connectionString" in config;
|
|
1822
1816
|
}
|
|
1823
|
-
|
|
1824
|
-
//#region src/storage/store.ts
|
|
1817
|
+
// src/storage/store.ts
|
|
1825
1818
|
/**
|
|
1826
1819
|
* Redis storage adapter for Mastra.
|
|
1827
1820
|
*
|
|
@@ -1931,8 +1924,7 @@ var RedisStore = class extends MastraStorage {
|
|
|
1931
1924
|
return `redis://${config.host}:${config.port || 6379}/${config.db || 0}`;
|
|
1932
1925
|
}
|
|
1933
1926
|
};
|
|
1934
|
-
|
|
1935
|
-
//#region src/cache.ts
|
|
1927
|
+
// src/cache.ts
|
|
1936
1928
|
const defaultSetWithExpiry = (client, key, value, seconds) => {
|
|
1937
1929
|
return client.set(key, value, "EX", seconds);
|
|
1938
1930
|
};
|
|
@@ -2126,7 +2118,6 @@ const nodeRedisPreset = {
|
|
|
2126
2118
|
arguments: args
|
|
2127
2119
|
})
|
|
2128
2120
|
};
|
|
2129
|
-
//#endregion
|
|
2130
2121
|
export { LIST_PUSH_INDEXED_SCRIPT, RedisServerCache, RedisStore, ScoresRedis, StoreMemoryRedis, WorkflowsRedis, nodeRedisPreset, upstashPreset };
|
|
2131
2122
|
|
|
2132
2123
|
//# sourceMappingURL=index.js.map
|