@mastra/upstash 1.1.0 → 1.1.1-alpha.1
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/CHANGELOG.md +29 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +2 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @mastra/upstash
|
|
2
2
|
|
|
3
|
+
## 1.1.1-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Respect optional `resourceId` in `getThreadById` so scoped thread lookups return `null` when the thread belongs to a different resource. ([#14237](https://github.com/mastra-ai/mastra/pull/14237))
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
const thread = await memory.getThreadById({
|
|
13
|
+
threadId: 'my-thread-id',
|
|
14
|
+
resourceId: 'my-user-id',
|
|
15
|
+
});
|
|
16
|
+
// Returns null if the thread does not belong to 'my-user-id'.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`7c275a8`](https://github.com/mastra-ai/mastra/commit/7c275a810595e1a6c41ccc39720531ab65734700), [`890b24c`](https://github.com/mastra-ai/mastra/commit/890b24cc7d32ed6aa4dfe253e54dc6bf4099f690), [`0f48ebf`](https://github.com/mastra-ai/mastra/commit/0f48ebfc7ac7897b2092a189f45751924cf56d1c), [`f180e49`](https://github.com/mastra-ai/mastra/commit/f180e4990e71b04c9a475b523584071712f0048f), [`f180e49`](https://github.com/mastra-ai/mastra/commit/f180e4990e71b04c9a475b523584071712f0048f), [`9260e01`](https://github.com/mastra-ai/mastra/commit/9260e015276fb1b500f7878ee452b47476bf1583), [`2f6c54e`](https://github.com/mastra-ai/mastra/commit/2f6c54e17c041cac1def54baaa6b771647836414), [`e06a159`](https://github.com/mastra-ai/mastra/commit/e06a1598ca07a6c3778aefc2a2d288363c6294ff), [`db34bc6`](https://github.com/mastra-ai/mastra/commit/db34bc6fb36cf125bda0c46be4d3fdc774b70cc4)]:
|
|
20
|
+
- @mastra/core@1.33.0-alpha.8
|
|
21
|
+
- @mastra/redis@1.1.1-alpha.0
|
|
22
|
+
|
|
23
|
+
## 1.1.1-alpha.0
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Track `suspendedAt` and `suspendPayload` on background tasks. SQL adapters auto-migrate the new columns via `alterTable`. ([#16260](https://github.com/mastra-ai/mastra/pull/16260))
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`9f17410`](https://github.com/mastra-ai/mastra/commit/9f1741080def23d42ee50b39887a385ae316a3c6), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`900d086`](https://github.com/mastra-ai/mastra/commit/900d086bb737b9cf2fcf68f11b0389b801a2738c), [`4c0e286`](https://github.com/mastra-ai/mastra/commit/4c0e28637c9cfb4f416549b55e97ebfa13319dfc), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`aebde9c`](https://github.com/mastra-ai/mastra/commit/aebde9cfacf56592c6b6350cae721740fe090b8a)]:
|
|
30
|
+
- @mastra/core@1.33.0-alpha.4
|
|
31
|
+
|
|
3
32
|
## 1.1.0
|
|
4
33
|
|
|
5
34
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -171,11 +171,13 @@ function toStorageRecord(task) {
|
|
|
171
171
|
args: task.args,
|
|
172
172
|
result: task.result ?? null,
|
|
173
173
|
error: task.error ?? null,
|
|
174
|
+
suspend_payload: task.suspendPayload ?? null,
|
|
174
175
|
retry_count: task.retryCount,
|
|
175
176
|
max_retries: task.maxRetries,
|
|
176
177
|
timeout_ms: task.timeoutMs,
|
|
177
178
|
createdAt: task.createdAt.toISOString(),
|
|
178
179
|
startedAt: task.startedAt?.toISOString() ?? null,
|
|
180
|
+
suspendedAt: task.suspendedAt?.toISOString() ?? null,
|
|
179
181
|
completedAt: task.completedAt?.toISOString() ?? null
|
|
180
182
|
};
|
|
181
183
|
}
|
|
@@ -192,11 +194,13 @@ function fromStorageRecord(record) {
|
|
|
192
194
|
runId: record.run_id ?? "",
|
|
193
195
|
result: record.result ?? void 0,
|
|
194
196
|
error: record.error ?? void 0,
|
|
197
|
+
suspendPayload: record.suspend_payload ?? void 0,
|
|
195
198
|
retryCount: Number(record.retry_count ?? 0),
|
|
196
199
|
maxRetries: Number(record.max_retries ?? 0),
|
|
197
200
|
timeoutMs: Number(record.timeout_ms ?? 3e5),
|
|
198
201
|
createdAt: new Date(record.createdAt),
|
|
199
202
|
startedAt: record.startedAt ? new Date(record.startedAt) : void 0,
|
|
203
|
+
suspendedAt: record.suspendedAt ? new Date(record.suspendedAt) : void 0,
|
|
200
204
|
completedAt: record.completedAt ? new Date(record.completedAt) : void 0
|
|
201
205
|
};
|
|
202
206
|
}
|
|
@@ -224,8 +228,10 @@ var BackgroundTasksUpstash = class extends storage.BackgroundTasksStorage {
|
|
|
224
228
|
if ("status" in update) merged.status = update.status;
|
|
225
229
|
if ("result" in update) merged.result = update.result;
|
|
226
230
|
if ("error" in update) merged.error = update.error;
|
|
231
|
+
if ("suspendPayload" in update) merged.suspendPayload = update.suspendPayload;
|
|
227
232
|
if ("retryCount" in update) merged.retryCount = update.retryCount;
|
|
228
233
|
if ("startedAt" in update) merged.startedAt = update.startedAt;
|
|
234
|
+
if ("suspendedAt" in update) merged.suspendedAt = update.suspendedAt;
|
|
229
235
|
if ("completedAt" in update) merged.completedAt = update.completedAt;
|
|
230
236
|
const record = toStorageRecord(merged);
|
|
231
237
|
const { key, processedRecord } = processRecord(storage.TABLE_BACKGROUND_TASKS, record);
|
|
@@ -265,6 +271,9 @@ var BackgroundTasksUpstash = class extends storage.BackgroundTasksStorage {
|
|
|
265
271
|
if (filter.toolName) {
|
|
266
272
|
tasks = tasks.filter((t) => t.toolName === filter.toolName);
|
|
267
273
|
}
|
|
274
|
+
if (filter.toolCallId) {
|
|
275
|
+
tasks = tasks.filter((t) => t.toolCallId === filter.toolCallId);
|
|
276
|
+
}
|
|
268
277
|
const dateCol = filter.dateFilterBy ?? "createdAt";
|
|
269
278
|
if (filter.fromDate) {
|
|
270
279
|
tasks = tasks.filter((t) => {
|
|
@@ -339,13 +348,16 @@ var StoreMemoryUpstash = class extends storage.MemoryStorage {
|
|
|
339
348
|
await this.#db.deleteData({ tableName: storage.TABLE_MESSAGES });
|
|
340
349
|
await this.#db.deleteData({ tableName: storage.TABLE_RESOURCES });
|
|
341
350
|
}
|
|
342
|
-
async getThreadById({
|
|
351
|
+
async getThreadById({
|
|
352
|
+
threadId,
|
|
353
|
+
resourceId
|
|
354
|
+
}) {
|
|
343
355
|
try {
|
|
344
356
|
const thread = await this.#db.get({
|
|
345
357
|
tableName: storage.TABLE_THREADS,
|
|
346
358
|
keys: { id: threadId }
|
|
347
359
|
});
|
|
348
|
-
if (!thread) return null;
|
|
360
|
+
if (!thread || resourceId !== void 0 && thread.resourceId !== resourceId) return null;
|
|
349
361
|
return {
|
|
350
362
|
...thread,
|
|
351
363
|
createdAt: storage.ensureDate(thread.createdAt),
|