@mastra/pg 1.23.0-alpha.0 → 1.23.0-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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +31 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/tracing.d.ts +7 -0
- package/dist/storage/domains/observability/v-next/tracing.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -13513,6 +13513,7 @@ var ObservabilityPG = class ObservabilityPG extends _mastra_core_storage.Observa
|
|
|
13513
13513
|
}
|
|
13514
13514
|
}
|
|
13515
13515
|
async batchDeleteTraces(args) {
|
|
13516
|
+
this.assertUnscopedBatchDeleteTraces(args);
|
|
13516
13517
|
try {
|
|
13517
13518
|
const tableName = getTableName$5({
|
|
13518
13519
|
indexName: _mastra_core_storage.TABLE_SPANS,
|
|
@@ -17695,11 +17696,39 @@ async function getTraceLight(client, schema, args) {
|
|
|
17695
17696
|
spans: rows.map(rowToLightSpanRecord)
|
|
17696
17697
|
};
|
|
17697
17698
|
}
|
|
17699
|
+
/**
|
|
17700
|
+
* Delete traces by traceId, cascading to trace-linked signal events
|
|
17701
|
+
* (metrics, logs, scores, feedback). Signal rows with a NULL traceId are
|
|
17702
|
+
* never affected. When the optional tenant scope (`organizationId` /
|
|
17703
|
+
* `resourceId`) is set, every DELETE additionally requires the row's tenant
|
|
17704
|
+
* columns to match.
|
|
17705
|
+
*/
|
|
17698
17706
|
async function batchDeleteTraces(client, schema, args) {
|
|
17699
17707
|
if (args.traceIds.length === 0) return;
|
|
17700
|
-
const
|
|
17708
|
+
const params = [...args.traceIds];
|
|
17701
17709
|
const placeholders = args.traceIds.map((_, i) => `$${i + 1}`).join(", ");
|
|
17702
|
-
|
|
17710
|
+
let scopeCondition = "";
|
|
17711
|
+
if (args.organizationId !== void 0) {
|
|
17712
|
+
params.push(args.organizationId);
|
|
17713
|
+
scopeCondition += ` AND "organizationId" = $${params.length}`;
|
|
17714
|
+
}
|
|
17715
|
+
if (args.resourceId !== void 0) {
|
|
17716
|
+
params.push(args.resourceId);
|
|
17717
|
+
scopeCondition += ` AND "resourceId" = $${params.length}`;
|
|
17718
|
+
}
|
|
17719
|
+
const tables = [
|
|
17720
|
+
TABLE_SPAN_EVENTS,
|
|
17721
|
+
TABLE_METRIC_EVENTS,
|
|
17722
|
+
TABLE_LOG_EVENTS,
|
|
17723
|
+
TABLE_SCORE_EVENTS,
|
|
17724
|
+
TABLE_FEEDBACK_EVENTS
|
|
17725
|
+
];
|
|
17726
|
+
await client.tx(async (t) => {
|
|
17727
|
+
for (const tableName of tables) {
|
|
17728
|
+
const table = qualifiedTable(schema, tableName);
|
|
17729
|
+
await t.query(`DELETE FROM ${table} WHERE "traceId" IN (${placeholders})${scopeCondition}`, params);
|
|
17730
|
+
}
|
|
17731
|
+
});
|
|
17703
17732
|
}
|
|
17704
17733
|
/** Truncate the span_events table. */
|
|
17705
17734
|
async function dangerouslyClearTracing(client, schema) {
|