@mastra/dynamodb 1.3.3-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/entities/background-task.d.ts +8 -0
- package/dist/entities/background-task.d.ts.map +1 -1
- package/dist/entities/index.d.ts +8 -0
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/index.cjs +28 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -4
- 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/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-dynamodb
|
|
|
3
3
|
description: Documentation for @mastra/dynamodb. Use when working with @mastra/dynamodb APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/dynamodb"
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.4.0-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -116,6 +116,14 @@ export declare const backgroundTaskEntity: Entity<string, string, string, {
|
|
|
116
116
|
type: "string";
|
|
117
117
|
required: false;
|
|
118
118
|
};
|
|
119
|
+
ownerId: {
|
|
120
|
+
type: "string";
|
|
121
|
+
required: false;
|
|
122
|
+
};
|
|
123
|
+
leaseExpiresAtIso: {
|
|
124
|
+
type: "string";
|
|
125
|
+
required: false;
|
|
126
|
+
};
|
|
119
127
|
};
|
|
120
128
|
indexes: {
|
|
121
129
|
primary: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background-task.d.ts","sourceRoot":"","sources":["../../src/entities/background-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA2BnC,eAAO,MAAM,oBAAoB;;QAE7B,MAAM;QACN,OAAO;QACP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAvBK,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM
|
|
1
|
+
{"version":3,"file":"background-task.d.ts","sourceRoot":"","sources":["../../src/entities/background-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AA2BnC,eAAO,MAAM,oBAAoB;;QAE7B,MAAM;QACN,OAAO;QACP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAvBK,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;0BALN,OAAO;0BAKP,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAkHlB,OAAO;YACL,EAAE;gBAAI,KAAK;gBAAQ,SAAS;;YAC5B,EAAE;gBAAI,KAAK;gBAAQ,SAAS;;;QAE9B,OAAO;YACL,KAAK;YACL,EAAE;gBAAI,KAAK;gBAAY,SAAS;;YAChC,EAAE;gBAAI,KAAK;gBAAY,SAAS;;;QAElC,KAAK;YACH,KAAK;YACL,EAAE;gBAAI,KAAK;gBAAY,SAAS;;YAChC,EAAE;gBAAI,KAAK;gBAAY,SAAS;;;QAElC,QAAQ;YACN,KAAK;YACL,EAAE;gBAAI,KAAK;gBAAY,SAAS;;YAChC,EAAE;gBAAI,KAAK;gBAAY,SAAS;;;;UAGpC,CAAC"}
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -955,6 +955,14 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
|
|
|
955
955
|
type: "string";
|
|
956
956
|
required: false;
|
|
957
957
|
};
|
|
958
|
+
ownerId: {
|
|
959
|
+
type: "string";
|
|
960
|
+
required: false;
|
|
961
|
+
};
|
|
962
|
+
leaseExpiresAtIso: {
|
|
963
|
+
type: "string";
|
|
964
|
+
required: false;
|
|
965
|
+
};
|
|
958
966
|
};
|
|
959
967
|
indexes: {
|
|
960
968
|
primary: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBpF"}
|
package/dist/index.cjs
CHANGED
|
@@ -170,6 +170,14 @@ const backgroundTaskEntity = new electrodb.Entity({
|
|
|
170
170
|
completedAtIso: {
|
|
171
171
|
type: "string",
|
|
172
172
|
required: false
|
|
173
|
+
},
|
|
174
|
+
ownerId: {
|
|
175
|
+
type: "string",
|
|
176
|
+
required: false
|
|
177
|
+
},
|
|
178
|
+
leaseExpiresAtIso: {
|
|
179
|
+
type: "string",
|
|
180
|
+
required: false
|
|
173
181
|
}
|
|
174
182
|
},
|
|
175
183
|
indexes: {
|
|
@@ -1225,7 +1233,9 @@ function toElectroRecord(task) {
|
|
|
1225
1233
|
createdAt: task.createdAt.toISOString(),
|
|
1226
1234
|
startedAtIso: task.startedAt?.toISOString(),
|
|
1227
1235
|
suspendedAtIso: task.suspendedAt?.toISOString(),
|
|
1228
|
-
completedAtIso: task.completedAt?.toISOString()
|
|
1236
|
+
completedAtIso: task.completedAt?.toISOString(),
|
|
1237
|
+
ownerId: task.ownerId ?? void 0,
|
|
1238
|
+
leaseExpiresAtIso: task.leaseExpiresAt?.toISOString()
|
|
1229
1239
|
};
|
|
1230
1240
|
}
|
|
1231
1241
|
function fromElectroRecord(data) {
|
|
@@ -1258,7 +1268,9 @@ function fromElectroRecord(data) {
|
|
|
1258
1268
|
createdAt: asDate(data.createdAt) ?? /* @__PURE__ */ new Date(),
|
|
1259
1269
|
startedAt: asDate(data.startedAtIso),
|
|
1260
1270
|
suspendedAt: asDate(data.suspendedAtIso),
|
|
1261
|
-
completedAt: asDate(data.completedAtIso)
|
|
1271
|
+
completedAt: asDate(data.completedAtIso),
|
|
1272
|
+
ownerId: data.ownerId != null && data.ownerId !== "" ? String(data.ownerId) : void 0,
|
|
1273
|
+
leaseExpiresAt: asDate(data.leaseExpiresAtIso)
|
|
1262
1274
|
};
|
|
1263
1275
|
}
|
|
1264
1276
|
var BackgroundTasksStorageDynamoDB = class extends _mastra_core_storage.BackgroundTasksStorage {
|
|
@@ -1301,6 +1313,10 @@ var BackgroundTasksStorageDynamoDB = class extends _mastra_core_storage.Backgrou
|
|
|
1301
1313
|
else setFields.suspendedAtIso = update.suspendedAt.toISOString();
|
|
1302
1314
|
if ("completedAt" in update) if (update.completedAt === void 0 || update.completedAt === null) removeFields.push("completedAtIso");
|
|
1303
1315
|
else setFields.completedAtIso = update.completedAt.toISOString();
|
|
1316
|
+
if ("ownerId" in update) if (update.ownerId === void 0 || update.ownerId === null) removeFields.push("ownerId");
|
|
1317
|
+
else setFields.ownerId = update.ownerId;
|
|
1318
|
+
if ("leaseExpiresAt" in update) if (update.leaseExpiresAt === void 0 || update.leaseExpiresAt === null) removeFields.push("leaseExpiresAtIso");
|
|
1319
|
+
else setFields.leaseExpiresAtIso = update.leaseExpiresAt.toISOString();
|
|
1304
1320
|
if (Object.keys(setFields).length === 0 && removeFields.length === 0) return false;
|
|
1305
1321
|
let op = this.service.entities.background_task.patch({
|
|
1306
1322
|
entity: ENTITY,
|
|
@@ -1308,10 +1324,18 @@ var BackgroundTasksStorageDynamoDB = class extends _mastra_core_storage.Backgrou
|
|
|
1308
1324
|
});
|
|
1309
1325
|
if (Object.keys(setFields).length > 0) op = op.set(setFields);
|
|
1310
1326
|
if (removeFields.length > 0) op = op.remove(removeFields);
|
|
1311
|
-
if (options?.expectedStatus) op = op.where(({ status }, { eq }) => eq(status, options.expectedStatus));
|
|
1327
|
+
if (options?.expectedStatus !== void 0) op = op.where(({ status }, { eq }) => eq(status, options.expectedStatus));
|
|
1328
|
+
if (options?.expectedOwnerId !== void 0) {
|
|
1329
|
+
const expectedOwnerId = options.expectedOwnerId;
|
|
1330
|
+
op = op.where(({ ownerId }, { eq, notExists }) => expectedOwnerId === null ? notExists(ownerId) : eq(ownerId, expectedOwnerId));
|
|
1331
|
+
}
|
|
1332
|
+
if (options?.expectedLeaseExpiresAt !== void 0) {
|
|
1333
|
+
const expectedLeaseExpiresAt = options.expectedLeaseExpiresAt;
|
|
1334
|
+
op = op.where(({ leaseExpiresAtIso }, { eq, notExists }) => expectedLeaseExpiresAt === null ? notExists(leaseExpiresAtIso) : eq(leaseExpiresAtIso, expectedLeaseExpiresAt.toISOString()));
|
|
1335
|
+
}
|
|
1312
1336
|
await op.go();
|
|
1313
1337
|
} catch (error) {
|
|
1314
|
-
if (options?.expectedStatus && error?.cause?.name === "ConditionalCheckFailedException") return false;
|
|
1338
|
+
if ((options?.expectedStatus !== void 0 || options?.expectedOwnerId !== void 0 || options?.expectedLeaseExpiresAt !== void 0) && error?.cause?.name === "ConditionalCheckFailedException") return false;
|
|
1315
1339
|
throw new _mastra_core_error.MastraError({
|
|
1316
1340
|
id: (0, _mastra_core_storage.createStorageErrorId)("DYNAMODB", "BACKGROUND_TASKS_UPDATE", "FAILED"),
|
|
1317
1341
|
domain: _mastra_core_error.ErrorDomain.STORAGE,
|