@forumone/throughline-audit 0.2.3 → 0.3.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/CHANGELOG.md +32 -0
- package/dist/options.d.ts +14 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +4 -0
- package/dist/plugin.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @forumone/throughline-audit
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1a4a441: Let every server's tools be served by Payload's own MCP plugin
|
|
8
|
+
|
|
9
|
+
`createMcpToolCollector()` in core, and an `mcpTools` option on all six servers. The host hands the collector's array to `@payloadcms/plugin-mcp` at config time and each plugin fills it at `onInit` — which works because the plugin reads `mcp.tools` inside the handler it builds per request, so an array handed over empty is read populated.
|
|
10
|
+
|
|
11
|
+
That ordering is the whole problem this solves: every tool in the suite is built at `onInit` because every one closes over `payload`, and `mcpPlugin` takes its tools as a config option.
|
|
12
|
+
|
|
13
|
+
Omit `mcpTools` and nothing changes — each server keeps its own `/mcp` endpoint, which is what lets a host move one at a time rather than all six at once.
|
|
14
|
+
|
|
15
|
+
Duplicate tool names are refused, naming both servers. Six servers each owning a `publish` was fine while each had its own endpoint; one server is one namespace, and an MCP client offered two tools under one name gets whichever registered last.
|
|
16
|
+
|
|
17
|
+
**Also fixes a defect the integration test found.** `service.loadDocument` called `findByID` without `disableErrors`, so a missing document threw `NotFound` before the pipeline ran — which made the `exist` step's `not-found` branch unreachable from every caller, and turned "publish a document that does not exist" into a thrown error instead of the diagnostic the pipeline exists to return. The step's own tests passed it an empty document and so never noticed. `unpublish` now distinguishes a missing document from one that is merely already a draft.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [1a4a441]
|
|
22
|
+
- @forumone/throughline-core@0.5.0
|
|
23
|
+
|
|
24
|
+
## 0.2.4
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [40839b5]
|
|
29
|
+
- Updated dependencies [9f39ace]
|
|
30
|
+
- Updated dependencies [f138b3d]
|
|
31
|
+
- Updated dependencies [6fac789]
|
|
32
|
+
- @forumone/throughline-core@0.4.0
|
|
33
|
+
- @forumone/throughline-plugin-contract@0.3.0
|
|
34
|
+
|
|
3
35
|
## 0.2.3
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/dist/options.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { McpToolCollector } from '@forumone/throughline-core';
|
|
1
2
|
import type { PayloadRequest } from 'payload';
|
|
2
3
|
import type { BaseCorePluginOptions } from '@forumone/throughline-plugin-contract';
|
|
3
4
|
export interface AuditQueryPluginOptions extends BaseCorePluginOptions {
|
|
@@ -11,6 +12,19 @@ export interface AuditQueryPluginOptions extends BaseCorePluginOptions {
|
|
|
11
12
|
* allow reads. Defaults to admin and editor roles.
|
|
12
13
|
*/
|
|
13
14
|
readAccess?: (req: PayloadRequest) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Where to put this server's MCP tools so Payload's own MCP plugin can serve
|
|
17
|
+
* them.
|
|
18
|
+
*
|
|
19
|
+
* `createMcpToolCollector()` from `@forumone/throughline-core`. The host hands
|
|
20
|
+
* its array to `@payloadcms/plugin-mcp` at config time and this plugin fills
|
|
21
|
+
* it at `onInit` — which is the first moment the tools can exist, since they
|
|
22
|
+
* close over `payload`, and still before any request reads the array.
|
|
23
|
+
*
|
|
24
|
+
* Omit it and nothing changes: this server keeps its own `/mcp` endpoint,
|
|
25
|
+
* which is what lets a host move one server at a time.
|
|
26
|
+
*/
|
|
27
|
+
mcpTools?: McpToolCollector;
|
|
14
28
|
}
|
|
15
29
|
export declare const DEFAULT_AUDIT_COLLECTION_SLUG = "audit-events";
|
|
16
30
|
/**
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAElF,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAElF,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAA;IAE7C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAC5B;AAED,eAAO,MAAM,6BAA6B,iBAAiB,CAAA;AAE3D;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,uBAAuB,GAAG,uBAAuB,CAEzF"}
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAC,MAAM,6BAA6B,GAAG,cAAc,CAAA;AAE3D;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgC;IAC9D,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,uCAAuC,CAAA;AAG1F,OAAO,EACL,KAAK,uBAAuB,EAG7B,MAAM,cAAc,CAAA;AAerB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,uCAAuC,CAAA;AAG1F,OAAO,EACL,KAAK,uBAAuB,EAG7B,MAAM,cAAc,CAAA;AAerB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,CA6E9D,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -48,6 +48,10 @@ export const auditQueryPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
48
48
|
createWhatChangedInRangeTool(deps),
|
|
49
49
|
createGetRecentFailuresTool(deps),
|
|
50
50
|
];
|
|
51
|
+
// Payload's own MCP plugin, when the host is using it. See the option's
|
|
52
|
+
// note — `onInit` is both the earliest these tools can exist and still
|
|
53
|
+
// early enough that the array is read populated.
|
|
54
|
+
options.mcpTools?.add(tools, { serverName: 'audit', logger });
|
|
51
55
|
const handler = createMcpHandler({
|
|
52
56
|
payload,
|
|
53
57
|
serverName: 'audit',
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources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AAM,OAAO,GAAG,gBAAgB,CAAC;gBAC/B,OAAO;gBACP,UAAU,EAAE,OAAO;gBACnB,KAAK;gBACL,MAAM;aACP,CAAC,CAAA;YAEF,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE;gBACjD,KAAK,EAAE,OAAO;gBACd,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;aACpB,CAAC,CAAA;YAEF,QAAQ,CAAC,QAAQ,CAAC;gBAChB,EAAE,EAAE,SAAS;gBACb,OAAO,EAAE,cAAc;gBACvB,YAAY,EAAE,CAAC,aAAa,CAAC;aAC9B,CAAC,CAAA;YAEF,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE;gBACtC,cAAc;gBACd,WAAW;gBACX,SAAS,EAAE,KAAK,CAAC,MAAM;aACxB,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forumone/throughline-audit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Read-only MCP query tools over the Throughline audit log. Pairs with core's auditPlugin (which writes records).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"zod": "^3.23.0",
|
|
43
|
-
"@forumone/throughline-core": "0.
|
|
44
|
-
"@forumone/throughline-plugin-contract": "0.
|
|
43
|
+
"@forumone/throughline-core": "0.5.0",
|
|
44
|
+
"@forumone/throughline-plugin-contract": "0.3.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^20.17.0",
|