@anthusai/papyrus 1.2.0-next.2 → 1.2.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.
@@ -39,8 +39,7 @@ import type {
39
39
  UserDirectoryEntry,
40
40
  } from "../lib/category-repository";
41
41
  import { relationTypeKey } from "../lib/semantic-graph";
42
- import { contentItemStageKeys, type ContentItemVersionRecord } from "../lib/content-item-lifecycle";
43
- import { getContentItemStageDefinitions } from "../lib/site-brand";
42
+ import { CONTENT_ITEM_STAGES, type ContentItemVersionRecord } from "../lib/content-item-lifecycle";
44
43
  import { DOCTRINE_DEFINITIONS, getCategoryDoctrineDefinitions, type DoctrineCategory } from "../lib/doctrine";
45
44
  import { configureAmplifyClient } from "./amplify-client-provider";
46
45
  import { isUnauthenticatedError, loadReaderSessionSnapshot, type ReaderAuthSnapshot } from "./reader-auth-state";
@@ -2174,7 +2173,7 @@ export async function loadNewsroomContentItemVersions(): Promise<ContentItemVers
2174
2173
  graphql: (options: Record<string, unknown>) => Promise<GraphQLConnectionResponse<ContentItemVersionRecord>>;
2175
2174
  };
2176
2175
  const field = "listItemsByStageAndUpdatedAt";
