@anthusai/papyrus 2.0.0-next.8 → 2.0.0-next.81

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.
Files changed (213) hide show
  1. package/amplify/auth/resource.js +16 -1
  2. package/amplify/auth/resource.ts +19 -1
  3. package/amplify/data/function-handler.js +20 -0
  4. package/amplify/data/function-handler.ts +40 -0
  5. package/amplify/data/resource.js +151 -61
  6. package/amplify/data/resource.ts +157 -61
  7. package/amplify/data/schema.js +2096 -1980
  8. package/amplify/data/schema.ts +198 -69
  9. package/amplify/functions/assignment-action/data-access.js +14 -15
  10. package/amplify/functions/assignment-action/data-access.ts +13 -14
  11. package/amplify/functions/assignment-action/handler.ts +1 -1
  12. package/amplify/functions/automation-view/handler.py +17 -0
  13. package/amplify/functions/automation-view/resource.js +24 -0
  14. package/amplify/functions/automation-view/resource.ts +34 -0
  15. package/amplify/functions/automation-view/schema.js +26 -0
  16. package/amplify/functions/automation-view/schema.ts +28 -0
  17. package/amplify/functions/automation-view/wire.js +56 -0
  18. package/amplify/functions/automation-view/wire.ts +76 -0
  19. package/amplify/functions/content-actions/handler.py +61 -2
  20. package/amplify/functions/content-actions/requirements.txt +1 -0
  21. package/amplify/functions/content-actions/resource.js +1 -1
  22. package/amplify/functions/content-actions/resource.ts +1 -1
  23. package/amplify/{plugins/editorial-checks/function → functions/editorial-checks}/handler.py +3 -3
  24. package/amplify/functions/editorial-checks/requirements.txt +1 -0
  25. package/amplify/{plugins/editorial-checks/function → functions/editorial-checks}/resource.js +7 -7
  26. package/amplify/{plugins/editorial-checks/function → functions/editorial-checks}/resource.ts +7 -7
  27. package/amplify/functions/editorial-checks/schema.js +122 -0
  28. package/amplify/{plugins → functions}/editorial-checks/schema.ts +40 -12
  29. package/amplify/functions/editorial-checks/wire.js +53 -0
  30. package/amplify/functions/editorial-checks/wire.ts +61 -0
  31. package/amplify/functions/monitoring-view/handler.py +11 -0
  32. package/amplify/functions/monitoring-view/resource.js +24 -0
  33. package/amplify/functions/monitoring-view/resource.ts +34 -0
  34. package/amplify/functions/monitoring-view/schema.js +17 -0
  35. package/amplify/functions/monitoring-view/schema.ts +19 -0
  36. package/amplify/functions/monitoring-view/wire.js +37 -0
  37. package/amplify/functions/monitoring-view/wire.ts +47 -0
  38. package/amplify/functions/public-forms/core.js +247 -0
  39. package/amplify/functions/public-forms/core.ts +310 -0
  40. package/amplify/functions/public-forms/handler.ts +41 -0
  41. package/amplify/functions/public-forms/origins.js +35 -0
  42. package/amplify/functions/public-forms/origins.ts +43 -0
  43. package/amplify/functions/public-forms/resource.js +9 -0
  44. package/amplify/functions/public-forms/resource.ts +10 -0
  45. package/amplify/functions/public-forms/wire.js +25 -0
  46. package/amplify/functions/public-forms/wire.ts +32 -0
  47. package/amplify/functions/shared/editorial-context.ts +63 -4
  48. package/amplify/functions/shared/python-bundle.js +20 -14
  49. package/amplify/functions/shared/python-bundle.ts +25 -18
  50. package/amplify/plugins/newsletter/config.js +245 -0
  51. package/amplify/plugins/newsletter/config.ts +305 -0
  52. package/amplify/plugins/newsletter/function/handler.py +6 -0
  53. package/amplify/plugins/newsletter/function/requirements.txt +5 -0
  54. package/amplify/plugins/newsletter/ops/handler.py +12 -0
  55. package/amplify/plugins/newsletter/ops/resource.js +27 -0
  56. package/amplify/plugins/newsletter/ops/resource.ts +37 -0
  57. package/amplify/plugins/newsletter/papyrus.plugin.js +263 -0
  58. package/amplify/plugins/newsletter/papyrus.plugin.ts +311 -0
  59. package/amplify/plugins/newsletter/schema.js +57 -0
  60. package/amplify/plugins/newsletter/schema.ts +62 -0
  61. package/amplify/plugins/newsletter/secure-string-parameter.js +107 -0
  62. package/amplify/plugins/newsletter/secure-string-parameter.ts +120 -0
  63. package/amplify/plugins/newsletter/sending.js +140 -0
  64. package/amplify/plugins/newsletter/sending.ts +186 -0
  65. package/amplify/plugins/reader-steering/config.js +182 -0
  66. package/amplify/plugins/reader-steering/config.ts +290 -0
  67. package/amplify/plugins/reader-steering/function/ai_moderation.py +246 -0
  68. package/amplify/plugins/reader-steering/function/handler.py +1554 -0
  69. package/amplify/plugins/reader-steering/function/moderation-prompt.md +27 -0
  70. package/amplify/plugins/reader-steering/function/moderation.py +316 -0
  71. package/amplify/plugins/reader-steering/function/proposals.py +255 -0
  72. package/amplify/plugins/reader-steering/function/resource.js +27 -0
  73. package/amplify/plugins/reader-steering/function/resource.ts +35 -0
  74. package/amplify/plugins/reader-steering/papyrus.plugin.js +186 -0
  75. package/amplify/plugins/reader-steering/papyrus.plugin.ts +212 -0
  76. package/amplify/plugins/reader-steering/schema.js +205 -0
  77. package/amplify/plugins/reader-steering/schema.ts +207 -0
  78. package/amplify/plugins/registry.js +4 -2
  79. package/amplify/plugins/registry.ts +4 -2
  80. package/amplify/plugins/signup/schema.js +2 -1
  81. package/amplify/plugins/signup/schema.ts +2 -1
  82. package/amplify/plugins/types.ts +5 -0
  83. package/amplify/plugins/wire.js +1 -0
  84. package/amplify/plugins/wire.ts +1 -0
  85. package/amplify/publication/projection-lease.js +30 -0
  86. package/amplify/publication/projection-lease.ts +39 -0
  87. package/amplify/publication/redirect-and-index.js +105 -0
  88. package/amplify/publication/redirect-rules.js +73 -0
  89. package/amplify/publication/redirect-rules.ts +93 -0
  90. package/amplify/publication/s3-projection.js +7 -1
  91. package/amplify/publication/s3-projection.ts +9 -1
  92. package/amplify/site-backend-config.ts +18 -1
  93. package/amplify/site-backend-names.js +4 -2
  94. package/amplify/site-backend-names.ts +4 -2
  95. package/amplify/site-backend.js +45 -3
  96. package/amplify/site-backend.ts +51 -3
  97. package/app/api/auth/prospectus/sign-in/route.ts +4 -0
  98. package/app/api/newsletter/confirm/route.ts +13 -0
  99. package/app/api/newsletter/preferences/route.ts +13 -0
  100. package/app/api/newsletter/state/route.ts +9 -0
  101. package/app/api/newsletter/subscribe/route.ts +9 -0
  102. package/app/api/newsletter/unsubscribe/route.ts +13 -0
  103. package/app/api/newsroom/curation/context/route.ts +9 -0
  104. package/app/api/newsroom/curation/priming/route.ts +9 -0
  105. package/app/api/newsroom/curation/publication/route.ts +9 -0
  106. package/app/api/reader/comment/delete/route.ts +9 -0
  107. package/app/api/reader/comment/edit/route.ts +9 -0
  108. package/app/api/reader/comment/route.ts +9 -0
  109. package/app/api/reader/flag/route.ts +9 -0
  110. package/app/api/reader/handle/route.ts +9 -0
  111. package/app/api/reader/me/route.ts +9 -0
  112. package/app/api/reader/rating/route.ts +9 -0
  113. package/app/api/reader/report/route.ts +9 -0
  114. package/app/api/reader/retired/route.ts +9 -0
  115. package/app/api/reader/submit/route.ts +9 -0
  116. package/app/api/reader/vote/route.ts +9 -0
  117. package/bin/papyrus-infra.mjs +20 -1
  118. package/components/automation-panel.tsx +49 -0
  119. package/components/automation-run-now.tsx +97 -0
  120. package/components/automation-view.tsx +192 -0
  121. package/components/editorial-checks-admin-panel.tsx +36 -11
  122. package/components/moderation-panel.tsx +248 -0
  123. package/components/monitoring-overview-view.tsx +241 -0
  124. package/components/monitoring-panel.tsx +40 -0
  125. package/components/news-desk-client-provider.tsx +18 -18
  126. package/components/news-desk-taxonomy-client.ts +28 -8
  127. package/components/newsletter-panel.tsx +474 -0
  128. package/components/newsletter-sections.tsx +163 -0
  129. package/components/newsroom-access-gate.tsx +15 -1
  130. package/components/newsroom-article-editor.tsx +6 -6
  131. package/components/newsroom-articles-view.tsx +6 -6
  132. package/components/newsroom-board-view.tsx +8 -3
  133. package/components/newsroom-curation-bootstrap.tsx +45 -0
  134. package/components/newsroom-ops-overview.tsx +22 -92
  135. package/components/newsroom-ops-shell.tsx +2 -2
  136. package/components/newsroom-organizer.css +33 -0
  137. package/components/newsroom-overview-skeleton.tsx +25 -0
  138. package/components/newsroom-references-view.tsx +192 -49
  139. package/components/notification-center.tsx +273 -0
  140. package/components/publication-cyclotron-panel.tsx +15 -10
  141. package/components/reader-auth-state.ts +1 -1
  142. package/components/reference-add-entry.tsx +75 -0
  143. package/components/reference-curation-controls.tsx +31 -22
  144. package/components/reference-cyclotron-priming.tsx +58 -19
  145. package/components/reference-cyclotron-suggestion.tsx +10 -6
  146. package/components/reference-priming.tsx +14 -10
  147. package/components/reference-relevance-review.tsx +3 -3
  148. package/components/reference-section-suggestion.tsx +1 -1
  149. package/components/topic-steering-workspace.tsx +223 -144
  150. package/components/use-editorial-checks.ts +12 -10
  151. package/infra/amplify-app-shell.js +94 -16
  152. package/infra/amplify-app-shell.ts +106 -18
  153. package/infra/cloud-email-config.js +32 -0
  154. package/infra/cloud-email-config.ts +39 -0
  155. package/infra/cloud-email.js +57 -0
  156. package/infra/cloud-email.test.js +69 -0
  157. package/infra/cloud-email.test.ts +66 -0
  158. package/infra/cloud-email.ts +60 -0
  159. package/infra/index.js +1 -0
  160. package/infra/secure-string-parameter-handler.js +41 -0
  161. package/infra/secure-string-parameter-handler.ts +41 -0
  162. package/infra/secure-string-parameter.js +79 -0
  163. package/infra/secure-string-parameter.ts +91 -0
  164. package/infra/site-config.js +88 -6
  165. package/infra/site-config.ts +134 -6
  166. package/lib/automation-client.ts +54 -0
  167. package/lib/automation-fixture.ts +93 -0
  168. package/lib/automation-overview.ts +232 -0
  169. package/lib/category-repository.ts +11 -9
  170. package/lib/curation-routes.ts +345 -0
  171. package/lib/cyclotron-suggestions.ts +4 -4
  172. package/lib/editorial-checks-backend.ts +1 -1
  173. package/lib/editorial-checks-client.ts +19 -1
  174. package/lib/editorial-checks-demo.ts +2 -2
  175. package/lib/editorial-checks-settings.ts +3 -0
  176. package/lib/editorial-checks.ts +8 -11
  177. package/lib/editorial-preview.ts +5 -5
  178. package/lib/monitoring-client.ts +29 -0
  179. package/lib/monitoring-overview-fixture.ts +51 -0
  180. package/lib/monitoring-overview.ts +145 -0
  181. package/lib/news-desk-session.ts +12 -21
  182. package/lib/newsletter-api.ts +418 -0
  183. package/lib/newsletter-client.ts +46 -0
  184. package/lib/newsletter-fixture.ts +184 -0
  185. package/lib/newsletter-model.ts +202 -0
  186. package/lib/newsroom-organizer-nav.ts +2 -1
  187. package/lib/prospectus-session.ts +15 -14
  188. package/lib/prospectus-sign-in-routes.ts +84 -19
  189. package/lib/prospectus-site-identity.ts +24 -1
  190. package/lib/reader-api.ts +145 -0
  191. package/lib/reader-moderation.ts +220 -0
  192. package/lib/reader-retirement-route.ts +89 -0
  193. package/lib/reader-subject.md +29 -0
  194. package/lib/reader-subject.ts +53 -0
  195. package/lib/reference-review-details.ts +71 -0
  196. package/lib/reference-review-request.ts +14 -0
  197. package/lib/relevance-decisions.ts +42 -10
  198. package/lib/relevance-status.ts +2 -2
  199. package/lib/review-client.ts +99 -0
  200. package/lib/review-fixture.ts +45 -0
  201. package/lib/review-requests.ts +238 -0
  202. package/lib/semantic-graph.ts +2 -0
  203. package/lib/site-brand-tenant.ts +11 -6
  204. package/lib/site-brand.ts +6 -3
  205. package/lib/site-origin.ts +67 -0
  206. package/lib/use-reference-review-data.ts +44 -0
  207. package/middleware.ts +14 -3
  208. package/package.json +56 -3
  209. package/routes.manifest.json +215 -2
  210. package/amplify/plugins/editorial-checks/function/requirements.txt +0 -1
  211. package/amplify/plugins/editorial-checks/papyrus.plugin.js +0 -71
  212. package/amplify/plugins/editorial-checks/papyrus.plugin.ts +0 -87
  213. package/amplify/plugins/editorial-checks/schema.js +0 -94
