@anthusai/papyrus 1.0.0-next.30 → 1.0.0-next.31

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.
@@ -152,6 +152,7 @@ async function withReaderGraphQLContext<T>(operation: () => Promise<T>): Promise
152
152
  // Drafts are read as the signed-in visitor: the client reads the session from the request cookies, and it is
153
153
  // kept in the request's async context (never a module global) so one visitor's session cannot serve another.
154
154
  const { cookies } = await import("next/headers");
155
+ await cookies();
155
156
  const client = generateServerClientUsingCookies<Schema>({ config, cookies, authMode: "userPool" });
156
157
  return runWithContentSource(source, operation, client);
157
158
  }
@@ -1,7 +1,12 @@
1
1
  import { graphqlContentRepository } from "./graphql-content-repository";
2
2
  import { SITE_BRAND } from "./site-brand";
3
+ import { getContentSource } from "./site-env";
3
4
  import type { RendererConfig } from "./renderer-config";
4
5
 
6
+ export function siteEnumeratesReaderRoutesAtBuild(): boolean {
7
+ return siteServesNextReaderRoutes() && getContentSource() !== "drafts";
8
+ }
9
+
5
10
  export function siteServesNextReaderRoutes(rendererKind: RendererConfig["kind"] = SITE_BRAND.renderer.kind): boolean {
6
11
  return rendererKind !== "markus";
7
12
  }
@@ -29,7 +34,7 @@ type EditionDateStaticParam = {
29
34
 
30
35
  export async function generateEditionDateStaticParams(): Promise<EditionDateStaticParam[]> {
31
36
  if (process.env.NODE_ENV === "development") return [];
32
- if (!siteServesNextReaderRoutes()) return [];
37
+ if (!siteEnumeratesReaderRoutesAtBuild()) return [];
33
38
 
34
39
  const { editions } = await graphqlContentRepository.listPublishedEditions({ limit: 100 });
35
40
  const params: EditionDateStaticParam[] = [];
@@ -42,7 +47,7 @@ export async function generateEditionDateStaticParams(): Promise<EditionDateStat
42
47
 
43
48
  export async function generateArticleStaticParams(): Promise<Array<{ slug: string }>> {
44
49
  if (process.env.NODE_ENV === "development") return [];
45
- if (!siteServesNextReaderRoutes()) return [];
50
+ if (!siteEnumeratesReaderRoutesAtBuild()) return [];
46
51
 
47
52
  const slugs = await graphqlContentRepository.listArticleSlugs();
48
53
  return slugs.map((slug) => ({ slug }));
package/package.json CHANGED
@@ -295,7 +295,7 @@
295
295
  "optional": true
296
296
  }
297
297
  },
298
- "version": "1.0.0-next.30",
298
+ "version": "1.0.0-next.31",
299
299
  "dependencies": {
300
300
  "@aws-amplify/adapter-nextjs": "^1.7.3",
301
301
  "@aws-sdk/client-cognito-identity-provider": "3.1045.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0-next.30",
2
+ "version": "1.0.0-next.31",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",