@anthusai/papyrus 5.0.0 → 5.1.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.
- package/amplify/data/resource.js +6 -0
- package/amplify/data/resource.ts +7 -0
- package/amplify/data/schema.js +6 -0
- package/amplify/data/schema.ts +7 -0
- package/amplify/functions/content-actions/handler.py +15 -0
- package/amplify/site-backend.js +5 -0
- package/amplify/site-backend.ts +5 -0
- package/package.json +1 -1
- package/routes.manifest.json +1 -1
package/amplify/data/resource.js
CHANGED
|
@@ -607,6 +607,12 @@ const schema = a.schema({
|
|
|
607
607
|
.returns(a.json())
|
|
608
608
|
.authorization((allow) => [allow.groups(contentWriteGroups)])
|
|
609
609
|
.handler(a.handler.function(contentActions)),
|
|
610
|
+
moveStoryStage: a
|
|
611
|
+
.mutation()
|
|
612
|
+
.arguments({ input: a.json().required() })
|
|
613
|
+
.returns(a.json())
|
|
614
|
+
.authorization((allow) => [allow.groups(contentWriteGroups)])
|
|
615
|
+
.handler(a.handler.function(contentActions)),
|
|
610
616
|
unpublishItem: a
|
|
611
617
|
.mutation()
|
|
612
618
|
.arguments({ input: a.json().required() })
|
package/amplify/data/resource.ts
CHANGED
|
@@ -662,6 +662,13 @@ const schema = a.schema({
|
|
|
662
662
|
.authorization((allow) => [allow.groups(contentWriteGroups)])
|
|
663
663
|
.handler(a.handler.function(contentActions)),
|
|
664
664
|
|
|
665
|
+
moveStoryStage: a
|
|
666
|
+
.mutation()
|
|
667
|
+
.arguments({ input: a.json().required() })
|
|
668
|
+
.returns(a.json())
|
|
669
|
+
.authorization((allow) => [allow.groups(contentWriteGroups)])
|
|
670
|
+
.handler(a.handler.function(contentActions)),
|
|
671
|
+
|
|
665
672
|
unpublishItem: a
|
|
666
673
|
.mutation()
|
|
667
674
|
.arguments({ input: a.json().required() })
|
package/amplify/data/schema.js
CHANGED
|
@@ -515,6 +515,12 @@ const baseDefinitions = {
|
|
|
515
515
|
.returns(a.json())
|
|
516
516
|
.authorization((allow) => [allow.groups(contentWriteGroups)])
|
|
517
517
|
.handler(a.handler.function(contentActions)),
|
|
518
|
+
moveStoryStage: a
|
|
519
|
+
.mutation()
|
|
520
|
+
.arguments({ input: a.json().required() })
|
|
521
|
+
.returns(a.json())
|
|
522
|
+
.authorization((allow) => [allow.groups(contentWriteGroups)])
|
|
523
|
+
.handler(a.handler.function(contentActions)),
|
|
518
524
|
unpublishItem: a
|
|
519
525
|
.mutation()
|
|
520
526
|
.arguments({ input: a.json().required() })
|
package/amplify/data/schema.ts
CHANGED
|
@@ -564,6 +564,13 @@ const baseDefinitions = {
|
|
|
564
564
|
.authorization((allow) => [allow.groups(contentWriteGroups)])
|
|
565
565
|
.handler(a.handler.function(contentActions)),
|
|
566
566
|
|
|
567
|
+
moveStoryStage: a
|
|
568
|
+
.mutation()
|
|
569
|
+
.arguments({ input: a.json().required() })
|
|
570
|
+
.returns(a.json())
|
|
571
|
+
.authorization((allow) => [allow.groups(contentWriteGroups)])
|
|
572
|
+
.handler(a.handler.function(contentActions)),
|
|
573
|
+
|
|
567
574
|
unpublishItem: a
|
|
568
575
|
.mutation()
|
|
569
576
|
.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.publication import ensure_publication_from_environment
|
|
26
27
|
from papyrus_content.reference_intake import IntakeError, intake_references
|
|
27
28
|
from papyrus_content.publishing import (
|
|
28
29
|
ItemFields,
|
|
@@ -151,6 +152,7 @@ def schedule_unpurged_invalidation(keys: list[str]) -> None:
|
|
|
151
152
|
|
|
152
153
|
def run_deploy_render_task(client) -> dict:
|
|
153
154
|
"""Render every published page after a backend deploy, then report drift (a dry run: nothing is deleted)."""
|
|
155
|
+
ensure_publication_from_environment(client)
|
|
154
156
|
context = projection_context(client)
|
|
155
157
|
report = deploy_render(context)
|
|
156
158
|
print(drift_metric_line(report))
|
|
@@ -284,6 +286,17 @@ def unpublish_item_action(arguments: dict, actor: str) -> dict:
|
|
|
284
286
|
return response
|
|
285
287
|
|
|
286
288
|
|
|
289
|
+
def move_story_stage_action(arguments: dict, actor: str) -> dict:
|
|
290
|
+
from papyrus_content.story_reporting import move_story_stage
|
|
291
|
+
|
|
292
|
+
client, _claims = create_authoring_client()
|
|
293
|
+
try:
|
|
294
|
+
result = move_story_stage(client, arguments["lineageId"], arguments["stage"], actor=actor, reason=arguments.get("reason"))
|
|
295
|
+
except ValueError as error:
|
|
296
|
+
return {"ok": False, "errors": [{"code": "invalid-stage", "message": str(error), "line": None}]}
|
|
297
|
+
return {"ok": True, **result}
|
|
298
|
+
|
|
299
|
+
|
|
287
300
|
def request_staging_build_action() -> dict:
|
|
288
301
|
cms_app_id = (os.environ.get("PAPYRUS_CMS_AMPLIFY_APP_ID") or "").strip()
|
|
289
302
|
if not cms_app_id:
|
|
@@ -312,6 +325,8 @@ def handler(event, context):
|
|
|
312
325
|
return save_item_draft_action(arguments, actor)
|
|
313
326
|
if field == "publishItem":
|
|
314
327
|
return publish_item_action(arguments, actor)
|
|
328
|
+
if field == "moveStoryStage":
|
|
329
|
+
return move_story_stage_action(arguments, actor)
|
|
315
330
|
if field == "unpublishItem":
|
|
316
331
|
return unpublish_item_action(arguments, actor)
|
|
317
332
|
if field == "requestStagingBuild":
|
package/amplify/site-backend.js
CHANGED
|
@@ -313,6 +313,11 @@ export function defineSiteBackend(papyrusSite) {
|
|
|
313
313
|
grantNewsroomReadWrite(backend.newsroomSummary.resources.lambda);
|
|
314
314
|
const contentActionsLambda = backend.contentActions.resources.lambda;
|
|
315
315
|
grantNewsroomReadWriteDelete(contentActionsLambda);
|
|
316
|
+
if ((activeBrand?.corpusKey ?? "").trim() !== "") {
|
|
317
|
+
// A deploy creates the publication's canonical corpus from the brand when the backend has none.
|
|
318
|
+
contentActionsLambda.addEnvironment("PAPYRUS_PUBLICATION_CORPUS_KEY", (activeBrand?.corpusKey ?? "").trim());
|
|
319
|
+
contentActionsLambda.addEnvironment("PAPYRUS_PUBLICATION_NAME", (activeBrand?.publicationName ?? activeBrand?.corpusKey ?? "").trim());
|
|
320
|
+
}
|
|
316
321
|
// AppSync validates the token; pending intake additionally binds its actor
|
|
317
322
|
// and publication to this deployment's pool and existing API endpoint.
|
|
318
323
|
contentActionsLambda.addEnvironment("PAPYRUS_USER_POOL_ISSUER", `https://cognito-idp.${Stack.of(contentActionsLambda).region}.amazonaws.com/${backend.auth.resources.userPool.userPoolId}`);
|
package/amplify/site-backend.ts
CHANGED
|
@@ -399,6 +399,11 @@ export function defineSiteBackend(papyrusSite: PapyrusSite) {
|
|
|
399
399
|
grantNewsroomReadWrite(backend.newsroomSummary.resources.lambda as LambdaFunction);
|
|
400
400
|
const contentActionsLambda = backend.contentActions.resources.lambda as LambdaFunction;
|
|
401
401
|
grantNewsroomReadWriteDelete(contentActionsLambda);
|
|
402
|
+
if ((activeBrand?.corpusKey ?? "").trim() !== "") {
|
|
403
|
+
// A deploy creates the publication's canonical corpus from the brand when the backend has none.
|
|
404
|
+
contentActionsLambda.addEnvironment("PAPYRUS_PUBLICATION_CORPUS_KEY", (activeBrand?.corpusKey ?? "").trim());
|
|
405
|
+
contentActionsLambda.addEnvironment("PAPYRUS_PUBLICATION_NAME", (activeBrand?.publicationName ?? activeBrand?.corpusKey ?? "").trim());
|
|
406
|
+
}
|
|
402
407
|
// AppSync validates the token; pending intake additionally binds its actor
|
|
403
408
|
// and publication to this deployment's pool and existing API endpoint.
|
|
404
409
|
contentActionsLambda.addEnvironment(
|
package/package.json
CHANGED
package/routes.manifest.json
CHANGED