@cmssy/next 9.10.0 → 10.1.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 CHANGED
@@ -61,18 +61,19 @@ Helpers to frame the page inside the cmssy editor only in edit mode.
61
61
 
62
62
  The active locale lives in the URL path prefix (`/en/about`; the default locale
63
63
  stays bare). `createCmssyPage` resolves it and exposes it via `CmssyLocaleProvider`.
64
- For the locale to survive navigation, internal links must carry the prefix - use
65
- `CmssyLink` instead of `next/link` / `<a>`:
64
+ For the locale to survive navigation, internal links must carry the prefix -
65
+ prefix hrefs yourself with `localizeHref` and pass the result to `next/link`:
66
66
 
67
67
  ```tsx
68
68
  // any block component
69
- import { CmssyLink } from "@cmssy/next/client";
69
+ import Link from "next/link";
70
+ import { localizeHref } from "@cmssy/next";
70
71
 
71
- <CmssyLink href="/about">About</CmssyLink>; // → /en/about while EN is active
72
+ <Link href={localizeHref("/about", locale)}>About</Link>; // → /en/about while EN is active
72
73
  ```
73
74
 
74
75
  Add middleware so the root layout (which can't read the path) resolves the right
75
- locale via `getCmssyLocale`. On Next.js 16 the file is `proxy.ts` (the renamed
76
+ locale from the path prefix. On Next.js 16 the file is `proxy.ts` (the renamed
76
77
  middleware convention); on Next.js 15 use `middleware.ts` with the same body.
77
78
 
78
79
  ```ts
@@ -87,16 +88,14 @@ export const config = { matcher: ["/((?!_next/|api/|.*\\..*).*)"] };
87
88
  On Next.js 15, name the file `middleware.ts` and rename the export to
88
89
  `middleware` (`export const middleware = createCmssyLocaleMiddleware(cmssy)`).
89
90
 
90
- Language switcher and raw markup helpers live in `@cmssy/react`:
91
- `buildLocaleSwitchHref(target, pathname, locale)`, `localizeHref(href, locale)`,
92
- `localizeHtmlLinks(html, locale)`.
91
+ `localizeHref(href, locale)` and the `CMSSY_LOCALE_HEADER` constant are
92
+ re-exported from `@cmssy/next` (and `@cmssy/core`).
93
93
 
94
94
  ## Exports
95
95
 
96
96
  `createCmssyPage`, `createDraftRoute`, `cmssyCspHeaders` / `applyCmssyCsp`,
97
97
  `isCmssyEditRequest` / `isCmssyEditMode`, `createCmssyLocaleMiddleware` /
98
- `resolveLocaleFromPathname`, the `CmssyConfig` type, and from
99
- `@cmssy/next/client`: `CmssyLink`, `CmssyLocaleProvider`, `useCmssyLocale`.
98
+ `resolveLocaleFromPathname`, and the `CmssyConfig` type.
100
99
 
101
100
  ## License
102
101
 
package/dist/index.cjs CHANGED
@@ -20,22 +20,18 @@ Object.defineProperty(exports, "CMSSY_SECRET_QUERY_PARAM", {
20
20
  enumerable: true,
21
21
  get: function () { return core.CMSSY_SECRET_QUERY_PARAM; }
22
22
  });
23
- Object.defineProperty(exports, "CMSSY_SESSION_COOKIE", {
24
- enumerable: true,
25
- get: function () { return core.CMSSY_SESSION_COOKIE; }
26
- });
27
23
  Object.defineProperty(exports, "DEFAULT_CMSSY_EDITOR_ORIGINS", {
28
24
  enumerable: true,
29
25
  get: function () { return core.DEFAULT_CMSSY_EDITOR_ORIGINS; }
30
26
  });
31
- Object.defineProperty(exports, "assertAuthConfig", {
32
- enumerable: true,
33
- get: function () { return core.assertAuthConfig; }
34
- });
35
27
  Object.defineProperty(exports, "defineCmssyConfig", {
36
28
  enumerable: true,
37
29
  get: function () { return core.defineCmssyConfig; }
38
30
  });
31
+ Object.defineProperty(exports, "localizeHref", {
32
+ enumerable: true,
33
+ get: function () { return core.localizeHref; }
34
+ });
39
35
  Object.defineProperty(exports, "resolveEditorOrigin", {
40
36
  enumerable: true,
41
37
  get: function () { return core.resolveEditorOrigin; }
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CMSSY_SESSION_COOKIE, CmssyAuthConfig, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, DEFAULT_CMSSY_EDITOR_ORIGINS, assertAuthConfig, defineCmssyConfig, resolveEditorOrigin } from '@cmssy/core';
1
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, DEFAULT_CMSSY_EDITOR_ORIGINS, defineCmssyConfig, localizeHref, resolveEditorOrigin } from '@cmssy/core';
2
2
  export { C as CmssyEditorProps, a as CreateCmssyPageOptions } from './index-C4vUxDkk.cjs';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CMSSY_SESSION_COOKIE, CmssyAuthConfig, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, DEFAULT_CMSSY_EDITOR_ORIGINS, assertAuthConfig, defineCmssyConfig, resolveEditorOrigin } from '@cmssy/core';
1
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, DEFAULT_CMSSY_EDITOR_ORIGINS, defineCmssyConfig, localizeHref, resolveEditorOrigin } from '@cmssy/core';
2
2
  export { C as CmssyEditorProps, a as CreateCmssyPageOptions } from './index-C4vUxDkk.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CMSSY_SESSION_COOKIE, DEFAULT_CMSSY_EDITOR_ORIGINS, assertAuthConfig, defineCmssyConfig, resolveEditorOrigin } from '@cmssy/core';
1
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, DEFAULT_CMSSY_EDITOR_ORIGINS, defineCmssyConfig, localizeHref, resolveEditorOrigin } from '@cmssy/core';
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var server = require('next/server');
4
- var react = require('@cmssy/react');
4
+ var locale = require('@cmssy/core/internal/locale');
5
5
  var core = require('@cmssy/core');
6
+ var internal = require('@cmssy/core/internal');
6
7
 
7
8
  // src/preset/proxy.ts
8
9
  var CMSSY_EDIT_PATH_PREFIX = "/cmssy-edit";
@@ -12,7 +13,7 @@ async function cmssyEditRewrite(request, config, options = {}) {
12
13
  if (!searchParams.getAll(core.CMSSY_EDIT_QUERY_PARAM).includes("1")) return null;
13
14
  const provided = searchParams.get(core.CMSSY_SECRET_QUERY_PARAM);
14
15
  if (!provided || !config.draftSecret) return null;
15
- if (!await core.cmssySecretsMatch(provided, config.draftSecret)) return null;
16
+ if (!await internal.cmssySecretsMatch(provided, config.draftSecret)) return null;
16
17
  const url = request.nextUrl.clone();
17
18
  url.pathname = `${CMSSY_EDIT_PATH_PREFIX}${pathname === "/" ? "" : pathname}`;
18
19
  warnIfEditRouteMissing(url);
@@ -49,9 +50,9 @@ function createCmssyProxy(config, options = {}) {
49
50
  const { pathname } = request.nextUrl;
50
51
  const requestHeaders = new Headers(request.headers);
51
52
  requestHeaders.delete(core.CMSSY_EDIT_HEADER);
52
- requestHeaders.delete(core.CMSSY_LOCALE_HEADER);
53
- const locale = await core.localeForPathname(config, pathname);
54
- requestHeaders.set(core.CMSSY_LOCALE_HEADER, locale);
53
+ requestHeaders.delete(locale.CMSSY_LOCALE_HEADER);
54
+ const locale$1 = await locale.localeForPathname(config, pathname);
55
+ requestHeaders.set(locale.CMSSY_LOCALE_HEADER, locale$1);
55
56
  const editHeaders = new Headers(requestHeaders);
56
57
  editHeaders.set(core.CMSSY_EDIT_HEADER, "1");
57
58
  const editRewrite = await cmssyEditRewrite(request, config, {
@@ -61,11 +62,11 @@ function createCmssyProxy(config, options = {}) {
61
62
  core.applyCmssyCsp(editRewrite, { editorOrigin: config.editorOrigin });
62
63
  return editRewrite;
63
64
  }
64
- if (options.stripLocalePrefix && pathname.startsWith(`/${locale}`)) {
65
- const { defaultLocale } = await react.resolveSiteLocales(config);
66
- if (locale !== defaultLocale) {
65
+ if (options.stripLocalePrefix && pathname.startsWith(`/${locale$1}`)) {
66
+ const { defaultLocale } = await locale.resolveSiteLocales(config);
67
+ if (locale$1 !== defaultLocale) {
67
68
  const url = request.nextUrl.clone();
68
- url.pathname = pathname.slice(locale.length + 1) || "/";
69
+ url.pathname = pathname.slice(locale$1.length + 1) || "/";
69
70
  return server.NextResponse.rewrite(url, {
70
71
  request: { headers: requestHeaders }
71
72
  });
@@ -75,75 +76,6 @@ function createCmssyProxy(config, options = {}) {
75
76
  };
76
77
  }
77
78
  var cmssyProxyMatcher = ["/((?!_next/|api/|.*\\..*).*)"];
78
- async function resolveLocaleFromPathname(config, pathname) {
79
- const segments = pathname.split("/").filter(Boolean);
80
- const siteLocales = await react.resolveSiteLocales({
81
- apiUrl: config.apiUrl,
82
- org: config.org,
83
- workspaceSlug: config.workspaceSlug
84
- });
85
- return react.splitLocaleFromPath(segments, siteLocales).locale;
86
- }
87
- function createCmssyLocaleMiddleware(config) {
88
- return async function cmssyLocaleMiddleware(request) {
89
- const locale = await resolveLocaleFromPathname(
90
- config,
91
- request.nextUrl.pathname
92
- );
93
- const headers = new Headers(request.headers);
94
- headers.set(core.CMSSY_LOCALE_HEADER, locale);
95
- return server.NextResponse.next({ request: { headers } });
96
- };
97
- }
98
- function isPrefetch(request) {
99
- return request.headers.get("next-router-prefetch") !== null || request.headers.get("purpose") === "prefetch" || (request.headers.get("sec-purpose") ?? "").includes("prefetch");
100
- }
101
- function createCmssyAuthMiddleware(config) {
102
- const auth = core.assertAuthConfig(config);
103
- return async function cmssyAuthMiddleware(request) {
104
- const raw = request.cookies.get(core.CMSSY_SESSION_COOKIE)?.value;
105
- if (!raw) return server.NextResponse.next();
106
- const session = await core.openSession(
107
- raw,
108
- auth.sessionSecret,
109
- config.workspaceSlug
110
- );
111
- if (!session) {
112
- const response = server.NextResponse.next();
113
- response.cookies.set(core.CMSSY_SESSION_COOKIE, "", {
114
- ...core.sessionCookieOptions(),
115
- maxAge: 0
116
- });
117
- return response;
118
- }
119
- if (!core.isAccessExpired(session)) return server.NextResponse.next();
120
- if (isPrefetch(request)) return server.NextResponse.next();
121
- let payload = null;
122
- try {
123
- const result = await core.backendRefresh(config, session.refreshToken);
124
- payload = core.toSessionPayload(result);
125
- } catch {
126
- return server.NextResponse.next();
127
- }
128
- if (!payload) {
129
- const cleared = server.NextResponse.next();
130
- cleared.cookies.set(core.CMSSY_SESSION_COOKIE, "", {
131
- ...core.sessionCookieOptions(),
132
- maxAge: 0
133
- });
134
- return cleared;
135
- }
136
- const sealed = await core.sealSession(
137
- payload,
138
- auth.sessionSecret,
139
- config.workspaceSlug
140
- );
141
- request.cookies.set(core.CMSSY_SESSION_COOKIE, sealed);
142
- const refreshed = server.NextResponse.next({ request });
143
- refreshed.cookies.set(core.CMSSY_SESSION_COOKIE, sealed, core.sessionCookieOptions());
144
- return refreshed;
145
- };
146
- }
147
79
  async function isCmssyEditRequest(request, config) {
148
80
  if (request.cookies.has("__prerender_bypass")) return true;
149
81
  return core.isVerifiedEditUrl(request.nextUrl, config);
@@ -153,28 +85,13 @@ Object.defineProperty(exports, "CMSSY_EDIT_HEADER", {
153
85
  enumerable: true,
154
86
  get: function () { return core.CMSSY_EDIT_HEADER; }
155
87
  });
156
- Object.defineProperty(exports, "CMSSY_LOCALE_HEADER", {
157
- enumerable: true,
158
- get: function () { return core.CMSSY_LOCALE_HEADER; }
159
- });
160
88
  Object.defineProperty(exports, "applyCmssyCsp", {
161
89
  enumerable: true,
162
90
  get: function () { return core.applyCmssyCsp; }
163
91
  });
164
- Object.defineProperty(exports, "cmssyCspHeaders", {
165
- enumerable: true,
166
- get: function () { return core.cmssyCspHeaders; }
167
- });
168
- Object.defineProperty(exports, "localeForPathname", {
169
- enumerable: true,
170
- get: function () { return core.localeForPathname; }
171
- });
172
92
  exports.CMSSY_EDIT_PATH_PREFIX = CMSSY_EDIT_PATH_PREFIX;
173
93
  exports.cmssyEditRewrite = cmssyEditRewrite;
174
94
  exports.cmssyProxyMatcher = cmssyProxyMatcher;
175
- exports.createCmssyAuthMiddleware = createCmssyAuthMiddleware;
176
95
  exports.createCmssyEditMiddleware = createCmssyEditMiddleware;
177
- exports.createCmssyLocaleMiddleware = createCmssyLocaleMiddleware;
178
96
  exports.createCmssyProxy = createCmssyProxy;
179
97
  exports.isCmssyEditRequest = isCmssyEditRequest;
180
- exports.resolveLocaleFromPathname = resolveLocaleFromPathname;
@@ -1,6 +1,6 @@
1
1
  import { NextRequest, NextResponse } from 'next/server';
2
2
  import { CmssyConfig } from '@cmssy/core';
3
- export { CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CmssyCspOptions, applyCmssyCsp, cmssyCspHeaders, localeForPathname } from '@cmssy/core';
3
+ export { CMSSY_EDIT_HEADER, CmssyCspOptions, applyCmssyCsp } from '@cmssy/core';
4
4
 
5
5
  interface CmssyProxyOptions {
6
6
  /**
@@ -72,21 +72,6 @@ declare function createCmssyEditMiddleware(config: {
72
72
  draftSecret: string;
73
73
  }): (request: NextRequest) => Promise<NextResponse>;
74
74
 
75
- /**
76
- * Resolves the active locale from a pathname's leading segment, against the
77
- * workspace locales (fetched, cached 60s).
78
- */
79
- declare function resolveLocaleFromPathname(config: CmssyConfig, pathname: string): Promise<string>;
80
- /**
81
- * Middleware that derives the locale from the URL path prefix and forwards it as
82
- * the `x-cmssy-locale` request header, so server components that can't read the
83
- * path (root layout) resolve the right locale via `getCmssyLocale`.
84
- */
85
- declare function createCmssyLocaleMiddleware(config: CmssyConfig): (request: NextRequest) => Promise<NextResponse>;
86
-
87
- type CmssyAuthMiddleware = (request: NextRequest) => Promise<NextResponse>;
88
- declare function createCmssyAuthMiddleware(config: CmssyConfig): CmssyAuthMiddleware;
89
-
90
75
  interface EditRequestLike {
91
76
  cookies: {
92
77
  has: (name: string) => boolean;
@@ -102,4 +87,4 @@ declare function isCmssyEditRequest(request: EditRequestLike, config: {
102
87
  draftSecret: string;
103
88
  }): Promise<boolean>;
104
89
 
105
- export { CMSSY_EDIT_PATH_PREFIX, type CmssyAuthMiddleware, type CmssyProxyOptions, cmssyEditRewrite, cmssyProxyMatcher, createCmssyAuthMiddleware, createCmssyEditMiddleware, createCmssyLocaleMiddleware, createCmssyProxy, isCmssyEditRequest, resolveLocaleFromPathname };
90
+ export { CMSSY_EDIT_PATH_PREFIX, type CmssyProxyOptions, cmssyEditRewrite, cmssyProxyMatcher, createCmssyEditMiddleware, createCmssyProxy, isCmssyEditRequest };
@@ -1,6 +1,6 @@
1
1
  import { NextRequest, NextResponse } from 'next/server';
2
2
  import { CmssyConfig } from '@cmssy/core';
3
- export { CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, CmssyCspOptions, applyCmssyCsp, cmssyCspHeaders, localeForPathname } from '@cmssy/core';
3
+ export { CMSSY_EDIT_HEADER, CmssyCspOptions, applyCmssyCsp } from '@cmssy/core';
4
4
 
5
5
  interface CmssyProxyOptions {
6
6
  /**
@@ -72,21 +72,6 @@ declare function createCmssyEditMiddleware(config: {
72
72
  draftSecret: string;
73
73
  }): (request: NextRequest) => Promise<NextResponse>;
74
74
 
75
- /**
76
- * Resolves the active locale from a pathname's leading segment, against the
77
- * workspace locales (fetched, cached 60s).
78
- */
79
- declare function resolveLocaleFromPathname(config: CmssyConfig, pathname: string): Promise<string>;
80
- /**
81
- * Middleware that derives the locale from the URL path prefix and forwards it as
82
- * the `x-cmssy-locale` request header, so server components that can't read the
83
- * path (root layout) resolve the right locale via `getCmssyLocale`.
84
- */
85
- declare function createCmssyLocaleMiddleware(config: CmssyConfig): (request: NextRequest) => Promise<NextResponse>;
86
-
87
- type CmssyAuthMiddleware = (request: NextRequest) => Promise<NextResponse>;
88
- declare function createCmssyAuthMiddleware(config: CmssyConfig): CmssyAuthMiddleware;
89
-
90
75
  interface EditRequestLike {
91
76
  cookies: {
92
77
  has: (name: string) => boolean;
@@ -102,4 +87,4 @@ declare function isCmssyEditRequest(request: EditRequestLike, config: {
102
87
  draftSecret: string;
103
88
  }): Promise<boolean>;
104
89
 
105
- export { CMSSY_EDIT_PATH_PREFIX, type CmssyAuthMiddleware, type CmssyProxyOptions, cmssyEditRewrite, cmssyProxyMatcher, createCmssyAuthMiddleware, createCmssyEditMiddleware, createCmssyLocaleMiddleware, createCmssyProxy, isCmssyEditRequest, resolveLocaleFromPathname };
90
+ export { CMSSY_EDIT_PATH_PREFIX, type CmssyProxyOptions, cmssyEditRewrite, cmssyProxyMatcher, createCmssyEditMiddleware, createCmssyProxy, isCmssyEditRequest };
@@ -1,7 +1,8 @@
1
1
  import { NextResponse } from 'next/server';
2
- import { resolveSiteLocales, splitLocaleFromPath } from '@cmssy/react';
3
- import { CMSSY_EDIT_QUERY_PARAM, CMSSY_SECRET_QUERY_PARAM, cmssySecretsMatch, CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, localeForPathname, applyCmssyCsp, assertAuthConfig, CMSSY_SESSION_COOKIE, openSession, sessionCookieOptions, isAccessExpired, backendRefresh, toSessionPayload, sealSession, isVerifiedEditUrl } from '@cmssy/core';
4
- export { CMSSY_EDIT_HEADER, CMSSY_LOCALE_HEADER, applyCmssyCsp, cmssyCspHeaders, localeForPathname } from '@cmssy/core';
2
+ import { CMSSY_LOCALE_HEADER, localeForPathname, resolveSiteLocales } from '@cmssy/core/internal/locale';
3
+ import { CMSSY_EDIT_QUERY_PARAM, CMSSY_SECRET_QUERY_PARAM, CMSSY_EDIT_HEADER, applyCmssyCsp, isVerifiedEditUrl } from '@cmssy/core';
4
+ export { CMSSY_EDIT_HEADER, applyCmssyCsp } from '@cmssy/core';
5
+ import { cmssySecretsMatch } from '@cmssy/core/internal';
5
6
 
6
7
  // src/preset/proxy.ts
7
8
  var CMSSY_EDIT_PATH_PREFIX = "/cmssy-edit";
@@ -74,78 +75,9 @@ function createCmssyProxy(config, options = {}) {
74
75
  };
75
76
  }
76
77
  var cmssyProxyMatcher = ["/((?!_next/|api/|.*\\..*).*)"];
77
- async function resolveLocaleFromPathname(config, pathname) {
78
- const segments = pathname.split("/").filter(Boolean);
79
- const siteLocales = await resolveSiteLocales({
80
- apiUrl: config.apiUrl,
81
- org: config.org,
82
- workspaceSlug: config.workspaceSlug
83
- });
84
- return splitLocaleFromPath(segments, siteLocales).locale;
85
- }
86
- function createCmssyLocaleMiddleware(config) {
87
- return async function cmssyLocaleMiddleware(request) {
88
- const locale = await resolveLocaleFromPathname(
89
- config,
90
- request.nextUrl.pathname
91
- );
92
- const headers = new Headers(request.headers);
93
- headers.set(CMSSY_LOCALE_HEADER, locale);
94
- return NextResponse.next({ request: { headers } });
95
- };
96
- }
97
- function isPrefetch(request) {
98
- return request.headers.get("next-router-prefetch") !== null || request.headers.get("purpose") === "prefetch" || (request.headers.get("sec-purpose") ?? "").includes("prefetch");
99
- }
100
- function createCmssyAuthMiddleware(config) {
101
- const auth = assertAuthConfig(config);
102
- return async function cmssyAuthMiddleware(request) {
103
- const raw = request.cookies.get(CMSSY_SESSION_COOKIE)?.value;
104
- if (!raw) return NextResponse.next();
105
- const session = await openSession(
106
- raw,
107
- auth.sessionSecret,
108
- config.workspaceSlug
109
- );
110
- if (!session) {
111
- const response = NextResponse.next();
112
- response.cookies.set(CMSSY_SESSION_COOKIE, "", {
113
- ...sessionCookieOptions(),
114
- maxAge: 0
115
- });
116
- return response;
117
- }
118
- if (!isAccessExpired(session)) return NextResponse.next();
119
- if (isPrefetch(request)) return NextResponse.next();
120
- let payload = null;
121
- try {
122
- const result = await backendRefresh(config, session.refreshToken);
123
- payload = toSessionPayload(result);
124
- } catch {
125
- return NextResponse.next();
126
- }
127
- if (!payload) {
128
- const cleared = NextResponse.next();
129
- cleared.cookies.set(CMSSY_SESSION_COOKIE, "", {
130
- ...sessionCookieOptions(),
131
- maxAge: 0
132
- });
133
- return cleared;
134
- }
135
- const sealed = await sealSession(
136
- payload,
137
- auth.sessionSecret,
138
- config.workspaceSlug
139
- );
140
- request.cookies.set(CMSSY_SESSION_COOKIE, sealed);
141
- const refreshed = NextResponse.next({ request });
142
- refreshed.cookies.set(CMSSY_SESSION_COOKIE, sealed, sessionCookieOptions());
143
- return refreshed;
144
- };
145
- }
146
78
  async function isCmssyEditRequest(request, config) {
147
79
  if (request.cookies.has("__prerender_bypass")) return true;
148
80
  return isVerifiedEditUrl(request.nextUrl, config);
149
81
  }
150
82
 
151
- export { CMSSY_EDIT_PATH_PREFIX, cmssyEditRewrite, cmssyProxyMatcher, createCmssyAuthMiddleware, createCmssyEditMiddleware, createCmssyLocaleMiddleware, createCmssyProxy, isCmssyEditRequest, resolveLocaleFromPathname };
83
+ export { CMSSY_EDIT_PATH_PREFIX, cmssyEditRewrite, cmssyProxyMatcher, createCmssyEditMiddleware, createCmssyProxy, isCmssyEditRequest };