@anthusai/papyrus 5.136.0-next.2 → 5.136.0-next.4

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.
@@ -86,6 +86,11 @@ export const announcementsSchemaDefinitions = {
86
86
  lockedAt: a.datetime(),
87
87
  lockedVersion: a.integer(),
88
88
  preferredVersion: a.integer(),
89
+ machineVersion: a.integer(),
90
+ exampleScope: a.string(),
91
+ exampleState: a.string(),
92
+ exampleAt: a.datetime(),
93
+ exampleKey: a.string(),
89
94
  nextAttemptAt: a.datetime(),
90
95
  waitingFor: a.string(),
91
96
  dueAt: a.datetime(),
@@ -89,6 +89,11 @@ export const announcementsSchemaDefinitions = {
89
89
  lockedAt: a.datetime(),
90
90
  lockedVersion: a.integer(),
91
91
  preferredVersion: a.integer(),
92
+ machineVersion: a.integer(),
93
+ exampleScope: a.string(),
94
+ exampleState: a.string(),
95
+ exampleAt: a.datetime(),
96
+ exampleKey: a.string(),
92
97
  nextAttemptAt: a.datetime(),
93
98
  waitingFor: a.string(),
94
99
  dueAt: a.datetime(),
@@ -22,10 +22,10 @@ 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
- roundup: ["id", "name", "description", "kind", "schedule", "issueType", "archivePath"],
28
+ roundup: ["id", "name", "description", "kind", "schedule", "issueType", "types", "archivePath"],
29
29
  alert: ["id", "name", "description", "kind", "rule", "approval"],
30
30
  };
31
31
  function fail(message) {
@@ -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";
@@ -192,6 +199,7 @@ function resolveList(raw, index) {
192
199
  timezone: timeZone(schedule.timezone, `${label}.schedule.timezone`),
193
200
  },
194
201
  issueType: matching(list.issueType, `${label}.issueType`, ISSUE_TYPE, "the lowercase Item type the site gives its issues, such as post (a site-defined Story type, never a default of the engine)"),
202
+ types: stringList(list.types, `${label}.types`) ?? fail(`${label}.types is required: the Story types the roundup carries, such as ["article"]`),
195
203
  archivePath: matching(list.archivePath, `${label}.archivePath`, ARCHIVE_PATH, 'a path that starts and ends with "/", such as /roundup/'),
196
204
  };
197
205
  }
@@ -233,6 +241,7 @@ export function resolveNewsletterConfig(request) {
233
241
  theme: resolveTheme(raw.theme),
234
242
  lists,
235
243
  itemUrlStyle: itemUrlStyle(raw.itemUrlStyle),
244
+ ...(raw.floorStars === undefined ? {} : { floorStars: floorStars(raw.floorStars) }),
236
245
  configurationSet: matching(raw.configurationSet, "configurationSet", SES_NAME, "an SES configuration set name", `papyrus-${siteId}`),
237
246
  eventTopicName: matching(raw.eventTopicName, "eventTopicName", SES_NAME, "an SNS topic name", `papyrus-newsletter-events-${siteId}`),
238
247
  };
@@ -61,6 +61,8 @@ export type RoundupList = ListBase & {
61
61
  schedule: { draft: string; timezone: string };
62
62
  /** The CMS item type of an issue. */
63
63
  issueType: string;
64
+ /** The Story types the roundup carries, such as `["article"]`. There is no default of every type: wiki pages and other kinds never qualify unless named. */
65
+ types: string[];
64
66
  /** Where the sent issue is archived, such as `/roundup/`: one path segment, also the section the issue Items are filed under. */
65
67
  archivePath: string;
66
68
  };
