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

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 (211) hide show
  1. package/amplify/data/function-handler.js +20 -0
  2. package/amplify/data/function-handler.ts +40 -0
  3. package/amplify/data/resource.js +151 -61
  4. package/amplify/data/resource.ts +157 -61
  5. package/amplify/data/schema.js +2096 -1980
  6. package/amplify/data/schema.ts +198 -69
  7. package/amplify/functions/assignment-action/data-access.js +14 -15
  8. package/amplify/functions/assignment-action/data-access.ts +13 -14
  9. package/amplify/functions/assignment-action/handler.ts +1 -1
  10. package/amplify/functions/automation-view/handler.py +17 -0
  11. package/amplify/functions/automation-view/resource.js +24 -0
  12. package/amplify/functions/automation-view/resource.ts +34 -0
  13. package/amplify/functions/automation-view/schema.js +26 -0
  14. package/amplify/functions/automation-view/schema.ts +28 -0
  15. package/amplify/functions/automation-view/wire.js +56 -0
  16. package/amplify/functions/automation-view/wire.ts +76 -0
  17. package/amplify/functions/content-actions/handler.py +61 -2
  18. package/amplify/functions/content-actions/requirements.txt +1 -0
  19. package/amplify/functions/content-actions/resource.js +1 -1
  20. package/amplify/functions/content-actions/resource.ts +1 -1
  21. package/amplify/{plugins/editorial-checks/function → functions/editorial-checks}/handler.py +3 -3
  22. package/amplify/functions/editorial-checks/requirements.txt +1 -0
  23. package/amplify/{plugins/editorial-checks/function → functions/editorial-checks}/resource.js +7 -7
  24. package/amplify/{plugins/editorial-checks/function → functions/editorial-checks}/resource.ts +7 -7
  25. package/amplify/functions/editorial-checks/schema.js +122 -0
  26. package/amplify/{plugins → functions}/editorial-checks/schema.ts +40 -12
  27. package/amplify/functions/editorial-checks/wire.js +53 -0
  28. package/amplify/functions/editorial-checks/wire.ts +61 -0
  29. package/amplify/functions/monitoring-view/handler.py +11 -0
  30. package/amplify/functions/monitoring-view/resource.js +24 -0
  31. package/amplify/functions/monitoring-view/resource.ts +34 -0
  32. package/amplify/functions/monitoring-view/schema.js +17 -0
  33. package/amplify/functions/monitoring-view/schema.ts +19 -0
  34. package/amplify/functions/monitoring-view/wire.js +37 -0
  35. package/amplify/functions/monitoring-view/wire.ts +47 -0
  36. package/amplify/functions/public-forms/core.js +247 -0
  37. package/amplify/functions/public-forms/core.ts +310 -0
  38. package/amplify/functions/public-forms/handler.ts +41 -0
  39. package/amplify/functions/public-forms/origins.js +35 -0
  40. package/amplify/functions/public-forms/origins.ts +43 -0
  41. package/amplify/functions/public-forms/resource.js +9 -0
  42. package/amplify/functions/public-forms/resource.ts +10 -0
  43. package/amplify/functions/public-forms/wire.js +25 -0
  44. package/amplify/functions/public-forms/wire.ts +32 -0
  45. package/amplify/functions/shared/editorial-context.ts +63 -4
  46. package/amplify/functions/shared/python-bundle.js +20 -14
  47. package/amplify/functions/shared/python-bundle.ts +25 -18
  48. package/amplify/plugins/newsletter/config.js +245 -0
  49. package/amplify/plugins/newsletter/config.ts +305 -0
  50. package/amplify/plugins/newsletter/function/handler.py +6 -0
  51. package/amplify/plugins/newsletter/function/requirements.txt +5 -0
  52. package/amplify/plugins/newsletter/ops/handler.py +12 -0
  53. package/amplify/plugins/newsletter/ops/resource.js +27 -0
  54. package/amplify/plugins/newsletter/ops/resource.ts +37 -0
  55. package/amplify/plugins/newsletter/papyrus.plugin.js +263 -0
  56. package/amplify/plugins/newsletter/papyrus.plugin.ts +311 -0
  57. package/amplify/plugins/newsletter/schema.js +57 -0
  58. package/amplify/plugins/newsletter/schema.ts +62 -0
  59. package/amplify/plugins/newsletter/secure-string-parameter.js +107 -0
  60. package/amplify/plugins/newsletter/secure-string-parameter.ts +120 -0
  61. package/amplify/plugins/newsletter/sending.js +140 -0
  62. package/amplify/plugins/newsletter/sending.ts +186 -0
  63. package/amplify/plugins/reader-steering/config.js +182 -0
  64. package/amplify/plugins/reader-steering/config.ts +290 -0
  65. package/amplify/plugins/reader-steering/function/ai_moderation.py +246 -0
  66. package/amplify/plugins/reader-steering/function/handler.py +1554 -0
  67. package/amplify/plugins/reader-steering/function/moderation-prompt.md +27 -0
  68. package/amplify/plugins/reader-steering/function/moderation.py +316 -0
  69. package/amplify/plugins/reader-steering/function/proposals.py +255 -0
  70. package/amplify/plugins/reader-steering/function/resource.js +27 -0
  71. package/amplify/plugins/reader-steering/function/resource.ts +35 -0
  72. package/amplify/plugins/reader-steering/papyrus.plugin.js +186 -0
  73. package/amplify/plugins/reader-steering/papyrus.plugin.ts +212 -0
  74. package/amplify/plugins/reader-steering/schema.js +205 -0
  75. package/amplify/plugins/reader-steering/schema.ts +207 -0
  76. package/amplify/plugins/registry.js +4 -2
  77. package/amplify/plugins/registry.ts +4 -2
  78. package/amplify/plugins/signup/schema.js +2 -1
  79. package/amplify/plugins/signup/schema.ts +2 -1
  80. package/amplify/plugins/types.ts +5 -0
  81. package/amplify/plugins/wire.js +1 -0
  82. package/amplify/plugins/wire.ts +1 -0
  83. package/amplify/publication/projection-lease.js +30 -0
  84. package/amplify/publication/projection-lease.ts +39 -0
  85. package/amplify/publication/redirect-and-index.js +105 -0
  86. package/amplify/publication/redirect-rules.js +73 -0
  87. package/amplify/publication/redirect-rules.ts +93 -0
  88. package/amplify/publication/s3-projection.js +7 -1
  89. package/amplify/publication/s3-projection.ts +9 -1
  90. package/amplify/site-backend-config.ts +18 -1
  91. package/amplify/site-backend-names.js +4 -2
  92. package/amplify/site-backend-names.ts +4 -2
  93. package/amplify/site-backend.js +41 -2
  94. package/amplify/site-backend.ts +46 -2
  95. package/app/api/auth/prospectus/sign-in/route.ts +4 -0
  96. package/app/api/newsletter/confirm/route.ts +13 -0
  97. package/app/api/newsletter/preferences/route.ts +13 -0
  98. package/app/api/newsletter/state/route.ts +9 -0
  99. package/app/api/newsletter/subscribe/route.ts +9 -0
  100. package/app/api/newsletter/unsubscribe/route.ts +13 -0
  101. package/app/api/newsroom/curation/context/route.ts +9 -0
  102. package/app/api/newsroom/curation/priming/route.ts +9 -0
  103. package/app/api/newsroom/curation/publication/route.ts +9 -0
  104. package/app/api/reader/comment/delete/route.ts +9 -0
  105. package/app/api/reader/comment/edit/route.ts +9 -0
  106. package/app/api/reader/comment/route.ts +9 -0
  107. package/app/api/reader/flag/route.ts +9 -0
  108. package/app/api/reader/handle/route.ts +9 -0
  109. package/app/api/reader/me/route.ts +9 -0
  110. package/app/api/reader/rating/route.ts +9 -0
  111. package/app/api/reader/report/route.ts +9 -0
  112. package/app/api/reader/retired/route.ts +9 -0
  113. package/app/api/reader/submit/route.ts +9 -0
  114. package/app/api/reader/vote/route.ts +9 -0
  115. package/bin/papyrus-infra.mjs +20 -1
  116. package/components/automation-panel.tsx +49 -0
  117. package/components/automation-run-now.tsx +97 -0
  118. package/components/automation-view.tsx +192 -0
  119. package/components/editorial-checks-admin-panel.tsx +36 -11
  120. package/components/moderation-panel.tsx +248 -0
  121. package/components/monitoring-overview-view.tsx +241 -0
  122. package/components/monitoring-panel.tsx +40 -0
  123. package/components/news-desk-client-provider.tsx +18 -18
  124. package/components/news-desk-taxonomy-client.ts +28 -8
  125. package/components/newsletter-panel.tsx +474 -0
  126. package/components/newsletter-sections.tsx +163 -0
  127. package/components/newsroom-access-gate.tsx +15 -1
  128. package/components/newsroom-article-editor.tsx +6 -6
  129. package/components/newsroom-articles-view.tsx +6 -6
  130. package/components/newsroom-board-view.tsx +8 -3
  131. package/components/newsroom-curation-bootstrap.tsx +45 -0
  132. package/components/newsroom-ops-overview.tsx +22 -92
  133. package/components/newsroom-ops-shell.tsx +2 -2
  134. package/components/newsroom-organizer.css +33 -0
  135. package/components/newsroom-overview-skeleton.tsx +25 -0
  136. package/components/newsroom-references-view.tsx +192 -49
  137. package/components/notification-center.tsx +273 -0
  138. package/components/publication-cyclotron-panel.tsx +15 -10
  139. package/components/reader-auth-state.ts +1 -1
  140. package/components/reference-add-entry.tsx +75 -0
  141. package/components/reference-curation-controls.tsx +31 -22
  142. package/components/reference-cyclotron-priming.tsx +58 -19
  143. package/components/reference-cyclotron-suggestion.tsx +10 -6
  144. package/components/reference-priming.tsx +14 -10
  145. package/components/reference-relevance-review.tsx +3 -3
  146. package/components/reference-section-suggestion.tsx +1 -1
  147. package/components/topic-steering-workspace.tsx +223 -144
  148. package/components/use-editorial-checks.ts +12 -10
  149. package/infra/amplify-app-shell.js +94 -16
  150. package/infra/amplify-app-shell.ts +106 -18
  151. package/infra/cloud-email-config.js +32 -0
  152. package/infra/cloud-email-config.ts +39 -0
  153. package/infra/cloud-email.js +57 -0
  154. package/infra/cloud-email.test.js +69 -0
  155. package/infra/cloud-email.test.ts +66 -0
  156. package/infra/cloud-email.ts +60 -0
  157. package/infra/index.js +1 -0
  158. package/infra/secure-string-parameter-handler.js +41 -0
  159. package/infra/secure-string-parameter-handler.ts +41 -0
  160. package/infra/secure-string-parameter.js +79 -0
  161. package/infra/secure-string-parameter.ts +91 -0
  162. package/infra/site-config.js +88 -6
  163. package/infra/site-config.ts +134 -6
  164. package/lib/automation-client.ts +54 -0
  165. package/lib/automation-fixture.ts +93 -0
  166. package/lib/automation-overview.ts +232 -0
  167. package/lib/category-repository.ts +11 -9
  168. package/lib/curation-routes.ts +345 -0
  169. package/lib/cyclotron-suggestions.ts +4 -4
  170. package/lib/editorial-checks-backend.ts +1 -1
  171. package/lib/editorial-checks-client.ts +19 -1
  172. package/lib/editorial-checks-demo.ts +2 -2
  173. package/lib/editorial-checks-settings.ts +3 -0
  174. package/lib/editorial-checks.ts +8 -11
  175. package/lib/editorial-preview.ts +5 -5
  176. package/lib/monitoring-client.ts +29 -0
  177. package/lib/monitoring-overview-fixture.ts +51 -0
  178. package/lib/monitoring-overview.ts +145 -0
  179. package/lib/news-desk-session.ts +12 -21
  180. package/lib/newsletter-api.ts +418 -0
  181. package/lib/newsletter-client.ts +46 -0
  182. package/lib/newsletter-fixture.ts +184 -0
  183. package/lib/newsletter-model.ts +202 -0
  184. package/lib/newsroom-organizer-nav.ts +2 -1
  185. package/lib/prospectus-session.ts +15 -14
  186. package/lib/prospectus-sign-in-routes.ts +84 -19
  187. package/lib/prospectus-site-identity.ts +24 -1
  188. package/lib/reader-api.ts +145 -0
  189. package/lib/reader-moderation.ts +220 -0
  190. package/lib/reader-retirement-route.ts +89 -0
  191. package/lib/reader-subject.md +29 -0
  192. package/lib/reader-subject.ts +53 -0
  193. package/lib/reference-review-details.ts +71 -0
  194. package/lib/reference-review-request.ts +14 -0
  195. package/lib/relevance-decisions.ts +42 -10
  196. package/lib/relevance-status.ts +2 -2
  197. package/lib/review-client.ts +99 -0
  198. package/lib/review-fixture.ts +45 -0
  199. package/lib/review-requests.ts +238 -0
  200. package/lib/semantic-graph.ts +2 -0
  201. package/lib/site-brand-tenant.ts +11 -6
  202. package/lib/site-brand.ts +6 -3
  203. package/lib/site-origin.ts +67 -0
  204. package/lib/use-reference-review-data.ts +44 -0
  205. package/middleware.ts +14 -3
  206. package/package.json +56 -3
  207. package/routes.manifest.json +215 -2
  208. package/amplify/plugins/editorial-checks/function/requirements.txt +0 -1
  209. package/amplify/plugins/editorial-checks/papyrus.plugin.js +0 -71
  210. package/amplify/plugins/editorial-checks/papyrus.plugin.ts +0 -87
  211. package/amplify/plugins/editorial-checks/schema.js +0 -94
