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