@pantheon-systems/p1-next-sdk 0.11.1 → 0.13.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/bin/lib/transform.js +175 -1
- package/dist/P1NextRouterProvider.js +0 -4
- package/dist/P1NextRouterProvider.js.map +1 -1
- package/dist/auth-handler.d.ts.map +1 -1
- package/dist/auth-handler.js +4 -4
- package/dist/auth-handler.js.map +1 -1
- package/dist/editor-paths.js +0 -12
- package/dist/editor-paths.js.map +1 -1
- package/dist/handler-actions.js +0 -4
- package/dist/handler-actions.js.map +1 -1
- package/dist/handler.js +0 -16
- package/dist/handler.js.map +1 -1
- package/dist/middleware.js +0 -5
- package/dist/middleware.js.map +1 -1
- package/dist/pages-handler.js +0 -12
- package/dist/pages-handler.js.map +1 -1
- package/dist/published-page.d.ts +1 -1
- package/dist/published-page.js +0 -38
- package/dist/published-page.js.map +1 -1
- package/dist/routes/broker.d.ts +6 -0
- package/dist/routes/broker.d.ts.map +1 -1
- package/dist/routes/broker.js +25 -23
- package/dist/routes/broker.js.map +1 -1
- package/dist/routes/datasource-context.js +2 -2
- package/dist/routes/editor-context.js +4 -9
- package/dist/routes/editor-context.js.map +1 -1
- package/dist/routes/publish.js +0 -10
- package/dist/routes/publish.js.map +1 -1
- package/package.json +4 -4
package/bin/lib/transform.js
CHANGED
|
@@ -72,12 +72,186 @@ export function rewriteWrapperSignature(source) {
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* The editor's mid-switch waiting state moved into the SDK: `useP1Editor` now
|
|
77
|
+
* retains the last rendered props itself and reports *why* it is reloading, and
|
|
78
|
+
* `<EditorReloadOverlay>` owns the copy for each wait. The old inline version
|
|
79
|
+
* could not tell a workstream switch from a page switch, so it announced every
|
|
80
|
+
* reload as "Switching workstream".
|
|
81
|
+
*/
|
|
82
|
+
const OVERLAY_EDITS = [
|
|
83
|
+
[
|
|
84
|
+
` const [userRole, setUserRole] = useState<ContentRole>('editor');\n` +
|
|
85
|
+
` const lastGoodStateRef = React.useRef<{ puckKey: string; puckProps: any } | null>(null);\n`,
|
|
86
|
+
` const [userRole, setUserRole] = useState<ContentRole>('editor');\n`,
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
`<EditorContent path={path} lastGoodStateRef={lastGoodStateRef} />`,
|
|
90
|
+
`<EditorContent path={path} />`,
|
|
91
|
+
],
|
|
92
|
+
[
|
|
93
|
+
`function EditorContent({\n` +
|
|
94
|
+
` path,\n` +
|
|
95
|
+
` lastGoodStateRef,\n` +
|
|
96
|
+
`}: {\n` +
|
|
97
|
+
` path: string;\n` +
|
|
98
|
+
` lastGoodStateRef: React.MutableRefObject<{ puckKey: string; puckProps: any } | null>;\n` +
|
|
99
|
+
`}) {`,
|
|
100
|
+
`function EditorContent({ path }: { path: string }) {`,
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
` const { loading, error, puckKey, puckProps } = useP1Editor({`,
|
|
104
|
+
` const { loading, reloading, hasContent, error, puckKey, puckProps } = useP1Editor({`,
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
` P1QueryProvider,\n editorPathHref,\n} from "@pantheon-systems/puck-css";`,
|
|
108
|
+
` P1QueryProvider,\n editorPathHref,\n EditorReloadOverlay,\n} from "@pantheon-systems/puck-css";`,
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
` // Update last good state when loading completes successfully (ref passed from parent)
|
|
112
|
+
React.useEffect(() => {
|
|
113
|
+
if (!loading && !error) {
|
|
114
|
+
lastGoodStateRef.current = { puckKey, puckProps };
|
|
115
|
+
}
|
|
116
|
+
}, [loading, error, puckKey, puckProps]);
|
|
117
|
+
|
|
118
|
+
if (redirecting) {
|
|
119
|
+
return <LoadingMessage message="Redirecting" data-testid="editor-redirecting" />;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Show full loading screen only on first load (no previous state)
|
|
123
|
+
if (loading && !lastGoodStateRef.current) {
|
|
124
|
+
return <LoadingMessage message="Loading document" data-testid="editor-loading" />;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Show error only if we have no previous state to fall back to
|
|
128
|
+
if (error && !lastGoodStateRef.current) {
|
|
129
|
+
return (
|
|
130
|
+
<div style={{ textAlign: "center", padding: "4rem", fontFamily: "system-ui" }}>
|
|
131
|
+
<h3>Error loading document</h3>
|
|
132
|
+
<p style={{ color: "#666" }}>{error.message}</p>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Use current state if loaded, otherwise keep showing last good state
|
|
138
|
+
const displayState = (!loading && !error)
|
|
139
|
+
? { puckKey, puckProps }
|
|
140
|
+
: lastGoodStateRef.current ?? { puckKey, puckProps };
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<div className="puck-editor-theme" style={{ position: "relative" }}>
|
|
144
|
+
{/* Loading overlay - shown during branch switch */}
|
|
145
|
+
{loading && lastGoodStateRef.current && (
|
|
146
|
+
<div
|
|
147
|
+
style={{
|
|
148
|
+
position: "fixed",
|
|
149
|
+
top: "50%",
|
|
150
|
+
left: "50%",
|
|
151
|
+
transform: "translate(-50%, -50%)",
|
|
152
|
+
zIndex: 9999,
|
|
153
|
+
background: "rgba(255, 255, 255, 0.95)",
|
|
154
|
+
padding: "1rem 2rem",
|
|
155
|
+
borderRadius: "8px",
|
|
156
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
157
|
+
fontFamily: "system-ui",
|
|
158
|
+
fontSize: "14px",
|
|
159
|
+
color: "#333",
|
|
160
|
+
fontWeight: 500,
|
|
161
|
+
display: "flex",
|
|
162
|
+
alignItems: "center",
|
|
163
|
+
gap: "0.75rem",
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
<div
|
|
167
|
+
style={{
|
|
168
|
+
width: "16px",
|
|
169
|
+
height: "16px",
|
|
170
|
+
border: "2px solid #e0e0e0",
|
|
171
|
+
borderTopColor: "#2563eb",
|
|
172
|
+
borderRadius: "50%",
|
|
173
|
+
animation: "spin 0.6s linear infinite",
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
Switching workstream...
|
|
177
|
+
<style>{\`
|
|
178
|
+
@keyframes spin {
|
|
179
|
+
to { transform: rotate(360deg); }
|
|
180
|
+
}
|
|
181
|
+
\`}</style>
|
|
182
|
+
</div>
|
|
183
|
+
)}
|
|
184
|
+
<DatasourceRegistryProvider registry={editorCtx?.remoteDatasourceRegistry ?? []}>
|
|
185
|
+
<DatasourceDataProvider context={remoteDatasourceContext}>
|
|
186
|
+
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
|
187
|
+
<Puck key={\`\${displayState.puckKey}-\${chatbotEnabled ? "ai" : "no-ai"}\`} {...displayState.puckProps as any} _experimentalFullScreenCanvas={true} />
|
|
188
|
+
</DatasourceDataProvider>
|
|
189
|
+
</DatasourceRegistryProvider>
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
`,
|
|
194
|
+
` if (redirecting) {
|
|
195
|
+
return <LoadingMessage message="Redirecting" data-testid="editor-redirecting" />;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (loading) {
|
|
199
|
+
return <LoadingMessage message="Loading document" data-testid="editor-loading" />;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// A failed load with a document already on screen keeps that document; only a
|
|
203
|
+
// failure with nothing to fall back on takes over the view.
|
|
204
|
+
if (error && !hasContent) {
|
|
205
|
+
return (
|
|
206
|
+
<div style={{ textAlign: "center", padding: "4rem", fontFamily: "system-ui" }}>
|
|
207
|
+
<h3>Error loading document</h3>
|
|
208
|
+
<p style={{ color: "#666" }}>{error.message}</p>
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<div className="puck-editor-theme" style={{ position: "relative" }}>
|
|
215
|
+
<EditorReloadOverlay reloading={reloading} />
|
|
216
|
+
<DatasourceRegistryProvider registry={editorCtx?.remoteDatasourceRegistry ?? []}>
|
|
217
|
+
<DatasourceDataProvider context={remoteDatasourceContext}>
|
|
218
|
+
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
|
219
|
+
<Puck key={\`\${puckKey}-\${chatbotEnabled ? "ai" : "no-ai"}\`} {...puckProps as any} _experimentalFullScreenCanvas={true} />
|
|
220
|
+
</DatasourceDataProvider>
|
|
221
|
+
</DatasourceRegistryProvider>
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
`,
|
|
226
|
+
],
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Swap the hand-rolled loading overlay for the SDK one. Every anchor has to
|
|
231
|
+
* match: an app already on the SDK overlay is left alone, and an app that
|
|
232
|
+
* edited part of this region keeps its own version rather than being left with
|
|
233
|
+
* a broken mix of the two.
|
|
234
|
+
*/
|
|
235
|
+
export function rewriteLoadingOverlay(source) {
|
|
236
|
+
const found = OVERLAY_EDITS.filter(([find]) => source.includes(find));
|
|
237
|
+
if (found.length === 0) return source;
|
|
238
|
+
if (found.length !== OVERLAY_EDITS.length) {
|
|
239
|
+
throw new BailError(
|
|
240
|
+
"editor-client.tsx has a partly-customized loading overlay; migrate this file by hand.",
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
let out = source;
|
|
244
|
+
for (const [find, replace] of OVERLAY_EDITS) out = out.replace(find, replace);
|
|
245
|
+
return out;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** Full editor-client transform: deepen imports, add the named imports, rewrite the signature, adopt the SDK overlay. */
|
|
76
249
|
export function rewriteEditorClient(source) {
|
|
77
250
|
let out = deepenRelativeImports(source);
|
|
78
251
|
out = addNamedImport(out, "next/navigation", "usePathname", "prepend");
|
|
79
252
|
out = addNamedImport(out, "@pantheon-systems/p1-next-sdk", "editorPagePathFromUrlPath", "append");
|
|
80
253
|
out = rewriteWrapperSignature(out);
|
|
254
|
+
out = rewriteLoadingOverlay(out);
|
|
81
255
|
return out;
|
|
82
256
|
}
|
|
83
257
|
|
|
@@ -8,9 +8,6 @@ export function P1NextRouterProvider({ children }) {
|
|
|
8
8
|
const pathname = usePathname();
|
|
9
9
|
const searchParams = useSearchParams();
|
|
10
10
|
const isInitialMount = useRef(true);
|
|
11
|
-
// Re-fetch server component data on back/forward navigation.
|
|
12
|
-
// Without this, Next.js restores the cached client shell but the
|
|
13
|
-
// server-rendered content inside it is empty.
|
|
14
11
|
useEffect(() => {
|
|
15
12
|
const handler = (event) => {
|
|
16
13
|
if (event.persisted) {
|
|
@@ -20,7 +17,6 @@ export function P1NextRouterProvider({ children }) {
|
|
|
20
17
|
window.addEventListener("pageshow", handler);
|
|
21
18
|
return () => window.removeEventListener("pageshow", handler);
|
|
22
19
|
}, [nextRouter]);
|
|
23
|
-
// Also handle popstate (Next.js client-side back navigation)
|
|
24
20
|
useEffect(() => {
|
|
25
21
|
if (isInitialMount.current) {
|
|
26
22
|
isInitialMount.current = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"P1NextRouterProvider.js","sourceRoot":"","sources":["../src/P1NextRouterProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AACnE,OAAO,EAAE,eAAe,EAAiB,MAAM,4BAA4B,CAAC;AAE5E,MAAM,UAAU,oBAAoB,CAAC,EAAE,QAAQ,EAA2B;IACxE,MAAM,UAAU,GAAG,SAAS,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM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AAM,GAAa,OAAO,CAC9B,GAAG,EAAE,CAAC,CAAC;QACL,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE;QACnC,OAAO,EAAE,CAAC,GAAW,EAAE,OAA8B,EAAE,EAAE,CACvD,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC;QAClC,QAAQ;QACR,YAAY;KACb,CAAC,EACF,CAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,CAAC,CACrC,CAAC;IAEF,OAAO,CACL,KAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YACpC,QAAQ,GACgB,CAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-handler.d.ts","sourceRoot":"","sources":["../src/auth-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB;oBAEhD,OAAO,cACJ;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAA;KAAE;
|
|
1
|
+
{"version":3,"file":"auth-handler.d.ts","sourceRoot":"","sources":["../src/auth-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB;oBAEhD,OAAO,cACJ;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAA;KAAE;EAuBzD"}
|
package/dist/auth-handler.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
import { PRODUCTION_BASE_URL } from "@pantheon-systems/puck-css/server";
|
|
3
|
-
import { postBrokerLogin, postBrokerRedeem } from "./routes/broker";
|
|
3
|
+
import { postBrokerLogin, postBrokerLogout, postBrokerRedeem } from "./routes/broker";
|
|
4
4
|
export function createP1AuthHandler(opts) {
|
|
5
5
|
async function POST(request, { params }) {
|
|
6
6
|
const { action = [] } = await params;
|
|
7
7
|
const route = action[0];
|
|
8
|
-
// Same fallback as createNextConfig/createNextContentClient (PCC-3282):
|
|
9
|
-
// an unset p1BaseUrl (no CSS_BASE_URL / NEXT_PUBLIC_CSS_BASE_URL) should
|
|
10
|
-
// resolve to the production backend rather than failing broker login.
|
|
11
8
|
const p1BaseUrl = opts.p1BaseUrl ?? PRODUCTION_BASE_URL;
|
|
12
9
|
if (route === "login") {
|
|
13
10
|
return postBrokerLogin(request, opts.p1ApiKey, p1BaseUrl, opts.p1SiteUrl, opts.redirectUrl, opts.prompt);
|
|
@@ -15,6 +12,9 @@ export function createP1AuthHandler(opts) {
|
|
|
15
12
|
if (route === "redeem") {
|
|
16
13
|
return postBrokerRedeem(request, opts.p1ApiKey, p1BaseUrl);
|
|
17
14
|
}
|
|
15
|
+
if (route === "logout") {
|
|
16
|
+
return postBrokerLogout(request, p1BaseUrl);
|
|
17
|
+
}
|
|
18
18
|
return NextResponse.json({ error: "not_found" }, { status: 404 });
|
|
19
19
|
}
|
|
20
20
|
return { POST };
|
package/dist/auth-handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-handler.js","sourceRoot":"","sources":["../src/auth-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"auth-handler.js","sourceRoot":"","sources":["../src/auth-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAUtF,MAAM,UAAU,mBAAmB,CAAC,IAAyB;IAC3D,KAAK,UAAU,IAAI,CACjB,OAAgB,EAChB,EAAE,MAAM,EAA8C;QAEtD,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,MAAM,MAAM,CAAC;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAIxB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,mBAAmB,CAAC;QAExD,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;YACtB,OAAO,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3G,CAAC;QACD,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvB,OAAO,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvB,OAAO,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC"}
|
package/dist/editor-paths.js
CHANGED
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Editor URL → page path mapping, shared by the server page handler and the
|
|
3
|
-
* client-side editor. Pure and client-safe: the editor renders from a
|
|
4
|
-
* persistent layout (so it survives route-param changes) and derives its page
|
|
5
|
-
* path from usePathname() with these helpers, which must agree with the
|
|
6
|
-
* server's parsing in pages-handler.
|
|
7
|
-
*/
|
|
8
1
|
import { pagePathFromCatchAllSegments } from "@pantheon-systems/puck-css/routes";
|
|
9
2
|
export function parseEditorSegments(segments) {
|
|
10
3
|
if (segments.length === 0)
|
|
11
4
|
return "/";
|
|
12
5
|
const command = segments[0];
|
|
13
|
-
// /p1/api/... is handled by the route handler, not the page
|
|
14
6
|
if (command === "api")
|
|
15
7
|
return "/";
|
|
16
|
-
// /p1/edit/... -> editor for the path
|
|
17
8
|
if (command === "edit") {
|
|
18
9
|
return pagePathFromCatchAllSegments(segments.slice(1));
|
|
19
10
|
}
|
|
20
|
-
// /p1/... (anything else) -> editor for that path
|
|
21
11
|
return pagePathFromCatchAllSegments(segments);
|
|
22
12
|
}
|
|
23
13
|
export function editorPagePathFromUrlPath(pathname, basePath = "/p1") {
|
|
24
14
|
if (pathname !== basePath && !pathname.startsWith(`${basePath}/`)) {
|
|
25
|
-
// Falling back silently would make the editor load and edit the root
|
|
26
|
-
// document while the URL points somewhere else entirely.
|
|
27
15
|
console.warn(`[p1-next-sdk] "${pathname}" is outside the editor base path "${basePath}"; ` +
|
|
28
16
|
`falling back to the root page. If the editor is not mounted at ${basePath}, ` +
|
|
29
17
|
`pass the correct basePath to editorPagePathFromUrlPath.`);
|
package/dist/editor-paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-paths.js","sourceRoot":"","sources":["../src/editor-paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor-paths.js","sourceRoot":"","sources":["../src/editor-paths.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,MAAM,UAAU,mBAAmB,CAAC,QAAkB;IACpD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAG5B,IAAI,OAAO,KAAK,KAAK;QAAE,OAAO,GAAG,CAAC;IAGlC,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,OAAO,4BAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;IAGD,OAAO,4BAA4B,CAAC,QAAQ,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,QAAgB,EAChB,QAAQ,GAAG,KAAK;IAEhB,IAAI,QAAQ,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,CAAC,EAAE,CAAC;QAGlE,OAAO,CAAC,IAAI,CACV,kBAAkB,QAAQ,sCAAsC,QAAQ,KAAK;YAC3E,kEAAkE,QAAQ,IAAI;YAC9E,yDAAyD,CAC5D,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,QAAQ,GAAG,QAAQ;SACtB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;SACtB,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,OAAO,CAAC,CAAC;IACnB,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/handler-actions.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Barrel re-export for handler actions.
|
|
3
|
-
* Each domain lives in its own route module under `./routes/`.
|
|
4
|
-
*/
|
|
5
1
|
export { normalizePath } from "@pantheon-systems/puck-css/server";
|
|
6
2
|
export { getPageData } from "./routes/page-data";
|
|
7
3
|
export { getEditorContext } from "./routes/editor-context";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler-actions.js","sourceRoot":"","sources":["../src/handler-actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler-actions.js","sourceRoot":"","sources":["../src/handler-actions.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACvH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/handler.js
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* P1 Next SDK handler — NextAuth-style catch-all for `/p1/api/[...p1]`.
|
|
3
|
-
*
|
|
4
|
-
* Usage in your Next.js app:
|
|
5
|
-
*
|
|
6
|
-
* // app/p1/api/[...p1]/route.ts
|
|
7
|
-
* import { createP1Handler } from "@pantheon-systems/p1-next-sdk";
|
|
8
|
-
* import config from "../../../../puck.config";
|
|
9
|
-
* const handler = createP1Handler({ config });
|
|
10
|
-
* export const { GET, POST, DELETE } = handler;
|
|
11
|
-
*/
|
|
12
1
|
import { NextResponse } from "next/server";
|
|
13
2
|
import { ensureInitialized } from "@pantheon-systems/puck-css/server";
|
|
14
3
|
import { runWithAuthToken } from "@pantheon-systems/puck-css/server";
|
|
15
4
|
import { extractBearerToken } from "./auth-utils";
|
|
16
5
|
import { getPageData, getRemoteDatasources, getEditorContext, getDatasourceContext, getRoutes, postPublish, postResolvePreview, postPreviewMeta, postRemoteDatasources, deleteRemoteDatasources, } from "./handler-actions";
|
|
17
|
-
/** Extract the sub-path segments from the catch-all `p1` param under `/p1/api/`. */
|
|
18
6
|
function parseP1Segments(p1) {
|
|
19
7
|
if (p1.length === 0)
|
|
20
8
|
return { action: "", rest: [] };
|
|
@@ -28,10 +16,6 @@ function withAuth(request, fn) {
|
|
|
28
16
|
return NextResponse.json({ error: "unauthorized" }, { status: 401 });
|
|
29
17
|
}
|
|
30
18
|
export function createP1Handler(opts) {
|
|
31
|
-
// Called per request, not pinned at module load: ensureInitialized dedupes
|
|
32
|
-
// successful inits and clears its state on failure, so a transient failure at
|
|
33
|
-
// cold start retries instead of leaving every later request awaiting a
|
|
34
|
-
// permanently rejected promise.
|
|
35
19
|
const init = () => ensureInitialized(opts);
|
|
36
20
|
async function GET(request, { params }) {
|
|
37
21
|
await init();
|
package/dist/handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,iBAAiB,EAAqB,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,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,CAAC,CAAC,CAAC;QAE7F,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,KAAK,UAAU,MAAM,CACnB,OAAgB,EAChB,EAAE,MAAM,EAA0C;QAElD,MAAM,IAAI,EAAE,CAAC;QACb,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,MAAM,MAAM,CAAC;QACjC,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;QAEvC,IAAI,MAAM,KAAK,aAAa;YAAE,OAAO,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC;QAE/F,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC"}
|
package/dist/middleware.js
CHANGED
|
@@ -15,10 +15,6 @@ export function createP1Middleware(config) {
|
|
|
15
15
|
return NextResponse.next();
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
// Asset-extension paths deliberately still reach getRedirect: redirects are
|
|
19
|
-
// user-configured for arbitrary paths, and migrating sites point old asset
|
|
20
|
-
// URLs at their new home. Only the document lookup is skipped (see
|
|
21
|
-
// resolvePageData).
|
|
22
18
|
try {
|
|
23
19
|
const redirect = await client.getRedirect(pathname);
|
|
24
20
|
if (redirect !== null) {
|
|
@@ -29,7 +25,6 @@ export function createP1Middleware(config) {
|
|
|
29
25
|
const validStatusCodes = [301, 302, 303, 307, 308];
|
|
30
26
|
const statusCode = validStatusCodes.includes(redirect.statusCode) ? redirect.statusCode : 301;
|
|
31
27
|
const destinationUrl = new URL(destination);
|
|
32
|
-
// Preserve original query parameters
|
|
33
28
|
if (url.search) {
|
|
34
29
|
url.searchParams.forEach((value, key) => {
|
|
35
30
|
if (!destinationUrl.searchParams.has(key)) {
|
package/dist/middleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAEnD,MAAM,UAAU,kBAAkB,CAAC,MAA0B;IAC3D,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;QACjC,OAAO,EAAE,MAAM,CAAC,UAAU;QAC1B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,CAAC;IAEH,OAAO,KAAK,UAAU,YAAY,CAAC,OAAgB;QACjD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAE9B,KAAK,MAAM,MAAM,IAAI,aAAa,EAAE,CAAC;YACnC,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;gBAChC,OAAO,YAAY,CAAC,IAAI,EAAE,CAAC;YAC7B,CAAC;QACH,CAAC;
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAEnD,MAAM,UAAU,kBAAkB,CAA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,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC9F,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;gBAE5C,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;oBACf,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;wBACtC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;4BAC1C,cAAc,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;wBAC9C,CAAC;oBACH,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,OAAO,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO,CAAC,IAAI,CAAC,0CAA0C,EAAE,OAAO,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,YAAY,CAAC,IAAI,EAAE,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/pages-handler.js
CHANGED
|
@@ -3,16 +3,7 @@ import { ensureInitialized, } from "@pantheon-systems/puck-css/server";
|
|
|
3
3
|
import { parseEditorSegments } from "./editor-paths";
|
|
4
4
|
export function createP1Pages(opts) {
|
|
5
5
|
const { EditorClient } = opts;
|
|
6
|
-
// Called per request, not pinned at module load: ensureInitialized dedupes
|
|
7
|
-
// successful inits and clears its state on failure, so a transient failure at
|
|
8
|
-
// cold start retries instead of leaving every later request awaiting a
|
|
9
|
-
// permanently rejected promise.
|
|
10
6
|
const init = () => ensureInitialized(opts);
|
|
11
|
-
// A parent layout always renders before its child page within a request, so
|
|
12
|
-
// if the editor is mounted correctly Layout flips this before Page reads it.
|
|
13
|
-
// A legacy page-only app (no `(editor)/layout.tsx`) renders Page alone, and
|
|
14
|
-
// the flag is still false — the dev-only nudge below fires. Per-process,
|
|
15
|
-
// best-effort: it can't run in production and never affects output.
|
|
16
7
|
let layoutRendered = false;
|
|
17
8
|
let warnedMissingLayout = false;
|
|
18
9
|
async function generateMetadata({ params, }) {
|
|
@@ -21,14 +12,11 @@ export function createP1Pages(opts) {
|
|
|
21
12
|
const pagePath = parseEditorSegments(p1);
|
|
22
13
|
return { title: "P1 Editor: " + pagePath };
|
|
23
14
|
}
|
|
24
|
-
// Persists across route-param changes — the editor lives here. Sets the flag
|
|
25
|
-
// synchronously (before any await) so Page can observe it in the same request.
|
|
26
15
|
async function Layout({ children }) {
|
|
27
16
|
layoutRendered = true;
|
|
28
17
|
await init();
|
|
29
18
|
return (_jsxs(_Fragment, { children: [_jsx(EditorClient, {}), children] }));
|
|
30
19
|
}
|
|
31
|
-
// Remounts per navigation; must stay empty so nothing is lost when it does.
|
|
32
20
|
function Page() {
|
|
33
21
|
if (process.env.NODE_ENV !== "production" &&
|
|
34
22
|
!layoutRendered &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages-handler.js","sourceRoot":"","sources":["../src/pages-handler.tsx"],"names":[],"mappings":";AA4CA,OAAO,EACL,iBAAiB,GAElB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAarD,MAAM,UAAU,aAAa,CAAC,IAAmB;IAC/C,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"pages-handler.js","sourceRoot":"","sources":["../src/pages-handler.tsx"],"names":[],"mappings":";AA4CA,OAAO,EACL,iBAAiB,GAElB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAarD,MAAM,UAAU,aAAa,CAAC,IAAmB;IAC/C,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAK9B,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAO3C,IAAI,cAAc,GAAG,KAAK,CAAC;IAC3B,IAAI,mBAAmB,GAAG,KAAK,CAAC;IAEhC,KAAK,UAAU,gBAAgB,CAAC,EAC9B,MAAM,GAGP;QACC,MAAM,IAAI,EAAE,CAAC;QACb,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,MAAM,MAAM,CAAC;QACjC,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAC;QACzC,OAAO,EAAE,KAAK,EAAE,aAAa,GAAG,QAAQ,EAAE,CAAC;IAC7C,CAAC;IAID,KAAK,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAiC;QAC/D,cAAc,GAAG,IAAI,CAAC;QACtB,MAAM,IAAI,EAAE,CAAC;QACb,OAAO,CACL,8BACE,KAAC,YAAY,KAAG,EACf,QAAQ,IACR,CACJ,CAAC;IACJ,CAAC;IAGD,SAAS,IAAI;QACX,IACE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YACrC,CAAC,cAAc;YACf,CAAC,mBAAmB,EACpB,CAAC;YACD,mBAAmB,GAAG,IAAI,CAAC;YAC3B,OAAO,CAAC,IAAI,CACV,sEAAsE;gBACpE,uEAAuE;gBACvE,4CAA4C;gBAC5C,qDAAqD;gBACrD,iCAAiC,CACpC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/published-page.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export type PublishedPageResult = {
|
|
|
34
34
|
* Published Puck data for `path`.
|
|
35
35
|
*
|
|
36
36
|
* Memoized with cache(): generateMetadata and the page body both need the same
|
|
37
|
-
* page, and without this every render reads it from
|
|
37
|
+
* page, and without this every render reads it from the backend twice.
|
|
38
38
|
*/
|
|
39
39
|
export declare const loadPublishedPage: (path: string) => Promise<PublishedPageResult>;
|
|
40
40
|
/**
|
package/dist/published-page.js
CHANGED
|
@@ -1,49 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Server-side readers for published content.
|
|
3
|
-
*
|
|
4
|
-
* These live in the SDK rather than the scaffolded app because they carry the
|
|
5
|
-
* invariants that keep public routes cacheable and correct: initialization is
|
|
6
|
-
* awaited per read so a failed cold start can recover, a miss is reported
|
|
7
|
-
* distinctly from an outage so it can become a real 404 instead of a cached
|
|
8
|
-
* 200, and prerendering is aborted rather than baking an empty page into the
|
|
9
|
-
* build. A renderer that gets any of those wrong fails in ways that only show
|
|
10
|
-
* up under CDN caching or a backend blip.
|
|
11
|
-
*
|
|
12
|
-
* How a miss is presented — the copy, the styling, the editor links — is the
|
|
13
|
-
* app's business, and stays in the app.
|
|
14
|
-
*/
|
|
15
1
|
import { cache } from "react";
|
|
16
2
|
import { connection } from "next/server";
|
|
17
3
|
import { ensureInitialized, getPage, listRouteTemplateKeysFromDatabase, } from "@pantheon-systems/puck-css/server";
|
|
18
|
-
/**
|
|
19
|
-
* Awaited on every read rather than pinned to a module-level promise: the DAL
|
|
20
|
-
* dedupes successful inits itself and clears its state on failure, so calling it
|
|
21
|
-
* per read is what lets a transient cold-start failure recover instead of
|
|
22
|
-
* serving the empty state until the process restarts.
|
|
23
|
-
*/
|
|
24
4
|
const initP1 = () => ensureInitialized({
|
|
25
5
|
p1BaseUrl: process.env.NEXT_PUBLIC_CSS_BASE_URL,
|
|
26
6
|
p1ApiKey: process.env.CSS_API_KEY,
|
|
27
7
|
p1SiteId: process.env.NEXT_PUBLIC_CSS_SITE_ID,
|
|
28
|
-
// Default to "main" when unset: server components (no user token) need a
|
|
29
|
-
// branch to list/read documents (e.g. the /structure routes table).
|
|
30
8
|
p1BranchId: process.env.NEXT_PUBLIC_CSS_BRANCH_ID ?? "main",
|
|
31
9
|
});
|
|
32
10
|
async function unavailable(path, error) {
|
|
33
11
|
console.warn(`[p1-next-sdk] published content unavailable for ${path}:`, error instanceof Error ? error.message : String(error));
|
|
34
|
-
// Aborts prerendering and defers to the request. Public pages are prerendered
|
|
35
|
-
// at build time now that they no longer opt out of caching, so without this a
|
|
36
|
-
// build running while the backend is down would fail outright, and a build
|
|
37
|
-
// against a half-up backend would bake the holding page into cached output.
|
|
38
12
|
await connection();
|
|
39
13
|
return { status: "unavailable" };
|
|
40
14
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Published Puck data for `path`.
|
|
43
|
-
*
|
|
44
|
-
* Memoized with cache(): generateMetadata and the page body both need the same
|
|
45
|
-
* page, and without this every render reads it from Postgres twice.
|
|
46
|
-
*/
|
|
47
15
|
export const loadPublishedPage = cache(async (path) => {
|
|
48
16
|
try {
|
|
49
17
|
await initP1();
|
|
@@ -54,12 +22,6 @@ export const loadPublishedPage = cache(async (path) => {
|
|
|
54
22
|
return unavailable(path, error);
|
|
55
23
|
}
|
|
56
24
|
});
|
|
57
|
-
/**
|
|
58
|
-
* Collection template keys for the current render.
|
|
59
|
-
*
|
|
60
|
-
* Memoized with cache(): metadata resolution and the page body each need them,
|
|
61
|
-
* and each call lists every key in the store.
|
|
62
|
-
*/
|
|
63
25
|
export const loadRouteTemplateKeys = cache(async () => {
|
|
64
26
|
await initP1();
|
|
65
27
|
return listRouteTemplateKeysFromDatabase();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"published-page.js","sourceRoot":"","sources":["../src/published-page.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"published-page.js","sourceRoot":"","sources":["../src/published-page.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,iBAAiB,E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C7C,CAAC,CAAC,CAAC"}
|
package/dist/routes/broker.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
export declare function postBrokerLogin(request: Request, apiKey: string | undefined, baseUrl: string | undefined, siteUrl?: string, redirectUrl?: string, prompt?: string): Promise<NextResponse<any>>;
|
|
3
3
|
export declare function postBrokerRedeem(request: Request, apiKey: string | undefined, baseUrl: string | undefined): Promise<NextResponse<any>>;
|
|
4
|
+
/**
|
|
5
|
+
* Unlike login and redeem, this carries no API key: logout authenticates with
|
|
6
|
+
* the broker JWT the browser already holds. The hop exists so a proxy-mode app
|
|
7
|
+
* can keep a same-origin connect-src, matching how login and redeem are routed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function postBrokerLogout(request: Request, baseUrl: string | undefined): Promise<NextResponse<any>>;
|
|
4
10
|
//# sourceMappingURL=broker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broker.d.ts","sourceRoot":"","sources":["../../src/routes/broker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAsB3C,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,8BA+EhB;AA6BD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,8BA0C5B"}
|
|
1
|
+
{"version":3,"file":"broker.d.ts","sourceRoot":"","sources":["../../src/routes/broker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAsB3C,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,8BA+EhB;AA6BD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,8BA0C5B;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GAAG,SAAS,8BA0C5B"}
|
package/dist/routes/broker.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
|
-
// Route Handler `request.url` reflects the Node server's own bind address
|
|
3
|
-
// (e.g. localhost:3000), not the Host the browser actually requested, once a
|
|
4
|
-
// reverse proxy is involved -- but its scheme is unaffected by that, so only
|
|
5
|
-
// the host needs replacing.
|
|
6
|
-
//
|
|
7
|
-
// Deliberately reads `host`, NOT `x-forwarded-host`: on Pantheon, `Host` is
|
|
8
|
-
// what the edge routes on, so a request only reaches this container with a
|
|
9
|
-
// Host that resolves to this site -- an arbitrary Host 404s upstream.
|
|
10
|
-
// `X-Forwarded-Host` is not similarly validated; it passes through from the
|
|
11
|
-
// client unchanged, so trusting it here would let anyone redirect a login
|
|
12
|
-
// to an attacker-controlled origin (confirmed empirically, not theoretical).
|
|
13
2
|
function deriveOriginFromRequest(request) {
|
|
14
3
|
const host = request.headers.get("host");
|
|
15
4
|
const requestUrl = new URL(request.url);
|
|
@@ -49,10 +38,6 @@ export async function postBrokerLogin(request, apiKey, baseUrl, siteUrl, redirec
|
|
|
49
38
|
}
|
|
50
39
|
}
|
|
51
40
|
const effectiveRedirectUrl = redirectUrl ?? actualOrigin + basePath;
|
|
52
|
-
// PCC-3531: the fallback above yields localhost on a deployed site because this
|
|
53
|
-
// server cannot see its own public origin. The browser can, so pass its origin
|
|
54
|
-
// upstream as a proposal for CCR to validate. Skipped when a target is
|
|
55
|
-
// configured, keeping those requests byte-identical to before.
|
|
56
41
|
const hasExplicitTarget = redirectUrl !== undefined || siteUrlValue !== undefined;
|
|
57
42
|
const proposedOrigin = hasExplicitTarget
|
|
58
43
|
? undefined
|
|
@@ -70,18 +55,12 @@ export async function postBrokerLogin(request, apiKey, baseUrl, siteUrl, redirec
|
|
|
70
55
|
if (!response.ok) {
|
|
71
56
|
return NextResponse.json(body, { status: response.status });
|
|
72
57
|
}
|
|
73
|
-
// Log then strip: this route is public, so echoing the warning would let anyone
|
|
74
|
-
// probe whether an origin is registered for a site. The browser never reads it.
|
|
75
58
|
const { warning, ...clientBody } = body;
|
|
76
59
|
if (typeof warning === "string" && warning !== "") {
|
|
77
60
|
console.warn(`[P1AuthHandler] ${warning}`);
|
|
78
61
|
}
|
|
79
62
|
return NextResponse.json(clientBody);
|
|
80
63
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Still untrusted after this — CCR validates against the site's registered
|
|
83
|
-
* origins. Malformed values are dropped rather than forwarded upstream.
|
|
84
|
-
*/
|
|
85
64
|
async function readProposedOrigin(request) {
|
|
86
65
|
let parsed;
|
|
87
66
|
try {
|
|
@@ -95,8 +74,6 @@ async function readProposedOrigin(request) {
|
|
|
95
74
|
return undefined;
|
|
96
75
|
}
|
|
97
76
|
try {
|
|
98
|
-
// Re-deriving the origin and requiring an exact match rejects anything
|
|
99
|
-
// carrying a path or credentials.
|
|
100
77
|
const url = new URL(candidate);
|
|
101
78
|
return url.origin === candidate ? candidate : undefined;
|
|
102
79
|
}
|
|
@@ -132,4 +109,29 @@ export async function postBrokerRedeem(request, apiKey, baseUrl) {
|
|
|
132
109
|
}
|
|
133
110
|
return NextResponse.json(body);
|
|
134
111
|
}
|
|
112
|
+
export async function postBrokerLogout(request, baseUrl) {
|
|
113
|
+
if (!baseUrl) {
|
|
114
|
+
return NextResponse.json({ error: "Server configuration error" }, { status: 500 });
|
|
115
|
+
}
|
|
116
|
+
const authorization = request.headers.get("authorization");
|
|
117
|
+
if (authorization === null) {
|
|
118
|
+
return NextResponse.json({ error: "Authentication required" }, { status: 401 });
|
|
119
|
+
}
|
|
120
|
+
const origin = request.headers.get("origin");
|
|
121
|
+
const response = await fetch(`${baseUrl}/broker/logout`, {
|
|
122
|
+
method: "POST",
|
|
123
|
+
headers: {
|
|
124
|
+
"Content-Type": "application/json",
|
|
125
|
+
"Authorization": authorization,
|
|
126
|
+
...(origin !== null ? { "Origin": origin } : {}),
|
|
127
|
+
},
|
|
128
|
+
body: await request.text(),
|
|
129
|
+
});
|
|
130
|
+
const body = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
131
|
+
if (!response.ok) {
|
|
132
|
+
return NextResponse.json(body, { status: response.status });
|
|
133
|
+
}
|
|
134
|
+
const { warning: _warning, ...clientBody } = body;
|
|
135
|
+
return NextResponse.json(clientBody);
|
|
136
|
+
}
|
|
135
137
|
//# sourceMappingURL=broker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broker.js","sourceRoot":"","sources":["../../src/routes/broker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"broker.js","sourceRoot":"","sources":["../../src/routes/broker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAa3C,SAAS,uBAAuB,CAAC,OAAgB;IAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,UAAU,CAAC,MAAM,CAAC;IAC3B,CAAC;IACD,OAAO,GAAG,UAAU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,IAAI,EAAE,CAAC;QAC3B,OAAO,YAAY,CAAC,IAAI,CACtB,EAAE,KAAK,EAAE,yBAAyB,EAAE,EACpC,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,gBAAgB,EAAE;QACvD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,eAAe,EAAE,aAAa;YAC9B,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjD;QACD,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,EAAE;KAC3B,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC;IAE7E,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D,CAAC;IAID,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,IAG5C,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -21,12 +21,12 @@ export async function getDatasourceContext(request, options) {
|
|
|
21
21
|
const referencedDatasourceIds = new Set([id]);
|
|
22
22
|
const token = extractBearerToken(request);
|
|
23
23
|
const client = token ? createAuthenticatedClient(token) : null;
|
|
24
|
-
const
|
|
24
|
+
const ccrQueryFetchers = await createCssQueryFetchers({
|
|
25
25
|
client,
|
|
26
26
|
branchId,
|
|
27
27
|
filterIds: referencedDatasourceIds,
|
|
28
28
|
});
|
|
29
|
-
const allFetchers = [...(options.builtinFetchers ?? []), ...
|
|
29
|
+
const allFetchers = [...(options.builtinFetchers ?? []), ...ccrQueryFetchers];
|
|
30
30
|
const context = await loadRemoteDatasourceContext({
|
|
31
31
|
searchParams: Object.fromEntries(url.searchParams.entries()),
|
|
32
32
|
pagePath: path,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
import { normalizePath, listRoutes, listRouteTemplateKeysFromDatabase, getPageEditorPreviewParams, buildRemoteDatasourceRegistry, listRemoteDatasourcesForPage, cssQueriesToDatasourceDefinitions, getSharedSiteId, getSharedBranchId, createAuthenticatedClient, runWithAuthToken, } from "@pantheon-systems/puck-css/server";
|
|
3
3
|
import { extractBearerToken } from "../auth-utils";
|
|
4
|
-
async function
|
|
4
|
+
async function fetchCcrQueryDefinitions(request, branchOverride) {
|
|
5
5
|
const siteId = getSharedSiteId();
|
|
6
6
|
const branchId = branchOverride || getSharedBranchId();
|
|
7
7
|
const token = extractBearerToken(request);
|
|
@@ -18,7 +18,7 @@ async function fetchCssQueryDefinitions(request, branchOverride) {
|
|
|
18
18
|
}
|
|
19
19
|
catch (error) {
|
|
20
20
|
const message = error instanceof Error ? error.message : String(error);
|
|
21
|
-
console.warn("[P1] Editor context:
|
|
21
|
+
console.warn("[P1] Editor context: query lookup failed:", message);
|
|
22
22
|
return [];
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -30,9 +30,6 @@ export async function getEditorContext(request, options) {
|
|
|
30
30
|
if (path === null) {
|
|
31
31
|
return NextResponse.json({ error: "invalid_path" }, { status: 400 });
|
|
32
32
|
}
|
|
33
|
-
// Unlike getRoutes, a missing token degrades rather than 401s: the editor
|
|
34
|
-
// falls back to an unauthenticated fetch and treats any error response as
|
|
35
|
-
// fatal, so rejecting here would break auth-optional deployments.
|
|
36
33
|
const token = extractBearerToken(request);
|
|
37
34
|
const run = (fn) => token ? runWithAuthToken(token, fn) : fn();
|
|
38
35
|
return run(() => buildEditorContext(request, options, path, branchId));
|
|
@@ -44,12 +41,10 @@ async function buildEditorContext(request, options, path, branchId) {
|
|
|
44
41
|
Promise.resolve(getPageEditorPreviewParams(path)),
|
|
45
42
|
Promise.resolve(listRemoteDatasourcesForPage(path)),
|
|
46
43
|
]);
|
|
47
|
-
|
|
48
|
-
// that call, and getSharedBranchId() returns null until it completes.
|
|
49
|
-
const cssQueryDefinitions = await fetchCssQueryDefinitions(request, branchId);
|
|
44
|
+
const ccrQueryDefinitions = await fetchCcrQueryDefinitions(request, branchId);
|
|
50
45
|
const remoteDatasourceRegistry = [
|
|
51
46
|
...buildRemoteDatasourceRegistry(options.builtinDatasourceRegistry ?? [], userDefs.global, userDefs.page),
|
|
52
|
-
...
|
|
47
|
+
...ccrQueryDefinitions,
|
|
53
48
|
];
|
|
54
49
|
return NextResponse.json({
|
|
55
50
|
remoteDatasourceContext: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-context.js","sourceRoot":"","sources":["../../src/routes/editor-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACL,aAAa,EACb,UAAU,EACV,iCAAiC,EACjC,0BAA0B,EAC1B,6BAA6B,EAC7B,4BAA4B,EAC5B,iCAAiC,EACjC,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAOnD,KAAK,UAAU,wBAAwB,CAAC,OAAgB,EAAE,cAA8B;IACtF,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,cAAc,IAAI,iBAAiB,EAAE,CAAC;IACvD,MAAM,KAAK,GAAG,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|
import { isRouteTemplatePath, normalizePath, listOverridePathsForBase, persistPublishedPage, } from "@pantheon-systems/puck-css/server";
|
|
4
4
|
export { postPublish as POST };
|
|
5
|
-
/**
|
|
6
|
-
* Dynamic segment rendering public pages, as Next.js names it for
|
|
7
|
-
* revalidatePath. Overridable for an app whose catch-all directory is not
|
|
8
|
-
* `[...puckPath]`.
|
|
9
|
-
*/
|
|
10
5
|
export const DEFAULT_PUBLIC_PAGE_SEGMENT = "/[...puckPath]";
|
|
11
6
|
export async function postPublish(request, { publicPageSegment = DEFAULT_PUBLIC_PAGE_SEGMENT } = {}) {
|
|
12
7
|
const payload = (await request.json());
|
|
@@ -20,11 +15,6 @@ export async function postPublish(request, { publicPageSegment = DEFAULT_PUBLIC_
|
|
|
20
15
|
for (const p of await listOverridePathsForBase(path)) {
|
|
21
16
|
revalidatePath(p);
|
|
22
17
|
}
|
|
23
|
-
// Instance URLs that resolve by template fall-through alone (/jedi/5 against
|
|
24
|
-
// /jedi/:id) have no store entry, so listOverridePathsForBase cannot
|
|
25
|
-
// enumerate them. Invalidating the catch-all segment is the only way to
|
|
26
|
-
// reach them; without it they serve pre-edit content until revalidate
|
|
27
|
-
// expires.
|
|
28
18
|
revalidatePath(publicPageSegment, "page");
|
|
29
19
|
}
|
|
30
20
|
return NextResponse.json({ status: "ok" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/routes/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,WAAW,IAAI,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/routes/publish.ts"],"names":[],"mappings":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@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantheon-systems/p1-next-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Next.js SDK for P1 editor integration",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"server-only": "^0.0.1",
|
|
38
|
-
"@pantheon-systems/css-client": "0.
|
|
39
|
-
"@pantheon-systems/puck-css": "0.
|
|
38
|
+
"@pantheon-systems/css-client": "0.13.0",
|
|
39
|
+
"@pantheon-systems/puck-css": "0.13.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@puckeditor/core": ">=0.21.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"homepage": "https://github.com/pantheon-systems/p1-platform/tree/main/packages/p1-next-sdk",
|
|
58
58
|
"scripts": {
|
|
59
|
-
"build": "pnpm run clean && tsc",
|
|
59
|
+
"build": "pnpm run clean && tsc --emitDeclarationOnly && tsc --declaration false --declarationMap false --removeComments",
|
|
60
60
|
"clean": "rm -rf dist *.tsbuildinfo",
|
|
61
61
|
"lint": "eslint src",
|
|
62
62
|
"lint:fix": "eslint src --fix",
|