@@ -6,13 +6,15 @@ import { knowledgeQuery } from "../functions/knowledge-query/resource.js";
6
6
  import { manageUserRole } from "../functions/manage-user-role/resource.js";
7
7
  import { modelAttachmentUpload } from "../functions/model-attachment-upload/resource.js";
8
8
  import { newsroomSummary } from "../functions/newsroom-summary/resource.js";
9
+ import { publicForms } from "../functions/public-forms/resource.js";
9
10
  import { procedureAction } from "../functions/procedure-action/resource.js";
10
11
  import { readerSettings } from "../functions/reader-settings/resource.js";
11
12
  import { emailSubmissionProcessor } from "../functions/email-submission-processor/resource.js";
12
13
  import { sesInboundReceive } from "../functions/ses-inbound-receive/resource.js";
13
14
  import { slackDelivery } from "../functions/slack-delivery/resource.js";
14
15
  import { slackEvents } from "../functions/slack-events/resource.js";
15
- import { schema as leanSchema, schemaWithPlugins } from "./schema.js";
16
+ import { assertKnownModelGroups, schema as leanSchema, schemaExcludingGroups, schemaWithPlugins } from "./schema.js";
17
+ import { functionHandler, sharedFunctions } from "./function-handler.js";
16
18
  const authoringOperations = [
17
19
  "read",
18
20
  "create",
@@ -135,7 +137,7 @@ const schema = a.schema({
135
137
  .query()
136
138
  .returns(a.ref("UserDirectoryResult"))
137
139
  .authorization((allow) => [allow.group(adminGroup)])
138
- .handler(a.handler.function(manageUserRole)),
140
+ .handler(functionHandler("manageUserRole", manageUserRole)),
139
141
  grantUserRole: a
140
142
  .mutation()
141
143
  .arguments({
@@ -146,7 +148,7 @@ const schema = a.schema({
146
148
  })
147
149
  .returns(a.ref("UserRoleMutationResult"))
148
150
  .authorization((allow) => [allow.group(adminGroup)])
149
- .handler(a.handler.function(manageUserRole)),
151
+ .handler(functionHandler("manageUserRole", manageUserRole)),
150
152
  revokeUserRole: a
151
153
  .mutation()
152
154
  .arguments({
@@ -157,7 +159,7 @@ const schema = a.schema({
157
159
  })
158
160
  .returns(a.ref("UserRoleMutationResult"))
159
161
  .authorization((allow) => [allow.group(adminGroup)])
160
- .handler(a.handler.function(manageUserRole)),
162
+ .handler(functionHandler("manageUserRole", manageUserRole)),
161
163
  mergeUserProfiles: a
162
164
  .mutation()
163
165
  .arguments({
@@ -169,12 +171,12 @@ const schema = a.schema({
169
171
  })
170
172
  .returns(a.ref("UserDirectoryEntry"))
171
173
  .authorization((allow) => [allow.group(adminGroup)])
172
- .handler(a.handler.function(manageUserRole)),
174
+ .handler(functionHandler("manageUserRole", manageUserRole)),
173
175
  getReaderSettings: a
174
176
  .query()
175
177
  .returns(a.ref("ReaderSettingsResult"))
176
178
  .authorization((allow) => [allow.authenticated()])
177
- .handler(a.handler.function(readerSettings)),
179
+ .handler(functionHandler("readerSettings", readerSettings)),
178
180
  updateReaderSettings: a
179
181
  .mutation()
180
182
  .arguments({
@@ -182,7 +184,7 @@ const schema = a.schema({
182
184
  })
183
185
  .returns(a.ref("ReaderSettingsResult"))
184
186
  .authorization((allow) => [allow.authenticated()])
185
- .handler(a.handler.function(readerSettings)),
187
+ .handler(functionHandler("readerSettings", readerSettings)),
186
188
  SteeringActionResult: a.customType({
187
189
  ok: a.boolean().required(),
188
190
  action: a.string().required(),
@@ -210,7 +212,7 @@ const schema = a.schema({
210
212
  })
211
213
  .returns(a.ref("SteeringActionResult"))
212
214
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
213
- .handler(a.handler.function(categoryAction)),
215
+ .handler(functionHandler("categoryAction", categoryAction)),
214
216
  CurationDelegationResult: a.customType({
215
217
  ok: a.boolean().required(),
216
218
  delegationId: a.id().required(),
@@ -323,7 +325,7 @@ const schema = a.schema({
323
325
  .authorization((allow) => [
324
326
  allow.groups(categoryWriteGroups),
325
327
  ])
326
- .handler(a.handler.function(categoryAction)),
328
+ .handler(functionHandler("categoryAction", categoryAction)),
327
329
  createCurationDelegation: a
328
330
  .mutation()
329
331
  .arguments({
@@ -334,7 +336,7 @@ const schema = a.schema({
334
336
  .authorization((allow) => [
335
337
  allow.groups(categoryWriteGroups),
336
338
  ])
337
- .handler(a.handler.function(categoryAction)),
339
+ .handler(functionHandler("categoryAction", categoryAction)),
338
340
  revokeCurationDelegation: a
339
341
  .mutation()
340
342
  .arguments({
@@ -344,14 +346,14 @@ const schema = a.schema({
344
346
  .authorization((allow) => [
345
347
  allow.groups(categoryWriteGroups),
346
348
  ])
347
- .handler(a.handler.function(categoryAction)),
349
+ .handler(functionHandler("categoryAction", categoryAction)),
348
350
  listCurationDelegations: a
349
351
  .query()
350
352
  .returns(a.ref("CurationDelegationResult").array())
351
353
  .authorization((allow) => [
352
354
  allow.groups(categoryWriteGroups),
353
355
  ])
354
- .handler(a.handler.function(categoryAction)),
356
+ .handler(functionHandler("categoryAction", categoryAction)),
355
357
  requestCurationDelegation: a
356
358
  .mutation()
357
359
  .arguments({
@@ -364,7 +366,7 @@ const schema = a.schema({
364
366
  .authorization((allow) => [
365
367
  allow.authenticated("identityPool"),
366
368
  ])
367
- .handler(a.handler.function(categoryAction)),
369
+ .handler(functionHandler("categoryAction", categoryAction)),
368
370
  approveCurationDelegation: a
369
371
  .mutation()
370
372
  .arguments({
@@ -374,7 +376,7 @@ const schema = a.schema({
374
376
  .authorization((allow) => [
375
377
  allow.groups(categoryWriteGroups),
376
378
  ])
377
- .handler(a.handler.function(categoryAction)),
379
+ .handler(functionHandler("categoryAction", categoryAction)),
378
380
  denyCurationDelegation: a
379
381
  .mutation()
380
382
  .arguments({
@@ -384,7 +386,7 @@ const schema = a.schema({
384
386
  .authorization((allow) => [
385
387
  allow.groups(categoryWriteGroups),
386
388
  ])
387
- .handler(a.handler.function(categoryAction)),
389
+ .handler(functionHandler("categoryAction", categoryAction)),
388
390
  getCurationDelegationStatus: a
389
391
  .query()
390
392
  .arguments({
@@ -394,7 +396,7 @@ const schema = a.schema({
394
396
  .authorization((allow) => [
395
397
  allow.authenticated("identityPool"),
396
398
  ])
397
- .handler(a.handler.function(categoryAction)),
399
+ .handler(functionHandler("categoryAction", categoryAction)),
398
400
  recordDelegatedCuration: a
399
401
  .mutation()
400
402
  .arguments({
@@ -415,7 +417,7 @@ const schema = a.schema({
415
417
  .authorization((allow) => [
416
418
  allow.authenticated("identityPool"),
417
419
  ])
418
- .handler(a.handler.function(categoryAction)),
420
+ .handler(functionHandler("categoryAction", categoryAction)),
419
421
  setReferenceQualityRating: a
420
422
  .mutation()
421
423
  .arguments({
@@ -429,7 +431,7 @@ const schema = a.schema({
429
431
  .authorization((allow) => [
430
432
  allow.groups(categoryWriteGroups),
431
433
  ])
432
- .handler(a.handler.function(categoryAction)),
434
+ .handler(functionHandler("categoryAction", categoryAction)),
433
435
  createReferenceNote: a
434
436
  .mutation()
435
437
  .arguments({
@@ -443,7 +445,7 @@ const schema = a.schema({
443
445
  .authorization((allow) => [
444
446
  allow.groups(categoryWriteGroups),
445
447
  ])
446
- .handler(a.handler.function(categoryAction)),
448
+ .handler(functionHandler("categoryAction", categoryAction)),
447
449
  moveReferenceCorpus: a
448
450
  .mutation()
449
451
  .arguments({
@@ -457,7 +459,7 @@ const schema = a.schema({
457
459
  .authorization((allow) => [
458
460
  allow.groups(categoryWriteGroups),
459
461
  ])
460
- .handler(a.handler.function(categoryAction)),
462
+ .handler(functionHandler("categoryAction", categoryAction)),
461
463
  startReferenceCuration: a
462
464
  .mutation()
463
465
  .arguments({
@@ -470,7 +472,7 @@ const schema = a.schema({
470
472
  .authorization((allow) => [
471
473
  allow.groups(categoryWriteGroups),
472
474
  ])
473
- .handler(a.handler.function(categoryAction)),
475
+ .handler(functionHandler("categoryAction", categoryAction)),
474
476
  getReferenceCurationStatus: a
475
477
  .query()
476
478
  .arguments({
@@ -480,7 +482,7 @@ const schema = a.schema({
480
482
  .authorization((allow) => [
481
483
  allow.groups(categoryWriteGroups),
482
484
  ])
483
- .handler(a.handler.function(categoryAction)),
485
+ .handler(functionHandler("categoryAction", categoryAction)),
484
486
  createCategorySetDraft: a
485
487
  .mutation()
486
488
  .arguments({
@@ -491,7 +493,7 @@ const schema = a.schema({
491
493
  })
492
494
  .returns(a.ref("CategorySetDraftActionResult"))
493
495
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
494
- .handler(a.handler.function(categoryAction)),
496
+ .handler(functionHandler("categoryAction", categoryAction)),
495
497
  promoteCategorySetDraft: a
496
498
  .mutation()
497
499
  .arguments({
@@ -501,7 +503,7 @@ const schema = a.schema({
501
503
  })
502
504
  .returns(a.ref("CategorySetDraftActionResult"))
503
505
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
504
- .handler(a.handler.function(categoryAction)),
506
+ .handler(functionHandler("categoryAction", categoryAction)),
505
507
  discardCategorySetDraft: a
506
508
  .mutation()
507
509
  .arguments({
@@ -511,7 +513,7 @@ const schema = a.schema({
511
513
  })
512
514
  .returns(a.ref("CategorySetDraftActionResult"))
513
515
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
514
- .handler(a.handler.function(categoryAction)),
516
+ .handler(functionHandler("categoryAction", categoryAction)),
515
517
  createDraftCategory: a
516
518
  .mutation()
517
519
  .arguments({
@@ -526,7 +528,7 @@ const schema = a.schema({
526
528
  })
527
529
  .returns(a.ref("SteeringActionResult"))
528
530
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
529
- .handler(a.handler.function(categoryAction)),
531
+ .handler(functionHandler("categoryAction", categoryAction)),
530
532
  updateDraftCategory: a
531
533
  .mutation()
532
534
  .arguments({
@@ -541,7 +543,7 @@ const schema = a.schema({
541
543
  })
542
544
  .returns(a.ref("SteeringActionResult"))
543
545
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
544
- .handler(a.handler.function(categoryAction)),
546
+ .handler(functionHandler("categoryAction", categoryAction)),
545
547
  archiveDraftCategory: a
546
548
  .mutation()
547
549
  .arguments({
@@ -551,7 +553,7 @@ const schema = a.schema({
551
553
  })
552
554
  .returns(a.ref("SteeringActionResult"))
553
555
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
554
- .handler(a.handler.function(categoryAction)),
556
+ .handler(functionHandler("categoryAction", categoryAction)),
555
557
  reviewReferenceTopicLabel: a
556
558
  .mutation()
557
559
  .arguments({
@@ -564,7 +566,7 @@ const schema = a.schema({
564
566
  })
565
567
  .returns(a.ref("TopicLabelActionResult"))
566
568
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
567
- .handler(a.handler.function(categoryAction)),
569
+ .handler(functionHandler("categoryAction", categoryAction)),
568
570
  NewsroomSummary: a.customType({
569
571
  generatedAt: a.datetime().required(),
570
572
  staleAt: a.datetime(),
@@ -582,37 +584,49 @@ const schema = a.schema({
582
584
  .query()
583
585
  .returns(a.ref("NewsroomSummary"))
584
586
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
585
- .handler(a.handler.function(newsroomSummary)),
587
+ .handler(functionHandler("newsroomSummary", newsroomSummary)),
586
588
  deriveMarkus: a
587
589
  .query()
588
590
  .arguments({ input: a.json().required() })
589
591
  .returns(a.json())
590
592
  .authorization((allow) => [allow.groups(contentWriteGroups)])
591
- .handler(a.handler.function(contentActions)),
593
+ .handler(functionHandler("contentActions", contentActions)),
594
+ intakePendingReferences: a
595
+ .mutation()
596
+ .arguments({ input: a.json().required() })
597
+ .returns(a.json())
598
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
599
+ .handler(functionHandler("contentActions", contentActions)),
592
600
  saveItemDraft: a
593
601
  .mutation()
594
602
  .arguments({ input: a.json().required() })
595
603
  .returns(a.json())
596
604
  .authorization((allow) => [allow.groups(contentWriteGroups)])
597
- .handler(a.handler.function(contentActions)),
605
+ .handler(functionHandler("contentActions", contentActions)),
598
606
  publishItem: a
599
607
  .mutation()
600
608
  .arguments({ input: a.json().required() })
601
609
  .returns(a.json())
602
610
  .authorization((allow) => [allow.groups(contentWriteGroups)])
603
- .handler(a.handler.function(contentActions)),
611
+ .handler(functionHandler("contentActions", contentActions)),
612
+ moveStoryStage: a
613
+ .mutation()
614
+ .arguments({ input: a.json().required() })
615
+ .returns(a.json())
616
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
617
+ .handler(functionHandler("contentActions", contentActions)),
604
618
  unpublishItem: a
605
619
  .mutation()
606
620
  .arguments({ input: a.json().required() })
607
621
  .returns(a.json())
608
622
  .authorization((allow) => [allow.groups(contentWriteGroups)])
609
- .handler(a.handler.function(contentActions)),
623
+ .handler(functionHandler("contentActions", contentActions)),
610
624
  requestStagingBuild: a
611
625
  .mutation()
612
626
  .arguments({ input: a.json().required() })
613
627
  .returns(a.json())
614
628
  .authorization((allow) => [allow.groups(contentWriteGroups)])
615
- .handler(a.handler.function(contentActions)),
629
+ .handler(functionHandler("contentActions", contentActions)),
616
630
  knowledgeQuery: a
617
631
  .query()
618
632
  .arguments({
@@ -620,7 +634,7 @@ const schema = a.schema({
620
634
  })
621
635
  .returns(a.json())
622
636
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
623
- .handler(a.handler.function(knowledgeQuery)),
637
+ .handler(functionHandler("knowledgeQuery", knowledgeQuery)),
624
638
  updateNewsroomSummary: a
625
639
  .mutation()
626
640
  .arguments({
@@ -630,7 +644,7 @@ const schema = a.schema({
630
644
  })
631
645
  .returns(a.ref("NewsroomSummary"))
632
646
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
633
- .handler(a.handler.function(newsroomSummary)),
647
+ .handler(functionHandler("newsroomSummary", newsroomSummary)),
634
648
  ModelAttachmentUploadSlot: a.customType({
635
649
  ok: a.boolean().required(),
636
650
  uploadId: a.string().required(),
@@ -686,7 +700,7 @@ const schema = a.schema({
686
700
  })
687
701
  .returns(a.ref("ModelAttachmentUploadSlot"))
688
702
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
689
- .handler(a.handler.function(modelAttachmentUpload)),
703
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
690
704
  completeModelAttachmentUpload: a
691
705
  .mutation()
692
706
  .arguments({
@@ -707,7 +721,7 @@ const schema = a.schema({
707
721
  })
708
722
  .returns(a.ref("ModelAttachment"))
709
723
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
710
- .handler(a.handler.function(modelAttachmentUpload)),
724
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
711
725
  abortModelAttachmentUpload: a
712
726
  .mutation()
713
727
  .arguments({
@@ -728,7 +742,7 @@ const schema = a.schema({
728
742
  })
729
743
  .returns(a.ref("ModelAttachmentUploadAbortResult"))
730
744
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
731
- .handler(a.handler.function(modelAttachmentUpload)),
745
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
732
746
  createModelAttachmentDownload: a
733
747
  .mutation()
734
748
  .arguments({
@@ -736,7 +750,7 @@ const schema = a.schema({
736
750
  })
737
751
  .returns(a.ref("ModelAttachmentDownloadSlot"))
738
752
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
739
- .handler(a.handler.function(modelAttachmentUpload)),
753
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
740
754
  AssignmentActionResult: a.customType({
741
755
  ok: a.boolean().required(),
742
756
  assignmentId: a.id(),
@@ -824,7 +838,7 @@ const schema = a.schema({
824
838
  })
825
839
  .returns(a.ref("AssignmentContext").array().required())
826
840
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
827
- .handler(a.handler.function(assignmentAction)),
841
+ .handler(functionHandler("assignmentAction", assignmentAction)),
828
842
  listAssignmentQueue: a
829
843
  .query()
830
844
  .arguments({
@@ -834,7 +848,7 @@ const schema = a.schema({
834
848
  })
835
849
  .returns(a.ref("AssignmentContext").array().required())
836
850
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
837
- .handler(a.handler.function(assignmentAction)),
851
+ .handler(functionHandler("assignmentAction", assignmentAction)),
838
852
  getEditorialContext: a
839
853
  .query()
840
854
  .arguments({
@@ -843,10 +857,11 @@ const schema = a.schema({
843
857
  storyLineageId: a.id(),
844
858
  assignmentId: a.id(),
845
859
  maxCharacters: a.integer(),
860
+ optionalPublicationDoctrine: a.boolean(),
846
861
  })
847
862
  .returns(a.json().required())
848
863
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
849
- .handler(a.handler.function(assignmentAction)),
864
+ .handler(functionHandler("assignmentAction", assignmentAction)),
850
865
  getAssignmentContext: a
851
866
  .query()
852
867
  .arguments({
@@ -854,7 +869,7 @@ const schema = a.schema({
854
869
  })
855
870
  .returns(a.ref("AssignmentContext"))
856
871
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
857
- .handler(a.handler.function(assignmentAction)),
872
+ .handler(functionHandler("assignmentAction", assignmentAction)),
858
873
  claimAssignment: a
859
874
  .mutation()
860
875
  .arguments({
@@ -870,7 +885,7 @@ const schema = a.schema({
870
885
  })
871
886
  .returns(a.ref("AssignmentActionResult"))
872
887
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
873
- .handler(a.handler.function(assignmentAction)),
888
+ .handler(functionHandler("assignmentAction", assignmentAction)),
874
889
  releaseAssignment: a
875
890
  .mutation()
876
891
  .arguments({
@@ -881,7 +896,7 @@ const schema = a.schema({
881
896
  })
882
897
  .returns(a.ref("AssignmentActionResult"))
883
898
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
884
- .handler(a.handler.function(assignmentAction)),
899
+ .handler(functionHandler("assignmentAction", assignmentAction)),
885
900
  completeAssignment: a
886
901
  .mutation()
887
902
  .arguments({
@@ -892,7 +907,7 @@ const schema = a.schema({
892
907
  })
893
908
  .returns(a.ref("AssignmentActionResult"))
894
909
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
895
- .handler(a.handler.function(assignmentAction)),
910
+ .handler(functionHandler("assignmentAction", assignmentAction)),
896
911
  cancelAssignment: a
897
912
  .mutation()
898
913
  .arguments({
@@ -903,7 +918,7 @@ const schema = a.schema({
903
918
  })
904
919
  .returns(a.ref("AssignmentActionResult"))
905
920
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
906
- .handler(a.handler.function(assignmentAction)),
921
+ .handler(functionHandler("assignmentAction", assignmentAction)),
907
922
  reopenAssignment: a
908
923
  .mutation()
909
924
  .arguments({
@@ -914,7 +929,7 @@ const schema = a.schema({
914
929
  })
915
930
  .returns(a.ref("AssignmentActionResult"))
916
931
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
917
- .handler(a.handler.function(assignmentAction)),
932
+ .handler(functionHandler("assignmentAction", assignmentAction)),
918
933
  retryImmediateAssignment: a
919
934
  .mutation()
920
935
  .arguments({
@@ -925,12 +940,12 @@ const schema = a.schema({
925
940
  })
926
941
  .returns(a.ref("AssignmentActionResult"))
927
942
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
928
- .handler(a.handler.function(assignmentAction)),
943
+ .handler(functionHandler("assignmentAction", assignmentAction)),
929
944
  listNewsroomProcedureDefinitions: a
930
945
  .query()
931
946
  .returns(a.json())
932
947
  .authorization((allow) => [allow.group(adminGroup)])
933
- .handler(a.handler.function(procedureAction)),
948
+ .handler(functionHandler("procedureAction", procedureAction)),
934
949
  getNewsroomProcedureDefinition: a
935
950
  .query()
936
951
  .arguments({
@@ -939,7 +954,7 @@ const schema = a.schema({
939
954
  })
940
955
  .returns(a.json())
941
956
  .authorization((allow) => [allow.group(adminGroup)])
942
- .handler(a.handler.function(procedureAction)),
957
+ .handler(functionHandler("procedureAction", procedureAction)),
943
958
  saveNewsroomProcedureDefinition: a
944
959
  .mutation()
945
960
  .arguments({
@@ -947,7 +962,7 @@ const schema = a.schema({
947
962
  })
948
963
  .returns(a.json())
949
964
  .authorization((allow) => [allow.group(adminGroup)])
950
- .handler(a.handler.function(procedureAction)),
965
+ .handler(functionHandler("procedureAction", procedureAction)),
951
966
  saveNewsroomProcedureVersionDraft: a
952
967
  .mutation()
953
968
  .arguments({
@@ -955,7 +970,7 @@ const schema = a.schema({
955
970
  })
956
971
  .returns(a.json())
957
972
  .authorization((allow) => [allow.group(adminGroup)])
958
- .handler(a.handler.function(procedureAction)),
973
+ .handler(functionHandler("procedureAction", procedureAction)),
959
974
  publishNewsroomProcedureVersion: a
960
975
  .mutation()
961
976
  .arguments({
@@ -963,7 +978,7 @@ const schema = a.schema({
963
978
  })
964
979
  .returns(a.json())
965
980
  .authorization((allow) => [allow.group(adminGroup)])
966
- .handler(a.handler.function(procedureAction)),
981
+ .handler(functionHandler("procedureAction", procedureAction)),
967
982
  startNewsroomProcedureRun: a
968
983
  .mutation()
969
984
  .arguments({
@@ -977,7 +992,7 @@ const schema = a.schema({
977
992
  })
978
993
  .returns(a.json())
979
994
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
980
- .handler(a.handler.function(procedureAction)),
995
+ .handler(functionHandler("procedureAction", procedureAction)),
981
996
  getNewsroomProcedureRun: a
982
997
  .query()
983
998
  .arguments({
@@ -985,7 +1000,7 @@ const schema = a.schema({
985
1000
  })
986
1001
  .returns(a.json())
987
1002
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
988
- .handler(a.handler.function(procedureAction)),
1003
+ .handler(functionHandler("procedureAction", procedureAction)),
989
1004
  listNewsroomProcedureRunsByProcedure: a
990
1005
  .query()
991
1006
  .arguments({
@@ -993,7 +1008,7 @@ const schema = a.schema({
993
1008
  })
994
1009
  .returns(a.json())
995
1010
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
996
- .handler(a.handler.function(procedureAction)),
1011
+ .handler(functionHandler("procedureAction", procedureAction)),
997
1012
  Assignment: a
998
1013
  .model({
999
1014
  id: a.id().required(),
@@ -1138,6 +1153,8 @@ const schema = a.schema({
1138
1153
  error: a.json(),
1139
1154
  attempt: a.integer(),
1140
1155
  newsroomFeedKey: a.string(),
1156
+ usage: a.json(),
1157
+ costUsd: a.float(),
1141
1158
  })
1142
1159
  .secondaryIndexes((index) => [
1143
1160
  index("procedureId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByProcedureAndRequestedAt"),
@@ -1149,6 +1166,73 @@ const schema = a.schema({
1149
1166
  allow.group("editor").to(["read"]),
1150
1167
  allow.group(adminGroup).to(authoringOperations),
1151
1168
  ]),
1169
+ Automation: a
1170
+ .model({
1171
+ id: a.id().required(),
1172
+ title: a.string().required(),
1173
+ description: a.string(),
1174
+ enabled: a.boolean().required(),
1175
+ trigger: a.json().required(),
1176
+ procedureKey: a.string().required(),
1177
+ inputTemplate: a.json(),
1178
+ limits: a.json(),
1179
+ createdBy: a.string(),
1180
+ createdAt: a.datetime().required(),
1181
+ updatedBy: a.string(),
1182
+ updatedAt: a.datetime().required(),
1183
+ })
1184
+ .authorization((allow) => [
1185
+ allow.group("editor").to(["read", "create", "update"]),
1186
+ allow.group(adminGroup).to(authoringOperations),
1187
+ ]),
1188
+ /** A human review point raised by a step on any item (PPY-ab6a50). Review is not a story state. */
1189
+ ReviewRequest: a
1190
+ .model({
1191
+ id: a.id().required(),
1192
+ subject: a.json().required(),
1193
+ mode: a.string().required(),
1194
+ reason: a.string().required(),
1195
+ ask: a.string(),
1196
+ raisedBy: a.string().required(),
1197
+ raisedAt: a.datetime().required(),
1198
+ deadline: a.datetime(),
1199
+ state: a.string().required(),
1200
+ answer: a.json(),
1201
+ links: a.json(),
1202
+ history: a.json(),
1203
+ appliedIn: a.json(),
1204
+ updatedAt: a.datetime().required(),
1205
+ })
1206
+ .authorization((allow) => [
1207
+ allow.group("editor").to(["read", "create", "update"]),
1208
+ allow.group(adminGroup).to(authoringOperations),
1209
+ ]),
1210
+ /** One user's read mark on one review request; id is "<userKey>#<requestId>". */
1211
+ ReviewReadMark: a
1212
+ .model({
1213
+ id: a.id().required(),
1214
+ requestId: a.string().required(),
1215
+ userKey: a.string().required(),
1216
+ readAt: a.datetime().required(),
1217
+ })
1218
+ .authorization((allow) => [
1219
+ allow.groups(["editor", adminGroup]).to(["read", "create", "update"]),
1220
+ ]),
1221
+ /** Who is told about review requests: scope default, mode or automation. Changed by data, not code. */
1222
+ ReviewRecipientRule: a
1223
+ .model({
1224
+ id: a.id().required(),
1225
+ scope: a.string().required(),
1226
+ key: a.string(),
1227
+ roles: a.string().array(),
1228
+ emails: a.string().array(),
1229
+ updatedBy: a.string(),
1230
+ updatedAt: a.datetime().required(),
1231
+ })
1232
+ .authorization((allow) => [
1233
+ allow.group("editor").to(["read"]),
1234
+ allow.group(adminGroup).to(authoringOperations),
1235
+ ]),
1152
1236
  NewsroomSection: a
1153
1237
  .model({
1154
1238
  id: a.id().required(),
@@ -2153,6 +2237,7 @@ const schema = a.schema({
2153
2237
  allow.resource(modelAttachmentUpload),
2154
2238
  allow.resource(newsroomSummary),
2155
2239
  allow.resource(procedureAction),
2240
+ allow.resource(publicForms).to(["mutate"]),
2156
2241
  allow.resource(sesInboundReceive),
2157
2242
  allow.resource(emailSubmissionProcessor),
2158
2243
  allow.resource(slackEvents),
@@ -2162,10 +2247,15 @@ const schema = a.schema({
2162
2247
  * The site's data API. Amplify allows one `defineData` per backend and registers it when called, so this is
2163
2248
  * a function: a site without plugins passes none and gets exactly the base schema.
2164
2249
  */
2165
- export function defineSiteData(pluginDefinitions = {}) {
2250
+ export function defineSiteData(pluginDefinitions = {}, excludeModelGroups = []) {
2251
+ assertKnownModelGroups(excludeModelGroups);
2252
+ const hasPlugins = Object.keys(pluginDefinitions).length > 0;
2166
2253
  return defineData({
2167
2254
  name: "PapyrusCmsApi",
2168
- schema: Object.keys(pluginDefinitions).length === 0 ? leanSchema : schemaWithPlugins(pluginDefinitions),
2255
+ functions: sharedFunctions(),
2256
+ schema: excludeModelGroups.length > 0
2257
+ ? schemaExcludingGroups(excludeModelGroups, pluginDefinitions)
2258
+ : hasPlugins ? schemaWithPlugins(pluginDefinitions) : leanSchema,
2169
2259
  authorizationModes: {
2170
2260
  defaultAuthorizationMode: "userPool",
2171
2261
  apiKeyAuthorizationMode: {