@forumone/throughline-publishing 0.7.1 → 0.9.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 +100 -0
- package/README.md +11 -6
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +2 -3
- package/dist/options.js.map +1 -1
- package/dist/pipeline/index.d.ts +5 -0
- package/dist/pipeline/index.d.ts.map +1 -1
- package/dist/pipeline/index.js +47 -29
- package/dist/pipeline/index.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +23 -28
- package/dist/plugin.js.map +1 -1
- package/dist/tools/descriptors.d.ts +26 -0
- package/dist/tools/descriptors.d.ts.map +1 -0
- package/dist/tools/descriptors.js +38 -0
- package/dist/tools/descriptors.js.map +1 -0
- package/dist/tools/get-publish-status.d.ts.map +1 -1
- package/dist/tools/get-publish-status.js +2 -2
- package/dist/tools/get-publish-status.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/publish.d.ts.map +1 -1
- package/dist/tools/publish.js +8 -2
- package/dist/tools/publish.js.map +1 -1
- package/dist/tools/rollback.d.ts.map +1 -1
- package/dist/tools/rollback.js +2 -2
- package/dist/tools/rollback.js.map +1 -1
- package/dist/tools/schedule-publish.d.ts.map +1 -1
- package/dist/tools/schedule-publish.js +2 -2
- package/dist/tools/schedule-publish.js.map +1 -1
- package/dist/tools/unpublish.d.ts.map +1 -1
- package/dist/tools/unpublish.js +2 -2
- package/dist/tools/unpublish.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
1
|
# @forumone/throughline-publishing
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a9262da: Per-tool gating works, because tool names no longer wait for `onInit`
|
|
8
|
+
|
|
9
|
+
`@payloadcms/plugin-mcp` generates one per-key checkbox per tool while the host's
|
|
10
|
+
config is being built, and then gates every call on the checkbox matching the
|
|
11
|
+
tool's name. Every Throughline tool was built at `onInit` — each closes over
|
|
12
|
+
`payload`, the publishing service or the manifest loader — so the array it maps
|
|
13
|
+
over was empty, no checkboxes were generated, and its `?? false` denied all 27
|
|
14
|
+
tools to every key. A valid key got a 200 and an empty `tools/list`, with nothing
|
|
15
|
+
wrong on either side.
|
|
16
|
+
|
|
17
|
+
The plugin needs only `name` and `description` then, and neither needs a Payload.
|
|
18
|
+
So a server now **declares** its tools as the config is built and **binds** their
|
|
19
|
+
handlers at `onInit`:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
options.mcpTools?.declare(PUBLISHING_TOOL_DESCRIPTORS, { serverName: 'publishing' })
|
|
23
|
+
// …later, at onInit:
|
|
24
|
+
options.mcpTools?.add(tools, { serverName: 'publishing' })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Each package gained a `tools/descriptors.ts` holding every tool's name and
|
|
28
|
+
description; the factories spread from it, so the checkbox and the MCP client
|
|
29
|
+
cannot describe a tool differently. A `descriptors.test.ts` in each package
|
|
30
|
+
asserts the two sets match, without needing a database.
|
|
31
|
+
|
|
32
|
+
`createMcpToolCollector` gains `declare()` and an `unbound` list. Both mismatches
|
|
33
|
+
are refused rather than absorbed: a tool built but never declared throws at
|
|
34
|
+
`onInit` (it would otherwise be denied to every key, silently), and a tool
|
|
35
|
+
declared but never bound stays advertised with a handler that explains itself.
|
|
36
|
+
|
|
37
|
+
**Order in the host's plugin array is now load-bearing.** Every tool-bearing
|
|
38
|
+
server must come before `mcpPlugin`, or it declares into an array that has
|
|
39
|
+
already been read. It was only a convention before; it is a requirement now, and
|
|
40
|
+
the failure mode — a server's tools missing from every key — is the one this
|
|
41
|
+
change exists to remove.
|
|
42
|
+
|
|
43
|
+
`requiredScope` stays declared and read by nothing. Enforcement is the checkbox;
|
|
44
|
+
these record which tools are consequential, and are the mapping a scope-aware
|
|
45
|
+
default would be built from.
|
|
46
|
+
|
|
47
|
+
The playground registers `mcpPlugin` for the first time, so the suite's only
|
|
48
|
+
end-to-end host now exercises the tools rather than just their composition.
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [a9262da]
|
|
53
|
+
- @forumone/throughline-core@0.8.0
|
|
54
|
+
|
|
55
|
+
## 0.8.0
|
|
56
|
+
|
|
57
|
+
### Minor Changes
|
|
58
|
+
|
|
59
|
+
- 3140ea0: One MCP transport, not seven
|
|
60
|
+
|
|
61
|
+
Every plugin served its own `POST /<prefix>/mcp` on a 146-line JSON-RPC subset of
|
|
62
|
+
the protocol that spoke `tools/list` and `tools/call` and nothing else. Payload
|
|
63
|
+
ships an MCP server built on the official SDK — streamable HTTP, sessions, per-key
|
|
64
|
+
capability checkboxes — and the tools were never the transport. They now reach a
|
|
65
|
+
client through the host's `@payloadcms/plugin-mcp`, on one `/api/mcp`, via the
|
|
66
|
+
collector `createMcpToolCollector` already provided.
|
|
67
|
+
|
|
68
|
+
**Breaking.** Removed from `@forumone/throughline-core`: `createMcpHandler`,
|
|
69
|
+
`McpHandlerOptions`, `createApiKeysCollection`, `ApiKeysCollectionOptions`,
|
|
70
|
+
`DEFAULT_API_KEYS_SLUG`, `createBearerTokenAuthenticator`,
|
|
71
|
+
`BearerTokenAuthenticatorOptions`, `generateApiKey`. Removed from
|
|
72
|
+
`@forumone/throughline-plugin-contract`: `McpAuthenticator`, `McpAuthResult`.
|
|
73
|
+
`sha256Hex` stays exported, from `./utils` rather than `./auth`.
|
|
74
|
+
|
|
75
|
+
`routePrefix` is gone from `auditQueryPlugin`, `componentsPlugin` and
|
|
76
|
+
`integrationsPlugin` — omitted from their options types, so passing one is a
|
|
77
|
+
compile error rather than config that reads as if it does something. `/mcp` was
|
|
78
|
+
the only endpoint any of the three served. `publishingPlugin`, `approvalsPlugin`
|
|
79
|
+
and `formsPlugin` keep theirs; they still serve admin controls, the approval
|
|
80
|
+
action link and the public form post.
|
|
81
|
+
|
|
82
|
+
**A host that passes no `mcpTools` collector now has no MCP surface.** There is no
|
|
83
|
+
per-server endpoint left as a fallback. This is a config change of one line per
|
|
84
|
+
plugin, and `createMcpToolCollector`'s own docs carry the shape.
|
|
85
|
+
|
|
86
|
+
**What this costs, stated plainly.** `requiredScope` is now read by nothing —
|
|
87
|
+
`plugin-mcp` gates on checkboxes generated at config time, which this suite cannot
|
|
88
|
+
fill because every tool is built at `onInit`. So a key that authenticates reaches
|
|
89
|
+
every collected tool, exactly as an all-or-nothing per-server key did. The
|
|
90
|
+
declarations are kept because they are the mapping those checkboxes need; #78
|
|
91
|
+
tracks restoring enforcement, and the type's own doc comment says so.
|
|
92
|
+
|
|
93
|
+
Also drops the key collection from the playground, which leaves that app with no
|
|
94
|
+
MCP surface at all until `mcpPlugin` can be wired there — #79, blocked on moving
|
|
95
|
+
it off `payload@^3.83.0`.
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- Updated dependencies [3140ea0]
|
|
100
|
+
- @forumone/throughline-plugin-contract@0.4.0
|
|
101
|
+
- @forumone/throughline-core@0.7.0
|
|
102
|
+
|
|
3
103
|
## 0.7.1
|
|
4
104
|
|
|
5
105
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Policy-gated publishing server for Throughline. The trust boundary that decides
|
|
|
8
8
|
- **A trust boundary** — a `beforeChange` hook on every configured collection that rejects direct writes to `_status`. The pipeline is the only sanctioned way to publish.
|
|
9
9
|
- **Admin controls** — Publish and Unpublish buttons that run the pipeline as the logged-in editor. Installed automatically; no host-side code.
|
|
10
10
|
- **A server-side API** — `publishDocument` / `unpublishDocument` / `getPublishStatus` for host code that needs to publish outside the admin.
|
|
11
|
-
- **Five MCP tools**
|
|
11
|
+
- **Five MCP tools** — `publish`, `unpublish`, `schedule_publish`, `get_publish_status`, `rollback` — handed to the host's collector at `onInit` and served by `@payloadcms/plugin-mcp` on one `/api/mcp`. Pass `mcpTools` or they reach nobody.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -71,11 +71,14 @@ With `adminComponents: false` the admin has **no** working publish path until yo
|
|
|
71
71
|
|---|---|---|
|
|
72
72
|
| `POST /api/publishing/publish` | Payload session | `{ collection, id }` |
|
|
73
73
|
| `POST /api/publishing/unpublish` | Payload session | `{ collection, id }` |
|
|
74
|
-
| `POST /api/publishing/mcp` | Bearer API key | JSON-RPC |
|
|
75
74
|
|
|
76
|
-
|
|
75
|
+
Those two, and nothing else. This plugin used to serve `POST /api/publishing/mcp`
|
|
76
|
+
on a JSON-RPC subset written here; it is deleted, along with the five others like
|
|
77
|
+
it.
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
### Serving these tools through Payload's MCP plugin
|
|
80
|
+
|
|
81
|
+
Payload ships `@payloadcms/plugin-mcp` — the official MCP SDK, streamable HTTP, sessions, and per-key per-tool capability checkboxes an admin can see and change. It is now the only way these tools reach a client:
|
|
79
82
|
|
|
80
83
|
```ts
|
|
81
84
|
import { createMcpToolCollector } from '@forumone/throughline-core'
|
|
@@ -90,9 +93,11 @@ plugins: [
|
|
|
90
93
|
]
|
|
91
94
|
```
|
|
92
95
|
|
|
93
|
-
Every
|
|
96
|
+
Every handler here is built at `onInit`, because every one closes over `payload`; `mcpPlugin` takes its tools as a config option. The collector bridges that in two steps: this plugin **declares** its tools' names and descriptions as the config is built — which is when `mcpPlugin` reads the array to generate one per-key checkbox per tool — and **binds** the handlers at `onInit`, which is still before any request. Hand over `mcpTools.tools` itself rather than a copy.
|
|
97
|
+
|
|
98
|
+
**`publishingPlugin` must come before `mcpPlugin` in that array.** Declaring after it has been read means no checkboxes, and a tool with no checkbox is denied to every key with no error anywhere.
|
|
94
99
|
|
|
95
|
-
Omit `mcpTools` and
|
|
100
|
+
Omit `mcpTools` and this plugin's tools are unreachable — there is no per-server endpoint left as a fallback, and nothing errors, because from Payload's side nothing is misconfigured. The admin controls, the trust boundary and `publishDocument` all still work.
|
|
96
101
|
|
|
97
102
|
One thing does not survive the move: `plugin-mcp` resolves a key to its linked user and does not carry the key document forward, so the calling key's *name* is not recoverable. Audit rows record the strategy instead, or a name the host passes as `apiKeyName`.
|
|
98
103
|
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAElF,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAA;IACZ,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mGAAmG;IACnG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,uFAAuF;IACvF,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,0EAA0E;IAC1E,cAAc,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC1D;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,GAAG,SA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AuB,GAAG,uBAAuB,CAezF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,uBAAuB,EAChC,IAAI,EAAE,MAAM,GACX,kBAAkB,CAiBpB"}
|
package/dist/options.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatZodIssues } from '@forumone/throughline-core';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
const PublishableCollectionSchema = z.object({
|
|
3
4
|
slug: z.string().min(1),
|
|
@@ -26,9 +27,7 @@ export function validateOptions(options) {
|
|
|
26
27
|
for (const collection of options.collections) {
|
|
27
28
|
const result = PublishableCollectionSchema.safeParse(collection);
|
|
28
29
|
if (!result.success) {
|
|
29
|
-
const issues = result.error
|
|
30
|
-
.map((i) => ` - ${i.path.join('.') || '(root)'}: ${i.message}`)
|
|
31
|
-
.join('\n');
|
|
30
|
+
const issues = formatZodIssues(result.error);
|
|
32
31
|
throw new Error(`Invalid collection config:\n${issues}`);
|
|
33
32
|
}
|
|
34
33
|
}
|
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":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAqGvB,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;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,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;IAC/D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,sFAAsF,CAC1G,CAAA;IACH,CAAC;IACD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,QAAQ;QAC3C,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;QAClC,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,QAAQ;QAC3C,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,MAAM;QACrC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,aAAa;QAC1D,qBAAqB,EAAE,MAAM,CAAC,qBAAqB,IAAI,oBAAoB;QAC3E,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5E,CAAA;AACH,CAAC"}
|
package/dist/pipeline/index.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export declare function runPublishPipeline(context: PipelineContext): Promise<Pi
|
|
|
9
9
|
* Runs every preflight step (everything but `execute`). Used by
|
|
10
10
|
* `get_publish_status` to answer "would this publish succeed?" without
|
|
11
11
|
* mutating anything.
|
|
12
|
+
*
|
|
13
|
+
* Warnings are deliberately dropped, as they always were: this answers a
|
|
14
|
+
* question about whether a publish would be *blocked*, and a warning does not
|
|
15
|
+
* block. Surfacing them here would be a change to what `get_publish_status`
|
|
16
|
+
* means, not a tidy-up.
|
|
12
17
|
*/
|
|
13
18
|
export declare function runPreflightPipeline(context: PipelineContext): Promise<PipelineResult>;
|
|
14
19
|
export type { PipelineContext, PipelineResult, PipelineStep, PipelineStepResult } from './types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pipeline/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pipeline/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAA;AAoE/E;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAO1F;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAG5F;AAED,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/pipeline/index.js
CHANGED
|
@@ -18,53 +18,71 @@ const ORDERED_STEPS = [
|
|
|
18
18
|
{ name: 'execute', step: executeStep },
|
|
19
19
|
];
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* Walks a list of steps, stopping at the first that does not pass.
|
|
22
|
+
*
|
|
23
|
+
* The failure envelope — `failedAt` plus whichever of `reason`, `code`,
|
|
24
|
+
* `issues` and `suggestion` the step supplied — was written out twice, once per
|
|
25
|
+
* runner, and a field added to one would have been missed by the other. It is
|
|
26
|
+
* written here once.
|
|
27
|
+
*
|
|
28
|
+
* Warnings are collected but not returned in the envelope: what to do with them
|
|
29
|
+
* differs between the two callers, and that difference is the only reason there
|
|
30
|
+
* are still two.
|
|
31
|
+
*
|
|
32
|
+
* One thing worth knowing before adding a step: a warning cannot currently reach
|
|
33
|
+
* a *failure* envelope. `execute` is the only step that warns, it runs last, and
|
|
34
|
+
* its two failure returns carry none — so `runPublishPipeline` spreading
|
|
35
|
+
* warnings onto a failure is unreachable today. It is kept because the moment a
|
|
36
|
+
* step both warns and fails, or an earlier step learns to warn, dropping them
|
|
37
|
+
* would be silent. That is also why there is no test for it: the pipeline has no
|
|
38
|
+
* way to produce the case.
|
|
24
39
|
*/
|
|
25
|
-
|
|
40
|
+
async function runSteps(context, steps) {
|
|
26
41
|
const warnings = [];
|
|
27
|
-
for (const { name, step } of
|
|
42
|
+
for (const { name, step } of steps) {
|
|
28
43
|
const result = await step(context);
|
|
29
44
|
if (result.warnings)
|
|
30
45
|
warnings.push(...result.warnings);
|
|
31
|
-
if (
|
|
32
|
-
|
|
46
|
+
if (result.pass)
|
|
47
|
+
continue;
|
|
48
|
+
return {
|
|
49
|
+
failure: {
|
|
33
50
|
success: false,
|
|
34
51
|
failedAt: name,
|
|
35
52
|
...(result.reason ? { reason: result.reason } : {}),
|
|
36
53
|
...(result.code ? { code: result.code } : {}),
|
|
37
54
|
...(result.issues ? { issues: result.issues } : {}),
|
|
38
55
|
...(result.suggestion ? { suggestion: result.suggestion } : {}),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
56
|
+
},
|
|
57
|
+
warnings,
|
|
58
|
+
};
|
|
42
59
|
}
|
|
43
|
-
return {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
return { warnings };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Runs the full publish pipeline. Stops at the first failing step and
|
|
64
|
+
* returns its diagnostic; otherwise records success with the publish
|
|
65
|
+
* timestamp the execute step set.
|
|
66
|
+
*/
|
|
67
|
+
export async function runPublishPipeline(context) {
|
|
68
|
+
const { failure, warnings } = await runSteps(context, ORDERED_STEPS);
|
|
69
|
+
const carried = warnings.length ? { warnings } : {};
|
|
70
|
+
if (failure)
|
|
71
|
+
return { ...failure, ...carried };
|
|
72
|
+
return { success: true, publishedAt: new Date().toISOString(), ...carried };
|
|
48
73
|
}
|
|
49
74
|
/**
|
|
50
75
|
* Runs every preflight step (everything but `execute`). Used by
|
|
51
76
|
* `get_publish_status` to answer "would this publish succeed?" without
|
|
52
77
|
* mutating anything.
|
|
78
|
+
*
|
|
79
|
+
* Warnings are deliberately dropped, as they always were: this answers a
|
|
80
|
+
* question about whether a publish would be *blocked*, and a warning does not
|
|
81
|
+
* block. Surfacing them here would be a change to what `get_publish_status`
|
|
82
|
+
* means, not a tidy-up.
|
|
53
83
|
*/
|
|
54
84
|
export async function runPreflightPipeline(context) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!result.pass) {
|
|
58
|
-
return {
|
|
59
|
-
success: false,
|
|
60
|
-
failedAt: name,
|
|
61
|
-
...(result.reason ? { reason: result.reason } : {}),
|
|
62
|
-
...(result.code ? { code: result.code } : {}),
|
|
63
|
-
...(result.issues ? { issues: result.issues } : {}),
|
|
64
|
-
...(result.suggestion ? { suggestion: result.suggestion } : {}),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return { success: true };
|
|
85
|
+
const { failure } = await runSteps(context, PREFLIGHT_STEPS);
|
|
86
|
+
return failure ?? { success: true };
|
|
69
87
|
}
|
|
70
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pipeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAQhD,MAAM,eAAe,GAAk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AAQ;SACT,CAAA;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,CAAA;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAwB;IAC/D,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IACpE,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAEnD,IAAI,OAAO;QAAE,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,CAAA;IAE9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,EAAE,CAAA;AAC7E,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAwB;IACjE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;IAC5D,OAAO,OAAO,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AACrC,CAAC"}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAGvE,OAAO,EAAE,KAAK,uBAAuB,EAAmB,MAAM,cAAc,CAAA;AAkB5E,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,CA8G9D,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { getPluginRegistry } from '@forumone/throughline-plugin-contract';
|
|
2
|
-
import {
|
|
2
|
+
import { createNamedLogger, defaultLogger, getAuditWriter } from '@forumone/throughline-core';
|
|
3
3
|
import { validateOptions } from './options.js';
|
|
4
4
|
import { createBlockStatusWritesHook } from './hooks/block-status-writes.js';
|
|
5
5
|
import { createRecordDraftWritesHook } from './hooks/draft-writes.js';
|
|
6
6
|
import { createAdminEndpoints } from './endpoints/admin.js';
|
|
7
7
|
import { attachPublishingService, createPublishingService } from './service.js';
|
|
8
|
-
import { createGetPublishStatusTool, createPublishTool, createRollbackTool, createSchedulePublishTool, createUnpublishTool, } from './tools/index.js';
|
|
8
|
+
import { PUBLISHING_TOOL_DESCRIPTORS, createGetPublishStatusTool, createPublishTool, createRollbackTool, createSchedulePublishTool, createUnpublishTool, } from './tools/index.js';
|
|
9
9
|
const PLUGIN_ID = '@forumone/throughline-publishing';
|
|
10
10
|
const PLUGIN_VERSION = '0.1.0';
|
|
11
|
-
const MCP_HANDLER_SYMBOL = Symbol.for('@forumone/throughline/publishing-mcp-handler');
|
|
12
11
|
const CLIENT_ENTRY = '@forumone/throughline-publishing/client';
|
|
13
12
|
export const publishingPlugin = (rawOptions) => (incomingConfig) => {
|
|
14
13
|
if (rawOptions.enabled === false)
|
|
@@ -45,23 +44,26 @@ export const publishingPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
45
44
|
: {}),
|
|
46
45
|
};
|
|
47
46
|
});
|
|
47
|
+
/*
|
|
48
|
+
Declared here, bound at `onInit`.
|
|
49
|
+
|
|
50
|
+
`mcpPlugin` generates one per-key checkbox per tool while the config is being
|
|
51
|
+
built, from the names and descriptions in this array, and denies any tool it
|
|
52
|
+
has no checkbox for. The handlers cannot exist yet — they close over
|
|
53
|
+
`payload`, the service and the audit writer — but the names never needed to
|
|
54
|
+
wait for them.
|
|
55
|
+
|
|
56
|
+
This runs when Payload applies the plugin, so **this plugin must come before
|
|
57
|
+
`mcpPlugin` in the host's array** or the declarations land after the fields
|
|
58
|
+
are generated.
|
|
59
|
+
*/
|
|
60
|
+
options.mcpTools?.declare(PUBLISHING_TOOL_DESCRIPTORS, { serverName: 'publishing' });
|
|
48
61
|
return {
|
|
49
62
|
...incomingConfig,
|
|
50
63
|
collections: modifiedCollections,
|
|
51
64
|
endpoints: [
|
|
52
65
|
...(incomingConfig.endpoints ?? []),
|
|
53
66
|
...createAdminEndpoints({ routePrefix, publishableSlugs }),
|
|
54
|
-
{
|
|
55
|
-
path: `${routePrefix}/mcp`,
|
|
56
|
-
method: 'post',
|
|
57
|
-
handler: async (req) => {
|
|
58
|
-
const handler = req.payload[MCP_HANDLER_SYMBOL];
|
|
59
|
-
if (!handler) {
|
|
60
|
-
return new Response(JSON.stringify({ error: 'Publishing MCP not initialized' }), { status: 503, headers: { 'content-type': 'application/json' } });
|
|
61
|
-
}
|
|
62
|
-
return handler(req);
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
67
|
],
|
|
66
68
|
onInit: async (payload) => {
|
|
67
69
|
if (incomingConfig.onInit) {
|
|
@@ -82,26 +84,19 @@ export const publishingPlugin = (rawOptions) => (incomingConfig) => {
|
|
|
82
84
|
createRollbackTool({ payload, options, auditWriter }),
|
|
83
85
|
];
|
|
84
86
|
/*
|
|
85
|
-
Payload's own MCP plugin,
|
|
87
|
+
Payload's own MCP plugin, and the only transport these tools have.
|
|
86
88
|
|
|
87
|
-
`onInit` is the first moment
|
|
89
|
+
`onInit` is the first moment they can exist — they close over the
|
|
88
90
|
service, the audit writer and `payload` — and it runs before any request,
|
|
89
91
|
which is when `mcpPlugin` reads the array. That ordering is the whole
|
|
90
92
|
reason a config-time option can be filled at init.
|
|
93
|
+
|
|
94
|
+
A host that registers this plugin without `mcpTools` gets the publish
|
|
95
|
+
pipeline, the admin controls and `publishDocument`, and no MCP surface
|
|
96
|
+
at all. This plugin used to serve its own `/mcp` endpoint as a fallback;
|
|
97
|
+
it no longer does.
|
|
91
98
|
*/
|
|
92
99
|
options.mcpTools?.add(tools, { serverName: 'publishing', logger });
|
|
93
|
-
const handler = createMcpHandler({
|
|
94
|
-
payload,
|
|
95
|
-
serverName: 'publishing',
|
|
96
|
-
tools,
|
|
97
|
-
logger,
|
|
98
|
-
});
|
|
99
|
-
Object.defineProperty(payload, MCP_HANDLER_SYMBOL, {
|
|
100
|
-
value: handler,
|
|
101
|
-
enumerable: false,
|
|
102
|
-
writable: false,
|
|
103
|
-
configurable: false,
|
|
104
|
-
});
|
|
105
100
|
registry.register({
|
|
106
101
|
id: PLUGIN_ID,
|
|
107
102
|
version: PLUGIN_VERSION,
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EAAgC,eAAe,EAAE,MAAM,cAAc,CAAA;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,kBAAkB,CAAA;AAEzB,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EAAE,YAAY;4BAClB,UAAU,EAAE,eAAe;4BAC3B,WAAW,EAAE,EAAE,WAAW,EAAE;yBAC7B;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,IAAI,CAAC,eAAe,KAAK,SAAS;oBACpC,CAAC,CAAC;wBACE,eAAe,EAAE;4BACf,IAAI,EAAE,YAAY;4BAClB,UAAU,EAAE,iBAAiB;4BAC7B,WAAW,EAAE,EAAE,WAAW,EAAE;yBAC7B;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;aACR;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { McpToolDescriptor } from '@forumone/throughline-core';
|
|
2
|
+
export declare const PUBLISHING_TOOLS: {
|
|
3
|
+
readonly publish: {
|
|
4
|
+
readonly name: "publish";
|
|
5
|
+
readonly description: "Publishes a draft document. Runs the full publish pipeline: composition, accessibility, required-field, embargo, and approval checks. Returns success with the publish timestamp, or a specific failedAt step with reason / suggestion when something blocks the publish.";
|
|
6
|
+
};
|
|
7
|
+
readonly unpublish: {
|
|
8
|
+
readonly name: "unpublish";
|
|
9
|
+
readonly description: "Unpublishes a published document by reverting it to draft. Use when content needs to be removed from the public site without deleting it. Fires content/page.unpublished so revalidation and integrations can react.";
|
|
10
|
+
};
|
|
11
|
+
readonly schedulePublish: {
|
|
12
|
+
readonly name: "schedule_publish";
|
|
13
|
+
readonly description: "Schedules a future publish. Validates the document would currently pass the preflight pipeline (composition, accessibility, required fields, embargo, approval), then stores `scheduledPublishAt` on the document. The framework's workflow runner picks up the schedule and executes the full publish pipeline at that time.";
|
|
14
|
+
};
|
|
15
|
+
readonly getPublishStatus: {
|
|
16
|
+
readonly name: "get_publish_status";
|
|
17
|
+
readonly description: "Returns the current publishability of a document without actually publishing. Reports current status, whether unpublished changes exist, the last publish timestamp, and a preflight result indicating whether `publish` would currently succeed. Read-only; no audit record is written.";
|
|
18
|
+
};
|
|
19
|
+
readonly rollback: {
|
|
20
|
+
readonly name: "rollback";
|
|
21
|
+
readonly description: "Rolls a document back to a prior version from Payload's version history. The restored content lands as a fresh draft; call `publish` afterwards if you want it live again. Audits the rollback under publishing.rollback.";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/** Every tool this server contributes, for the collector. */
|
|
25
|
+
export declare const PUBLISHING_TOOL_DESCRIPTORS: readonly McpToolDescriptor[];
|
|
26
|
+
//# sourceMappingURL=descriptors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAenE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;CA0ByB,CAAA;AAEtD,6DAA6D;AAC7D,eAAO,MAAM,2BAA2B,EAAE,SAAS,iBAAiB,EACnC,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This server's tools, by name and description, knowable without a Payload.
|
|
3
|
+
|
|
4
|
+
`@payloadcms/plugin-mcp` reads exactly these two fields while the host's config
|
|
5
|
+
is being built, to generate one per-key checkbox per tool — and gates every call
|
|
6
|
+
on the checkbox matching the tool's name. The handlers cannot exist that early,
|
|
7
|
+
because each closes over `payload`, the publishing service and the audit writer.
|
|
8
|
+
So the plugin declares from here as the config builds, and binds handlers at
|
|
9
|
+
`onInit`.
|
|
10
|
+
|
|
11
|
+
The factories below spread these, so a description edited here is the one the
|
|
12
|
+
checkbox and the MCP client both show, and the two cannot drift.
|
|
13
|
+
*/
|
|
14
|
+
export const PUBLISHING_TOOLS = {
|
|
15
|
+
publish: {
|
|
16
|
+
name: 'publish',
|
|
17
|
+
description: 'Publishes a draft document. Runs the full publish pipeline: composition, accessibility, required-field, embargo, and approval checks. Returns success with the publish timestamp, or a specific failedAt step with reason / suggestion when something blocks the publish.',
|
|
18
|
+
},
|
|
19
|
+
unpublish: {
|
|
20
|
+
name: 'unpublish',
|
|
21
|
+
description: 'Unpublishes a published document by reverting it to draft. Use when content needs to be removed from the public site without deleting it. Fires content/page.unpublished so revalidation and integrations can react.',
|
|
22
|
+
},
|
|
23
|
+
schedulePublish: {
|
|
24
|
+
name: 'schedule_publish',
|
|
25
|
+
description: "Schedules a future publish. Validates the document would currently pass the preflight pipeline (composition, accessibility, required fields, embargo, approval), then stores `scheduledPublishAt` on the document. The framework's workflow runner picks up the schedule and executes the full publish pipeline at that time.",
|
|
26
|
+
},
|
|
27
|
+
getPublishStatus: {
|
|
28
|
+
name: 'get_publish_status',
|
|
29
|
+
description: 'Returns the current publishability of a document without actually publishing. Reports current status, whether unpublished changes exist, the last publish timestamp, and a preflight result indicating whether `publish` would currently succeed. Read-only; no audit record is written.',
|
|
30
|
+
},
|
|
31
|
+
rollback: {
|
|
32
|
+
name: 'rollback',
|
|
33
|
+
description: "Rolls a document back to a prior version from Payload's version history. The restored content lands as a fresh draft; call `publish` afterwards if you want it live again. Audits the rollback under publishing.rollback.",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
/** Every tool this server contributes, for the collector. */
|
|
37
|
+
export const PUBLISHING_TOOL_DESCRIPTORS = Object.values(PUBLISHING_TOOLS);
|
|
38
|
+
//# sourceMappingURL=descriptors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;EAYE;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,WAAW,EACT,2QAA2Q;KAC9Q;IACD,SAAS,EAAE;QACT,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,sNAAsN;KACzN;IACD,eAAe,EAAE;QACf,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,+TAA+T;KAClU;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,0RAA0R;KAC7R;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,2NAA2N;KAC9N;CACmD,CAAA;AAEtD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,2BAA2B,GACtC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-publish-status.d.ts","sourceRoot":"","sources":["../../src/tools/get-publish-status.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"get-publish-status.d.ts","sourceRoot":"","sources":["../../src/tools/get-publish-status.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAG/E,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,uBAAuB,CAAA;IAChC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC5B;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,wBAAwB,GAAG,iBAAiB,CAuC5F"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { withMeta } from '@forumone/throughline-core';
|
|
3
3
|
import { createPublishingService } from '../service.js';
|
|
4
|
+
import { PUBLISHING_TOOLS } from './descriptors.js';
|
|
4
5
|
export function createGetPublishStatusTool(deps) {
|
|
5
6
|
const inputSchema = withMeta({
|
|
6
7
|
collection: z.string(),
|
|
@@ -9,8 +10,7 @@ export function createGetPublishStatusTool(deps) {
|
|
|
9
10
|
const service = deps.service ??
|
|
10
11
|
createPublishingService({ ...deps, auditWriter: async () => { } });
|
|
11
12
|
return {
|
|
12
|
-
|
|
13
|
-
description: "Returns the current publishability of a document without actually publishing. Reports current status, whether unpublished changes exist, the last publish timestamp, and a preflight result indicating whether `publish` would currently succeed. Read-only; no audit record is written.",
|
|
13
|
+
...PUBLISHING_TOOLS.getPublishStatus,
|
|
14
14
|
inputSchema,
|
|
15
15
|
handler: async (input, ctx) => {
|
|
16
16
|
const status = await service.getStatus({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-publish-status.js","sourceRoot":"","sources":["../../src/tools/get-publish-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAGrD,OAAO,EAAE,uBAAuB,EAA0B,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"get-publish-status.js","sourceRoot":"","sources":["../../src/tools/get-publish-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAGrD,OAAO,EAAE,uBAAuB,EAA0B,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AASnD,MAAM,UAAU,0BAA0B,CAAC,IAA8B;IACvE,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,EAAE,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ptors.js';
|
|
1
2
|
export { createPublishTool, type PublishToolDeps } from './publish.js';
|
|
2
3
|
export { createUnpublishTool, type UnpublishToolDeps } from './unpublish.js';
|
|
3
4
|
export { createSchedulePublishTool, type SchedulePublishToolDeps, } from './schedule-publish.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EACL,yBAAyB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,0BAA0B,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EACL,yBAAyB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,0BAA0B,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/tools/index.js
CHANGED
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwB,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAA0B,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EACL,yBAAyB,GAE1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,0BAA0B,GAE3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAyB,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAwB,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAA0B,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EACL,yBAAyB,GAE1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,0BAA0B,GAE3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAyB,MAAM,eAAe,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/tools/publish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/tools/publish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAG/E,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,uBAAuB,CAAA;IAChC,WAAW,EAAE,WAAW,CAAA;IACxB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC5B;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,iBAAiB,CA0B1E"}
|
package/dist/tools/publish.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { withMeta } from '@forumone/throughline-core';
|
|
3
3
|
import { createPublishingService } from '../service.js';
|
|
4
|
+
import { PUBLISHING_TOOLS } from './descriptors.js';
|
|
4
5
|
export function createPublishTool(deps) {
|
|
5
6
|
const inputSchema = withMeta({
|
|
6
7
|
collection: z.string().describe('The collection slug (e.g. "pages")'),
|
|
@@ -8,9 +9,14 @@ export function createPublishTool(deps) {
|
|
|
8
9
|
});
|
|
9
10
|
const service = deps.service ?? createPublishingService(deps);
|
|
10
11
|
return {
|
|
11
|
-
|
|
12
|
+
...PUBLISHING_TOOLS.publish,
|
|
13
|
+
/*
|
|
14
|
+
Declared, and read by nothing. The per-key checkbox `plugin-mcp` generates
|
|
15
|
+
is what gates this tool; this records that publishing is consequential, and
|
|
16
|
+
is the mapping a scope-aware default would be built from. See
|
|
17
|
+
`McpToolDefinition`.
|
|
18
|
+
*/
|
|
12
19
|
requiredScope: 'publishing.execute',
|
|
13
|
-
description: "Publishes a draft document. Runs the full publish pipeline: composition, accessibility, required-field, embargo, and approval checks. Returns success with the publish timestamp, or a specific failedAt step with reason / suggestion when something blocks the publish.",
|
|
14
20
|
inputSchema,
|
|
15
21
|
handler: async (input, ctx) => service.publish({
|
|
16
22
|
collection: input.collection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/tools/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAGvE,OAAO,EAAE,uBAAuB,EAA0B,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/tools/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAGvE,OAAO,EAAE,uBAAuB,EAA0B,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAUnD,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;QACrE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;KAC3C,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAA;IAE7D,OAAO;QACL,GAAG,gBAAgB,CAAC,OAAO;QAC3B;;;;;UAKE;QACF,aAAa,EAAE,oBAAoB;QACnC,WAAW;QACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAC5B,OAAO,CAAC,OAAO,CAAC;YACd,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE;YACrE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C,CAAC;KACL,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollback.d.ts","sourceRoot":"","sources":["../../src/tools/rollback.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAE9E,OAAO,EAAE,KAAK,uBAAuB,EAAqB,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"rollback.d.ts","sourceRoot":"","sources":["../../src/tools/rollback.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAE9E,OAAO,EAAE,KAAK,uBAAuB,EAAqB,MAAM,eAAe,CAAA;AAG/E,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,uBAAuB,CAAA;IAChC,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,CAmF5E"}
|
package/dist/tools/rollback.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { withMeta } from '@forumone/throughline-core';
|
|
3
3
|
import { sendEventSafely } from '../events.js';
|
|
4
4
|
import { resolveCollection } from '../options.js';
|
|
5
|
+
import { PUBLISHING_TOOLS } from './descriptors.js';
|
|
5
6
|
export function createRollbackTool(deps) {
|
|
6
7
|
const inputSchema = withMeta({
|
|
7
8
|
collection: z.string(),
|
|
@@ -9,9 +10,8 @@ export function createRollbackTool(deps) {
|
|
|
9
10
|
versionId: z.string().describe('The version ID to roll the document back to'),
|
|
10
11
|
});
|
|
11
12
|
return {
|
|
12
|
-
|
|
13
|
+
...PUBLISHING_TOOLS.rollback,
|
|
13
14
|
requiredScope: 'publishing.execute',
|
|
14
|
-
description: "Rolls a document back to a prior version from Payload's version history. The restored content lands as a fresh draft; call `publish` afterwards if you want it live again. Audits the rollback under publishing.rollback.",
|
|
15
15
|
inputSchema,
|
|
16
16
|
handler: async (input, ctx) => {
|
|
17
17
|
const collection = resolveCollection(deps.options, input.collection);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollback.js","sourceRoot":"","sources":["../../src/tools/rollback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAgC,iBAAiB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"rollback.js","sourceRoot":"","sources":["../../src/tools/rollback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAgC,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAQnD,M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AC,UAAU;gBAClC,QAAQ,EAAE,KAAK,CAAC,EAAE;gBAClB,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,UAAU;gBAC/B,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS;gBACjC,cAAc,EAAE,0BAA0B,KAAK,CAAC,SAAS,EAAE;gBAC3D,OAAO,EAAE,IAAI;aACd,CAAC,CAAA;YAEF,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,KAAK,CAAC,SAAS;gBAC5B,IAAI,EAAE,kEAAkE;gBACxE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5C,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-publish.d.ts","sourceRoot":"","sources":["../../src/tools/schedule-publish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAE9E,OAAO,EAAE,KAAK,uBAAuB,EAAqB,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"schedule-publish.d.ts","sourceRoot":"","sources":["../../src/tools/schedule-publish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAE9E,OAAO,EAAE,KAAK,uBAAuB,EAAqB,MAAM,eAAe,CAAA;AAI/E,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,uBAAuB,CAAA;IAChC,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,GAAG,iBAAiB,CAyG1F"}
|
|
@@ -3,6 +3,7 @@ import { withMeta } from '@forumone/throughline-core';
|
|
|
3
3
|
import { sendEventSafely } from '../events.js';
|
|
4
4
|
import { resolveCollection } from '../options.js';
|
|
5
5
|
import { runPreflightPipeline } from '../pipeline/index.js';
|
|
6
|
+
import { PUBLISHING_TOOLS } from './descriptors.js';
|
|
6
7
|
export function createSchedulePublishTool(deps) {
|
|
7
8
|
const inputSchema = withMeta({
|
|
8
9
|
collection: z.string(),
|
|
@@ -13,9 +14,8 @@ export function createSchedulePublishTool(deps) {
|
|
|
13
14
|
.describe('ISO 8601 timestamp at which the document should be published'),
|
|
14
15
|
});
|
|
15
16
|
return {
|
|
16
|
-
|
|
17
|
+
...PUBLISHING_TOOLS.schedulePublish,
|
|
17
18
|
requiredScope: 'publishing.execute',
|
|
18
|
-
description: "Schedules a future publish. Validates the document would currently pass the preflight pipeline (composition, accessibility, required fields, embargo, approval), then stores `scheduledPublishAt` on the document. The framework's workflow runner picks up the schedule and executes the full publish pipeline at that time.",
|
|
19
19
|
inputSchema,
|
|
20
20
|
handler: async (input, ctx) => {
|
|
21
21
|
const collection = resolveCollection(deps.options, input.collection);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-publish.js","sourceRoot":"","sources":["../../src/tools/schedule-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAgC,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,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C,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBACjF,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,UAAU;gBAC/B,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS;gBACjC,cAAc,EAAE,yBAAyB,KAAK,CAAC,SAAS,EAAE;gBAC1D,OAAO,EAAE,IAAI;aACd,CAAC,CAAA;YAEF,OAAO;gBACL,SAAS,EAAE,IAAI;gBACf,YAAY,EAAE,KAAK,CAAC,SAAS;gBAC7B,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5C,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpublish.d.ts","sourceRoot":"","sources":["../../src/tools/unpublish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"unpublish.d.ts","sourceRoot":"","sources":["../../src/tools/unpublish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,4BAA4B,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAG/E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,uBAAuB,CAAA;IAChC,WAAW,EAAE,WAAW,CAAA;IACxB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC5B;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,iBAAiB,CAoB9E"}
|
package/dist/tools/unpublish.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { withMeta } from '@forumone/throughline-core';
|
|
3
3
|
import { createPublishingService } from '../service.js';
|
|
4
|
+
import { PUBLISHING_TOOLS } from './descriptors.js';
|
|
4
5
|
export function createUnpublishTool(deps) {
|
|
5
6
|
const inputSchema = withMeta({
|
|
6
7
|
collection: z.string(),
|
|
@@ -8,9 +9,8 @@ export function createUnpublishTool(deps) {
|
|
|
8
9
|
});
|
|
9
10
|
const service = deps.service ?? createPublishingService(deps);
|
|
10
11
|
return {
|
|
11
|
-
|
|
12
|
+
...PUBLISHING_TOOLS.unpublish,
|
|
12
13
|
requiredScope: 'publishing.execute',
|
|
13
|
-
description: 'Unpublishes a published document by reverting it to draft. Use when content needs to be removed from the public site without deleting it. Fires content/page.unpublished so revalidation and integrations can react.',
|
|
14
14
|
inputSchema,
|
|
15
15
|
handler: async (input, ctx) => service.unpublish({
|
|
16
16
|
collection: input.collection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpublish.js","sourceRoot":"","sources":["../../src/tools/unpublish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAGvE,OAAO,EAAE,uBAAuB,EAA0B,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"unpublish.js","sourceRoot":"","sources":["../../src/tools/unpublish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAGvE,OAAO,EAAE,uBAAuB,EAA0B,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAUnD,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;KACf,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAA;IAE7D,OAAO;QACL,GAAG,gBAAgB,CAAC,SAAS;QAC7B,aAAa,EAAE,oBAAoB;QACnC,WAAW;QACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAC5B,OAAO,CAAC,SAAS,CAAC;YAChB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE;YACrE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C,CAAC;KACL,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forumone/throughline-publishing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Policy-gated publishing server for Throughline. Wraps Payload's update operation with composition, accessibility, required-field, embargo, and approval gating.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"zod": "^3.23.0",
|
|
62
|
-
"@forumone/throughline-core": "0.
|
|
63
|
-
"@forumone/throughline-plugin-contract": "0.
|
|
62
|
+
"@forumone/throughline-core": "0.8.0",
|
|
63
|
+
"@forumone/throughline-plugin-contract": "0.4.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@payloadcms/db-sqlite": "^3.83.0",
|