@forumone/throughline-publishing 0.2.3 → 0.3.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/CHANGELOG.md +27 -0
- package/README.md +154 -1
- package/dist/admin/PublishButton.d.ts +24 -0
- package/dist/admin/PublishButton.d.ts.map +1 -0
- package/dist/admin/PublishButton.js +128 -0
- package/dist/admin/PublishButton.js.map +1 -0
- package/dist/admin/UnpublishButton.d.ts +15 -0
- package/dist/admin/UnpublishButton.d.ts.map +1 -0
- package/dist/admin/UnpublishButton.js +90 -0
- package/dist/admin/UnpublishButton.js.map +1 -0
- package/dist/admin/publishing-client.d.ts +55 -0
- package/dist/admin/publishing-client.d.ts.map +1 -0
- package/dist/admin/publishing-client.js +64 -0
- package/dist/admin/publishing-client.js.map +1 -0
- package/dist/checks/alt-text.d.ts +8 -2
- package/dist/checks/alt-text.d.ts.map +1 -1
- package/dist/checks/alt-text.js +13 -3
- package/dist/checks/alt-text.js.map +1 -1
- package/dist/endpoints/admin.d.ts +19 -0
- package/dist/endpoints/admin.d.ts.map +1 -0
- package/dist/endpoints/admin.js +93 -0
- package/dist/endpoints/admin.js.map +1 -0
- package/dist/events.d.ts +16 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +30 -0
- package/dist/events.js.map +1 -0
- package/dist/exports/client.d.ts +14 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +11 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/hooks/block-status-writes.d.ts +4 -0
- package/dist/hooks/block-status-writes.d.ts.map +1 -1
- package/dist/hooks/block-status-writes.js +6 -1
- package/dist/hooks/block-status-writes.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +19 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js.map +1 -1
- package/dist/pipeline/index.d.ts.map +1 -1
- package/dist/pipeline/index.js +9 -1
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/steps/accessibility.d.ts +4 -0
- package/dist/pipeline/steps/accessibility.d.ts.map +1 -1
- package/dist/pipeline/steps/accessibility.js +6 -1
- package/dist/pipeline/steps/accessibility.js.map +1 -1
- package/dist/pipeline/steps/execute.d.ts +9 -0
- package/dist/pipeline/steps/execute.d.ts.map +1 -1
- package/dist/pipeline/steps/execute.js +17 -2
- package/dist/pipeline/steps/execute.js.map +1 -1
- package/dist/pipeline/types.d.ts +15 -1
- package/dist/pipeline/types.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +62 -5
- package/dist/plugin.js.map +1 -1
- package/dist/service.d.ts +116 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +245 -0
- package/dist/service.js.map +1 -0
- package/dist/tools/get-publish-status.d.ts +4 -1
- package/dist/tools/get-publish-status.d.ts.map +1 -1
- package/dist/tools/get-publish-status.js +16 -30
- package/dist/tools/get-publish-status.js.map +1 -1
- package/dist/tools/publish.d.ts +4 -1
- package/dist/tools/publish.d.ts.map +1 -1
- package/dist/tools/publish.js +8 -57
- package/dist/tools/publish.js.map +1 -1
- package/dist/tools/rollback.d.ts.map +1 -1
- package/dist/tools/rollback.js +5 -1
- package/dist/tools/rollback.js.map +1 -1
- package/dist/tools/schedule-publish.d.ts.map +1 -1
- package/dist/tools/schedule-publish.js +9 -2
- package/dist/tools/schedule-publish.js.map +1 -1
- package/dist/tools/unpublish.d.ts +4 -1
- package/dist/tools/unpublish.d.ts.map +1 -1
- package/dist/tools/unpublish.js +8 -47
- package/dist/tools/unpublish.js.map +1 -1
- package/package.json +19 -2
package/dist/checks/alt-text.js
CHANGED
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
* a `url` or `filename` property whose `mimeType`, if present, starts with
|
|
4
4
|
* `image/`). Flags any whose `alt` is missing or empty.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Skips an upload's `sizes` map: Payload's generated derivatives carry
|
|
7
|
+
* `filename` and `mimeType` but never `alt`, which lives on the parent
|
|
8
|
+
* document. They are renditions of an image already checked, not images in
|
|
9
|
+
* their own right — walking into them reports one false failure per
|
|
10
|
+
* configured `imageSize`.
|
|
11
|
+
*
|
|
12
|
+
* Heuristic, not exhaustive. A host can add checks via `accessibilityChecks`
|
|
13
|
+
* and switch a built-in off via `disableAccessibilityChecks`.
|
|
8
14
|
*/
|
|
9
15
|
export const altTextCheck = {
|
|
10
16
|
name: 'alt-text',
|
|
@@ -33,10 +39,14 @@ function walkForImages(value, visit, path = '') {
|
|
|
33
39
|
return;
|
|
34
40
|
}
|
|
35
41
|
const obj = value;
|
|
36
|
-
|
|
42
|
+
const isImage = looksLikeImage(obj);
|
|
43
|
+
if (isImage) {
|
|
37
44
|
visit(obj, path || '(root)');
|
|
38
45
|
}
|
|
39
46
|
for (const key of Object.keys(obj)) {
|
|
47
|
+
// An image's own derivatives are not separate images.
|
|
48
|
+
if (isImage && key === 'sizes')
|
|
49
|
+
continue;
|
|
40
50
|
walkForImages(obj[key], visit, path ? `${path}.${key}` : key);
|
|
41
51
|
}
|
|
42
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alt-text.js","sourceRoot":"","sources":["../../src/checks/alt-text.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"alt-text.js","sourceRoot":"","sources":["../../src/checks/alt-text.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,GAAuB;IAC9C,IAAI,EAAE,UAAU;IAChB,GAAG,CAAC,GAAG;QACL,MAAM,MAAM,GAAyB,EAAE,CAAA;QACvC,aAAa,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACjC,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;YACxB,IAAI,OAAO,GAAG,K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C;AAED,SAAS,cAAc,CAAC,GAA4B;IAClD,wEAAwE;IACxE,qEAAqE;IACrE,wEAAwE;IACxE,qBAAqB;IACrB,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAA;IAC5B,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC9D,OAAO,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,QAAQ,CAAA;AAC5C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Endpoint } from 'payload';
|
|
2
|
+
export interface CreateAdminEndpointsDeps {
|
|
3
|
+
/** Route prefix the plugin is mounted under, e.g. `/publishing`. */
|
|
4
|
+
routePrefix: string;
|
|
5
|
+
/** Collections registered as publishable; anything else is rejected. */
|
|
6
|
+
publishableSlugs: Set<string>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The admin's path into the pipeline.
|
|
10
|
+
*
|
|
11
|
+
* These endpoints authenticate off the Payload session cookie, so `req.user`
|
|
12
|
+
* is the logged-in editor — no API key in the editorial publish path, and
|
|
13
|
+
* the audit event records the person rather than a service principal. The
|
|
14
|
+
* write still goes through the pipeline, and still runs with
|
|
15
|
+
* `overrideAccess: false`, so neither the policy checks nor the collection's
|
|
16
|
+
* access control are skipped.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createAdminEndpoints(deps: CreateAdminEndpointsDeps): Endpoint[];
|
|
19
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/endpoints/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,QAAQ,EAAuB,MAAM,SAAS,CAAA;AAStE,MAAM,WAAW,wBAAwB;IACvC,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAA;IACnB,wEAAwE;IACxE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,wBAAwB,GAAG,QAAQ,EAAE,CAa/E"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { APIError } from 'payload';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getPublishingService, toAuthenticatedUser } from '../service.js';
|
|
4
|
+
const BodySchema = z.object({
|
|
5
|
+
collection: z.string().min(1),
|
|
6
|
+
id: z.union([z.string().min(1), z.number()]),
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* The admin's path into the pipeline.
|
|
10
|
+
*
|
|
11
|
+
* These endpoints authenticate off the Payload session cookie, so `req.user`
|
|
12
|
+
* is the logged-in editor — no API key in the editorial publish path, and
|
|
13
|
+
* the audit event records the person rather than a service principal. The
|
|
14
|
+
* write still goes through the pipeline, and still runs with
|
|
15
|
+
* `overrideAccess: false`, so neither the policy checks nor the collection's
|
|
16
|
+
* access control are skipped.
|
|
17
|
+
*/
|
|
18
|
+
export function createAdminEndpoints(deps) {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
path: `${deps.routePrefix}/publish`,
|
|
22
|
+
method: 'post',
|
|
23
|
+
handler: (req) => handle(req, deps, 'publish'),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
path: `${deps.routePrefix}/unpublish`,
|
|
27
|
+
method: 'post',
|
|
28
|
+
handler: (req) => handle(req, deps, 'unpublish'),
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
async function handle(req, deps, action) {
|
|
33
|
+
if (!req.user) {
|
|
34
|
+
return json({ error: 'You must be logged in to publish.' }, 401);
|
|
35
|
+
}
|
|
36
|
+
let raw;
|
|
37
|
+
try {
|
|
38
|
+
raw = await req.json?.();
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return json({ error: 'Invalid JSON body.' }, 400);
|
|
42
|
+
}
|
|
43
|
+
const parsed = BodySchema.safeParse(raw);
|
|
44
|
+
if (!parsed.success) {
|
|
45
|
+
return json({ error: 'Expected a JSON body with `collection` and `id`.' }, 400);
|
|
46
|
+
}
|
|
47
|
+
const { collection } = parsed.data;
|
|
48
|
+
const id = String(parsed.data.id);
|
|
49
|
+
if (!deps.publishableSlugs.has(collection)) {
|
|
50
|
+
return json({
|
|
51
|
+
error: `Collection "${collection}" is not registered as publishable. Add it to publishingPlugin's collections option.`,
|
|
52
|
+
}, 400);
|
|
53
|
+
}
|
|
54
|
+
let service;
|
|
55
|
+
try {
|
|
56
|
+
service = getPublishingService(req.payload);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return json({ error: 'Publishing server not initialized.' }, 503);
|
|
60
|
+
}
|
|
61
|
+
const request = {
|
|
62
|
+
collection,
|
|
63
|
+
id,
|
|
64
|
+
actor: {
|
|
65
|
+
user: toAuthenticatedUser(req.user),
|
|
66
|
+
enforceAccessAs: req.user,
|
|
67
|
+
channel: 'admin',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
const result = action === 'publish'
|
|
72
|
+
? await service.publish(request)
|
|
73
|
+
: await service.unpublish(request);
|
|
74
|
+
// A pipeline block is a real answer, not a transport failure: 200 with
|
|
75
|
+
// the diagnostic so the admin can render `failedAt` / `reason` /
|
|
76
|
+
// `issues` / `suggestion` rather than a generic error.
|
|
77
|
+
return json(result, 200);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error instanceof APIError) {
|
|
81
|
+
return json({ error: error.message }, error.status || 500);
|
|
82
|
+
}
|
|
83
|
+
req.payload.logger.error({ err: error }, `[publishing] admin ${action} failed for ${collection}/${id}`);
|
|
84
|
+
return json({ error: `Could not ${action} this document.` }, 500);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function json(body, status) {
|
|
88
|
+
return new Response(JSON.stringify(body), {
|
|
89
|
+
status,
|
|
90
|
+
headers: { 'content-type': 'application/json' },
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../src/endpoints/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsC,MAAM,SAAS,CAAA;AACtE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEzE,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;CAC7C,CAAC,CAAA;AASF;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAA8B;IACjE,OAAO;QACL;YACE,IAAI,EAAE,GAAG,IAAI,CAAC,WAAW,UAAU;YACnC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC;SAC/C;QACD;YACE,IAAI,EAAE,GAAG,IAAI,CAAC,WAAW,YAAY;YACrC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,CAAC;SACjD;KACF,CAAA;AACH,CAAC;AAED,KAAK,UAAU,MAAM,CACnB,GAAmB,EACnB,IAA8B,EAC9B,MAA+B;IAE/B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,IAAI,CAAC,EAAE,KAAK,E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I,CAAC;QACH,MAAM,MAAM,GACV,MAAM,KAAK,SAAS;YAClB,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;YAChC,CAAC,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QACtC,uEAAuE;QACvE,iEAAiE;QACjE,uDAAuD;QACvD,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAA;QAC5D,CAAC;QACD,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CACtB,EAAE,GAAG,EAAE,KAAK,EAAE,EACd,sBAAsB,MAAM,eAAe,UAAU,IAAI,EAAE,EAAE,CAC9D,CAAA;QACD,OAAO,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,MAAM,iBAAiB,EAAE,EAAE,GAAG,CAAC,CAAA;IACnE,CAAC;AACH,CAAC;AAED,SAAS,IAAI,CAAC,IAAa,EAAE,MAAc;IACzC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;QACxC,MAAM;QACN,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAChD,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Inngest } from 'inngest';
|
|
2
|
+
type EventPayload = Parameters<Inngest['send']>[0];
|
|
3
|
+
/**
|
|
4
|
+
* Emits an Inngest event without letting a transport failure fail the action
|
|
5
|
+
* that already completed. Returns a warning message on failure, `null` on
|
|
6
|
+
* success.
|
|
7
|
+
*
|
|
8
|
+
* Publishing writes the document first and emits afterwards. The event is a
|
|
9
|
+
* consequence of the write, not a step in it — if the emission fails the
|
|
10
|
+
* document is still published. Throwing here would tell an editor their
|
|
11
|
+
* change didn't go live when it did, and the obvious response to that is to
|
|
12
|
+
* click Publish again on content that is already live.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sendEventSafely(inngest: Inngest, event: EventPayload): Promise<string | null>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAElD;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQxB"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emits an Inngest event without letting a transport failure fail the action
|
|
3
|
+
* that already completed. Returns a warning message on failure, `null` on
|
|
4
|
+
* success.
|
|
5
|
+
*
|
|
6
|
+
* Publishing writes the document first and emits afterwards. The event is a
|
|
7
|
+
* consequence of the write, not a step in it — if the emission fails the
|
|
8
|
+
* document is still published. Throwing here would tell an editor their
|
|
9
|
+
* change didn't go live when it did, and the obvious response to that is to
|
|
10
|
+
* click Publish again on content that is already live.
|
|
11
|
+
*/
|
|
12
|
+
export async function sendEventSafely(inngest, event) {
|
|
13
|
+
try {
|
|
14
|
+
await inngest.send(event);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
const name = eventName(event);
|
|
19
|
+
return `The ${name} event could not be sent, so revalidation and integrations may not have run: ${describeError(error)}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function eventName(event) {
|
|
23
|
+
if (Array.isArray(event))
|
|
24
|
+
return event[0]?.name ?? 'publishing';
|
|
25
|
+
return event.name ?? 'publishing';
|
|
26
|
+
}
|
|
27
|
+
function describeError(error) {
|
|
28
|
+
return error instanceof Error ? error.message : String(error);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAgB,EAChB,KAAmB;IAEnB,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACzB,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;QAC7B,OAAO,OAAO,IAAI,gFAAgF,aAAa,CAAC,KAAK,CAAC,EAAE,CAAA;IAC1H,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,KAAmB;IACpC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,YAAY,CAAA;IAC/D,OAAQ,KAA2B,CAAC,IAAI,IAAI,YAAY,CAAA;AAC1D,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client entry point for the admin controls, referenced from Payload's
|
|
3
|
+
* import map as `@forumone/throughline-publishing/client#PublishButton`.
|
|
4
|
+
*
|
|
5
|
+
* Kept separate from the package root so server-only consumers never pull
|
|
6
|
+
* React or `@payloadcms/ui` into their bundle.
|
|
7
|
+
*/
|
|
8
|
+
export { PublishButton } from '../admin/PublishButton.js';
|
|
9
|
+
export type { ThroughlinePublishButtonProps } from '../admin/PublishButton.js';
|
|
10
|
+
export { UnpublishButton } from '../admin/UnpublishButton.js';
|
|
11
|
+
export type { ThroughlineUnpublishButtonProps } from '../admin/UnpublishButton.js';
|
|
12
|
+
export { callPublishingEndpoint, describeBlock } from '../admin/publishing-client.js';
|
|
13
|
+
export type { CallPublishingEndpointArgs, PublishingCallResult, PublishingIssue, PublishingResponse, } from '../admin/publishing-client.js';
|
|
14
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,YAAY,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAA;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,YAAY,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAA;AAElF,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AACrF,YAAY,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,eAAe,EACf,kBAAkB,GACnB,MAAM,+BAA+B,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client entry point for the admin controls, referenced from Payload's
|
|
3
|
+
* import map as `@forumone/throughline-publishing/client#PublishButton`.
|
|
4
|
+
*
|
|
5
|
+
* Kept separate from the package root so server-only consumers never pull
|
|
6
|
+
* React or `@payloadcms/ui` into their bundle.
|
|
7
|
+
*/
|
|
8
|
+
export { PublishButton } from '../admin/PublishButton.js';
|
|
9
|
+
export { UnpublishButton } from '../admin/UnpublishButton.js';
|
|
10
|
+
export { callPublishingEndpoint, describeBlock } from '../admin/publishing-client.js';
|
|
11
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAGzD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAG7D,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA"}
|
|
@@ -7,6 +7,10 @@ import type { CollectionBeforeChangeHook } from 'payload';
|
|
|
7
7
|
* Without this hook, the Payload MCP could let Claude flip a document to
|
|
8
8
|
* `published` directly, sidestepping every check the publishing server
|
|
9
9
|
* exists to enforce. With it, the only sanctioned path is the pipeline.
|
|
10
|
+
*
|
|
11
|
+
* Throws `APIError` rather than `Error` so Payload returns 400 with the
|
|
12
|
+
* message intact instead of swallowing it into a 500 and a generic
|
|
13
|
+
* "Something went wrong" toast.
|
|
10
14
|
*/
|
|
11
15
|
export declare function createBlockStatusWritesHook(): CollectionBeforeChangeHook;
|
|
12
16
|
//# sourceMappingURL=block-status-writes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-status-writes.d.ts","sourceRoot":"","sources":["../../src/hooks/block-status-writes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block-status-writes.d.ts","sourceRoot":"","sources":["../../src/hooks/block-status-writes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAEzD;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,IAAI,0BAA0B,CAsBxE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APIError } from 'payload';
|
|
1
2
|
/**
|
|
2
3
|
* The trust boundary. This `beforeChange` hook rejects every update that
|
|
3
4
|
* touches `_status` unless the request explicitly carries the
|
|
@@ -6,6 +7,10 @@
|
|
|
6
7
|
* Without this hook, the Payload MCP could let Claude flip a document to
|
|
7
8
|
* `published` directly, sidestepping every check the publishing server
|
|
8
9
|
* exists to enforce. With it, the only sanctioned path is the pipeline.
|
|
10
|
+
*
|
|
11
|
+
* Throws `APIError` rather than `Error` so Payload returns 400 with the
|
|
12
|
+
* message intact instead of swallowing it into a 500 and a generic
|
|
13
|
+
* "Something went wrong" toast.
|
|
9
14
|
*/
|
|
10
15
|
export function createBlockStatusWritesHook() {
|
|
11
16
|
return ({ data, originalDoc, operation, context, req }) => {
|
|
@@ -22,7 +27,7 @@ export function createBlockStatusWritesHook() {
|
|
|
22
27
|
}
|
|
23
28
|
if (isBypassed(context) || isBypassed(req?.context))
|
|
24
29
|
return data;
|
|
25
|
-
throw new
|
|
30
|
+
throw new APIError('Direct writes to `_status` are not allowed. Use the publishing server (publish / unpublish / rollback) so the policy pipeline runs.', 400);
|
|
26
31
|
};
|
|
27
32
|
}
|
|
28
33
|
function hasStatusChange(data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-status-writes.js","sourceRoot":"","sources":["../../src/hooks/block-status-writes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block-status-writes.js","sourceRoot":"","sources":["../../src/hooks/block-status-writes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGlC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;QACxD,IAAI,SAAS,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAA;QACvC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAA;QAEvC,+DAA+D;QAC/D,IACE,WAAW;YACX,OAAO,WAAW,KAAK,QAAQ;YAC9B,IAAgC,CAAC,SAAS,CAAC;gBACzC,WAAuC,CAAC,SAAS,CAAC,EACrD,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;YAAE,OAAO,IAAI,CAAA;QAEhE,MAAM,IAAI,QAAQ,CAChB,qIAAqI,EACrI,GAAG,CACJ,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAED,SAAS,eAAe,CAAC,IAAa;IACpC,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,SAAS,IAAI,IAAI,CAC/D,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAC,OAAgB;IAClC,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IACzD,OAAQ,OAAmC,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAA;AAChF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export { publishingPlugin } from './plugin.js';
|
|
2
2
|
export type { AccessibilityCheck, AccessibilityIssue, ActiveApproval, ApprovalResolver, PublishableCollection, PublishingPluginOptions, ResolvedCollection, } from './options.js';
|
|
3
3
|
export type { PipelineContext, PipelineResult, PipelineStep, PipelineStepResult, } from './pipeline/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Server-side publishing API. Use these from host code — a custom endpoint,
|
|
6
|
+
* a scheduled job, a Server Action — to run the full policy pipeline as a
|
|
7
|
+
* given user, with no API key and correct audit attribution.
|
|
8
|
+
*/
|
|
9
|
+
export { getPublishStatus, getPublishingService, publishDocument, unpublishDocument, } from './service.js';
|
|
10
|
+
export type { DocumentActionArgs, PublishOutcome, PublishRequest, PublishStatusOutcome, PublishingActor, PublishingService, UnpublishOutcome, } from './service.js';
|
|
4
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAA;AAErB,YAAY,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,kBAAkB,GACnB,MAAM,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAA;AAErB,YAAY,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,kBAAkB,GACnB,MAAM,qBAAqB,CAAA;AAE5B;;;;GAIG;AACH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,MAAM,cAAc,CAAA;AAErB,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export { publishingPlugin } from './plugin.js';
|
|
2
|
+
/**
|
|
3
|
+
* Server-side publishing API. Use these from host code — a custom endpoint,
|
|
4
|
+
* a scheduled job, a Server Action — to run the full policy pipeline as a
|
|
5
|
+
* given user, with no API key and correct audit attribution.
|
|
6
|
+
*/
|
|
7
|
+
export { getPublishStatus, getPublishingService, publishDocument, unpublishDocument, } from './service.js';
|
|
2
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAmB9C;;;;GAIG;AACH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,MAAM,cAAc,CAAA"}
|
package/dist/options.d.ts
CHANGED
|
@@ -45,10 +45,29 @@ export interface PublishingPluginOptions extends BaseCorePluginOptions {
|
|
|
45
45
|
collections: PublishableCollection[];
|
|
46
46
|
/** Optional: extra accessibility checks beyond the built-ins. */
|
|
47
47
|
accessibilityChecks?: AccessibilityCheck[];
|
|
48
|
+
/**
|
|
49
|
+
* Optional: names of built-in accessibility checks to skip —
|
|
50
|
+
* `'alt-text'`, `'heading-hierarchy'`, `'link-labels'`.
|
|
51
|
+
*
|
|
52
|
+
* `accessibilityChecks` only appends, so without this a built-in that
|
|
53
|
+
* misfires on a host's content shape blocks every publish until the
|
|
54
|
+
* plugin ships a fix. Switch one off here and supply your own.
|
|
55
|
+
*/
|
|
56
|
+
disableAccessibilityChecks?: string[];
|
|
48
57
|
/** Optional: resolver consulted when a document's policy requires approval. */
|
|
49
58
|
approvalResolver?: ApprovalResolver;
|
|
50
59
|
/** Required: Inngest client used to fire publishing events. */
|
|
51
60
|
inngest: Inngest;
|
|
61
|
+
/**
|
|
62
|
+
* Whether to install the plugin's Publish / Unpublish controls on each
|
|
63
|
+
* configured collection. Default: `true`.
|
|
64
|
+
*
|
|
65
|
+
* Payload's native buttons write `_status` directly, which the plugin's
|
|
66
|
+
* trust boundary rejects — so with this off, the admin has no working
|
|
67
|
+
* publish path until the host supplies its own control (see
|
|
68
|
+
* `publishDocument`).
|
|
69
|
+
*/
|
|
70
|
+
adminComponents?: boolean;
|
|
52
71
|
}
|
|
53
72
|
export type ResolvedCollection = Required<Omit<PublishableCollection, 'requiredFields'>> & Pick<PublishableCollection, 'requiredFields'>;
|
|
54
73
|
/**
|
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,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,SAAS,CAAA;CAC9B;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,C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/D,OAAO,EAAE,OAAO,CAAA;IAChB;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,CAAC,GACtF,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,CAAA;AAe/C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,uBAAuB,GAAG,uBAAuB,CAiBzF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,uBAAuB,EAChC,IAAI,EAAE,MAAM,GACX,kBAAkB,CAiBpB"}
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAqFvB,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;IAClC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5C,cAAc,EAAE,CAAC;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,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"}
|
|
@@ -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;AAqB/E;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,
|
|
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;AAqB/E;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAyB1F;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAezB;AAED,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/pipeline/index.js
CHANGED
|
@@ -23,8 +23,11 @@ const ORDERED_STEPS = [
|
|
|
23
23
|
* timestamp the execute step set.
|
|
24
24
|
*/
|
|
25
25
|
export async function runPublishPipeline(context) {
|
|
26
|
+
const warnings = [];
|
|
26
27
|
for (const { name, step } of ORDERED_STEPS) {
|
|
27
28
|
const result = await step(context);
|
|
29
|
+
if (result.warnings)
|
|
30
|
+
warnings.push(...result.warnings);
|
|
28
31
|
if (!result.pass) {
|
|
29
32
|
return {
|
|
30
33
|
success: false,
|
|
@@ -33,10 +36,15 @@ export async function runPublishPipeline(context) {
|
|
|
33
36
|
...(result.code ? { code: result.code } : {}),
|
|
34
37
|
...(result.issues ? { issues: result.issues } : {}),
|
|
35
38
|
...(result.suggestion ? { suggestion: result.suggestion } : {}),
|
|
39
|
+
...(warnings.length ? { warnings } : {}),
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
|
-
return {
|
|
43
|
+
return {
|
|
44
|
+
success: true,
|
|
45
|
+
publishedAt: new Date().toISOString(),
|
|
46
|
+
...(warnings.length ? { warnings } : {}),
|
|
47
|
+
};
|
|
40
48
|
}
|
|
41
49
|
/**
|
|
42
50
|
* Runs every preflight step (everything but `execute`). Used by
|
|
@@ -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,4BAA4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AC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzC,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAAwB;IAExB,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,eAAe,EAAE,CAAC;QAC7C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAA;QAClC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,QAAQ,EAAE,IAAI;gBACd,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7C,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnD,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChE,CAAA;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AAC1B,CAAC"}
|
|
@@ -4,6 +4,10 @@ import type { PipelineStep } from '../types.js';
|
|
|
4
4
|
* Errors block publish; warnings are surfaced on the result but don't fail
|
|
5
5
|
* the step. (Warning-only behavior is currently unused by the built-in
|
|
6
6
|
* checks but reserved for richer per-client checks.)
|
|
7
|
+
*
|
|
8
|
+
* Built-ins named in `disableAccessibilityChecks` are skipped, so a host
|
|
9
|
+
* whose content shape trips one can replace it rather than wait for a
|
|
10
|
+
* plugin release.
|
|
7
11
|
*/
|
|
8
12
|
export declare const accessibilityStep: PipelineStep;
|
|
9
13
|
//# sourceMappingURL=accessibility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/accessibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAA;AAG9D
|
|
1
|
+
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/accessibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAA;AAG9D;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,YA4B/B,CAAA"}
|
|
@@ -4,10 +4,15 @@ import { BUILT_IN_ACCESSIBILITY_CHECKS } from '../../checks/index.js';
|
|
|
4
4
|
* Errors block publish; warnings are surfaced on the result but don't fail
|
|
5
5
|
* the step. (Warning-only behavior is currently unused by the built-in
|
|
6
6
|
* checks but reserved for richer per-client checks.)
|
|
7
|
+
*
|
|
8
|
+
* Built-ins named in `disableAccessibilityChecks` are skipped, so a host
|
|
9
|
+
* whose content shape trips one can replace it rather than wait for a
|
|
10
|
+
* plugin release.
|
|
7
11
|
*/
|
|
8
12
|
export const accessibilityStep = async (ctx) => {
|
|
13
|
+
const disabled = new Set(ctx.options.disableAccessibilityChecks ?? []);
|
|
9
14
|
const checks = [
|
|
10
|
-
...BUILT_IN_ACCESSIBILITY_CHECKS,
|
|
15
|
+
...BUILT_IN_ACCESSIBILITY_CHECKS.filter((check) => !disabled.has(check.name)),
|
|
11
16
|
...(ctx.options.accessibilityChecks ?? []),
|
|
12
17
|
];
|
|
13
18
|
const allIssues = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility.js","sourceRoot":"","sources":["../../../src/pipeline/steps/accessibility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AAErE
|
|
1
|
+
{"version":3,"file":"accessibility.js","sourceRoot":"","sources":["../../../src/pipeline/steps/accessibility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AAErE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAiB,KAAK,EAAE,GAAG,EAAE,EAAE;IAC3D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAA;IACtE,MAAM,MAAM,GAAG;QACb,GAAG,6BAA6B,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7E,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,IAAI,EAAE,CAAC;KAC3C,CAAA;IAED,MAAM,SAAS,GAAoB,EAAE,CAAA;IACrC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC,CAAA;QAC5D,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAA;IAC9D,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO;YACL,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,sBAAsB;YAC5B,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,uBAAuB,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE;YAC/E,MAAM,EAAE,MAAM;YACd,UAAU,EACR,kHAAkH;SACrH,CAAA;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AACvB,CAAC,CAAA"}
|
|
@@ -7,6 +7,15 @@ import type { PipelineStep } from '../types.js';
|
|
|
7
7
|
* Sets `context.bypassPublishingServer = true` on the Payload update so the
|
|
8
8
|
* status-write blocking hook recognizes this as a sanctioned write. Any
|
|
9
9
|
* other path that tries to flip `_status` will be rejected by the hook.
|
|
10
|
+
*
|
|
11
|
+
* When `actor.enforceAccessAs` is set the write runs as that user with
|
|
12
|
+
* `overrideAccess: false`, so Payload rejects an editor who lacks update
|
|
13
|
+
* access on the collection. Bypassing the hook is not bypassing access
|
|
14
|
+
* control.
|
|
15
|
+
*
|
|
16
|
+
* The event is emitted after the write and cannot fail the step: once
|
|
17
|
+
* `_status` is `published` the publish has happened, and reporting failure
|
|
18
|
+
* would send an editor back to re-publish live content.
|
|
10
19
|
*/
|
|
11
20
|
export declare const executeStep: PipelineStep;
|
|
12
21
|
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/execute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,WAAW,EAAE,YAoCzB,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sendEventSafely } from '../../events.js';
|
|
1
2
|
/**
|
|
2
3
|
* Performs the actual publish: writes `_status: 'published'` and updates
|
|
3
4
|
* the publishedAt field, then fires `content/page.published` with metadata
|
|
@@ -6,6 +7,15 @@
|
|
|
6
7
|
* Sets `context.bypassPublishingServer = true` on the Payload update so the
|
|
7
8
|
* status-write blocking hook recognizes this as a sanctioned write. Any
|
|
8
9
|
* other path that tries to flip `_status` will be rejected by the hook.
|
|
10
|
+
*
|
|
11
|
+
* When `actor.enforceAccessAs` is set the write runs as that user with
|
|
12
|
+
* `overrideAccess: false`, so Payload rejects an editor who lacks update
|
|
13
|
+
* access on the collection. Bypassing the hook is not bypassing access
|
|
14
|
+
* control.
|
|
15
|
+
*
|
|
16
|
+
* The event is emitted after the write and cannot fail the step: once
|
|
17
|
+
* `_status` is `published` the publish has happened, and reporting failure
|
|
18
|
+
* would send an editor back to re-publish live content.
|
|
9
19
|
*/
|
|
10
20
|
export const executeStep = async (ctx) => {
|
|
11
21
|
const now = new Date().toISOString();
|
|
@@ -20,9 +30,14 @@ export const executeStep = async (ctx) => {
|
|
|
20
30
|
_status: 'published',
|
|
21
31
|
[ctx.collection.publishedAtField]: now,
|
|
22
32
|
},
|
|
33
|
+
...(ctx.actor.enforceAccessAs
|
|
34
|
+
? { user: ctx.actor.enforceAccessAs, overrideAccess: false }
|
|
35
|
+
: {}),
|
|
23
36
|
context: { bypassPublishingServer: true },
|
|
24
37
|
});
|
|
25
|
-
|
|
38
|
+
// The write has landed. From here the publish has happened, so nothing
|
|
39
|
+
// below may turn it back into a failure.
|
|
40
|
+
const warning = await sendEventSafely(ctx.inngest, {
|
|
26
41
|
name: 'content/page.published',
|
|
27
42
|
data: {
|
|
28
43
|
collection: ctx.collection.slug,
|
|
@@ -33,6 +48,6 @@ export const executeStep = async (ctx) => {
|
|
|
33
48
|
isFirstPublish: wasFirstPublish,
|
|
34
49
|
},
|
|
35
50
|
});
|
|
36
|
-
return { pass: true };
|
|
51
|
+
return { pass: true, ...(warning ? { warnings: [warning] } : {}) };
|
|
37
52
|
};
|
|
38
53
|
//# sourceMappingURL=execute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/pipeline/steps/execute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/pipeline/steps/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAiB,KAAK,EAAE,GAAG,EAAE,EAAE;IACrD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACpC,MAAM,mBAAmB,GACvB,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,QAAQ;QAC/D,CAAC,CAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAY;QAC3D,CAAC,CAAC,IAAI,CAAA;IACV,MAAM,eAAe,GAAG,mBAAmB,KAAK,IAAI,CAAA;IAEpD,MAAM,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;QACvB,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,IAAI;QAC/B,EAAE,EAAE,GAAG,CAAC,UAAU;QAClB,IAAI,EAAE;YACJ,OAAO,EAAE,WAAW;YACpB,CAAC,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,GAAG;SACvC;QACD,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe;YAC3B,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,cAAc,EAAE,KAAK,EAAE;YAC5D,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE;KAC1C,CAAC,CAAA;IAEF,uEAAuE;IACvE,yCAAyC;IACzC,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE;QACjD,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE;YACJ,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,IAAI;YAC/B,EAAE,EAAE,GAAG,CAAC,UAAU;YAClB,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC;YACtE,WAAW,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,QAAQ;YAC3C,mBAAmB;YACnB,cAAc,EAAE,eAAe;SAChC;KACF,CAAC,CAAA;IAEF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;AACpE,CAAC,CAAA"}
|
package/dist/pipeline/types.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { Inngest } from 'inngest';
|
|
2
|
-
import type { Payload } from 'payload';
|
|
2
|
+
import type { Payload, TypedUser } from 'payload';
|
|
3
3
|
import type { AuthenticatedUser } from '@forumone/throughline-plugin-contract';
|
|
4
4
|
import type { AccessibilityIssue, PublishingPluginOptions, ResolvedCollection } from '../options.js';
|
|
5
5
|
export interface PipelineActor {
|
|
6
6
|
user: AuthenticatedUser | null;
|
|
7
7
|
apiKeyName: string;
|
|
8
8
|
sessionId?: string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* When set, Payload reads and writes inside the pipeline run as this user
|
|
11
|
+
* with `overrideAccess: false`, so the collection's own access control
|
|
12
|
+
* applies. The admin path sets it to the logged-in editor; the MCP path
|
|
13
|
+
* leaves it unset because the API key is its own trust boundary.
|
|
14
|
+
*/
|
|
15
|
+
enforceAccessAs?: TypedUser | undefined;
|
|
9
16
|
}
|
|
10
17
|
export interface PipelineMeta {
|
|
11
18
|
userPrompt?: string | undefined;
|
|
@@ -31,6 +38,11 @@ export interface PipelineStepResult {
|
|
|
31
38
|
code?: string;
|
|
32
39
|
issues?: PipelineIssue[];
|
|
33
40
|
suggestion?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Non-fatal problems. The step did what it was asked to; something
|
|
43
|
+
* adjacent to it did not. Warnings never fail a step.
|
|
44
|
+
*/
|
|
45
|
+
warnings?: string[];
|
|
34
46
|
}
|
|
35
47
|
export type PipelineStep = (context: PipelineContext) => Promise<PipelineStepResult>;
|
|
36
48
|
export interface PipelineResult {
|
|
@@ -41,5 +53,7 @@ export interface PipelineResult {
|
|
|
41
53
|
issues?: PipelineIssue[];
|
|
42
54
|
suggestion?: string;
|
|
43
55
|
publishedAt?: string;
|
|
56
|
+
/** Non-fatal problems collected across the steps that ran. */
|
|
57
|
+
warnings?: string[];
|
|
44
58
|
}
|
|
45
59
|
//# sourceMappingURL=types.d.ts.map
|