@anthusai/papyrus 5.135.0-next.5 → 5.135.0-next.7

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.
@@ -20,50 +20,11 @@ export const announcementsSchemaDefinitions = {
20
20
  })
21
21
  .disableOperations(["subscriptions"])
22
22
  .authorization((allow) => [allow.group("admin").to(["read"])]),
23
- /**
24
- * One announcement of a Story on the publication's X account: the audit row (who, what, when, post id, cost, mode, outcome). id = "<accountId>#<storyLineageId>",
25
- * created with a condition so a Story is announced once per account. The post text is in S3 (ModelAttachment role announcement_document). Editors and admins read;
26
- * the announcement pipeline writes.
27
- */
28
- Announcement: a
29
- .model({
30
- id: a.id().required(),
31
- accountId: a.string().required(),
32
- accountHandle: a.string(),
33
- storyLineageId: a.id().required(),
34
- storyItemId: a.id(),
35
- storyVersionNumber: a.integer(),
36
- channel: a.string().required(),
37
- state: a.string().required(),
38
- blockedReason: a.string(),
39
- mode: a.string().required(),
40
- trigger: a.string(),
41
- link: a.string(),
42
- weight: a.integer(),
43
- draftedBy: a.string(),
44
- checks: a.json(),
45
- postId: a.string(),
46
- postedAt: a.datetime(),
47
- cost: a.string(),
48
- attempts: a.integer(),
49
- round: a.integer(),
50
- error: a.string(),
51
- history: a.json(),
52
- withdrawnBy: a.string(),
53
- withdrawnAt: a.datetime(),
54
- createdAt: a.datetime().required(),
55
- updatedAt: a.datetime().required(),
56
- })
57
- .secondaryIndexes((index) => [
58
- index("accountId").sortKeys(["createdAt"]).queryField("listAnnouncementsByAccountAndCreatedAt"),
59
- ])
60
- .disableOperations(["subscriptions"])
61
- .authorization((allow) => [allow.groups(editors).to(["read"])]),
62
23
  /**
63
24
  * An Announcement: the decision to say something about one or more Stories (docs/announcement-records.md). It knows nothing about channels and holds no approval;
64
25
  * a Delivery holds both. id is made from the once-only key (dedupeKey), and created with a condition, so a decision is made once. The Stories it is about are
65
- * `announces` relations, with the version looked at. Short fields only: no text. Named for what it is because the model `Announcement` is the X row shape that
66
- * PPY-efd06c deletes. Editors and admins read; the announcement pipeline writes.
26
+ * `announces` relations, with the version looked at. Short fields only: no text. The model named `Announcement` (the old X row shape, with its
27
+ * account index and round counter) is gone: an X post is an Announcement with one Delivery. Editors and admins read; the announcement pipeline writes.
67
28
  */
68
29
  AnnouncementDecision: a