@@ -89,6 +91,8 @@ export type NewsletterConfig = {
89
91
  lists: NewsletterList[];
90
92
  /** How the site addresses its item pages (`urls.style` in projection.json): roundup drafts link to published items with it. */
91
93
  itemUrlStyle: ItemUrlStyle;
94
+ /** 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. */
95
+ floorStars?: number;
92
96
  /** `papyrus-<siteId>` unless overridden. */
93
97
  configurationSet: string;
94
98
  /** `papyrus-newsletter-events-<siteId>` unless overridden. */
@@ -97,10 +101,10 @@ export type NewsletterConfig = {
97
101
 
98
102
  const KNOWN_KEYS = new Set([
99
103
  "name", "siteId", "siteOrigin", "basePath", "computeRoleArn", "sendingDomain", "fromAddress", "fromName", "theme", "lists",
100
- "configurationSet", "eventTopicName", "itemUrlStyle",
104
+ "configurationSet", "eventTopicName", "itemUrlStyle", "floorStars",
101
105
  ]);
102
106
  const LIST_KEYS = {
103
- roundup: ["id", "name", "description", "kind", "schedule", "issueType", "archivePath"],
107
+ roundup: ["id", "name", "description", "kind", "schedule", "issueType", "types", "archivePath"],
104
108
  alert: ["id", "name", "description", "kind", "rule", "approval"],
105
109
  };
106
110
 
@@ -170,6 +174,12 @@ function stringList(raw: unknown, label: string): string[] | undefined {
170
174
  return [...new Set(raw.map((entry, index) => text(entry, `${label}[${index}]`, 80)))];
171
175
  }
172
176
 
177
+ export function floorStars(raw: unknown): number | undefined {
178
+ if (raw === undefined) return undefined;
179
+ if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1 || raw > 5) fail("floorStars must be a whole number from 1 to 5");
180
+ return raw;
181
+ }
182
+
173
183
  export function itemUrlStyle(raw: unknown): ItemUrlStyle {
174
184
  if (raw === undefined) return "html";
175
185
  if (typeof raw !== "string" || !(ITEM_URL_STYLES as readonly string[]).includes(raw)) fail(`itemUrlStyle must be one of ${ITEM_URL_STYLES.join(", ")}`);
@@ -255,6 +265,7 @@ function resolveList(raw: unknown, index: number): NewsletterList {
255
265
  timezone: timeZone(schedule.timezone, `${label}.schedule.timezone`),
256
266
  },
257
267
  issueType: matching(list.issueType, `${label}.issueType`, ISSUE_TYPE, "the lowercase Item type the site gives its issues, such as post (a site-defined Story type, never a default of the engine)"),
268
+ types: stringList(list.types, `${label}.types`) ?? fail(`${label}.types is required: the Story types the roundup carries, such as ["article"]`),
258
269
  archivePath: matching(list.archivePath, `${label}.archivePath`, ARCHIVE_PATH, 'a path that starts and ends with "/", such as /roundup/'),
259
270
  };
260
271
  }
@@ -293,6 +304,7 @@ export function resolveNewsletterConfig(request: PluginRequest): NewsletterConfi
293
304
  theme: resolveTheme(raw.theme),
294
305
  lists,
295
306
  itemUrlStyle: itemUrlStyle(raw.itemUrlStyle),
307
+ ...(raw.floorStars === undefined ? {} : { floorStars: floorStars(raw.floorStars) }),
296
308
  configurationSet: matching(raw.configurationSet, "configurationSet", SES_NAME, "an SES configuration set name", `papyrus-${siteId}`),
297
309
  eventTopicName: matching(raw.eventTopicName, "eventTopicName", SES_NAME, "an SNS topic name", `papyrus-newsletter-events-${siteId}`),
298
310
  };
@@ -71,13 +71,14 @@ 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,
77
78
  description: list.description,
78
79
  kind: list.kind,
79
80
  // A roundup's issue type, archive section and time zone are what drafting needs; its schedule stays in the stack.
80
- ...(list.kind === "roundup" ? { issueType: list.issueType, archivePath: list.archivePath, timezone: list.schedule.timezone } : {}),
81
+ ...(list.kind === "roundup" ? { issueType: list.issueType, types: list.types, archivePath: list.archivePath, timezone: list.schedule.timezone } : {}),
81
82
  // An alert's rule and approval decide which published items raise an alert and whether an admin approves it.
82
83
  ...(list.kind === "alert" ? { rule: list.rule, approval: list.approval } : {}),
83
84
  }))),
@@ -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,
@@ -91,7 +92,7 @@ export function newsletterEnvironment(config: NewsletterConfig, tableName: strin
91
92
  description: list.description,
92
93
  kind: list.kind,
93
94
  // A roundup's issue type, archive section and time zone are what drafting needs; its schedule stays in the stack.
94
- ...(list.kind === "roundup" ? { issueType: list.issueType, archivePath: list.archivePath, timezone: list.schedule.timezone } : {}),
95
+ ...(list.kind === "roundup" ? { issueType: list.issueType, types: list.types, archivePath: list.archivePath, timezone: list.schedule.timezone } : {}),
95
96
  // An alert's rule and approval decide which published items raise an alert and whether an admin approves it.
96
97
  ...(list.kind === "alert" ? { rule: list.rule, approval: list.approval } : {}),
97
98
  })),
