@mastra/dsql 1.5.4 → 1.5.5-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/index.cjs +12 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -24
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { MastraBase } from "@mastra/core/base";
|
|
|
6
6
|
import { parseSqlIdentifier } from "@mastra/core/utils";
|
|
7
7
|
import { MessageList } from "@mastra/core/agent";
|
|
8
8
|
import { saveScorePayloadSchema } from "@mastra/core/evals";
|
|
9
|
-
|
|
9
|
+
// src/shared/config.ts
|
|
10
10
|
/**
|
|
11
11
|
* Default connection pool settings optimized for Aurora DSQL.
|
|
12
12
|
*
|
|
@@ -70,8 +70,7 @@ const getEffectiveRegion = (config) => {
|
|
|
70
70
|
if (extractedRegion) return extractedRegion;
|
|
71
71
|
throw new Error("DSQLStore: region could not be determined. Provide region in config or use a standard DSQL endpoint.");
|
|
72
72
|
};
|
|
73
|
-
|
|
74
|
-
//#region src/storage/client.ts
|
|
73
|
+
// src/storage/client.ts
|
|
75
74
|
/**
|
|
76
75
|
* Truncate a query string for error messages.
|
|
77
76
|
*/
|
|
@@ -439,8 +438,7 @@ async function withRetry(fn, options = {}) {
|
|
|
439
438
|
}
|
|
440
439
|
throw lastError;
|
|
441
440
|
}
|
|
442
|
-
|
|
443
|
-
//#region src/shared/batch.ts
|
|
441
|
+
// src/shared/batch.ts
|
|
444
442
|
/**
|
|
445
443
|
* Batch utilities for Aurora DSQL.
|
|
446
444
|
*
|
|
@@ -489,8 +487,7 @@ function splitIntoBatches(records, options = {}) {
|
|
|
489
487
|
batchCount: batches.length
|
|
490
488
|
};
|
|
491
489
|
}
|
|
492
|
-
|
|
493
|
-
//#region src/storage/db/index.ts
|
|
490
|
+
// src/storage/db/index.ts
|
|
494
491
|
/**
|
|
495
492
|
* Resolves DsqlDomainConfi to a database client and schema.
|
|
496
493
|
* Handles creating a new pool if config is provided.
|
|
@@ -1230,8 +1227,7 @@ var DsqlDB = class extends MastraBase {
|
|
|
1230
1227
|
return this.clearTable({ tableName });
|
|
1231
1228
|
}
|
|
1232
1229
|
};
|
|
1233
|
-
|
|
1234
|
-
//#region src/storage/domains/utils.ts
|
|
1230
|
+
// src/storage/domains/utils.ts
|
|
1235
1231
|
function getSchemaName(schema) {
|
|
1236
1232
|
return schema ? `"${parseSqlIdentifier(schema, "schema name")}"` : void 0;
|
|
1237
1233
|
}
|
|
@@ -1260,8 +1256,7 @@ function transformFromSqlRow({ tableName, sqlRow }) {
|
|
|
1260
1256
|
});
|
|
1261
1257
|
return result;
|
|
1262
1258
|
}
|
|
1263
|
-
|
|
1264
|
-
//#region src/storage/domains/agents/index.ts
|
|
1259
|
+
// src/storage/domains/agents/index.ts
|
|
1265
1260
|
var AgentsDSQL = class AgentsDSQL extends AgentsStorage {
|
|
1266
1261
|
#db;
|
|
1267
1262
|
#schema;
|
|
@@ -1825,8 +1820,7 @@ var AgentsDSQL = class AgentsDSQL extends AgentsStorage {
|
|
|
1825
1820
|
};
|
|
1826
1821
|
}
|
|
1827
1822
|
};
|
|
1828
|
-
|
|
1829
|
-
//#region src/storage/db/run-fencing.ts
|
|
1823
|
+
// src/storage/db/run-fencing.ts
|
|
1830
1824
|
/**
|
|
1831
1825
|
* Epoch milliseconds on the database clock. Aurora DSQL never waits on a row
|
|
1832
1826
|
* lock, so the transaction's start time is the time its statements run, and
|
|
@@ -1869,8 +1863,7 @@ function withRunFence(client, claimsTable, fence, operation, write) {
|
|
|
1869
1863
|
return write(t);
|
|
1870
1864
|
});
|
|
1871
1865
|
}
|
|
1872
|
-
|
|
1873
|
-
//#region src/storage/domains/memory/index.ts
|
|
1866
|
+
// src/storage/domains/memory/index.ts
|
|
1874
1867
|
/**
|
|
1875
1868
|
* Generate SQL placeholder string for IN clauses.
|
|
1876
1869
|
* @param count - Number of placeholders to generate
|
|
@@ -2946,8 +2939,7 @@ var MemoryDSQL = class MemoryDSQL extends MemoryStorage {
|
|
|
2946
2939
|
return result;
|
|
2947
2940
|
}
|
|
2948
2941
|
};
|
|
2949
|
-
|
|
2950
|
-
//#region src/storage/domains/observability/index.ts
|
|
2942
|
+
// src/storage/domains/observability/index.ts
|
|
2951
2943
|
var ObservabilityDSQL = class ObservabilityDSQL extends ObservabilityStorage {
|
|
2952
2944
|
static retentionTables = { spans: {
|
|
2953
2945
|
table: TABLE_SPANS,
|
|
@@ -3503,8 +3495,7 @@ var ObservabilityDSQL = class ObservabilityDSQL extends ObservabilityStorage {
|
|
|
3503
3495
|
}
|
|
3504
3496
|
}
|
|
3505
3497
|
};
|
|
3506
|
-
|
|
3507
|
-
//#region src/storage/domains/scores/index.ts
|
|
3498
|
+
// src/storage/domains/scores/index.ts
|
|
3508
3499
|
/**
|
|
3509
3500
|
* DSQL-specific score row transformation.
|
|
3510
3501
|
* Uses Z-suffix timestamps (createdAtZ, updatedAtZ) when available.
|
|
@@ -3881,8 +3872,7 @@ var ScoresDSQL = class ScoresDSQL extends ScoresStorage {
|
|
|
3881
3872
|
}
|
|
3882
3873
|
}
|
|
3883
3874
|
};
|
|
3884
|
-
|
|
3885
|
-
//#region src/storage/domains/workflows/index.ts
|
|
3875
|
+
// src/storage/domains/workflows/index.ts
|
|
3886
3876
|
const RUN_OWNER_COLUMNS = `generation, "ownerId", "leaseExpiresAt", ${DB_NOW_MS} AS "nowMs"`;
|
|
3887
3877
|
function toRunOwnershipRecord(runId, row) {
|
|
3888
3878
|
const leaseExpiresAt = row.leaseExpiresAt === null ? null : Number(row.leaseExpiresAt);
|
|
@@ -4418,8 +4408,7 @@ var WorkflowsDSQL = class WorkflowsDSQL extends WorkflowsStorage {
|
|
|
4418
4408
|
}
|
|
4419
4409
|
}
|
|
4420
4410
|
};
|
|
4421
|
-
|
|
4422
|
-
//#region src/storage/index.ts
|
|
4411
|
+
// src/storage/index.ts
|
|
4423
4412
|
var DSQLStore = class extends MastraStorage {
|
|
4424
4413
|
#pool;
|
|
4425
4414
|
#db;
|
|
@@ -4529,7 +4518,6 @@ var DSQLStore = class extends MastraStorage {
|
|
|
4529
4518
|
this.isInitialized = false;
|
|
4530
4519
|
}
|
|
4531
4520
|
};
|
|
4532
|
-
//#endregion
|
|
4533
4521
|
export { AgentsDSQL, DSQLStore, DSQL_POOL_DEFAULTS, MemoryDSQL, ObservabilityDSQL, PoolAdapter, ScoresDSQL, WorkflowsDSQL };
|
|
4534
4522
|
|
|
4535
4523
|
//# sourceMappingURL=index.js.map
|