feat: add H6 admin client with H5 compat layer#348
Draft
shsteimer wants to merge 31 commits into
Draft
Conversation
Extract validatePath and classifySequenceStatus into utils.js, and filterPendingPages into diff-utils.js. No callers yet — this commit establishes the modules and tests independently of the admin migration. 350 tests, 0 failures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace direct fetch calls and ensureLogin patterns in scripts.js, diff.js, and orphaned-pages-popover.js with the shared helix-admin.js client. Also imports filterPendingPages from the extracted diff-utils.js module instead of duplicating the inline implementation in diff.js. - validateHosts / fetchHosts use RETRY_ON_401 (status GET is public) - submitStatusJob uses PREFLIGHT_AND_RETRY (job creation requires auth) - runJob / fetchJobDetails / pollJob use jobAdmin for cors-mode polling - orphaned-pages-popover uses admin directly (no AEM pipeline in iframe) - oneSecondFunction renamed to randomLoadingMessage; innerHTML → textContent Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both scripts.js and diff.js had near-identical implementations. The stricter validation (checks for live.url / preview.url) is used as the canonical form. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
redirect.svg was lost in migration from helix-labs-website. Icon is Font Awesome Free (arrow-right-to-bracket variant from labs repo). Redirect location popover used hardcoded white background; replaced with --color-background / --color-text / --color-border so it adapts to dark mode. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
[str] = path.split('://') was destructuring the first element (the
protocol), not the host+path. Fixed to [, str] so that
https://example.com/foo/bar correctly returns /foo/bar/*.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… mode
Error context was lost after helix-admin migration: the catch blocks
always called updateTableError('Job'), discarding the HTTP status code.
A 401 no longer showed the sidekick sign-in link and a 403 no longer
showed the permissions message. Hoist preview outside the try block so
error.status and site context can be forwarded to updateTableError.
Redirect icon (black fill SVG) was invisible in dark mode. Apply
filter: invert(1) scoped to both the manual data-theme="dark" toggle
and prefers-color-scheme: dark (excluding manual light overrides).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fetchJobDetails and fetchContent bypassed executeAdminRequest, so a 401 on those calls had no retry or login prompt. Wrap both with RETRY_ON_401 and propagate null returns to the call sites. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add res.ok guard in pollJob to stop polling on non-OK responses - Hoist statusAdmin to module scope in scripts.js (matches orphaned-pages-popover.js) - Simplify randomLoadingMessage to compact form Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
Commits
|
|
…lient Removes all hardcoded admin.hlx.page references from the log viewer. Admin detail buttons now carry requestFn closures over proper admin.* calls (admin.config, admin.index, admin.job, admin.status) instead of storing data-url attributes and using event delegation + admin.raw. All RewrittenData methods return DOM nodes instead of HTML strings, eliminating innerHTML usage in buildLog. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Addresses two SHOULD FIX items from Claude code review on PR #360: - `loadPrism().then()` was a floating promise; awaiting it prevents silent unhandled rejections and ensures highlight runs after Prism is loaded - `console.log` on caught error changed to `console.error` for proper error stream visibility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Adds admin.snapshot({org,site}) [GET/update/remove] and admin.sidekick({org,site}) [GET] namespaces to scripts/helix-admin.js
- Rewrites tools/snapshot-admin/utils.js: removes module-level org/site state and setOrgSite(), adds org/site as explicit params, replaces all direct fetch calls with admin.snapshot() + executeAdminRequest (PREFLIGHT_AND_RETRY on reads, RETRY_ON_401 on writes)
- Updates snapshot-admin.js and snapshot-details.js: removes setOrgSite() calls, passes org/site to each utils function, guards against null return (login cancelled)
- Migrates the sidekick config fetch in snapshot-details.js to admin.sidekick().get()
- Rewrites snapshot-utils.js: replaces all admin.hlx.page fetch calls with admin.snapshot()/admin.status() calls; keeps updateScheduledPublish + isRegisteredForSnapshotScheduler as direct fetch (external scheduler service, not admin.hlx.page)
- Rewrites popover.js: removes inline admin.hlx.page functions, imports shared helpers from snapshot-utils.js, uses admin.snapshot().get() directly for listing (sidekick iframe context, no AEM pipeline)
- palette.js unchanged — snapshot-utils.js exports same function signatures
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Wrap getCustomReviewHost in try-catch so network errors fall back to default review host instead of aborting the details load - Sequence deleteSnapshotUrls via reduce to prevent concurrent auth modals when multiple paths are deleted in one batch - Add formatError helper to restore friendly 401/403 messages - Document that saveManifest does not return the saved manifest - Comment reviewSnapshot to explain why review state is sent in both query param and body Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wrap the fetch() call in request() so that network-level failures (DNS, timeout, CORS block) are caught and returned as a normalized AdminResponse with ok=false, status=0, and error set to the thrown message. json()/text() reject with the original error. Previously these errors escaped the library as thrown exceptions, requiring every caller to add its own try-catch. Now the uniform ok/status/error contract holds for all failure modes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…og path in handleReviewAction
`null ?? { success: true }` was coercing login-cancelled returns to success,
bypassing callers' null guards and allowing deleteSnapshot/updatePaths to
proceed with partial server state. Fixes catch block log path for review
actions (was always logging /manifest, should be /review for
request/approve/reject).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds scripts/aem-admin.js — a new admin client targeting the Helix 6 admin API surface, with an H5 compatibility shim so existing H5 URL patterns continue to work during the transition. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d helix-admin client
- wrap fetch in try/catch; network errors return {ok:false, status:0}
instead of throwing, matching helix-admin's never-throws contract
- expose .url on bindConfig and bindOperation return values
- add psi, snapshot, sidekick namespaces
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Nothing reads it; the client is identified by import path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… tests admin-shared-behaviors.js exports runSharedBehaviorTests(admin), covering the full AdminResponse contract (network errors, response envelope, CRUD, content-type derivation, params, bodyless writes, bindOperation behaviors, raw(), suggestions shape, coordsFromURL edge cases, withRequestInit). helix-admin.test.js: runs shared suite + H5-specific URL assertions, coordsFromURL H5 patterns, ref:null behavior, suggestions H5 URLs. aem-admin.test.js: runs shared suite + H6-specific URL assertions, coordsFromURL H6 patterns, suggestions H6 URLs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers the three meaningful branches: H5 client returned when the use-h6-api localStorage key is absent, H6 client returned when the key is present (empty value and non-empty value). Uses mock.module() stubs so the tests don't exercise the real admin clients. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace direct `import admin from '../../scripts/helix-admin.js'` with `getAdminClient` from `scripts/admin-compat.js` across all 25 tool files. The compat shim dynamically selects helix-admin (H5) or aem-admin (H6) based on the `use-h6-api` localStorage flag, enabling H6 forward compat without changing tool behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolves conflicts from: - feat(helix-admin): add sidekick namespace; migrate site-query off admin.raw (#367) - fix(site-query): remove credentials: include from site fetches (#368) Kept HEAD's snapshot() function and getAdminClient import in site-query; took main's expanded sidekick/log/index tests and simplified updateTableError. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://wip-h6-support--helix-tools-website--adobe.aem.page/tools/robots-edit/index.html
🤖 Generated with Claude Code