69
30
  .model({
@@ -23,50 +23,11 @@ export const announcementsSchemaDefinitions = {
23
23
  })
24
24
  .disableOperations(["subscriptions"])
25
25
  .authorization((allow) => [allow.group("admin").to(["read"])]),
26
- /**
27
- * One announcement of a Story on the publication's X account: the audit row (who, what, when, post id, cost, mode, outcome). id = "<accountId>#<storyLineageId>",
28
- * created with a condition so a Story is announced once per account. The post text is in S3 (ModelAttachment role announcement_document). Editors and admins read;
29
- * the announcement pipeline writes.
30
- */
31
- Announcement: a
32
- .model({
33
- id: a.id().required(),
34
- accountId: a.string().required(),
35
- accountHandle: a.string(),
36
- storyLineageId: a.id().required(),
37
- storyItemId: a.id(),
38
- storyVersionNumber: a.integer(),
39
- channel: a.string().required(),
40
- state: a.string().required(),
41
- blockedReason: a.string(),
42
- mode: a.string().required(),
43
- trigger: a.string(),
44
- link: a.string(),
45
- weight: a.integer(),
46
- draftedBy: a.string(),
47
- checks: a.json(),
48
- postId: a.string(),
49
- postedAt: a.datetime(),
50
- cost: a.string(),
51
- attempts: a.integer(),
52
- round: a.integer(),
53
- error: a.string(),
54
- history: a.json(),
55
- withdrawnBy: a.string(),
56
- withdrawnAt: a.datetime(),
57
- createdAt: a.datetime().required(),
58
- updatedAt: a.datetime().required(),
59
- })
60
- .secondaryIndexes((index) => [
61
- index("accountId").sortKeys(["createdAt"]).queryField("listAnnouncementsByAccountAndCreatedAt"),
62
- ])
63
- .disableOperations(["subscriptions"])
64
- .authorization((allow) => [allow.groups(editors).to(["read"])]),
65
26
  /**
66
27
  * An Announcement: the decision to say something about one or more Stories (docs/announcement-records.md). It knows nothing about channels and holds no approval;
67
28
  * a Delivery holds both. id is made from the once-only key (dedupeKey), and created with a condition, so a decision is made once. The Stories it is about are
68
- * `announces` relations, with the version looked at. Short fields only: no text. Named for what it is because the model `Announcement` is the X row shape that
69
- * PPY-efd06c deletes. Editors and admins read; the announcement pipeline writes.
29
+ * `announces` relations, with the version looked at. Short fields only: no text. The model named `Announcement` (the old X row shape, with its
30
+ * account index and round counter) is gone: an X post is an Announcement with one Delivery. Editors and admins read; the announcement pipeline writes.
70
31
  */
71
32
  AnnouncementDecision: a
72
33
  .model({
@@ -24,7 +24,6 @@ const MAX_GRAPH_EXPORT_ATTACHMENT_BYTES = 512 * 1024 * 1024;
24
24
  const UPLOAD_EXPIRES_SECONDS = 10 * 60;
25
25
  const DOWNLOAD_EXPIRES_SECONDS = 10 * 60;
26
26
  const ALLOWED_OWNER_KINDS = new Set([
27
- "announcement",
28
27
  "assignment",
29
28
  "assignmentEvent",
30
29
  "delivery",
@@ -61,7 +60,6 @@ const ALLOWED_ROLES = new Set([
61
60
  "visual_negative",
62
61
  "image_record",
63
62
  "image_candidate_file",
64
- "announcement_document",
65
63
  "delivery_text", // a Delivery's words, one file in S3 (src/papyrus_content/announcements/deliveries.py)
66
64
  "doctrine_document",
67
65
  "doctrine_asset",
@@ -293,7 +291,6 @@ function uploadIdFor(input: ReturnType<typeof normalizeAttachmentInput>): string
293
291
  }
294
292
 
295
293
  function ownerModelName(ownerKind: string): string {
296
- if (ownerKind === "announcement") return "Announcement";
297
294
  if (ownerKind === "assignment") return "Assignment";
298
295
  if (ownerKind === "assignmentEvent") return "AssignmentEvent";
299
296
  if (ownerKind === "delivery") return "Delivery";
@@ -2,9 +2,9 @@ import { COMPUTE_ROLE_ARN_ENVIRONMENT_VARIABLE, environmentOrConfigured } from "
2
2
  import { COMPUTE_ROLE_ARN, HOSTNAME, LOCAL_PART, NEWSLETTER_LIST_ID, NEWSLETTER_SITE_ID, SES_NAME, basePath, itemUrlStyle, matching, origin, record, resolveRule, resolveTheme, text, } from "../newsletter/config.js";
3
3
  const KNOWN_KEYS = [
4
4
  "name", "siteId", "siteOrigin", "basePath", "computeRoleArn", "sendingDomain", "fromAddress", "fromName", "theme", "lists",
5
- "itemUrlStyle", "configurationSet", "consent", "confirmWindowHours",
5
+ "itemUrlStyle", "configurationSet", "consent", "confirmWindowHours", "legacyNewsletterLinks",
6
6
  ];
7
- const LIST_KEYS = ["id", "name", "description", "rule", "approval", "family", "cadence", "sendAt", "timeZone"];
7
+ const LIST_KEYS = ["id", "name", "description", "rule", "approval", "kind", "family", "cadence", "sendAt", "timeZone"];
8
8
  const CADENCES = ["each", "daily", "weekly"];
9
9
  const WEEKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
10
10
  /** The helpers shared with the newsletter word their errors for it; this plugin says its own name. */
@@ -27,6 +27,11 @@ function resolveList(raw, index) {
27
27
  const approval = list.approval === undefined ? "admin" : list.approval;
28
28
  if (approval !== "admin" && approval !== "none")
29
29
  fail(`${label}.approval must be "admin" or "none"`);
30
+ const kind = list.kind === undefined ? undefined : list.kind;
31
+ if (kind !== undefined && kind !== "story.published" && kind !== "roundup")
32
+ fail(`${label}.kind must be "story.published" or "roundup"`);
33
+ if (kind === "roundup" && list.rule !== undefined)
34
+ fail(`${label} is a roundup list, which is never sent each story, so it names no rule`);
30
35
  const family = list.family === undefined ? undefined : matching(list.family, `${label}.family`, NEWSLETTER_LIST_ID, "lowercase letters, digits and hyphens, starting with a letter");
31
36
  const cadence = list.cadence === undefined ? undefined : list.cadence;
32
37
  if (cadence !== undefined && !CADENCES.includes(cadence))
@@ -50,6 +55,7 @@ function resolveList(raw, index) {
50
55
  description: text(list.description, `${label}.description`, 300, { optional: true, fallback: "" }),
51
56
  rule: resolveRule(list.rule, `${label}.rule`),
52
57
  approval,
58
+ ...(kind === undefined ? {} : { kind: kind }),
53
59
  ...(family === undefined ? {} : { family }),
54
60
  ...(cadence === undefined ? {} : { cadence: cadence }),
55
61
  ...(periodic ? { sendAt: list.sendAt, timeZone: list.timeZone } : {}),
@@ -63,6 +69,13 @@ function confirmWindowHours(raw) {
63
69
  fail("confirmWindowHours must be a whole number of hours, at least 1");
64
70
  return raw;
65
71
  }
72
+ function legacyNewsletterLinks(raw) {
73
+ if (raw === undefined)
74
+ return false;
75
+ if (typeof raw !== "boolean")
76
+ fail("legacyNewsletterLinks must be true or false");
77
+ return raw;
78
+ }
66
79
  export function resolveNotificationsConfig(request) {
67
80
  return inThisPlugin(() => {
68
81
  const raw = record(typeof request === "string" ? { name: request } : request, "settings", KNOWN_KEYS);
@@ -97,6 +110,7 @@ export function resolveNotificationsConfig(request) {
97
110
  confirmWindowHours: confirmWindowHours(raw.confirmWindowHours),
98
111
  itemUrlStyle: itemUrlStyle(raw.itemUrlStyle),
99
112
  configurationSet: matching(raw.configurationSet, "configurationSet", SES_NAME, "an SES configuration set name", `papyrus-${siteId}`),
113
+ legacyNewsletterLinks: legacyNewsletterLinks(raw.legacyNewsletterLinks),
100
114
  };
101
115
  });
102
116
  }
@@ -29,6 +29,11 @@ export type NotificationsList = {
29
29
  description: string;
30
30
  rule: NewsletterRule;
31
31
  approval: "admin" | "none";
32
+ /**
33
+ * What the list is for. `story.published` (the default) sends each matching story. `roundup` is a periodic issue's list: it is never
34
+ * sent each story, so it carries no rule. A newsletter roundup list keeps its id and becomes a `roundup` list when its subscribers move (PPY-6b2d35).
35
+ */
36
+ kind?: "story.published" | "roundup";
32
37
  /** The cadence family: lists that carry the same items at different cadences share one, and a reader holds one list of a family. None: its own family. */
33
38
  family?: string;
34
39
  /** `each`, `daily` or `weekly`, as in the site's `lists` document. A reader's switch between lists of a family waits for the next period start of its periodic list. */
@@ -59,13 +64,18 @@ export type NotificationsConfig = {
59
64
  itemUrlStyle: ItemUrlStyle;
60
65
  /** `papyrus-<siteId>` unless overridden: the sending stack's configuration set, shared with the newsletter. */
61
66
  configurationSet: string;
67
+ /**
68
+ * Honour the old newsletter's manage and unsubscribe links (they were mailed with the newsletter's tokens) until the date the migration
69
+ * gave them. Dated: set only while that period runs, and removed with `src/papyrus_content/notifications/legacy_links.py` (see that file).
70
+ */
71
+ legacyNewsletterLinks: boolean;
62
72
  };
63
73
 
64
74
  const KNOWN_KEYS = [
65
75
  "name", "siteId", "siteOrigin", "basePath", "computeRoleArn", "sendingDomain", "fromAddress", "fromName", "theme", "lists",
66
- "itemUrlStyle", "configurationSet", "consent", "confirmWindowHours",
76
+ "itemUrlStyle", "configurationSet", "consent", "confirmWindowHours", "legacyNewsletterLinks",
67
77
  ];
68
- const LIST_KEYS = ["id", "name", "description", "rule", "approval", "family", "cadence", "sendAt", "timeZone"];
78
+ const LIST_KEYS = ["id", "name", "description", "rule", "approval", "kind", "family", "cadence", "sendAt", "timeZone"];
69
79
  const CADENCES = ["each", "daily", "weekly"];
70
80
  const WEEKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
71
81
 
@@ -88,6 +98,9 @@ function resolveList(raw: unknown, index: number): NotificationsList {
88
98
  const list = record(raw, label, LIST_KEYS);
89
99
  const approval = list.approval === undefined ? "admin" : list.approval;
90
100
  if (approval !== "admin" && approval !== "none") fail(`${label}.approval must be "admin" or "none"`);
101
+ const kind = list.kind === undefined ? undefined : list.kind;
102
+ if (kind !== undefined && kind !== "story.published" && kind !== "roundup") fail(`${label}.kind must be "story.published" or "roundup"`);
103
+ if (kind === "roundup" && list.rule !== undefined) fail(`${label} is a roundup list, which is never sent each story, so it names no rule`);
91
104
  const family = list.family === undefined ? undefined : matching(list.family, `${label}.family`, NEWSLETTER_LIST_ID, "lowercase letters, digits and hyphens, starting with a letter");
92
105
  const cadence = list.cadence === undefined ? undefined : list.cadence;
93
106
  if (cadence !== undefined && !CADENCES.includes(cadence as string)) fail(`${label}.cadence must be one of: ${CADENCES.join(", ")}`);
@@ -107,6 +120,7 @@ function resolveList(raw: unknown, index: number): NotificationsList {
107
120
  description: text(list.description, `${label}.description`, 300, { optional: true, fallback: "" }),
108
121
  rule: resolveRule(list.rule, `${label}.rule`),
109
122
  approval,
123
+ ...(kind === undefined ? {} : { kind: kind as NotificationsList["kind"] }),
110
124
  ...(family === undefined ? {} : { family }),
111
125
  ...(cadence === undefined ? {} : { cadence: cadence as NotificationsList["cadence"] }),
112
126
  ...(periodic ? { sendAt: list.sendAt as NotificationsList["sendAt"], timeZone: list.timeZone as string } : {}),
@@ -120,6 +134,12 @@ function confirmWindowHours(raw: unknown): number {
120
134
  return raw;
121
135
  }
122
136
 
137
+ function legacyNewsletterLinks(raw: unknown): boolean {
138
+ if (raw === undefined) return false;
139
+ if (typeof raw !== "boolean") fail("legacyNewsletterLinks must be true or false");
140
+ return raw;
141
+ }
142
+
123
143
  export function resolveNotificationsConfig(request: PluginRequest): NotificationsConfig {
124
144
  return inThisPlugin(() => {
125
145
  const raw = record(typeof request === "string" ? { name: request } : request, "settings", KNOWN_KEYS);
@@ -152,6 +172,7 @@ export function resolveNotificationsConfig(request: PluginRequest): Notification
152
172
  confirmWindowHours: confirmWindowHours(raw.confirmWindowHours),
153
173
  itemUrlStyle: itemUrlStyle(raw.itemUrlStyle),
154
174
  configurationSet: matching(raw.configurationSet, "configurationSet", SES_NAME, "an SES configuration set name", `papyrus-${siteId}`),
175
+ legacyNewsletterLinks: legacyNewsletterLinks(raw.legacyNewsletterLinks),
155
176
  };
156
177
  });
157
178
  }
@@ -58,6 +58,8 @@ export const notificationsTableName = (siteId) => `papyrus-notifications-${siteI
58
58
  export const notificationsOperatorsParameterName = (siteId) => `/papyrus/${siteId}/notifications/operators`;
59
59
  /** Generated once by the stack; the addresses' recipient keys are derived from it. */
60
60
  export const notificationsKeyParameterName = (siteId) => `/papyrus/${siteId}/notifications/recipient-key`;
61
+ /** Where the newsletter plugin generated its key (it is retained when that plugin is removed): read only while old newsletter links are honoured. */
62
+ export const legacyNewsletterKeyParameterName = (siteId) => `/papyrus/${siteId}/newsletter-key`;
61
63
  export const notificationsAlarmNames = (siteId) => ({
62
64
  emailDeadLetters: `papyrus-notifications-${siteId}-email-dlq`,
63
65
  routerDeadLetters: `papyrus-notifications-${siteId}-router-dlq`,
@@ -87,11 +89,12 @@ export function notificationsEnvironment(config, names) {
87
89
  FROM_NAME: config.fromName,
88
90
  CONFIGURATION_SET: config.configurationSet,
89
91
  ITEM_URL_STYLE: config.itemUrlStyle,
90
- LISTS_JSON: JSON.stringify(config.lists.map((list) => ({ id: list.id, name: list.name, description: list.description, rule: list.rule, approval: list.approval, family: list.family, cadence: list.cadence, sendAt: list.sendAt, timeZone: list.timeZone }))),
92
+ LISTS_JSON: JSON.stringify(config.lists.map((list) => ({ id: list.id, name: list.name, description: list.description, rule: list.rule, approval: list.approval, kind: list.kind, family: list.family, cadence: list.cadence, sendAt: list.sendAt, timeZone: list.timeZone }))),
91
93
  THEME_JSON: JSON.stringify(config.theme),
92
94
  CONSENT: config.consent,
93
95
  CONFIRM_WINDOW_SECONDS: String(config.confirmWindowHours * 3600),
94
96
  METRIC_NAMESPACE: `Caducus/papyrus-${config.siteId}`,
97
+ ...(config.legacyNewsletterLinks ? { LEGACY_NEWSLETTER_KEY_PARAMETER: legacyNewsletterKeyParameterName(config.siteId) } : {}),
95
98
  };
96
99
  }
97
100
  export const notificationsPlugin = {
@@ -247,6 +250,10 @@ export const notificationsPlugin = {
247
250
  `arn:${stack.partition}:ssm:${stack.region}:${stack.account}:parameter${operatorsParameter}`,
248
251
  keyParameter.parameterArn,
249
252
  ];
253
+ // Old newsletter links (dated; legacy_links.py): every function builds the same runtime, so each may read the old key.
254
+ if (config.legacyNewsletterLinks) {
255
+ parameterArns.push(`arn:${stack.partition}:ssm:${stack.region}:${stack.account}:parameter${legacyNewsletterKeyParameterName(config.siteId)}`);
256
+ }
250
257
  // Every function builds the same runtime (the audience needs the recipient key), and the SES events suppress readers.
251
258
  for (const fn of [router, email, flush, sesEvents]) {
252
259
  table.grantReadWriteData(fn); // includes the table key's encrypt and decrypt
@@ -66,6 +66,8 @@ export const notificationsTableName = (siteId: string) => `papyrus-notifications
66
66
  export const notificationsOperatorsParameterName = (siteId: string) => `/papyrus/${siteId}/notifications/operators`;
67
67
  /** Generated once by the stack; the addresses' recipient keys are derived from it. */
68
68
  export const notificationsKeyParameterName = (siteId: string) => `/papyrus/${siteId}/notifications/recipient-key`;
69
+ /** Where the newsletter plugin generated its key (it is retained when that plugin is removed): read only while old newsletter links are honoured. */
70
+ export const legacyNewsletterKeyParameterName = (siteId: string) => `/papyrus/${siteId}/newsletter-key`;
69
71
  export const notificationsAlarmNames = (siteId: string) => ({
70
72
  emailDeadLetters: `papyrus-notifications-${siteId}-email-dlq`,
71
73
  routerDeadLetters: `papyrus-notifications-${siteId}-router-dlq`,
@@ -98,11 +100,12 @@ export function notificationsEnvironment(config: NotificationsConfig, names: { t
98
100
  FROM_NAME: config.fromName,
99
101
  CONFIGURATION_SET: config.configurationSet,
100
102
  ITEM_URL_STYLE: config.itemUrlStyle,
101
- LISTS_JSON: JSON.stringify(config.lists.map((list) => ({ id: list.id, name: list.name, description: list.description, rule: list.rule, approval: list.approval, family: list.family, cadence: list.cadence, sendAt: list.sendAt, timeZone: list.timeZone }))),
103
+ LISTS_JSON: JSON.stringify(config.lists.map((list) => ({ id: list.id, name: list.name, description: list.description, rule: list.rule, approval: list.approval, kind: list.kind, family: list.family, cadence: list.cadence, sendAt: list.sendAt, timeZone: list.timeZone }))),
102
104
  THEME_JSON: JSON.stringify(config.theme),
103
105
  CONSENT: config.consent,
104
106
  CONFIRM_WINDOW_SECONDS: String(config.confirmWindowHours * 3600),
105
107
  METRIC_NAMESPACE: `Caducus/papyrus-${config.siteId}`,
108
+ ...(config.legacyNewsletterLinks ? { LEGACY_NEWSLETTER_KEY_PARAMETER: legacyNewsletterKeyParameterName(config.siteId) } : {}),
106
109
  };
107
110
  }
108
111
 
@@ -268,6 +271,10 @@ export const notificationsPlugin: PapyrusPlugin<NotificationsConfig, Record<stri
268
271
  `arn:${stack.partition}:ssm:${stack.region}:${stack.account}:parameter${operatorsParameter}`,
269
272
  keyParameter.parameterArn,
270
273
  ];
274
+ // Old newsletter links (dated; legacy_links.py): every function builds the same runtime, so each may read the old key.
275
+ if (config.legacyNewsletterLinks) {
276
+ parameterArns.push(`arn:${stack.partition}:ssm:${stack.region}:${stack.account}:parameter${legacyNewsletterKeyParameterName(config.siteId)}`);
277
+ }
271
278
  // Every function builds the same runtime (the audience needs the recipient key), and the SES events suppress readers.
272
279
  for (const fn of [router, email, flush, sesEvents]) {
273
280
  table.grantReadWriteData(fn); // includes the table key's encrypt and decrypt
@@ -33,8 +33,6 @@ export type ImageOperationName =
33
33
  | "guidelines_diff"
34
34
  | "guidelines_save"
35
35
  | "guidelines_history"
36
- | "announcements_list"
37
- | "announcements_show"
38
36
  | "announcements_dry_run"
39
37
  | "announcements_pause"
40
38
  | "announcements_resume"
@@ -992,96 +990,6 @@ export type GuidelinesHistoryResult = {
992
990
  })[];
993
991
  };
994
992
 
995
- /** List the account's announcements, newest first, optionally one state. */
996
- export type AnnouncementsListInput = {
997
- /** One state of an announcement. */
998
- state?: "posting" | "posted" | "failed" | "blocked" | "dry_run" | "withdrawn";
999
- /** How many to return; 50 when left out. */
1000
- limit?: number;
1001
- };
1002
-
1003
- export type AnnouncementsListResult = {
1004
- announcements: ({
1005
- id: string;
1006
- accountId?: string;
1007
- storyLineageId?: string;
1008
- storyVersionNumber?: number;
1009
- /** One state of an announcement. */
1010
- state: "posting" | "posted" | "failed" | "blocked" | "dry_run" | "withdrawn";
1011
- /** The state in plain words, such as Dry run: not sent. */
1012
- label: string;
1013
- blockedReason?: string;
1014
- mode?: string;
1015
- link?: string;
1016
- weight?: number;
1017
- draftedBy?: string;
1018
- checks?: {
1019
- name: string;
1020
- passed: boolean;
1021
- }[];
1022
- postId?: string;
1023
- postedAt?: string;
1024
- /** Dollars Caducus charged on this announcement so far, as a decimal string. */
1025
- cost?: string;
1026
- attempts?: number;
1027
- error?: string;
1028
- history?: {
1029
- at: string;
1030
- by: string;
1031
- state: string;
1032
- note: string;
1033
- }[];
1034
- withdrawnBy?: string;
1035
- createdAt?: string;
1036
- updatedAt?: string;
1037
- })[];
1038
- };
1039
-
1040
- /** Show one Story's announcement: its row, its history, and the post text and checks kept in S3. */
1041
- export type AnnouncementsShowInput = {
1042
- /** The lineage id of the Story. */
1043
- story: string;
1044
- };
1045
-
1046
- export type AnnouncementsShowResult = {
1047
- announcement: {
1048
- id: string;
1049
- accountId?: string;
1050
- storyLineageId?: string;
1051
- storyVersionNumber?: number;
1052
- /** One state of an announcement. */
1053
- state: "posting" | "posted" | "failed" | "blocked" | "dry_run" | "withdrawn";
1054
- /** The state in plain words, such as Dry run: not sent. */
1055
- label: string;
1056
- blockedReason?: string;
1057
- mode?: string;
1058
- link?: string;
1059
- weight?: number;
1060
- draftedBy?: string;
1061
- checks?: {
1062
- name: string;
1063
- passed: boolean;
1064
- }[];
1065
- postId?: string;
1066
- postedAt?: string;
1067
- /** Dollars Caducus charged on this announcement so far, as a decimal string. */
1068
- cost?: string;
1069
- attempts?: number;
1070
- error?: string;
1071
- history?: {
1072
- at: string;
1073
- by: string;
1074
- state: string;
1075
- note: string;
1076
- }[];
1077
- withdrawnBy?: string;
1078
- createdAt?: string;
1079
- updatedAt?: string;
1080
- };
1081
- /** The stored post: text, post, link, weight, model and every check's problems. */
1082
- document?: Record<string, unknown>;
1083
- };
1084
-
1085
993
  /** Build the exact post a Story would get (text, link with its UTM tags, length, every check) without sending or recording anything. */
1086
994
  export type AnnouncementsDryRunInput = {
1087
995
  /** The lineage id of the Story. */
@@ -1102,7 +1010,7 @@ export type AnnouncementsDryRunResult = {
1102
1010
  sent: boolean;
1103
1011
  };
1104
1012
 
1105
- /** Pause announcements: nothing is posted, and eligible Stories wait as Blocked: paused. */
1013
+ /** Pause announcements: nothing is posted, and an X Delivery that comes due waits as Blocked: paused. */
1106
1014
  export type AnnouncementsPauseInput = Record<string, unknown>;
1107
1015
 
1108
1016
  export type AnnouncementsPauseResult = {
@@ -1112,7 +1020,7 @@ export type AnnouncementsPauseResult = {
1112
1020
  pauseReason?: string;
1113
1021
  };
1114
1022
 
1115
- /** Resume announcements and announce the Stories that waited. */
1023
+ /** Resume announcements and put back the X Deliveries that waited. */
1116
1024
  export type AnnouncementsResumeInput = Record<string, unknown>;
1117
1025
 
1118
1026
  export type AnnouncementsResumeResult = {
@@ -1465,7 +1373,7 @@ export type AnnouncementsRecordManualResult = {
1465
1373
  attempt: Record<string, unknown>;
1466
1374
  };
1467
1375
 
1468
- /** Withdraw a Delivery that went: this deletes a public post. */
1376
+ /** Withdraw a Delivery: stop one that has not gone, or take back one that went where the channel can (a post on X is deleted). */
1469
1377
  export type AnnouncementsWithdrawInput = {
1470
1378
  /** The Delivery's id. */
1471
1379
  delivery: string;
@@ -1473,6 +1381,14 @@ export type AnnouncementsWithdrawInput = {
1473
1381
 
1474
1382
  export type AnnouncementsWithdrawResult = {
1475
1383
  id: string;
1384
+ /** The Delivery's state afterwards: withdrawn. */
1385
+ state: string;
1386
+ /** Who withdrew it. */
1387
+ withdrawnBy: string;
1388
+ /** What Caducus has charged for the post in all, deletion included, when a post was deleted. */
1389
+ cost?: string | null;
1390
+ /** The Announcement's state afterwards: withdrawn once every Delivery is, cancelled when none had gone. */
1391
+ announcementState: string;
1476
1392
  };
1477
1393
 
1478
1394
  /** Where a Story was announced: each Announcement that announces it, with one line for each live Delivery. */
@@ -1704,8 +1620,6 @@ export interface ImageOperations {
1704
1620
  guidelines_diff: { input: GuidelinesDiffInput; result: GuidelinesDiffResult };
1705
1621
  guidelines_save: { input: GuidelinesSaveInput; result: GuidelinesSaveResult };
1706
1622
  guidelines_history: { input: GuidelinesHistoryInput; result: GuidelinesHistoryResult };
1707
- announcements_list: { input: AnnouncementsListInput; result: AnnouncementsListResult };
1708
- announcements_show: { input: AnnouncementsShowInput; result: AnnouncementsShowResult };
1709
1623
  announcements_dry_run: { input: AnnouncementsDryRunInput; result: AnnouncementsDryRunResult };
1710
1624
  announcements_pause: { input: AnnouncementsPauseInput; result: AnnouncementsPauseResult };
1711
1625
  announcements_resume: { input: AnnouncementsResumeInput; result: AnnouncementsResumeResult };
@@ -1762,8 +1676,6 @@ export const IMAGE_OPERATIONS = {
1762
1676
  guidelines_diff: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "guidelines", command: "papyrus guidelines diff" },
1763
1677
  guidelines_save: { effect: "write", agentAllowed: true, agentRung: "prepare", agentRefusal: "human_required", group: "guidelines", command: "papyrus guidelines save" },
1764
1678
  guidelines_history: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "guidelines", command: "papyrus guidelines history" },
1765
- announcements_list: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements list" },
1766
- announcements_show: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements show" },
1767
1679
  announcements_dry_run: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements dry-run" },
1768
1680
  announcements_pause: { effect: "write", agentAllowed: true, agentRung: "propose", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements pause" },
1769
1681
  announcements_resume: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements resume" },
@@ -1781,7 +1693,7 @@ export const IMAGE_OPERATIONS = {
1781
1693
  announcements_unlock: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements unlock" },
1782
1694
  announcements_correct: { effect: "write", agentAllowed: true, agentRung: "prepare", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements correct" },
1783
1695
  announcements_record_manual: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements record-manual" },
1784
- announcements_withdraw: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements withdraw" },
1696
+ announcements_withdraw: { effect: "write", agentAllowed: true, agentRung: "prepare", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements withdraw" },
1785
1697
  announcements_where: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements where" },
1786
1698
  announcements_recent: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements recent" },
1787
1699
  announcements_explain: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements explain" },
package/package.json CHANGED
@@ -650,7 +650,7 @@
650
650
  "optional": true
651
651
  }
652
652
  },
653
- "version": "5.135.0-next.5",
653
+ "version": "5.135.0-next.7",
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.135.0-next.5",
2
+ "version": "5.135.0-next.7",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",