@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.
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.24.0-alpha.1"
6
+ version: "1.24.0-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.24.0-alpha.1",
2
+ "version": "1.24.0-alpha.2",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -16155,6 +16155,26 @@ async function updateFeedbackReviewStatus(client, schema, args) {
16155
16155
  });
16156
16156
  return rowToFeedbackRecord(row);
16157
16157
  }
16158
+ /**
16159
+ * Delete feedback events by feedbackId. Optional `organizationId` and
16160
+ * `resourceId` values are ANDed into the predicate to restrict deletion to
16161
+ * records with matching scope fields.
16162
+ */
16163
+ async function deleteFeedback(client, schema, args) {
16164
+ if (args.feedbackIds.length === 0) return;
16165
+ const table = qualifiedTable(schema, TABLE_FEEDBACK_EVENTS);
16166
+ const values = [...args.feedbackIds];
16167
+ const conditions = [`"feedbackId" IN (${args.feedbackIds.map((_, i) => `$${i + 1}`).join(", ")})`];
16168
+ if (args.organizationId !== void 0) {
16169
+ values.push(args.organizationId);
16170
+ conditions.push(`"organizationId" = $${values.length}`);
16171
+ }
16172
+ if (args.resourceId !== void 0) {
16173
+ values.push(args.resourceId);
16174
+ conditions.push(`"resourceId" = $${values.length}`);
16175
+ }
16176
+ await client.query(`DELETE FROM ${table} WHERE ${conditions.join(" AND ")}`, values);
16177
+ }
16158
16178
  async function listFeedback(client, schema, args) {
16159
16179
  const { mode, filters, pagination, orderBy, after, limit } = _mastra_core_storage.listFeedbackArgsSchema.parse(args);
16160
16180
  const table = qualifiedTable(schema, TABLE_FEEDBACK_EVENTS);
@@ -16915,6 +16935,26 @@ async function batchCreateScores(client, schema, args) {
16915
16935
  const insert = buildInsert(schema, TABLE_SCORE_EVENTS, args.scores.map(scoreRecordToRow));
16916
16936
  if (insert) await client.query(insert.text, insert.values);
16917
16937
  }
16938
+ /**
16939
+ * Delete score events by scoreId. Optional `organizationId` and `resourceId`
16940
+ * values are ANDed into the predicate to restrict deletion to records with
16941
+ * matching scope fields.
16942
+ */
16943
+ async function deleteScores(client, schema, args) {
16944
+ if (args.scoreIds.length === 0) return;
16945
+ const table = qualifiedTable(schema, TABLE_SCORE_EVENTS);
16946
+ const values = [...args.scoreIds];
16947
+ const conditions = [`"scoreId" IN (${args.scoreIds.map((_, i) => `$${i + 1}`).join(", ")})`];
16948
+ if (args.organizationId !== void 0) {
16949
+ values.push(args.organizationId);
16950
+ conditions.push(`"organizationId" = $${values.length}`);
16951
+ }
16952
+ if (args.resourceId !== void 0) {
16953
+ values.push(args.resourceId);
16954
+ conditions.push(`"resourceId" = $${values.length}`);
16955
+ }
16956
+ await client.query(`DELETE FROM ${table} WHERE ${conditions.join(" AND ")}`, values);
16957
+ }
16918
16958
  async function listScores(client, schema, args) {
16919
16959
  const { mode, filters, pagination, orderBy, after, limit } = _mastra_core_storage.listScoresArgsSchema.parse(args);
16920
16960
  const table = qualifiedTable(schema, TABLE_SCORE_EVENTS);
@@ -18404,6 +18444,12 @@ var ObservabilityStoragePostgresVNext = class ObservabilityStoragePostgresVNext
18404
18444
  async batchCreateFeedback(args) {
18405
18445
  await this.#run("BATCH_CREATE_FEEDBACK", () => batchCreateFeedback(this.#client, this.#schema, args), { count: args.feedbacks.length });
18406
18446
  }
18447
+ async deleteScores(args) {
18448
+ await this.#run("DELETE_SCORES", () => deleteScores(this.#client, this.#schema, args), { count: args.scoreIds.length });
18449
+ }
18450
+ async deleteFeedback(args) {
18451
+ await this.#run("DELETE_FEEDBACK", () => deleteFeedback(this.#client, this.#schema, args), { count: args.feedbackIds.length });
18452
+ }
18407
18453
  async listLogs(args) {
18408
18454
  return this.#run("LIST_LOGS", () => listLogs(this.#readClient, this.#schema, args));
18409
18455
  }