@taprootio/site-authoring 0.62.0 → 0.64.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/README.md +63 -23
- package/package.json +2 -2
- package/src/api.js +149 -21
- package/src/appearance-contract.js +9 -0
- package/src/article-end-settings.js +295 -0
- package/src/changelog.json +39 -0
- package/src/chrome-input.js +1 -1
- package/src/cli.js +110 -26
- package/src/constants.js +7 -0
- package/src/content/components.js +130 -14
- package/src/content/cta-decoration-paint.js +321 -0
- package/src/content/form-placement-presentation.js +91 -0
- package/src/content/form-placement-presentation.json +6 -0
- package/src/content/free-form-section-registry.json +19 -1
- package/src/content/free-form-sections.js +64 -55
- package/src/content/markdown.js +13 -0
- package/src/content/tiptap-prosemirror.ts +72 -59
- package/src/content/validate-document.js +2 -0
- package/src/cta-artwork-warnings.js +164 -0
- package/src/errors.js +6 -0
- package/src/field-schema.json +6 -2
- package/src/field-validation.js +14 -5
- package/src/footer-workspace.js +7 -3
- package/src/form-references.js +71 -9
- package/src/forms-contract.js +3 -5
- package/src/heading-outline.js +7 -0
- package/src/output.js +2 -0
- package/src/page-article-end.js +66 -0
- package/src/page-block-catalog.js +54 -0
- package/src/page-form-presentation.js +104 -0
- package/src/page-structure-checks.js +7 -1
- package/src/placed-image-ids.js +15 -18
- package/src/presentation-reference.js +30 -52
- package/src/reference-help.js +97 -27
- package/src/reusable-blocks.js +429 -0
- package/src/reusable-placements.js +271 -0
- package/src/setting-reference.js +25 -1
- package/src/settings-catalog.js +1 -0
- package/src/site-check-findings.js +30 -2
- package/src/site-check-rules.json +1 -0
- package/src/site-checks.js +26 -2
- package/src/site-health-findings.js +25 -3
- package/src/site-health-image-checks.js +1 -1
- package/src/staging-check.js +108 -21
- package/src/staging-served.js +5 -49
- package/src/status-warning-paints.js +17 -0
- package/src/template-token-reach.json +14 -2
- package/src/theme-resolve.js +27 -0
- package/src/transport.js +41 -5
- package/src/typed-page-reference.js +55 -5
- package/src/typed-pages.js +27 -4
- package/src/verbs/approve.js +2 -1
- package/src/verbs/deploy.js +93 -15
- package/src/verbs/footer-push.js +4 -2
- package/src/verbs/forms-push.js +9 -0
- package/src/verbs/health.js +11 -6
- package/src/verbs/index.js +3 -0
- package/src/verbs/pages-blocks-pull.js +22 -0
- package/src/verbs/pages-push.js +89 -34
- package/src/verbs/plan.js +34 -5
- package/src/verbs/pull.js +213 -124
- package/src/verbs/status.js +20 -2
- package/src/verbs/theme-push.js +164 -14
- package/src/verbs/theme-resolve.js +114 -40
- package/src/verbs/validate.js +49 -18
- package/src/workspace-check.js +42 -5
- package/src/workspace-context-usage.js +54 -1
- package/src/workspace.js +37 -7
- package/test/fixtures/default-site-theme.json +1 -1
package/src/typed-pages.js
CHANGED
|
@@ -64,7 +64,7 @@ export const SHARED_FRONT_MATTER_KEYS = Object.freeze(["title", "path", "descrip
|
|
|
64
64
|
* its bare document, which has nowhere to carry them, so it does not accept
|
|
65
65
|
* them.
|
|
66
66
|
*/
|
|
67
|
-
const TYPED_PAGE_FRONT_MATTER_KEYS = Object.freeze(["displayDate", "displayAuthor", "showOnProfile", "coverImage", "tags"]);
|
|
67
|
+
const TYPED_PAGE_FRONT_MATTER_KEYS = Object.freeze(["displayDate", "displayAuthor", "showOnProfile", "articleEnd", "coverImage", "tags"]);
|
|
68
68
|
|
|
69
69
|
/** Front-matter fields only one template accepts. Others are refused for it. */
|
|
70
70
|
const TEMPLATE_FRONT_MATTER_KEYS = Object.freeze({
|
|
@@ -181,6 +181,20 @@ export function supportsAuthoredTags(template) {
|
|
|
181
181
|
return Object.hasOwn(TEMPLATE_FRONT_MATTER_KEYS, template) && TEMPLATE_FRONT_MATTER_KEYS[template].includes("tags");
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
/** Which workspace templates support the site’s article-end placement. */
|
|
185
|
+
export function supportsArticleEnd(template) {
|
|
186
|
+
return TEMPLATE_FRONT_MATTER_KEYS[template]?.includes("articleEnd") === true;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function requireArticleEnd(template, value, file, { fromText = false } = {}) {
|
|
190
|
+
if (!supportsArticleEnd(template)) {
|
|
191
|
+
throw fail("pages.article_end_invalid", `'${file}' is a ${template} page, which does not accept articleEnd.`, "articleEnd");
|
|
192
|
+
}
|
|
193
|
+
if (typeof value === "boolean") return value;
|
|
194
|
+
if (fromText && (value === "true" || value === "false")) return value === "true";
|
|
195
|
+
throw fail("pages.article_end_invalid", `'${file}' needs a boolean articleEnd value of true or false.`, "articleEnd");
|
|
196
|
+
}
|
|
197
|
+
|
|
184
198
|
/** Whether a site's wire template supports authored tags. */
|
|
185
199
|
export function supportsAuthoredTagWireType(wireType) {
|
|
186
200
|
return supportsAuthoredTags(templateNameForWireType(wireType));
|
|
@@ -675,12 +689,13 @@ function canonicalSourceData(template, data, file) {
|
|
|
675
689
|
* The canonical workspace document for a typed page, with keys in one fixed
|
|
676
690
|
* order. The order is part of the byte-stability contract.
|
|
677
691
|
*/
|
|
678
|
-
function typedDocument(template, { displayDate, displayAuthor, showOnProfile, coverImageId, tags, data }) {
|
|
692
|
+
function typedDocument(template, { displayDate, displayAuthor, showOnProfile, articleEnd, coverImageId, tags, data }) {
|
|
679
693
|
return {
|
|
680
694
|
template,
|
|
681
695
|
...(displayDate === undefined ? {} : { displayDate }),
|
|
682
696
|
...(displayAuthor === undefined ? {} : { displayAuthor }),
|
|
683
697
|
...(showOnProfile === undefined ? {} : { showOnProfile }),
|
|
698
|
+
...(articleEnd === undefined ? {} : { articleEnd }),
|
|
684
699
|
...(coverImageId === undefined ? {} : { coverImageId }),
|
|
685
700
|
...(tags === undefined ? {} : { tags }),
|
|
686
701
|
data,
|
|
@@ -689,8 +704,11 @@ function typedDocument(template, { displayDate, displayAuthor, showOnProfile, co
|
|
|
689
704
|
|
|
690
705
|
/** Validates a parsed `.pm.json` that declares a template, and returns its canonical form. */
|
|
691
706
|
export function typedDocumentFromJson(parsed, file) {
|
|
692
|
-
requireKeys(parsed, ["template", "displayDate", "displayAuthor", "showOnProfile", "coverImageId", "tags", "data"], file, "document");
|
|
707
|
+
requireKeys(parsed, ["template", "displayDate", "displayAuthor", "showOnProfile", "articleEnd", "coverImageId", "tags", "data"], file, "document");
|
|
693
708
|
const template = requireTemplateName(parsed.template, file);
|
|
709
|
+
const articleEnd = Object.hasOwn(parsed, "articleEnd")
|
|
710
|
+
? requireArticleEnd(template, parsed.articleEnd, file)
|
|
711
|
+
: undefined;
|
|
694
712
|
const tags = Object.hasOwn(parsed, "tags") ? requireSourceTags(template, parsed.tags, file).names : undefined;
|
|
695
713
|
if (template === TEMPLATE_FREE_FORM) {
|
|
696
714
|
throw fail(
|
|
@@ -719,6 +737,7 @@ export function typedDocumentFromJson(parsed, file) {
|
|
|
719
737
|
displayDate,
|
|
720
738
|
displayAuthor,
|
|
721
739
|
showOnProfile,
|
|
740
|
+
articleEnd,
|
|
722
741
|
coverImageId,
|
|
723
742
|
tags,
|
|
724
743
|
data: canonicalSourceData(template, parsed.data, file),
|
|
@@ -835,6 +854,7 @@ export function workspaceDocumentFromPage(page, listedTemplateType) {
|
|
|
835
854
|
: undefined,
|
|
836
855
|
// Written only when the page is kept off its author's profile, as the date is written only when there is one.
|
|
837
856
|
showOnProfile: !generated && page.showOnProfile === false ? false : undefined,
|
|
857
|
+
articleEnd: supportsArticleEnd(name) && page.articleEnd === false ? false : undefined,
|
|
838
858
|
coverImageId: !generated && typeof page.coverImageId === "string" && page.coverImageId !== ""
|
|
839
859
|
? page.coverImageId
|
|
840
860
|
: undefined,
|
|
@@ -1336,6 +1356,9 @@ export async function typedDocumentFromMarkdown({
|
|
|
1336
1356
|
}) {
|
|
1337
1357
|
if (template === TEMPLATE_GENERATED) throw generatedMarkdownFault(file);
|
|
1338
1358
|
if (template === TEMPLATE_LEGAL) throw legalMarkdownFault(file);
|
|
1359
|
+
const articleEnd = fields.has("articleEnd")
|
|
1360
|
+
? requireArticleEnd(template, fields.get("articleEnd"), file, { fromText: true })
|
|
1361
|
+
: undefined;
|
|
1339
1362
|
const tags = fields.has("tags") ? parseMarkdownTags(fields.get("tags"), file) : undefined;
|
|
1340
1363
|
const displayDate = fields.has("displayDate") ? requireDisplayDate(fields.get("displayDate"), file) : undefined;
|
|
1341
1364
|
const displayAuthor = fields.has("displayAuthor") ? requireDisplayAuthor(fields.get("displayAuthor"), file) : undefined;
|
|
@@ -1385,7 +1408,7 @@ export async function typedDocumentFromMarkdown({
|
|
|
1385
1408
|
return typedDocumentFromJson(
|
|
1386
1409
|
{
|
|
1387
1410
|
template,
|
|
1388
|
-
...definedEntries([["displayDate", displayDate], ["displayAuthor", displayAuthor], ["showOnProfile", showOnProfile], ["coverImageId", coverImageId], ["tags", tags]]),
|
|
1411
|
+
...definedEntries([["displayDate", displayDate], ["displayAuthor", displayAuthor], ["showOnProfile", showOnProfile], ["articleEnd", articleEnd], ["coverImageId", coverImageId], ["tags", tags]]),
|
|
1389
1412
|
data: withoutUndefined(data),
|
|
1390
1413
|
},
|
|
1391
1414
|
file,
|
package/src/verbs/approve.js
CHANGED
|
@@ -188,7 +188,8 @@ export async function approve(invocation) {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
const reported = boundedList(approved, MAXIMUM_REPORTED);
|
|
191
|
-
onProgress(`Approved ${approved.length} page(s).
|
|
191
|
+
onProgress(`Approved ${approved.length} page(s). Stage the selection, then promote it to publish.`);
|
|
192
|
+
onProgress("If a page moved, staging previews its automatic redirect and production promotion makes it live.");
|
|
192
193
|
return successResult(VERB_APPROVE, siteId, {
|
|
193
194
|
approved: {
|
|
194
195
|
total: approved.length,
|
package/src/verbs/deploy.js
CHANGED
|
@@ -3,24 +3,29 @@ import {
|
|
|
3
3
|
DEPLOYMENT_ENVIRONMENT_PRODUCTION,
|
|
4
4
|
DEPLOYMENT_ENVIRONMENT_STAGING,
|
|
5
5
|
DEPLOYMENT_REQUEST_OUTCOME_COALESCED,
|
|
6
|
+
DEPLOYMENT_REQUEST_OUTCOME_UNCHANGED,
|
|
6
7
|
DEPLOYMENT_STATUS_COMPLETED,
|
|
7
8
|
deploySite,
|
|
8
9
|
describePageEstimate,
|
|
9
10
|
getDeploySelection,
|
|
10
11
|
getPublishingReadiness,
|
|
12
|
+
getStagingPreviewStatus,
|
|
11
13
|
listDeployments,
|
|
12
14
|
mintStagingPreviewHandoff,
|
|
15
|
+
resetSiteStaging,
|
|
13
16
|
waitForDeployment,
|
|
14
17
|
withRefusalGuidance,
|
|
15
18
|
} from "../api.js";
|
|
16
19
|
import {
|
|
17
20
|
DEPLOY_TARGET_PRODUCTION,
|
|
21
|
+
DEPLOY_TARGET_RESET_STAGING,
|
|
18
22
|
DEPLOY_TARGET_STAGING,
|
|
19
23
|
LIMITS,
|
|
20
24
|
REFUSAL_CAPABILITY_MISSING,
|
|
21
25
|
REFUSAL_CREDENTIAL_REJECTED,
|
|
22
26
|
REFUSAL_UNCLASSIFIED,
|
|
23
27
|
SURFACE_DOCS_PRESENTATION,
|
|
28
|
+
SURFACE_NONE,
|
|
24
29
|
VERB_DEPLOY,
|
|
25
30
|
} from "../constants.js";
|
|
26
31
|
import { SiteAuthoringError } from "../errors.js";
|
|
@@ -129,6 +134,13 @@ async function resolveStagingDeploymentId(client, siteId, invocation, manifest,
|
|
|
129
134
|
onProgress("Looking for the most recent completed staging deployment to promote.");
|
|
130
135
|
const { deployments } = await listDeployments(client, siteId, { environment: DEPLOYMENT_ENVIRONMENT_STAGING });
|
|
131
136
|
const completed = deployments.find((deployment) => deployment.status === DEPLOYMENT_STATUS_COMPLETED);
|
|
137
|
+
if (completed?.stagingReset === true) {
|
|
138
|
+
throw new SiteAuthoringError(
|
|
139
|
+
"deploy.reset_not_promotable",
|
|
140
|
+
"The current stage was reset from production. Run 'taproot-site deploy --staging' with your next candidate before promoting.",
|
|
141
|
+
{ field: "stagingDeploymentId" },
|
|
142
|
+
);
|
|
143
|
+
}
|
|
132
144
|
if (completed === undefined) {
|
|
133
145
|
throw new SiteAuthoringError(
|
|
134
146
|
"deploy.staging_required",
|
|
@@ -161,6 +173,7 @@ function reportReadiness(readiness) {
|
|
|
161
173
|
approvedPageCount: readiness.approvedPageCount,
|
|
162
174
|
selectedPageCount: readiness.selectedPageCount,
|
|
163
175
|
blockedPageCount: readiness.blockedPageCount,
|
|
176
|
+
...(readiness.protectedCarryCount > 0 ? { protectedCarryCount: readiness.protectedCarryCount } : {}),
|
|
164
177
|
hasCandidateChanges: readiness.hasCandidateChanges,
|
|
165
178
|
hasSuccessfulStagingDeployment: readiness.hasSuccessfulStagingDeployment,
|
|
166
179
|
redirectsChanged: readiness.redirectsChanged,
|
|
@@ -205,24 +218,34 @@ function presentationHandoffUnavailable(error) {
|
|
|
205
218
|
}
|
|
206
219
|
return {
|
|
207
220
|
reason: "staging.handoff_unavailable",
|
|
208
|
-
recovery: "Run 'taproot-site staging review' to mint a fresh
|
|
209
|
-
+ "already deployed and waits for review.",
|
|
221
|
+
recovery: "Run 'taproot-site staging review' to mint a fresh handoff for the completed staging release.",
|
|
210
222
|
};
|
|
211
223
|
}
|
|
212
224
|
|
|
213
225
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* site's exact acknowledged staging host, and single-use like every other.
|
|
226
|
+
* Managed Docs deploys and Standard resets use a single-use review handoff.
|
|
227
|
+
* The handoff is host-bound. After a reset, confirm the expected release still
|
|
228
|
+
* holds that host before returning the link.
|
|
218
229
|
*/
|
|
219
|
-
async function
|
|
230
|
+
async function mintDeploymentStagingHandoff(client, siteId, onProgress, now, { returnPath, expectedDeploymentId }) {
|
|
220
231
|
try {
|
|
221
232
|
const handoff = await mintStagingPreviewHandoff(client, siteId, { now, returnPath });
|
|
233
|
+
if (expectedDeploymentId !== undefined) {
|
|
234
|
+
const current = await getStagingPreviewStatus(client, siteId).catch((error) => {
|
|
235
|
+
if (client.signal?.aborted) throw error;
|
|
236
|
+
return undefined;
|
|
237
|
+
});
|
|
238
|
+
if (current?.ready !== true || current.currentAcknowledgedStagingDeploymentId !== expectedDeploymentId ||
|
|
239
|
+
current.stagingUrl !== handoff.stagingUrl) {
|
|
240
|
+
const recovery = "Run 'taproot-site staging review' to open the current staging release.";
|
|
241
|
+
onProgress("Warning: staging changed before the review handoff was confirmed. " + recovery);
|
|
242
|
+
return { url: "", reason: "staging.release_changed", recovery };
|
|
243
|
+
}
|
|
244
|
+
}
|
|
222
245
|
onProgress(`Staging review handoff minted for ${handoff.stagingUrl}. ${STAGING_REVIEW_GUIDANCE}`);
|
|
223
246
|
return { ...handoff, review: STAGING_REVIEW_GUIDANCE };
|
|
224
247
|
} catch (error) {
|
|
225
|
-
if (error instanceof SiteAuthoringError && !(error instanceof ApiError)) throw error;
|
|
248
|
+
if (client.signal?.aborted || error instanceof SiteAuthoringError && !(error instanceof ApiError)) throw error;
|
|
226
249
|
const unavailable = presentationHandoffUnavailable(error);
|
|
227
250
|
onProgress(`Warning: the deployment completed, but a staging review handoff could not be minted (${unavailable.reason}). ${unavailable.recovery}`);
|
|
228
251
|
return { url: "", stagingUrl: "", ...unavailable };
|
|
@@ -249,16 +272,67 @@ async function readStagedSiteHealth({ client, config, siteId, onProgress, deploy
|
|
|
249
272
|
}
|
|
250
273
|
}
|
|
251
274
|
|
|
275
|
+
function stagingResetUnsupported() {
|
|
276
|
+
return new SiteAuthoringError("deploy.reset_unsupported", "Resetting staging to production is available on Standard sites.");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async function openDeploySession(invocation) {
|
|
280
|
+
try {
|
|
281
|
+
return await openSession(invocation);
|
|
282
|
+
} catch (error) {
|
|
283
|
+
if (invocation.deployTarget === DEPLOY_TARGET_RESET_STAGING &&
|
|
284
|
+
error instanceof SiteAuthoringError && error.code === "surface.none") throw stagingResetUnsupported();
|
|
285
|
+
throw error;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
async function resetStaging(invocation, { client, siteId, surface, now, onProgress }) {
|
|
290
|
+
if (surface === SURFACE_DOCS_PRESENTATION || surface === SURFACE_NONE) throw stagingResetUnsupported();
|
|
291
|
+
if (explicitSelection(invocation).present || invocation.stagingDeploymentId !== undefined || invocation.allowFailedPreview === true) {
|
|
292
|
+
throw usageError("deploy.reset_selection", "Resetting staging cannot carry a page, settings or navigation selection or a preview override.", "Candidate");
|
|
293
|
+
}
|
|
294
|
+
return await withRefusalGuidance(onProgress, "reset staging", async () => {
|
|
295
|
+
const before = await readStagingReleaseBefore(client, siteId, now);
|
|
296
|
+
const created = await resetSiteStaging(client, siteId);
|
|
297
|
+
const unchanged = created.outcome === DEPLOYMENT_REQUEST_OUTCOME_UNCHANGED;
|
|
298
|
+
const deployment = unchanged ? created : await waitForDeployment(client, {
|
|
299
|
+
siteId, deploymentId: created.id, environment: DEPLOYMENT_ENVIRONMENT_STAGING, onProgress, now,
|
|
300
|
+
});
|
|
301
|
+
const stagingServed = unchanged ? undefined : await confirmStagingServed(client, siteId, {
|
|
302
|
+
before, deploymentId: deployment.id, coalesced: created.outcome === DEPLOYMENT_REQUEST_OUTCOME_COALESCED, onProgress, now,
|
|
303
|
+
});
|
|
304
|
+
if (stagingServed && stagingServed.state !== "served") onProgress(`Warning: ${stagingServed.message}`);
|
|
305
|
+
if (invocation.handoff !== true) onProgress(HANDOFF_NOT_REQUESTED_PROGRESS);
|
|
306
|
+
const stagingPreview = invocation.handoff === true
|
|
307
|
+
? await mintDeploymentStagingHandoff(client, siteId, onProgress, now, {
|
|
308
|
+
returnPath: invocation.reviewPath,
|
|
309
|
+
expectedDeploymentId: deployment.id,
|
|
310
|
+
})
|
|
311
|
+
: handoffNotRequested();
|
|
312
|
+
onProgress(unchanged ? "Staging already matches production." : "Staging was reset from production. Stage the next candidate normally.");
|
|
313
|
+
return successResult(VERB_DEPLOY, siteId, {
|
|
314
|
+
target: DEPLOY_TARGET_RESET_STAGING,
|
|
315
|
+
environment: DEPLOYMENT_ENVIRONMENT_STAGING,
|
|
316
|
+
deployment,
|
|
317
|
+
outcome: created.outcome,
|
|
318
|
+
resetStatus: unchanged ? "unchanged" : "reset",
|
|
319
|
+
...(stagingServed === undefined ? {} : { stagingServed }),
|
|
320
|
+
stagingPreview,
|
|
321
|
+
nextStep: "staging review",
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
252
326
|
export async function deploy(invocation) {
|
|
253
327
|
const target = invocation.deployTarget;
|
|
254
|
-
if (target !== DEPLOY_TARGET_STAGING && target !== DEPLOY_TARGET_PRODUCTION) {
|
|
328
|
+
if (target !== DEPLOY_TARGET_STAGING && target !== DEPLOY_TARGET_PRODUCTION && target !== DEPLOY_TARGET_RESET_STAGING) {
|
|
255
329
|
throw usageError(
|
|
256
330
|
"deploy.target_missing",
|
|
257
|
-
"deploy requires
|
|
331
|
+
"deploy requires --staging, --production or --reset-staging.",
|
|
258
332
|
"deployTarget",
|
|
259
333
|
);
|
|
260
334
|
}
|
|
261
|
-
const session = await
|
|
335
|
+
const session = await openDeploySession(invocation);
|
|
262
336
|
const { client, config, siteId, surface, now, onProgress } = session;
|
|
263
337
|
// A managed Docs site deploys its settings and nothing else (TR00790): the
|
|
264
338
|
// Docs shell takes pages, navigation, and redirects from the artifact, so
|
|
@@ -269,6 +343,7 @@ export async function deploy(invocation) {
|
|
|
269
343
|
// exchange said the platform is paused. It changes nothing else: the write
|
|
270
344
|
// still runs and its refusal still classifies as platform_paused (TR00692).
|
|
271
345
|
warnIfExternalWritesPaused(session, VERB_DEPLOY);
|
|
346
|
+
if (target === DEPLOY_TARGET_RESET_STAGING) return await resetStaging(invocation, session);
|
|
272
347
|
const manifest = await readManifest(config.workspaceDir, siteId, { required: false });
|
|
273
348
|
const selection = explicitSelection(invocation);
|
|
274
349
|
const tagDestinationWarnings = presentationOnly ? undefined : reportTagDestinationWarnings(
|
|
@@ -354,8 +429,8 @@ export async function deploy(invocation) {
|
|
|
354
429
|
+ "only. Change a theme, brand, header, or footer setting first."
|
|
355
430
|
: "A staging deployment needs at least one approved page, settings group, or navigation change, or an "
|
|
356
431
|
+ "edited redirect map, form, or video caption or poster. Run 'taproot-site approve' or change "
|
|
357
|
-
+ "staged settings/navigation first.",
|
|
358
|
-
{ field: "Candidate" },
|
|
432
|
+
+ "staged settings/navigation first. To restore production on staging, run 'taproot-site deploy --reset-staging'.",
|
|
433
|
+
{ field: "Candidate", ...(!presentationOnly ? { nextStep: "taproot-site deploy --reset-staging" } : {}) },
|
|
359
434
|
);
|
|
360
435
|
if (nothingSelected && presentationOnly) {
|
|
361
436
|
throw emptySelectionError();
|
|
@@ -467,7 +542,7 @@ export async function deploy(invocation) {
|
|
|
467
542
|
// The review URL is a live credential, so it is minted only when asked for (TR01233).
|
|
468
543
|
if (invocation.handoff !== true) onProgress(HANDOFF_NOT_REQUESTED_PROGRESS);
|
|
469
544
|
const stagingPreview = invocation.handoff === true
|
|
470
|
-
? await
|
|
545
|
+
? await mintDeploymentStagingHandoff(client, siteId, onProgress, now, { returnPath: invocation.reviewPath })
|
|
471
546
|
: handoffNotRequested();
|
|
472
547
|
return successResult(VERB_DEPLOY, siteId, {
|
|
473
548
|
target,
|
|
@@ -488,6 +563,7 @@ export async function deploy(invocation) {
|
|
|
488
563
|
});
|
|
489
564
|
}
|
|
490
565
|
const { routeCheck, redirects, stagingPreview } = await inspectStagingPreview(client, siteId, onProgress, now, {
|
|
566
|
+
expectedDeploymentId: completed.id,
|
|
491
567
|
handoff: invocation.handoff === true,
|
|
492
568
|
returnPath: invocation.reviewPath,
|
|
493
569
|
});
|
|
@@ -509,7 +585,9 @@ export async function deploy(invocation) {
|
|
|
509
585
|
routeCheck,
|
|
510
586
|
redirects,
|
|
511
587
|
stagingPreview,
|
|
512
|
-
nextStep: redirects.verified
|
|
588
|
+
nextStep: redirects.verified !== true ? "redirects check"
|
|
589
|
+
: redirects.waitingForMove !== undefined ? "deploy --staging"
|
|
590
|
+
: "deploy --production",
|
|
513
591
|
});
|
|
514
592
|
});
|
|
515
593
|
}
|
package/src/verbs/footer-push.js
CHANGED
|
@@ -105,7 +105,9 @@ export async function footerPush(invocation) {
|
|
|
105
105
|
knownImageIds: context.knownImageIds,
|
|
106
106
|
},
|
|
107
107
|
);
|
|
108
|
-
onProgress(
|
|
108
|
+
onProgress(context.manifest.settingsOnly === true
|
|
109
|
+
? "Validated the footer document and site-owned image references locally. Taproot will check page targets when saving."
|
|
110
|
+
: "Validated the complete footer document, stable page targets, and site-owned image references locally.");
|
|
109
111
|
|
|
110
112
|
const footerChecks = {
|
|
111
113
|
...evaluateOfflineSiteChecks({
|
|
@@ -114,7 +116,7 @@ export async function footerPush(invocation) {
|
|
|
114
116
|
footerInput: await readFooterFitInput(config.workspaceDir, footerSettings),
|
|
115
117
|
onProgress,
|
|
116
118
|
}),
|
|
117
|
-
...footerLinkWarnings(context.manifest.pages, footerSettings, onProgress),
|
|
119
|
+
...(context.manifest.settingsOnly === true ? {} : footerLinkWarnings(context.manifest.pages, footerSettings, onProgress)),
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
if (dryRun) {
|
package/src/verbs/forms-push.js
CHANGED
|
@@ -239,6 +239,15 @@ export async function formsPush(invocation) {
|
|
|
239
239
|
let error = caught;
|
|
240
240
|
if (caught instanceof ApiError && (caught.hasField("ExpectedVersion") || caught.hasField("ExpectedSettings"))) {
|
|
241
241
|
error = changedOnTheSite(form.key, caught, applied);
|
|
242
|
+
} else if (
|
|
243
|
+
caught instanceof ApiError
|
|
244
|
+
&& caught.descriptionFor("Definition.presentation.hideRequiredLegend") === "form_appearance_unavailable"
|
|
245
|
+
) {
|
|
246
|
+
error = new SiteAuthoringError(
|
|
247
|
+
"forms.appearance_unavailable",
|
|
248
|
+
"This form appearance option is temporarily unavailable. Try again after the update finishes.",
|
|
249
|
+
{ field: `${formFileName(form.key)}:presentation.hideRequiredLegend`, status: caught.status },
|
|
250
|
+
);
|
|
242
251
|
} else if (caught instanceof ApiError && caught.descriptionFor("Sink") === "newsletter_disabled") {
|
|
243
252
|
error = new SiteAuthoringError(
|
|
244
253
|
"forms.newsletter_disabled",
|
package/src/verbs/health.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
buildImageFinding,
|
|
14
14
|
buildPageFindings,
|
|
15
15
|
filesByPageId,
|
|
16
|
+
imageFindingNewSinceProduction,
|
|
16
17
|
mergeAlts,
|
|
17
18
|
productionKeys,
|
|
18
19
|
reportHealthProgress,
|
|
@@ -120,19 +121,19 @@ export async function readSiteHealthReport({
|
|
|
120
121
|
stagedDeploymentId,
|
|
121
122
|
budgets,
|
|
122
123
|
}) {
|
|
123
|
-
const
|
|
124
|
+
const staging = environment === DEPLOY_TARGET_STAGING;
|
|
125
|
+
const production = await getSiteHealth(client, siteId, { includeImagePageResourceIds: staging });
|
|
124
126
|
let report = production;
|
|
125
|
-
if (
|
|
127
|
+
if (staging) {
|
|
126
128
|
const releaseId = stagedDeploymentId ?? production.stagedDeploymentId;
|
|
127
129
|
if (releaseId === undefined) return unavailable("not_checked", environment);
|
|
128
|
-
report = await getSiteHealth(client, siteId, { deploymentId: releaseId });
|
|
130
|
+
report = await getSiteHealth(client, siteId, { deploymentId: releaseId, includeImagePageResourceIds: true });
|
|
129
131
|
}
|
|
130
132
|
const available = ["complete", "incomplete"].includes(report.status) && Boolean(report.deploymentId);
|
|
131
133
|
if (!available) return unavailable(report.status, environment);
|
|
132
134
|
|
|
133
135
|
const manifest = await readManifest(config.workspaceDir, siteId, { required: false });
|
|
134
136
|
const fileByPageId = filesByPageId(manifest);
|
|
135
|
-
const staging = environment === DEPLOY_TARGET_STAGING;
|
|
136
137
|
const keys = staging ? productionKeys(production) : undefined;
|
|
137
138
|
const findings = buildPageFindings(report, { fileByPageId, keys, environment });
|
|
138
139
|
|
|
@@ -165,6 +166,7 @@ export async function readSiteHealthReport({
|
|
|
165
166
|
imageFindings = report.images.map((stored) => {
|
|
166
167
|
const record = records.get(stored.imageId);
|
|
167
168
|
const isFailed = failed.has(stored.imageId);
|
|
169
|
+
const newSinceProduction = imageFindingNewSinceProduction(stored, keys?.images);
|
|
168
170
|
return {
|
|
169
171
|
...buildImageFinding({
|
|
170
172
|
imageId: stored.imageId,
|
|
@@ -176,12 +178,13 @@ export async function readSiteHealthReport({
|
|
|
176
178
|
affectedPages: resolveAffectedPages(stored.affectedPages, fileByPageId),
|
|
177
179
|
environment,
|
|
178
180
|
}),
|
|
179
|
-
...(
|
|
181
|
+
...(newSinceProduction === undefined ? {} : { newSinceProduction }),
|
|
180
182
|
};
|
|
181
183
|
});
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
const compared = keys !== undefined;
|
|
187
|
+
const imageIdentityComplete = !compared || imageFindings.every((item) => item.newSinceProduction !== undefined);
|
|
185
188
|
reportHealthProgress(onProgress, {
|
|
186
189
|
environment,
|
|
187
190
|
checkedAt: report.checkedAt,
|
|
@@ -189,6 +192,7 @@ export async function readSiteHealthReport({
|
|
|
189
192
|
findings,
|
|
190
193
|
imageFindings,
|
|
191
194
|
compared: staging ? compared : undefined,
|
|
195
|
+
imageIdentityComplete,
|
|
192
196
|
});
|
|
193
197
|
const keptFindings = boundedByBytes(findings, budgets.findings);
|
|
194
198
|
const keptImages = boundedByBytes(imageFindings, budgets.imageFindings);
|
|
@@ -215,7 +219,8 @@ export async function readSiteHealthReport({
|
|
|
215
219
|
comparedTo: "production",
|
|
216
220
|
compared: true,
|
|
217
221
|
newFindings: findings.filter((item) => item.newSinceProduction).length,
|
|
218
|
-
newImageFindings: imageFindings.filter((item) => item.newSinceProduction).length,
|
|
222
|
+
newImageFindings: imageFindings.filter((item) => item.newSinceProduction === true).length,
|
|
223
|
+
...(imageIdentityComplete ? {} : { imageIdentityComplete: false }),
|
|
219
224
|
}
|
|
220
225
|
: {
|
|
221
226
|
comparedTo: "production",
|
package/src/verbs/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
VERB_MEDIA_IMAGES_GET,
|
|
24
24
|
VERB_MEDIA_IMAGES_DESCRIBE,
|
|
25
25
|
VERB_NAV_PUSH,
|
|
26
|
+
VERB_PAGES_BLOCKS_PULL,
|
|
26
27
|
VERB_PAGES_DELETE,
|
|
27
28
|
VERB_PAGES_META_SET,
|
|
28
29
|
VERB_PAGES_PUSH,
|
|
@@ -66,6 +67,7 @@ import { marketingPush } from "./marketing-push.js";
|
|
|
66
67
|
import { mediaUpload } from "./media-upload.js";
|
|
67
68
|
import { mediaImagesDescribe, mediaImagesGet, mediaImagesList } from "./media-images.js";
|
|
68
69
|
import { navPush } from "./nav-push.js";
|
|
70
|
+
import { pagesBlocksPull } from "./pages-blocks-pull.js";
|
|
69
71
|
import { pagesDelete } from "./pages-delete.js";
|
|
70
72
|
import { pagesMetaSet } from "./pages-meta-set.js";
|
|
71
73
|
import { pagesPush } from "./pages-push.js";
|
|
@@ -173,6 +175,7 @@ export const VERB_HANDLERS = Object.freeze({
|
|
|
173
175
|
[VERB_PULL]: pull,
|
|
174
176
|
[VERB_PAGES_PUSH]: pagesPush,
|
|
175
177
|
[VERB_PAGES_META_SET]: pagesMetaSet,
|
|
178
|
+
[VERB_PAGES_BLOCKS_PULL]: pagesBlocksPull,
|
|
176
179
|
[VERB_PAGES_DELETE]: pagesDelete,
|
|
177
180
|
[VERB_AUTHORS_LIST]: authorsList,
|
|
178
181
|
[VERB_AUTHORS_ADD]: authorsAdd,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { withRefusalGuidance } from "../api.js";
|
|
2
|
+
import { VERB_PAGES_BLOCKS_PULL } from "../constants.js";
|
|
3
|
+
import { getSitePageBlockCatalog } from "../page-block-catalog.js";
|
|
4
|
+
import { openSession, successResult } from "../session.js";
|
|
5
|
+
import { readManifest, writeManifest } from "../workspace.js";
|
|
6
|
+
|
|
7
|
+
export async function pagesBlocksPull(invocation) {
|
|
8
|
+
const { client, config, siteId, onProgress } = await openSession(invocation);
|
|
9
|
+
const manifest = await readManifest(config.workspaceDir, siteId);
|
|
10
|
+
const catalog = await withRefusalGuidance(
|
|
11
|
+
onProgress, VERB_PAGES_BLOCKS_PULL, () => getSitePageBlockCatalog(client, siteId),
|
|
12
|
+
);
|
|
13
|
+
if (catalog === undefined) delete manifest.pageBlockCatalog;
|
|
14
|
+
else manifest.pageBlockCatalog = catalog;
|
|
15
|
+
await writeManifest(config.workspaceDir, manifest);
|
|
16
|
+
|
|
17
|
+
const status = (rows) => rows === undefined ? { status: "unavailable" } : { status: "known", count: rows.length };
|
|
18
|
+
const forms = status(catalog?.forms);
|
|
19
|
+
const definitions = status(catalog?.definitions);
|
|
20
|
+
onProgress(`Page block catalog refreshed. Forms: ${forms.count ?? forms.status}. Reusable blocks: ${definitions.count ?? definitions.status}.`);
|
|
21
|
+
return successResult(VERB_PAGES_BLOCKS_PULL, siteId, { pageBlockCatalog: { forms, definitions } });
|
|
22
|
+
}
|