@@ -39,6 +39,9 @@ export type ImageOperationName =
39
39
  | "announcements_settings_show"
40
40
  | "announcements_settings_set"
41
41
  | "announcements_account_status"
42
+ | "announcements_account_connect"
43
+ | "announcements_blocked"
44
+ | "announcements_retry"
42
45
  | "announcements_review_show"
43
46
  | "announcements_review_set"
44
47
  | "announcements_delivery_review_set"
@@ -48,6 +51,7 @@ export type ImageOperationName =
48
51
  | "announcements_pinned_change"
49
52
  | "announcements_release"
50
53
  | "announcements_unlock"
54
+ | "announcements_example"
51
55
  | "announcements_correct"
52
56
  | "announcements_record_manual"
53
57
  | "announcements_withdraw"
@@ -1136,10 +1140,56 @@ export type AnnouncementsAccountStatusResult = {
1136
1140
  accountHandle?: string;
1137
1141
  /** For example $0.60 spent of $10.00 this cycle. */
1138
1142
  standing?: string;
1143
+ /** Our count of the posts this account sent in the current billing cycle, a post later deleted included (X charged for it). X's own count is read beside it on the page. */
1144
+ postCount?: number;
1145
+ suggestion?: {
1146
+ eligibleCount?: number;
1147
+ windowDays?: number;
1148
+ postsPerMonth?: number;
1149
+ dollarsPerMonth?: number;
1150
+ sentence: string;
1151
+ };
1139
1152
  pauseReason?: string;
1140
1153
  pricesAsOf?: string;
1141
1154
  };
1142
1155
 
1156
+ /** Print the newsroom page where the X account is connected. Connecting is a browser step (OAuth): nothing is connected from here. */
1157
+ export type AnnouncementsAccountConnectInput = Record<string, unknown>;
1158
+
1159
+ export type AnnouncementsAccountConnectResult = {
1160
+ /** The address of Administration > Announcements in the newsroom. */
1161
+ url: string;
1162
+ words: string;
1163
+ };
1164
+
1165
+ /** List the Stories that qualified for X and are waiting, each with its reason (paused, budget reached, the account needs connecting again, a failed check). */
1166
+ export type AnnouncementsBlockedInput = Record<string, unknown>;
1167
+
1168
+ export type AnnouncementsBlockedResult = {
1169
+ blocked: {
1170
+ delivery: string;
1171
+ announcementId: string;
1172
+ stories: {
1173
+ lineageId: string;
1174
+ }[];
1175
+ reason: string;
1176
+ words: string;
1177
+ since?: string;
1178
+ }[];
1179
+ };
1180
+
1181
+ /** Try a failed Delivery again: it goes back to ready, and the next try is the next attempt. The attempts so far stay in its log. */
1182
+ export type AnnouncementsRetryInput = {
1183
+ /** The Delivery's id. */
1184
+ delivery: string;
1185
+ };
1186
+
1187
+ export type AnnouncementsRetryResult = {
1188
+ id: string;
1189
+ /** The Delivery's state afterwards: ready. */
1190
+ state: string;
1191
+ };
1192
+
1143
1193
  /** Show the publication's announcement review and each override, and what a channel and kind would get. */
