@mastra/pg 1.24.0-alpha.1 → 1.24.0-alpha.2

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.js CHANGED
@@ -16131,6 +16131,26 @@ async function updateFeedbackReviewStatus(client, schema, args) {
16131
16131
  });
16132
16132
  return rowToFeedbackRecord(row);
16133
16133
  }
16134
+ /**
16135
+ * Delete feedback events by feedbackId. Optional `organizationId` and
16136
+ * `resourceId` values are ANDed into the predicate to restrict deletion to
16137
+ * records with matching scope fields.
16138
+ */
16139
+ async function deleteFeedback(client, schema, args) {
16140
+ if (args.feedbackIds.length === 0) return;
16141
+ const table = qualifiedTable(schema, TABLE_FEEDBACK_EVENTS);
16142
+ const values = [...args.feedbackIds];
16143
+ const conditions = [`"feedbackId" IN (${args.feedbackIds.map((_, i) => `$${i + 1}`).join(", ")})`];
16144
+ if (args.organizationId !== void 0) {
16145
+ values.push(args.organizationId);
16146
+ conditions.push(`"organizationId" = $${values.length}`);
16147
+ }
16148
+ if (args.resourceId !== void 0) {
16149
+ values.push(args.resourceId);
16150
+ conditions.push(`"resourceId" = $${values.length}`);
16151
+ }
16152
+ await client.query(`DELETE FROM ${table} WHERE ${conditions.join(" AND ")}`, values);
16153
+ }
16134
16154
  async function listFeedback(client, schema, args) {
16135
16155
  const { mode, filters, pagination, orderBy, after, limit } = listFeedbackArgsSchema.parse(args);
16136
16156
  const table = qualifiedTable(schema, TABLE_FEEDBACK_EVENTS);
@@ -16891,6 +16911,26 @@ async function batchCreateScores(client, schema, args) {
16891
16911
  const insert = buildInsert(schema, TABLE_SCORE_EVENTS, args.scores.map(scoreRecordToRow));
16892
16912
  if (insert) await client.query(insert.text, insert.values);
16893
16913
  }
16914
+ /**
16915
+ * Delete score events by scoreId. Optional `organizationId` and `resourceId`
16916
+ * values are ANDed into the predicate to restrict deletion to records with
16917
+ * matching scope fields.
16918
+ */
16919
+ async function deleteScores(client, schema, args) {
16920
+ if (args.scoreIds.length === 0) return;
16921
+ const table = qualifiedTable(schema, TABLE_SCORE_EVENTS);
16922
+ const values = [...args.scoreIds];
16923
+ const conditions = [`"scoreId" IN (${args.scoreIds.map((_, i) => `$${i + 1}`).join(", ")})`];
16924
+ if (args.organizationId !== void 0) {
16925
+ values.push(args.organizationId);
16926
+ conditions.push(`"organizationId" = $${values.length}`);
16927
+ }
16928
+ if (args.resourceId !== void 0) {
16929
+ values.push(args.resourceId);
16930
+ conditions.push(`"resourceId" = $${values.length}`);
16931
+ }
16932
+ await client.query(`DELETE FROM ${table} WHERE ${conditions.join(" AND ")}`, values);
16933
+ }
16894
16934
  async function listScores(client, schema, args) {
16895
16935
  const { mode, filters, pagination, orderBy, after, limit } = listScoresArgsSchema.parse(args);
16896
16936
  const table = qualifiedTable(schema, TABLE_SCORE_EVENTS);
@@ -18380,6 +18420,12 @@ var ObservabilityStoragePostgresVNext = class ObservabilityStoragePostgresVNext
18380
18420
  async batchCreateFeedback(args) {
18381
18421
  await this.#run("BATCH_CREATE_FEEDBACK", () => batchCreateFeedback(this.#client, this.#schema, args), { count: args.feedbacks.length });
18382
18422
  }
18423
+ async deleteScores(args) {
18424
+ await this.#run("DELETE_SCORES", () => deleteScores(this.#client, this.#schema, args), { count: args.scoreIds.length });
18425
+ }
18426
+ async deleteFeedback(args) {
18427
+ await this.#run("DELETE_FEEDBACK", () => deleteFeedback(this.#client, this.#schema, args), { count: args.feedbackIds.length });
18428
+ }
18383
18429
  async listLogs(args) {
18384
18430
  return this.#run("LIST_LOGS", () => listLogs(this.#readClient, this.#schema, args));
18385
18431
  }