@anthusai/papyrus 3.2.0 → 3.3.0

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.
@@ -589,6 +589,12 @@ const schema = a.schema({
589
589
  .returns(a.json())
590
590
  .authorization((allow) => [allow.groups(contentWriteGroups)])
591
591
  .handler(a.handler.function(contentActions)),
592
+ intakePendingReferences: a
593
+ .mutation()
594
+ .arguments({ input: a.json().required() })
595
+ .returns(a.json())
596
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
597
+ .handler(a.handler.function(contentActions)),
592
598
  saveItemDraft: a
593
599
  .mutation()
594
600
  .arguments({ input: a.json().required() })
@@ -641,6 +641,13 @@ const schema = a.schema({
641
641
  .authorization((allow) => [allow.groups(contentWriteGroups)])
642
642
  .handler(a.handler.function(contentActions)),
643
643
 
644
+ intakePendingReferences: a
645
+ .mutation()
646
+ .arguments({ input: a.json().required() })
647
+ .returns(a.json())
648
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
649
+ .handler(a.handler.function(contentActions)),
650
+
644
651
  saveItemDraft: a
645
652
  .mutation()
646
653
  .arguments({ input: a.json().required() })
@@ -496,6 +496,12 @@ const baseDefinitions = {
496
496
  .returns(a.json())
497
497
  .authorization((allow) => [allow.groups(contentWriteGroups)])
498
498
  .handler(a.handler.function(contentActions)),
499
+ intakePendingReferences: a
500
+ .mutation()
501
+ .arguments({ input: a.json().required() })
502
+ .returns(a.json())
503
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
504
+ .handler(a.handler.function(contentActions)),
499
505
  saveItemDraft: a
500
506
  .mutation()
501
507
  .arguments({ input: a.json().required() })
@@ -542,6 +542,13 @@ const baseDefinitions = {
542
542
  .authorization((allow) => [allow.groups(contentWriteGroups)])
543
543
  .handler(a.handler.function(contentActions)),
544
544
 
545
+ intakePendingReferences: a
546
+ .mutation()
547
+ .arguments({ input: a.json().required() })
548
+ .returns(a.json())
549
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
550
+ .handler(a.handler.function(contentActions)),
551
+
545
552
  saveItemDraft: a
546
553
  .mutation()
547
554
  .arguments({ input: a.json().required() })
@@ -23,6 +23,7 @@ from papyrus_content.rebuild_trigger import (
23
23
  trigger_staging_build,
24
24
  )
25
25
  from papyrus_content.story_reporting import save_story_version
26
+ from papyrus_content.reference_intake import IntakeError, intake_references
26
27
  from papyrus_content.publishing import (
27
28
  ItemFields,
28
29
  PublishError,
@@ -299,6 +300,12 @@ def handler(event, context):
299
300
  arguments = parse_input(event["arguments"]["input"])
300
301
  actor = actor_from_event(event)
301
302
  try:
303
+ if field == "intakePendingReferences":
304
+ client, _claims = create_authoring_client()
305
+ try:
306
+ return intake_references(client, arguments, event.get("identity") or {})
307
+ except IntakeError as error:
308
+ return {"ok": False, "errors": [{"code": "intake-rejected", "message": str(error)}]}
302
309
  if field == "deriveMarkus":
303
310
  return derive_markus_action(arguments)
304
311
  if field == "saveItemDraft":
@@ -310,6 +310,9 @@ export function defineSiteBackend(papyrusSite) {
310
310
  grantNewsroomReadWrite(backend.newsroomSummary.resources.lambda);
311
311
  const contentActionsLambda = backend.contentActions.resources.lambda;
312
312
  grantNewsroomReadWriteDelete(contentActionsLambda);
313
+ // AppSync validates the token; pending intake additionally binds its actor
314
+ // and publication to this deployment's pool and existing API endpoint.
315
+ contentActionsLambda.addEnvironment("PAPYRUS_USER_POOL_ISSUER", `https://cognito-idp.${Stack.of(contentActionsLambda).region}.amazonaws.com/${backend.auth.resources.userPool.userPoolId}`);
313
316
  contentActionsLambda.addEnvironment("PAPYRUS_GRAPHQL_ENDPOINT", backend.data.resources.cfnResources.cfnGraphqlApi.attrGraphQlUrl);
314
317
  contentActionsLambda.addToRolePolicy(new PolicyStatement({
315
318
  actions: ["appsync:GraphQL"],
@@ -396,6 +396,12 @@ export function defineSiteBackend(papyrusSite: PapyrusSite) {
396
396
  grantNewsroomReadWrite(backend.newsroomSummary.resources.lambda as LambdaFunction);
397
397
  const contentActionsLambda = backend.contentActions.resources.lambda as LambdaFunction;
398
398
  grantNewsroomReadWriteDelete(contentActionsLambda);
399
+ // AppSync validates the token; pending intake additionally binds its actor
400
+ // and publication to this deployment's pool and existing API endpoint.
401
+ contentActionsLambda.addEnvironment(
402
+ "PAPYRUS_USER_POOL_ISSUER",
403
+ `https://cognito-idp.${Stack.of(contentActionsLambda).region}.amazonaws.com/${backend.auth.resources.userPool.userPoolId}`,
404
+ );
399
405
  contentActionsLambda.addEnvironment(
400
406
  "PAPYRUS_GRAPHQL_ENDPOINT",
401
407
  backend.data.resources.cfnResources.cfnGraphqlApi.attrGraphQlUrl,
package/package.json CHANGED
@@ -395,7 +395,7 @@
395
395
  "optional": true
396
396
  }
397
397
  },
398
- "version": "3.2.0",
398
+ "version": "3.3.0",
399
399
  "dependencies": {
400
400
  "@aws-amplify/adapter-nextjs": "^1.7.3",
401
401
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.2.0",
2
+ "version": "3.3.0",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",