@anthusai/papyrus 5.136.0-next.2 → 5.136.0-next.3
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.
|
@@ -22,7 +22,7 @@ const THEME_KEYS = [
|
|
|
22
22
|
];
|
|
23
23
|
const KNOWN_KEYS = new Set([
|
|
24
24
|
"name", "siteId", "siteOrigin", "basePath", "computeRoleArn", "sendingDomain", "fromAddress", "fromName", "theme", "lists",
|
|
25
|
-
"configurationSet", "eventTopicName", "itemUrlStyle",
|
|
25
|
+
"configurationSet", "eventTopicName", "itemUrlStyle", "floorStars",
|
|
26
26
|
]);
|
|
27
27
|
const LIST_KEYS = {
|
|
28
28
|
roundup: ["id", "name", "description", "kind", "schedule", "issueType", "archivePath"],
|
|
@@ -98,6 +98,13 @@ function stringList(raw, label) {
|
|
|
98
98
|
fail(`${label} must be a list of 1 to 50 names`);
|
|
99
99
|
return [...new Set(raw.map((entry, index) => text(entry, `${label}[${index}]`, 80)))];
|
|
100
100
|
}
|
|
101
|
+
export function floorStars(raw) {
|
|
102
|
+
if (raw === undefined)
|
|
103
|
+
return undefined;
|
|
104
|
+
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1 || raw > 5)
|
|
105
|
+
fail("floorStars must be a whole number from 1 to 5");
|
|
106
|
+
return raw;
|
|
107
|
+
}
|
|
101
108
|
export function itemUrlStyle(raw) {
|
|
102
109
|
if (raw === undefined)
|
|
103
110
|
return "html";
|
|
@@ -233,6 +240,7 @@ export function resolveNewsletterConfig(request) {
|
|
|
233
240
|
theme: resolveTheme(raw.theme),
|
|
234
241
|
lists,
|
|
235
242
|
itemUrlStyle: itemUrlStyle(raw.itemUrlStyle),
|
|
243
|
+
...(raw.floorStars === undefined ? {} : { floorStars: floorStars(raw.floorStars) }),
|
|
236
244
|
configurationSet: matching(raw.configurationSet, "configurationSet", SES_NAME, "an SES configuration set name", `papyrus-${siteId}`),
|
|
237
245
|
eventTopicName: matching(raw.eventTopicName, "eventTopicName", SES_NAME, "an SNS topic name", `papyrus-newsletter-events-${siteId}`),
|
|
238
246
|
};
|
|
@@ -89,6 +89,8 @@ export type NewsletterConfig = {
|
|
|
89
89
|
lists: NewsletterList[];
|
|
90
90
|
/** How the site addresses its item pages (`urls.style` in projection.json): roundup drafts link to published items with it. */
|
|
91
91
|
itemUrlStyle: ItemUrlStyle;
|
|
92
|
+
/** The site's quality floor (`quality.floorStars` in projection.json, 1 to 5): a roundup draft takes only Stories rated at least this. Absent: no floor. Keep it equal to the site's. */
|
|
93
|
+
floorStars?: number;
|
|
92
94
|
/** `papyrus-<siteId>` unless overridden. */
|
|
93
95
|
configurationSet: string;
|
|
94
96
|
/** `papyrus-newsletter-events-<siteId>` unless overridden. */
|
|
@@ -97,7 +99,7 @@ export type NewsletterConfig = {
|
|
|
97
99
|
|
|
98
100
|
const KNOWN_KEYS = new Set([
|
|
99
101
|
"name", "siteId", "siteOrigin", "basePath", "computeRoleArn", "sendingDomain", "fromAddress", "fromName", "theme", "lists",
|
|
100
|
-
"configurationSet", "eventTopicName", "itemUrlStyle",
|
|
102
|
+
"configurationSet", "eventTopicName", "itemUrlStyle", "floorStars",
|
|
101
103
|
]);
|
|
102
104
|
const LIST_KEYS = {
|
|
103
105
|
roundup: ["id", "name", "description", "kind", "schedule", "issueType", "archivePath"],
|
|
@@ -170,6 +172,12 @@ function stringList(raw: unknown, label: string): string[] | undefined {
|
|
|
170
172
|
return [...new Set(raw.map((entry, index) => text(entry, `${label}[${index}]`, 80)))];
|
|
171
173
|
}
|
|
172
174
|
|
|
175
|
+
export function floorStars(raw: unknown): number | undefined {
|
|
176
|
+
if (raw === undefined) return undefined;
|
|
177
|
+
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1 || raw > 5) fail("floorStars must be a whole number from 1 to 5");
|
|
178
|
+
return raw;
|
|
179
|
+
}
|
|
180
|
+
|
|
173
181
|
export function itemUrlStyle(raw: unknown): ItemUrlStyle {
|
|
174
182
|
if (raw === undefined) return "html";
|
|
175
183
|
if (typeof raw !== "string" || !(ITEM_URL_STYLES as readonly string[]).includes(raw)) fail(`itemUrlStyle must be one of ${ITEM_URL_STYLES.join(", ")}`);
|
|
@@ -293,6 +301,7 @@ export function resolveNewsletterConfig(request: PluginRequest): NewsletterConfi
|
|
|
293
301
|
theme: resolveTheme(raw.theme),
|
|
294
302
|
lists,
|
|
295
303
|
itemUrlStyle: itemUrlStyle(raw.itemUrlStyle),
|
|
304
|
+
...(raw.floorStars === undefined ? {} : { floorStars: floorStars(raw.floorStars) }),
|
|
296
305
|
configurationSet: matching(raw.configurationSet, "configurationSet", SES_NAME, "an SES configuration set name", `papyrus-${siteId}`),
|
|
297
306
|
eventTopicName: matching(raw.eventTopicName, "eventTopicName", SES_NAME, "an SNS topic name", `papyrus-newsletter-events-${siteId}`),
|
|
298
307
|
};
|
|
@@ -71,6 +71,7 @@ export function newsletterEnvironment(config, tableName, keyParameter) {
|
|
|
71
71
|
FROM_NAME: config.fromName,
|
|
72
72
|
CONFIGURATION_SET: config.configurationSet,
|
|
73
73
|
ITEM_URL_STYLE: config.itemUrlStyle,
|
|
74
|
+
...(config.floorStars === undefined ? {} : { FLOOR_STARS: String(config.floorStars) }),
|
|
74
75
|
LISTS_JSON: JSON.stringify(config.lists.map((list) => ({
|
|
75
76
|
id: list.id,
|
|
76
77
|
name: list.name,
|
|
@@ -84,6 +84,7 @@ export function newsletterEnvironment(config: NewsletterConfig, tableName: strin
|
|
|
84
84
|
FROM_NAME: config.fromName,
|
|
85
85
|
CONFIGURATION_SET: config.configurationSet,
|
|
86
86
|
ITEM_URL_STYLE: config.itemUrlStyle,
|
|
87
|
+
...(config.floorStars === undefined ? {} : { FLOOR_STARS: String(config.floorStars) }),
|
|
87
88
|
LISTS_JSON: JSON.stringify(
|
|
88
89
|
config.lists.map((list) => ({
|
|
89
90
|
id: list.id,
|
package/package.json
CHANGED
package/routes.manifest.json
CHANGED