@mastra/factory 0.10.1 → 0.10.2-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.
Files changed (32) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/factory.d.ts.map +1 -1
  3. package/dist/factory.js +1 -0
  4. package/dist/factory.js.map +1 -1
  5. package/dist/integrations/base.d.ts +2 -0
  6. package/dist/integrations/base.d.ts.map +1 -1
  7. package/dist/integrations/github/integration.d.ts.map +1 -1
  8. package/dist/integrations/github/integration.js +2 -1
  9. package/dist/integrations/github/integration.js.map +1 -1
  10. package/dist/integrations/github/routes.d.ts +2 -0
  11. package/dist/integrations/github/routes.d.ts.map +1 -1
  12. package/dist/integrations/github/routes.js +9 -3
  13. package/dist/integrations/github/routes.js.map +1 -1
  14. package/dist/integrations/platform/github/integration.d.ts.map +1 -1
  15. package/dist/integrations/platform/github/integration.js +2 -1
  16. package/dist/integrations/platform/github/integration.js.map +1 -1
  17. package/dist/routes/projects.d.ts +3 -0
  18. package/dist/routes/projects.d.ts.map +1 -1
  19. package/dist/routes/projects.js +1 -0
  20. package/dist/routes/projects.js.map +1 -1
  21. package/dist/routes/surface.d.ts.map +1 -1
  22. package/dist/routes/surface.js +1 -0
  23. package/dist/routes/surface.js.map +1 -1
  24. package/dist/sandbox/session-retirement.d.ts +3 -0
  25. package/dist/sandbox/session-retirement.d.ts.map +1 -1
  26. package/dist/sandbox/session-retirement.js +8 -1
  27. package/dist/sandbox/session-retirement.js.map +1 -1
  28. package/dist/storage/domains/work-items/base.d.ts +9 -0
  29. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  30. package/dist/storage/domains/work-items/base.js +24 -0
  31. package/dist/storage/domains/work-items/base.js.map +1 -1
  32. package/package.json +6 -6
@@ -819,6 +819,30 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
819
819
  id: { in: [...new Set(ids)] }
820
820
  })).map(toWorkItem);
821
821
  }
822
+ /**
823
+ * Strip every ref to a retired session; matching happens in app code because
824
+ * `findMany` cannot reach inside the `sessions` JSON column.
825
+ * ponytail: org-wide scan per session delete; JSON-path query if it measures.
826
+ */
827
+ async clearSessionReferences({ orgId, sessionId }) {
828
+ const holding = (await this.#db.findMany("work_items", { org_id: orgId })).filter((row) => Object.values(row.sessions).some((ref) => ref.sessionId === sessionId));
829
+ let cleared = 0;
830
+ for (const row of holding) {
831
+ let changed = false;
832
+ await this.#db.updateAtomic("work_items", { id: row.id }, (current) => {
833
+ const kept = Object.entries(current.sessions).filter(([, ref]) => ref.sessionId !== sessionId);
834
+ if (kept.length === Object.keys(current.sessions).length) return null;
835
+ changed = true;
836
+ return {
837
+ sessions: Object.fromEntries(kept),
838
+ revision: current.revision + 1,
839
+ updated_at: /* @__PURE__ */ new Date()
840
+ };
841
+ });
842
+ if (changed) cleared += 1;
843
+ }
844
+ return cleared;
845
+ }
822
846
  async get({ orgId, id }) {
823
847
  const row = await this.#db.findOne("work_items", {
824
848
  org_id: orgId,