@objectstack/rest 7.1.0 → 7.2.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 CHANGED
@@ -1618,6 +1618,35 @@ var RestServer = class {
1618
1618
  tags: ["metadata"]
1619
1619
  }
1620
1620
  });
1621
+ this.routeManager.register({
1622
+ method: "GET",
1623
+ path: `${metaPath}/:type/:name/audit`,
1624
+ handler: async (req, res) => {
1625
+ try {
1626
+ const environmentId = isScoped ? req.params?.environmentId : void 0;
1627
+ const p = await this.resolveProtocol(environmentId, req);
1628
+ if (typeof p.auditMetaItem !== "function") {
1629
+ res.json({ events: [] });
1630
+ return;
1631
+ }
1632
+ const limit = req.query?.limit !== void 0 ? Number(req.query.limit) : void 0;
1633
+ const result = await p.auditMetaItem({
1634
+ type: req.params.type,
1635
+ name: req.params.name,
1636
+ ...environmentId ? { environmentId } : {},
1637
+ ...limit !== void 0 && Number.isFinite(limit) ? { limit } : {}
1638
+ });
1639
+ res.json(result);
1640
+ } catch (error) {
1641
+ logError("[REST] Unhandled error:", error);
1642
+ sendError(res, error);
1643
+ }
1644
+ },
1645
+ metadata: {
1646
+ summary: "List protection-audit events for a metadata item",
1647
+ tags: ["metadata"]
1648
+ }
1649
+ });
1621
1650
  this.routeManager.register({
1622
1651
  method: "POST",
1623
1652
  path: `${metaPath}/:type/:name/publish`,