@abinnovision/payloadcms-mcpx 2.0.0-beta.12 → 2.0.0-beta.14
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/README.md +32 -20
- package/dist/admin/capability-toggles.mjs +28 -8
- package/dist/admin/confirmations-panel.mjs +242 -0
- package/dist/admin/confirmations.d.mts +15 -0
- package/dist/admin/confirmations.mjs +70 -0
- package/dist/admin/index.d.mts +2 -1
- package/dist/admin/index.mjs +2 -1
- package/dist/api-keys/capability-matrix.d.mts +2 -0
- package/dist/api-keys/capability-matrix.mjs +12 -0
- package/dist/api-keys/collection.mjs +3 -3
- package/dist/api-keys/confirmation-view.mjs +6 -0
- package/dist/api-keys/fields.mjs +18 -1
- package/dist/builtin-tool-names.mjs +3 -1
- package/dist/capabilities.mjs +6 -2
- package/dist/define-tool.d.mts +4 -4
- package/dist/define-tool.mjs +8 -1
- package/dist/endpoint/confirmations.mjs +124 -0
- package/dist/endpoint/handler.mjs +2 -2
- package/dist/endpoint/server.mjs +22 -18
- package/dist/endpoint/upload.mjs +5 -4
- package/dist/grants/confirmation.mjs +106 -0
- package/dist/{upload → grants}/grant.mjs +39 -16
- package/dist/options.mjs +28 -5
- package/dist/plugin.d.mts +2 -1
- package/dist/plugin.mjs +5 -2
- package/dist/tools/builtin.mjs +5 -1
- package/dist/tools/create-document.mjs +1 -1
- package/dist/tools/delete-document.mjs +157 -0
- package/dist/tools/find-versions.mjs +1 -1
- package/dist/tools/get-document.mjs +1 -1
- package/dist/tools/patch-document.mjs +2 -2
- package/dist/tools/publish-document.mjs +1 -1
- package/dist/tools/run-confirmed.mjs +126 -0
- package/dist/tools/shared.mjs +4 -0
- package/dist/types.d.mts +129 -18
- package/dist/upload/file.mjs +25 -6
- package/dist/write/draft-guard.mjs +11 -9
- package/dist/write/publish-intent.mjs +16 -6
- package/package.json +1 -1
|
@@ -2,7 +2,13 @@ import { isPlainObject } from "../guards.mjs";
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
//#region src/write/publish-intent.ts
|
|
4
4
|
const PUBLISH_INTENT = "__mcpxPublishIntent";
|
|
5
|
+
const TRASH_INTENT = "__mcpxTrashIntent";
|
|
5
6
|
const TOKEN = randomUUID();
|
|
7
|
+
const take = (data, key) => {
|
|
8
|
+
if (!isPlainObject(data) || data[key] !== TOKEN) return false;
|
|
9
|
+
delete data[key];
|
|
10
|
+
return true;
|
|
11
|
+
};
|
|
6
12
|
const withPublishIntent = (data) => ({
|
|
7
13
|
...data,
|
|
8
14
|
[PUBLISH_INTENT]: TOKEN
|
|
@@ -10,10 +16,14 @@ const withPublishIntent = (data) => ({
|
|
|
10
16
|
const hasPublishIntent = (data) => isPlainObject(data) && data[PUBLISH_INTENT] === TOKEN;
|
|
11
17
|
/**
|
|
12
18
|
* Called by the last hook that needs the marker, which removes it.
|
|
13
|
-
*/ const takePublishIntent = (data) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
19
|
+
*/ const takePublishIntent = (data) => take(data, PUBLISH_INTENT);
|
|
20
|
+
const withTrashIntent = (data) => ({
|
|
21
|
+
...data,
|
|
22
|
+
[TRASH_INTENT]: TOKEN
|
|
23
|
+
});
|
|
24
|
+
const hasTrashIntent = (data) => isPlainObject(data) && data[TRASH_INTENT] === TOKEN;
|
|
25
|
+
/**
|
|
26
|
+
* The counterpart of {@link takePublishIntent}.
|
|
27
|
+
*/ const takeTrashIntent = (data) => take(data, TRASH_INTENT);
|
|
18
28
|
//#endregion
|
|
19
|
-
export { hasPublishIntent, takePublishIntent, withPublishIntent };
|
|
29
|
+
export { hasPublishIntent, hasTrashIntent, takePublishIntent, takeTrashIntent, withPublishIntent, withTrashIntent };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@abinnovision/payloadcms-mcpx",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.14",
|
|
5
5
|
"description": "Payload CMS plugin exposing a fixed, schema-aware MCP tool surface with draft-only writes and per-API-key capabilities.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"payload",
|