2177
- const versionsPerStage = await Promise.all(contentItemStageKeys(getContentItemStageDefinitions()).map(async (stage) => {
2176
+ const versionsPerStage = await Promise.all(CONTENT_ITEM_STAGES.map(async (stage) => {
2178
2177
  const versions: ContentItemVersionRecord[] = [];
2179
2178
  let nextToken: string | null = null;
2180
2179
  do {
@@ -1,35 +1,36 @@
1
1
  /**
2
2
  * One content item, one lifecycle: the stages an Item lineage moves through.
3
- * The default stages mirror CONTENT_ITEM_STAGES in src/papyrus_content/content_item_lifecycle.py;
4
- * a publication overrides them with SiteBrand.contentItemStages.
3
+ * Mirrors CONTENT_ITEM_STAGES in src/papyrus_content/content_item_lifecycle.py.
5
4
  * See docs/content-item-lifecycle.md.
6
5
  */
7
- export type ContentItemStageDefinition = {
8
- key: string;
9
- label: string;
10
- };
6
+ export const CONTENT_ITEM_STAGES = [
7
+ "idea",
8
+ "assignment",
9
+ "research",
10
+ "report",
11
+ "editor_select",
12
+ "copywriting",
13
+ "illustration",
14
+ "typesetting",
15
+ "published",
16
+ ] as const;
11
17
 
12
- export const DEFAULT_CONTENT_ITEM_STAGE_DEFINITIONS: readonly ContentItemStageDefinition[] = [
13
- { key: "idea", label: "Idea" },
14
- { key: "assignment", label: "Assignment" },
15
- { key: "research", label: "Research" },
16
- { key: "report", label: "Report" },
17
- { key: "editor_select", label: "Editor select" },
18
- { key: "copywriting", label: "Copywriting" },
19
- { key: "illustration", label: "Illustration" },
20
- { key: "typesetting", label: "Typesetting" },
21
- { key: "published", label: "Published" },
22
- ];
18
+ export type ContentItemStage = (typeof CONTENT_ITEM_STAGES)[number];
23
19
 
24
- export function contentItemStageKeys(stageDefinitions: readonly ContentItemStageDefinition[]): string[] {
25
- return stageDefinitions.map(definition => definition.key);
26
- }
20
+ const CONTENT_ITEM_STAGE_LABELS: Record<ContentItemStage, string> = {
21
+ idea: "Idea",
22
+ assignment: "Assignment",
23
+ research: "Research",
24
+ report: "Report",
25
+ editor_select: "Editor select",
26
+ copywriting: "Copywriting",
27
+ illustration: "Illustration",
28
+ typesetting: "Typesetting",
29
+ published: "Published",
30
+ };
27
31
 
28
- export function contentItemStageLabel(
29
- stage: string,
30
- stageDefinitions: readonly ContentItemStageDefinition[] = DEFAULT_CONTENT_ITEM_STAGE_DEFINITIONS,
31
- ): string {
32
- return stageDefinitions.find(definition => definition.key === stage)?.label ?? stage;
32
+ export function contentItemStageLabel(stage: string): string {
33
+ return (CONTENT_ITEM_STAGE_LABELS as Record<string, string>)[stage] ?? stage;
33
34
  }
34
35
 
35
36
  export type ContentItemVersionRecord = {
@@ -1,12 +1,12 @@
1
1
  import type { KanbanConfig, KanbanIssue } from "@kanbus/ui";
2
2
  import type { AssignmentRecord, ReferenceRecord } from "./category-repository";
3
3
  import {
4
- contentItemStageKeys,
4
+ CONTENT_ITEM_STAGES,
5
5
  contentItemStageLabel,
6
6
  latestVersionPerContentItem,
7
7
  type ContentItemVersionRecord,
8
8
  } from "./content-item-lifecycle";
9
- import { getContentItemName, getContentItemStageDefinitions } from "./site-brand";
9
+ import { getContentItemName } from "./site-brand";
10
10
 
11
11
  export type NativeBoardKind = "contentItem" | "reference" | "assignment";
12
12
  export interface NativeBoardIssue extends KanbanIssue {
@@ -71,13 +71,10 @@ export function projectNewsroomBoard(records: {
71
71
  ];
72
72
  }
73
73
 
74
- export function contentItemColumnOrder(
75
- stagesPresentOnBoard: readonly string[],
76
- stageKeys: readonly string[] = contentItemStageKeys(getContentItemStageDefinitions()),
77
- ): string[] {
78
- const lastStage = stageKeys[stageKeys.length - 1];
79
- const unrecognizedStages = [...new Set(stagesPresentOnBoard)].filter(stage => !stageKeys.includes(stage));
80
- return [...stageKeys.filter(stage => stage !== lastStage), ...unrecognizedStages, lastStage];
74
+ export function contentItemColumnOrder(stagesPresentOnBoard: readonly string[]): string[] {
75
+ const lastStage = CONTENT_ITEM_STAGES[CONTENT_ITEM_STAGES.length - 1];
76
+ const unrecognizedStages = [...new Set(stagesPresentOnBoard)].filter(stage => !(CONTENT_ITEM_STAGES as readonly string[]).includes(stage));
77
+ return [...CONTENT_ITEM_STAGES.filter(stage => stage !== lastStage), ...unrecognizedStages, lastStage];
81
78
  }
82
79
 
83
80
  /** Content items read left to right through the lifecycle with the final stage last; other record kinds follow it. */
@@ -85,7 +82,7 @@ export function newsroomBoardConfig(issues: readonly NativeBoardIssue[]): Kanban
85
82
  const contentItemType = contentItemBoardType();
86
83
  const kinds: NativeBoardKind[] = ["contentItem", "reference", "assignment"];
87
84
  const contentItemStatuses = contentItemColumnOrder(issues.filter(issue => issue.kind === "contentItem").map(issue => issue.nativeStatus))
88
- .map(stage => ({ key: `${contentItemType}/${stage}`, name: contentItemStageLabel(stage, getContentItemStageDefinitions()), category: "native" }));
85
+ .map(stage => ({ key: `${contentItemType}/${stage}`, name: contentItemStageLabel(stage), category: "native" }));
89
86
  const otherStatuses = [...new Set(issues.filter(issue => issue.kind !== "contentItem").map(issue => issue.status))]
90
87
  .map(key => ({ key, name: key.replace("/", " · "), category: "native" }));
91
88
  const statuses = [...contentItemStatuses, ...otherStatuses];
package/lib/site-brand.ts CHANGED
@@ -5,7 +5,6 @@ import type { BlogPageBackgroundProps } from "../components/blog-page-background
5
5
  import type { SiteBrandFont } from "./brand-fonts";
6
6
  import type { PictogramFigureProps } from "../components/pictogram-figure";
7
7
  import papyrusSite from "papyrus-site";
8
- import { DEFAULT_CONTENT_ITEM_STAGE_DEFINITIONS, type ContentItemStageDefinition } from "./content-item-lifecycle";
9
8
  import {
10
9
  DEFAULT_THEME_PACK_TOKENS,
11
10
  type HostingConfig,
@@ -93,8 +92,6 @@ export type SiteBrand = {
93
92
  articleTitleSuffix: string;
94
93
  /** Defaults to Story / Stories, the newsroom term. */
95
94
  contentItemName?: ContentItemName;
96
- /** The lifecycle stages in board order, last one being publication. Defaults to the standard newsroom lifecycle. */
97
- contentItemStages?: readonly ContentItemStageDefinition[];
98
95
  placeholderByline: string;
99
96
  defaultPresentation: EditionPresentationFormat;
100
97
  forcedPresentation?: EditionPresentationFormat;
@@ -226,10 +223,6 @@ export function getContentItemName(brand: SiteBrand = SITE_BRAND): ContentItemNa
226
223
  return brand.contentItemName ?? DEFAULT_CONTENT_ITEM_NAME;
227
224
  }
228
225
 
229
- export function getContentItemStageDefinitions(brand: SiteBrand = SITE_BRAND): readonly ContentItemStageDefinition[] {
230
- return brand.contentItemStages?.length ? brand.contentItemStages : DEFAULT_CONTENT_ITEM_STAGE_DEFINITIONS;
231
- }
232
-
233
226
  /** Root-route config for a brand, defaulting to `{ kind: "reader" }`. */
234
227
  export function getRootRoute(brand: SiteBrand = SITE_BRAND): RootRouteConfig {
235
228
  return brand.rootRoute ?? { kind: "reader" };
package/package.json CHANGED
@@ -339,7 +339,7 @@
339
339
  "optional": true
340
340
  }
341
341
  },
342
- "version": "1.2.0-next.2",
342
+ "version": "1.2.0",
343
343
  "dependencies": {
344
344
  "@aws-amplify/adapter-nextjs": "^1.7.3",
345
345
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.0-next.2",
2
+ "version": "1.2.0",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",