@forumone/throughline 2.1.0 → 2.2.0-next-623d42c
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 +41 -0
- package/dist/approvals/endpoints/action.d.ts.map +1 -1
- package/dist/approvals/endpoints/action.js +27 -8
- package/dist/approvals/endpoints/action.js.map +1 -1
- package/dist/approvals/tokens.d.ts +3 -0
- package/dist/approvals/tokens.d.ts.map +1 -1
- package/dist/approvals/tokens.js +1 -1
- package/dist/approvals/tokens.js.map +1 -1
- package/dist/authoring/tools.d.ts.map +1 -1
- package/dist/authoring/tools.js +6 -1
- package/dist/authoring/tools.js.map +1 -1
- package/dist/components/tools/validate-composition.d.ts.map +1 -1
- package/dist/components/tools/validate-composition.js +4 -1
- package/dist/components/tools/validate-composition.js.map +1 -1
- package/dist/components/validation/composition.d.ts +9 -1
- package/dist/components/validation/composition.d.ts.map +1 -1
- package/dist/components/validation/composition.js +9 -7
- package/dist/components/validation/composition.js.map +1 -1
- package/dist/exports/client.d.ts +3 -0
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +2 -0
- package/dist/exports/client.js.map +1 -1
- package/dist/fields/slug.d.ts.map +1 -1
- package/dist/fields/slug.js +4 -1
- package/dist/fields/slug.js.map +1 -1
- package/dist/integrations/admin/SyncButton.d.ts.map +1 -1
- package/dist/integrations/admin/SyncButton.js +11 -5
- package/dist/integrations/admin/SyncButton.js.map +1 -1
- package/dist/integrations/admin/sync-client.d.ts +2 -0
- package/dist/integrations/admin/sync-client.d.ts.map +1 -1
- package/dist/integrations/admin/sync-client.js +7 -1
- package/dist/integrations/admin/sync-client.js.map +1 -1
- package/dist/integrations/collection.d.ts +1 -1
- package/dist/integrations/collection.d.ts.map +1 -1
- package/dist/integrations/collection.js +11 -4
- package/dist/integrations/collection.js.map +1 -1
- package/dist/integrations/sync/status.d.ts +17 -4
- package/dist/integrations/sync/status.d.ts.map +1 -1
- package/dist/integrations/sync/status.js +37 -6
- package/dist/integrations/sync/status.js.map +1 -1
- package/dist/media/hooks.d.ts.map +1 -1
- package/dist/media/hooks.js +11 -9
- package/dist/media/hooks.js.map +1 -1
- package/dist/migrate/exports.json +16 -0
- package/dist/publishing/admin/FirstErrorProvider.d.ts +24 -0
- package/dist/publishing/admin/FirstErrorProvider.d.ts.map +1 -0
- package/dist/publishing/admin/FirstErrorProvider.js +100 -0
- package/dist/publishing/admin/FirstErrorProvider.js.map +1 -0
- package/dist/publishing/admin/PublishButton.d.ts.map +1 -1
- package/dist/publishing/admin/PublishButton.js +18 -3
- package/dist/publishing/admin/PublishButton.js.map +1 -1
- package/dist/publishing/admin/SchedulePublishField.d.ts.map +1 -1
- package/dist/publishing/admin/SchedulePublishField.js +25 -10
- package/dist/publishing/admin/SchedulePublishField.js.map +1 -1
- package/dist/publishing/admin/UnpublishButton.d.ts.map +1 -1
- package/dist/publishing/admin/UnpublishButton.js +9 -3
- package/dist/publishing/admin/UnpublishButton.js.map +1 -1
- package/dist/publishing/admin/first-error.d.ts +60 -0
- package/dist/publishing/admin/first-error.d.ts.map +1 -0
- package/dist/publishing/admin/first-error.js +211 -0
- package/dist/publishing/admin/first-error.js.map +1 -0
- package/dist/publishing/admin/publishing-client.d.ts +33 -4
- package/dist/publishing/admin/publishing-client.d.ts.map +1 -1
- package/dist/publishing/admin/publishing-client.js +56 -21
- package/dist/publishing/admin/publishing-client.js.map +1 -1
- package/dist/publishing/admin/schedule-state.d.ts +31 -4
- package/dist/publishing/admin/schedule-state.d.ts.map +1 -1
- package/dist/publishing/admin/schedule-state.js +26 -14
- package/dist/publishing/admin/schedule-state.js.map +1 -1
- package/dist/publishing/checks/alt-text.d.ts.map +1 -1
- package/dist/publishing/checks/alt-text.js +3 -1
- package/dist/publishing/checks/alt-text.js.map +1 -1
- package/dist/publishing/checks/heading-hierarchy.d.ts +9 -3
- package/dist/publishing/checks/heading-hierarchy.d.ts.map +1 -1
- package/dist/publishing/checks/heading-hierarchy.js +19 -6
- package/dist/publishing/checks/heading-hierarchy.js.map +1 -1
- package/dist/publishing/checks/link-labels.js +1 -1
- package/dist/publishing/checks/link-labels.js.map +1 -1
- package/dist/publishing/endpoints/admin.d.ts.map +1 -1
- package/dist/publishing/endpoints/admin.js +26 -7
- package/dist/publishing/endpoints/admin.js.map +1 -1
- package/dist/publishing/events.d.ts +15 -1
- package/dist/publishing/events.d.ts.map +1 -1
- package/dist/publishing/events.js +17 -2
- package/dist/publishing/events.js.map +1 -1
- package/dist/publishing/hooks/block-status-writes.js +5 -2
- package/dist/publishing/hooks/block-status-writes.js.map +1 -1
- package/dist/publishing/hooks/schedule-events.d.ts.map +1 -1
- package/dist/publishing/hooks/schedule-events.js +5 -7
- package/dist/publishing/hooks/schedule-events.js.map +1 -1
- package/dist/publishing/index.d.ts +9 -1
- package/dist/publishing/index.d.ts.map +1 -1
- package/dist/publishing/index.js +7 -0
- package/dist/publishing/index.js.map +1 -1
- package/dist/publishing/messages.d.ts +63 -0
- package/dist/publishing/messages.d.ts.map +1 -0
- package/dist/publishing/messages.js +84 -0
- package/dist/publishing/messages.js.map +1 -0
- package/dist/publishing/options.d.ts +46 -1
- package/dist/publishing/options.d.ts.map +1 -1
- package/dist/publishing/options.js +8 -0
- package/dist/publishing/options.js.map +1 -1
- package/dist/publishing/pipeline/finish.d.ts +12 -0
- package/dist/publishing/pipeline/finish.d.ts.map +1 -0
- package/dist/publishing/pipeline/finish.js +24 -0
- package/dist/publishing/pipeline/finish.js.map +1 -0
- package/dist/publishing/pipeline/index.d.ts.map +1 -1
- package/dist/publishing/pipeline/index.js +11 -8
- package/dist/publishing/pipeline/index.js.map +1 -1
- package/dist/publishing/pipeline/steps/accessibility.d.ts +3 -3
- package/dist/publishing/pipeline/steps/accessibility.d.ts.map +1 -1
- package/dist/publishing/pipeline/steps/accessibility.js +17 -9
- package/dist/publishing/pipeline/steps/accessibility.js.map +1 -1
- package/dist/publishing/pipeline/steps/approval.d.ts.map +1 -1
- package/dist/publishing/pipeline/steps/approval.js +6 -4
- package/dist/publishing/pipeline/steps/approval.js.map +1 -1
- package/dist/publishing/pipeline/steps/composition.d.ts.map +1 -1
- package/dist/publishing/pipeline/steps/composition.js +36 -17
- package/dist/publishing/pipeline/steps/composition.js.map +1 -1
- package/dist/publishing/pipeline/steps/embargo.d.ts +4 -0
- package/dist/publishing/pipeline/steps/embargo.d.ts.map +1 -1
- package/dist/publishing/pipeline/steps/embargo.js +13 -4
- package/dist/publishing/pipeline/steps/embargo.js.map +1 -1
- package/dist/publishing/pipeline/steps/execute.d.ts.map +1 -1
- package/dist/publishing/pipeline/steps/execute.js +48 -5
- package/dist/publishing/pipeline/steps/execute.js.map +1 -1
- package/dist/publishing/pipeline/steps/exist.d.ts +2 -0
- package/dist/publishing/pipeline/steps/exist.d.ts.map +1 -1
- package/dist/publishing/pipeline/steps/exist.js +5 -3
- package/dist/publishing/pipeline/steps/exist.js.map +1 -1
- package/dist/publishing/pipeline/steps/link-targets.d.ts +3 -0
- package/dist/publishing/pipeline/steps/link-targets.d.ts.map +1 -0
- package/dist/publishing/pipeline/steps/link-targets.js +293 -0
- package/dist/publishing/pipeline/steps/link-targets.js.map +1 -0
- package/dist/publishing/pipeline/steps/required-fields.d.ts.map +1 -1
- package/dist/publishing/pipeline/steps/required-fields.js +7 -5
- package/dist/publishing/pipeline/steps/required-fields.js.map +1 -1
- package/dist/publishing/pipeline/types.d.ts +25 -0
- package/dist/publishing/pipeline/types.d.ts.map +1 -1
- package/dist/publishing/pipeline/where.d.ts +13 -0
- package/dist/publishing/pipeline/where.d.ts.map +1 -0
- package/dist/publishing/pipeline/where.js +44 -0
- package/dist/publishing/pipeline/where.js.map +1 -0
- package/dist/publishing/plugin.d.ts.map +1 -1
- package/dist/publishing/plugin.js +22 -0
- package/dist/publishing/plugin.js.map +1 -1
- package/dist/publishing/service.d.ts +26 -17
- package/dist/publishing/service.d.ts.map +1 -1
- package/dist/publishing/service.js +43 -32
- package/dist/publishing/service.js.map +1 -1
- package/dist/publishing/tools/get-publish-status.d.ts.map +1 -1
- package/dist/publishing/tools/get-publish-status.js +4 -0
- package/dist/publishing/tools/get-publish-status.js.map +1 -1
- package/dist/publishing/tools/rollback.d.ts.map +1 -1
- package/dist/publishing/tools/rollback.js +1 -1
- package/dist/publishing/tools/rollback.js.map +1 -1
- package/dist/references/UsedOnPanel.d.ts.map +1 -1
- package/dist/references/UsedOnPanel.js +1 -1
- package/dist/references/UsedOnPanel.js.map +1 -1
- package/dist/references/find.d.ts +12 -1
- package/dist/references/find.d.ts.map +1 -1
- package/dist/references/find.js +24 -5
- package/dist/references/find.js.map +1 -1
- package/dist/references/guards.d.ts.map +1 -1
- package/dist/references/guards.js +9 -2
- package/dist/references/guards.js.map +1 -1
- package/dist/references/index.d.ts +4 -2
- package/dist/references/index.d.ts.map +1 -1
- package/dist/references/index.js +2 -1
- package/dist/references/index.js.map +1 -1
- package/dist/references/links.d.ts +45 -0
- package/dist/references/links.d.ts.map +1 -0
- package/dist/references/links.js +117 -0
- package/dist/references/links.js.map +1 -0
- package/dist/references/walk.d.ts +70 -0
- package/dist/references/walk.d.ts.map +1 -1
- package/dist/references/walk.js +88 -41
- package/dist/references/walk.js.map +1 -1
- package/dist/utils/field-path.d.ts +56 -0
- package/dist/utils/field-path.d.ts.map +1 -0
- package/dist/utils/field-path.js +146 -0
- package/dist/utils/field-path.js.map +1 -0
- package/package.json +6 -5
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { Button, FieldLabel, toast, useAuth, useConfig, useDocumentInfo } from '@payloadcms/ui';
|
|
5
|
-
import { describeSyncOutcome, fetchSyncStatus, formatSyncTime, syncHasFinished, triggerSync, } from './sync-client.js';
|
|
5
|
+
import { describeSyncOutcome, fetchSyncStatus, formatSyncTime, syncHasFinished, syncToastId, triggerSync, } from './sync-client.js';
|
|
6
6
|
/** How long to watch for the run to finish before saying so and stopping. */
|
|
7
7
|
const POLL_INTERVAL_MS = 3_000;
|
|
8
8
|
const POLL_TIMEOUT_MS = 120_000;
|
|
@@ -52,12 +52,15 @@ export function SyncButton(props = {}) {
|
|
|
52
52
|
setOutcome(null);
|
|
53
53
|
setGaveUpWaiting(false);
|
|
54
54
|
const result = await triggerSync({ serverURL, apiRoute: api, collectionSlug, id });
|
|
55
|
+
// One toast per instance, replaced rather than stacked; an error stays
|
|
56
|
+
// until it is closed (forumone-2026#805).
|
|
57
|
+
const toastId = syncToastId(collectionSlug, id);
|
|
55
58
|
if (!result.ok) {
|
|
56
|
-
toast.error(result.message);
|
|
59
|
+
toast.error(result.message, { id: toastId, duration: Infinity });
|
|
57
60
|
setPhase('idle');
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
|
-
toast.success(result.body.message ?? 'Sync queued.');
|
|
63
|
+
toast.success(result.body.message ?? 'Sync queued.', { id: toastId });
|
|
61
64
|
setBaseline(result.body.lastSyncAt ?? null);
|
|
62
65
|
setPhase('waiting');
|
|
63
66
|
}, [api, collectionSlug, id, phase, serverURL]);
|
|
@@ -81,13 +84,16 @@ export function SyncButton(props = {}) {
|
|
|
81
84
|
setOutcome(status);
|
|
82
85
|
setPhase('idle');
|
|
83
86
|
const described = describeSyncOutcome(status, instanceNameRef.current);
|
|
84
|
-
const options =
|
|
87
|
+
const options = {
|
|
88
|
+
id: syncToastId(collectionSlug, id),
|
|
89
|
+
...(described.description ? { description: described.description } : {}),
|
|
90
|
+
};
|
|
85
91
|
if (described.severity === 'success')
|
|
86
92
|
toast.success(described.title, options);
|
|
87
93
|
else if (described.severity === 'warning')
|
|
88
94
|
toast.warning(described.title, options);
|
|
89
95
|
else
|
|
90
|
-
toast.error(described.title, { ...options, duration:
|
|
96
|
+
toast.error(described.title, { ...options, duration: Infinity });
|
|
91
97
|
return;
|
|
92
98
|
}
|
|
93
99
|
if (Date.now() >= deadline) {
|
|
@@ -1 +1 @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CAAA;IAE/F,OAAO,CACL,eAAK,SAAS,EAAC,yCAAyC,aAEtD,KAAC,UAAU,IAAC,EAAE,EAAC,MAAM,EAAC,KAAK,EAAC,aAAa,GAAG,EAC5C,KAAC,MAAM,IACL,WAAW,EAAC,WAAW,EACvB,QAAQ,EAAE,CAAC,OAAO,IAAI,KAAK,KAAK,MAAM,EACtC,OAAO,EAAE,GAAG,EAAE;oBACZ,KAAK,KAAK,EAAE,CAAA;gBACd,CAAC,EACD,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,QAAQ,KACT,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC,YAEjE,KAAK,GACC,EAGT,yBAAa,QAAQ,EAAC,SAAS,EAAC,mBAAmB,YAChD,KAAK,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,GAChD,IACA,CACP,CAAA;AACH,CAAC;AAED,6EAA6E;AAC7E,SAAS,KAAK,CAAC,IAKd;IACC,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO,gEAAgE,CAAA;IAC1F,IAAI,IAAI,CAAC,KAAK,KAAK,YAAY;QAAE,OAAO,2CAA2C,CAAA;IACnF,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,yCAAyC,CAAA;IAC9E,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,OAAO,gFAAgF,CAAA;IACzF,CAAC;IACD,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,eAAe,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAA;IAClF,OAAO,iEAAiE,CAAA;AAC1E,CAAC"}
|
|
@@ -78,6 +78,8 @@ export interface SyncOutcome {
|
|
|
78
78
|
* somebody pressed this button is to find out whether their change landed.
|
|
79
79
|
*/
|
|
80
80
|
export declare function describeSyncOutcome(status: SyncStatus, instanceName?: string): SyncOutcome;
|
|
81
|
+
/** One toast per instance: a second sync's notices replace the first's. */
|
|
82
|
+
export declare function syncToastId(collectionSlug: string, id: number | string): string;
|
|
81
83
|
/** `2026-08-29T14:03:00.000Z` as something an operator reads at a glance. */
|
|
82
84
|
export declare function formatSyncTime(value: null | string): string;
|
|
83
85
|
//# sourceMappingURL=sync-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-client.d.ts","sourceRoot":"","sources":["../../../src/integrations/admin/sync-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"sync-client.d.ts","sourceRoot":"","sources":["../../../src/integrations/admin/sync-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA;AAE5E,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,SAAS,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACtE,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KA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3,6 +3,7 @@
|
|
|
3
3
|
* request handling and the message formatting can be unit tested without a
|
|
4
4
|
* form, a document or a browser.
|
|
5
5
|
*/
|
|
6
|
+
import { lastErrorDetail } from '../sync/status.js';
|
|
6
7
|
/**
|
|
7
8
|
* POSTs to the collection's sync endpoint using the browser's session cookie.
|
|
8
9
|
*
|
|
@@ -87,7 +88,8 @@ export function syncHasFinished(baseline, current) {
|
|
|
87
88
|
*/
|
|
88
89
|
export function describeSyncOutcome(status, instanceName) {
|
|
89
90
|
const subject = instanceName ? `"${instanceName}"` : 'The integration';
|
|
90
|
-
|
|
91
|
+
// The title already says what the stored summary line says.
|
|
92
|
+
const description = status.lastError ? lastErrorDetail(status.lastError) : undefined;
|
|
91
93
|
switch (status.lastSyncStatus) {
|
|
92
94
|
case 'success':
|
|
93
95
|
return { severity: 'success', title: `${subject} synced.` };
|
|
@@ -109,6 +111,10 @@ export function describeSyncOutcome(status, instanceName) {
|
|
|
109
111
|
return { severity: 'warning', title: `${subject} ran, but reported no status.` };
|
|
110
112
|
}
|
|
111
113
|
}
|
|
114
|
+
/** One toast per instance: a second sync's notices replace the first's. */
|
|
115
|
+
export function syncToastId(collectionSlug, id) {
|
|
116
|
+
return `throughline:sync:${collectionSlug}:${id}`;
|
|
117
|
+
}
|
|
112
118
|
/** `2026-08-29T14:03:00.000Z` as something an operator reads at a glance. */
|
|
113
119
|
export function formatSyncTime(value) {
|
|
114
120
|
if (!value)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-client.js","sourceRoot":"","sources":["../../../src/integrations/admin/sync-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"sync-client.js","sourceRoot":"","sources":["../../../src/integrations/admin/sync-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAwBnD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC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AAE,CAAA;AACnD,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,cAAc,CAAC,KAAoB;IACjD,IAAI,CAAC,KAAK;QAAE,OAAO,OAAO,CAAA;IAC1B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5B,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,SAAS,CAAA;IAClD,OAAO,IAAI,CAAC,cAAc,EAAE,CAAA;AAC9B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CollectionConfig, type Endpoint } from 'payload';
|
|
2
2
|
import { type PluginAdminOptions } from '../plugin-contract/admin.js';
|
|
3
3
|
import type { IntegrationRegistry } from './registry.js';
|
|
4
4
|
export interface CreateIntegrationsCollectionOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/integrations/collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/integrations/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,KAAK,QAAQ,EAAoB,MAAM,SAAS,CAAA;AACvG,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,6BAA6B,CAAA;AACxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AASxD,MAAM,WAAW,mCAAmC;IAClD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,mEAAmE;IACnE,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;IACtB,iGAAiG;IACjG,KAAK,CAAC,EAAE,kBAAkB,CAAA;CAC3B;AAsBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,mCAAmC,GAC3C,gBAAgB,CA4KlB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APIError } from 'payload';
|
|
1
2
|
import { resolveAdminGroup } from '../plugin-contract/admin.js';
|
|
2
3
|
import { DEFAULT_INTEGRATIONS_SLUG } from './options.js';
|
|
3
4
|
/**
|
|
@@ -172,17 +173,23 @@ export function createIntegrationsCollection(options) {
|
|
|
172
173
|
const integrationType = incoming['integrationType'];
|
|
173
174
|
if (typeof integrationType !== 'string')
|
|
174
175
|
return data;
|
|
176
|
+
/*
|
|
177
|
+
`APIError` with 400, not `Error`. Payload's `routeError` shows the
|
|
178
|
+
admin "Something went wrong." in place of any error that is not
|
|
179
|
+
public, and a plain `Error` is a non-public 500 — so the reason below
|
|
180
|
+
never reached the person who could act on it (forumone-2026#805).
|
|
181
|
+
*/
|
|
175
182
|
const integration = registry.get(integrationType);
|
|
176
183
|
if (!integration) {
|
|
177
|
-
throw new
|
|
184
|
+
throw new APIError(`"${integrationType}" isn't an integration this site has. Nothing was saved. Choose one of: ${registry
|
|
178
185
|
.list()
|
|
179
|
-
.map((i) => i.
|
|
180
|
-
.join(', ') || '
|
|
186
|
+
.map((i) => i.name)
|
|
187
|
+
.join(', ') || 'none are installed'}.`, 400);
|
|
181
188
|
}
|
|
182
189
|
const config = (incoming['config'] ?? {});
|
|
183
190
|
const validation = await integration.validateConfig(config);
|
|
184
191
|
if (!validation.ok) {
|
|
185
|
-
throw new
|
|
192
|
+
throw new APIError(`The settings for ${integration.name} aren't valid, so nothing was saved: ${validation.reason ?? 'no reason given'}`, 400);
|
|
186
193
|
}
|
|
187
194
|
return data;
|
|
188
195
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/integrations/collection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/integrations/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuE,MAAM,SAA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AM,eAAe,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAA;oBACnD,IAAI,OAAO,eAAe,KAAK,QAAQ;wBAAE,OAAO,IAAI,CAAA;oBAEpD;;;;;sBAKE;oBACF,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;oBACjD,IAAI,CAAC,WAAW,EAAE,CAAC;wBACjB,MAAM,IAAI,QAAQ,CAChB,IAAI,eAAe,2EACjB,QAAQ;6BACL,IAAI,EAAE;6BACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;6BAClB,IAAI,CAAC,IAAI,CAAC,IAAI,oBACnB,GAAG,EACH,GAAG,CACJ,CAAA;oBACH,CAAC;oBAED,MAAM,MAAM,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAA4B,CAAA;oBACpE,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;oBAC3D,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;wBACnB,MAAM,IAAI,QAAQ,CAChB,oBAAoB,WAAW,CAAC,IAAI,wCAAwC,UAAU,CAAC,MAAM,IAAI,iBAAiB,EAAE,EACpH,GAAG,CACJ,CAAA;oBACH,CAAC;oBACD,OAAO,IAAI,CAAA;gBACb,CAAC;aACF;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import type { Payload } from 'payload';
|
|
2
2
|
import type { IntegrationContext, IntegrationStatusUpdate } from '../types.js';
|
|
3
|
+
export declare const LAST_ERROR_SUMMARY: {
|
|
4
|
+
readonly failed: "The last sync failed. The details below are for a site administrator.";
|
|
5
|
+
readonly partial: "The last sync finished, but some items weren't updated. The details below are for a site administrator.";
|
|
6
|
+
};
|
|
7
|
+
/** `lastError` for a run: the summary line, a blank line, then the integration's own detail. */
|
|
8
|
+
export declare function lastErrorText(status: 'failed' | 'partial', detail: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* The integration's own detail from a `lastError`, without the summary line —
|
|
11
|
+
* for a reader that already says the same thing in its own words, as the Sync
|
|
12
|
+
* button's toast title does. A value written before the summary existed comes
|
|
13
|
+
* back as it was.
|
|
14
|
+
*/
|
|
15
|
+
export declare function lastErrorDetail(text: string): string;
|
|
3
16
|
/**
|
|
4
17
|
* The fields one `updateStatus` call writes to an instance.
|
|
5
18
|
*
|
|
6
19
|
* `lastError` is cleared only by a success. A partial or failed run replaces it
|
|
7
|
-
* with its message. A JavaScript caller can still
|
|
8
|
-
* status and no message, which the types refuse;
|
|
9
|
-
* rather than blanked, so the admin keeps the
|
|
10
|
-
* showing a partial run with no reason at all.
|
|
20
|
+
* with its message, after a plain summary line. A JavaScript caller can still
|
|
21
|
+
* reach here with a non-success status and no message, which the types refuse;
|
|
22
|
+
* then `lastError` is left alone rather than blanked, so the admin keeps the
|
|
23
|
+
* last reason it had instead of showing a partial run with no reason at all.
|
|
11
24
|
*/
|
|
12
25
|
export declare function statusUpdateData(...[status, error]: IntegrationStatusUpdate): Record<string, unknown>;
|
|
13
26
|
/** `IntegrationContext.updateStatus`, writing to `collectionSlug` through `payload`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/integrations/sync/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/integrations/sync/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAW9E,eAAO,MAAM,kBAAkB;;;CAIrB,CAAA;AAEV,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAElF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,uBAAuB,GAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB;AAED,wFAAwF;AACxF,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAChC,cAAc,EAAE,MAAM,GACrB,kBAAkB,CAAC,cAAc,CAAC,CAQpC"}
|
|
@@ -1,11 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The line `lastError` leads with. forumone-2026#805.
|
|
3
|
+
|
|
4
|
+
Editors can read an integration's `Last Error`, and what an integration writes
|
|
5
|
+
there is for an administrator: `HubSpot 401 on /marketing/v3/…`. So it opens
|
|
6
|
+
with a sentence anybody can read — whether the run failed or half-worked, and
|
|
7
|
+
who to tell — and the integration's own detail follows, unchanged, for the
|
|
8
|
+
person who can act on it.
|
|
9
|
+
*/
|
|
10
|
+
export const LAST_ERROR_SUMMARY = {
|
|
11
|
+
failed: 'The last sync failed. The details below are for a site administrator.',
|
|
12
|
+
partial: "The last sync finished, but some items weren't updated. The details below are for a site administrator.",
|
|
13
|
+
};
|
|
14
|
+
/** `lastError` for a run: the summary line, a blank line, then the integration's own detail. */
|
|
15
|
+
export function lastErrorText(status, detail) {
|
|
16
|
+
return `${LAST_ERROR_SUMMARY[status]}\n\n${detail}`;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The integration's own detail from a `lastError`, without the summary line —
|
|
20
|
+
* for a reader that already says the same thing in its own words, as the Sync
|
|
21
|
+
* button's toast title does. A value written before the summary existed comes
|
|
22
|
+
* back as it was.
|
|
23
|
+
*/
|
|
24
|
+
export function lastErrorDetail(text) {
|
|
25
|
+
for (const summary of Object.values(LAST_ERROR_SUMMARY)) {
|
|
26
|
+
if (text.startsWith(`${summary}\n\n`))
|
|
27
|
+
return text.slice(summary.length + 2);
|
|
28
|
+
}
|
|
29
|
+
return text;
|
|
30
|
+
}
|
|
1
31
|
/**
|
|
2
32
|
* The fields one `updateStatus` call writes to an instance.
|
|
3
33
|
*
|
|
4
34
|
* `lastError` is cleared only by a success. A partial or failed run replaces it
|
|
5
|
-
* with its message. A JavaScript caller can still
|
|
6
|
-
* status and no message, which the types refuse;
|
|
7
|
-
* rather than blanked, so the admin keeps the
|
|
8
|
-
* showing a partial run with no reason at all.
|
|
35
|
+
* with its message, after a plain summary line. A JavaScript caller can still
|
|
36
|
+
* reach here with a non-success status and no message, which the types refuse;
|
|
37
|
+
* then `lastError` is left alone rather than blanked, so the admin keeps the
|
|
38
|
+
* last reason it had instead of showing a partial run with no reason at all.
|
|
9
39
|
*/
|
|
10
40
|
export function statusUpdateData(...[status, error]) {
|
|
11
41
|
const data = {
|
|
@@ -14,8 +44,9 @@ export function statusUpdateData(...[status, error]) {
|
|
|
14
44
|
};
|
|
15
45
|
if (status === 'success')
|
|
16
46
|
data['lastError'] = null;
|
|
17
|
-
else if (typeof error === 'string' && error.length > 0)
|
|
18
|
-
data['lastError'] = error;
|
|
47
|
+
else if (typeof error === 'string' && error.length > 0) {
|
|
48
|
+
data['lastError'] = lastErrorText(status, lastErrorDetail(error));
|
|
49
|
+
}
|
|
19
50
|
return data;
|
|
20
51
|
}
|
|
21
52
|
/** `IntegrationContext.updateStatus`, writing to `collectionSlug` through `payload`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/integrations/sync/status.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAG,CAAC,MAAM,E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A;SAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA;IACnE,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,kBAAkB,CAChC,OAAgC,EAChC,cAAsB;IAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,CAAC,MAAM,CAAC;YACnB,UAAU,EAAE,cAAc;YAC1B,EAAE,EAAE,UAAU;YACd,IAAI,EAAE,gBAAgB,CAAC,GAAG,MAAM,CAAC;SAClC,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/media/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAChC,MAAM,SAAS,CAAA;AA6BhB;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,GAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MACiB,GAC/C,0BAA0B,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/media/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAChC,MAAM,SAAS,CAAA;AA6BhB;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,GAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MACiB,GAC/C,0BAA0B,CAa5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,SAAK,GAAG,0BAA0B,CA8C1F;AAOD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1D,yBAAyB,CA0C3B;AAED,yCAAyC;AACzC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC;AAED,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CACrC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CAQ7D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,yBAAyB,CAmC5B"}
|
package/dist/media/hooks.js
CHANGED
|
@@ -31,12 +31,13 @@ order: a sanitised SVG is written back over the object and changes its size.
|
|
|
31
31
|
* same one given to `upload.mimeTypes`, which does not run on a client upload.
|
|
32
32
|
*/
|
|
33
33
|
export function refuseMimeTypesOutside(allowed, message = (mimeType) => `${mimeType} is not a type this site accepts.`) {
|
|
34
|
-
return ({ data, operation }) => {
|
|
34
|
+
return ({ data, operation, req }) => {
|
|
35
35
|
if (operation !== 'create')
|
|
36
36
|
return data;
|
|
37
37
|
const mimeType = typeof data?.['mimeType'] === 'string' ? data['mimeType'] : '';
|
|
38
38
|
if (mimeType && !allowed.includes(mimeType)) {
|
|
39
|
-
|
|
39
|
+
// `t`, so a host's translation of Payload's "invalid field" prefix applies.
|
|
40
|
+
throw new ValidationError({ errors: [{ path: 'mimeType', message: message(mimeType) }] }, req?.t);
|
|
40
41
|
}
|
|
41
42
|
return data;
|
|
42
43
|
};
|
|
@@ -72,20 +73,21 @@ export function refuseStorageKeyMismatch(collectionPrefix = '') {
|
|
|
72
73
|
if (!written || !recorded || written === recorded)
|
|
73
74
|
return data;
|
|
74
75
|
const sameFolder = written.replace(/[^/]+$/, '') === recorded.replace(/[^/]+$/, '');
|
|
76
|
+
/*
|
|
77
|
+
The two paths are for whoever fixes it, so they go to the log; the editor
|
|
78
|
+
reads what happened and whether it is theirs to fix (forumone-2026#805).
|
|
79
|
+
*/
|
|
80
|
+
req.payload?.logger?.warn?.({ event: 'media.storage-key-mismatch', written, recorded, sameFolder }, `[media] refused an upload: stored at ${written}, would have been recorded as ${recorded}`);
|
|
75
81
|
throw new ValidationError({
|
|
76
82
|
errors: [
|
|
77
83
|
{
|
|
78
84
|
path: 'filename',
|
|
79
85
|
message: sameFolder
|
|
80
|
-
? `
|
|
81
|
-
|
|
82
|
-
`link would not resolve. Rename your file and upload it again.`
|
|
83
|
-
: `This upload was stored at ${written} but the document would have recorded ${recorded}, ` +
|
|
84
|
-
`so its link would not resolve. Nothing is wrong with the file: this is a fault in the ` +
|
|
85
|
-
`upload path itself, and it will affect every upload until it is fixed. Please report it.`,
|
|
86
|
+
? `There's already a file called ${file.name} in the Media library. Rename your file and upload it again.`
|
|
87
|
+
: "This file couldn't be added because of a problem with uploads. It isn't your file; every upload will fail until it's fixed. Please tell a site administrator.",
|
|
86
88
|
},
|
|
87
89
|
],
|
|
88
|
-
});
|
|
90
|
+
}, req.t);
|
|
89
91
|
};
|
|
90
92
|
}
|
|
91
93
|
const tokenOf = (token) => {
|
package/dist/media/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/media/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EACL,eAAe,GAGhB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AAEF;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAA0B,EAC1B,UAAwC,CAAC,QAAQ,EAAE,EAAE,CACnD,GAAG,QAAQ,mCAAmC;IAEhD,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/media/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EACL,eAAe,GAGhB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AAEF;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAA0B,EAC1B,UAAwC,CAAC,QAAQ,EAAE,EAAE,CACnD,GAAG,QAAQ,mCAAmC;IAEhD,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE;QAClC,IAAI,SAAS,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAA;QACvC,MAAM,QAAQ,GAAG,OAAO,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,U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CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;YACtD,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;YACpE,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,EAAE,KAAK,SAAS;gBAAE,OAAO,GAAG,CAAA;YAEtD,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC;gBAC7B,UAAU,EAAE,UAAU,CAAC,IAAI;gBAC3B,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,IAAI,EAAE,UAAU;gBAChB,GAAG;aACJ,CAAC,CAAA;YACF,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACrB,WAAW,MAAM,CAAC,QAAQ,cAAc,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,WAAW;gBACnF,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,IAAI,eAAe,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAC7F,CAAA;YACD,OAAO,EAAE,GAAI,GAA+B,EAAE,GAAG,UAAU,EAAE,CAAA;QAC/D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;gBACtB,GAAG,EAAE,KAAK;gBACV,GAAG,EAAE,0BAA0B,MAAM,CAAC,QAAQ,kCAAkC;aACjF,CAAC,CAAA;YACF,OAAO,GAAG,CAAA;QACZ,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"AccessFinding": ["@forumone/throughline/testing"],
|
|
11
11
|
"AccessFindingKind": ["@forumone/throughline/testing"],
|
|
12
12
|
"AccessibilityCheck": ["@forumone/throughline/publishing"],
|
|
13
|
+
"AccessibilityCheckContext": ["@forumone/throughline/publishing"],
|
|
13
14
|
"AccessibilityIssue": ["@forumone/throughline/publishing"],
|
|
14
15
|
"ActionToken": ["@forumone/throughline/approvals"],
|
|
15
16
|
"ActionTokenAction": ["@forumone/throughline/approvals"],
|
|
@@ -134,9 +135,11 @@
|
|
|
134
135
|
"FieldProblem": ["@forumone/throughline/content"],
|
|
135
136
|
"FindContentNeedingAttentionOptions": ["@forumone/throughline/editorial"],
|
|
136
137
|
"FindReferencesOptions": ["@forumone/throughline/media"],
|
|
138
|
+
"FirstErrorProvider": ["@forumone/throughline/client"],
|
|
137
139
|
"FormattedAuditEvent": ["@forumone/throughline/audit"],
|
|
138
140
|
"FrameworkEvents": ["@forumone/throughline/jobs"],
|
|
139
141
|
"GlobalTagHookOptions": ["@forumone/throughline/publishing"],
|
|
142
|
+
"GoToFirstErrorOptions": ["@forumone/throughline/client"],
|
|
140
143
|
"GroupResolver": ["@forumone/throughline/approvals"],
|
|
141
144
|
"HEALTH_TOOLS": ["@forumone/throughline/editorial"],
|
|
142
145
|
"HEALTH_TOOL_DESCRIPTORS": ["@forumone/throughline/editorial"],
|
|
@@ -188,8 +191,12 @@
|
|
|
188
191
|
"JobTrigger": ["@forumone/throughline/jobs"],
|
|
189
192
|
"JobsAdapter": ["@forumone/throughline/jobs"],
|
|
190
193
|
"KeyParts": ["@forumone/throughline/media"],
|
|
194
|
+
"LINK_TARGET_KEY": ["@forumone/throughline/media", "@forumone/throughline/publishing"],
|
|
191
195
|
"LISTED": ["@forumone/throughline/fields"],
|
|
192
196
|
"LOCKED_DOCUMENTS_SLUG": ["@forumone/throughline"],
|
|
197
|
+
"LinkTarget": ["@forumone/throughline/media", "@forumone/throughline/publishing"],
|
|
198
|
+
"LinkTargetMarker": ["@forumone/throughline/media", "@forumone/throughline/publishing"],
|
|
199
|
+
"LinkTargetsInOptions": ["@forumone/throughline/media", "@forumone/throughline/publishing"],
|
|
193
200
|
"LockHolder": ["@forumone/throughline/content"],
|
|
194
201
|
"Logger": ["@forumone/throughline"],
|
|
195
202
|
"MANUAL_SYNC_EVENT": ["@forumone/throughline/integrations"],
|
|
@@ -314,6 +321,9 @@
|
|
|
314
321
|
"WEBHOOK_INTEGRATION_ID": ["@forumone/throughline/integrations"],
|
|
315
322
|
"WORK_TOOLS": ["@forumone/throughline/editorial"],
|
|
316
323
|
"WORK_TOOL_DESCRIPTORS": ["@forumone/throughline/editorial"],
|
|
324
|
+
"WalkDocumentOptions": ["@forumone/throughline/media"],
|
|
325
|
+
"WalkLocation": ["@forumone/throughline/media"],
|
|
326
|
+
"WalkVisitor": ["@forumone/throughline/media"],
|
|
317
327
|
"WebhookConfig": ["@forumone/throughline/integrations"],
|
|
318
328
|
"WorkOptions": ["@forumone/throughline/editorial"],
|
|
319
329
|
"WorkRow": ["@forumone/throughline/editorial"],
|
|
@@ -451,6 +461,7 @@
|
|
|
451
461
|
"getJobFailureWriter": ["@forumone/throughline/observability"],
|
|
452
462
|
"getPublishStatus": ["@forumone/throughline/publishing"],
|
|
453
463
|
"getPublishingService": ["@forumone/throughline/publishing"],
|
|
464
|
+
"goToFirstError": ["@forumone/throughline/client"],
|
|
454
465
|
"gridDays": ["@forumone/throughline/editorial"],
|
|
455
466
|
"hardenCoreCollections": ["@forumone/throughline"],
|
|
456
467
|
"hasDrafts": ["@forumone/throughline/testing"],
|
|
@@ -472,10 +483,13 @@
|
|
|
472
483
|
"jobPayload": ["@forumone/throughline/jobs"],
|
|
473
484
|
"keepOrStampPublishedAt": ["@forumone/throughline/fields"],
|
|
474
485
|
"linkLabelsCheck": ["@forumone/throughline/publishing"],
|
|
486
|
+
"linkTargetMarker": ["@forumone/throughline/media"],
|
|
487
|
+
"linkTargetsIn": ["@forumone/throughline/media", "@forumone/throughline/publishing"],
|
|
475
488
|
"listHref": ["@forumone/throughline/editorial"],
|
|
476
489
|
"lockHolder": ["@forumone/throughline/content"],
|
|
477
490
|
"lockRefusal": ["@forumone/throughline/content"],
|
|
478
491
|
"mapFields": ["@forumone/throughline/fields"],
|
|
492
|
+
"markLinkTarget": ["@forumone/throughline/media", "@forumone/throughline/publishing"],
|
|
479
493
|
"matchCommands": ["@forumone/throughline/editorial"],
|
|
480
494
|
"matchRank": ["@forumone/throughline/editorial"],
|
|
481
495
|
"mcpApiKeyAccess": ["@forumone/throughline"],
|
|
@@ -562,6 +576,7 @@
|
|
|
562
576
|
"usedBy": ["@forumone/throughline/fields"],
|
|
563
577
|
"validateBlock": ["@forumone/throughline/content"],
|
|
564
578
|
"verifyActionToken": ["@forumone/throughline/approvals"],
|
|
579
|
+
"walkDocument": ["@forumone/throughline/media"],
|
|
565
580
|
"webhookIntegration": ["@forumone/throughline/integrations"],
|
|
566
581
|
"whereQuery": ["@forumone/throughline/editorial"],
|
|
567
582
|
"withMeta": ["@forumone/throughline"],
|
|
@@ -654,6 +669,7 @@
|
|
|
654
669
|
"coerceBlock": ["@forumone/throughline-design-system/render"],
|
|
655
670
|
"collectSelectOptions": ["@forumone/throughline-design-system/generate"],
|
|
656
671
|
"compareShapes": ["@forumone/throughline-design-system/testing"],
|
|
672
|
+
"componentDisplayName": ["@forumone/throughline-design-system/contract"],
|
|
657
673
|
"defaultMismatches": ["@forumone/throughline-design-system/testing"],
|
|
658
674
|
"describeBlockInvariants": ["@forumone/throughline-design-system/testing"],
|
|
659
675
|
"fieldOverride": ["@forumone/throughline-design-system/generate"],
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* After a Save, Publish or Schedule that fails, takes the editor to the first
|
|
4
|
+
* field that is wrong. forumone-2026#805.
|
|
5
|
+
*
|
|
6
|
+
* Registered by the publishing plugin in `admin.components.providers`, so it
|
|
7
|
+
* wraps the whole admin. That is outside any form, which is why it listens to
|
|
8
|
+
* the page rather than to form state:
|
|
9
|
+
*
|
|
10
|
+
* - **Arms** on a click on one of Payload's save buttons (`#action-save`,
|
|
11
|
+
* `#action-save-draft`) or the save shortcut. An autosave has neither, so the
|
|
12
|
+
* page never moves while somebody is typing.
|
|
13
|
+
* - **Fires** when an error toast appears while armed — Payload raises one for
|
|
14
|
+
* every failed save, whether its own validation or the server refused — and
|
|
15
|
+
* goes to the first marked field, opening its tab or row if it must.
|
|
16
|
+
* - **Disarms** on a success toast, or after twenty seconds.
|
|
17
|
+
*
|
|
18
|
+
* The Publish button and the Schedule control call `goToFirstError` themselves
|
|
19
|
+
* once they have marked the fields, and disarm this first.
|
|
20
|
+
*/
|
|
21
|
+
export declare function FirstErrorProvider({ children }: {
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}): ReactNode;
|
|
24
|
+
//# sourceMappingURL=FirstErrorProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirstErrorProvider.d.ts","sourceRoot":"","sources":["../../../src/publishing/admin/FirstErrorProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAA;AAGjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAuDpF"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { armFirstError, goToFirstError, isExplicitSave, takeArmed } from './first-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* After a Save, Publish or Schedule that fails, takes the editor to the first
|
|
6
|
+
* field that is wrong. forumone-2026#805.
|
|
7
|
+
*
|
|
8
|
+
* Registered by the publishing plugin in `admin.components.providers`, so it
|
|
9
|
+
* wraps the whole admin. That is outside any form, which is why it listens to
|
|
10
|
+
* the page rather than to form state:
|
|
11
|
+
*
|
|
12
|
+
* - **Arms** on a click on one of Payload's save buttons (`#action-save`,
|
|
13
|
+
* `#action-save-draft`) or the save shortcut. An autosave has neither, so the
|
|
14
|
+
* page never moves while somebody is typing.
|
|
15
|
+
* - **Fires** when an error toast appears while armed — Payload raises one for
|
|
16
|
+
* every failed save, whether its own validation or the server refused — and
|
|
17
|
+
* goes to the first marked field, opening its tab or row if it must.
|
|
18
|
+
* - **Disarms** on a success toast, or after twenty seconds.
|
|
19
|
+
*
|
|
20
|
+
* The Publish button and the Schedule control call `goToFirstError` themselves
|
|
21
|
+
* once they have marked the fields, and disarm this first.
|
|
22
|
+
*/
|
|
23
|
+
export function FirstErrorProvider({ children }) {
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (typeof document === 'undefined')
|
|
26
|
+
return;
|
|
27
|
+
let observer = null;
|
|
28
|
+
let timer;
|
|
29
|
+
const stop = () => {
|
|
30
|
+
observer?.disconnect();
|
|
31
|
+
observer = null;
|
|
32
|
+
if (timer)
|
|
33
|
+
clearTimeout(timer);
|
|
34
|
+
timer = undefined;
|
|
35
|
+
};
|
|
36
|
+
const watch = () => {
|
|
37
|
+
stop();
|
|
38
|
+
armFirstError();
|
|
39
|
+
observer = new MutationObserver((mutations) => {
|
|
40
|
+
const type = toastType(mutations);
|
|
41
|
+
if (type === 'success') {
|
|
42
|
+
takeArmed();
|
|
43
|
+
stop();
|
|
44
|
+
}
|
|
45
|
+
else if (type === 'error') {
|
|
46
|
+
stop();
|
|
47
|
+
if (takeArmed())
|
|
48
|
+
void goToFirstError();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
// Only while armed: a whole-document observer during ordinary typing
|
|
52
|
+
// would cost something for nothing.
|
|
53
|
+
observer.observe(document.body, {
|
|
54
|
+
subtree: true,
|
|
55
|
+
childList: true,
|
|
56
|
+
attributes: true,
|
|
57
|
+
attributeFilter: ['data-type'],
|
|
58
|
+
});
|
|
59
|
+
timer = setTimeout(() => {
|
|
60
|
+
takeArmed();
|
|
61
|
+
stop();
|
|
62
|
+
}, 20_000);
|
|
63
|
+
};
|
|
64
|
+
const onEvent = (event) => {
|
|
65
|
+
if (isExplicitSave(event))
|
|
66
|
+
watch();
|
|
67
|
+
};
|
|
68
|
+
document.addEventListener('click', onEvent, true);
|
|
69
|
+
document.addEventListener('keydown', onEvent, true);
|
|
70
|
+
return () => {
|
|
71
|
+
document.removeEventListener('click', onEvent, true);
|
|
72
|
+
document.removeEventListener('keydown', onEvent, true);
|
|
73
|
+
stop();
|
|
74
|
+
};
|
|
75
|
+
}, []);
|
|
76
|
+
return children;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The kind of toast these mutations show appearing, if any. Sonner marks each
|
|
80
|
+
* toast `data-sonner-toast` with its `data-type`, and turns a promise toast
|
|
81
|
+
* from `loading` to `error` in place, which is an attribute change rather than
|
|
82
|
+
* a new node.
|
|
83
|
+
*/
|
|
84
|
+
function toastType(mutations) {
|
|
85
|
+
for (const mutation of mutations) {
|
|
86
|
+
const nodes = mutation.type === 'attributes' ? [mutation.target] : Array.from(mutation.addedNodes);
|
|
87
|
+
for (const node of nodes) {
|
|
88
|
+
if (!(node instanceof Element))
|
|
89
|
+
continue;
|
|
90
|
+
const toast = node.matches('[data-sonner-toast]')
|
|
91
|
+
? node
|
|
92
|
+
: node.querySelector('[data-sonner-toast]');
|
|
93
|
+
const type = toast?.getAttribute('data-type');
|
|
94
|
+
if (type === 'error' || type === 'success')
|
|
95
|
+
return type;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=FirstErrorProvider.js.map
|