@objectstack/rest 7.1.0 → 7.2.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/index.cjs +29 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1578,6 +1578,35 @@ var RestServer = class {
|
|
|
1578
1578
|
tags: ["metadata"]
|
|
1579
1579
|
}
|
|
1580
1580
|
});
|
|
1581
|
+
this.routeManager.register({
|
|
1582
|
+
method: "GET",
|
|
1583
|
+
path: `${metaPath}/:type/:name/audit`,
|
|
1584
|
+
handler: async (req, res) => {
|
|
1585
|
+
try {
|
|
1586
|
+
const environmentId = isScoped ? req.params?.environmentId : void 0;
|
|
1587
|
+
const p = await this.resolveProtocol(environmentId, req);
|
|
1588
|
+
if (typeof p.auditMetaItem !== "function") {
|
|
1589
|
+
res.json({ events: [] });
|
|
1590
|
+
return;
|
|
1591
|
+
}
|
|
1592
|
+
const limit = req.query?.limit !== void 0 ? Number(req.query.limit) : void 0;
|
|
1593
|
+
const result = await p.auditMetaItem({
|
|
1594
|
+
type: req.params.type,
|
|
1595
|
+
name: req.params.name,
|
|
1596
|
+
...environmentId ? { environmentId } : {},
|
|
1597
|
+
...limit !== void 0 && Number.isFinite(limit) ? { limit } : {}
|
|
1598
|
+
});
|
|
1599
|
+
res.json(result);
|
|
1600
|
+
} catch (error) {
|
|
1601
|
+
logError("[REST] Unhandled error:", error);
|
|
1602
|
+
sendError(res, error);
|
|
1603
|
+
}
|
|
1604
|
+
},
|
|
1605
|
+
metadata: {
|
|
1606
|
+
summary: "List protection-audit events for a metadata item",
|
|
1607
|
+
tags: ["metadata"]
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1581
1610
|
this.routeManager.register({
|
|
1582
1611
|
method: "POST",
|
|
1583
1612
|
path: `${metaPath}/:type/:name/publish`,
|