@@ -6,13 +6,15 @@ import { knowledgeQuery } from "../functions/knowledge-query/resource";
6
6
  import { manageUserRole } from "../functions/manage-user-role/resource";
7
7
  import { modelAttachmentUpload } from "../functions/model-attachment-upload/resource";
8
8
  import { newsroomSummary } from "../functions/newsroom-summary/resource";
9
+ import { publicForms } from "../functions/public-forms/resource";
9
10
  import { procedureAction } from "../functions/procedure-action/resource";
10
11
  import { readerSettings } from "../functions/reader-settings/resource";
11
12
  import { emailSubmissionProcessor } from "../functions/email-submission-processor/resource";
12
13
  import { sesInboundReceive } from "../functions/ses-inbound-receive/resource";
13
14
  import { slackDelivery } from "../functions/slack-delivery/resource";
14
15
  import { slackEvents } from "../functions/slack-events/resource";
15
- import { schema as leanSchema, schemaWithPlugins } from "./schema";
16
+ import { assertKnownModelGroups, schema as leanSchema, schemaExcludingGroups, schemaWithPlugins } from "./schema";
17
+ import { functionHandler, sharedFunctions } from "./function-handler";
16
18
  const authoringOperations: ("read" | "create" | "update" | "delete")[] = [
17
19
  "read",
18
20
  "create",
@@ -144,7 +146,7 @@ const schema = a.schema({
144
146
  .query()
145
147
  .returns(a.ref("UserDirectoryResult"))
146
148
  .authorization((allow) => [allow.group(adminGroup)])
147
- .handler(a.handler.function(manageUserRole)),
149
+ .handler(functionHandler("manageUserRole", manageUserRole)),
148
150
 
149
151
  grantUserRole: a
150
152
  .mutation()
@@ -156,7 +158,7 @@ const schema = a.schema({
156
158
  })
157
159
  .returns(a.ref("UserRoleMutationResult"))
158
160
  .authorization((allow) => [allow.group(adminGroup)])
159
- .handler(a.handler.function(manageUserRole)),
161
+ .handler(functionHandler("manageUserRole", manageUserRole)),
160
162
 
161
163
  revokeUserRole: a
162
164
  .mutation()
@@ -168,7 +170,7 @@ const schema = a.schema({
168
170
  })
169
171
  .returns(a.ref("UserRoleMutationResult"))
170
172
  .authorization((allow) => [allow.group(adminGroup)])
171
- .handler(a.handler.function(manageUserRole)),
173
+ .handler(functionHandler("manageUserRole", manageUserRole)),
172
174
 
173
175
  mergeUserProfiles: a
174
176
  .mutation()
@@ -181,13 +183,13 @@ const schema = a.schema({
181
183
  })
182
184
  .returns(a.ref("UserDirectoryEntry"))
183
185
  .authorization((allow) => [allow.group(adminGroup)])
184
- .handler(a.handler.function(manageUserRole)),
186
+ .handler(functionHandler("manageUserRole", manageUserRole)),
185
187
 
186
188
  getReaderSettings: a
187
189
  .query()
188
190
  .returns(a.ref("ReaderSettingsResult"))
189
191
  .authorization((allow) => [allow.authenticated()])
190
- .handler(a.handler.function(readerSettings)),
192
+ .handler(functionHandler("readerSettings", readerSettings)),
191
193
 
192
194
  updateReaderSettings: a
193
195
  .mutation()
@@ -196,7 +198,7 @@ const schema = a.schema({
196
198
  })
197
199
  .returns(a.ref("ReaderSettingsResult"))
198
200
  .authorization((allow) => [allow.authenticated()])
199
- .handler(a.handler.function(readerSettings)),
201
+ .handler(functionHandler("readerSettings", readerSettings)),
200
202
 
201
203
  SteeringActionResult: a.customType({
202
204
  ok: a.boolean().required(),
@@ -226,7 +228,7 @@ const schema = a.schema({
226
228
  })
227
229
  .returns(a.ref("SteeringActionResult"))
228
230
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
229
- .handler(a.handler.function(categoryAction)),
231
+ .handler(functionHandler("categoryAction", categoryAction)),
230
232
 
231
233
  CurationDelegationResult: a.customType({
232
234
  ok: a.boolean().required(),
@@ -351,7 +353,7 @@ const schema = a.schema({
351
353
  .authorization((allow) => [
352
354
  allow.groups(categoryWriteGroups),
353
355
  ])
354
- .handler(a.handler.function(categoryAction)),
356
+ .handler(functionHandler("categoryAction", categoryAction)),
355
357
 
356
358
  createCurationDelegation: a
357
359
  .mutation()
@@ -363,7 +365,7 @@ const schema = a.schema({
363
365
  .authorization((allow) => [
364
366
  allow.groups(categoryWriteGroups),
365
367
  ])
366
- .handler(a.handler.function(categoryAction)),
368
+ .handler(functionHandler("categoryAction", categoryAction)),
367
369
 
368
370
  revokeCurationDelegation: a
369
371
  .mutation()
@@ -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
 
379
381
  listCurationDelegations: a
380
382
  .query()
@@ -382,7 +384,7 @@ const schema = a.schema({
382
384
  .authorization((allow) => [
383
385
  allow.groups(categoryWriteGroups),
384
386
  ])
385
- .handler(a.handler.function(categoryAction)),
387
+ .handler(functionHandler("categoryAction", categoryAction)),
386
388
 
387
389
  requestCurationDelegation: a
388
390
  .mutation()
@@ -396,7 +398,7 @@ const schema = a.schema({
396
398
  .authorization((allow) => [
397
399
  allow.authenticated("identityPool"),
398
400
  ])
399
- .handler(a.handler.function(categoryAction)),
401
+ .handler(functionHandler("categoryAction", categoryAction)),
400
402
 
401
403
  approveCurationDelegation: a
402
404
  .mutation()
@@ -407,7 +409,7 @@ const schema = a.schema({
407
409
  .authorization((allow) => [
408
410
  allow.groups(categoryWriteGroups),
409
411
  ])
410
- .handler(a.handler.function(categoryAction)),
412
+ .handler(functionHandler("categoryAction", categoryAction)),
411
413
 
412
414
  denyCurationDelegation: a
413
415
  .mutation()
@@ -418,7 +420,7 @@ const schema = a.schema({
418
420
  .authorization((allow) => [
419
421
  allow.groups(categoryWriteGroups),
420
422
  ])
421
- .handler(a.handler.function(categoryAction)),
423
+ .handler(functionHandler("categoryAction", categoryAction)),
422
424
 
423
425
  getCurationDelegationStatus: a
424
426
  .query()
@@ -429,7 +431,7 @@ const schema = a.schema({
429
431
  .authorization((allow) => [
430
432
  allow.authenticated("identityPool"),
431
433
  ])
432
- .handler(a.handler.function(categoryAction)),
434
+ .handler(functionHandler("categoryAction", categoryAction)),
433
435
 
434
436
  recordDelegatedCuration: a
435
437
  .mutation()
@@ -451,7 +453,7 @@ const schema = a.schema({
451
453
  .authorization((allow) => [
452
454
  allow.authenticated("identityPool"),
453
455
  ])
454
- .handler(a.handler.function(categoryAction)),
456
+ .handler(functionHandler("categoryAction", categoryAction)),
455
457
 
456
458
  setReferenceQualityRating: a
457
459
  .mutation()
@@ -466,7 +468,7 @@ const schema = a.schema({
466
468
  .authorization((allow) => [
467
469
  allow.groups(categoryWriteGroups),
468
470
  ])
469
- .handler(a.handler.function(categoryAction)),
471
+ .handler(functionHandler("categoryAction", categoryAction)),
470
472
 
471
473
  createReferenceNote: a
472
474
  .mutation()
@@ -481,7 +483,7 @@ const schema = a.schema({
481
483
  .authorization((allow) => [
482
484
  allow.groups(categoryWriteGroups),
483
485
  ])
484
- .handler(a.handler.function(categoryAction)),
486
+ .handler(functionHandler("categoryAction", categoryAction)),
485
487
 
486
488
  moveReferenceCorpus: a
487
489
  .mutation()
@@ -496,7 +498,7 @@ const schema = a.schema({
496
498
  .authorization((allow) => [
497
499
  allow.groups(categoryWriteGroups),
498
500
  ])
499
- .handler(a.handler.function(categoryAction)),
501
+ .handler(functionHandler("categoryAction", categoryAction)),
500
502
 
501
503
  startReferenceCuration: a
502
504
  .mutation()
@@ -510,7 +512,7 @@ const schema = a.schema({
510
512
  .authorization((allow) => [
511
513
  allow.groups(categoryWriteGroups),
512
514
  ])
513
- .handler(a.handler.function(categoryAction)),
515
+ .handler(functionHandler("categoryAction", categoryAction)),
514
516
 
515
517
  getReferenceCurationStatus: a
516
518
  .query()
@@ -521,7 +523,7 @@ const schema = a.schema({
521
523
  .authorization((allow) => [
522
524
  allow.groups(categoryWriteGroups),
523
525
  ])
524
- .handler(a.handler.function(categoryAction)),
526
+ .handler(functionHandler("categoryAction", categoryAction)),
525
527
 
526
528
  createCategorySetDraft: a
527
529
  .mutation()
@@ -533,7 +535,7 @@ const schema = a.schema({
533
535
  })
534
536
  .returns(a.ref("CategorySetDraftActionResult"))
535
537
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
536
- .handler(a.handler.function(categoryAction)),
538
+ .handler(functionHandler("categoryAction", categoryAction)),
537
539
 
538
540
  promoteCategorySetDraft: a
539
541
  .mutation()
@@ -544,7 +546,7 @@ const schema = a.schema({
544
546
  })
545
547
  .returns(a.ref("CategorySetDraftActionResult"))
546
548
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
547
- .handler(a.handler.function(categoryAction)),
549
+ .handler(functionHandler("categoryAction", categoryAction)),
548
550
 
549
551
  discardCategorySetDraft: a
550
552
  .mutation()
@@ -555,7 +557,7 @@ const schema = a.schema({
555
557
  })
556
558
  .returns(a.ref("CategorySetDraftActionResult"))
557
559
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
558
- .handler(a.handler.function(categoryAction)),
560
+ .handler(functionHandler("categoryAction", categoryAction)),
559
561
 
560
562
  createDraftCategory: a
561
563
  .mutation()
@@ -571,7 +573,7 @@ const schema = a.schema({
571
573
  })
572
574
  .returns(a.ref("SteeringActionResult"))
573
575
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
574
- .handler(a.handler.function(categoryAction)),
576
+ .handler(functionHandler("categoryAction", categoryAction)),
575
577
 
576
578
  updateDraftCategory: a
577
579
  .mutation()
@@ -587,7 +589,7 @@ const schema = a.schema({
587
589
  })
588
590
  .returns(a.ref("SteeringActionResult"))
589
591
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
590
- .handler(a.handler.function(categoryAction)),
592
+ .handler(functionHandler("categoryAction", categoryAction)),
591
593
 
592
594
  archiveDraftCategory: a
593
595
  .mutation()
@@ -598,7 +600,7 @@ const schema = a.schema({
598
600
  })
599
601
  .returns(a.ref("SteeringActionResult"))
600
602
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
601
- .handler(a.handler.function(categoryAction)),
603
+ .handler(functionHandler("categoryAction", categoryAction)),
602
604
 
603
605
  reviewReferenceTopicLabel: a
604
606
  .mutation()
@@ -612,7 +614,7 @@ const schema = a.schema({
612
614
  })
613
615
  .returns(a.ref("TopicLabelActionResult"))
614
616
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
615
- .handler(a.handler.function(categoryAction)),
617
+ .handler(functionHandler("categoryAction", categoryAction)),
616
618
 
617
619
  NewsroomSummary: a.customType({
618
620
  generatedAt: a.datetime().required(),
@@ -632,42 +634,56 @@ const schema = a.schema({
632
634
  .query()
633
635
  .returns(a.ref("NewsroomSummary"))
634
636
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
635
- .handler(a.handler.function(newsroomSummary)),
637
+ .handler(functionHandler("newsroomSummary", newsroomSummary)),
636
638
 
637
639
  deriveMarkus: a
638
640
  .query()
639
641
  .arguments({ input: a.json().required() })
640
642
  .returns(a.json())
641
643
  .authorization((allow) => [allow.groups(contentWriteGroups)])
642
- .handler(a.handler.function(contentActions)),
644
+ .handler(functionHandler("contentActions", contentActions)),
645
+
646
+ intakePendingReferences: a
647
+ .mutation()
648
+ .arguments({ input: a.json().required() })
649
+ .returns(a.json())
650
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
651
+ .handler(functionHandler("contentActions", contentActions)),
643
652
 
644
653
  saveItemDraft: a
645
654
  .mutation()
646
655
  .arguments({ input: a.json().required() })
647
656
  .returns(a.json())
648
657
  .authorization((allow) => [allow.groups(contentWriteGroups)])
649
- .handler(a.handler.function(contentActions)),
658
+ .handler(functionHandler("contentActions", contentActions)),
650
659
 
651
660
  publishItem: a
652
661
  .mutation()
653
662
  .arguments({ input: a.json().required() })
654
663
  .returns(a.json())
655
664
  .authorization((allow) => [allow.groups(contentWriteGroups)])
656
- .handler(a.handler.function(contentActions)),
665
+ .handler(functionHandler("contentActions", contentActions)),
666
+
667
+ moveStoryStage: a
668
+ .mutation()
669
+ .arguments({ input: a.json().required() })
670
+ .returns(a.json())
671
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
672
+ .handler(functionHandler("contentActions", contentActions)),
657
673
 
658
674
  unpublishItem: a
659
675
  .mutation()
660
676
  .arguments({ input: a.json().required() })
661
677
  .returns(a.json())
662
678
  .authorization((allow) => [allow.groups(contentWriteGroups)])
663
- .handler(a.handler.function(contentActions)),
679
+ .handler(functionHandler("contentActions", contentActions)),
664
680
 
665
681
  requestStagingBuild: a
666
682
  .mutation()
667
683
  .arguments({ input: a.json().required() })
668
684
  .returns(a.json())
669
685
  .authorization((allow) => [allow.groups(contentWriteGroups)])
670
- .handler(a.handler.function(contentActions)),
686
+ .handler(functionHandler("contentActions", contentActions)),
671
687
 
672
688
  knowledgeQuery: a
673
689
  .query()
@@ -676,7 +692,7 @@ const schema = a.schema({
676
692
  })
677
693
  .returns(a.json())
678
694
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
679
- .handler(a.handler.function(knowledgeQuery)),
695
+ .handler(functionHandler("knowledgeQuery", knowledgeQuery)),
680
696
 
681
697
  updateNewsroomSummary: a
682
698
  .mutation()
@@ -687,7 +703,7 @@ const schema = a.schema({
687
703
  })
688
704
  .returns(a.ref("NewsroomSummary"))
689
705
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
690
- .handler(a.handler.function(newsroomSummary)),
706
+ .handler(functionHandler("newsroomSummary", newsroomSummary)),
691
707
 
692
708
  ModelAttachmentUploadSlot: a.customType({
693
709
  ok: a.boolean().required(),
@@ -747,7 +763,7 @@ const schema = a.schema({
747
763
  })
748
764
  .returns(a.ref("ModelAttachmentUploadSlot"))
749
765
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
750
- .handler(a.handler.function(modelAttachmentUpload)),
766
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
751
767
 
752
768
  completeModelAttachmentUpload: a
753
769
  .mutation()
@@ -769,7 +785,7 @@ const schema = a.schema({
769
785
  })
770
786
  .returns(a.ref("ModelAttachment"))
771
787
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
772
- .handler(a.handler.function(modelAttachmentUpload)),
788
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
773
789
 
774
790
  abortModelAttachmentUpload: a
775
791
  .mutation()
@@ -791,7 +807,7 @@ const schema = a.schema({
791
807
  })
792
808
  .returns(a.ref("ModelAttachmentUploadAbortResult"))
793
809
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
794
- .handler(a.handler.function(modelAttachmentUpload)),
810
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
795
811
 
796
812
  createModelAttachmentDownload: a
797
813
  .mutation()
@@ -800,7 +816,7 @@ const schema = a.schema({
800
816
  })
801
817
  .returns(a.ref("ModelAttachmentDownloadSlot"))
802
818
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
803
- .handler(a.handler.function(modelAttachmentUpload)),
819
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
804
820
 
805
821
  AssignmentActionResult: a.customType({
806
822
  ok: a.boolean().required(),
@@ -895,7 +911,7 @@ const schema = a.schema({
895
911
  })
896
912
  .returns(a.ref("AssignmentContext").array().required())
897
913
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
898
- .handler(a.handler.function(assignmentAction)),
914
+ .handler(functionHandler("assignmentAction", assignmentAction)),
899
915
 
900
916
  listAssignmentQueue: a
901
917
  .query()
@@ -906,7 +922,7 @@ const schema = a.schema({
906
922
  })
907
923
  .returns(a.ref("AssignmentContext").array().required())
908
924
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
909
- .handler(a.handler.function(assignmentAction)),
925
+ .handler(functionHandler("assignmentAction", assignmentAction)),
910
926
 
911
927
  getEditorialContext: a
912
928
  .query()
@@ -916,10 +932,11 @@ const schema = a.schema({
916
932
  storyLineageId: a.id(),
917
933
  assignmentId: a.id(),
918
934
  maxCharacters: a.integer(),
935
+ optionalPublicationDoctrine: a.boolean(),
919
936
  })
920
937
  .returns(a.json().required())
921
938
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
922
- .handler(a.handler.function(assignmentAction)),
939
+ .handler(functionHandler("assignmentAction", assignmentAction)),
923
940
 
924
941
  getAssignmentContext: a
925
942
  .query()
@@ -928,7 +945,7 @@ const schema = a.schema({
928
945
  })
929
946
  .returns(a.ref("AssignmentContext"))
930
947
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
931
- .handler(a.handler.function(assignmentAction)),
948
+ .handler(functionHandler("assignmentAction", assignmentAction)),
932
949
 
933
950
  claimAssignment: a
934
951
  .mutation()
@@ -945,7 +962,7 @@ const schema = a.schema({
945
962
  })
946
963
  .returns(a.ref("AssignmentActionResult"))
947
964
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
948
- .handler(a.handler.function(assignmentAction)),
965
+ .handler(functionHandler("assignmentAction", assignmentAction)),
949
966
 
950
967
  releaseAssignment: a
951
968
  .mutation()
@@ -957,7 +974,7 @@ const schema = a.schema({
957
974
  })
958
975
  .returns(a.ref("AssignmentActionResult"))
959
976
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
960
- .handler(a.handler.function(assignmentAction)),
977
+ .handler(functionHandler("assignmentAction", assignmentAction)),
961
978
 
962
979
  completeAssignment: a
963
980
  .mutation()
@@ -969,7 +986,7 @@ const schema = a.schema({
969
986
  })
970
987
  .returns(a.ref("AssignmentActionResult"))
971
988
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
972
- .handler(a.handler.function(assignmentAction)),
989
+ .handler(functionHandler("assignmentAction", assignmentAction)),
973
990
 
974
991
  cancelAssignment: a
975
992
  .mutation()
@@ -981,7 +998,7 @@ const schema = a.schema({
981
998
  })
982
999
  .returns(a.ref("AssignmentActionResult"))
983
1000
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
984
- .handler(a.handler.function(assignmentAction)),
1001
+ .handler(functionHandler("assignmentAction", assignmentAction)),
985
1002
 
986
1003
  reopenAssignment: a
987
1004
  .mutation()
@@ -993,7 +1010,7 @@ const schema = a.schema({
993
1010
  })
994
1011
  .returns(a.ref("AssignmentActionResult"))
995
1012
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
996
- .handler(a.handler.function(assignmentAction)),
1013
+ .handler(functionHandler("assignmentAction", assignmentAction)),
997
1014
 
998
1015
  retryImmediateAssignment: a
999
1016
  .mutation()
@@ -1005,13 +1022,13 @@ const schema = a.schema({
1005
1022
  })
1006
1023
  .returns(a.ref("AssignmentActionResult"))
1007
1024
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
1008
- .handler(a.handler.function(assignmentAction)),
1025
+ .handler(functionHandler("assignmentAction", assignmentAction)),
1009
1026
 
1010
1027
  listNewsroomProcedureDefinitions: a
1011
1028
  .query()
1012
1029
  .returns(a.json())
1013
1030
  .authorization((allow) => [allow.group(adminGroup)])
1014
- .handler(a.handler.function(procedureAction)),
1031
+ .handler(functionHandler("procedureAction", procedureAction)),
1015
1032
 
1016
1033
  getNewsroomProcedureDefinition: a
1017
1034
  .query()
@@ -1021,7 +1038,7 @@ const schema = a.schema({
1021
1038
  })
1022
1039
  .returns(a.json())
1023
1040
  .authorization((allow) => [allow.group(adminGroup)])
1024
- .handler(a.handler.function(procedureAction)),
1041
+ .handler(functionHandler("procedureAction", procedureAction)),
1025
1042
 
1026
1043
  saveNewsroomProcedureDefinition: a
1027
1044
  .mutation()
@@ -1030,7 +1047,7 @@ const schema = a.schema({
1030
1047
  })
1031
1048
  .returns(a.json())
1032
1049
  .authorization((allow) => [allow.group(adminGroup)])
1033
- .handler(a.handler.function(procedureAction)),
1050
+ .handler(functionHandler("procedureAction", procedureAction)),
1034
1051
 
1035
1052
  saveNewsroomProcedureVersionDraft: a
1036
1053
  .mutation()
@@ -1039,7 +1056,7 @@ const schema = a.schema({
1039
1056
  })
1040
1057
  .returns(a.json())
1041
1058
  .authorization((allow) => [allow.group(adminGroup)])
1042
- .handler(a.handler.function(procedureAction)),
1059
+ .handler(functionHandler("procedureAction", procedureAction)),
1043
1060
 
1044
1061
  publishNewsroomProcedureVersion: a
1045
1062
  .mutation()
@@ -1048,7 +1065,7 @@ const schema = a.schema({
1048
1065
  })
1049
1066
  .returns(a.json())
1050
1067
  .authorization((allow) => [allow.group(adminGroup)])
1051
- .handler(a.handler.function(procedureAction)),
1068
+ .handler(functionHandler("procedureAction", procedureAction)),
1052
1069
 
1053
1070
  startNewsroomProcedureRun: a
1054
1071
  .mutation()
@@ -1063,7 +1080,7 @@ const schema = a.schema({
1063
1080
  })
1064
1081
  .returns(a.json())
1065
1082
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
1066
- .handler(a.handler.function(procedureAction)),
1083
+ .handler(functionHandler("procedureAction", procedureAction)),
1067
1084
 
1068
1085
  getNewsroomProcedureRun: a
1069
1086
  .query()
@@ -1072,7 +1089,7 @@ const schema = a.schema({
1072
1089
  })
1073
1090
  .returns(a.json())
1074
1091
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
1075
- .handler(a.handler.function(procedureAction)),
1092
+ .handler(functionHandler("procedureAction", procedureAction)),
1076
1093
 
1077
1094
  listNewsroomProcedureRunsByProcedure: a
1078
1095
  .query()
@@ -1081,7 +1098,7 @@ const schema = a.schema({
1081
1098
  })
1082
1099
  .returns(a.json())
1083
1100
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
1084
- .handler(a.handler.function(procedureAction)),
1101
+ .handler(functionHandler("procedureAction", procedureAction)),
1085
1102
 
1086
1103
  Assignment: a
1087
1104
  .model({
@@ -1231,6 +1248,8 @@ const schema = a.schema({
1231
1248
  error: a.json(),
1232
1249
  attempt: a.integer(),
1233
1250
  newsroomFeedKey: a.string(),
1251
+ usage: a.json(),
1252
+ costUsd: a.float(),
1234
1253
  })
1235
1254
  .secondaryIndexes((index) => [
1236
1255
  index("procedureId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByProcedureAndRequestedAt"),
@@ -1243,6 +1262,77 @@ const schema = a.schema({
1243
1262
  allow.group(adminGroup).to(authoringOperations),
1244
1263
  ]),
1245
1264
 
1265
+ Automation: a
1266
+ .model({
1267
+ id: a.id().required(),
1268
+ title: a.string().required(),
1269
+ description: a.string(),
1270
+ enabled: a.boolean().required(),
1271
+ trigger: a.json().required(),
1272
+ procedureKey: a.string().required(),
1273
+ inputTemplate: a.json(),
1274
+ limits: a.json(),
1275
+ createdBy: a.string(),
1276
+ createdAt: a.datetime().required(),
1277
+ updatedBy: a.string(),
1278
+ updatedAt: a.datetime().required(),
1279
+ })
1280
+ .authorization((allow) => [
1281
+ allow.group("editor").to(["read", "create", "update"]),
1282
+ allow.group(adminGroup).to(authoringOperations),
1283
+ ]),
1284
+
1285
+ /** A human review point raised by a step on any item (PPY-ab6a50). Review is not a story state. */
1286
+ ReviewRequest: a
1287
+ .model({
1288
+ id: a.id().required(),
1289
+ subject: a.json().required(),
1290
+ mode: a.string().required(),
1291
+ reason: a.string().required(),
1292
+ ask: a.string(),
1293
+ raisedBy: a.string().required(),
1294
+ raisedAt: a.datetime().required(),
1295
+ deadline: a.datetime(),
1296
+ state: a.string().required(),
1297
+ answer: a.json(),
1298
+ links: a.json(),
1299
+ history: a.json(),
1300
+ appliedIn: a.json(),
1301
+ updatedAt: a.datetime().required(),
1302
+ })
1303
+ .authorization((allow) => [
1304
+ allow.group("editor").to(["read", "create", "update"]),
1305
+ allow.group(adminGroup).to(authoringOperations),
1306
+ ]),
1307
+
1308
+ /** One user's read mark on one review request; id is "<userKey>#<requestId>". */
1309
+ ReviewReadMark: a
1310
+ .model({
1311
+ id: a.id().required(),
1312
+ requestId: a.string().required(),
1313
+ userKey: a.string().required(),
1314
+ readAt: a.datetime().required(),
1315
+ })
1316
+ .authorization((allow) => [
1317
+ allow.groups(["editor", adminGroup]).to(["read", "create", "update"]),
1318
+ ]),
1319
+
1320
+ /** Who is told about review requests: scope default, mode or automation. Changed by data, not code. */
1321
+ ReviewRecipientRule: a
1322
+ .model({
1323
+ id: a.id().required(),
1324
+ scope: a.string().required(),
1325
+ key: a.string(),
1326
+ roles: a.string().array(),
1327
+ emails: a.string().array(),
1328
+ updatedBy: a.string(),
1329
+ updatedAt: a.datetime().required(),
1330
+ })
1331
+ .authorization((allow) => [
1332
+ allow.group("editor").to(["read"]),
1333
+ allow.group(adminGroup).to(authoringOperations),
1334
+ ]),
1335
+
1246
1336
  NewsroomSection: a
1247
1337
  .model({
1248
1338
  id: a.id().required(),
@@ -2278,6 +2368,7 @@ const schema = a.schema({
2278
2368
  allow.resource(modelAttachmentUpload),
2279
2369
  allow.resource(newsroomSummary),
2280
2370
  allow.resource(procedureAction),
2371
+ allow.resource(publicForms).to(["mutate"]),
2281
2372
  allow.resource(sesInboundReceive),
2282
2373
  allow.resource(emailSubmissionProcessor),
2283
2374
  allow.resource(slackEvents),
@@ -2290,10 +2381,15 @@ export type Schema = ClientSchema<typeof schema>;
2290
2381
  * The site's data API. Amplify allows one `defineData` per backend and registers it when called, so this is
2291
2382
  * a function: a site without plugins passes none and gets exactly the base schema.
2292
2383
  */
2293
- export function defineSiteData(pluginDefinitions: Record<string, unknown> = {}) {
2384
+ export function defineSiteData(pluginDefinitions: Record<string, unknown> = {}, excludeModelGroups: readonly string[] = []) {
2385
+ assertKnownModelGroups(excludeModelGroups);
2386
+ const hasPlugins = Object.keys(pluginDefinitions).length > 0;
2294
2387
  return defineData({
2295
2388
  name: "PapyrusCmsApi",
2296
- schema: Object.keys(pluginDefinitions).length === 0 ? leanSchema : schemaWithPlugins(pluginDefinitions),
2389
+ functions: sharedFunctions(),
2390
+ schema: excludeModelGroups.length > 0
2391
+ ? schemaExcludingGroups(excludeModelGroups, pluginDefinitions)
2392
+ : hasPlugins ? schemaWithPlugins(pluginDefinitions) : leanSchema,
2297
2393
  authorizationModes: {
2298
2394
  defaultAuthorizationMode: "userPool",
2299
2395
  apiKeyAuthorizationMode: {