@objectstack/rest 7.7.0 → 7.8.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 +31 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1310,6 +1310,37 @@ var RestServer = class {
|
|
|
1310
1310
|
}
|
|
1311
1311
|
});
|
|
1312
1312
|
}
|
|
1313
|
+
if (metadata.endpoints.items !== false) {
|
|
1314
|
+
this.routeManager.register({
|
|
1315
|
+
method: "GET",
|
|
1316
|
+
path: `${metaPath}/_drafts`,
|
|
1317
|
+
handler: async (req, res) => {
|
|
1318
|
+
try {
|
|
1319
|
+
const environmentId = isScoped ? req.params?.environmentId : void 0;
|
|
1320
|
+
const p = await this.resolveProtocol(environmentId, req);
|
|
1321
|
+
if (typeof p.listDrafts !== "function") {
|
|
1322
|
+
res.status(501).json({
|
|
1323
|
+
error: "not_implemented",
|
|
1324
|
+
message: "protocol.listDrafts() is not available in this kernel"
|
|
1325
|
+
});
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
const result = await p.listDrafts({
|
|
1329
|
+
packageId: req.query?.packageId || void 0,
|
|
1330
|
+
type: req.query?.type || void 0
|
|
1331
|
+
});
|
|
1332
|
+
res.json(result);
|
|
1333
|
+
} catch (error) {
|
|
1334
|
+
logError("[REST] Unhandled error:", error);
|
|
1335
|
+
sendError(res, error);
|
|
1336
|
+
}
|
|
1337
|
+
},
|
|
1338
|
+
metadata: {
|
|
1339
|
+
summary: "List pending draft metadata items",
|
|
1340
|
+
tags: ["metadata"]
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1313
1344
|
if (metadata.endpoints.items !== false) {
|
|
1314
1345
|
this.routeManager.register({
|
|
1315
1346
|
method: "GET",
|