@pantheon-systems/p1-next-sdk 0.18.2 → 0.19.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/dist/middleware.d.ts +4 -0
- package/dist/middleware.js +5 -0
- package/package.json +4 -4
package/dist/middleware.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export interface P1MiddlewareConfig {
|
|
|
8
8
|
*/
|
|
9
9
|
cssBaseUrl?: string;
|
|
10
10
|
apiToken: string;
|
|
11
|
+
/**
|
|
12
|
+
* Site to look up redirects for. When blank, the middleware passes
|
|
13
|
+
* every request through without contacting the API.
|
|
14
|
+
*/
|
|
11
15
|
siteId: string;
|
|
12
16
|
}
|
|
13
17
|
export declare function createP1Middleware(config: P1MiddlewareConfig): (request: Request) => Promise<NextResponse<unknown>>;
|
package/dist/middleware.js
CHANGED
|
@@ -2,6 +2,11 @@ import { P1ContentClient } from "@pantheon-systems/css-client/content";
|
|
|
2
2
|
import { NextResponse } from "next/server";
|
|
3
3
|
const SKIP_PREFIXES = ["/p1/", "/_next/", "/api/"];
|
|
4
4
|
export function createP1Middleware(config) {
|
|
5
|
+
if (typeof config.siteId !== "string" || config.siteId.trim() === "") {
|
|
6
|
+
return async function p1PassThroughMiddleware() {
|
|
7
|
+
return NextResponse.next();
|
|
8
|
+
};
|
|
9
|
+
}
|
|
5
10
|
const client = new P1ContentClient({
|
|
6
11
|
baseUrl: config.cssBaseUrl,
|
|
7
12
|
apiToken: config.apiToken,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantheon-systems/p1-next-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Next.js SDK for P1 editor integration",
|
|
6
6
|
"publishConfig": {
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"launchdarkly-js-client-sdk": "^3.9.3",
|
|
46
46
|
"server-only": "^0.0.1",
|
|
47
|
-
"@pantheon-systems/css-client": "0.
|
|
48
|
-
"@pantheon-systems/p1-ai-chat": "0.9.
|
|
49
|
-
"@pantheon-systems/puck-css": "0.
|
|
47
|
+
"@pantheon-systems/css-client": "0.19.0",
|
|
48
|
+
"@pantheon-systems/p1-ai-chat": "0.9.2",
|
|
49
|
+
"@pantheon-systems/puck-css": "0.19.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@pantheon-systems/pds-toolkit-react": ">=2.0.0-alpha.92",
|