@mastra/lance 1.3.2-alpha.1 → 1.4.0-alpha.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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-rag-vector-databases.md +97 -1
- package/dist/index.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts +2 -4
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -463,7 +463,9 @@ function toRecord(task) {
|
|
|
463
463
|
createdAt: task.createdAt,
|
|
464
464
|
startedAt: task.startedAt ?? /* @__PURE__ */ new Date(0),
|
|
465
465
|
suspendedAt: task.suspendedAt ?? /* @__PURE__ */ new Date(0),
|
|
466
|
-
completedAt: task.completedAt ?? /* @__PURE__ */ new Date(0)
|
|
466
|
+
completedAt: task.completedAt ?? /* @__PURE__ */ new Date(0),
|
|
467
|
+
ownerId: task.ownerId ?? null,
|
|
468
|
+
leaseExpiresAt: task.leaseExpiresAt ?? null
|
|
467
469
|
};
|
|
468
470
|
}
|
|
469
471
|
function fromRecord(row) {
|
|
@@ -479,6 +481,7 @@ function fromRecord(row) {
|
|
|
479
481
|
const startedAt = row.startedAt instanceof Date ? row.startedAt : row.startedAt ? new Date(row.startedAt) : void 0;
|
|
480
482
|
const suspendedAt = row.suspendedAt instanceof Date ? row.suspendedAt : row.suspendedAt ? new Date(row.suspendedAt) : void 0;
|
|
481
483
|
const completedAt = row.completedAt instanceof Date ? row.completedAt : row.completedAt ? new Date(row.completedAt) : void 0;
|
|
484
|
+
const leaseExpiresAt = row.leaseExpiresAt instanceof Date ? row.leaseExpiresAt : row.leaseExpiresAt ? new Date(row.leaseExpiresAt) : void 0;
|
|
482
485
|
return {
|
|
483
486
|
id: String(row.id),
|
|
484
487
|
status: String(row.status),
|
|
@@ -498,7 +501,9 @@ function fromRecord(row) {
|
|
|
498
501
|
createdAt: row.createdAt instanceof Date ? row.createdAt : new Date(row.createdAt),
|
|
499
502
|
startedAt: startedAt && startedAt.getTime() > 0 ? startedAt : void 0,
|
|
500
503
|
suspendedAt: suspendedAt && suspendedAt.getTime() > 0 ? suspendedAt : void 0,
|
|
501
|
-
completedAt: completedAt && completedAt.getTime() > 0 ? completedAt : void 0
|
|
504
|
+
completedAt: completedAt && completedAt.getTime() > 0 ? completedAt : void 0,
|
|
505
|
+
ownerId: row.ownerId != null && row.ownerId !== "" ? String(row.ownerId) : void 0,
|
|
506
|
+
leaseExpiresAt
|
|
502
507
|
};
|
|
503
508
|
}
|
|
504
509
|
function escapeStr(val) {
|
|
@@ -521,7 +526,12 @@ var StoreBackgroundTasksLance = class extends BackgroundTasksStorage {
|
|
|
521
526
|
await this.#db.alterTable({
|
|
522
527
|
tableName: TABLE_BACKGROUND_TASKS,
|
|
523
528
|
schema: TABLE_SCHEMAS[TABLE_BACKGROUND_TASKS],
|
|
524
|
-
ifNotExists: [
|
|
529
|
+
ifNotExists: [
|
|
530
|
+
"suspend_payload",
|
|
531
|
+
"suspendedAt",
|
|
532
|
+
"ownerId",
|
|
533
|
+
"leaseExpiresAt"
|
|
534
|
+
]
|
|
525
535
|
});
|
|
526
536
|
}
|
|
527
537
|
async dangerouslyClearAll() {
|
|
@@ -540,9 +550,13 @@ var StoreBackgroundTasksLance = class extends BackgroundTasksStorage {
|
|
|
540
550
|
if ("startedAt" in update) values.startedAt = update.startedAt?.getTime() ?? 0;
|
|
541
551
|
if ("suspendedAt" in update) values.suspendedAt = update.suspendedAt?.getTime() ?? 0;
|
|
542
552
|
if ("completedAt" in update) values.completedAt = update.completedAt?.getTime() ?? 0;
|
|
553
|
+
if ("ownerId" in update) values.ownerId = update.ownerId ?? null;
|
|
554
|
+
if ("leaseExpiresAt" in update) values.leaseExpiresAt = update.leaseExpiresAt?.getTime() ?? null;
|
|
543
555
|
if (Object.keys(values).length === 0) return false;
|
|
544
556
|
const conditions = [`id = '${escapeStr(taskId)}'`];
|
|
545
557
|
if (options?.expectedStatus) conditions.push(`status = '${escapeStr(options.expectedStatus)}'`);
|
|
558
|
+
if (options?.expectedOwnerId !== void 0) conditions.push(options.expectedOwnerId === null ? "ownerId IS NULL" : `ownerId = '${escapeStr(options.expectedOwnerId)}'`);
|
|
559
|
+
if (options?.expectedLeaseExpiresAt !== void 0) conditions.push(options.expectedLeaseExpiresAt === null ? "leaseExpiresAt IS NULL" : `leaseExpiresAt = ${options.expectedLeaseExpiresAt.getTime()}`);
|
|
546
560
|
return (await (await this.client.openTable(TABLE_BACKGROUND_TASKS)).update({
|
|
547
561
|
where: conditions.join(" AND "),
|
|
548
562
|
values
|