1144
1194
  export type AnnouncementsReviewShowInput = {
1145
1195
  /** Narrow to one channel, such as linkedin. */
@@ -1332,6 +1382,26 @@ export type AnnouncementsUnlockResult = {
1332
1382
  lockedVersion?: number | null;
1333
1383
  };
1334
1384
 
1385
+ /** Say how far what a person changed in an announcement should reach, so later drafts can follow it. */
1386
+ export type AnnouncementsExampleInput = {
1387
+ /** The Delivery's id: one that went out, or one with a preferred version. */
1388
+ delivery: string;
1389
+ /** How far the change reaches: just this one, this channel, this kind of announcement on this channel, or the whole publication. Leave it out to keep the edit as a candidate. */
1390
+ scope?: "this_one" | "channel" | "kind" | "publication";
1391
+ /** One line on why, kept with the words in S3 and never in the catalog. It goes with a scope. */
1392
+ reason?: string;
1393
+ };
1394
+
1395
+ export type AnnouncementsExampleResult = {
1396
+ id: string;
1397
+ recorded: boolean;
1398
+ exampleState?: string | null;
1399
+ exampleScope?: string | null;
1400
+ machineVersion?: number | null;
1401
+ finalVersion?: number | null;
1402
+ reason?: string | null;
1403
+ };
1404
+
1335
1405
  /** Correct a Delivery that went with a new public text: the next generation, which supersedes the one that went. */
1336
1406
  export type AnnouncementsCorrectInput = {
1337
1407
  /** The id of the Delivery that went and is to be corrected. */
@@ -1647,6 +1717,9 @@ export interface ImageOperations {
1647
1717
  announcements_settings_show: { input: AnnouncementsSettingsShowInput; result: AnnouncementsSettingsShowResult };
1648
1718
  announcements_settings_set: { input: AnnouncementsSettingsSetInput; result: AnnouncementsSettingsSetResult };
1649
1719
  announcements_account_status: { input: AnnouncementsAccountStatusInput; result: AnnouncementsAccountStatusResult };
1720
+ announcements_account_connect: { input: AnnouncementsAccountConnectInput; result: AnnouncementsAccountConnectResult };
1721
+ announcements_blocked: { input: AnnouncementsBlockedInput; result: AnnouncementsBlockedResult };
1722
+ announcements_retry: { input: AnnouncementsRetryInput; result: AnnouncementsRetryResult };
1650
1723
  announcements_review_show: { input: AnnouncementsReviewShowInput; result: AnnouncementsReviewShowResult };
1651
1724
  announcements_review_set: { input: AnnouncementsReviewSetInput; result: AnnouncementsReviewSetResult };
1652
1725
  announcements_delivery_review_set: { input: AnnouncementsDeliveryReviewSetInput; result: AnnouncementsDeliveryReviewSetResult };
@@ -1656,6 +1729,7 @@ export interface ImageOperations {
1656
1729
  announcements_pinned_change: { input: AnnouncementsPinnedChangeInput; result: AnnouncementsPinnedChangeResult };
1657
1730
  announcements_release: { input: AnnouncementsReleaseInput; result: AnnouncementsReleaseResult };
1658
1731
  announcements_unlock: { input: AnnouncementsUnlockInput; result: AnnouncementsUnlockResult };
1732
+ announcements_example: { input: AnnouncementsExampleInput; result: AnnouncementsExampleResult };
1659
1733
  announcements_correct: { input: AnnouncementsCorrectInput; result: AnnouncementsCorrectResult };
1660
1734
  announcements_record_manual: { input: AnnouncementsRecordManualInput; result: AnnouncementsRecordManualResult };
1661
1735
  announcements_withdraw: { input: AnnouncementsWithdrawInput; result: AnnouncementsWithdrawResult };
@@ -1704,6 +1778,9 @@ export const IMAGE_OPERATIONS = {
1704
1778
  announcements_settings_show: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements settings show" },
1705
1779
  announcements_settings_set: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "blocked", group: "announcements", command: "papyrus announcements settings set" },
1706
1780
  announcements_account_status: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements account status" },
1781
+ announcements_account_connect: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements account connect" },
1782
+ announcements_blocked: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements blocked" },
1783
+ announcements_retry: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements retry" },
1707
1784
  announcements_review_show: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements review show" },
1708
1785
  announcements_review_set: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "blocked", group: "announcements", command: "papyrus announcements review set" },
1709
1786
  announcements_delivery_review_set: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements delivery review" },
@@ -1713,6 +1790,7 @@ export const IMAGE_OPERATIONS = {
1713
1790
  announcements_pinned_change: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "blocked", group: "announcements", command: "papyrus announcements pinned" },
1714
1791
  announcements_release: { effect: "write", agentAllowed: true, agentRung: "publish_auto", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements release" },
1715
1792
  announcements_unlock: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements unlock" },
1793
+ announcements_example: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements example" },
1716
1794
  announcements_correct: { effect: "write", agentAllowed: true, agentRung: "prepare", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements correct" },
1717
1795
  announcements_record_manual: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements record-manual" },
1718
1796
  announcements_withdraw: { effect: "write", agentAllowed: true, agentRung: "prepare", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements withdraw" },
package/package.json CHANGED
@@ -650,7 +650,7 @@
650
650
  "optional": true
651
651
  }
652
652
  },
653
- "version": "5.136.0-next.2",
653
+ "version": "5.136.0-next.4",
654
654
  "dependencies": {
655
655
  "@aws-amplify/adapter-nextjs": "^1.7.3",
656
656
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.136.0-next.2",
2
+ "version": "5.136.0-next.4",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",